- [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:
@@ -277,10 +277,10 @@ namespace actor
|
|||||||
if (act->react_mask)
|
if (act->react_mask)
|
||||||
{
|
{
|
||||||
// Si topetem en una vora de l'habitació, s'acabat el bot
|
// 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)...
|
// Si encara està botant (react_push < 8)...
|
||||||
if (act->react_push<8)
|
if (act->react_push<9)
|
||||||
{
|
{
|
||||||
act->pos.z++; // seguim pujant
|
act->pos.z++; // seguim pujant
|
||||||
act->react_push++; // augmentem el comptador de bot
|
act->react_push++; // augmentem el comptador de bot
|
||||||
@@ -355,28 +355,8 @@ namespace actor
|
|||||||
if (act->flags & FLAG_ORIENTABLE) act->orient = act->mov_push;
|
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)
|
void updatePush(actor_t *act)
|
||||||
{
|
{
|
||||||
if (act->flags & FLAG_REACTIVE) { updateReactive(act); return; }
|
|
||||||
|
|
||||||
vec3_t min = room::getMin();
|
vec3_t min = room::getMin();
|
||||||
vec3_t max = room::getMax();
|
vec3_t max = room::getMax();
|
||||||
|
|
||||||
@@ -524,7 +504,7 @@ namespace actor
|
|||||||
// ...i encara està baix...
|
// ...i encara està baix...
|
||||||
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
|
||||||
uint8_t result = push(act->below, PUSH_ZN);
|
act->push |= push(act->below, PUSH_ZN);
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
return;
|
return;
|
||||||
@@ -544,7 +524,7 @@ 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
|
||||||
uint8_t result = push(act->below, PUSH_ZN);
|
act->push |= push(act->below, PUSH_ZN);
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
return;
|
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;
|
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ó
|
// Si arribem fins ací, podem moure la posició
|
||||||
|
act->push &= ~PUSH_ZN;
|
||||||
act->pos.z--;
|
act->pos.z--;
|
||||||
actor::setDirty(act);
|
actor::setDirty(act);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user