- [FIX] Un café feia impossible passar per una habitació
- [FIX] No s'activaba el prólogo quan toca - [FIX] El gràfic de les portes de vegades era transparent - [FIX] Separades unes caixes que feien molt frustrant agafar una cosa - [FIX] Quan tenia el café de doble velocitat no podia creuar portes - [FIX] Algunes vegades el objecte dropejat encara feia clipping amb altres - [NEW] Missatges en els moments importants - [NEW] Quan te pases el joc també te dona els 'stats' de temps, vides i habitacions visitades.
This commit is contained in:
@@ -461,13 +461,33 @@ namespace actor
|
||||
actor_t *hero = find("HERO");
|
||||
while (obj2)
|
||||
{
|
||||
if (obj2 != hero && obj1 != obj2 && check_2d_collision(obj1, obj2))
|
||||
if (obj2 != hero && obj1 != obj2 && (obj1->pos.z<obj2->pos.z+obj2->size.z) && check_2d_collision(obj1, obj2))
|
||||
return true;
|
||||
obj2 = obj2->next;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void find_non_colliding_position(actor_t *obj)
|
||||
{
|
||||
int dist = 1;
|
||||
while (does_collide(obj))
|
||||
{
|
||||
obj->pos.x += dist;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.x -= dist*2;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.x += dist;
|
||||
obj->pos.y += dist;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.y -= dist*2;
|
||||
if (!does_collide(obj)) return;
|
||||
obj->pos.y += dist;
|
||||
dist++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const bool is_above(actor_t *obj1, actor_t *obj2)
|
||||
{
|
||||
return check_2d_collision(obj1, obj2) && (obj1->pos.z == obj2->pos.z + obj2->size.z);
|
||||
@@ -736,6 +756,7 @@ namespace actor
|
||||
if ((act->pos.x > min.x && act->pos.y >= min.y && (act->pos.y + act->size.y) <= max.y) || ((room::getDoors() & DOOR_XN) && (act->pos.y >= 24) && (act->pos.y <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if ((act->pos.x <= min.x) && (act->pos.z == room::getDoor(XN) * 4) && (room::getDoors() & DOOR_XN))
|
||||
{
|
||||
if (act->pos.y < 28)
|
||||
@@ -743,10 +764,16 @@ namespace actor
|
||||
else if (act->pos.y > 28)
|
||||
act->push |= PUSH_YN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (controller::down(KEY_RIGHT)) //(input::keyDown(SDL_SCANCODE_RIGHT) || input::keyDown(config::getKey(KEY_RIGHT)))
|
||||
@@ -756,6 +783,7 @@ namespace actor
|
||||
if (((act->pos.x + act->size.x) < max.x && act->pos.y >= min.y && (act->pos.y + act->size.y) <= max.y) || ((room::getDoors() & DOOR_XP) && (act->pos.y >= 24) && (act->pos.y <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if (((act->pos.x + act->size.x) >= max.x) && (act->pos.z == room::getDoor(XP) * 4) && (room::getDoors() & DOOR_XP))
|
||||
{
|
||||
if (act->pos.y < 28)
|
||||
@@ -763,10 +791,16 @@ namespace actor
|
||||
else if (act->pos.y > 28)
|
||||
act->push |= PUSH_YN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_XP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (controller::down(KEY_UP)) // input::keyDown(SDL_SCANCODE_UP) || input::keyDown(config::getKey(KEY_UP)))
|
||||
@@ -776,6 +810,7 @@ namespace actor
|
||||
if ((act->pos.y > min.y && act->pos.x >= min.x && (act->pos.x + act->size.x) <= max.x) || ((room::getDoors() & DOOR_YN) && (act->pos.x >= 24) && (act->pos.x <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if ((act->pos.y <= min.y) && (act->pos.z == room::getDoor(YN) * 4) && (room::getDoors() & DOOR_YN))
|
||||
{
|
||||
if (act->pos.x < 28)
|
||||
@@ -783,10 +818,16 @@ namespace actor
|
||||
else if (act->pos.x > 28)
|
||||
act->push |= PUSH_XN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YN;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (controller::down(KEY_DOWN)) // input::keyDown(SDL_SCANCODE_DOWN) || input::keyDown(config::getKey(KEY_DOWN)))
|
||||
@@ -796,6 +837,7 @@ namespace actor
|
||||
if (((act->pos.y + act->size.y) < max.y && act->pos.x >= min.x && (act->pos.x + act->size.x) <= max.x) || ((room::getDoors() & DOOR_YP) && (act->pos.x >= 24) && (act->pos.x <= 32)))
|
||||
{
|
||||
moving = true;
|
||||
// Si està en les vores d'una porta, espenta cap a centrar-lo
|
||||
if (((act->pos.y + act->size.y) >= max.y) && (act->pos.z == room::getDoor(YP) * 4) && (room::getDoors() & DOOR_YP))
|
||||
{
|
||||
if (act->pos.x < 28)
|
||||
@@ -803,10 +845,16 @@ namespace actor
|
||||
else if (act->pos.x > 28)
|
||||
act->push |= PUSH_XN;
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
act->push |= PUSH_YP;
|
||||
if (hero::getBoostRun() > 0) act->push |= PUSH_DOUBLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
// if ((input::keyPressed(SDL_SCANCODE_RETURN) || input::keyPressed(config::getKey(KEY_PICK))) && (hero::getSkills() & SKILL_PANTS))
|
||||
@@ -821,7 +869,8 @@ namespace actor
|
||||
if (picked->pos.y + picked->size.y > room::getMax().y)
|
||||
picked->pos.y = room::getMax().y - picked->size.y;
|
||||
picked->pos.z = act->pos.z;
|
||||
if (does_collide(picked))
|
||||
find_non_colliding_position(picked);
|
||||
/*if (does_collide(picked))
|
||||
{
|
||||
picked->pos.x -= 2;
|
||||
if (does_collide(picked))
|
||||
@@ -829,7 +878,7 @@ namespace actor
|
||||
picked->pos.x += 2;
|
||||
picked->pos.y -= 2;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
act->pos.z += picked->size.z;
|
||||
actor::actor_t *above = act->above;
|
||||
while (above)
|
||||
@@ -1111,7 +1160,9 @@ namespace actor
|
||||
act->pos.z += act->react_push;
|
||||
}
|
||||
|
||||
int vel = (act->flags & FLAG_HERO) && (hero::getBoostRun() > 0) ? 2 : 1;
|
||||
//int vel = (act->flags & FLAG_HERO) && (hero::getBoostRun() > 0) ? 2 : 1;
|
||||
int vel = (act->flags & FLAG_HERO) && (act->push & PUSH_DOUBLE) ? 2 : 1;
|
||||
act->push &= ~ PUSH_DOUBLE;
|
||||
|
||||
if (act->push & PUSH_ZP)
|
||||
{
|
||||
@@ -2207,7 +2258,12 @@ namespace actor
|
||||
|
||||
bool giveSkill(char *skill)
|
||||
{
|
||||
return giveSkill(getSkillFromString(skill));
|
||||
const int skill_number = getSkillFromString(skill);
|
||||
if (skill_number==SKILL_SHOES) modules::game::setMissatge(" JA TENS LES SABATES!- ARA JA POTS BOTAR!");
|
||||
else if (skill_number==SKILL_GLOVES) modules::game::setMissatge(" JA TENS ELS GUANTS!- ARA JA POTS ESPENTAR!");
|
||||
else if (skill_number==SKILL_PANTS) modules::game::setMissatge(" JA TENS ELS PANTALONS!- JA POTS AGAFAR COSES!");
|
||||
else if (skill_number==SKILL_BAG) modules::game::setMissatge(" JA TENS LA MOTXILLA!- A ARREPLEGAR PECES!");
|
||||
return giveSkill(skill_number);
|
||||
}
|
||||
|
||||
bool dropSkill(int skill)
|
||||
@@ -2269,8 +2325,13 @@ namespace actor
|
||||
{
|
||||
const int value = getPartFromString(part);
|
||||
parts |= value;
|
||||
if (value != 0)
|
||||
stats::collectPart();
|
||||
if (value != 0) stats::collectPart();
|
||||
|
||||
int num_parts = stats::getNumPartsCollected();
|
||||
char text[] = " PECES ARREPLEGADES:- 0/6";
|
||||
text[34] = num_parts + 48;
|
||||
modules::game::setMissatge(text);
|
||||
|
||||
return value != 0;
|
||||
}
|
||||
|
||||
@@ -2294,6 +2355,18 @@ namespace actor
|
||||
void pickAnbernic(char *name)
|
||||
{
|
||||
anbernics[name[8] - 48] = true;
|
||||
int num_anbernics = getNumAmbernicsCollected();
|
||||
if (num_anbernics==10)
|
||||
{
|
||||
modules::game::setMissatge(" HAS DESBLOQUEJAT- EL PROLOGO!");
|
||||
config::setProgoloDesbloquejat();
|
||||
}
|
||||
else
|
||||
{
|
||||
char text[] = " ANBERNICS ARREPLEGADES:- 0/10";
|
||||
text[36] = num_anbernics+48;
|
||||
modules::game::setMissatge(text);
|
||||
}
|
||||
}
|
||||
|
||||
bool wasAnbernicCollected(char *name)
|
||||
|
||||
Reference in New Issue
Block a user