- [NEW] Consola in-game
This commit is contained in:
@@ -1260,6 +1260,31 @@ namespace actor
|
||||
for (int i=0; i<100; ++i) boosters_collected[i] = false;
|
||||
}
|
||||
|
||||
const int getBoosterFromString(char *booster)
|
||||
{
|
||||
static const char *boostset_name[3] = {"RUN", "GOD", "JUMP"};
|
||||
for (int i=0;i<3;++i)
|
||||
{
|
||||
if (strcmp(booster, boostset_name[i])==0)
|
||||
{
|
||||
return 1<<i;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool giveBooster(char *booster)
|
||||
{
|
||||
const int value = getBoosterFromString(booster);
|
||||
switch (value)
|
||||
{
|
||||
case BOOST_GOD: boost_god = 99*2; break;
|
||||
case BOOST_RUN: boost_steps = 99*2; break;
|
||||
case BOOST_JUMP: boost_jumps = 10; break;
|
||||
}
|
||||
return value!=0;
|
||||
}
|
||||
|
||||
void collectBooster(int booster, int id)
|
||||
{
|
||||
boosters_collected[id] = true;
|
||||
@@ -1309,7 +1334,7 @@ namespace actor
|
||||
|
||||
const int getSkillFromString(char *skill)
|
||||
{
|
||||
static const char *skillset_name[4] = {"SHOES", "GLOBES", "PANTS", "BAG"};
|
||||
static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
|
||||
for (int i=0;i<4;++i)
|
||||
{
|
||||
if (strcmp(skill, skillset_name[i])==0)
|
||||
@@ -1320,9 +1345,18 @@ namespace actor
|
||||
return 0;
|
||||
}
|
||||
|
||||
void giveSkill(char *skill)
|
||||
bool giveSkill(char *skill)
|
||||
{
|
||||
skills |= getSkillFromString(skill);
|
||||
const int value = getSkillFromString(skill);
|
||||
skills |= value;
|
||||
return value!=0;
|
||||
}
|
||||
|
||||
bool dropSkill(char *skill)
|
||||
{
|
||||
const int value = getSkillFromString(skill);
|
||||
skills &= ~value;
|
||||
return value!=0;
|
||||
}
|
||||
|
||||
bool wasSkillCollected(char *skill)
|
||||
@@ -1338,7 +1372,7 @@ namespace actor
|
||||
const int getPartFromString(char *part)
|
||||
{
|
||||
static const char *partset_name[6] = {"FILTER", "PUMP", "TIMER", "SALT", "PIPE", "ELBOW"};
|
||||
for (int i=0;i<4;++i)
|
||||
for (int i=0;i<6;++i)
|
||||
{
|
||||
if (strcmp(part, partset_name[i])==0)
|
||||
{
|
||||
@@ -1348,9 +1382,18 @@ namespace actor
|
||||
return PART_NONE;
|
||||
}
|
||||
|
||||
void pickPart(char *part)
|
||||
bool pickPart(char *part)
|
||||
{
|
||||
parts |= getPartFromString(part);
|
||||
const int value = getPartFromString(part);
|
||||
parts |= value;
|
||||
return value!=0;
|
||||
}
|
||||
|
||||
bool dropPart(char *part)
|
||||
{
|
||||
const int value = getPartFromString(part);
|
||||
parts &= ~value;
|
||||
return value!=0;
|
||||
}
|
||||
|
||||
bool wasPartCollected(char *part)
|
||||
@@ -1362,5 +1405,14 @@ namespace actor
|
||||
{
|
||||
return parts;
|
||||
}
|
||||
|
||||
void move(int *x, int *y, int *z)
|
||||
{
|
||||
actor_t *hero = actor::find("HERO");
|
||||
if (x) hero->pos.x = *x;
|
||||
if (y) hero->pos.y = *y;
|
||||
if (z) hero->pos.z = *z;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user