Basic movement. Various bug fixes.
This commit is contained in:
parent
cd80ebacea
commit
b8aa460221
|
@ -101,6 +101,8 @@ static void init(void)
|
|||
|
||||
world.bob->checkpoints[0].x = world.bob->x;
|
||||
world.bob->checkpoints[0].y = world.bob->y;
|
||||
|
||||
superAnimate();
|
||||
}
|
||||
|
||||
static void tick(void)
|
||||
|
|
|
@ -176,7 +176,7 @@ static void touch(Entity *other)
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (s->isLocked && !dev.cheatKeys)
|
||||
{
|
||||
if (isClosed())
|
||||
|
@ -201,7 +201,7 @@ static void touch(Entity *other)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (s->state != DOOR_OPEN)
|
||||
{
|
||||
playSound(SND_DOOR_START, CH_MECHANICAL);
|
||||
|
@ -272,7 +272,8 @@ static void load(cJSON *root)
|
|||
|
||||
s = (Structure*)self;
|
||||
|
||||
s->active = cJSON_GetObjectItem(root, "isLocked")->valueint;
|
||||
s->isLocked = cJSON_GetObjectItem(root, "isLocked")->valueint;
|
||||
s->active = s->isLocked;
|
||||
if (cJSON_GetObjectItem(root, "requiredKey"))
|
||||
{
|
||||
STRNCPY(s->requiredItem, cJSON_GetObjectItem(root, "requiredKey")->valuestring, MAX_NAME_LENGTH);
|
||||
|
|
|
@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "main.h"
|
||||
|
||||
static long capFrameRate(const long then);
|
||||
static void handleCommandLine(int argc, const char *argv[]);
|
||||
static void handleCommandLine(int argc, char *argv[]);
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
long then, nextSecond, frames;
|
||||
|
||||
|
@ -31,6 +31,8 @@ int main(int argc, const char *argv[])
|
|||
|
||||
srand(time(NULL));
|
||||
|
||||
init18N(argc, argv);
|
||||
|
||||
initSDL();
|
||||
|
||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG);
|
||||
|
@ -90,7 +92,7 @@ static long capFrameRate(const long then)
|
|||
return SDL_GetTicks();
|
||||
}
|
||||
|
||||
static void handleCommandLine(int argc, const char *argv[])
|
||||
static void handleCommandLine(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ extern void handleInput(void);
|
|||
extern void prepareScene(void);
|
||||
extern void presentScene(void);
|
||||
extern void initAtlasTest(void);
|
||||
extern void init18N(int argc, char *argv[]);
|
||||
|
||||
App app;
|
||||
Camera camera;
|
||||
|
|
|
@ -20,6 +20,32 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "init.h"
|
||||
|
||||
void init18N(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int languageId = -1;
|
||||
|
||||
setlocale(LC_NUMERIC, "");
|
||||
|
||||
for (i = 1 ; i < argc ; i++)
|
||||
{
|
||||
if (strcmp(argv[i], "-language") == 0)
|
||||
{
|
||||
languageId = i + 1;
|
||||
|
||||
if (languageId >= argc)
|
||||
{
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "You must specify a language to use with -language. Using default.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setLanguage("blobwarsAttrition", languageId == -1 ? NULL : argv[languageId]);
|
||||
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Numeric is %s", setlocale(LC_NUMERIC, "C"));
|
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "atof(2.75) is %f", atof("2.75"));
|
||||
}
|
||||
|
||||
void initSDL(void)
|
||||
{
|
||||
int rendererFlags, windowFlags;
|
||||
|
|
|
@ -24,7 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "SDL2/SDL_mixer.h"
|
||||
#include "SDL2/SDL_ttf.h"
|
||||
|
||||
#include "locale.h"
|
||||
|
||||
extern void createSaveFolder(void);
|
||||
extern void setLanguage(char *applicationName, char *languageCode);
|
||||
extern void initLookups(void);
|
||||
extern void initGraphics(void);
|
||||
extern void initFonts(void);
|
||||
|
|
|
@ -57,7 +57,7 @@ void initEntities(void)
|
|||
|
||||
void doEntities(void)
|
||||
{
|
||||
Entity *prev;
|
||||
Entity *prev, *oldSelf;
|
||||
int camMidX, camMidY, flicker, i;
|
||||
|
||||
memset(riders, 0, sizeof(Entity*) * MAX_RIDERS);
|
||||
|
@ -143,7 +143,13 @@ void doEntities(void)
|
|||
|
||||
if (touched[i]->isStatic)
|
||||
{
|
||||
touched[i]->touch(self); /* for objects that never move */
|
||||
oldSelf = self;
|
||||
|
||||
self = touched[i];
|
||||
|
||||
touched[i]->touch(oldSelf); /* for objects that never move */
|
||||
|
||||
self = oldSelf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,8 +44,17 @@ void doHud(void)
|
|||
}
|
||||
}
|
||||
|
||||
void setGameplayMessage(char *newMessage, int newMessageType)
|
||||
void setGameplayMessage(int newMessageType, const char *format, ...)
|
||||
{
|
||||
char newMessage[MAX_DESCRIPTION_LENGTH];
|
||||
va_list args;
|
||||
|
||||
memset(&newMessage, '\0', sizeof(newMessage));
|
||||
|
||||
va_start(args, format);
|
||||
vsprintf(newMessage, format, args);
|
||||
va_end(args);
|
||||
|
||||
if (newMessageType >= messageType && newMessage != NULL)
|
||||
{
|
||||
STRNCPY(message, newMessage, MAX_DESCRIPTION_LENGTH);
|
||||
|
|
|
@ -63,6 +63,8 @@ void initWorld(void)
|
|||
|
||||
app.delegate.logic = logic;
|
||||
app.delegate.draw = draw;
|
||||
|
||||
startMission();
|
||||
}
|
||||
|
||||
static void logic(void)
|
||||
|
@ -161,6 +163,12 @@ static void doWorldInProgress(void)
|
|||
{
|
||||
cameraTrack(world.entityToTrack);
|
||||
|
||||
game.config.control[CONTROL_LEFT] = app.keyboard[SDL_SCANCODE_A];
|
||||
game.config.control[CONTROL_RIGHT] = app.keyboard[SDL_SCANCODE_D];
|
||||
game.config.control[CONTROL_UP] = app.keyboard[SDL_SCANCODE_W];
|
||||
game.config.control[CONTROL_DOWN] = app.keyboard[SDL_SCANCODE_S];
|
||||
game.config.control[CONTROL_JUMP] = app.keyboard[SDL_SCANCODE_I];
|
||||
|
||||
if (!world.showingInfoMessage)
|
||||
{
|
||||
doBob();
|
||||
|
|
Loading…
Reference in New Issue