- Treballant en el push, els reactius i la gravetat :P

This commit is contained in:
2024-05-08 22:43:11 +02:00
parent c3ab76b594
commit ef4711dd12
3 changed files with 82 additions and 32 deletions

View File

@@ -68,11 +68,11 @@ void game::init()
buffer[len-1]=0;
gifs.push_back(std::string(buffer));
}
//actor::actor_t *hero = actor::create("HERO", {16,32,8}, {8,8,12}, "test.gif", {0,32,20,32}, {-6,38});
actor::actor_t *hero = actor::create("HERO", {16,32,8}, {8,8,12}, "test.gif", {0,32,20,32}, {-6,38});
//actor::actor_t *hero = actor::create("HEROHEROHEROHER", {16,32,8}, {8,8,12}, "abad.gif", {0,0,20,35}, {-6,32});
//hero->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
//actor::setDirty(hero, true);
hero->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
actor::setDirty(hero, true);
actor::clear();
@@ -139,6 +139,24 @@ void btn_small(const int x, const int y, int &var, int min, int max, bool restrt
}
}
void btn_check(const int x, const int y, const char* label, uint8_t &flags, const uint8_t value)
{
int result=0;
if (flags & value) {
result=ui::check(label, x, y, 12, 11, true);
} else {
result=ui::check(label, x, y, 12, 11, false);
}
if (result)
{
if (flags & value) {
flags = flags & ~value;
} else {
flags = flags | value;
}
}
}
void btn_check(const int x, const int y, const char* label, uint16_t &flags, const uint16_t value)
{
int result=0;
@@ -251,10 +269,10 @@ bool game::loop()
if (input::keyDown(SDL_SCANCODE_ESCAPE)) return false;
// WHILE EDITING...
editor_move_selected();
actor::updateEditor(actor::getFirst());
//editor_move_selected();
//actor::updateEditor(actor::getFirst());
//actor::update(actor::getFirst());
actor::update(actor::getFirst());
actor::reorder();
@@ -351,7 +369,7 @@ bool game::loop()
act = actor::getSelected();
if (act)
{
draw::setViewport(420, 110, 100, 240);
draw::setViewport(420, 90, 100, 240);
btn_txt("NAME:", 2, 0, act->name);
if (btn_opt2("BMP:", 2, 10, act->bmp, gifs)) {
@@ -388,7 +406,7 @@ bool game::loop()
btn_check(50, 74, "DEAD", act->flags, FLAG_DEADLY);
btn_check(74, 74, "GRAV", act->flags, FLAG_GRAVITY);
btn_opt("ORIENT", 2, 86, act->orient, {PUSH_NONE, PUSH_XP, PUSH_XN, PUSH_YP, PUSH_YN}, {"NONE", "XP", "XN", "YP", "YN"});
btn_opt("ORIENT", 2, 86, act->orient, {PUSH_NONE, PUSH_XP, PUSH_XN, PUSH_YP, PUSH_YN, PUSH_ZP, PUSH_ZN}, {"NONE", "XP", "XN", "YP", "YN", "ZP", "ZN"});
btn_opt("MOVEMNT", 2, 96, act->movement, {MOV_NONE, MOV_X, MOV_Y, MOV_Z, MOV_CW, MOV_CCW, MOV_RAND, MOV_HUNT}, {"NONE", "X", "Y", "Z", "CW", "CCW", "RAND", "HUNT"});
btn_opt("ANIMCYC", 2, 106, act->anim_cycle, {0, 1}, {"0 1 0 2", "0 1 2 3"});
@@ -396,6 +414,22 @@ bool game::loop()
ui::label("ANMSPED", 2, 116, 32, 11);
btn_small(81, 116, act->anim_wait, 0, 10);
ui::label("RMASK", 2, 128, 24, 11);
btn_check(24+2, 128, "XP", act->react_mask, PUSH_XP);
btn_check(24+14, 128, "XN", act->react_mask, PUSH_XN);
btn_check(24+26, 128, "YP", act->react_mask, PUSH_YP);
btn_check(24+38, 128, "YN", act->react_mask, PUSH_YN);
btn_check(24+50, 128, "ZP", act->react_mask, PUSH_ZP);
btn_check(24+62, 128, "ZN", act->react_mask, PUSH_ZN);
ui::label("RPUSH", 2, 140, 24, 11);
btn_check(24+2, 140, "XP", act->react_push, PUSH_XP);
btn_check(24+14, 140, "XN", act->react_push, PUSH_XN);
btn_check(24+26, 140, "YP", act->react_push, PUSH_YP);
btn_check(24+38, 140, "YN", act->react_push, PUSH_YN);
btn_check(24+50, 140, "ZP", act->react_push, PUSH_ZP);
btn_check(24+62, 140, "ZN", act->react_push, PUSH_ZN);
/*
break;
}