diff --git a/data/altres.gif b/data/altres.gif index ecbb187..903a54b 100644 Binary files a/data/altres.gif and b/data/altres.gif differ diff --git a/data/rooms/13.txt b/data/rooms/13.txt index dd9ae28..bafc03d 100644 --- a/data/rooms/13.txt +++ b/data/rooms/13.txt @@ -11,6 +11,17 @@ exit-xn: 12 exit-yn: 14 exit-zn: 18 +actor{ + name: LIFT + bmp: altres.gif + bmp-rect: 160 56 32 24 + bmp-offset: 0 24 + pos: 24 48 0 + size: 8 8 4 + orient: ZP + movement: Z +} + actor{ name: LIFT13 bmp: caixes.gif diff --git a/data/rooms/18.txt b/data/rooms/18.txt index 67ba25d..010a2a4 100644 --- a/data/rooms/18.txt +++ b/data/rooms/18.txt @@ -10,3 +10,37 @@ under-door-texture: 0 exit-xn: 21 exit-yn: 19 exit-zp: 13 + +actor{ + name: BOX-A + bmp: caixes.gif + bmp-rect: 0 0 32 32 + bmp-offset: 0 32 + pos: 8 24 0 + size: 8 8 8 + flags: PUSHABLE + movement: CW +} + +actor{ + name: BOX-C + bmp: caixes.gif + bmp-rect: 64 0 32 32 + bmp-offset: 0 32 + pos: 13 32 0 + size: 8 8 8 + flags: PUSHABLE + movement: CW +} + +actor{ + name: LIFT + bmp: altres.gif + bmp-rect: 160 56 32 24 + bmp-offset: 0 24 + pos: 24 48 0 + size: 8 8 4 + orient: ZP + flags: MOVING + movement: Z +} diff --git a/data/rooms/19.txt b/data/rooms/19.txt index 065979c..a3d8282 100644 --- a/data/rooms/19.txt +++ b/data/rooms/19.txt @@ -40,7 +40,7 @@ actor{ pos: 24 24 8 size: 8 2 8 orient: ZN - flags: MOVING + flags: MOVING DEADLY movement: Z } @@ -52,7 +52,7 @@ actor{ pos: 16 24 10 size: 8 2 8 orient: ZN - flags: MOVING + flags: MOVING DEADLY movement: Z } @@ -64,18 +64,6 @@ actor{ pos: 8 24 12 size: 8 2 8 orient: ZN - flags: MOVING - movement: Z -} - -actor{ - name: CUADRO-03 - bmp: altres.gif - bmp-rect: 101 108 17 24 - bmp-offset: -11 29 - pos: 0 24 14 - size: 8 2 8 - orient: ZN flags: MOVING DEADLY movement: Z } @@ -88,7 +76,7 @@ actor{ pos: 32 24 6 size: 8 2 8 orient: ZN - flags: MOVING + flags: MOVING DEADLY movement: Z } @@ -100,7 +88,7 @@ actor{ pos: 40 24 4 size: 8 2 8 orient: ZN - flags: MOVING + flags: MOVING DEADLY movement: Z } @@ -112,7 +100,7 @@ actor{ pos: 48 24 2 size: 8 2 8 orient: ZN - flags: MOVING + flags: MOVING DEADLY movement: Z } @@ -124,7 +112,7 @@ actor{ pos: 56 24 0 size: 8 2 8 orient: ZN - flags: MOVING + flags: MOVING DEADLY movement: Z } @@ -208,6 +196,18 @@ actor{ movement: CW } +actor{ + name: REIXA-Y + bmp: altres.gif + bmp-rect: 101 108 17 24 + bmp-offset: -11 29 + pos: 0 24 14 + size: 8 2 8 + orient: ZN + flags: MOVING DEADLY + movement: Z +} + actor{ name: TRANSPA-00 bmp: altres.gif diff --git a/data/rooms/20.txt b/data/rooms/20.txt index 0bf6ab4..a133801 100644 --- a/data/rooms/20.txt +++ b/data/rooms/20.txt @@ -1,9 +1,272 @@ -width: 2 -height: 2 +width: 1 +height: 3 door-height-yp: 0 color: CYAN -floor-texture: 0 -wall-texture: 0 -door-texture: 0 +floor-texture: 3 +wall-texture: 6 +door-texture: 6 under-door-texture: 0 exit-yp: 19 + +actor{ + name: CONV-XP-01 + bmp: caixes.gif + bmp-rect: 0 128 32 32 + bmp-offset: 0 32 + pos: 16 24 0 + size: 8 8 4 + orient: XP + anim-cycle: MIN + flags: REACTIVE ANIMATED ORIENTABLE + react-mask: ZN + react-push: XP +} + +actor{ + name: GAT-ROBIN + bmp: gat2.gif + bmp-rect: 0 0 24 28 + bmp-offset: -4 32 + pos: 16 0 0 + size: 8 8 8 + orient: XP + anim-wait: 1 + flags: PUSHABLE REACTIVE MOVING ANIMATED ORIENTABLE DEADLY + react-mask: XP XN YP YN ZP ZN + movement: X +} + +actor{ + name: INVISI-00 + bmp: caixes.gif + bmp-rect: 128 0 16 13 + bmp-offset: 0 32 + pos: 24 16 30 + size: 8 8 8 + movement: CW +} + +actor{ + name: INVISI-01 + bmp: caixes.gif + bmp-rect: 128 0 16 13 + bmp-offset: 0 32 + pos: 24 32 30 + size: 8 8 8 + movement: CW +} + +actor{ + name: INVISI-02 + bmp: caixes.gif + bmp-rect: 128 0 16 13 + bmp-offset: 0 32 + pos: 32 16 30 + size: 8 8 8 + movement: CW +} + +actor{ + name: INVISI-03 + bmp: caixes.gif + bmp-rect: 128 0 16 13 + bmp-offset: 0 32 + pos: 32 32 30 + size: 8 8 8 + movement: CW +} + +actor{ + name: OBRER-00 + bmp: obrer.gif + bmp-rect: 0 0 24 32 + bmp-offset: -4 37 + pos: 24 24 0 + size: 8 8 8 + orient: YP + anim-wait: 1 + flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY + react-mask: XP XN YP YN ZP ZN + movement: Y +} + +actor{ + name: OBRER-01 + bmp: obrer.gif + bmp-rect: 0 0 24 32 + bmp-offset: -4 37 + pos: 32 48 0 + size: 8 8 8 + orient: YN + anim-wait: 1 + flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY + react-mask: XP XN YP YN ZP ZN + movement: Y +} + +actor{ + name: P-TIMER + bmp: objectes.gif + bmp-rect: 96 0 24 32 + bmp-offset: -4 34 + pos: 16 0 8 + size: 4 4 4 + anim-cycle: SEQ + anim-wait: 2 + flags: PUSHABLE GRAVITY SPECIAL + movement: CW +} + +actor{ + name: PLATF + bmp: caixes.gif + bmp-rect: 96 160 32 32 + bmp-offset: 0 32 + pos: 40 8 0 + size: 8 8 8 + orient: ZP + movement: Z +} + +actor{ + name: PLATF-00 + bmp: caixes.gif + bmp-rect: 96 160 32 32 + bmp-offset: 0 32 + pos: 16 16 0 + size: 8 8 8 + orient: ZP + movement: Z +} + +actor{ + name: PLATF-01 + bmp: caixes.gif + bmp-rect: 96 160 32 32 + bmp-offset: 0 32 + pos: 16 32 0 + size: 8 8 8 + orient: ZP + movement: Z +} + +actor{ + name: PLATF-02 + bmp: caixes.gif + bmp-rect: 96 160 32 32 + bmp-offset: 0 32 + pos: 40 16 0 + size: 8 8 8 + orient: ZP + movement: Z +} + +actor{ + name: PLATF-03 + bmp: caixes.gif + bmp-rect: 96 160 32 32 + bmp-offset: 0 32 + pos: 40 32 0 + size: 8 8 8 + orient: ZP + movement: Z +} + +actor{ + name: PLATH-00 + bmp: caixes.gif + bmp-rect: 160 128 32 32 + bmp-offset: 0 32 + pos: 16 8 0 + size: 8 8 4 + orient: ZP + movement: Z +} + +actor{ + name: REIXA-Y-00 + bmp: altres.gif + bmp-rect: 83 108 18 25 + bmp-offset: -11 29 + pos: 24 16 14 + size: 8 2 8 + orient: ZN + flags: MOVING DEADLY + movement: Z +} + +actor{ + name: REIXA-Y-01 + bmp: altres.gif + bmp-rect: 83 108 18 25 + bmp-offset: -11 29 + pos: 24 32 5 + size: 8 2 8 + orient: ZN + flags: MOVING DEADLY + movement: Z +} + +actor{ + name: REIXA-Y-02 + bmp: altres.gif + bmp-rect: 83 108 18 25 + bmp-offset: -11 29 + pos: 32 16 14 + size: 8 2 8 + orient: ZN + flags: MOVING DEADLY + movement: Z +} + +actor{ + name: REIXA-Y-03 + bmp: altres.gif + bmp-rect: 83 108 18 25 + bmp-offset: -11 29 + pos: 32 32 5 + size: 8 2 8 + orient: ZN + flags: MOVING DEADLY + movement: Z +} + +actor{ + name: TRANSPA-00 + bmp: altres.gif + bmp-rect: 0 160 32 32 + bmp-offset: 0 32 + pos: 40 32 8 + size: 8 8 6 + movement: CW +} + +actor{ + name: TRANSPA-01 + bmp: altres.gif + bmp-rect: 0 160 32 32 + bmp-offset: 0 32 + pos: 40 16 8 + size: 8 8 6 + movement: CW +} + +actor{ + name: TRANSPA-02 + bmp: altres.gif + bmp-rect: 0 160 32 32 + bmp-offset: 0 32 + pos: 16 16 8 + size: 8 8 6 + movement: CW +} + +actor{ + name: TRANSPA-03 + bmp: altres.gif + bmp-rect: 0 160 32 32 + bmp-offset: 0 32 + pos: 16 32 8 + size: 8 8 6 + movement: CW +} diff --git a/data/rooms/21.txt b/data/rooms/21.txt index f1d4fe5..8d6b098 100644 --- a/data/rooms/21.txt +++ b/data/rooms/21.txt @@ -3,7 +3,7 @@ height: 2 door-height-xp: 1 door-height-xn: 1 door-height-yp: 1 -color: CYAN +color: WHITE floor-texture: 0 wall-texture: 0 door-texture: 0 diff --git a/data/rooms/22.txt b/data/rooms/22.txt index dd8380f..3d15989 100644 --- a/data/rooms/22.txt +++ b/data/rooms/22.txt @@ -2,10 +2,10 @@ width: 2 height: 2 door-height-xp: 0 door-height-yp: 0 -color: CYAN -floor-texture: 0 -wall-texture: 0 -door-texture: 0 -under-door-texture: 0 +color: GREEN +floor-texture: 1 +wall-texture: 13 +door-texture: 7 +under-door-texture: 13 exit-xp: 21 exit-yp: 23 diff --git a/data/rooms/23.txt b/data/rooms/23.txt index fc89005..531a6d0 100644 --- a/data/rooms/23.txt +++ b/data/rooms/23.txt @@ -1,7 +1,7 @@ width: 2 height: 2 door-height-yn: 0 -color: CYAN +color: WHITE floor-texture: 0 wall-texture: 0 door-texture: 0 diff --git a/data/rooms/24.txt b/data/rooms/24.txt index 8922db9..bc95043 100644 --- a/data/rooms/24.txt +++ b/data/rooms/24.txt @@ -3,7 +3,7 @@ height: 2 door-height-xp: 0 door-height-yp: 0 door-height-yn: 4 -color: CYAN +color: YELLOW floor-texture: 0 wall-texture: 0 door-texture: 0 diff --git a/data/rooms/25.txt b/data/rooms/25.txt index 064c183..5e14291 100644 --- a/data/rooms/25.txt +++ b/data/rooms/25.txt @@ -1,10 +1,54 @@ width: 2 height: 2 door-height-xn: 4 -color: CYAN +color: PURPLE floor-texture: 0 wall-texture: 0 door-texture: 0 under-door-texture: 0 exit-xn: 24 exit-zp: 21 + +actor{ + name: BOX-B-00 + bmp: caixes.gif + bmp-rect: 32 0 32 32 + bmp-offset: 0 32 + pos: 16 48 0 + size: 8 8 8 + flags: PUSHABLE + movement: CW +} + +actor{ + name: BOX-B-01 + bmp: caixes.gif + bmp-rect: 32 0 32 32 + bmp-offset: 0 32 + pos: 32 8 0 + size: 8 8 8 + flags: PUSHABLE + movement: CW +} + +actor{ + name: PILOTA + bmp: altres.gif + bmp-rect: 0 108 21 21 + bmp-offset: -6 26 + pos: 32 24 0 + size: 8 8 8 + flags: PUSHABLE INERTIA + movement: CW +} + +actor{ + name: PLATF + bmp: caixes.gif + bmp-rect: 96 160 32 32 + bmp-offset: 0 32 + pos: 40 24 0 + size: 8 8 8 + orient: ZP + movement: Z +} diff --git a/data/templates.txt b/data/templates.txt index 7511c76..0615782 100644 --- a/data/templates.txt +++ b/data/templates.txt @@ -466,6 +466,18 @@ category{ movement: Y } + actor{ + name: REIXA-Y + bmp: altres.gif + bmp-rect: 101 108 17 24 + bmp-offset: -11 29 + pos: 0 24 14 + size: 8 2 8 + orient: ZN + flags: MOVING DEADLY + movement: Z + } + } category{ diff --git a/source/actor.cpp b/source/actor.cpp index dcf8c85..5846f4a 100644 --- a/source/actor.cpp +++ b/source/actor.cpp @@ -797,9 +797,12 @@ namespace actor vec3_t max = room::getMax(); if ( (act->push & PUSH_KILL) && (act->flags & FLAG_HERO) ) { - const int lives = hero::getLives()-1; - hero::setLives(lives); - stats::loseLive(); + if (!editor::isDevMode()) + { + const int lives = hero::getLives()-1; + hero::setLives(lives); + stats::loseLive(); + } // [TODO] If lives == 0 anar a la pantalla de game-over o cat's life actor_t *act = actor::find("HERO"); act = actor::replaceWithTemplate(act, "EXPLOSION"); @@ -1585,6 +1588,17 @@ namespace actor } return 0; } + const char *getBoosterName(int booster) + { + switch (booster) + { + case 1: return "RUN"; + case 2: return "GOD"; + case 4: return "JUMP"; + case 8: return "LIVE"; + default: return ""; + } + } bool giveBooster(char *booster) { @@ -1660,6 +1674,18 @@ namespace actor return 0; } + const char *getSkillName(int skill) + { + switch (skill) + { + case 1: return "SHOES"; + case 2: return "GLOVES"; + case 4: return "PANTS"; + case 8: return "BAG"; + default: return ""; + } + } + bool giveSkill(int skill) { skills |= skill; @@ -1705,6 +1731,20 @@ namespace actor return PART_NONE; } + const char *getPartName(int part) + { + switch (part) + { + case 1: return "FILTER"; + case 2: return "PUMP"; + case 4: return "TIMER"; + case 8: return "SALT"; + case 16: return "PIPE"; + case 32: return "ELBOW"; + default: return ""; + } + } + bool pickPart(char *part) { const int value = getPartFromString(part); diff --git a/source/actor.h b/source/actor.h index dac4eda..d1978ac 100644 --- a/source/actor.h +++ b/source/actor.h @@ -202,6 +202,8 @@ namespace actor void die(); bool isDead(); + const int getBoosterFromString(char *booster); + const char *getBoosterName(int booster); bool giveBooster(char *booster); void collectBooster(int booster, int id); bool wasBoosterCollected(int id); @@ -212,6 +214,8 @@ namespace actor void useBoostRun(); void useBoostJump(); + const int getSkillFromString(char *skill); + const char *getSkillName(int skill); bool giveSkill(int skill); bool giveSkill(char *skill); bool dropSkill(int skill); @@ -219,6 +223,8 @@ namespace actor bool wasSkillCollected(char *skill); int getSkills(); + const int getPartFromString(char *part); + const char *getPartName(int part); bool pickPart(char *part); bool dropPart(char *part); bool wasPartCollected(char *part); diff --git a/source/m_editor_map.cpp b/source/m_editor_map.cpp index 9190f56..3c107dd 100644 --- a/source/m_editor_map.cpp +++ b/source/m_editor_map.cpp @@ -4,6 +4,7 @@ #include "misc.h" #include #include "room.h" +#include "actor.h" namespace modules { @@ -20,6 +21,7 @@ namespace modules uint8_t h; uint8_t color; uint8_t exits[6]; + uint32_t specials; }; miniroom_t minirooms[64]; @@ -34,8 +36,8 @@ namespace modules if (minirooms[room].exits[YN] != 255) { draw::isoline(x,y,+1,-1,14); /*draw::isoline(x,y-1,+1,-1,14);*/ draw::isoline(x,y+1,+1,-1,14); } if (minirooms[room].exits[XP] != 255) { draw::isoline(x,y,+1,+1,14); /*draw::isoline(x,y-1,+1,+1,14);*/ draw::isoline(x,y+1,+1,+1,14); } if (minirooms[room].exits[YP] != 255) { draw::isoline(x,y,-1,+1,14); /*draw::isoline(x,y-1,-1,+1,14);*/ draw::isoline(x,y+1,-1,+1,14); } - if (minirooms[room].exits[ZN] != 255) { draw::vline(x,y,24); /*draw::isoline(x,y-1,-1,+1,14);*/ draw::vline(x+1,y,24); } - if (minirooms[room].exits[ZP] != 255) { draw::vline(x,y-24,24); /*draw::isoline(x,y-1,-1,+1,14);*/ draw::vline(x+1,y-24,24); } + if (minirooms[room].exits[ZN] != 255) { draw::vline(x-1,y,24); /*draw::isoline(x,y-1,-1,+1,14);*/ draw::vline(x,y,24); } + if (minirooms[room].exits[ZP] != 255) { draw::vline(x-1,y-24,24); /*draw::isoline(x,y-1,-1,+1,14);*/ draw::vline(x,y-24,24); } } if (minirooms[room].exits[XN] != 255) drawLines(minirooms[room].exits[XN], x-24, y-12); if (minirooms[room].exits[XP] != 255) drawLines(minirooms[room].exits[XP], x+24, y+12); @@ -59,6 +61,10 @@ namespace modules { char num[] = "00"; num[0] = 48+(room/10); num[1] = 48+(room%10); draw::print(num, x-4, y-3, LIGHT+(room==current_room?YELLOW:WHITE), BLACK); + if (minirooms[room].specials&0x000000ff) { draw::color(BLACK); draw::rect(x+3, y-4, 3, 3); draw::color(BLUE); draw::fillrect(x+4, y-3, 1, 1); } + if (minirooms[room].specials&0x0000ff00) { draw::color(BLACK); draw::rect(x+3, y-2, 3, 3); draw::color(GREEN); draw::fillrect(x+4, y-1, 1, 1); } + if (minirooms[room].specials&0x00ff0000) { draw::color(BLACK); draw::rect(x+3, y, 3, 3); draw::color(YELLOW); draw::fillrect(x+4, y+1, 1, 1); } + if (minirooms[room].specials&0xff000000) { draw::color(RED); draw::fillrect(x+4, y-3, 1, 5); } } } if (minirooms[room].exits[XN] != 255) drawRoom(minirooms[room].exits[XN], x-24, y-12, shadow); @@ -78,6 +84,27 @@ namespace modules minirooms[room].color = room::getColor(0); minirooms[room].w = (room::getSize().x >> 1)-1; minirooms[room].h = (room::getSize().y >> 1)-1; + minirooms[room].specials = 0; + + // Recolectem els especials de l'habitació per a mostrar-los + actor::actor_t *act = actor::getFirst(); + while (act) + { + if (act->flags & FLAG_SPECIAL) + { + if (act->name[0]=='B') { // Es un booster + minirooms[room].specials |= actor::hero::getBoosterFromString(&act->name[2]); + } else if (act->name[0]=='S') { // Es un skill + minirooms[room].specials |= (actor::hero::getSkillFromString(&act->name[2])<<8); + } else if (act->name[0]=='P') { // Es una part + minirooms[room].specials |= (actor::hero::getPartFromString(&act->name[2])<<16); + } else { + minirooms[room].specials |= (1<<24); // Es algo invalid + } + } + act = act->next; + } + for (int i=0; i<=ZN; ++i) minirooms[room].exits[i] = room::getExit(i); for (int i=0; i<=ZN; ++i) { @@ -113,6 +140,13 @@ namespace modules drawRoom(room::getCurrent(), scroll.x+x, scroll.y+y, true); } + draw::stencil::enable(); + draw::stencil::clear(255); + + for (int i=0;i<64;++i) drawn[i]=false; + drawRoom(room::getCurrent(), scroll.x, scroll.y); + + draw::render(); } @@ -120,11 +154,22 @@ namespace modules { if (input::keyPressed(SDL_SCANCODE_ESCAPE) || input::keyPressed(SDL_SCANCODE_TAB)) return false; - draw::stencil::enable(); - draw::stencil::clear(255); + //draw::stencil::enable(); + //draw::stencil::clear(255); + + //for (int i=0;i<64;++i) drawn[i]=false; + //drawRoom(room::getCurrent(), scroll.x, scroll.y); + + const int hover = draw::stencil::query(input::mouseX(), input::mouseY()); + if (hover!=255) { + draw::color(BLACK); draw::fillrect(0,0,60,60); + int line = 4; + draw::print2(hover, -2, 1, 1, WHITE, FONT_ZOOM_VERTICAL); + if (minirooms[hover].specials & 0x000000ff) draw::print2(actor::hero::getBoosterName(minirooms[hover].specials & 0xff), 1, line++, BLUE, FONT_ZOOM_NONE); + if (minirooms[hover].specials & 0x0000ff00) draw::print2(actor::hero::getSkillName((minirooms[hover].specials>>8) & 0xff), 1, line++, GREEN, FONT_ZOOM_NONE); + if (minirooms[hover].specials & 0x00ff0000) draw::print2(actor::hero::getPartName((minirooms[hover].specials>>16) & 0xff), 1, line++, YELLOW, FONT_ZOOM_NONE); + } - for (int i=0;i<64;++i) drawn[i]=false; - drawRoom(room::getCurrent(), scroll.x, scroll.y); draw::render(); if (input::mouseClk(1)) {