- [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:
2024-10-10 12:58:22 +02:00
parent ec7ac7114e
commit baae73a38d
9 changed files with 158 additions and 22 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -27,6 +27,19 @@ actor{
movement: CW
}
actor{
name: B-02-RUN
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 8 8 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: BATMAN
bmp: batman.gif

View File

@@ -25,19 +25,6 @@ actor{
movement: CCW
}
actor{
name: B-02-RUN
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 24 56 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: BATMAN
bmp: batman.gif

View File

@@ -25,7 +25,7 @@ actor{
bmp: altres.gif
bmp-rect: 0 133 32 27
bmp-offset: 0 27
pos: 0 48 0
pos: 0 51 0
size: 8 8 6
flags: REACTIVE DEADLY
react-mask: XP XN YP YN ZP ZN

View File

@@ -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)

View File

@@ -33,6 +33,7 @@
#define PUSH_ZP 16
#define PUSH_ZN 32
#define PUSH_KILL 64
#define PUSH_DOUBLE 128
// Tipus de moviment de l'actor
#define MOV_NONE 0 // Ningun

View File

@@ -17,6 +17,7 @@ namespace modules
actor::actor_t *act = nullptr;
const char *actor_names[] = {"JAILDESIGNER", "BATMAN", "ROBIN", "EL ALTRE BATMAN", "EL ABAD", "LA ROOMBA", "EL OBRER", "BAMBOLLA DE CAFE", "EL YONKI", "LA PILOTA", "SAM", "LORD ABAD"};
const char *actor_ids[] = {"JAILDES", "GAT-BATMAN", "GAT-ROBIN", "BATMAN", "ABAD", "ROOMBA2", "OBRER", "COFFEE", "YONKI", "PILOTA", "SAM", "LORD-ABAD"};
char time_text[7] = " 00:00";
void init(bool go_direct_to_credits)
{
@@ -36,6 +37,19 @@ namespace modules
if (audio::getCurrentMusic() != "mus_menu.ogg") audio::playMusic("mus_menu.ogg");
actor::templates::load();
int milliseconds = SDL_GetTicks()-actor::stats::getStartTime();
int seconds = milliseconds/1000;
int minutes = seconds / 60;
seconds = seconds % 60;
time_text[0] = minutes<100 ? ' ' : (minutes/100)+48;
time_text[1] = minutes<10 ? ' ' : ((minutes%100)/10)+48;
time_text[2] = (minutes%10)+48;
time_text[4] = (seconds/10)+48;
time_text[5] = (seconds%10)+48;
time_text[6] = 0;
}
const bool shouldGoToNext()
@@ -130,7 +144,17 @@ namespace modules
}
case 16:
draw::cls(2);
draw::print2("GRACIES PER JUGAR!", 11, 15, PURPLE, FONT_ZOOM_NONE);
draw::print2("GRACIES PER JUGAR!", 11, 9, PURPLE, FONT_ZOOM_VERTICAL);
draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 11, 14, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 11, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 11, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE);
break;
}

View File

@@ -289,8 +289,38 @@ namespace modules
return section;
}
char missatge[255] = "";
void mostra_missatge()
{
if ( (controller::pressed(KEY_MENU)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) )
{
missatge[0] = 0;
return;
}
draw::color(BLACK);
draw::fillrect(56, 68, 208, 48);
draw::color(WHITE);
draw::rect(56, 68, 208, 48);
char text[2][25];
int i=0, j=0, k=0;
while (missatge[i]!=0)
{
if (missatge[i]=='-') { text[k][j]=0; i++; j=0; k++; }
text[k][j] = missatge[i];
i++; j++;
}
text[k][j]=0;
draw::print2(text[0], 8, 10, WHITE, FONT_ZOOM_NONE);
draw::print2(text[1], 8, 12, WHITE, FONT_ZOOM_NONE);
draw::render();
}
int loop()
{
if (missatge[0] != 0) { mostra_missatge(); return GAME_NONE; }
int return_value = GAME_NONE;
if (actor::hero::isDead()) return GAME_DEAD;
@@ -956,5 +986,11 @@ namespace modules
return return_value;
}
void setMissatge(const char *text)
{
strcpy(missatge, text);
}
}
}

View File

@@ -27,5 +27,7 @@ namespace modules
const int getSection();
std::vector<std::string> getGifs();
void setMissatge(const char *text);
}
}