- [FIX] Ja torna a funcionar el bot

- [CHG] Llevat codi que ja no s'usa
- [FIX] React ja funciona al pasar per damunt
This commit is contained in:
2024-05-23 08:52:02 +02:00
parent 5f06a2ce2f
commit 99b4dd9d3f

View File

@@ -277,10 +277,10 @@ namespace actor
if (act->react_mask)
{
// Si topetem en una vora de l'habitació, s'acabat el bot
if (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) act->react_push=8;
if (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) act->react_push=9;
// Si encara està botant (react_push < 8)...
if (act->react_push<8)
if (act->react_push<9)
{
act->pos.z++; // seguim pujant
act->react_push++; // augmentem el comptador de bot
@@ -355,28 +355,8 @@ namespace actor
if (act->flags & FLAG_ORIENTABLE) act->orient = act->mov_push;
}
void updateReactive(actor_t *act)
{
if (act->push & act->react_mask)
{
actor_t *other = nullptr;
if (act->push == PUSH_XP) { act->pos.x-=2; other = get_collision(act); act->pos.x+=2; }
else if (act->push == PUSH_XN) { act->pos.x++; other = get_collision(act); act->pos.x--; }
else if (act->push == PUSH_YP) { act->pos.y--; other = get_collision(act); act->pos.y++; }
else if (act->push == PUSH_YN) { act->pos.y++; other = get_collision(act); act->pos.y--; }
else if (act->push == PUSH_ZN) { act->pos.z++; other = get_collision(act); act->pos.z--; }
if (other) {
other->push |= act->react_push;
}
}
}
void updatePush(actor_t *act)
{
if (act->flags & FLAG_REACTIVE) { updateReactive(act); return; }
vec3_t min = room::getMin();
vec3_t max = room::getMax();
@@ -524,7 +504,7 @@ namespace actor
// ...i encara està baix...
if (is_above(act, act->below)) {
// ...li pase a ell el push, neteje el meu flag, canvie direcció si pertoca i me ane
uint8_t result = push(act->below, PUSH_ZN);
act->push |= push(act->below, PUSH_ZN);
act->push &= ~PUSH_ZN;
if (act->flags & FLAG_MOVING) changeMoving(act);
return;
@@ -544,7 +524,7 @@ namespace actor
act->below = below;
below->above = act;
// ... i li passem el push, netejem el meu flag i gonnem
uint8_t result = push(act->below, PUSH_ZN);
act->push |= push(act->below, PUSH_ZN);
act->push &= ~PUSH_ZN;
if (act->flags & FLAG_MOVING) changeMoving(act);
return;
@@ -554,6 +534,7 @@ namespace actor
if (act->flags&FLAG_HERO && (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) ) return;
// Si arribem fins ací, podem moure la posició
act->push &= ~PUSH_ZN;
act->pos.z--;
actor::setDirty(act);
}