- [FIX] La porta de l'habitacio de les sabates, que vaig pujar en la party pero se m'havia oblidat fer-ho en el repo

- [FIX] Solució a un dangling pointer que me va trobar valgrind
- [COMMIT ABANS DEL MEGACANVI]
This commit is contained in:
2024-10-09 10:10:21 +02:00
parent 77cdf90c99
commit b292ae710a
3 changed files with 28 additions and 21 deletions

3
.gitignore vendored
View File

@@ -4,4 +4,5 @@
*.dSYM/* *.dSYM/*
build/* build/*
thepool thepool
thepool_debug thepool_debug
valgrind*

View File

@@ -1,7 +1,7 @@
width: 2 width: 2
height: 3 height: 3
door-height-xn: 3 door-height-xn: 3
door-height-yp: 2 door-height-yp: 3
color: WHITE color: WHITE
floor-texture: 11 floor-texture: 11
wall-texture: 2 wall-texture: 2

View File

@@ -636,6 +636,7 @@ namespace actor
audio::playSound("snd_disappear.wav", SOUND_BASIC); audio::playSound("snd_disappear.wav", SOUND_BASIC);
act = actor::replaceWithTemplate(act, "EXPLOSION"); act = actor::replaceWithTemplate(act, "EXPLOSION");
act->name[0] = '_'; act->name[0] = '_';
return PUSH_NONE;
} }
if (source->flags & FLAG_DEADLY) if (source->flags & FLAG_DEADLY)
@@ -682,6 +683,7 @@ namespace actor
act = actor::replaceWithTemplate(act, "EXPLOSION"); act = actor::replaceWithTemplate(act, "EXPLOSION");
act->name[0] = '_'; act->name[0] = '_';
room::cycleColor(1); room::cycleColor(1);
return PUSH_NONE;
} }
} }
return result; return result;
@@ -1134,8 +1136,10 @@ namespace actor
actor::actor_t *other = actor::get_collision(act); actor::actor_t *other = actor::get_collision(act);
if (other || (act->pos.x < min.x && (!(room::getDoors() & DOOR_XN) || (act->pos.y != 28) || (act->pos.z != room::getDoor(XN) * 4) || !(act->flags & FLAG_HERO)))) if (other || (act->pos.x < min.x && (!(room::getDoors() & DOOR_XN) || (act->pos.y != 28) || (act->pos.z != room::getDoor(XN) * 4) || !(act->flags & FLAG_HERO))))
{ {
if (other) if (other) {
other->push |= push(act, other, PUSH_XN); uint8_t push_value = push(act, other, PUSH_XN);
if (push_value) other->push |= push_value;
}
act->pos.x += vel; act->pos.x += vel;
if (act->flags & FLAG_MOVING) if (act->flags & FLAG_MOVING)
changeMoving(act); changeMoving(act);
@@ -1172,8 +1176,10 @@ namespace actor
actor::actor_t *other = actor::get_collision(act); actor::actor_t *other = actor::get_collision(act);
if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || !(act->flags & FLAG_HERO)))) if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || !(act->flags & FLAG_HERO))))
{ {
if (other) if (other) {
other->push |= push(act, other, PUSH_XP); uint8_t push_value = push(act, other, PUSH_XP);
if (push_value) other->push |= push_value;
}
act->pos.x -= vel; act->pos.x -= vel;
if (act->flags & FLAG_MOVING) if (act->flags & FLAG_MOVING)
changeMoving(act); changeMoving(act);
@@ -1213,8 +1219,10 @@ namespace actor
actor::actor_t *other = actor::get_collision(act); actor::actor_t *other = actor::get_collision(act);
if (other || (act->pos.y < min.y && (!(room::getDoors() & DOOR_YN) || (act->pos.x != 28) || (act->pos.z != room::getDoor(YN) * 4) || !(act->flags & FLAG_HERO)))) if (other || (act->pos.y < min.y && (!(room::getDoors() & DOOR_YN) || (act->pos.x != 28) || (act->pos.z != room::getDoor(YN) * 4) || !(act->flags & FLAG_HERO))))
{ {
if (other) if (other) {
other->push |= push(act, other, PUSH_YN); uint8_t push_value = push(act, other, PUSH_YN);
if (push_value) other->push |= push_value;
}
act->pos.y += vel; act->pos.y += vel;
if (act->flags & FLAG_MOVING) if (act->flags & FLAG_MOVING)
changeMoving(act); changeMoving(act);
@@ -1249,8 +1257,10 @@ namespace actor
actor::actor_t *other = actor::get_collision(act); actor::actor_t *other = actor::get_collision(act);
if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || !(act->flags & FLAG_HERO)))) if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || !(act->flags & FLAG_HERO))))
{ {
if (other) if (other) {
other->push |= push(act, other, PUSH_YP); uint8_t push_value = push(act, other, PUSH_YP);
if (push_value) other->push |= push_value;
}
act->pos.y -= vel; act->pos.y -= vel;
if (act->flags & FLAG_MOVING) if (act->flags & FLAG_MOVING)
changeMoving(act); changeMoving(act);
@@ -1307,7 +1317,8 @@ namespace actor
if (is_above(act, act->below)) if (is_above(act, act->below))
{ {
// ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane // ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane
act->push |= push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia uint8_t push_value = push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
if (push_value) act->push |= push_value;
act->push &= ~PUSH_ZN; act->push &= ~PUSH_ZN;
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z)) if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
changeMoving(act); changeMoving(act);
@@ -1328,7 +1339,9 @@ namespace actor
act->below = below; act->below = below;
below->above = act; below->above = act;
// ... i li passem el push, netejem el meu flag i gonnem // ... i li passem el push, netejem el meu flag i gonnem
act->push |= push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia uint8_t push_value = push(act, act->below, PUSH_ZN); // [RZC 20/09/2024] Canvie "act->below->push" per "act->push". Se li deu passar la reacció al que la inicia
if (push_value) act->push |= push_value;
act->push &= ~PUSH_ZN; act->push &= ~PUSH_ZN;
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z)) if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
changeMoving(act); changeMoving(act);
@@ -1401,23 +1414,16 @@ namespace actor
act->anim_wait_count++; act->anim_wait_count++;
} }
if (act->flags & FLAG_HERO) if (act->flags & FLAG_HERO) updateUserInput(act);
updateUserInput(act);
if (act->flags & FLAG_MOVING) if (act->flags & FLAG_MOVING)
{ {
if (act->movement == MOV_HUNT && ((act->pos.x & 7) == 0 || (act->pos.y & 7) == 0)) if (act->movement == MOV_HUNT && ((act->pos.x & 7) == 0 || (act->pos.y & 7) == 0))
changeMoving(act); changeMoving(act);
updateMoving(act); updateMoving(act);
} }
if (act->flags & FLAG_GRAVITY) if (act->flags & FLAG_GRAVITY) act->push |= PUSH_ZN;
act->push |= PUSH_ZN;
// if (act->flags & FLAG_PUSHABLE)
updatePush(act); updatePush(act);
// if (act->flags & FLAG_GRAVITY) updateGravity(act);
// if (act->flags & FLAG_REACTIVE) updateReactive(act);
// act->push = PUSH_NONE;
if (!room_changed && update_all && next) if (!room_changed && update_all && next)
update(next); update(next);