Atlas update.

This commit is contained in:
Steve 2019-06-02 16:13:34 +01:00
parent 9717047d47
commit 1093c16ed0
221 changed files with 2252 additions and 2249 deletions

View File

@ -4,9 +4,9 @@ LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po))
OUT = bin OUT = bin
SEARCHPATH += src SEARCHPATH += src
SEARCHPATH += src/combat SEARCHPATH += src/combat
SEARCHPATH += src/entities SEARCHPATH += src/entities
SEARCHPATH += src/entities/blobs SEARCHPATH += src/entities/blobs
SEARCHPATH += src/entities/boss SEARCHPATH += src/entities/boss
SEARCHPATH += src/entities/bullets SEARCHPATH += src/entities/bullets
@ -23,8 +23,8 @@ SEARCHPATH += src/hub
SEARCHPATH += src/json SEARCHPATH += src/json
SEARCHPATH += src/system SEARCHPATH += src/system
SEARCHPATH += src/test SEARCHPATH += src/test
SEARCHPATH += src/util SEARCHPATH += src/util
SEARCHPATH += src/widgets SEARCHPATH += src/widgets
SEARCHPATH += src/world SEARCHPATH += src/world
vpath %.c $(SEARCHPATH) vpath %.c $(SEARCHPATH)
@ -63,10 +63,10 @@ all: $(PROG) $(LOCALE_MO)
$(OUT)/%.o: %.c %.h $(DEPS) $(OUT)/%.o: %.c %.h $(DEPS)
@mkdir -p $(OUT) @mkdir -p $(OUT)
$(CC) $(CFLAGS) $(CXXFLAGS) -c -o $@ $< $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
%.mo: %.po %.mo: %.po
msgfmt -c -o $@ $< msgfmt -c -o $@ $<
# cleaning everything that can be automatically recreated with "make". # cleaning everything that can be automatically recreated with "make".
clean: clean:
$(RM) $(OBJS) $(PROG) $(LOCALE_MO) $(RM) $(OBJS) $(PROG) $(LOCALE_MO)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 MiB

After

Width:  |  Height:  |  Size: 3.3 MiB

View File

