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
SEARCHPATH += src
SEARCHPATH += src/combat
SEARCHPATH += src/entities
SEARCHPATH += src
SEARCHPATH += src/combat
SEARCHPATH += src/entities
SEARCHPATH += src/entities/blobs
SEARCHPATH += src/entities/boss
SEARCHPATH += src/entities/bullets
@ -23,8 +23,8 @@ SEARCHPATH += src/hub
SEARCHPATH += src/json
SEARCHPATH += src/system
SEARCHPATH += src/test
SEARCHPATH += src/util
SEARCHPATH += src/widgets
SEARCHPATH += src/util
SEARCHPATH += src/widgets
SEARCHPATH += src/world
vpath %.c $(SEARCHPATH)
@ -63,10 +63,10 @@ all: $(PROG) $(LOCALE_MO)
$(OUT)/%.o: %.c %.h $(DEPS)
@mkdir -p $(OUT)
$(CC) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
%.mo: %.po
msgfmt -c -o $@ $<
# cleaning everything that can be automatically recreated with "make".
clean:
$(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
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 += -g -lefence
CXXFLAGS += -fms-extensions -std=gnu11
@ -55,13 +58,13 @@ install:
cp -p icons/$(PROG)-128x128.png $(INST_ICON_DIR)/128x128/apps/$(PROG).png
mkdir -p $(INST_DESKTOP_DIR)
cp -p icons/$(PROG).desktop $(INST_DESKTOP_DIR)
@for f in $(LOCALE_MO); do \
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
mkdir -p $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES; \
cp -v $$f $(INST_LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
done
uninstall:
$(RM) $(BIN_DIR)/$(PROG)
$(RM) -rf $(DATA_DIR)
@ -70,7 +73,7 @@ uninstall:
$(RM) $(ICON_DIR)/64x64/apps/$(PROG).png
$(RM) $(ICON_DIR)/128x128/apps/$(PROG).png
$(RM) $(DESKTOP_DIR)/$(PROG).desktop
@for f in $(LOCALE_MO); do \
lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \
$(RM) -v $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \
@ -85,7 +88,7 @@ dist:
mkdir -p dist
mv $(PROG)-$(VERSION).$(REVISION).linux-x86.tar.gz dist
$(RM) -rf $(PROG)-$(VERSION).$(REVISION)
# prepare an archive for the program
src-dist:
$(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
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;
Entity **candidates, *e;
SDL_Rect losBounds;
sx = src->x + (src->w / 2);
sy = src->y + (src->h / 2);
tx = dest->x + (dest->w / 2);
ty = dest->y + (dest->h / 2);
losBounds.x = (int) MIN(src->x, dest->x);
losBounds.y = (int) MIN(src->y, dest->y);
losBounds.w = (int) (MAX(src->x, dest->x) - losBounds.x);
losBounds.h = (int) (MAX(src->y, dest->y) - losBounds.y);
candidates = getAllEntsWithin(losBounds.x, losBounds.y, losBounds.w, losBounds.h, NULL);
getSlope(sx, sy, tx, ty, &dx, &dy);
dx *= 8;
dy *= 8;
while (1)
{
sx -= dx;
sy -= dy;
mx = sx / MAP_TILE_SIZE;
my = sy / MAP_TILE_SIZE;
if (isSolid(mx, my))
{
return 0;
}
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))
@ -65,7 +65,7 @@ int hasLineOfSight(Entity *src, Entity *dest)
{
return 0;
}
if (e == dest)
{
return 1;
@ -73,7 +73,7 @@ int hasLineOfSight(Entity *src, Entity *dest)
}
}
}
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
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
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;
float power;
int i;
playBattleSound(SND_EXPLOSION, 0, x, y);
/* 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.w = radius * 2;
radiusRect.h = radius * 2;
if (killTimer < SDL_GetTicks())
{
numKilled = 0;
@ -77,17 +77,17 @@ void addExplosion(float x, float y, int radius, Entity *owner)
{
stunBob();
}
if (owner->type == ET_ENEMY && e->health <= 0 && e->type == ET_ENEMY && strstr(((Unit*)owner)->unitType, "EyeDroid"))
{
game.stats[STAT_EYE_DROID_EXPLOSION_KILLS]++;
}
if (e->health <= 0)
{
e->dx = rrnd(-radius / 8, radius / 8);
e->dy = rrnd(-5, 0);
if (owner->type == ET_BOB)
{
numKilled++;
@ -104,7 +104,7 @@ void addExplosion(float x, float y, int radius, Entity *owner)
setGameplayMessage(MSG_STANDARD, "%d hit grenade combo!", numKilled);
game.stats[STAT_GRENADE_COMBO] = MAX(game.stats[STAT_GRENADE_COMBO], numKilled);
if (numKilled >= 12)
{
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
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
modify it under the terms of the GNU General Public License
@ -56,7 +56,7 @@ void initWeapons(void)
missileSprite[0] = getSprite("MissileRight");
missileSprite[1] = getSprite("MissileLeft");
weaponName[WPN_PISTOL] = _("Pistol");
weaponName[WPN_PLASMA] = _("Plasma Rifle");
weaponName[WPN_SPREAD] = _("Spread Gun");
@ -68,7 +68,7 @@ void initWeapons(void)
void firePistol(void)
{
Bullet *bullet;
if (world.bob->facing != FACING_DIE)
{
bullet = createBaseBullet((Unit*)world.bob, bulletSprite[0]->frames[0]->rect.w);
@ -88,7 +88,7 @@ void fireAimedShot(Unit *owner)
int x, y;
float dx, dy;
Bullet *bullet;
if (owner->facing != FACING_DIE)
{
x = (int) (world.bob->x + rrnd(-8, 24));
@ -112,7 +112,7 @@ void fireAimedShot(Unit *owner)
void fireMachineGun(Unit *owner)
{
Bullet *bullet;
if (owner->facing != FACING_DIE)
{
bullet = createBaseBullet(owner, bulletSprite[0]->w);
@ -128,7 +128,7 @@ void fireMachineGun(Unit *owner)
void firePlasma(Unit *owner)
{
Bullet *bullet;
if (owner->facing != FACING_DIE)
{
bullet = createBaseBullet(owner, plasmaSprite[0]->w);
@ -173,7 +173,7 @@ void fireSpread(Unit *owner, int numberOfShots)
void fireLaser(Unit *owner)
{
Bullet *laser;
if (owner->facing != FACING_DIE)
{
laser = createBaseBullet(owner, laserSprite[0]->w);
@ -193,7 +193,7 @@ void fireLaser(Unit *owner)
void fireGrenade(Unit *owner)
{
Bullet *grenade;
if (owner->facing != FACING_DIE)
{
grenade = createBaseBullet(owner, grenadeSprite->w);
@ -217,7 +217,7 @@ void fireShotgun(Unit *owner)
int i;
float dx, dy;
Bullet *bullet;
if (owner->facing != FACING_DIE)
{
for (i = 0 ; i < 8 ; i++)
@ -243,7 +243,7 @@ void fireShotgun(Unit *owner)
void fireMissile(Unit *owner)
{
Bullet *missile;
if (owner->facing != FACING_DIE)
{
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
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
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
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
modify it under the terms of the GNU General Public License
@ -54,12 +54,12 @@ static int oldFacing;
Entity *initBob(void)
{
Bob *b;
b = malloc(sizeof(Bob));
memset(b, 0, sizeof(Bob));
initEntity((Entity*)b);
STRNCPY(b->name, "Bob", MAX_NAME_LENGTH);
b->type = ET_BOB;
@ -83,9 +83,9 @@ Entity *initBob(void)
b->reload = 0;
b->flags |= EF_SWIMS | EF_BOMB_SHIELD;
superAnimate = b->animate;
b->tick = tick;
b->init = init;
b->applyDamage = applyDamage;
@ -96,21 +96,21 @@ Entity *initBob(void)
b->die = die;
b->load = load;
b->save = save;
checkpointTimer = 0;
oldFacing = b->facing;
return (Entity*)b;
}
static void init(void)
{
changeSprite(walkSprite);
world.bob->checkpoints[0].x = world.bob->x;
world.bob->checkpoints[0].y = world.bob->y;
superAnimate();
}
@ -243,7 +243,7 @@ static void handeImmunity(void)
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[0].x = world.bob->x;
world.bob->checkpoints[0].y = world.bob->y;
checkpointTimer = FPS;
@ -361,11 +361,11 @@ static void doBobInWater(void)
static void doDying(void)
{
int mx, my;
if (--world.bob->health <= -(FPS * 2))
{
world.bob->flags |= EF_GONE;
if (app.config.blood)
{
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);
}
mx = (int) ((world.bob->x + (world.bob->w / 2)) / MAP_TILE_SIZE);
my = (int) (world.bob->y / MAP_TILE_SIZE) + 1;
addBloodDecal(mx, my);
@ -472,7 +472,7 @@ static void bobWalk(void)
{
fireWeapon();
}
if (isControl(CONTROL_JETPACK))
{
activate(1);
@ -511,7 +511,7 @@ static void bobSwim(void)
{
firePistol();
}
if (isControl(CONTROL_JETPACK))
{
activate(1);
@ -549,7 +549,7 @@ static void bobFly(void)
{
fireWeapon();
}
if (isControl(CONTROL_JETPACK))
{
activate(1);
@ -618,7 +618,7 @@ void resetAtCheckpoint(void)
{
world.bob->x = world.bob->checkpoints[0].x;
world.bob->y = world.bob->checkpoints[0].y;
world.bob->facing = oldFacing;
world.bob->outTimer = 0;
world.bob->flags |= EF_FLICKER;
@ -666,7 +666,7 @@ static void die(void)
static SDL_Rect *getCurrentSprite(void)
{
Sprite *s;
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;
@ -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);
world.bob->spriteFrame = 0;
}
return &s->frames[world.bob->spriteFrame]->rect;
}
@ -689,9 +689,9 @@ static void animate(void)
{
oldFacing = world.bob->facing;
}
world.bob->facing = FACING_DIE;
superAnimate();
}
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->y = cJSON_GetObjectItem(root, "y")->valueint;
world.bob->facing = lookup(cJSON_GetObjectItem(root, "facing")->valuestring);
if (game.plus & PLUS_MIRROR)
{
world.bob->x = MAP_PIXEL_WIDTH - world.bob->x;
@ -719,7 +719,7 @@ static void save(cJSON *root)
{
world.bob->facing = oldFacing;
}
cJSON_AddStringToObject(root, "type", "Bob");
cJSON_AddNumberToObject(root, "x", world.bob->checkpoints[0].x);
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
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
modify it under the terms of the GNU General Public License
@ -32,14 +32,14 @@ static void save(cJSON *root);
Entity *initMIA(void)
{
MIA *m;
m = malloc(sizeof(MIA));
memset(m, 0, sizeof(MIA));
initEntity((Entity*)m);
m->type = ET_MIA;
m->tx = m->ty = -1;
m->sprite[FACING_LEFT] = getSprite("MIA");
@ -60,7 +60,7 @@ Entity *initMIA(void)
m->save = save;
m->isMissionTarget = 1;
return (Entity*)m;
}
@ -81,9 +81,9 @@ static void reset(void)
static void tick(void)
{
MIA *m;
m = (MIA*)self;
if (--m->shudderTimer <= 0)
{
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);
m->starTimer = 1;
}
world.saveDelay = FPS;
}
}
@ -105,9 +105,9 @@ static void tick(void)
static void touch(Entity *other)
{
MIA *m;
m = (MIA*)self;
if (m->isMissionTarget && other == (Entity*)world.bob)
{
m->action = preTeleport;
@ -125,49 +125,49 @@ static void touch(Entity *other)
static void preTeleport(void)
{
MIA *m;
m = (MIA*)self;
if (--m->teleportTimer <= FPS)
{
m->action = teleport;
m->flags |= (EF_NO_CLIP | EF_WEIGHTLESS);
m->dy = -5;
}
world.saveDelay = FPS;
}
static void teleport(void)
{
MIA *m;
m = (MIA*)self;
if (--m->teleportTimer <= 0)
{
addTeleportStars(self);
m->alive = ALIVE_DEAD;
}
world.saveDelay = FPS;
}
static void load(cJSON *root)
{
MIA *m;
m = (MIA*)self;
m->active = cJSON_GetObjectItem(root, "isMissionTarget")->valueint;
}
static void save(cJSON *root)
{
MIA *m;
m = (MIA*)self;
cJSON_AddStringToObject(root, "type", "MIA");
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
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
modify it under the terms of the GNU General Public License
@ -33,13 +33,13 @@ static int exitMission;
Entity *initTeeka(void)
{
Unit *u;
u = createUnit();
u->unitType = "Teeka";
u->type = ET_TEEKA;
u->flags |= EF_IMMUNE;
u->action = lookForEnemies;
@ -51,15 +51,15 @@ Entity *initTeeka(void)
u->sprite[FACING_DIE] = getSprite("TeekaLeft");
u->health = u->healthMax = 9999;
superTick = u->tick;
u->tick = tick;
exitMission = 0;
aimedSprite = getSprite("AimedShot");
return (Entity*)u;
}
@ -87,13 +87,13 @@ static void lookForEnemies(void)
Entity *e;
float distance, range;
Unit *u;
u = (Unit*)self;
u->thinkTime = rrnd(FPS / 2, FPS);
target = NULL;
distance = 800;
for (e = world.entityHead.next ; e != NULL ; e = e->next)
@ -134,9 +134,9 @@ static void lookForEnemies(void)
static void preFire(void)
{
Unit *u;
u = (Unit*)self;
if (u->reload > 0)
{
return;
@ -148,7 +148,7 @@ static void preFire(void)
}
attack();
if (--u->shotsToFire <= 0)
{
u->thinkTime = FPS;
@ -160,7 +160,7 @@ static void attack(void)
{
Bullet *bullet;
float dx, dy;
getSlope(target->x, target->y, self->x, self->y, &dx, &dy);
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
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
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)
{
Boss *b;
b = initBlobBoss();
b->weakAgainst = ENV_WATER;
STRNCPY(b->name, "Blaze", MAX_NAME_LENGTH);
b->sprite[FACING_LEFT] = getSprite("BlazeLeft");
b->sprite[FACING_RIGHT] = getSprite("BlazeRight");
b->sprite[FACING_DIE] = getSprite("BlazeSpin");
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
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
modify it under the terms of the GNU General Public License
@ -40,17 +40,17 @@ static Sprite *aimedSprite;
Boss *initBlobBoss(void)
{
Boss *b;
b = initBoss();
b->flags |= EF_HALT_AT_EDGE;
b->health = b->healthMax = 250;
b->teleportTimer = FPS * rrnd(4, 6);
superAnimate = b->animate;
b->activate = activate;
b->action = walk;
b->walk = walk;
@ -60,9 +60,9 @@ Boss *initBlobBoss(void)
b->animate = animate;
b->applyDamage = applyDamage;
b->die = die1;
aimedSprite = getSprite("AimedShot");
return b;
}
@ -83,9 +83,9 @@ static void activate(int activate)
static void tick(void)
{
Boss *b;
b = (Boss*)self;
if (b->health > 0)
{
b->stunTimer = MAX(b->stunTimer - 1, 0);
@ -95,7 +95,7 @@ static void tick(void)
b->health -= 2;
world.boss = b;
if (b->stunTimer == 0)
{
teleport();
@ -125,9 +125,9 @@ static void tick(void)
static void changeEnvironment()
{
Boss *b;
b = (Boss*)self;
if (b->environment == b->weakAgainst)
{
b->teleportTimer = 0;
@ -143,9 +143,9 @@ static void changeEnvironment()
static void die1(void)
{
Boss *b;
b = (Boss*)self;
b->flags |= EF_BOUNCES;
b->thinkTime = 0;
@ -176,7 +176,7 @@ static void die1(void)
playBattleSound(SND_DEATH_3, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
break;
}
b->action = die2;
}
@ -184,9 +184,9 @@ static SDL_Rect *getCurrentSprite(void)
{
Boss *b;
Sprite *s;
b = (Boss*)self;
s = (b->stunTimer > 0 || b->health <= 0) ? b->sprite[FACING_DIE] : b->sprite[b->facing];
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);
self->spriteFrame = 0;
}
return &s->frames[self->spriteFrame]->rect;
}
static void animate(void)
{
Boss *b;
b = (Boss*)self;
if (b->alive != ALIVE_ALIVE || b->stunTimer > 0)
{
b->facing = FACING_DIE;
superAnimate();
}
else if (b->dx != 0)
@ -219,9 +219,9 @@ static void animate(void)
static void lookForPlayer(void)
{
Boss *b;
b = (Boss*)self;
b->thinkTime = rrnd(0, FPS / 2);
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)
{
Boss *b;
b = (Boss*)self;
b->dx = 0;
if (rand() % 100 < 20)
@ -282,9 +282,9 @@ static void moveTowardsPlayer(void)
static void preFire(void)
{
Boss *b;
b = (Boss*)self;
if (b->reload > 0)
{
return;
@ -305,7 +305,7 @@ static void attack(void)
Bullet *bullet;
float dx, dy;
int bx, by;
if (self->facing != FACING_DIE)
{
bx = (int) (world.bob->x + rrnd(-8, 24));
@ -337,9 +337,9 @@ static void walk(void)
void reappear(void)
{
int valid, r;
valid = 0;
do
{
r = (int) (rand() % MAX_CHECKPOINTS);
@ -348,15 +348,15 @@ void reappear(void)
valid = (self->x != 0 && self->y != 0);
}
while (!valid);
self->y -= (self->h + 10);
walk();
self->flags &= ~EF_GONE;
addTeleportStars(self);
playBattleSound(SND_APPEAR, -1, self->x, self->y);
}
@ -389,9 +389,9 @@ static void teleport(void)
static void die2(void)
{
Boss *b;
b = (Boss*)self;
b->health--;
if (b->health <= -FPS)
@ -413,7 +413,7 @@ static void die2(void)
{
awardTrophy("BLAZE_FROST");
}
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
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
modify it under the terms of the GNU General Public License
@ -27,16 +27,16 @@ static void init(void);
Boss *initBoss(void)
{
Boss *b;
b = malloc(sizeof(Boss));
memset(b, 0, sizeof(Boss));
initEntity((Entity*)b);
b->type = ET_BOSS;
b->sprite[FACING_LEFT] = b->sprite[FACING_RIGHT] = b->sprite[FACING_DIE] = getSprite("Boss");
b->isMissionTarget = 1;
b->spriteFrame = 0;
@ -45,11 +45,11 @@ Boss *initBoss(void)
world.boss = b;
b->flags |= EF_ALWAYS_PROCESS | EF_BOMB_SHIELD | EF_GONE;
b->init = init;
b->load = load;
b->save = save;
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
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
modify it under the terms of the GNU General Public License
@ -43,19 +43,19 @@ static Sprite *plasmaSprite[2];
Entity *initEyeDroidCommander(void)
{
Boss *b;
b = initBoss();
STRNCPY(b->name, "EyeDroid Commander", MAX_NAME_LENGTH);
b->sprite[FACING_LEFT] = getSprite("DroidCommanderLeft");
b->sprite[FACING_RIGHT] = getSprite("DroidCommanderRight");
b->sprite[FACING_DIE] = getSprite("DroidCommanderDie");
b->flags |= EF_WEIGHTLESS | EF_EXPLODES;
b->health = b->healthMax = 250;
b->action = walk;
b->walk = walk;
b->tick = tick;
@ -65,15 +65,15 @@ Entity *initEyeDroidCommander(void)
b->getCurrentSprite = getCurrentSprite;
brakingTimer = 0;
aimedSprite = getSprite("AimedShot");
missileSprite[0] = getSprite("MissileRight");
missileSprite[1] = getSprite("MissileLeft");
plasmaSprite[0] = getSprite("PlasmaRight");
plasmaSprite[1] = getSprite("PlasmaLeft");
return (Entity*)b;
}
@ -91,9 +91,9 @@ static void activate(int activate)
static void tick(void)
{
Boss *b;
b = (Boss*)self;
if (b->health > 0)
{
b->facing = (world.bob->x < b->x) ? FACING_LEFT : FACING_RIGHT;
@ -117,14 +117,14 @@ static void tick(void)
static void lookForPlayer(void)
{
float distance;
self->thinkTime = rrnd(0, FPS / 2);
if (rand() % 100 < 5)
{
brakingTimer = rrnd(60, 120);
}
distance = getDistance(world.bob->x, world.bob->y, self->x, self->y);
if (distance > app.config.winHeight)
@ -132,7 +132,7 @@ static void lookForPlayer(void)
moveTowardsPlayer(1);
return;
}
if (!enemyCanSeePlayer(self))
{
moveTowardsPlayer(1);
@ -143,7 +143,7 @@ static void lookForPlayer(void)
{
selectWeapon();
}
if (distance < app.config.winHeight / 4)
{
moveTowardsPlayer(-6);
@ -157,9 +157,9 @@ static void lookForPlayer(void)
static void selectWeapon(void)
{
Boss *b;
b = (Boss*)self;
if (world.bob->isOnGround || fabs(self->y - world.bob->y) > 64)
{
b->weaponType = WPN_AIMED_PISTOL;
@ -188,9 +188,9 @@ static void walk(void)
static void moveTowardsPlayer(int dir)
{
float vel;
vel = 0.5 * dir;
if (brakingTimer == 0)
{
if (world.bob->x < self->x)
@ -221,9 +221,9 @@ static void moveTowardsPlayer(int dir)
static void preFire(void)
{
Boss *b;
b = (Boss*)self;
if (b->reload > 0)
{
return;
@ -242,11 +242,11 @@ static void preFire(void)
static void attack(void)
{
Boss *b;
if (self->facing != FACING_DIE)
{
b = (Boss*)self;
switch (b->weaponType)
{
case WPN_AIMED_PISTOL:
@ -270,9 +270,9 @@ static void attackPistol(void)
float dx, dy;
Bullet *bullet;
Boss *b;
b = (Boss*)self;
bx = world.bob->x + rrnd(-8, 24);
by = world.bob->y + rrnd(-8, 24);
@ -297,9 +297,9 @@ static void attackPlasma(void)
{
Boss *b;
Bullet *bullet;
b = (Boss*)self;
bullet = createBaseBullet((Unit*)self, plasmaSprite[0]->w);
bullet->facing = self->facing;
bullet->damage = 2;
@ -320,9 +320,9 @@ static void attackMissile(void)
{
Boss *b;
Bullet *missile;
b = (Boss*)self;
missile = createBaseBullet((Unit*)self, missileSprite[0]->w);
missile->facing = b->facing;
missile->dx = b->facing == FACING_RIGHT ? 15 : -15;
@ -330,7 +330,7 @@ static void attackMissile(void)
missile->health = FPS * 3;
missile->sprite[0] = missileSprite[0];
missile->sprite[1] = missileSprite[1];
initMissile(missile);
b->reload = 15;
@ -352,9 +352,9 @@ static void applyDamage(int amount)
static void die(void)
{
Boss *b;
b = (Boss*)self;
b->dx = (randF() - randF()) * 3;
b->spriteTime = 0;
@ -379,9 +379,9 @@ static void die(void)
static void die2()
{
Boss *b;
b = (Boss*)self;
if (b->isOnGround)
{
addTeleportStars(self);
@ -398,7 +398,7 @@ static void die2()
awardTrophy("EYEDROID_COMMANDER");
game.stats[STAT_ENEMIES_KILLED]++;
b->action = entityIdle;
}
}
@ -406,14 +406,14 @@ static void die2()
static SDL_Rect *getCurrentSprite(void)
{
Sprite *s;
s = (self->alive == ALIVE_ALIVE) ? self->sprite[self->facing] : self->sprite[FACING_DIE];
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);
self->spriteFrame = 0;
}
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
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
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)
{
Boss *b;
b = initBlobBoss();
b->weakAgainst = ENV_LAVA;
STRNCPY(b->name, "Frost", MAX_NAME_LENGTH);
b->sprite[FACING_LEFT] = getSprite("FrostLeft");
b->sprite[FACING_RIGHT] = getSprite("FrostRight");
b->sprite[FACING_DIE] = getSprite("FrostSpin");
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
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
modify it under the terms of the GNU General Public License
@ -42,7 +42,7 @@ static Sprite *aimedSprite;
Entity *initTankCommander(void)
{
Boss *b;
b = initBoss();
STRNCPY(b->name, "Tank Commander", MAX_NAME_LENGTH);
@ -64,25 +64,25 @@ Entity *initTankCommander(void)
b->getCollisionBounds = getCollisionBounds;
brakingTimer = 0;
aimedSprite = getSprite("AimedShot");
missileSprite[0] = getSprite("MissileRight");
missileSprite[1] = getSprite("MissileLeft");
tankTrack = initTankTrack(b);
world.boss = b;
return (Entity*)b;
}
static void activate(int activate)
{
Boss *b;
b = (Boss*)self;
b->flags &= ~EF_GONE;
tankTrack->flags &= ~EF_GONE;
@ -97,9 +97,9 @@ static void activate(int activate)
static void tick(void)
{
Boss *b;
b = (Boss*)self;
if (b->health > 0)
{
b->facing = (world.bob->x < b->x) ? FACING_LEFT : FACING_RIGHT;
@ -119,9 +119,9 @@ static void tick(void)
static void lookForPlayer(void)
{
Boss *b;
b = (Boss*)self;
b->thinkTime = rrnd(0, FPS / 2);
if (rand() % 10 == 0)
@ -175,9 +175,9 @@ static void moveTowardsPlayer(void)
static void selectWeapon(void)
{
Boss *b;
b = (Boss*)self;
if (fabs(b->y - world.bob->y) > 64)
{
b->weaponType = WPN_AIMED_PISTOL;
@ -195,9 +195,9 @@ static void selectWeapon(void)
static void preFire(void)
{
Boss *b;
b = (Boss*)self;
if (b->reload > 0)
{
moveTowardsPlayer();
@ -217,11 +217,11 @@ static void preFire(void)
static void attack(void)
{
Boss *b;
if (self->facing != FACING_DIE)
{
b = (Boss*)self;
switch (b->weaponType)
{
case WPN_AIMED_PISTOL:
@ -242,9 +242,9 @@ static void attackPistol(void)
float dx, dy;
Bullet *bullet;
Boss *b;
b = (Boss*)self;
bx = world.bob->x + rrnd(-8, 24);
by = world.bob->y + rrnd(-8, 24);
@ -271,7 +271,7 @@ static void attackMissile(void)
{
Bullet *missile;
Boss *b;
b = (Boss*)self;
missile = createBaseBullet((Unit*)self, missileSprite[0]->w);
@ -287,7 +287,7 @@ static void attackMissile(void)
missile->sprite[1] = missileSprite[1];
b->reload = 15;
initMissile(missile);
playBattleSound(SND_MISSILE, b->uniqueId % MAX_SND_CHANNELS, b->x, b->y);
@ -296,9 +296,9 @@ static void attackMissile(void)
static void die1(void)
{
Boss *b;
b = (Boss*)self;
b->flags |= EF_BOUNCES;
b->action = die2;
@ -312,7 +312,7 @@ static void die2(void)
{
int mx, my;
Boss *b;
b = (Boss*)self;
b->health--;
@ -321,7 +321,7 @@ static void die2(void)
{
mx = (int) ((b->x + (b->w / 2)) / MAP_TILE_SIZE);
my = (int) ((b->y + b->h) / MAP_TILE_SIZE);
addScorchDecal(mx, my);
addExplosion(b->x + rand() % b->w, b->y + rand() % b->h, 50, self);
@ -345,7 +345,7 @@ static void die2(void)
awardTrophy("TANK_COMMANDER");
game.stats[STAT_ENEMIES_KILLED]++;
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
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
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)
{
Boss *b;
b = initBoss();
superAnimate = b->animate;
@ -51,7 +51,7 @@ Entity *initTankTrack(Boss *owner)
b->getCollisionBounds = getCollisionBounds;
tankCommander = owner;
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
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
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 *bullet;
bullet = malloc(sizeof(Bullet));
memset(bullet, 0, sizeof(Bullet));
initEntity((Entity*)bullet);
bullet->x = owner->x + (owner->w / 2) - (bulletWidth / 2);
bullet->y = (owner->y + owner->h / 2) - 3;
bullet->dx = owner->facing == FACING_RIGHT ? 15 : -15;
@ -43,7 +43,7 @@ Bullet *createBaseBullet(Unit *owner, int bulletWidth)
bullet->tick = tick;
bullet->touch = touch;
bullet->spriteFrame = 0;
return bullet;
@ -104,7 +104,7 @@ static void touch(Entity *other)
b->owner->type != other->type &&
!((b->owner->type == ET_TEEKA && other->type == ET_BOB) || (b->owner->type == ET_BOB && other->type == ET_TEEKA))
);
if (canHit)
{
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
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
modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@ static void explode(void);
void initGrenade(Bullet *b)
{
b->flags = EF_BOUNCES | EF_IGNORE_BULLETS | EF_KILL_OFFSCREEN | EF_FRICTIONLESS | EF_NO_TELEPORT;
superBounce = b->bounce;
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
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
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 == ET_TEEKA && other->type == ET_BOB) || (b->owner->type == ET_BOB && other->type == ET_TEEKA))
);
if (canHit)
{
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
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
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
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
modify it under the terms of the GNU General Public License
@ -32,11 +32,11 @@ static void getCollisionBounds(SDL_Rect *r);
Entity *initCannon(void)
{
Unit *u;
u = createUnit();
u->unitType = "Cannon";
u->type = ET_ENEMY;
u->sprite[FACING_LEFT] = getSprite("CannonLeft");
@ -62,7 +62,7 @@ Entity *initCannon(void)
u->die = die;
u->canFire = canFire;
u->getCollisionBounds = getCollisionBounds;
return (Entity*)u;
}
@ -87,7 +87,7 @@ static void die(void)
u->flags |= EF_BOUNCES | EF_ALWAYS_PROCESS;
u->action = die2;
u->facing = FACING_DIE;
u->thinkTime = 0;
u->spriteTime = 0;
@ -107,7 +107,7 @@ static void die2(void)
{
Unit *u;
int mx, my;
u = (Unit*)self;
if (--u->health % 3 == 0)
@ -117,7 +117,7 @@ static void die2(void)
addScorchDecal(mx, my);
addExplosion(u->x, u->y, 50, self);
throwDebris(u->x + u->w / 2, u->y + u->h / 2, 1);
}
@ -130,7 +130,7 @@ static void die2(void)
dropCarriedItem();
u->alive = ALIVE_DEAD;
addRandomWeapon(u->x, u->y);
}
}
@ -146,7 +146,7 @@ static void lookForPlayer(void)
{
Unit *u;
int r;
u = (Unit*)self;
u->thinkTime = rrnd(FPS / 2, FPS);
@ -192,9 +192,9 @@ static void lookForPlayer(void)
static void preFire(void)
{
Unit *u;
u = (Unit*)self;
u->facing = (world.bob->x < u->x) ? FACING_LEFT : FACING_RIGHT;
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
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
modify it under the terms of the GNU General Public License
@ -28,9 +28,9 @@ static void changeEnvironment(void);
void initDebris(Decoration *d)
{
initEntity((Entity*)d);
d->type = ET_DECORATION;
d->effectType = rand() % 2;
d->spriteFrame = 0;
@ -51,9 +51,9 @@ static void tick(void)
static void action(void)
{
Decoration *d;
d = (Decoration*)self;
if (d->effectType == 0)
{
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)
{
Decoration *d;
d = (Decoration*)self;
if (other == NULL)
{
d->dx *= 0.9;
@ -87,7 +87,7 @@ static void changeEnvironment(void)
case ENV_WATER:
self->alive = ALIVE_DEAD;
break;
default:
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
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
modify it under the terms of the GNU General Public License
@ -27,11 +27,11 @@ static void touch(Entity *other);
void initFleshChunk(Decoration *d)
{
initEntity((Entity*)d);
d->type = ET_DECORATION;
d->flags |= EF_BOUNCES | EF_IGNORE_BULLETS | EF_NO_TELEPORT | EF_CRUSHABLE;
if (app.config.blood != 2)
{
d->flags |= EF_KILL_OFFSCREEN;
@ -49,20 +49,20 @@ void initFleshChunk(Decoration *d)
static void tick(void)
{
Decoration *d;
d = (Decoration*)self;
d->health--;
d->bleedTime--;
}
static void action(void)
{
Decoration *d;
d = (Decoration*)self;
if (d->bleedTime > 0)
{
addBlood(d->x + (rand() % d->w), d->y + (rand() % d->h));
@ -74,11 +74,11 @@ static void action(void)
static void touch(Entity *other)
{
int mx, my;
if (other == NULL)
{
self->dx *= 0.9;
if (app.config.blood == 2)
{
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
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
modify it under the terms of the GNU General Public License
@ -39,7 +39,7 @@ static void save(cJSON *root);
void initEntity(Entity *e)
{
e->uniqueId = world.entityCounter++;
e->environment = ENV_AIR;
e->alive = ALIVE_ALIVE;
@ -55,10 +55,10 @@ void initEntity(Entity *e)
e->flags = 0;
e->thinkTime = 0;
e->spriteFrame = -1;
e->spriteTime = 0;
e->init = init;
e->reset = reset;
e->action = action;
@ -72,10 +72,10 @@ void initEntity(Entity *e)
e->die = die;
e->changeEnvironment = changeEnvironment;
e->getCollisionBounds = getCollisionBounds;
e->load = load;
e->save = save;
world.entityTail->next = e;
world.entityTail = e;
}
@ -97,9 +97,9 @@ static void action(void)
static void animate(void)
{
Sprite *s;
s = self->sprite[self->facing];
if (self->spriteTime != -1)
{
if (--self->spriteTime <= 0)
@ -108,7 +108,7 @@ static void animate(void)
{
self->spriteFrame = 0;
}
self->spriteTime = self->sprite[self->facing]->times[self->spriteFrame];
}
}
@ -169,15 +169,15 @@ void entityIdle(void)
static SDL_Rect *getCurrentSprite(void)
{
Sprite *s;
s = self->sprite[self->facing];
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);
self->spriteFrame = 0;
}
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
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
modify it under the terms of the GNU General Public License
@ -31,7 +31,7 @@ void initEntityFactory(void)
{
memset(&head, 0, sizeof(EntityDef));
tail = &head;
addEntityDef("AquaBlob", initAquaBlob);
addEntityDef("PistolBlob", initPistolBlob);
addEntityDef("PistolEyeDroid", initPistolDroid);
@ -54,11 +54,11 @@ void initEntityFactory(void)
addEntityDef("Frost", initFrost);
addEntityDef("EyeDroidCommander", initEyeDroidCommander);
addEntityDef("TankCommander", initTankCommander);
addEntityDef("Bob", initBob);
addEntityDef("MIA", initMIA);
addEntityDef("Teeka", initTeeka);
addEntityDef("Item", initItem);
addEntityDef("BronzeKey", initBronzeKey);
addEntityDef("SilverKey", initSilverKey);
@ -69,10 +69,10 @@ void initEntityFactory(void)
addEntityDef("YellowKeycard", initYellowKeycard);
addEntityDef("WhiteKeycard", initWhiteKeycard);
addEntityDef("WeaponPickup", initWeaponPickup);
addEntityDef("Cell", initCell);
addEntityDef("Heart", initHeart);
addEntityDef("Exit", initExit);
addEntityDef("PowerPool", initPowerPool);
addEntityDef("Teleporter", initTeleporter);
@ -97,7 +97,7 @@ void initEntityFactory(void)
Entity *createEntity(char *name)
{
EntityDef *def;
for (def = head.next ; def != NULL ; def = def->next)
{
if (strcmp(def->name, name) == 0)
@ -106,22 +106,22 @@ Entity *createEntity(char *name)
return def->initFunc();
}
}
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "No such entity definition '%s'", name);
exit(1);
return NULL;
}
static void addEntityDef(char *name, Entity *(*initFunc)(void))
{
EntityDef *def;
def = malloc(sizeof(EntityDef));
memset(def, 0, sizeof(EntityDef));
tail->next = def;
tail = def;
STRNCPY(def->name, name, MAX_NAME_LENGTH);
def->initFunc = initFunc;
}
@ -131,11 +131,11 @@ static Entity *initGenericEvilBlob(void)
int r;
char name[MAX_NAME_LENGTH];
strcpy(name, "");
r = rand() % world.numEnemyTypes;
sprintf(name, "%sBlob", world.enemyTypes[r]);
return createEntity(name);
}
@ -144,10 +144,10 @@ static Entity *initGenericEyeDroid(void)
int r;
char name[MAX_NAME_LENGTH];
strcpy(name, "");
r = rand() % world.numEnemyTypes;
sprintf(name, "%sEyeDroid", world.enemyTypes[r]);
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
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
modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initAquaBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "AquaBlob";
u->sprite[FACING_LEFT] = getSprite("AquaBlobLeft");
@ -41,7 +41,7 @@ Entity *initAquaBlob(void)
u->maxShotsToFire = 3;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@ static void animate(void);
Unit *createEvilBlob(void)
{
Unit *u;
u = createUnit();
u->reload = 0;
@ -38,7 +38,7 @@ Unit *createEvilBlob(void)
u->returnToStartTimer = 0;
u->flags |= EF_HALT_AT_EDGE;
superAnimate = u->animate;
u->action = lookForPlayer;
@ -249,14 +249,14 @@ static void lookForPlayer(void)
patrol();
return;
}
r = randF();
if (world.missionType == MT_OUTPOST || game.plus)
{
r = randF() * 0.65;
}
if (u->isMissionTarget)
{
r = randF() * 0.3;
@ -294,7 +294,7 @@ static void die(void)
u->flags &= ~(EF_HALT_AT_EDGE | EF_GONE);
u->action = die2;
u->facing = FACING_DIE;
u->thinkTime = 0;
u->spriteTime = 0;
@ -331,8 +331,8 @@ static void animate(void)
if (self->alive != ALIVE_ALIVE)
{
self->facing = FACING_DIE;
superAnimate();
superAnimate();
}
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
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
modify it under the terms of the GNU General Public License
@ -27,18 +27,18 @@ static int canFire(Entity *target);
Entity *initGrenadeBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "GrenadeBlob";
u->sprite[FACING_LEFT] = getSprite("GrenadeBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("GrenadeBlobRight");
u->sprite[FACING_DIE] = getSprite("GrenadeBlobSpin");
u->weaponType = WPN_GRENADES;
u->maxShotsToFire = 1;
superPreFire = u->preFire;
u->preFire = preFire;
@ -50,9 +50,9 @@ Entity *initGrenadeBlob(void)
static void preFire(void)
{
Unit *u;
u = (Unit*)self;
superPreFire();
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initLaserBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "LaserBlob";
u->sprite[FACING_LEFT] = getSprite("LaserBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("LaserBlobRight");
u->sprite[FACING_DIE] = getSprite("LaserBlobSpin");
@ -39,7 +39,7 @@ Entity *initLaserBlob(void)
u->maxShotsToFire = 1;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initMachineGunBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "MachineGunBlob";
u->sprite[FACING_LEFT] = getSprite("MachineGunBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("MachineGunBlobRight");
u->sprite[FACING_DIE] = getSprite("MachineGunBlobSpin");
@ -39,7 +39,7 @@ Entity *initMachineGunBlob(void)
u->maxShotsToFire = 5;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initPistolBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "PistolBlob";
u->sprite[FACING_LEFT] = getSprite("PistolBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("PistolBlobRight");
u->sprite[FACING_DIE] = getSprite("PistolBlobSpin");
@ -39,7 +39,7 @@ Entity *initPistolBlob(void)
u->maxShotsToFire = 3;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initPlasmaBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "PlasmaBlob";
u->sprite[FACING_LEFT] = getSprite("PlasmaBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("PlasmaBlobRight");
u->sprite[FACING_DIE] = getSprite("PlasmaBlobSpin");
@ -39,7 +39,7 @@ Entity *initPlasmaBlob(void)
u->maxShotsToFire = 6;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initShotgunBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "ShotgunBlob";
u->sprite[FACING_LEFT] = getSprite("ShotgunBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("ShotgunBlobRight");
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initSpreadGunBlob(void)
{
Unit *u;
u = createEvilBlob();
u->unitType = "SpreadGunBlob";
u->sprite[FACING_LEFT] = getSprite("SpreadGunBlobLeft");
u->sprite[FACING_RIGHT] = getSprite("SpreadGunBlobRight");
u->sprite[FACING_DIE] = getSprite("SpreadGunBlobSpin");
@ -39,7 +39,7 @@ Entity *initSpreadGunBlob(void)
u->maxShotsToFire = 3;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -30,7 +30,7 @@ static void (*superTouch)(Entity *other);
Unit *createEyeDroid(void)
{
Unit *u;
u = createUnit();
u->flags |= EF_WEIGHTLESS | EF_HALT_AT_EDGE | EF_EXPLODES;
@ -222,12 +222,12 @@ static void lookForPlayer(void)
}
r = randF();
if (world.missionType == MT_OUTPOST || game.plus)
{
r = randF() * 0.65;
}
if (u->isMissionTarget)
{
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
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
modify it under the terms of the GNU General Public License
@ -27,23 +27,23 @@ static int canFire(Entity *target);
Entity *initGrenadeDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "GrenadeEyeDroid";
u->sprite[FACING_LEFT] = getSprite("GrenadeDroidLeft");
u->sprite[FACING_RIGHT] = getSprite("GrenadeDroidRight");
u->sprite[FACING_DIE] = getSprite("GrenadeDroidDie");
u->weaponType = WPN_GRENADES;
u->maxShotsToFire = 1;
superPreFire = u->preFire;
u->preFire = preFire;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initLaserDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "LaserEyeDroid";
u->sprite[FACING_LEFT] = getSprite("LaserDroidLeft");
@ -39,7 +39,7 @@ Entity *initLaserDroid(void)
u->maxShotsToFire = 1;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initMachineGunDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "MachineGunEyeDroid";
u->sprite[FACING_LEFT] = getSprite("MachineGunDroidLeft");
@ -39,7 +39,7 @@ Entity *initMachineGunDroid(void)
u->maxShotsToFire = 5;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,11 +25,11 @@ static int canFire(Entity *target);
Entity *initPistolDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "PistolEyeDroid";
u->sprite[FACING_LEFT] = getSprite("PistolDroidLeft");
u->sprite[FACING_RIGHT] = getSprite("PistolDroidRight");
u->sprite[FACING_DIE] = getSprite("PistolDroidDie");
@ -39,7 +39,7 @@ Entity *initPistolDroid(void)
u->maxShotsToFire = 3;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initPlasmaDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "PlasmaEyeDroid";
u->sprite[FACING_LEFT] = getSprite("PlasmaDroidLeft");
@ -39,7 +39,7 @@ Entity *initPlasmaDroid(void)
u->maxShotsToFire = 6;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initShotgunDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "ShotgunEyeDroid";
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
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
modify it under the terms of the GNU General Public License
@ -25,9 +25,9 @@ static int canFire(Entity *target);
Entity *initSpreadGunDroid(void)
{
Unit *u;
u = createEyeDroid();
u->unitType = "SpreadGunEyeDroid";
u->sprite[FACING_LEFT] = getSprite("SpreadGunDroidLeft");
@ -39,7 +39,7 @@ Entity *initSpreadGunDroid(void)
u->maxShotsToFire = 3;
u->canFire = canFire;
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
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
modify it under the terms of the GNU General Public License
@ -25,23 +25,23 @@ static void touch(Entity *other);
Item *initBattery(void)
{
Item *i;
i = initConsumable();
i->spriteFrame = 0;
i->spriteTime = -1;
i->touch = touch;
return i;
}
static void touch(Entity *other)
{
Item *i;
i = (Item*)self;
if (touchedPlayer(other))
{
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
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
modify it under the terms of the GNU General Public License
@ -26,9 +26,9 @@ static void init(void);
Entity *initCell(void)
{
Item *i;
i = (Item*)createItem();
i->type = ET_CELL;
i->isMissionTarget = 1;
@ -42,7 +42,7 @@ Entity *initCell(void)
i->init = init;
i->touch = touch;
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
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
modify it under the terms of the GNU General Public License
@ -25,20 +25,20 @@ static void touch(Entity *other);
Item *initCherry(void)
{
Item *i;
i = initConsumable();
i->touch = touch;
return i;
}
static void touch(Entity *other)
{
Item *i;
i = (Item*)self;
if (touchedPlayer(other))
{
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
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
modify it under the terms of the GNU General Public License
@ -26,30 +26,30 @@ static void die(void);
Item *initConsumable(void)
{
Item *i;
i = malloc(sizeof(Item));
memset(i, 0, sizeof(Item));
initEntity((Entity*)i);
i->type = ET_CONSUMABLE;
i->flags |= EF_IGNORE_BULLETS | EF_CRUSHABLE;
i->health = FPS * 10;
i->tick = tick;
i->die = die;
return i;
}
static void tick(void)
{
Item *i;
i = (Item*)self;
if (i->isOnGround)
{
i->dx *= 0.05;
@ -75,9 +75,9 @@ int touchedPlayer(Entity *other)
void pickupItem(void)
{
Item *i;
i = (Item*)self;
i->alive = (i->environment == ENV_AIR) ? ALIVE_DYING : ALIVE_DEAD;
i->health = FPS / 2;
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
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
modify it under the terms of the GNU General Public License
@ -27,9 +27,9 @@ static void init(void);
Entity *initHeart(Entity *e)
{
Item *i;
i = (Item*)createItem();
i->type = ET_HEART;
i->isMissionTarget = 1;
@ -44,7 +44,7 @@ Entity *initHeart(Entity *e)
i->action = action;
i->init = init;
i->touch = touch;
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
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
modify it under the terms of the GNU General Public License
@ -35,12 +35,12 @@ static void save(cJSON *root);
Entity *createItem(void)
{
Item *i;
i = malloc(sizeof(Item));
memset(i, 0, sizeof(Item));
initEntity((Entity*)i);
i->type = ET_ITEM;
STRNCPY(i->spriteName, "Weapon", MAX_NAME_LENGTH);
@ -62,7 +62,7 @@ Entity *createItem(void)
i->die = die;
i->load = load;
i->save = save;
return (Entity*)i;
}
@ -74,18 +74,18 @@ Entity *initItem(void)
static void init(void)
{
Item *i;
i = (Item*)self;
i->sprite[FACING_LEFT] = i->sprite[FACING_RIGHT] = i->sprite[FACING_DIE] = getSprite(i->spriteName);
}
static void reset(void)
{
Item *i;
i = (Item*)self;
self->x = i->startX;
self->y = i->startY;
}
@ -104,9 +104,9 @@ static void tick(void)
static void touch(Entity *other)
{
Item *i;
i = (Item*)self;
if (i->alive == ALIVE_ALIVE && other != NULL && i->canBePickedUp)
{
if (other->type == ET_BOB && !world.bob->stunTimer)
@ -127,9 +127,9 @@ static void touch(Entity *other)
static void bobPickupItem(void)
{
Item *i;
i = (Item*)self;
if (!i->isMissionTarget)
{
if (i->thinkTime == 0)
@ -158,7 +158,7 @@ static void bobPickupItem(void)
updateObjective(i->name);
i->collected = 1;
}
setGameplayMessage(MSG_STANDARD, app.strings[ST_PICKED_UP], i->name);
playSound(SND_ITEM, i->uniqueId % MAX_SND_CHANNELS);
@ -185,9 +185,9 @@ static void bobPickupItem(void)
static void enemyPickupItem(Unit *u)
{
Item *i;
i = (Item*)self;
if (u->canCarryItem && u->carriedItem == NULL && u->alive == ALIVE_ALIVE)
{
u->carriedItem = i;
@ -199,9 +199,9 @@ static void enemyPickupItem(Unit *u)
static void destructablePickupItem(Structure *s)
{
Item *i;
i = (Item*)self;
if (s->carriedItem == NULL && s->alive == ALIVE_ALIVE)
{
s->carriedItem = i;
@ -213,9 +213,9 @@ static void destructablePickupItem(Structure *s)
static void changeEnvironment(void)
{
Item *i;
i = (Item*)self;
if (i->environment == ENV_SLIME || i->environment == ENV_LAVA)
{
addTeleportStars(self);
@ -234,9 +234,9 @@ static void die(void)
static void load(cJSON *root)
{
Item *i;
i = (Item*)self;
i->canBeCarried = cJSON_GetObjectItem(root, "canBeCarried")->valueint;
i->canBePickedUp = cJSON_GetObjectItem(root, "canBePickedUp")->valueint;
i->isMissionTarget = cJSON_GetObjectItem(root, "isMissionTarget")->valueint;
@ -247,7 +247,7 @@ static void load(cJSON *root)
{
i->collected = cJSON_GetObjectItem(root, "collected")->valueint;
}
if (game.plus & PLUS_MIRROR)
{
i->startX = MAP_PIXEL_WIDTH - i->startX;
@ -257,28 +257,28 @@ static void load(cJSON *root)
static void save(cJSON *root)
{
Item *i;
i = (Item*)self;
switch (i->type)
{
case ET_KEY:
cJSON_AddStringToObject(root, "type", i->sprite[0]->name);
break;
case ET_HEART:
cJSON_AddStringToObject(root, "type", "Heart");
break;
case ET_CELL:
cJSON_AddStringToObject(root, "type", "Cell");
break;
default:
cJSON_AddStringToObject(root, "type", "Item");
break;
}
cJSON_AddNumberToObject(root, "canBeCarried", i->canBeCarried);
cJSON_AddNumberToObject(root, "canBePickedUp", i->canBePickedUp);
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
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
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)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Bronze Key", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "BronzeKey", MAX_NAME_LENGTH);
return (Entity*)i;
}
Entity *initSilverKey(Entity *e)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Silver Key", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "SilverKey", MAX_NAME_LENGTH);
return (Entity*)i;
}
Entity *initGoldKey(Entity *e)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Gold Key", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "GoldKey", MAX_NAME_LENGTH);
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
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
modify it under the terms of the GNU General Public License
@ -26,65 +26,65 @@ static void touchWhiteKeycard(Entity *other);
Entity *initRedKeycard(void)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Red Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "RedKeycard", MAX_NAME_LENGTH);
return (Entity*)i;
}
Entity *initBlueKeycard(void)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Blue Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "BlueKeycard", MAX_NAME_LENGTH);
return (Entity*)i;
}
Entity *initGreenKeycard(void)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Green Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "GreenKeycard", MAX_NAME_LENGTH);
return (Entity*)i;
}
Entity *initYellowKeycard(void)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "Yellow Keycard", MAX_NAME_LENGTH);
STRNCPY(i->spriteName, "YellowKeycard", MAX_NAME_LENGTH);
return (Entity*)i;
}
Entity *initWhiteKeycard(void)
{
Item *i;
i = (Item*)createItem();
i->type = ET_KEY;
STRNCPY(i->name, "White Keycard", MAX_NAME_LENGTH);
@ -93,7 +93,7 @@ Entity *initWhiteKeycard(void)
itemTouch = i->touch;
i->touch = touchWhiteKeycard;
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
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
modify it under the terms of the GNU General Public License
@ -30,11 +30,11 @@ static void save(cJSON *root);
Entity *initWeaponPickup(void)
{
Item *i;
i = (Item*)initConsumable();
i->weaponType = WPN_PISTOL;
superTick = i->tick;
i->init = init;
@ -42,16 +42,16 @@ Entity *initWeaponPickup(void)
i->touch = touch;
i->load = load;
i->save = save;
return (Entity*)i;
}
static void init(void)
{
Item *i;
i = (Item*)self;
i->sprite[0] = i->sprite[1] = i->sprite[2] = getSprite("Weapon");
i->spriteFrame = i->weaponType;
i->spriteTime = -1;
@ -65,9 +65,9 @@ static void init(void)
static void tick(void)
{
Item *i;
i = (Item*)self;
superTick();
if (i->provided && i->alive == ALIVE_ALIVE)
@ -79,9 +79,9 @@ static void tick(void)
static void touch(Entity *other)
{
Item *i;
i = (Item*)self;
if (touchedPlayer(other))
{
world.bob->weaponType = i->weaponType;
@ -108,9 +108,9 @@ static void touch(Entity *other)
static void load(cJSON *root)
{
Item *i;
i = (Item*)self;
i->weaponType = lookup(cJSON_GetObjectItem(root, "weaponType")->valuestring);
i->provided = cJSON_GetObjectItem(root, "provided")->valueint;
}

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