- [FIX] Les portes frontals no tenien l'altura adequada

- [FIX] El piso de les portes frontals no es calculaba correctament
- [CHG] Ara RAND també canvia de direcció després de un temps random
- [FIX] Al crear un nou actor el editor no se ficava en mode SECTION_ACTOR
- [NEW] Al pulsar on no hi ha actors ara se fica en mode SECTION_ROOM
- [FIX] Quan estem en mode SECTION_ROOM no s'ha de vore un actor seleccionat
- Més habitacions. Zona 3 acabada, començant zona 4
This commit is contained in:
2024-09-26 13:51:10 +02:00
parent 1d85db4052
commit 8c639f2330
20 changed files with 960 additions and 16 deletions

View File

@@ -8,6 +8,7 @@
#include "debug.h"
#include "config.h"
#include <vector>
#include "m_game.h"
namespace actor
{
@@ -756,6 +757,7 @@ namespace actor
}
break;
case MOV_RAND:
act->react_push = (rand()%32)+8; // [RZC 26/09/2024] Hack usant react_push en el moviment RAND per a contar la distancia abans de canviar de direcció
switch (rand()%4)
{
case 0: act->mov_push=PUSH_YP; break;
@@ -817,6 +819,14 @@ namespace actor
return;
}
// [RZC 26/09/2024] Hack usant react_push en el moviment RAND per a contar la distancia abans de canviar de direcció
if (act->movement==MOV_RAND)
{
act->react_push--;
if (act->react_push==0) changeMoving(act);
}
// [RZC 26/09/2024] Hack usant react_push en les bambolles de café per al dz del moviment de anar pegant botets
if (act->movement==MOV_RANDJ)
{
@@ -1170,7 +1180,7 @@ namespace actor
draw::pushSource();
draw::setSource(act->surface);
if (editor::isEditing() && (act==selected)) draw::swapcol(1, room::getColor(1)); // Si està seleccionat, que canvie de color
if (editor::isEditing() && (act==selected) && modules::game::getSection()==modules::game::SECTION_ACTOR) draw::swapcol(1, room::getColor(1)); // Si està seleccionat, que canvie de color
draw::stencil::set(act->tag);
draw::draw(x, y, act->bmp_rect.w, act->bmp_rect.h, act->bmp_rect.x+ao, act->bmp_rect.y+oo, flip);
draw::swapcol(1, room::getColor(0)); // Tornem al color per defecte

View File

@@ -7,6 +7,7 @@
#include <vector>
#include "room.h"
#include "jutil.h"
#include "m_game.h"
#define EDITING_NORMAL 0
#define EDITING_CATEGORY_NAME 1
@@ -146,7 +147,7 @@ namespace modules
actor::select(new_act);
actor::setFloatingEditing(true);
room::editor::modify();
modules::game::setSection(modules::game::SECTION_ACTOR);
return false;
}
} else {

View File

@@ -12,8 +12,6 @@ namespace modules
{
namespace game
{
enum sections { SECTION_GENERAL, SECTION_ROOM, SECTION_ACTOR };
std::vector<std::string> gifs;
int treeview_scroll = 0;
@@ -275,6 +273,16 @@ namespace modules
}
}
void setSection(int value)
{
section = value;
}
const int getSection()
{
return section;
}
int loop()
{
int return_value = GAME_NONE;
@@ -362,6 +370,10 @@ namespace modules
actor::select(actor::findByTag(val));
section = SECTION_ACTOR;
}
else if (input::mouseX()>=0 && input::mouseX()<320 && input::mouseY()>=0 && input::mouseY()<240)
{
section = SECTION_ROOM;
}
}
// Si estem jugant, o estem en el editor pero NO en mode edició, pinta els marcadors

View File

