Fixed teleporter.
This commit is contained in:
parent
e97d38e278
commit
d51e96c74a
|
@ -120,10 +120,23 @@ static void activate(int active)
|
||||||
|
|
||||||
static void load(cJSON *root)
|
static void load(cJSON *root)
|
||||||
{
|
{
|
||||||
/* nothing to do */
|
Structure *s;
|
||||||
|
|
||||||
|
s = (Structure*)self;
|
||||||
|
|
||||||
|
s->active = cJSON_GetObjectItem(root, "active")->valueint;
|
||||||
|
s->tx = cJSON_GetObjectItem(root, "tx")->valueint;
|
||||||
|
s->ty = cJSON_GetObjectItem(root, "ty")->valueint;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void save(cJSON *root)
|
static void save(cJSON *root)
|
||||||
{
|
{
|
||||||
|
Structure *s;
|
||||||
|
|
||||||
|
s = (Structure*)self;
|
||||||
|
|
||||||
cJSON_AddStringToObject(root, "type", "Teleporter");
|
cJSON_AddStringToObject(root, "type", "Teleporter");
|
||||||
|
cJSON_AddNumberToObject(root, "active", s->active);
|
||||||
|
cJSON_AddNumberToObject(root, "tx", s->tx);
|
||||||
|
cJSON_AddNumberToObject(root, "ty", s->ty);
|
||||||
}
|
}
|
||||||
|
|
|
@ -798,6 +798,12 @@ void activateEntities(char *names, int active)
|
||||||
|
|
||||||
void teleportEntity(Entity *e, float tx, float ty)
|
void teleportEntity(Entity *e, float tx, float ty)
|
||||||
{
|
{
|
||||||
|
e->tx = tx;
|
||||||
|
e->ty = ty;
|
||||||
|
|
||||||
|
e->flags |= EF_TELEPORTING;
|
||||||
|
|
||||||
|
addTeleportStars(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleTeleport(void)
|
static void handleTeleport(void)
|
||||||
|
@ -876,6 +882,13 @@ void teleport(Entity *e, float tx, float ty)
|
||||||
e->flags |= EF_TELEPORTING;
|
e->flags |= EF_TELEPORTING;
|
||||||
|
|
||||||
addTeleportStars(e);
|
addTeleportStars(e);
|
||||||
|
|
||||||
|
if (e == (Entity*)world.bob)
|
||||||
|
{
|
||||||
|
terminateJetpack();
|
||||||
|
|
||||||
|
world.bob->flags &= ~(EF_WATER_BREATHING | EF_WEIGHTLESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Entity *findEntity(char *name)
|
Entity *findEntity(char *name)
|
||||||
|
|
|
@ -37,6 +37,7 @@ extern float limit(float i, float a, float b);
|
||||||
extern int isWalkable(int x, int y);
|
extern int isWalkable(int x, int y);
|
||||||
extern int isLiquid(int x, int y);
|
extern int isLiquid(int x, int y);
|
||||||
extern int isSolid(int x, int y);
|
extern int isSolid(int x, int y);
|
||||||
|
extern void terminateJetpack(void);
|
||||||
|
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern Camera camera;
|
extern Camera camera;
|
||||||
|
|
Loading…
Reference in New Issue