- Ja picka i leava objectes, pero no se perque se perd el falg de pickable. BUG
- Roomba retocada per a no ser tan juggernaut
This commit is contained in:
BIN
data/caixes.gif
BIN
data/caixes.gif
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
@@ -90,7 +90,7 @@ actor{
|
|||||||
name: ROOMBA
|
name: ROOMBA
|
||||||
bmp: caixes.gif
|
bmp: caixes.gif
|
||||||
bmp-rect: 160 0 32 32
|
bmp-rect: 160 0 32 32
|
||||||
bmp-offset: 0 32
|
bmp-offset: 0 34
|
||||||
pos: 40 32 0
|
pos: 40 32 0
|
||||||
size: 8 8 4
|
size: 8 8 4
|
||||||
orient: YP
|
orient: YP
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace actor
|
|||||||
actor_t *first = nullptr;
|
actor_t *first = nullptr;
|
||||||
actor_t *dirty = nullptr;
|
actor_t *dirty = nullptr;
|
||||||
actor_t *selected = nullptr;
|
actor_t *selected = nullptr;
|
||||||
|
actor_t *picked = nullptr;
|
||||||
|
|
||||||
actor_t *getFirst()
|
actor_t *getFirst()
|
||||||
{
|
{
|
||||||
@@ -220,7 +221,7 @@ namespace actor
|
|||||||
{
|
{
|
||||||
tmp[0]=0;
|
tmp[0]=0;
|
||||||
if (value==0) return "NONE";
|
if (value==0) return "NONE";
|
||||||
if (value&1) strcat(tmp, "HERO ");
|
if (value&256) strcat(tmp, "PICKABLE ");
|
||||||
if (value&2) strcat(tmp, "PUSHABLE ");
|
if (value&2) strcat(tmp, "PUSHABLE ");
|
||||||
if (value&4) strcat(tmp, "REACTIVE ");
|
if (value&4) strcat(tmp, "REACTIVE ");
|
||||||
if (value&8) strcat(tmp, "MOVING ");
|
if (value&8) strcat(tmp, "MOVING ");
|
||||||
@@ -285,6 +286,7 @@ namespace actor
|
|||||||
other = other->next;
|
other = other->next;
|
||||||
if (other == act) other = other->next;
|
if (other == act) other = other->next;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
other = dirty;
|
other = dirty;
|
||||||
while (other)
|
while (other)
|
||||||
{
|
{
|
||||||
@@ -292,6 +294,7 @@ namespace actor
|
|||||||
other = other->next;
|
other = other->next;
|
||||||
if (other == act) other = other->next;
|
if (other == act) other = other->next;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,6 +307,7 @@ namespace actor
|
|||||||
other = other->next;
|
other = other->next;
|
||||||
if (other == act) other = other->next;
|
if (other == act) other = other->next;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
other = dirty;
|
other = dirty;
|
||||||
while (other)
|
while (other)
|
||||||
{
|
{
|
||||||
@@ -311,12 +315,19 @@ namespace actor
|
|||||||
other = other->next;
|
other = other->next;
|
||||||
if (other == act) other = other->next;
|
if (other == act) other = other->next;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setDirty(actor_t *act, const bool force)
|
void setDirty(actor_t *act, const bool force)
|
||||||
{
|
{
|
||||||
|
if (!act->prev && !act->next)
|
||||||
|
{
|
||||||
|
act->next = first;
|
||||||
|
if (first) first->prev = act;
|
||||||
|
first = act;
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (act->prev==nullptr && act != first && !force) return;
|
if (act->prev==nullptr && act != first && !force) return;
|
||||||
|
|
||||||
if (act->prev) act->prev->next = act->next;
|
if (act->prev) act->prev->next = act->next;
|
||||||
@@ -326,7 +337,7 @@ namespace actor
|
|||||||
act->prev = nullptr;
|
act->prev = nullptr;
|
||||||
act->next = dirty;
|
act->next = dirty;
|
||||||
dirty = act;
|
dirty = act;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void select(actor_t *act) {
|
void select(actor_t *act) {
|
||||||
@@ -346,6 +357,9 @@ namespace actor
|
|||||||
|
|
||||||
void reorder()
|
void reorder()
|
||||||
{
|
{
|
||||||
|
dirty = first;
|
||||||
|
first = nullptr;
|
||||||
|
|
||||||
while (dirty)
|
while (dirty)
|
||||||
{
|
{
|
||||||
if (first)
|
if (first)
|
||||||
@@ -473,6 +487,34 @@ namespace actor
|
|||||||
act->push |= PUSH_YP;
|
act->push |= PUSH_YP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (input::keyPressed(SDL_SCANCODE_RETURN))
|
||||||
|
{
|
||||||
|
if (picked)
|
||||||
|
{
|
||||||
|
picked->pos.x = act->pos.x;
|
||||||
|
picked->pos.y = act->pos.y;
|
||||||
|
picked->pos.z = act->pos.z;
|
||||||
|
act->pos.z += picked->size.z;
|
||||||
|
actor::actor_t *above = act->above;
|
||||||
|
while (above) { above->pos.z += picked->size.z; above = above->above; }
|
||||||
|
if (act->below)
|
||||||
|
{
|
||||||
|
act->below->above = picked;
|
||||||
|
picked->below = act->below;
|
||||||
|
}
|
||||||
|
act->below = picked;
|
||||||
|
picked->above = act;
|
||||||
|
picked->next = picked->prev = nullptr;
|
||||||
|
actor::setDirty(picked, true);
|
||||||
|
picked = nullptr;
|
||||||
|
}
|
||||||
|
else if (act->below && act->below->flags&FLAG_PICKABLE)
|
||||||
|
{
|
||||||
|
const int height = act->below->size.z;
|
||||||
|
pick(act->below);
|
||||||
|
if (!input::keyDown(SDL_SCANCODE_SPACE)) act->pos.z -= height;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ( input::keyDown(SDL_SCANCODE_SPACE) && (act->pos.y+act->size.y)<=max.y && act->pos.y>=min.y && (act->pos.x+act->size.x)<=max.x && act->pos.x>=min.x && act->react_mask==0 && (act->pos.z==0 || act->below))
|
if ( input::keyDown(SDL_SCANCODE_SPACE) && (act->pos.y+act->size.y)<=max.y && act->pos.y>=min.y && (act->pos.x+act->size.x)<=max.x && act->pos.x>=min.x && act->react_mask==0 && (act->pos.z==0 || act->below))
|
||||||
{
|
{
|
||||||
// [RZC 14/05/2024] hack usant react_mask i react_push del heroi. Llegir més avall.
|
// [RZC 14/05/2024] hack usant react_mask i react_push del heroi. Llegir més avall.
|
||||||
@@ -793,6 +835,8 @@ namespace actor
|
|||||||
|
|
||||||
void update(actor_t *act, const bool update_all)
|
void update(actor_t *act, const bool update_all)
|
||||||
{
|
{
|
||||||
|
if (!act) return;
|
||||||
|
|
||||||
actor_t *next = act->next;
|
actor_t *next = act->next;
|
||||||
|
|
||||||
// Actualitzem el frame de l'animació (si no te el flag de animat, no afectarà per a res)
|
// Actualitzem el frame de l'animació (si no te el flag de animat, no afectarà per a res)
|
||||||
@@ -819,6 +863,8 @@ namespace actor
|
|||||||
|
|
||||||
void updateEditor(actor_t *act, const bool update_all)
|
void updateEditor(actor_t *act, const bool update_all)
|
||||||
{
|
{
|
||||||
|
if (!act) return;
|
||||||
|
|
||||||
actor_t *next = act->next;
|
actor_t *next = act->next;
|
||||||
|
|
||||||
if (act->anim_wait_count==act->anim_wait) {
|
if (act->anim_wait_count==act->anim_wait) {
|
||||||
@@ -892,6 +938,7 @@ namespace actor
|
|||||||
act = act->next;
|
act = act->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
act = dirty;
|
act = dirty;
|
||||||
while (act)
|
while (act)
|
||||||
{
|
{
|
||||||
@@ -901,6 +948,7 @@ namespace actor
|
|||||||
}
|
}
|
||||||
act = act->next;
|
act = act->next;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,6 +980,7 @@ namespace actor
|
|||||||
other = other->next;
|
other = other->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
other = dirty;
|
other = dirty;
|
||||||
while (other)
|
while (other)
|
||||||
{
|
{
|
||||||
@@ -944,6 +993,7 @@ namespace actor
|
|||||||
}
|
}
|
||||||
other = other->next;
|
other = other->next;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@@ -970,6 +1020,21 @@ namespace actor
|
|||||||
free(act);
|
free(act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void pick(actor_t *act)
|
||||||
|
{
|
||||||
|
if (!act) return;
|
||||||
|
if (act->prev) act->prev->next = act->next;
|
||||||
|
if (act==first) first = act->next;
|
||||||
|
if (act==dirty) dirty = act->next;
|
||||||
|
if (act->next) act->next->prev = act->prev;
|
||||||
|
if (act==selected) selected = nullptr;
|
||||||
|
picked = act;
|
||||||
|
picked->pos.x=36;
|
||||||
|
picked->pos.y=82;
|
||||||
|
}
|
||||||
|
|
||||||
|
actor_t *getPicked() { return picked; }
|
||||||
|
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
actor_t *hero = nullptr;
|
actor_t *hero = nullptr;
|
||||||
@@ -985,6 +1050,7 @@ namespace actor
|
|||||||
}
|
}
|
||||||
act = tmp;
|
act = tmp;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
act = dirty;
|
act = dirty;
|
||||||
while (act)
|
while (act)
|
||||||
{
|
{
|
||||||
@@ -997,10 +1063,16 @@ namespace actor
|
|||||||
}
|
}
|
||||||
act = tmp;
|
act = tmp;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if (picked)
|
||||||
|
{
|
||||||
|
free(picked);
|
||||||
|
picked = nullptr;
|
||||||
|
}
|
||||||
first = dirty = nullptr;
|
first = dirty = nullptr;
|
||||||
if (hero) {
|
if (hero) {
|
||||||
hero->above = hero->below = hero->next = hero->prev = nullptr;
|
hero->above = hero->below = hero->next = hero->prev = nullptr;
|
||||||
dirty = hero;
|
first = hero;
|
||||||
}
|
}
|
||||||
selected = nullptr;
|
selected = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,6 +123,10 @@ namespace actor
|
|||||||
|
|
||||||
void remove(actor_t *act);
|
void remove(actor_t *act);
|
||||||
|
|
||||||
|
void pick(actor_t *act);
|
||||||
|
|
||||||
|
actor_t *getPicked();
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
namespace templates
|
namespace templates
|
||||||
|
|||||||
@@ -365,6 +365,8 @@ bool game::loop()
|
|||||||
room::draw();
|
room::draw();
|
||||||
actor::draw(actor::getFirst());
|
actor::draw(actor::getFirst());
|
||||||
room::draw2();
|
room::draw2();
|
||||||
|
draw::swapcol(1, WHITE+LIGHT);
|
||||||
|
actor::draw(actor::getPicked(), false);
|
||||||
//draw::draw(148+sx*2-sy*2, 67+sx+sy,24,24,24,0);
|
//draw::draw(148+sx*2-sy*2, 67+sx+sy,24,24,24,0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user