@@ -16,9 +16,14 @@ namespace modules
#define GAME_EDITOR_BITMAP_POS 6
#define GAME_EDITOR_BITMAP_SIZE 7
enum sections { SECTION_GENERAL, SECTION_ROOM, SECTION_ACTOR };
void init();
int loop();
void setSection(int value);
const int getSection();
std::vector<std::string> getGifs();
}
}

View File

@@ -88,30 +88,36 @@ namespace room
if (doors & DOOR_YP)
{
uint8_t actual_floor = door_height[2]>0?0:floor_type*32;
actor::actor_t *act = actor::create("DOOR_YP1", {24,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[2]*8});
const int floor_row_tiles = int(floor_surf->w/32);
const uint8_t actual_floor = door_height[2]>0?0:floor_type;
int floor_x = (actual_floor%floor_row_tiles)*32;
int floor_y = int(actual_floor/floor_row_tiles)*16;
actor::actor_t *act = actor::create("DOOR_YP1", {24,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, "floor.gif", {floor_x,floor_y+1,32,15}, {0,15+door_height[2]*8});
act->flags = FLAG_NOEDITOR;
actor::setDirty(act, true);
act = actor::create("DOOR_YP2", {32,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[2]*8});
act = actor::create("DOOR_YP2", {32,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, "floor.gif", {floor_x,floor_y+1,32,15}, {0,15+door_height[2]*8});
act->flags = FLAG_NOEDITOR;
actor::setDirty(act, true);
act = actor::create("DOOR_YP", {20,(tmax.y+1)*8,1+door_height[2]*4}, {5,4,1}, "doors.gif", {(doors_type%6)*40,(doors_type/6)*59,16,48}, {-16,49});
act = actor::create("DOOR_YP", {20,(tmax.y+1)*8,1+door_height[2]*4}, {5,4,24}, "doors.gif", {(doors_type%6)*40,(doors_type/6)*59,16,48}, {-16,49});
act->flags = FLAG_NOEDITOR;
actor::setDirty(act, true);
}
if (doors & DOOR_XP)
{
uint8_t actual_floor = door_height[0]>0?0:floor_type*32;
actor::actor_t *act = actor::create("DOOR_XP1", {(tmax.x+1)*8,24,0}, {8,8,(door_height[0])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[0]*8});
const int floor_row_tiles = int(floor_surf->w/32);
const uint8_t actual_floor = door_height[0]>0?0:floor_type;
int floor_x = (actual_floor%floor_row_tiles)*32;
int floor_y = int(actual_floor/floor_row_tiles)*16;
actor::actor_t *act = actor::create("DOOR_XP1", {(tmax.x+1)*8,24,0}, {8,8,(door_height[0])*4}, "floor.gif", {floor_x,floor_y+1,32,15}, {0,15+door_height[0]*8});
act->flags = FLAG_NOEDITOR;
actor::setDirty(act, true);
act = actor::create("DOOR_XP2", {(tmax.x+1)*8,32,0}, {8,8,(door_height[0])*4}, "floor.gif", {actual_floor,1,32,15}, {0,15+door_height[0]*8});
act = actor::create("DOOR_XP2", {(tmax.x+1)*8,32,0}, {8,8,(door_height[0])*4}, "floor.gif", {floor_x,floor_y+1,32,15}, {0,15+door_height[0]*8});
act->flags = FLAG_NOEDITOR;
actor::setDirty(act, true);
act = actor::create("DOOR_XP", {(tmax.x+1)*8,20,1+door_height[0]*4}, {8,8,1}, "doors.gif", {(doors_type%6)*40,(doors_type/6)*59,16,48}, {0,49});
act = actor::create("DOOR_XP", {(tmax.x+1)*8,20,1+door_height[0]*4}, {8,8,24}, "doors.gif", {(doors_type%6)*40,(doors_type/6)*59,16,48}, {0,49});
act->flags = FLAG_NOEDITOR | FLAG_ORIENTABLE;
act->orient = PUSH_YP;
actor::setDirty(act, true);