Remaining items.
This commit is contained in:
parent
8e2ed9bace
commit
e7d4c02834
|
@ -27,8 +27,9 @@ OBJS += draw.o
|
|||
OBJS += effects.o entities.o explosions.o eyeDroidCommander.o
|
||||
OBJS += frost.o
|
||||
OBJS += game.o
|
||||
OBJS += hub.o hud.o
|
||||
OBJS += heart.o hub.o hud.o
|
||||
OBJS += init.o input.o io.o item.o items.o
|
||||
OBJS += key.o keycard.o
|
||||
OBJS += lookup.o
|
||||
OBJS += main.o map.o maths.o mia.o
|
||||
OBJS += objectives.o
|
||||
|
@ -37,7 +38,7 @@ OBJS += quadtree.o
|
|||
OBJS += sound.o sprites.o
|
||||
OBJS += tankCommander.o tankTrack.o teeka.o text.o textures.o title.o triggers.o
|
||||
OBJS += unit.o util.o
|
||||
OBJS += weapons.o widgets.o
|
||||
OBJS += weapons.o weaponPickup.o widgets.o
|
||||
|
||||
# top-level rule to create the program.
|
||||
all: $(PROG) $(LOCALE_MO)
|
||||
|
|
|
@ -133,6 +133,7 @@ struct Entity {
|
|||
int collected;
|
||||
int canBeCarried;
|
||||
int canBePickedUp;
|
||||
int provided;
|
||||
long flags;
|
||||
SDL_Rect bounds;
|
||||
int sprite[3];
|
||||
|
|
|
@ -159,3 +159,8 @@ static void attack(void)
|
|||
|
||||
self->reload = 5;
|
||||
}
|
||||
|
||||
void teekaExitMission(void)
|
||||
{
|
||||
exitMission = 1;
|
||||
}
|
||||
|
|
|
@ -21,14 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "../../../common.h"
|
||||
|
||||
extern void initConsumable(Entity *e);
|
||||
extern int getSpriteIndex(char *name);
|
||||
extern void setGameplayMessage(int type, char *format, ...);
|
||||
extern void playSound(int snd, int ch);
|
||||
extern void updateObjective(char *targetName);
|
||||
extern int touchedPlayer(Entity *other);
|
||||
extern void pickupItem(void);
|
||||
extern float limit(float i, float a, float b);
|
||||
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
extern World world;
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "heart.h"
|
||||
|
||||
static void action(void);
|
||||
static void touch(Entity *other);
|
||||
|
||||
void initHeart(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
e->isMissionTarget = 1;
|
||||
|
||||
STRNCPY(e->spriteName, "Heart", MAX_NAME_LENGTH);
|
||||
|
||||
e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("Heart");
|
||||
|
||||
e->spriteFrame = 0;
|
||||
e->spriteTime = -1;
|
||||
|
||||
e->action = action;
|
||||
e->touch = touch;
|
||||
}
|
||||
|
||||
static void action(void)
|
||||
{
|
||||
if (self->isOnGround)
|
||||
{
|
||||
self->dy = -5;
|
||||
}
|
||||
|
||||
self->thinkTime = FPS * rrnd(1, 3);
|
||||
}
|
||||
|
||||
static void touch(Entity *other)
|
||||
{
|
||||
if (other != NULL && other->type == ET_BOB && self->alive == ALIVE_ALIVE)
|
||||
{
|
||||
game.hearts++;
|
||||
|
||||
world.bob->health = world.bob->healthMax = game.hearts;
|
||||
|
||||
setGameplayMessage(MSG_OBJECTIVE, "Found a heart - Max health increased!");
|
||||
|
||||
playSound(SND_HEART_CELL, CH_ITEM);
|
||||
|
||||
self->alive = ALIVE_DEAD;
|
||||
|
||||
updateObjective("HEART_CELL");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../../../common.h"
|
||||
|
||||
extern void playSound(int snd, int ch);
|
||||
extern void setGameplayMessage(int type, char *format, ...);
|
||||
extern void initItem(Entity *e);
|
||||
extern int getSpriteIndex(char *name);
|
||||
extern void updateObjective(char *targetName);
|
||||
extern int rrnd(int low, int high);
|
||||
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
extern World world;
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "key.h"
|
||||
|
||||
void initBronzeKey(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Bronze Key", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "BronzeKey", MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
void initSilverKey(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Silver Key", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "SilverKey", MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
void initGoldKey(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Gold Key", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "GoldKey", MAX_NAME_LENGTH);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../../../common.h"
|
||||
|
||||
extern void initItem(Entity *e);
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "keycard.h"
|
||||
|
||||
static void (*itemTouch)(Entity *other);
|
||||
static void touchWhiteKeycard(Entity *other);
|
||||
|
||||
void initRedKeycard(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Red Keycard", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "RedKeycard", MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
void initBlueKeycard(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Blue Keycard", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "BlueKeycard", MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
void initGreenKeycard(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Green Keycard", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "GreenKeycard", MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
void initYellowKeycard(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "Yellow Keycard", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "YellowKeycard", MAX_NAME_LENGTH);
|
||||
}
|
||||
|
||||
void initWhiteKeycard(Entity *e)
|
||||
{
|
||||
initItem(e);
|
||||
|
||||
STRNCPY(e->name, "White Keycard", MAX_NAME_LENGTH);
|
||||
STRNCPY(e->spriteName, "WhiteKeycard", MAX_NAME_LENGTH);
|
||||
|
||||
itemTouch = e->touch;
|
||||
|
||||
e->touch = touchWhiteKeycard;
|
||||
}
|
||||
|
||||
static void touchWhiteKeycard(Entity *other)
|
||||
{
|
||||
itemTouch(other);
|
||||
|
||||
if (other == world.bob)
|
||||
{
|
||||
updateObjective("White Keycard");
|
||||
|
||||
if (self->alive == ALIVE_DEAD)
|
||||
{
|
||||
teekaExitMission();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../../../common.h"
|
||||
|
||||
extern void playSound(int snd, int ch);
|
||||
extern void setGameplayMessage(int type, char *format, ...);
|
||||
extern void initItem(Entity *e);
|
||||
extern int getSpriteIndex(char *name);
|
||||
extern void updateObjective(char *targetName);
|
||||
extern int rrnd(int low, int high);
|
||||
extern void teekaExitMission(void);
|
||||
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
extern World world;
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "weaponPickup.h"
|
||||
|
||||
static void (*itemTick)(void);
|
||||
static void tick(void);
|
||||
static void touch(Entity *other);
|
||||
|
||||
static char *description[] = {
|
||||
"Pistol",
|
||||
"Plasma Rifle",
|
||||
"Spread Gun",
|
||||
"Laser Cannon",
|
||||
"Grenades"
|
||||
};
|
||||
|
||||
void initWeaponPickup(Entity *e)
|
||||
{
|
||||
initConsumable(e);
|
||||
|
||||
e->weaponType = WPN_PISTOL;
|
||||
|
||||
e->sprite[0] = e->sprite[1] = e->sprite[2] = getSpriteIndex("Weapon");
|
||||
e->spriteFrame = e->weaponType;
|
||||
e->spriteTime = -1;
|
||||
|
||||
setEntitySize(e);
|
||||
|
||||
if (e->provided)
|
||||
{
|
||||
e->health = 9999;
|
||||
}
|
||||
|
||||
itemTick = e->tick;
|
||||
|
||||
e->tick = tick;
|
||||
e->touch = touch;
|
||||
}
|
||||
|
||||
static void tick(void)
|
||||
{
|
||||
itemTick();
|
||||
|
||||
if (self->provided && self->alive == ALIVE_ALIVE)
|
||||
{
|
||||
self->health = 9999;
|
||||
}
|
||||
}
|
||||
|
||||
static void touch(Entity *other)
|
||||
{
|
||||
if (touchedPlayer(other))
|
||||
{
|
||||
world.bob->weaponType = self->weaponType;
|
||||
|
||||
switch (self->weaponType)
|
||||
{
|
||||
case WPN_GRENADES:
|
||||
setGameplayMessage(MSG_STANDARD, "Got some Grenades");
|
||||
break;
|
||||
|
||||
default:
|
||||
setGameplayMessage(MSG_STANDARD, "Picked up a %s", description[self->weaponType]);
|
||||
break;
|
||||
}
|
||||
|
||||
pickupItem();
|
||||
|
||||
playSound(SND_WEAPON, CH_ITEM);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
Copyright (C) 2018 Parallel Realities
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "../../../common.h"
|
||||
|
||||
extern void playSound(int snd, int ch);
|
||||
extern void setGameplayMessage(int type, char *format, ...);
|
||||
extern void initConsumable(Entity *e);
|
||||
extern int getSpriteIndex(char *name);
|
||||
extern void updateObjective(char *targetName);
|
||||
extern int rrnd(int low, int high);
|
||||
extern void pickupItem(void);
|
||||
extern void teekaExitMission(void);
|
||||
extern void setEntitySize(Entity *e);
|
||||
extern int touchedPlayer(Entity *e);
|
||||
|
||||
extern Entity *self;
|
||||
extern Game game;
|
||||
extern World world;
|
Loading…
Reference in New Issue