@ -19,6 +19,9 @@ _OBJS += unixInit.o
include common.mk include common.mk
NPROCS = $(shell grep -c 'processor' /proc/cpuinfo)
MAKEFLAGS += -j$(NPROCS)
CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" CXXFLAGS += `sdl2-config --cflags` -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\"
CXXFLAGS += -g -lefence CXXFLAGS += -g -lefence
CXXFLAGS += -fms-extensions -std=gnu11 CXXFLAGS += -fms-extensions -std=gnu11
@ -55,13 +58,13 @@ install:
cp -p icons/$(PROG)-128x128.png $(INST_ICON_DIR)/128x128/apps/$(PROG).png cp -p icons/$(PROG)-128x128.png $(INST_ICON_DIR)/128x128/apps/$(PROG).png
mkdir -p $(INST_DESKTOP_DIR) mkdir -p $(INST_DESKTOP_DIR)
cp -p icons/$(PROG).desktop $(INST_DESKTOP_DIR) cp -p icons/$(PROG).desktop $(INST_DESKTOP_DIR)
@for f in $(LOCALE_MO); do \ @for f in $(LOCALE_MO); do \
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \ lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
mkdir -p $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES; \ mkdir -p $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES; \
cp -v $$f $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \ cp -v $$f $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
done done
uninstall: uninstall:
$(RM) $(BIN_DIR)/$(PROG) $(RM) $(BIN_DIR)/$(PROG)
$(RM) -rf $(DATA_DIR) $(RM) -rf $(DATA_DIR)
@ -70,7 +73,7 @@ uninstall:
$(RM) $(ICON_DIR)/64x64/apps/$(PROG).png $(RM) $(ICON_DIR)/64x64/apps/$(PROG).png
$(RM) $(ICON_DIR)/128x128/apps/$(PROG).png $(RM) $(ICON_DIR)/128x128/apps/$(PROG).png
$(RM) $(DESKTOP_DIR)/$(PROG).desktop $(RM) $(DESKTOP_DIR)/$(PROG).desktop
@for f in $(LOCALE_MO); do \ @for f in $(LOCALE_MO); do \
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \ lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
$(RM) -v $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \ $(RM) -v $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
@ -85,7 +88,7 @@ dist:
mkdir -p dist mkdir -p dist
mv $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz dist mv $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz dist
$(RM) -rf $(PROG)-$(VERSION).$(REVISION) $(RM) -rf $(PROG)-$(VERSION).$(REVISION)
# prepare an archive for the program # prepare an archive for the program
src-dist: src-dist:
$(RM) -rf $(PROG)-$(VERSION).$(REVISION) $(RM) -rf $(PROG)-$(VERSION).$(REVISION)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -26,37 +26,37 @@ int hasLineOfSight(Entity *src, Entity *dest)
float sx, sy, tx, ty, dx, dy; float sx, sy, tx, ty, dx, dy;
Entity **candidates, *e; Entity **candidates, *e;
SDL_Rect losBounds; SDL_Rect losBounds;
sx = src->x + (src->w / 2); sx = src->x + (src->w / 2);
sy = src->y + (src->h / 2); sy = src->y + (src->h / 2);
tx = dest->x + (dest->w / 2); tx = dest->x + (dest->w / 2);
ty = dest->y + (dest->h / 2); ty = dest->y + (dest->h / 2);
losBounds.x = (int) MIN(src->x, dest->x); losBounds.x = (int) MIN(src->x, dest->x);
losBounds.y = (int) MIN(src->y, dest->y); losBounds.y = (int) MIN(src->y, dest->y);
losBounds.w = (int) (MAX(src->x, dest->x) - losBounds.x); losBounds.w = (int) (MAX(src->x, dest->x) - losBounds.x);
losBounds.h = (int) (MAX(src->y, dest->y) - losBounds.y); losBounds.h = (int) (MAX(src->y, dest->y) - losBounds.y);
candidates = getAllEntsWithin(losBounds.x, losBounds.y, losBounds.w, losBounds.h, NULL); candidates = getAllEntsWithin(losBounds.x, losBounds.y, losBounds.w, losBounds.h, NULL);
getSlope(sx, sy, tx, ty, &dx, &dy); getSlope(sx, sy, tx, ty, &dx, &dy);
dx *= 8; dx *= 8;
dy *= 8; dy *= 8;
while (1) while (1)
{ {
sx -= dx; sx -= dx;
sy -= dy; sy -= dy;
mx = sx / MAP_TILE_SIZE; mx = sx / MAP_TILE_SIZE;
my = sy / MAP_TILE_SIZE; my = sy / MAP_TILE_SIZE;
if (isSolid(mx, my)) if (isSolid(mx, my))
{ {
return 0; return 0;
} }
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i]) for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
{ {
if (e != src && collision(sx, sy, 8, 8, e->x, e->y, e->w, e->h)) if (e != src && collision(sx, sy, 8, 8, e->x, e->y, e->w, e->h))
@ -65,7 +65,7 @@ int hasLineOfSight(Entity *src, Entity *dest)
{ {
return 0; return 0;
} }
if (e == dest) if (e == dest)
{ {
return 1; return 1;
@ -73,7 +73,7 @@ int hasLineOfSight(Entity *src, Entity *dest)
} }
} }
} }
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -29,7 +29,7 @@ void addExplosion(float x, float y, int radius, Entity *owner)
Entity **candidates, *e; Entity **candidates, *e;
float power; float power;
int i; int i;
playBattleSound(SND_EXPLOSION, 0, x, y); playBattleSound(SND_EXPLOSION, 0, x, y);
/* assuming x and y were from the top left of the entity */ /* assuming x and y were from the top left of the entity */
@ -42,7 +42,7 @@ void addExplosion(float x, float y, int radius, Entity *owner)
radiusRect.y = (int) (y - radius); radiusRect.y = (int) (y - radius);
radiusRect.w = radius * 2; radiusRect.w = radius * 2;
radiusRect.h = radius * 2; radiusRect.h = radius * 2;
if (killTimer < SDL_GetTicks()) if (killTimer < SDL_GetTicks())
{ {
numKilled = 0; numKilled = 0;
@ -77,17 +77,17 @@ void addExplosion(float x, float y, int radius, Entity *owner)
{ {
stunBob(); stunBob();
} }
if (owner->type == ET_ENEMY && e->health <= 0 && e->type == ET_ENEMY && strstr(((Unit*)owner)->unitType, "EyeDroid")) if (owner->type == ET_ENEMY && e->health <= 0 && e->type == ET_ENEMY && strstr(((Unit*)owner)->unitType, "EyeDroid"))
{ {
game.stats[STAT_EYE_DROID_EXPLOSION_KILLS]++; game.stats[STAT_EYE_DROID_EXPLOSION_KILLS]++;
} }
if (e->health <= 0) if (e->health <= 0)
{ {
e->dx = rrnd(-radius / 8, radius / 8); e->dx = rrnd(-radius / 8, radius / 8);
e->dy = rrnd(-5, 0); e->dy = rrnd(-5, 0);
if (owner->type == ET_BOB) if (owner->type == ET_BOB)
{ {
numKilled++; numKilled++;
@ -104,7 +104,7 @@ void addExplosion(float x, float y, int radius, Entity *owner)
setGameplayMessage(MSG_STANDARD, "%d hit grenade combo!", numKilled); setGameplayMessage(MSG_STANDARD, "%d hit grenade combo!", numKilled);
game.stats[STAT_GRENADE_COMBO] = MAX(game.stats[STAT_GRENADE_COMBO], numKilled); game.stats[STAT_GRENADE_COMBO] = MAX(game.stats[STAT_GRENADE_COMBO], numKilled);
if (numKilled >= 12) if (numKilled >= 12)
{ {
awardTrophy("GRENADE_COMBO"); awardTrophy("GRENADE_COMBO");

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -56,7 +56,7 @@ void initWeapons(void)
missileSprite[0] = getSprite("MissileRight"); missileSprite[0] = getSprite("MissileRight");
missileSprite[1] = getSprite("MissileLeft"); missileSprite[1] = getSprite("MissileLeft");
weaponName[WPN_PISTOL] = _("Pistol"); weaponName[WPN_PISTOL] = _("Pistol");
weaponName[WPN_PLASMA] = _("Plasma Rifle"); weaponName[WPN_PLASMA] = _("Plasma Rifle");
weaponName[WPN_SPREAD] = _("Spread Gun"); weaponName[WPN_SPREAD] = _("Spread Gun");
@ -68,7 +68,7 @@ void initWeapons(void)
void firePistol(void) void firePistol(void)
{ {
Bullet *bullet; Bullet *bullet;
if (world.bob->facing != FACING_DIE) if (world.bob->facing != FACING_DIE)
{ {
bullet = createBaseBullet((Unit*)world.bob, bulletSprite[0]->frames[0]->rect.w); bullet = createBaseBullet((Unit*)world.bob, bulletSprite[0]->frames[0]->rect.w);
@ -88,7 +88,7 @@ void fireAimedShot(Unit *owner)
int x, y; int x, y;
float dx, dy; float dx, dy;
Bullet *bullet; Bullet *bullet;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
x = (int) (world.bob->x + rrnd(-8, 24)); x = (int) (world.bob->x + rrnd(-8, 24));
@ -112,7 +112,7 @@ void fireAimedShot(Unit *owner)
void fireMachineGun(Unit *owner) void fireMachineGun(Unit *owner)
{ {
Bullet *bullet; Bullet *bullet;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
bullet = createBaseBullet(owner, bulletSprite[0]->w); bullet = createBaseBullet(owner, bulletSprite[0]->w);
@ -128,7 +128,7 @@ void fireMachineGun(Unit *owner)
void firePlasma(Unit *owner) void firePlasma(Unit *owner)
{ {
Bullet *bullet; Bullet *bullet;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
bullet = createBaseBullet(owner, plasmaSprite[0]->w); bullet = createBaseBullet(owner, plasmaSprite[0]->w);
@ -173,7 +173,7 @@ void fireSpread(Unit *owner, int numberOfShots)
void fireLaser(Unit *owner) void fireLaser(Unit *owner)
{ {
Bullet *laser; Bullet *laser;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
laser = createBaseBullet(owner, laserSprite[0]->w); laser = createBaseBullet(owner, laserSprite[0]->w);
@ -193,7 +193,7 @@ void fireLaser(Unit *owner)
void fireGrenade(Unit *owner) void fireGrenade(Unit *owner)
{ {
Bullet *grenade; Bullet *grenade;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
grenade = createBaseBullet(owner, grenadeSprite->w); grenade = createBaseBullet(owner, grenadeSprite->w);
@ -217,7 +217,7 @@ void fireShotgun(Unit *owner)
int i; int i;
float dx, dy; float dx, dy;
Bullet *bullet; Bullet *bullet;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
for (i = 0 ; i < 8 ; i++) for (i = 0 ; i < 8 ; i++)
@ -243,7 +243,7 @@ void fireShotgun(Unit *owner)
void fireMissile(Unit *owner) void fireMissile(Unit *owner)
{ {
Bullet *missile; Bullet *missile;
if (owner->facing != FACING_DIE) if (owner->facing != FACING_DIE)
{ {
missile = createBaseBullet(owner, missileSprite[0]->w); missile = createBaseBullet(owner, missileSprite[0]->w);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -54,12 +54,12 @@ static int oldFacing;
Entity *initBob(void) Entity *initBob(void)
{ {
Bob *b; Bob *b;
b = malloc(sizeof(Bob)); b = malloc(sizeof(Bob));
memset(b, 0, sizeof(Bob)); memset(b, 0, sizeof(Bob));
initEntity((Entity*)b); initEntity((Entity*)b);
STRNCPY(b->name, "Bob", MAX_NAME_LENGTH); STRNCPY(b->name, "Bob", MAX_NAME_LENGTH);
b->type = ET_BOB; b->type = ET_BOB;
@ -83,9 +83,9 @@ Entity *initBob(void)
b->reload = 0; b->reload = 0;
b->flags |= EF_SWIMS | EF_BOMB_SHIELD; b->flags |= EF_SWIMS | EF_BOMB_SHIELD;
superAnimate = b->animate; superAnimate = b->animate;
b->tick = tick; b->tick = tick;
b->init = init; b->init = init;
b->applyDamage = applyDamage; b->applyDamage = applyDamage;
@ -96,21 +96,21 @@ Entity *initBob(void)
b->die = die; b->die = die;
b->load = load; b->load = load;
b->save = save; b->save = save;
checkpointTimer = 0; checkpointTimer = 0;
oldFacing = b->facing; oldFacing = b->facing;
return (Entity*)b; return (Entity*)b;
} }
static void init(void) static void init(void)
{ {
changeSprite(walkSprite); changeSprite(walkSprite);
world.bob->checkpoints[0].x = world.bob->x; world.bob->checkpoints[0].x = world.bob->x;
world.bob->checkpoints[0].y = world.bob->y; world.bob->checkpoints[0].y = world.bob->y;
superAnimate(); superAnimate();
} }
@ -243,7 +243,7 @@ static void handeImmunity(void)
world.bob->checkpoints[i].x = world.bob->checkpoints[i - 1].x; world.bob->checkpoints[i].x = world.bob->checkpoints[i - 1].x;
world.bob->checkpoints[i].y = world.bob->checkpoints[i - 1].y; world.bob->checkpoints[i].y = world.bob->checkpoints[i - 1].y;
} }
world.bob->checkpoints[0].x = world.bob->x; world.bob->checkpoints[0].x = world.bob->x;
world.bob->checkpoints[0].y = world.bob->y; world.bob->checkpoints[0].y = world.bob->y;
checkpointTimer = FPS; checkpointTimer = FPS;
@ -361,11 +361,11 @@ static void doBobInWater(void)
static void doDying(void) static void doDying(void)
{ {
int mx, my; int mx, my;
if (--world.bob->health <= -(FPS * 2)) if (--world.bob->health <= -(FPS * 2))
{ {
world.bob->flags |= EF_GONE; world.bob->flags |= EF_GONE;
if (app.config.blood) if (app.config.blood)
{ {
throwFleshChunks(world.bob->x + world.bob->w / 2, world.bob->y + world.bob->h / 2, rrnd(3, 6)); throwFleshChunks(world.bob->x + world.bob->w / 2, world.bob->y + world.bob->h / 2, rrnd(3, 6));
@ -385,7 +385,7 @@ static void doDying(void)
{ {
playSound(SND_POP, world.bob->uniqueId % MAX_SND_CHANNELS); playSound(SND_POP, world.bob->uniqueId % MAX_SND_CHANNELS);
} }
mx = (int) ((world.bob->x + (world.bob->w / 2)) / MAP_TILE_SIZE); mx = (int) ((world.bob->x + (world.bob->w / 2)) / MAP_TILE_SIZE);
my = (int) (world.bob->y / MAP_TILE_SIZE) + 1; my = (int) (world.bob->y / MAP_TILE_SIZE) + 1;
addBloodDecal(mx, my); addBloodDecal(mx, my);
@ -472,7 +472,7 @@ static void bobWalk(void)
{ {
fireWeapon(); fireWeapon();
} }
if (isControl(CONTROL_JETPACK)) if (isControl(CONTROL_JETPACK))
{ {
activate(1); activate(1);
@ -511,7 +511,7 @@ static void bobSwim(void)
{ {
firePistol(); firePistol();
} }
if (isControl(CONTROL_JETPACK)) if (isControl(CONTROL_JETPACK))
{ {
activate(1); activate(1);
@ -549,7 +549,7 @@ static void bobFly(void)
{ {
fireWeapon(); fireWeapon();
} }
if (isControl(CONTROL_JETPACK)) if (isControl(CONTROL_JETPACK))
{ {
activate(1); activate(1);
@ -618,7 +618,7 @@ void resetAtCheckpoint(void)
{ {
world.bob->x = world.bob->checkpoints[0].x; world.bob->x = world.bob->checkpoints[0].x;
world.bob->y = world.bob->checkpoints[0].y; world.bob->y = world.bob->checkpoints[0].y;
world.bob->facing = oldFacing; world.bob->facing = oldFacing;
world.bob->outTimer = 0; world.bob->outTimer = 0;
world.bob->flags |= EF_FLICKER; world.bob->flags |= EF_FLICKER;
@ -666,7 +666,7 @@ static void die(void)
static SDL_Rect *getCurrentSprite(void) static SDL_Rect *getCurrentSprite(void)
{ {
Sprite *s; Sprite *s;
s = (world.bob->alive == ALIVE_ALIVE && world.bob->stunTimer <= 0) ? world.bob->sprite[world.bob->facing] : world.bob->sprite[FACING_DIE]; s = (world.bob->alive == ALIVE_ALIVE && world.bob->stunTimer <= 0) ? world.bob->sprite[world.bob->facing] : world.bob->sprite[FACING_DIE];
{ {
return &world.bob->sprite[world.bob->facing]->frames[world.bob->spriteFrame]->rect; return &world.bob->sprite[world.bob->facing]->frames[world.bob->spriteFrame]->rect;
@ -677,7 +677,7 @@ static SDL_Rect *getCurrentSprite(void)
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", world.bob->name, world.bob->type, world.bob->spriteFrame, s->numFrames); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", world.bob->name, world.bob->type, world.bob->spriteFrame, s->numFrames);
world.bob->spriteFrame = 0; world.bob->spriteFrame = 0;
} }
return &s->frames[world.bob->spriteFrame]->rect; return &s->frames[world.bob->spriteFrame]->rect;
} }
@ -689,9 +689,9 @@ static void animate(void)
{ {
oldFacing = world.bob->facing; oldFacing = world.bob->facing;
} }
world.bob->facing = FACING_DIE; world.bob->facing = FACING_DIE;
superAnimate(); superAnimate();
} }
else if (world.bob->dx != 0 || world.bob->flags & EF_WEIGHTLESS) else if (world.bob->dx != 0 || world.bob->flags & EF_WEIGHTLESS)
@ -705,7 +705,7 @@ static void load(cJSON *root)
world.bob->x = cJSON_GetObjectItem(root, "x")->valueint; world.bob->x = cJSON_GetObjectItem(root, "x")->valueint;
world.bob->y = cJSON_GetObjectItem(root, "y")->valueint; world.bob->y = cJSON_GetObjectItem(root, "y")->valueint;
world.bob->facing = lookup(cJSON_GetObjectItem(root, "facing")->valuestring); world.bob->facing = lookup(cJSON_GetObjectItem(root, "facing")->valuestring);
if (game.plus & PLUS_MIRROR) if (game.plus & PLUS_MIRROR)
{ {
world.bob->x = MAP_PIXEL_WIDTH - world.bob->x; world.bob->x = MAP_PIXEL_WIDTH - world.bob->x;
@ -719,7 +719,7 @@ static void save(cJSON *root)
{ {
world.bob->facing = oldFacing; world.bob->facing = oldFacing;
} }
cJSON_AddStringToObject(root, "type", "Bob"); cJSON_AddStringToObject(root, "type", "Bob");
cJSON_AddNumberToObject(root, "x", world.bob->checkpoints[0].x); cJSON_AddNumberToObject(root, "x", world.bob->checkpoints[0].x);
cJSON_AddNumberToObject(root, "y", world.bob->checkpoints[0].y); cJSON_AddNumberToObject(root, "y", world.bob->checkpoints[0].y);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -32,14 +32,14 @@ static void save(cJSON *root);
Entity *initMIA(void) Entity *initMIA(void)
{ {
MIA *m; MIA *m;
m = malloc(sizeof(MIA)); m = malloc(sizeof(MIA));
memset(m, 0, sizeof(MIA)); memset(m, 0, sizeof(MIA));
initEntity((Entity*)m); initEntity((Entity*)m);
m->type = ET_MIA; m->type = ET_MIA;
m->tx = m->ty = -1; m->tx = m->ty = -1;
m->sprite[FACING_LEFT] = getSprite("MIA"); m->sprite[FACING_LEFT] = getSprite("MIA");
@ -60,7 +60,7 @@ Entity *initMIA(void)
m->save = save; m->save = save;
m->isMissionTarget = 1; m->isMissionTarget = 1;
return (Entity*)m; return (Entity*)m;
} }
@ -81,9 +81,9 @@ static void reset(void)
static void tick(void) static void tick(void)
{ {
MIA *m; MIA *m;
m = (MIA*)self; m = (MIA*)self;
if (--m->shudderTimer <= 0) if (--m->shudderTimer <= 0)
{ {
m->x = (m->tx + rand() % 4); m->x = (m->tx + rand() % 4);
@ -97,7 +97,7 @@ static void tick(void)
addMIATeleportStars(m->x + rand() % m->w, m->y + rand() % m->h); addMIATeleportStars(m->x + rand() % m->w, m->y + rand() % m->h);
m->starTimer = 1; m->starTimer = 1;
} }
world.saveDelay = FPS; world.saveDelay = FPS;
} }
} }
@ -105,9 +105,9 @@ static void tick(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
MIA *m; MIA *m;
m = (MIA*)self; m = (MIA*)self;
if (m->isMissionTarget && other == (Entity*)world.bob) if (m->isMissionTarget && other == (Entity*)world.bob)
{ {
m->action = preTeleport; m->action = preTeleport;
@ -125,49 +125,49 @@ static void touch(Entity *other)
static void preTeleport(void) static void preTeleport(void)
{ {
MIA *m; MIA *m;
m = (MIA*)self; m = (MIA*)self;
if (--m->teleportTimer <= FPS) if (--m->teleportTimer <= FPS)
{ {
m->action = teleport; m->action = teleport;
m->flags |= (EF_NO_CLIP | EF_WEIGHTLESS); m->flags |= (EF_NO_CLIP | EF_WEIGHTLESS);
m->dy = -5; m->dy = -5;
} }
world.saveDelay = FPS; world.saveDelay = FPS;
} }
static void teleport(void) static void teleport(void)
{ {
MIA *m; MIA *m;
m = (MIA*)self; m = (MIA*)self;
if (--m->teleportTimer <= 0) if (--m->teleportTimer <= 0)
{ {
addTeleportStars(self); addTeleportStars(self);
m->alive = ALIVE_DEAD; m->alive = ALIVE_DEAD;
} }
world.saveDelay = FPS; world.saveDelay = FPS;
} }
static void load(cJSON *root) static void load(cJSON *root)
{ {
MIA *m; MIA *m;
m = (MIA*)self; m = (MIA*)self;
m->active = cJSON_GetObjectItem(root, "isMissionTarget")->valueint; m->active = cJSON_GetObjectItem(root, "isMissionTarget")->valueint;
} }
static void save(cJSON *root) static void save(cJSON *root)
{ {
MIA *m; MIA *m;
m = (MIA*)self; m = (MIA*)self;
cJSON_AddStringToObject(root, "type", "MIA"); cJSON_AddStringToObject(root, "type", "MIA");
cJSON_AddNumberToObject(root, "isMissionTarget", m->isMissionTarget); cJSON_AddNumberToObject(root, "isMissionTarget", m->isMissionTarget);
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -33,13 +33,13 @@ static int exitMission;
Entity *initTeeka(void) Entity *initTeeka(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createUnit();
u->unitType = "Teeka"; u->unitType = "Teeka";
u->type = ET_TEEKA; u->type = ET_TEEKA;
u->flags |= EF_IMMUNE; u->flags |= EF_IMMUNE;
u->action = lookForEnemies; u->action = lookForEnemies;
@ -51,15 +51,15 @@ Entity *initTeeka(void)
u->sprite[FACING_DIE] = getSprite("TeekaLeft"); u->sprite[FACING_DIE] = getSprite("TeekaLeft");
u->health = u->healthMax = 9999; u->health = u->healthMax = 9999;
superTick = u->tick; superTick = u->tick;
u->tick = tick; u->tick = tick;
exitMission = 0; exitMission = 0;
aimedSprite = getSprite("AimedShot"); aimedSprite = getSprite("AimedShot");
return (Entity*)u; return (Entity*)u;
} }
@ -87,13 +87,13 @@ static void lookForEnemies(void)
Entity *e; Entity *e;
float distance, range; float distance, range;
Unit *u; Unit *u;
u = (Unit*)self; u = (Unit*)self;
u->thinkTime = rrnd(FPS / 2, FPS); u->thinkTime = rrnd(FPS / 2, FPS);
target = NULL; target = NULL;
distance = 800; distance = 800;
for (e = world.entityHead.next ; e != NULL ; e = e->next) for (e = world.entityHead.next ; e != NULL ; e = e->next)
@ -134,9 +134,9 @@ static void lookForEnemies(void)
static void preFire(void) static void preFire(void)
{ {
Unit *u; Unit *u;
u = (Unit*)self; u = (Unit*)self;
if (u->reload > 0) if (u->reload > 0)
{ {
return; return;
@ -148,7 +148,7 @@ static void preFire(void)
} }
attack(); attack();
if (--u->shotsToFire <= 0) if (--u->shotsToFire <= 0)
{ {
u->thinkTime = FPS; u->thinkTime = FPS;
@ -160,7 +160,7 @@ static void attack(void)
{ {
Bullet *bullet; Bullet *bullet;
float dx, dy; float dx, dy;
getSlope(target->x, target->y, self->x, self->y, &dx, &dy); getSlope(target->x, target->y, self->x, self->y, &dx, &dy);
bullet = createBaseBullet((Unit*)self, aimedSprite->w); bullet = createBaseBullet((Unit*)self, aimedSprite->w);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,16 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Entity *initBlaze(void) Entity *initBlaze(void)
{ {
Boss *b; Boss *b;
b = initBlobBoss(); b = initBlobBoss();
b->weakAgainst = ENV_WATER; b->weakAgainst = ENV_WATER;
STRNCPY(b->name, "Blaze", MAX_NAME_LENGTH); STRNCPY(b->name, "Blaze", MAX_NAME_LENGTH);
b->sprite[FACING_LEFT] = getSprite("BlazeLeft"); b->sprite[FACING_LEFT] = getSprite("BlazeLeft");
b->sprite[FACING_RIGHT] = getSprite("BlazeRight"); b->sprite[FACING_RIGHT] = getSprite("BlazeRight");
b->sprite[FACING_DIE] = getSprite("BlazeSpin"); b->sprite[FACING_DIE] = getSprite("BlazeSpin");
return (Entity*)b; return (Entity*)b;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -40,17 +40,17 @@ static Sprite *aimedSprite;
Boss *initBlobBoss(void) Boss *initBlobBoss(void)
{ {
Boss *b; Boss *b;
b = initBoss(); b = initBoss();
b->flags |= EF_HALT_AT_EDGE; b->flags |= EF_HALT_AT_EDGE;
b->health = b->healthMax = 250; b->health = b->healthMax = 250;
b->teleportTimer = FPS * rrnd(4, 6); b->teleportTimer = FPS * rrnd(4, 6);
superAnimate = b->animate; superAnimate = b->animate;
b->activate = activate; b->activate = activate;
b->action = walk; b->action = walk;
b->walk = walk; b->walk = walk;
@ -60,9 +60,9 @@ Boss *initBlobBoss(void)
b->animate = animate; b->animate = animate;
b->applyDamage = applyDamage; b->applyDamage = applyDamage;
b->die = die1; b->die = die1;
aimedSprite = getSprite("AimedShot"); aimedSprite = getSprite("AimedShot");
return b; return b;
} }
@ -83,9 +83,9 @@ static void activate(int activate)
static void tick(void) static void tick(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->health > 0) if (b->health > 0)
{ {
b->stunTimer = MAX(b->stunTimer - 1, 0); b->stunTimer = MAX(b->stunTimer - 1, 0);
@ -95,7 +95,7 @@ static void tick(void)
b->health -= 2; b->health -= 2;
world.boss = b; world.boss = b;
if (b->stunTimer == 0) if (b->stunTimer == 0)
{ {
teleport(); teleport();
@ -125,9 +125,9 @@ static void tick(void)
static void changeEnvironment() static void changeEnvironment()
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->environment == b->weakAgainst) if (b->environment == b->weakAgainst)
{ {
b->teleportTimer = 0; b->teleportTimer = 0;
@ -143,9 +143,9 @@ static void changeEnvironment()
static void die1(void) static void die1(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->flags |= EF_BOUNCES; b->flags |= EF_BOUNCES;
b->thinkTime = 0; b->thinkTime = 0;
@ -176,7 +176,7 @@ static void die1(void)
playBattleSound(SND_DEATH_3, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y); playBattleSound(SND_DEATH_3, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
break; break;
} }
b->action = die2; b->action = die2;
} }
@ -184,9 +184,9 @@ static SDL_Rect *getCurrentSprite(void)
{ {
Boss *b; Boss *b;
Sprite *s; Sprite *s;
b = (Boss*)self; b = (Boss*)self;
s = (b->stunTimer > 0 || b->health <= 0) ? b->sprite[FACING_DIE] : b->sprite[b->facing]; s = (b->stunTimer > 0 || b->health <= 0) ? b->sprite[FACING_DIE] : b->sprite[b->facing];
if (self->spriteFrame >= s->numFrames) if (self->spriteFrame >= s->numFrames)
@ -194,20 +194,20 @@ static SDL_Rect *getCurrentSprite(void)
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", self->name, self->type, self->spriteFrame, s->numFrames); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", self->name, self->type, self->spriteFrame, s->numFrames);
self->spriteFrame = 0; self->spriteFrame = 0;
} }
return &s->frames[self->spriteFrame]->rect; return &s->frames[self->spriteFrame]->rect;
} }
static void animate(void) static void animate(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->alive != ALIVE_ALIVE || b->stunTimer > 0) if (b->alive != ALIVE_ALIVE || b->stunTimer > 0)
{ {
b->facing = FACING_DIE; b->facing = FACING_DIE;
superAnimate(); superAnimate();
} }
else if (b->dx != 0) else if (b->dx != 0)
@ -219,9 +219,9 @@ static void animate(void)
static void lookForPlayer(void) static void lookForPlayer(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->thinkTime = rrnd(0, FPS / 2); b->thinkTime = rrnd(0, FPS / 2);
if (getDistance(world.bob->x, world.bob->y, b->x, b->y) > 650) if (getDistance(world.bob->x, world.bob->y, b->x, b->y) > 650)
@ -248,9 +248,9 @@ static void lookForPlayer(void)
static void moveTowardsPlayer(void) static void moveTowardsPlayer(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->dx = 0; b->dx = 0;
if (rand() % 100 < 20) if (rand() % 100 < 20)
@ -282,9 +282,9 @@ static void moveTowardsPlayer(void)
static void preFire(void) static void preFire(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->reload > 0) if (b->reload > 0)
{ {
return; return;
@ -305,7 +305,7 @@ static void attack(void)
Bullet *bullet; Bullet *bullet;
float dx, dy; float dx, dy;
int bx, by; int bx, by;
if (self->facing != FACING_DIE) if (self->facing != FACING_DIE)
{ {
bx = (int) (world.bob->x + rrnd(-8, 24)); bx = (int) (world.bob->x + rrnd(-8, 24));
@ -337,9 +337,9 @@ static void walk(void)
void reappear(void) void reappear(void)
{ {
int valid, r; int valid, r;
valid = 0; valid = 0;
do do
{ {
r = (int) (rand() % MAX_CHECKPOINTS); r = (int) (rand() % MAX_CHECKPOINTS);
@ -348,15 +348,15 @@ void reappear(void)
valid = (self->x != 0 && self->y != 0); valid = (self->x != 0 && self->y != 0);
} }
while (!valid); while (!valid);
self->y -= (self->h + 10); self->y -= (self->h + 10);
walk(); walk();
self->flags &= ~EF_GONE; self->flags &= ~EF_GONE;
addTeleportStars(self); addTeleportStars(self);
playBattleSound(SND_APPEAR, -1, self->x, self->y); playBattleSound(SND_APPEAR, -1, self->x, self->y);
} }
@ -389,9 +389,9 @@ static void teleport(void)
static void die2(void) static void die2(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->health--; b->health--;
if (b->health <= -FPS) if (b->health <= -FPS)
@ -413,7 +413,7 @@ static void die2(void)
{ {
awardTrophy("BLAZE_FROST"); awardTrophy("BLAZE_FROST");
} }
b->action = entityIdle; b->action = entityIdle;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,16 +27,16 @@ static void init(void);
Boss *initBoss(void) Boss *initBoss(void)
{ {
Boss *b; Boss *b;
b = malloc(sizeof(Boss)); b = malloc(sizeof(Boss));
memset(b, 0, sizeof(Boss)); memset(b, 0, sizeof(Boss));
initEntity((Entity*)b); initEntity((Entity*)b);
b->type = ET_BOSS; b->type = ET_BOSS;
b->sprite[FACING_LEFT] = b->sprite[FACING_RIGHT] = b->sprite[FACING_DIE] = getSprite("Boss"); b->sprite[FACING_LEFT] = b->sprite[FACING_RIGHT] = b->sprite[FACING_DIE] = getSprite("Boss");
b->isMissionTarget = 1; b->isMissionTarget = 1;
b->spriteFrame = 0; b->spriteFrame = 0;
@ -45,11 +45,11 @@ Boss *initBoss(void)
world.boss = b; world.boss = b;
b->flags |= EF_ALWAYS_PROCESS | EF_BOMB_SHIELD | EF_GONE; b->flags |= EF_ALWAYS_PROCESS | EF_BOMB_SHIELD | EF_GONE;
b->init = init; b->init = init;
b->load = load; b->load = load;
b->save = save; b->save = save;
return b; return b;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -43,19 +43,19 @@ static Sprite *plasmaSprite[2];
Entity *initEyeDroidCommander(void) Entity *initEyeDroidCommander(void)
{ {
Boss *b; Boss *b;
b = initBoss(); b = initBoss();
STRNCPY(b->name, "EyeDroid Commander", MAX_NAME_LENGTH); STRNCPY(b->name, "EyeDroid Commander", MAX_NAME_LENGTH);
b->sprite[FACING_LEFT] = getSprite("DroidCommanderLeft"); b->sprite[FACING_LEFT] = getSprite("DroidCommanderLeft");
b->sprite[FACING_RIGHT] = getSprite("DroidCommanderRight"); b->sprite[FACING_RIGHT] = getSprite("DroidCommanderRight");
b->sprite[FACING_DIE] = getSprite("DroidCommanderDie"); b->sprite[FACING_DIE] = getSprite("DroidCommanderDie");
b->flags |= EF_WEIGHTLESS | EF_EXPLODES; b->flags |= EF_WEIGHTLESS | EF_EXPLODES;
b->health = b->healthMax = 250; b->health = b->healthMax = 250;
b->action = walk; b->action = walk;
b->walk = walk; b->walk = walk;
b->tick = tick; b->tick = tick;
@ -65,15 +65,15 @@ Entity *initEyeDroidCommander(void)
b->getCurrentSprite = getCurrentSprite; b->getCurrentSprite = getCurrentSprite;
brakingTimer = 0; brakingTimer = 0;
aimedSprite = getSprite("AimedShot"); aimedSprite = getSprite("AimedShot");
missileSprite[0] = getSprite("MissileRight"); missileSprite[0] = getSprite("MissileRight");
missileSprite[1] = getSprite("MissileLeft"); missileSprite[1] = getSprite("MissileLeft");
plasmaSprite[0] = getSprite("PlasmaRight"); plasmaSprite[0] = getSprite("PlasmaRight");
plasmaSprite[1] = getSprite("PlasmaLeft"); plasmaSprite[1] = getSprite("PlasmaLeft");
return (Entity*)b; return (Entity*)b;
} }
@ -91,9 +91,9 @@ static void activate(int activate)
static void tick(void) static void tick(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->health > 0) if (b->health > 0)
{ {
b->facing = (world.bob->x < b->x) ? FACING_LEFT : FACING_RIGHT; b->facing = (world.bob->x < b->x) ? FACING_LEFT : FACING_RIGHT;
@ -117,14 +117,14 @@ static void tick(void)
static void lookForPlayer(void) static void lookForPlayer(void)
{ {
float distance; float distance;
self->thinkTime = rrnd(0, FPS / 2); self->thinkTime = rrnd(0, FPS / 2);
if (rand() % 100 < 5) if (rand() % 100 < 5)
{ {
brakingTimer = rrnd(60, 120); brakingTimer = rrnd(60, 120);
} }
distance = getDistance(world.bob->x, world.bob->y, self->x, self->y); distance = getDistance(world.bob->x, world.bob->y, self->x, self->y);
if (distance > app.config.winHeight) if (distance > app.config.winHeight)
@ -132,7 +132,7 @@ static void lookForPlayer(void)
moveTowardsPlayer(1); moveTowardsPlayer(1);
return; return;
} }
if (!enemyCanSeePlayer(self)) if (!enemyCanSeePlayer(self))
{ {
moveTowardsPlayer(1); moveTowardsPlayer(1);
@ -143,7 +143,7 @@ static void lookForPlayer(void)
{ {
selectWeapon(); selectWeapon();
} }
if (distance < app.config.winHeight / 4) if (distance < app.config.winHeight / 4)
{ {
moveTowardsPlayer(-6); moveTowardsPlayer(-6);
@ -157,9 +157,9 @@ static void lookForPlayer(void)
static void selectWeapon(void) static void selectWeapon(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (world.bob->isOnGround || fabs(self->y - world.bob->y) > 64) if (world.bob->isOnGround || fabs(self->y - world.bob->y) > 64)
{ {
b->weaponType = WPN_AIMED_PISTOL; b->weaponType = WPN_AIMED_PISTOL;
@ -188,9 +188,9 @@ static void walk(void)
static void moveTowardsPlayer(int dir) static void moveTowardsPlayer(int dir)
{ {
float vel; float vel;
vel = 0.5 * dir; vel = 0.5 * dir;
if (brakingTimer == 0) if (brakingTimer == 0)
{ {
if (world.bob->x < self->x) if (world.bob->x < self->x)
@ -221,9 +221,9 @@ static void moveTowardsPlayer(int dir)
static void preFire(void) static void preFire(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->reload > 0) if (b->reload > 0)
{ {
return; return;
@ -242,11 +242,11 @@ static void preFire(void)
static void attack(void) static void attack(void)
{ {
Boss *b; Boss *b;
if (self->facing != FACING_DIE) if (self->facing != FACING_DIE)
{ {
b = (Boss*)self; b = (Boss*)self;
switch (b->weaponType) switch (b->weaponType)
{ {
case WPN_AIMED_PISTOL: case WPN_AIMED_PISTOL:
@ -270,9 +270,9 @@ static void attackPistol(void)
float dx, dy; float dx, dy;
Bullet *bullet; Bullet *bullet;
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
bx = world.bob->x + rrnd(-8, 24); bx = world.bob->x + rrnd(-8, 24);
by = world.bob->y + rrnd(-8, 24); by = world.bob->y + rrnd(-8, 24);
@ -297,9 +297,9 @@ static void attackPlasma(void)
{ {
Boss *b; Boss *b;
Bullet *bullet; Bullet *bullet;
b = (Boss*)self; b = (Boss*)self;
bullet = createBaseBullet((Unit*)self, plasmaSprite[0]->w); bullet = createBaseBullet((Unit*)self, plasmaSprite[0]->w);
bullet->facing = self->facing; bullet->facing = self->facing;
bullet->damage = 2; bullet->damage = 2;
@ -320,9 +320,9 @@ static void attackMissile(void)
{ {
Boss *b; Boss *b;
Bullet *missile; Bullet *missile;
b = (Boss*)self; b = (Boss*)self;
missile = createBaseBullet((Unit*)self, missileSprite[0]->w); missile = createBaseBullet((Unit*)self, missileSprite[0]->w);
missile->facing = b->facing; missile->facing = b->facing;
missile->dx = b->facing == FACING_RIGHT ? 15 : -15; missile->dx = b->facing == FACING_RIGHT ? 15 : -15;
@ -330,7 +330,7 @@ static void attackMissile(void)
missile->health = FPS * 3; missile->health = FPS * 3;
missile->sprite[0] = missileSprite[0]; missile->sprite[0] = missileSprite[0];
missile->sprite[1] = missileSprite[1]; missile->sprite[1] = missileSprite[1];
initMissile(missile); initMissile(missile);
b->reload = 15; b->reload = 15;
@ -352,9 +352,9 @@ static void applyDamage(int amount)
static void die(void) static void die(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->dx = (randF() - randF()) * 3; b->dx = (randF() - randF()) * 3;
b->spriteTime = 0; b->spriteTime = 0;
@ -379,9 +379,9 @@ static void die(void)
static void die2() static void die2()
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->isOnGround) if (b->isOnGround)
{ {
addTeleportStars(self); addTeleportStars(self);
@ -398,7 +398,7 @@ static void die2()
awardTrophy("EYEDROID_COMMANDER"); awardTrophy("EYEDROID_COMMANDER");
game.stats[STAT_ENEMIES_KILLED]++; game.stats[STAT_ENEMIES_KILLED]++;
b->action = entityIdle; b->action = entityIdle;
} }
} }
@ -406,14 +406,14 @@ static void die2()
static SDL_Rect *getCurrentSprite(void) static SDL_Rect *getCurrentSprite(void)
{ {
Sprite *s; Sprite *s;
s = (self->alive == ALIVE_ALIVE) ? self->sprite[self->facing] : self->sprite[FACING_DIE]; s = (self->alive == ALIVE_ALIVE) ? self->sprite[self->facing] : self->sprite[FACING_DIE];
if (self->spriteFrame >= s->numFrames) if (self->spriteFrame >= s->numFrames)
{ {
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", self->name, self->type, self->spriteFrame, s->numFrames); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", self->name, self->type, self->spriteFrame, s->numFrames);
self->spriteFrame = 0; self->spriteFrame = 0;
} }
return &s->frames[self->spriteFrame]->rect; return &s->frames[self->spriteFrame]->rect;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,16 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Entity *initFrost(void) Entity *initFrost(void)
{ {
Boss *b; Boss *b;
b = initBlobBoss(); b = initBlobBoss();
b->weakAgainst = ENV_LAVA; b->weakAgainst = ENV_LAVA;
STRNCPY(b->name, "Frost", MAX_NAME_LENGTH); STRNCPY(b->name, "Frost", MAX_NAME_LENGTH);
b->sprite[FACING_LEFT] = getSprite("FrostLeft"); b->sprite[FACING_LEFT] = getSprite("FrostLeft");
b->sprite[FACING_RIGHT] = getSprite("FrostRight"); b->sprite[FACING_RIGHT] = getSprite("FrostRight");
b->sprite[FACING_DIE] = getSprite("FrostSpin"); b->sprite[FACING_DIE] = getSprite("FrostSpin");
return (Entity*)b; return (Entity*)b;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -42,7 +42,7 @@ static Sprite *aimedSprite;
Entity *initTankCommander(void) Entity *initTankCommander(void)
{ {
Boss *b; Boss *b;
b = initBoss(); b = initBoss();
STRNCPY(b->name, "Tank Commander", MAX_NAME_LENGTH); STRNCPY(b->name, "Tank Commander", MAX_NAME_LENGTH);
@ -64,25 +64,25 @@ Entity *initTankCommander(void)
b->getCollisionBounds = getCollisionBounds; b->getCollisionBounds = getCollisionBounds;
brakingTimer = 0; brakingTimer = 0;
aimedSprite = getSprite("AimedShot"); aimedSprite = getSprite("AimedShot");
missileSprite[0] = getSprite("MissileRight"); missileSprite[0] = getSprite("MissileRight");
missileSprite[1] = getSprite("MissileLeft"); missileSprite[1] = getSprite("MissileLeft");
tankTrack = initTankTrack(b); tankTrack = initTankTrack(b);
world.boss = b; world.boss = b;
return (Entity*)b; return (Entity*)b;
} }
static void activate(int activate) static void activate(int activate)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->flags &= ~EF_GONE; b->flags &= ~EF_GONE;
tankTrack->flags &= ~EF_GONE; tankTrack->flags &= ~EF_GONE;
@ -97,9 +97,9 @@ static void activate(int activate)
static void tick(void) static void tick(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->health > 0) if (b->health > 0)
{ {
b->facing = (world.bob->x < b->x) ? FACING_LEFT : FACING_RIGHT; b->facing = (world.bob->x < b->x) ? FACING_LEFT : FACING_RIGHT;
@ -119,9 +119,9 @@ static void tick(void)
static void lookForPlayer(void) static void lookForPlayer(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->thinkTime = rrnd(0, FPS / 2); b->thinkTime = rrnd(0, FPS / 2);
if (rand() % 10 == 0) if (rand() % 10 == 0)
@ -175,9 +175,9 @@ static void moveTowardsPlayer(void)
static void selectWeapon(void) static void selectWeapon(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (fabs(b->y - world.bob->y) > 64) if (fabs(b->y - world.bob->y) > 64)
{ {
b->weaponType = WPN_AIMED_PISTOL; b->weaponType = WPN_AIMED_PISTOL;
@ -195,9 +195,9 @@ static void selectWeapon(void)
static void preFire(void) static void preFire(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
if (b->reload > 0) if (b->reload > 0)
{ {
moveTowardsPlayer(); moveTowardsPlayer();
@ -217,11 +217,11 @@ static void preFire(void)
static void attack(void) static void attack(void)
{ {
Boss *b; Boss *b;
if (self->facing != FACING_DIE) if (self->facing != FACING_DIE)
{ {
b = (Boss*)self; b = (Boss*)self;
switch (b->weaponType) switch (b->weaponType)
{ {
case WPN_AIMED_PISTOL: case WPN_AIMED_PISTOL:
@ -242,9 +242,9 @@ static void attackPistol(void)
float dx, dy; float dx, dy;
Bullet *bullet; Bullet *bullet;
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
bx = world.bob->x + rrnd(-8, 24); bx = world.bob->x + rrnd(-8, 24);
by = world.bob->y + rrnd(-8, 24); by = world.bob->y + rrnd(-8, 24);
@ -271,7 +271,7 @@ static void attackMissile(void)
{ {
Bullet *missile; Bullet *missile;
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
missile = createBaseBullet((Unit*)self, missileSprite[0]->w); missile = createBaseBullet((Unit*)self, missileSprite[0]->w);
@ -287,7 +287,7 @@ static void attackMissile(void)
missile->sprite[1] = missileSprite[1]; missile->sprite[1] = missileSprite[1];
b->reload = 15; b->reload = 15;
initMissile(missile); initMissile(missile);
playBattleSound(SND_MISSILE, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y); playBattleSound(SND_MISSILE, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
@ -296,9 +296,9 @@ static void attackMissile(void)
static void die1(void) static void die1(void)
{ {
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->flags |= EF_BOUNCES; b->flags |= EF_BOUNCES;
b->action = die2; b->action = die2;
@ -312,7 +312,7 @@ static void die2(void)
{ {
int mx, my; int mx, my;
Boss *b; Boss *b;
b = (Boss*)self; b = (Boss*)self;
b->health--; b->health--;
@ -321,7 +321,7 @@ static void die2(void)
{ {
mx = (int) ((b->x + (b->w / 2)) / MAP_TILE_SIZE); mx = (int) ((b->x + (b->w / 2)) / MAP_TILE_SIZE);
my = (int) ((b->y + b->h) / MAP_TILE_SIZE); my = (int) ((b->y + b->h) / MAP_TILE_SIZE);
addScorchDecal(mx, my); addScorchDecal(mx, my);
addExplosion(b->x + rand() % b->w, b->y + rand() % b->h, 50, self); addExplosion(b->x + rand() % b->w, b->y + rand() % b->h, 50, self);
@ -345,7 +345,7 @@ static void die2(void)
awardTrophy("TANK_COMMANDER"); awardTrophy("TANK_COMMANDER");
game.stats[STAT_ENEMIES_KILLED]++; game.stats[STAT_ENEMIES_KILLED]++;
b->action = entityIdle; b->action = entityIdle;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -31,7 +31,7 @@ static void getCollisionBounds(SDL_Rect *r);
Entity *initTankTrack(Boss *owner) Entity *initTankTrack(Boss *owner)
{ {
Boss *b; Boss *b;
b = initBoss(); b = initBoss();
superAnimate = b->animate; superAnimate = b->animate;
@ -51,7 +51,7 @@ Entity *initTankTrack(Boss *owner)
b->getCollisionBounds = getCollisionBounds; b->getCollisionBounds = getCollisionBounds;
tankCommander = owner; tankCommander = owner;
return (Entity*)b; return (Entity*)b;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -26,12 +26,12 @@ static void touch(Entity *other);
Bullet *createBaseBullet(Unit *owner, int bulletWidth) Bullet *createBaseBullet(Unit *owner, int bulletWidth)
{ {
Bullet *bullet; Bullet *bullet;
bullet = malloc(sizeof(Bullet)); bullet = malloc(sizeof(Bullet));
memset(bullet, 0, sizeof(Bullet)); memset(bullet, 0, sizeof(Bullet));
initEntity((Entity*)bullet); initEntity((Entity*)bullet);
bullet->x = owner->x + (owner->w / 2) - (bulletWidth / 2); bullet->x = owner->x + (owner->w / 2) - (bulletWidth / 2);
bullet->y = (owner->y + owner->h / 2) - 3; bullet->y = (owner->y + owner->h / 2) - 3;
bullet->dx = owner->facing == FACING_RIGHT ? 15 : -15; bullet->dx = owner->facing == FACING_RIGHT ? 15 : -15;
@ -43,7 +43,7 @@ Bullet *createBaseBullet(Unit *owner, int bulletWidth)
bullet->tick = tick; bullet->tick = tick;
bullet->touch = touch; bullet->touch = touch;
bullet->spriteFrame = 0; bullet->spriteFrame = 0;
return bullet; return bullet;
@ -104,7 +104,7 @@ static void touch(Entity *other)
b->owner->type != other->type && b->owner->type != other->type &&
!((b->owner->type == ET_TEEKA && other->type == ET_BOB) || (b->owner->type == ET_BOB && other->type == ET_TEEKA)) !((b->owner->type == ET_TEEKA && other->type == ET_BOB) || (b->owner->type == ET_BOB && other->type == ET_TEEKA))
); );
if (canHit) if (canHit)
{ {
swapSelf(other); swapSelf(other);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@ static void explode(void);
void initGrenade(Bullet *b) void initGrenade(Bullet *b)
{ {
b->flags = EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_FRICTIONLESS | EF_NO_TELEPORT; b->flags = EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_FRICTIONLESS | EF_NO_TELEPORT;
superBounce = b->bounce; superBounce = b->bounce;
b->tick = tick; b->tick = tick;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -61,7 +61,7 @@ static void touch(Entity *other)
b->owner->type != other->type && b->owner->type != other->type &&
!((b->owner->type == ET_TEEKA && other->type == ET_BOB) || (b->owner->type == ET_BOB && other->type == ET_TEEKA)) !((b->owner->type == ET_TEEKA && other->type == ET_BOB) || (b->owner->type == ET_BOB && other->type == ET_TEEKA))
); );
if (canHit) if (canHit)
{ {
if (other->flags & EF_EXPLODES) if (other->flags & EF_EXPLODES)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -32,11 +32,11 @@ static void getCollisionBounds(SDL_Rect *r);
Entity *initCannon(void) Entity *initCannon(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createUnit();
u->unitType = "Cannon"; u->unitType = "Cannon";
u->type = ET_ENEMY; u->type = ET_ENEMY;
u->sprite[FACING_LEFT] = getSprite("CannonLeft"); u->sprite[FACING_LEFT] = getSprite("CannonLeft");
@ -62,7 +62,7 @@ Entity *initCannon(void)
u->die = die; u->die = die;
u->canFire = canFire; u->canFire = canFire;
u->getCollisionBounds = getCollisionBounds; u->getCollisionBounds = getCollisionBounds;
return (Entity*)u; return (Entity*)u;
} }
@ -87,7 +87,7 @@ static void die(void)
u->flags |= EF_BOUNCES | EF_ALWAYS_PROCESS; u->flags |= EF_BOUNCES | EF_ALWAYS_PROCESS;
u->action = die2; u->action = die2;
u->facing = FACING_DIE; u->facing = FACING_DIE;
u->thinkTime = 0; u->thinkTime = 0;
u->spriteTime = 0; u->spriteTime = 0;
@ -107,7 +107,7 @@ static void die2(void)
{ {
Unit *u; Unit *u;
int mx, my; int mx, my;
u = (Unit*)self; u = (Unit*)self;
if (--u->health % 3 == 0) if (--u->health % 3 == 0)
@ -117,7 +117,7 @@ static void die2(void)
addScorchDecal(mx, my); addScorchDecal(mx, my);
addExplosion(u->x, u->y, 50, self); addExplosion(u->x, u->y, 50, self);
throwDebris(u->x + u->w / 2, u->y + u->h / 2, 1); throwDebris(u->x + u->w / 2, u->y + u->h / 2, 1);
} }
@ -130,7 +130,7 @@ static void die2(void)
dropCarriedItem(); dropCarriedItem();
u->alive = ALIVE_DEAD; u->alive = ALIVE_DEAD;
addRandomWeapon(u->x, u->y); addRandomWeapon(u->x, u->y);
} }
} }
@ -146,7 +146,7 @@ static void lookForPlayer(void)
{ {
Unit *u; Unit *u;
int r; int r;
u = (Unit*)self; u = (Unit*)self;
u->thinkTime = rrnd(FPS / 2, FPS); u->thinkTime = rrnd(FPS / 2, FPS);
@ -192,9 +192,9 @@ static void lookForPlayer(void)
static void preFire(void) static void preFire(void)
{ {
Unit *u; Unit *u;
u = (Unit*)self; u = (Unit*)self;
u->facing = (world.bob->x < u->x) ? FACING_LEFT : FACING_RIGHT; u->facing = (world.bob->x < u->x) ? FACING_LEFT : FACING_RIGHT;
if (u->reload > 0) if (u->reload > 0)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -28,9 +28,9 @@ static void changeEnvironment(void);
void initDebris(Decoration *d) void initDebris(Decoration *d)
{ {
initEntity((Entity*)d); initEntity((Entity*)d);
d->type = ET_DECORATION; d->type = ET_DECORATION;
d->effectType = rand() % 2; d->effectType = rand() % 2;
d->spriteFrame = 0; d->spriteFrame = 0;
@ -51,9 +51,9 @@ static void tick(void)
static void action(void) static void action(void)
{ {
Decoration *d; Decoration *d;
d = (Decoration*)self; d = (Decoration*)self;
if (d->effectType == 0) if (d->effectType == 0)
{ {
addFlameParticles(d->x + (rand() % d->w), d->y + (rand() % d->h), d->isOnGround); addFlameParticles(d->x + (rand() % d->w), d->y + (rand() % d->h), d->isOnGround);
@ -69,9 +69,9 @@ static void action(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
Decoration *d; Decoration *d;
d = (Decoration*)self; d = (Decoration*)self;
if (other == NULL) if (other == NULL)
{ {
d->dx *= 0.9; d->dx *= 0.9;
@ -87,7 +87,7 @@ static void changeEnvironment(void)
case ENV_WATER: case ENV_WATER:
self->alive = ALIVE_DEAD; self->alive = ALIVE_DEAD;
break; break;
default: default:
break; break;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,11 +27,11 @@ static void touch(Entity *other);
void initFleshChunk(Decoration *d) void initFleshChunk(Decoration *d)
{ {
initEntity((Entity*)d); initEntity((Entity*)d);
d->type = ET_DECORATION; d->type = ET_DECORATION;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_NO_TELEPORT | EF_CRUSHABLE; d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_NO_TELEPORT | EF_CRUSHABLE;
if (app.config.blood != 2) if (app.config.blood != 2)
{ {
d->flags |= EF_KILL_OFFSCREEN; d->flags |= EF_KILL_OFFSCREEN;
@ -49,20 +49,20 @@ void initFleshChunk(Decoration *d)
static void tick(void) static void tick(void)
{ {
Decoration *d; Decoration *d;
d = (Decoration*)self; d = (Decoration*)self;
d->health--; d->health--;
d->bleedTime--; d->bleedTime--;
} }
static void action(void) static void action(void)
{ {
Decoration *d; Decoration *d;
d = (Decoration*)self; d = (Decoration*)self;
if (d->bleedTime > 0) if (d->bleedTime > 0)
{ {
addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h)); addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h));
@ -74,11 +74,11 @@ static void action(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
int mx, my; int mx, my;
if (other == NULL) if (other == NULL)
{ {
self->dx *= 0.9; self->dx *= 0.9;
if (app.config.blood == 2) if (app.config.blood == 2)
{ {
mx = (int) ((self->x + (self->w / 2)) / MAP_TILE_SIZE); mx = (int) ((self->x + (self->w / 2)) / MAP_TILE_SIZE);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -39,7 +39,7 @@ static void save(cJSON *root);
void initEntity(Entity *e) void initEntity(Entity *e)
{ {
e->uniqueId = world.entityCounter++; e->uniqueId = world.entityCounter++;
e->environment = ENV_AIR; e->environment = ENV_AIR;
e->alive = ALIVE_ALIVE; e->alive = ALIVE_ALIVE;
@ -55,10 +55,10 @@ void initEntity(Entity *e)
e->flags = 0; e->flags = 0;
e->thinkTime = 0; e->thinkTime = 0;
e->spriteFrame = -1; e->spriteFrame = -1;
e->spriteTime = 0; e->spriteTime = 0;
e->init = init; e->init = init;
e->reset = reset; e->reset = reset;
e->action = action; e->action = action;
@ -72,10 +72,10 @@ void initEntity(Entity *e)
e->die = die; e->die = die;
e->changeEnvironment = changeEnvironment; e->changeEnvironment = changeEnvironment;
e->getCollisionBounds = getCollisionBounds; e->getCollisionBounds = getCollisionBounds;
e->load = load; e->load = load;
e->save = save; e->save = save;
world.entityTail->next = e; world.entityTail->next = e;
world.entityTail = e; world.entityTail = e;
} }
@ -97,9 +97,9 @@ static void action(void)
static void animate(void) static void animate(void)
{ {
Sprite *s; Sprite *s;
s = self->sprite[self->facing]; s = self->sprite[self->facing];
if (self->spriteTime != -1) if (self->spriteTime != -1)
{ {
if (--self->spriteTime <= 0) if (--self->spriteTime <= 0)
@ -108,7 +108,7 @@ static void animate(void)
{ {
self->spriteFrame = 0; self->spriteFrame = 0;
} }
self->spriteTime = self->sprite[self->facing]->times[self->spriteFrame]; self->spriteTime = self->sprite[self->facing]->times[self->spriteFrame];
} }
} }
@ -169,15 +169,15 @@ void entityIdle(void)
static SDL_Rect *getCurrentSprite(void) static SDL_Rect *getCurrentSprite(void)
{ {
Sprite *s; Sprite *s;
s = self->sprite[self->facing]; s = self->sprite[self->facing];
if (self->spriteFrame >= s->numFrames) if (self->spriteFrame >= s->numFrames)
{ {
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", self->name, self->type, self->spriteFrame, s->numFrames); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "WARNING: %s (%d) bad sprite frames - %d > %d\n", self->name, self->type, self->spriteFrame, s->numFrames);
self->spriteFrame = 0; self->spriteFrame = 0;
} }
return &s->frames[self->spriteFrame]->rect; return &s->frames[self->spriteFrame]->rect;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -31,7 +31,7 @@ void initEntityFactory(void)
{ {
memset(&head, 0, sizeof(EntityDef)); memset(&head, 0, sizeof(EntityDef));
tail = &head; tail = &head;
addEntityDef("AquaBlob", initAquaBlob); addEntityDef("AquaBlob", initAquaBlob);
addEntityDef("PistolBlob", initPistolBlob); addEntityDef("PistolBlob", initPistolBlob);
addEntityDef("PistolEyeDroid", initPistolDroid); addEntityDef("PistolEyeDroid", initPistolDroid);
@ -54,11 +54,11 @@ void initEntityFactory(void)
addEntityDef("Frost", initFrost); addEntityDef("Frost", initFrost);
addEntityDef("EyeDroidCommander", initEyeDroidCommander); addEntityDef("EyeDroidCommander", initEyeDroidCommander);
addEntityDef("TankCommander", initTankCommander); addEntityDef("TankCommander", initTankCommander);
addEntityDef("Bob", initBob); addEntityDef("Bob", initBob);
addEntityDef("MIA", initMIA); addEntityDef("MIA", initMIA);
addEntityDef("Teeka", initTeeka); addEntityDef("Teeka", initTeeka);
addEntityDef("Item", initItem); addEntityDef("Item", initItem);
addEntityDef("BronzeKey", initBronzeKey); addEntityDef("BronzeKey", initBronzeKey);
addEntityDef("SilverKey", initSilverKey); addEntityDef("SilverKey", initSilverKey);
@ -69,10 +69,10 @@ void initEntityFactory(void)
addEntityDef("YellowKeycard", initYellowKeycard); addEntityDef("YellowKeycard", initYellowKeycard);
addEntityDef("WhiteKeycard", initWhiteKeycard); addEntityDef("WhiteKeycard", initWhiteKeycard);
addEntityDef("WeaponPickup", initWeaponPickup); addEntityDef("WeaponPickup", initWeaponPickup);
addEntityDef("Cell", initCell); addEntityDef("Cell", initCell);
addEntityDef("Heart", initHeart); addEntityDef("Heart", initHeart);
addEntityDef("Exit", initExit); addEntityDef("Exit", initExit);
addEntityDef("PowerPool", initPowerPool); addEntityDef("PowerPool", initPowerPool);
addEntityDef("Teleporter", initTeleporter); addEntityDef("Teleporter", initTeleporter);
@ -97,7 +97,7 @@ void initEntityFactory(void)
Entity *createEntity(char *name) Entity *createEntity(char *name)
{ {
EntityDef *def; EntityDef *def;
for (def = head.next ; def != NULL ; def = def->next) for (def = head.next ; def != NULL ; def = def->next)
{ {
if (strcmp(def->name, name) == 0) if (strcmp(def->name, name) == 0)
@ -106,22 +106,22 @@ Entity *createEntity(char *name)
return def->initFunc(); return def->initFunc();
} }
} }
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "No such entity definition '%s'", name); SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "No such entity definition '%s'", name);
exit(1); exit(1);
return NULL; return NULL;
} }
static void addEntityDef(char *name, Entity *(*initFunc)(void)) static void addEntityDef(char *name, Entity *(*initFunc)(void))
{ {
EntityDef *def; EntityDef *def;
def = malloc(sizeof(EntityDef)); def = malloc(sizeof(EntityDef));
memset(def, 0, sizeof(EntityDef)); memset(def, 0, sizeof(EntityDef));
tail->next = def; tail->next = def;
tail = def; tail = def;
STRNCPY(def->name, name, MAX_NAME_LENGTH); STRNCPY(def->name, name, MAX_NAME_LENGTH);
def->initFunc = initFunc; def->initFunc = initFunc;
} }
@ -131,11 +131,11 @@ static Entity *initGenericEvilBlob(void)
int r; int r;
char name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
strcpy(name, ""); strcpy(name, "");
r = rand() % world.numEnemyTypes; r = rand() % world.numEnemyTypes;
sprintf(name, "%sBlob", world.enemyTypes[r]); sprintf(name, "%sBlob", world.enemyTypes[r]);
return createEntity(name); return createEntity(name);
} }
@ -144,10 +144,10 @@ static Entity *initGenericEyeDroid(void)
int r; int r;
char name[MAX_NAME_LENGTH]; char name[MAX_NAME_LENGTH];
strcpy(name, ""); strcpy(name, "");
r = rand() % world.numEnemyTypes; r = rand() % world.numEnemyTypes;
sprintf(name, "%sEyeDroid", world.enemyTypes[r]); sprintf(name, "%sEyeDroid", world.enemyTypes[r]);
return createEntity(name); return createEntity(name);
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initAquaBlob(void) Entity *initAquaBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "AquaBlob"; u->unitType = "AquaBlob";
u->sprite[FACING_LEFT] = getSprite("AquaBlobLeft"); u->sprite[FACING_LEFT] = getSprite("AquaBlobLeft");
@ -41,7 +41,7 @@ Entity *initAquaBlob(void)
u->maxShotsToFire = 3; u->maxShotsToFire = 3;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@ static void animate(void);
Unit *createEvilBlob(void) Unit *createEvilBlob(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createUnit();
u->reload = 0; u->reload = 0;
@ -38,7 +38,7 @@ Unit *createEvilBlob(void)
u->returnToStartTimer = 0; u->returnToStartTimer = 0;
u->flags |= EF_HALT_AT_EDGE; u->flags |= EF_HALT_AT_EDGE;
superAnimate = u->animate; superAnimate = u->animate;
u->action = lookForPlayer; u->action = lookForPlayer;
@ -249,14 +249,14 @@ static void lookForPlayer(void)
patrol(); patrol();
return; return;
} }
r = randF(); r = randF();
if (world.missionType == MT_OUTPOST || game.plus) if (world.missionType == MT_OUTPOST || game.plus)
{ {
r = randF() * 0.65; r = randF() * 0.65;
} }
if (u->isMissionTarget) if (u->isMissionTarget)
{ {
r = randF() * 0.3; r = randF() * 0.3;
@ -294,7 +294,7 @@ static void die(void)
u->flags &= ~(EF_HALT_AT_EDGE | EF_GONE); u->flags &= ~(EF_HALT_AT_EDGE | EF_GONE);
u->action = die2; u->action = die2;
u->facing = FACING_DIE; u->facing = FACING_DIE;
u->thinkTime = 0; u->thinkTime = 0;
u->spriteTime = 0; u->spriteTime = 0;
@ -331,8 +331,8 @@ static void animate(void)
if (self->alive != ALIVE_ALIVE) if (self->alive != ALIVE_ALIVE)
{ {
self->facing = FACING_DIE; self->facing = FACING_DIE;
superAnimate(); superAnimate();
} }
else if (self->dx != 0) else if (self->dx != 0)
{ {

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,18 +27,18 @@ static int canFire(Entity *target);
Entity *initGrenadeBlob(void) Entity *initGrenadeBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "GrenadeBlob"; u->unitType = "GrenadeBlob";
u->sprite[FACING_LEFT] = getSprite("GrenadeBlobLeft"); u->sprite[FACING_LEFT] = getSprite("GrenadeBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("GrenadeBlobRight"); u->sprite[FACING_RIGHT] = getSprite("GrenadeBlobRight");
u->sprite[FACING_DIE] = getSprite("GrenadeBlobSpin"); u->sprite[FACING_DIE] = getSprite("GrenadeBlobSpin");
u->weaponType = WPN_GRENADES; u->weaponType = WPN_GRENADES;
u->maxShotsToFire = 1; u->maxShotsToFire = 1;
superPreFire = u->preFire; superPreFire = u->preFire;
u->preFire = preFire; u->preFire = preFire;
@ -50,9 +50,9 @@ Entity *initGrenadeBlob(void)
static void preFire(void) static void preFire(void)
{ {
Unit *u; Unit *u;
u = (Unit*)self; u = (Unit*)self;
superPreFire(); superPreFire();
if (u->shotsToFire == 0) if (u->shotsToFire == 0)

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initLaserBlob(void) Entity *initLaserBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "LaserBlob"; u->unitType = "LaserBlob";
u->sprite[FACING_LEFT] = getSprite("LaserBlobLeft"); u->sprite[FACING_LEFT] = getSprite("LaserBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("LaserBlobRight"); u->sprite[FACING_RIGHT] = getSprite("LaserBlobRight");
u->sprite[FACING_DIE] = getSprite("LaserBlobSpin"); u->sprite[FACING_DIE] = getSprite("LaserBlobSpin");
@ -39,7 +39,7 @@ Entity *initLaserBlob(void)
u->maxShotsToFire = 1; u->maxShotsToFire = 1;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initMachineGunBlob(void) Entity *initMachineGunBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "MachineGunBlob"; u->unitType = "MachineGunBlob";
u->sprite[FACING_LEFT] = getSprite("MachineGunBlobLeft"); u->sprite[FACING_LEFT] = getSprite("MachineGunBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("MachineGunBlobRight"); u->sprite[FACING_RIGHT] = getSprite("MachineGunBlobRight");
u->sprite[FACING_DIE] = getSprite("MachineGunBlobSpin"); u->sprite[FACING_DIE] = getSprite("MachineGunBlobSpin");
@ -39,7 +39,7 @@ Entity *initMachineGunBlob(void)
u->maxShotsToFire = 5; u->maxShotsToFire = 5;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initPistolBlob(void) Entity *initPistolBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "PistolBlob"; u->unitType = "PistolBlob";
u->sprite[FACING_LEFT] = getSprite("PistolBlobLeft"); u->sprite[FACING_LEFT] = getSprite("PistolBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("PistolBlobRight"); u->sprite[FACING_RIGHT] = getSprite("PistolBlobRight");
u->sprite[FACING_DIE] = getSprite("PistolBlobSpin"); u->sprite[FACING_DIE] = getSprite("PistolBlobSpin");
@ -39,7 +39,7 @@ Entity *initPistolBlob(void)
u->maxShotsToFire = 3; u->maxShotsToFire = 3;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initPlasmaBlob(void) Entity *initPlasmaBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "PlasmaBlob"; u->unitType = "PlasmaBlob";
u->sprite[FACING_LEFT] = getSprite("PlasmaBlobLeft"); u->sprite[FACING_LEFT] = getSprite("PlasmaBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("PlasmaBlobRight"); u->sprite[FACING_RIGHT] = getSprite("PlasmaBlobRight");
u->sprite[FACING_DIE] = getSprite("PlasmaBlobSpin"); u->sprite[FACING_DIE] = getSprite("PlasmaBlobSpin");
@ -39,7 +39,7 @@ Entity *initPlasmaBlob(void)
u->maxShotsToFire = 6; u->maxShotsToFire = 6;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initShotgunBlob(void) Entity *initShotgunBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "ShotgunBlob"; u->unitType = "ShotgunBlob";
u->sprite[FACING_LEFT] = getSprite("ShotgunBlobLeft"); u->sprite[FACING_LEFT] = getSprite("ShotgunBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("ShotgunBlobRight"); u->sprite[FACING_RIGHT] = getSprite("ShotgunBlobRight");
u->sprite[FACING_DIE] = getSprite("ShotgunBlobSpin"); u->sprite[FACING_DIE] = getSprite("ShotgunBlobSpin");

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initSpreadGunBlob(void) Entity *initSpreadGunBlob(void)
{ {
Unit *u; Unit *u;
u = createEvilBlob(); u = createEvilBlob();
u->unitType = "SpreadGunBlob"; u->unitType = "SpreadGunBlob";
u->sprite[FACING_LEFT] = getSprite("SpreadGunBlobLeft"); u->sprite[FACING_LEFT] = getSprite("SpreadGunBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("SpreadGunBlobRight"); u->sprite[FACING_RIGHT] = getSprite("SpreadGunBlobRight");
u->sprite[FACING_DIE] = getSprite("SpreadGunBlobSpin"); u->sprite[FACING_DIE] = getSprite("SpreadGunBlobSpin");
@ -39,7 +39,7 @@ Entity *initSpreadGunBlob(void)
u->maxShotsToFire = 3; u->maxShotsToFire = 3;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@ static void (*superTouch)(Entity *other);
Unit *createEyeDroid(void) Unit *createEyeDroid(void)
{ {
Unit *u; Unit *u;
u = createUnit(); u = createUnit();
u->flags |= EF_WEIGHTLESS | EF_HALT_AT_EDGE | EF_EXPLODES; u->flags |= EF_WEIGHTLESS | EF_HALT_AT_EDGE | EF_EXPLODES;
@ -222,12 +222,12 @@ static void lookForPlayer(void)
} }
r = randF(); r = randF();
if (world.missionType == MT_OUTPOST || game.plus) if (world.missionType == MT_OUTPOST || game.plus)
{ {
r = randF() * 0.65; r = randF() * 0.65;
} }
if (u->isMissionTarget) if (u->isMissionTarget)
{ {
r = randF() * 0.3; r = randF() * 0.3;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,23 +27,23 @@ static int canFire(Entity *target);
Entity *initGrenadeDroid(void) Entity *initGrenadeDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "GrenadeEyeDroid"; u->unitType = "GrenadeEyeDroid";
u->sprite[FACING_LEFT] = getSprite("GrenadeDroidLeft"); u->sprite[FACING_LEFT] = getSprite("GrenadeDroidLeft");
u->sprite[FACING_RIGHT] = getSprite("GrenadeDroidRight"); u->sprite[FACING_RIGHT] = getSprite("GrenadeDroidRight");
u->sprite[FACING_DIE] = getSprite("GrenadeDroidDie"); u->sprite[FACING_DIE] = getSprite("GrenadeDroidDie");
u->weaponType = WPN_GRENADES; u->weaponType = WPN_GRENADES;
u->maxShotsToFire = 1; u->maxShotsToFire = 1;
superPreFire = u->preFire; superPreFire = u->preFire;
u->preFire = preFire; u->preFire = preFire;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initLaserDroid(void) Entity *initLaserDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "LaserEyeDroid"; u->unitType = "LaserEyeDroid";
u->sprite[FACING_LEFT] = getSprite("LaserDroidLeft"); u->sprite[FACING_LEFT] = getSprite("LaserDroidLeft");
@ -39,7 +39,7 @@ Entity *initLaserDroid(void)
u->maxShotsToFire = 1; u->maxShotsToFire = 1;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initMachineGunDroid(void) Entity *initMachineGunDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "MachineGunEyeDroid"; u->unitType = "MachineGunEyeDroid";
u->sprite[FACING_LEFT] = getSprite("MachineGunDroidLeft"); u->sprite[FACING_LEFT] = getSprite("MachineGunDroidLeft");
@ -39,7 +39,7 @@ Entity *initMachineGunDroid(void)
u->maxShotsToFire = 5; u->maxShotsToFire = 5;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initPistolDroid(void) Entity *initPistolDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "PistolEyeDroid"; u->unitType = "PistolEyeDroid";
u->sprite[FACING_LEFT] = getSprite("PistolDroidLeft"); u->sprite[FACING_LEFT] = getSprite("PistolDroidLeft");
u->sprite[FACING_RIGHT] = getSprite("PistolDroidRight"); u->sprite[FACING_RIGHT] = getSprite("PistolDroidRight");
u->sprite[FACING_DIE] = getSprite("PistolDroidDie"); u->sprite[FACING_DIE] = getSprite("PistolDroidDie");
@ -39,7 +39,7 @@ Entity *initPistolDroid(void)
u->maxShotsToFire = 3; u->maxShotsToFire = 3;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initPlasmaDroid(void) Entity *initPlasmaDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "PlasmaEyeDroid"; u->unitType = "PlasmaEyeDroid";
u->sprite[FACING_LEFT] = getSprite("PlasmaDroidLeft"); u->sprite[FACING_LEFT] = getSprite("PlasmaDroidLeft");
@ -39,7 +39,7 @@ Entity *initPlasmaDroid(void)
u->maxShotsToFire = 6; u->maxShotsToFire = 6;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initShotgunDroid(void) Entity *initShotgunDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "ShotgunEyeDroid"; u->unitType = "ShotgunEyeDroid";
u->sprite[FACING_LEFT] = getSprite("ShotgunDroidLeft"); u->sprite[FACING_LEFT] = getSprite("ShotgunDroidLeft");

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initSpreadGunDroid(void) Entity *initSpreadGunDroid(void)
{ {
Unit *u; Unit *u;
u = createEyeDroid(); u = createEyeDroid();
u->unitType = "SpreadGunEyeDroid"; u->unitType = "SpreadGunEyeDroid";
u->sprite[FACING_LEFT] = getSprite("SpreadGunDroidLeft"); u->sprite[FACING_LEFT] = getSprite("SpreadGunDroidLeft");
@ -39,7 +39,7 @@ Entity *initSpreadGunDroid(void)
u->maxShotsToFire = 3; u->maxShotsToFire = 3;
u->canFire = canFire; u->canFire = canFire;
return (Entity*)u; return (Entity*)u;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,23 +25,23 @@ static void touch(Entity *other);
Item *initBattery(void) Item *initBattery(void)
{ {
Item *i; Item *i;
i = initConsumable(); i = initConsumable();
i->spriteFrame = 0; i->spriteFrame = 0;
i->spriteTime = -1; i->spriteTime = -1;
i->touch = touch; i->touch = touch;
return i; return i;
} }
static void touch(Entity *other) static void touch(Entity *other)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (touchedPlayer(other)) if (touchedPlayer(other))
{ {
world.bob->power = MIN(world.bob->power + i->power, world.bob->powerMax); world.bob->power = MIN(world.bob->power + i->power, world.bob->powerMax);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -26,9 +26,9 @@ static void init(void);
Entity *initCell(void) Entity *initCell(void)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_CELL; i->type = ET_CELL;
i->isMissionTarget = 1; i->isMissionTarget = 1;
@ -42,7 +42,7 @@ Entity *initCell(void)
i->init = init; i->init = init;
i->touch = touch; i->touch = touch;
return (Entity*)i; return (Entity*)i;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -25,20 +25,20 @@ static void touch(Entity *other);
Item *initCherry(void) Item *initCherry(void)
{ {
Item *i; Item *i;
i = initConsumable(); i = initConsumable();
i->touch = touch; i->touch = touch;
return i; return i;
} }
static void touch(Entity *other) static void touch(Entity *other)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (touchedPlayer(other)) if (touchedPlayer(other))
{ {
world.bob->health = limit(world.bob->health + i->value, 0, world.bob->healthMax); world.bob->health = limit(world.bob->health + i->value, 0, world.bob->healthMax);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -26,30 +26,30 @@ static void die(void);
Item *initConsumable(void) Item *initConsumable(void)
{ {
Item *i; Item *i;
i = malloc(sizeof(Item)); i = malloc(sizeof(Item));
memset(i, 0, sizeof(Item)); memset(i, 0, sizeof(Item));
initEntity((Entity*)i); initEntity((Entity*)i);
i->type = ET_CONSUMABLE; i->type = ET_CONSUMABLE;
i->flags |= EF_IGNORE_BULLETS | EF_CRUSHABLE; i->flags |= EF_IGNORE_BULLETS | EF_CRUSHABLE;
i->health = FPS * 10; i->health = FPS * 10;
i->tick = tick; i->tick = tick;
i->die = die; i->die = die;
return i; return i;
} }
static void tick(void) static void tick(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (i->isOnGround) if (i->isOnGround)
{ {
i->dx *= 0.05; i->dx *= 0.05;
@ -75,9 +75,9 @@ int touchedPlayer(Entity *other)
void pickupItem(void) void pickupItem(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
i->alive = (i->environment == ENV_AIR) ? ALIVE_DYING : ALIVE_DEAD; i->alive = (i->environment == ENV_AIR) ? ALIVE_DYING : ALIVE_DEAD;
i->health = FPS / 2; i->health = FPS / 2;
i->thinkTime = 0; i->thinkTime = 0;

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -27,9 +27,9 @@ static void init(void);
Entity *initHeart(Entity *e) Entity *initHeart(Entity *e)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_HEART; i->type = ET_HEART;
i->isMissionTarget = 1; i->isMissionTarget = 1;
@ -44,7 +44,7 @@ Entity *initHeart(Entity *e)
i->action = action; i->action = action;
i->init = init; i->init = init;
i->touch = touch; i->touch = touch;
return (Entity*)i; return (Entity*)i;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -35,12 +35,12 @@ static void save(cJSON *root);
Entity *createItem(void) Entity *createItem(void)
{ {
Item *i; Item *i;
i = malloc(sizeof(Item)); i = malloc(sizeof(Item));
memset(i, 0, sizeof(Item)); memset(i, 0, sizeof(Item));
initEntity((Entity*)i); initEntity((Entity*)i);
i->type = ET_ITEM; i->type = ET_ITEM;
STRNCPY(i->spriteName, "Weapon", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "Weapon", MAX_NAME_LENGTH);
@ -62,7 +62,7 @@ Entity *createItem(void)
i->die = die; i->die = die;
i->load = load; i->load = load;
i->save = save; i->save = save;
return (Entity*)i; return (Entity*)i;
} }
@ -74,18 +74,18 @@ Entity *initItem(void)
static void init(void) static void init(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
i->sprite[FACING_LEFT] = i->sprite[FACING_RIGHT] = i->sprite[FACING_DIE] = getSprite(i->spriteName); i->sprite[FACING_LEFT] = i->sprite[FACING_RIGHT] = i->sprite[FACING_DIE] = getSprite(i->spriteName);
} }
static void reset(void) static void reset(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
self->x = i->startX; self->x = i->startX;
self->y = i->startY; self->y = i->startY;
} }
@ -104,9 +104,9 @@ static void tick(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (i->alive == ALIVE_ALIVE && other != NULL && i->canBePickedUp) if (i->alive == ALIVE_ALIVE && other != NULL && i->canBePickedUp)
{ {
if (other->type == ET_BOB && !world.bob->stunTimer) if (other->type == ET_BOB && !world.bob->stunTimer)
@ -127,9 +127,9 @@ static void touch(Entity *other)
static void bobPickupItem(void) static void bobPickupItem(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (!i->isMissionTarget) if (!i->isMissionTarget)
{ {
if (i->thinkTime == 0) if (i->thinkTime == 0)
@ -158,7 +158,7 @@ static void bobPickupItem(void)
updateObjective(i->name); updateObjective(i->name);
i->collected = 1; i->collected = 1;
} }
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name); setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
playSound(SND_ITEM, i->uniqueId % MAX_SND_CHANNELS); playSound(SND_ITEM, i->uniqueId % MAX_SND_CHANNELS);
@ -185,9 +185,9 @@ static void bobPickupItem(void)
static void enemyPickupItem(Unit *u) static void enemyPickupItem(Unit *u)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (u->canCarryItem && u->carriedItem == NULL && u->alive == ALIVE_ALIVE) if (u->canCarryItem && u->carriedItem == NULL && u->alive == ALIVE_ALIVE)
{ {
u->carriedItem = i; u->carriedItem = i;
@ -199,9 +199,9 @@ static void enemyPickupItem(Unit *u)
static void destructablePickupItem(Structure *s) static void destructablePickupItem(Structure *s)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (s->carriedItem == NULL && s->alive == ALIVE_ALIVE) if (s->carriedItem == NULL && s->alive == ALIVE_ALIVE)
{ {
s->carriedItem = i; s->carriedItem = i;
@ -213,9 +213,9 @@ static void destructablePickupItem(Structure *s)
static void changeEnvironment(void) static void changeEnvironment(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (i->environment == ENV_SLIME || i->environment == ENV_LAVA) if (i->environment == ENV_SLIME || i->environment == ENV_LAVA)
{ {
addTeleportStars(self); addTeleportStars(self);
@ -234,9 +234,9 @@ static void die(void)
static void load(cJSON *root) static void load(cJSON *root)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
i->canBeCarried = cJSON_GetObjectItem(root, "canBeCarried")->valueint; i->canBeCarried = cJSON_GetObjectItem(root, "canBeCarried")->valueint;
i->canBePickedUp = cJSON_GetObjectItem(root, "canBePickedUp")->valueint; i->canBePickedUp = cJSON_GetObjectItem(root, "canBePickedUp")->valueint;
i->isMissionTarget = cJSON_GetObjectItem(root, "isMissionTarget")->valueint; i->isMissionTarget = cJSON_GetObjectItem(root, "isMissionTarget")->valueint;
@ -247,7 +247,7 @@ static void load(cJSON *root)
{ {
i->collected = cJSON_GetObjectItem(root, "collected")->valueint; i->collected = cJSON_GetObjectItem(root, "collected")->valueint;
} }
if (game.plus & PLUS_MIRROR) if (game.plus & PLUS_MIRROR)
{ {
i->startX = MAP_PIXEL_WIDTH - i->startX; i->startX = MAP_PIXEL_WIDTH - i->startX;
@ -257,28 +257,28 @@ static void load(cJSON *root)
static void save(cJSON *root) static void save(cJSON *root)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
switch (i->type) switch (i->type)
{ {
case ET_KEY: case ET_KEY:
cJSON_AddStringToObject(root, "type", i->sprite[0]->name); cJSON_AddStringToObject(root, "type", i->sprite[0]->name);
break; break;
case ET_HEART: case ET_HEART:
cJSON_AddStringToObject(root, "type", "Heart"); cJSON_AddStringToObject(root, "type", "Heart");
break; break;
case ET_CELL: case ET_CELL:
cJSON_AddStringToObject(root, "type", "Cell"); cJSON_AddStringToObject(root, "type", "Cell");
break; break;
default: default:
cJSON_AddStringToObject(root, "type", "Item"); cJSON_AddStringToObject(root, "type", "Item");
break; break;
} }
cJSON_AddNumberToObject(root, "canBeCarried", i->canBeCarried); cJSON_AddNumberToObject(root, "canBeCarried", i->canBeCarried);
cJSON_AddNumberToObject(root, "canBePickedUp", i->canBePickedUp); cJSON_AddNumberToObject(root, "canBePickedUp", i->canBePickedUp);
cJSON_AddNumberToObject(root, "isMissionTarget", i->isMissionTarget); cJSON_AddNumberToObject(root, "isMissionTarget", i->isMissionTarget);

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -23,41 +23,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Entity *initBronzeKey(Entity *e) Entity *initBronzeKey(Entity *e)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Bronze Key", MAX_NAME_LENGTH); STRNCPY(i->name, "Bronze Key", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "BronzeKey", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "BronzeKey", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }
Entity *initSilverKey(Entity *e) Entity *initSilverKey(Entity *e)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Silver Key", MAX_NAME_LENGTH); STRNCPY(i->name, "Silver Key", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "SilverKey", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "SilverKey", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }
Entity *initGoldKey(Entity *e) Entity *initGoldKey(Entity *e)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Gold Key", MAX_NAME_LENGTH); STRNCPY(i->name, "Gold Key", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "GoldKey", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "GoldKey", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -26,65 +26,65 @@ static void touchWhiteKeycard(Entity *other);
Entity *initRedKeycard(void) Entity *initRedKeycard(void)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Red Keycard", MAX_NAME_LENGTH); STRNCPY(i->name, "Red Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "RedKeycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "RedKeycard", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }
Entity *initBlueKeycard(void) Entity *initBlueKeycard(void)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Blue Keycard", MAX_NAME_LENGTH); STRNCPY(i->name, "Blue Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "BlueKeycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "BlueKeycard", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }
Entity *initGreenKeycard(void) Entity *initGreenKeycard(void)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Green Keycard", MAX_NAME_LENGTH); STRNCPY(i->name, "Green Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "GreenKeycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "GreenKeycard", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }
Entity *initYellowKeycard(void) Entity *initYellowKeycard(void)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "Yellow Keycard", MAX_NAME_LENGTH); STRNCPY(i->name, "Yellow Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "YellowKeycard", MAX_NAME_LENGTH); STRNCPY(i->spriteName, "YellowKeycard", MAX_NAME_LENGTH);
return (Entity*)i; return (Entity*)i;
} }
Entity *initWhiteKeycard(void) Entity *initWhiteKeycard(void)
{ {
Item *i; Item *i;
i = (Item*)createItem(); i = (Item*)createItem();
i->type = ET_KEY; i->type = ET_KEY;
STRNCPY(i->name, "White Keycard", MAX_NAME_LENGTH); STRNCPY(i->name, "White Keycard", MAX_NAME_LENGTH);
@ -93,7 +93,7 @@ Entity *initWhiteKeycard(void)
itemTouch = i->touch; itemTouch = i->touch;
i->touch = touchWhiteKeycard; i->touch = touchWhiteKeycard;
return (Entity*)i; return (Entity*)i;
} }

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License

View File

@ -1,5 +1,5 @@
/* /*
Copyright (C) 2018 Parallel Realities Copyright (C) 2018-2019 Parallel Realities
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
@ -30,11 +30,11 @@ static void save(cJSON *root);
Entity *initWeaponPickup(void) Entity *initWeaponPickup(void)
{ {
Item *i; Item *i;
i = (Item*)initConsumable(); i = (Item*)initConsumable();
i->weaponType = WPN_PISTOL; i->weaponType = WPN_PISTOL;
superTick = i->tick; superTick = i->tick;
i->init = init; i->init = init;
@ -42,16 +42,16 @@ Entity *initWeaponPickup(void)
i->touch = touch; i->touch = touch;
i->load = load; i->load = load;
i->save = save; i->save = save;
return (Entity*)i; return (Entity*)i;
} }
static void init(void) static void init(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
i->sprite[0] = i->sprite[1] = i->sprite[2] = getSprite("Weapon"); i->sprite[0] = i->sprite[1] = i->sprite[2] = getSprite("Weapon");
i->spriteFrame = i->weaponType; i->spriteFrame = i->weaponType;
i->spriteTime = -1; i->spriteTime = -1;
@ -65,9 +65,9 @@ static void init(void)
static void tick(void) static void tick(void)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
superTick(); superTick();
if (i->provided && i->alive == ALIVE_ALIVE) if (i->provided && i->alive == ALIVE_ALIVE)
@ -79,9 +79,9 @@ static void tick(void)
static void touch(Entity *other) static void touch(Entity *other)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
if (touchedPlayer(other)) if (touchedPlayer(other))
{ {
world.bob->weaponType = i->weaponType; world.bob->weaponType = i->weaponType;
@ -108,9 +108,9 @@ static void touch(Entity *other)
static void load(cJSON *root) static void load(cJSON *root)
{ {
Item *i; Item *i;
i = (Item*)self; i = (Item*)self;
i->weaponType = lookup(cJSON_GetObjectItem(root, "weaponType")->valuestring); i->weaponType = lookup(cJSON_GetObjectItem(root, "weaponType")->valuestring);
i->provided = cJSON_GetObjectItem(root, "provided")->valueint; i->provided = cJSON_GetObjectItem(root, "provided")->valueint;
} }

Some files were not shown because too many files have changed in this diff Show More