Compare commits
2 Commits
33cfc7ee99
...
3e83fcdaa8
| Author | SHA1 | Date | |
|---|---|---|---|
| 3e83fcdaa8 | |||
| af6c5f43ef |
@@ -20,6 +20,18 @@ actor{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: TAULA01
|
||||||
|
bmp: caixes.gif
|
||||||
|
bmp-rect: 128 32 32 32
|
||||||
|
bmp-offset: 0 32
|
||||||
|
pos: 8 24 0
|
||||||
|
size: 8 8 8
|
||||||
|
orient: YP
|
||||||
|
flags: ORIENTABLE
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: TAULETA
|
name: TAULETA
|
||||||
bmp: caixes.gif
|
bmp: caixes.gif
|
||||||
@@ -30,6 +42,19 @@ actor{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: S-SHOES
|
||||||
|
bmp: objectes.gif
|
||||||
|
bmp-rect: 162 0 28 22
|
||||||
|
bmp-offset: -3 24
|
||||||
|
pos: 48 8 0
|
||||||
|
size: 4 4 4
|
||||||
|
anim-cycle: SEQ
|
||||||
|
anim-wait: 2
|
||||||
|
flags: SPECIAL
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: ARMARI02
|
name: ARMARI02
|
||||||
bmp: caixes.gif
|
bmp: caixes.gif
|
||||||
@@ -62,18 +87,6 @@ actor{
|
|||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
actor{
|
|
||||||
name: TAULA01
|
|
||||||
bmp: caixes.gif
|
|
||||||
bmp-rect: 128 32 32 32
|
|
||||||
bmp-offset: 0 32
|
|
||||||
pos: 8 24 0
|
|
||||||
size: 8 8 8
|
|
||||||
orient: YP
|
|
||||||
flags: ORIENTABLE
|
|
||||||
movement: CW
|
|
||||||
}
|
|
||||||
|
|
||||||
actor{
|
actor{
|
||||||
name: TAULA02
|
name: TAULA02
|
||||||
bmp: caixes.gif
|
bmp: caixes.gif
|
||||||
|
|||||||
@@ -66,3 +66,16 @@ actor{
|
|||||||
flags: ANIMATED SPECIAL
|
flags: ANIMATED SPECIAL
|
||||||
movement: CW
|
movement: CW
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actor{
|
||||||
|
name: S-SHOES
|
||||||
|
bmp: objectes.gif
|
||||||
|
bmp-rect: 162 0 28 22
|
||||||
|
bmp-offset: -3 24
|
||||||
|
pos: 48 8 0
|
||||||
|
size: 4 4 4
|
||||||
|
anim-cycle: SEQ
|
||||||
|
anim-wait: 2
|
||||||
|
flags: SPECIAL
|
||||||
|
movement: CW
|
||||||
|
}
|
||||||
|
|||||||
@@ -422,22 +422,30 @@ namespace actor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t push(actor_t *act, uint8_t push)
|
uint8_t push(actor_t *source, actor_t *act, uint8_t push)
|
||||||
{
|
{
|
||||||
uint8_t result = 0;
|
uint8_t result = 0;
|
||||||
if (act->flags & FLAG_PUSHABLE) act->push |= push;
|
if ( (act->flags & FLAG_PUSHABLE) && ( !(source->flags&FLAG_HERO) || (hero::getSkills()&SKILL_GLOVES) ) ) act->push |= push;
|
||||||
if ( (act->flags & FLAG_REACTIVE) && (act->react_mask & push) ) result = act->react_push;
|
if ( (act->flags & FLAG_REACTIVE) && (act->react_mask & push) ) result = act->react_push;
|
||||||
if (act->flags & FLAG_DEADLY) result |= PUSH_KILL;
|
if (act->flags & FLAG_DEADLY) result |= PUSH_KILL;
|
||||||
|
|
||||||
|
if (source->flags&FLAG_HERO)
|
||||||
|
{
|
||||||
if (act->flags & FLAG_SPECIAL)
|
if (act->flags & FLAG_SPECIAL)
|
||||||
{
|
{
|
||||||
if (act->name[0]=='B') // Es un booster
|
// [TODO 02/07/2024] Fer que faça un fumet o algo al desapareixer les coses
|
||||||
{
|
if (act->name[0]=='B') { // Es un booster
|
||||||
hero::collectBooster(act->name[1]-48, (act->name[3]-48)*10+(act->name[4]-48));
|
hero::collectBooster(act->name[1]-48, (act->name[3]-48)*10+(act->name[4]-48));
|
||||||
actor::remove(act);
|
actor::remove(act);
|
||||||
|
} else if (act->name[0]=='S') { // Es un skill
|
||||||
|
hero::giveSkill(&act->name[2]);
|
||||||
|
actor::remove(act);
|
||||||
|
} else if ( (act->name[0]=='P') && (hero::getSkills()&SKILL_BAG) ) { // Es una part
|
||||||
|
hero::pickPart(&act->name[2]);
|
||||||
|
actor::remove(act);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +527,7 @@ namespace actor
|
|||||||
act->push |= PUSH_YP;
|
act->push |= PUSH_YP;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (input::keyPressed(SDL_SCANCODE_RETURN))
|
if (input::keyPressed(SDL_SCANCODE_RETURN) && (hero::getSkills()&SKILL_PANTS))
|
||||||
{
|
{
|
||||||
if (picked)
|
if (picked)
|
||||||
{
|
{
|
||||||
@@ -547,7 +555,7 @@ namespace actor
|
|||||||
if (!input::keyDown(SDL_SCANCODE_SPACE)) act->pos.z -= height;
|
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) && (hero::getSkills()&SKILL_SHOES) && (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.
|
||||||
act->react_mask=hero::getBoostJump()>0 ? 2 : 1; // =1 estic botant (anant cap amunt)
|
act->react_mask=hero::getBoostJump()>0 ? 2 : 1; // =1 estic botant (anant cap amunt)
|
||||||
@@ -710,7 +718,7 @@ namespace actor
|
|||||||
actor::actor_t *other = actor::get_collision(act);
|
actor::actor_t *other = actor::get_collision(act);
|
||||||
if (other || ( act->pos.x<min.x && ( !(room::getDoors()&DOOR_XN) || (act->pos.y!=28) || (act->pos.z!=room::getDoor(XN)*4) || !(act->flags&FLAG_HERO) ) ))
|
if (other || ( act->pos.x<min.x && ( !(room::getDoors()&DOOR_XN) || (act->pos.y!=28) || (act->pos.z!=room::getDoor(XN)*4) || !(act->flags&FLAG_HERO) ) ))
|
||||||
{
|
{
|
||||||
if (other) act->push |= push(other, PUSH_XN);
|
if (other) act->push |= push(act, other, PUSH_XN);
|
||||||
act->pos.x+=vel;
|
act->pos.x+=vel;
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
}
|
}
|
||||||
@@ -718,7 +726,7 @@ namespace actor
|
|||||||
{
|
{
|
||||||
// Si tenim a algú damunt, el movem també
|
// Si tenim a algú damunt, el movem també
|
||||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||||
push(act->above, PUSH_XN);
|
push(act, act->above, PUSH_XN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si ja havem atravesat la porta, ens movem a la porta de l'altra costat
|
// Si ja havem atravesat la porta, ens movem a la porta de l'altra costat
|
||||||
@@ -739,14 +747,14 @@ namespace actor
|
|||||||
actor::actor_t *other = actor::get_collision(act);
|
actor::actor_t *other = actor::get_collision(act);
|
||||||
if (other || ((act->pos.x+act->size.x)>max.x && ( !(room::getDoors()&DOOR_XP) || (act->pos.y!=28) || !(act->flags&FLAG_HERO) ) ))
|
if (other || ((act->pos.x+act->size.x)>max.x && ( !(room::getDoors()&DOOR_XP) || (act->pos.y!=28) || !(act->flags&FLAG_HERO) ) ))
|
||||||
{
|
{
|
||||||
if (other) act->push |= push(other, PUSH_XP);
|
if (other) act->push |= push(act, other, PUSH_XP);
|
||||||
act->pos.x-=vel;
|
act->pos.x-=vel;
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||||
push(act->above, PUSH_XP);
|
push(act, act->above, PUSH_XP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((act->pos.x+act->size.x)>max.x+4) {
|
if ((act->pos.x+act->size.x)>max.x+4) {
|
||||||
@@ -766,14 +774,14 @@ namespace actor
|
|||||||
actor::actor_t *other = actor::get_collision(act);
|
actor::actor_t *other = actor::get_collision(act);
|
||||||
if (other || ( act->pos.y<min.y && ( !(room::getDoors()&DOOR_YN) || (act->pos.x!=28) || (act->pos.z!=room::getDoor(YN)*4) || !(act->flags&FLAG_HERO) ) ))
|
if (other || ( act->pos.y<min.y && ( !(room::getDoors()&DOOR_YN) || (act->pos.x!=28) || (act->pos.z!=room::getDoor(YN)*4) || !(act->flags&FLAG_HERO) ) ))
|
||||||
{
|
{
|
||||||
if (other) act->push |= push(other, PUSH_YN);
|
if (other) act->push |= push(act, other, PUSH_YN);
|
||||||
act->pos.y+=vel;
|
act->pos.y+=vel;
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||||
push(act->above, PUSH_YN);
|
push(act, act->above, PUSH_YN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (act->pos.y<min.y-4) {
|
if (act->pos.y<min.y-4) {
|
||||||
@@ -793,14 +801,14 @@ namespace actor
|
|||||||
actor::actor_t *other = actor::get_collision(act);
|
actor::actor_t *other = actor::get_collision(act);
|
||||||
if (other || ( (act->pos.y+act->size.y)>max.y && ( !(room::getDoors()&DOOR_YP) || (act->pos.x!=28) || !(act->flags&FLAG_HERO) ) ))
|
if (other || ( (act->pos.y+act->size.y)>max.y && ( !(room::getDoors()&DOOR_YP) || (act->pos.x!=28) || !(act->flags&FLAG_HERO) ) ))
|
||||||
{
|
{
|
||||||
if (other) act->push |= push(other, PUSH_YP);
|
if (other) act->push |= push(act, other, PUSH_YP);
|
||||||
act->pos.y-=vel;
|
act->pos.y-=vel;
|
||||||
if (act->flags & FLAG_MOVING) changeMoving(act);
|
if (act->flags & FLAG_MOVING) changeMoving(act);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
if (act->above && act->above->flags & FLAG_PUSHABLE) {
|
||||||
push(act->above, PUSH_YP);
|
push(act, act->above, PUSH_YP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((act->pos.y+act->size.y)>max.y+4) {
|
if ((act->pos.y+act->size.y)>max.y+4) {
|
||||||
@@ -836,7 +844,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
|
||||||
act->push |= push(act->below, PUSH_ZN);
|
act->push |= push(act, act->below, PUSH_ZN);
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
||||||
return;
|
return;
|
||||||
@@ -856,7 +864,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
|
||||||
act->push |= push(act->below, PUSH_ZN);
|
act->push |= push(act, act->below, PUSH_ZN);
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
if ( (act->flags & FLAG_MOVING) && (act->movement==MOV_Z) ) changeMoving(act);
|
||||||
return;
|
return;
|
||||||
@@ -974,9 +982,9 @@ namespace actor
|
|||||||
|
|
||||||
draw::pushSource();
|
draw::pushSource();
|
||||||
draw::setSource(act->surface);
|
draw::setSource(act->surface);
|
||||||
if (editor::isEditing() && (act==selected)) draw::swapcol(1, room::getColor()==9?11:9); // Si està seleccionat, que canvie de color
|
if (editor::isEditing() && (act==selected)) draw::swapcol(1, room::getColor(1)); // Si està seleccionat, que canvie de color
|
||||||
draw::draw(x, y, act->bmp_rect.w, act->bmp_rect.h, act->bmp_rect.x+ao, act->bmp_rect.y+oo, flip);
|
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()); // Tornem al color per defecte
|
draw::swapcol(1, room::getColor(0)); // Tornem al color per defecte
|
||||||
draw::popSource();
|
draw::popSource();
|
||||||
//print(x+5,y,act->pos.x);
|
//print(x+5,y,act->pos.x);
|
||||||
//print(x+5,y+6,act->pos.y);
|
//print(x+5,y+6,act->pos.y);
|
||||||
@@ -1299,9 +1307,27 @@ namespace actor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void giveSkill(int skill)
|
const int getSkillFromString(char *skill)
|
||||||
{
|
{
|
||||||
skills |= skill;
|
static const char *skillset_name[4] = {"SHOES", "GLOBES", "PANTS", "BAG"};
|
||||||
|
for (int i=0;i<4;++i)
|
||||||
|
{
|
||||||
|
if (strcmp(skill, skillset_name[i])==0)
|
||||||
|
{
|
||||||
|
return 1<<i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void giveSkill(char *skill)
|
||||||
|
{
|
||||||
|
skills |= getSkillFromString(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wasSkillCollected(char *skill)
|
||||||
|
{
|
||||||
|
return skills & getSkillFromString(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getSkills()
|
int getSkills()
|
||||||
@@ -1309,9 +1335,27 @@ namespace actor
|
|||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
void pickPart(int part)
|
const int getPartFromString(char *part)
|
||||||
{
|
{
|
||||||
parts |= part;
|
static const char *partset_name[6] = {"FILTER", "PUMP", "TIMER", "SALT", "PIPE", "ELBOW"};
|
||||||
|
for (int i=0;i<4;++i)
|
||||||
|
{
|
||||||
|
if (strcmp(part, partset_name[i])==0)
|
||||||
|
{
|
||||||
|
return 1<<i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PART_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void pickPart(char *part)
|
||||||
|
{
|
||||||
|
parts |= getPartFromString(part);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wasPartCollected(char *part)
|
||||||
|
{
|
||||||
|
return parts & getPartFromString(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getParts()
|
int getParts()
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ namespace actor
|
|||||||
|
|
||||||
void reorder();
|
void reorder();
|
||||||
|
|
||||||
uint8_t push(actor_t *act, uint8_t push);
|
uint8_t push(actor_t *source, actor_t *act, uint8_t push);
|
||||||
|
|
||||||
void update(actor_t *act, const bool update_all=true);
|
void update(actor_t *act, const bool update_all=true);
|
||||||
void updateEditor(actor_t *act, const bool update_all=true);
|
void updateEditor(actor_t *act, const bool update_all=true);
|
||||||
@@ -176,10 +176,12 @@ namespace actor
|
|||||||
void useBoostRun();
|
void useBoostRun();
|
||||||
void useBoostJump();
|
void useBoostJump();
|
||||||
|
|
||||||
void giveSkill(int skill);
|
void giveSkill(char *skill);
|
||||||
|
bool wasSkillCollected(char *skill);
|
||||||
int getSkills();
|
int getSkills();
|
||||||
|
|
||||||
void pickPart(int part);
|
void pickPart(char *part);
|
||||||
|
bool wasPartCollected(char *part);
|
||||||
int getParts();
|
int getParts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -373,9 +373,9 @@ bool game::loop()
|
|||||||
draw::swapcol(1, WHITE+LIGHT);
|
draw::swapcol(1, WHITE+LIGHT);
|
||||||
actor::draw(actor::getPicked(), false);
|
actor::draw(actor::getPicked(), false);
|
||||||
|
|
||||||
const int col1 = 7+(room::getColor()-6)%5;
|
const int col1 = room::getColor(1);
|
||||||
const int col2 = 7+(room::getColor()-5)%5;
|
const int col2 = room::getColor(2);
|
||||||
const int col3 = 7+(room::getColor()-4)%5;
|
const int col3 = room::getColor(3);
|
||||||
draw::print2("a", 4, 26, col1, FONT_ZOOM_NONE);
|
draw::print2("a", 4, 26, col1, FONT_ZOOM_NONE);
|
||||||
draw::print2("b", 7, 26, col2, FONT_ZOOM_NONE);
|
draw::print2("b", 7, 26, col2, FONT_ZOOM_NONE);
|
||||||
draw::print2("c", 10, 26, col3, FONT_ZOOM_NONE);
|
draw::print2("c", 10, 26, col3, FONT_ZOOM_NONE);
|
||||||
@@ -385,13 +385,13 @@ bool game::loop()
|
|||||||
draw::print2(actor::hero::getBoostRun()/2, 2, 9, 27, col2, FONT_ZOOM_NONE);
|
draw::print2(actor::hero::getBoostRun()/2, 2, 9, 27, col2, FONT_ZOOM_NONE);
|
||||||
|
|
||||||
draw::setSource(draw::getSurface("objectes.gif"));
|
draw::setSource(draw::getSurface("objectes.gif"));
|
||||||
draw::swapcol(1, actor::hero::getSkills()&SKILL_SHOES ? WHITE : BLUE);
|
draw::swapcol(1, actor::hero::getSkills()&SKILL_SHOES ? col1 : col3);
|
||||||
draw::draw(276,166, 28, 22, 162, 0);
|
draw::draw(276,166, 28, 22, 162, 0);
|
||||||
draw::swapcol(1, actor::hero::getSkills()&SKILL_PANTS ? WHITE : BLUE);
|
draw::swapcol(1, actor::hero::getSkills()&SKILL_PANTS ? col1 : col3);
|
||||||
draw::draw(250,183, 18, 23, 167, 22);
|
draw::draw(250,183, 18, 23, 167, 22);
|
||||||
draw::swapcol(1, actor::hero::getSkills()&SKILL_GLOVES ? WHITE : BLUE);
|
draw::swapcol(1, actor::hero::getSkills()&SKILL_GLOVES ? col1 : col3);
|
||||||
draw::draw(222,200, 21, 22, 165, 45);
|
draw::draw(222,200, 21, 22, 165, 45);
|
||||||
draw::swapcol(1, actor::hero::getSkills()&SKILL_BAG ? WHITE : BLUE);
|
draw::swapcol(1, actor::hero::getSkills()&SKILL_BAG ? col1 : col3);
|
||||||
draw::draw(279,200, 20, 25, 145, 41);
|
draw::draw(279,200, 20, 25, 145, 41);
|
||||||
/*
|
/*
|
||||||
print(0,0,input::mouseX());
|
print(0,0,input::mouseX());
|
||||||
@@ -586,7 +586,7 @@ switch (section)
|
|||||||
|
|
||||||
ui::label("TEXTURES", 2, line, 96, 11, GRAY); line+=10;
|
ui::label("TEXTURES", 2, line, 96, 11, GRAY); line+=10;
|
||||||
|
|
||||||
changed |= btn_opt("COLOR", 2, line, room::editor::refColor(), {7, 8, 9, 10, 11}, {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"}, 47); //ui::label("COLOR", 2, line, 64, 11);
|
changed |= btn_opt("COLOR", 2, line, room::editor::refColor(), {0, 1, 2, 3, 4}, {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"}, 47); //ui::label("COLOR", 2, line, 64, 11);
|
||||||
//changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
|
//changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
|
||||||
line += 10;
|
line += 10;
|
||||||
ui::label("FLOOR", 2, line, 48, 11);
|
ui::label("FLOOR", 2, line, 48, 11);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace room
|
|||||||
static int doors = NO_DOOR; // Portes obertes
|
static int doors = NO_DOOR; // Portes obertes
|
||||||
static int door_height[4]; // Altura de cada porta
|
static int door_height[4]; // Altura de cada porta
|
||||||
static int exits[6]; // Habitació destí a la que du cada porta (piso i sostre inclosos)
|
static int exits[6]; // Habitació destí a la que du cada porta (piso i sostre inclosos)
|
||||||
static int color = 5; // Color de l'habitació
|
static int color = 0; // Esquema de color de l'habitació
|
||||||
|
|
||||||
static int floor_type = 0; // Tile per al piso
|
static int floor_type = 0; // Tile per al piso
|
||||||
static int walls_type = 0; // Tile per a les pareds
|
static int walls_type = 0; // Tile per a les pareds
|
||||||
@@ -36,6 +36,14 @@ namespace room
|
|||||||
static draw::surface *doors_surf = nullptr;
|
static draw::surface *doors_surf = nullptr;
|
||||||
static draw::surface *aux_surf = nullptr;
|
static draw::surface *aux_surf = nullptr;
|
||||||
|
|
||||||
|
static uint8_t color_schemes[5][4] = {
|
||||||
|
{7, 11, 10, 9},
|
||||||
|
{8, 11, 9, 7},
|
||||||
|
{9, 11, 10, 8},
|
||||||
|
{10, 11, 8, 7},
|
||||||
|
{11, 10, 9, 8},
|
||||||
|
};
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
actor::clear();
|
actor::clear();
|
||||||
@@ -141,7 +149,7 @@ namespace room
|
|||||||
door_height[YN] = SDL_clamp(val, -1, 5);
|
door_height[YN] = SDL_clamp(val, -1, 5);
|
||||||
|
|
||||||
} else if (util::strcomp(key, "color:")) {
|
} else if (util::strcomp(key, "color:")) {
|
||||||
color = util::stringToInt(file::readString(&buffer), {"purple", "green", "cyan", "yellow", "white"}, {7, 8, 9, 10, 11});
|
color = util::stringToInt(file::readString(&buffer), {"purple", "green", "cyan", "yellow", "white"}, {0, 1, 2, 3, 4});
|
||||||
|
|
||||||
} else if (util::strcomp(key, "floor-texture:")) {
|
} else if (util::strcomp(key, "floor-texture:")) {
|
||||||
floor_type = file::readInt(&buffer);
|
floor_type = file::readInt(&buffer);
|
||||||
@@ -176,13 +184,24 @@ namespace room
|
|||||||
|
|
||||||
if (!::editor::isEditing() && act->flags & FLAG_SPECIAL)
|
if (!::editor::isEditing() && act->flags & FLAG_SPECIAL)
|
||||||
{
|
{
|
||||||
if (act->name[0]=='B') // Es un booster
|
if (act->name[0]=='B') { // Es un booster
|
||||||
{
|
|
||||||
if (actor::hero::wasBoosterCollected((act->name[3]-48)*10+(act->name[4]-48)))
|
if (actor::hero::wasBoosterCollected((act->name[3]-48)*10+(act->name[4]-48)))
|
||||||
{
|
{
|
||||||
actor::remove(act);
|
actor::remove(act);
|
||||||
act = nullptr;
|
act = nullptr;
|
||||||
}
|
}
|
||||||
|
} else if (act->name[0]=='S') { // Es un skill
|
||||||
|
if (actor::hero::wasSkillCollected(&act->name[2]))
|
||||||
|
{
|
||||||
|
actor::remove(act);
|
||||||
|
act = nullptr;
|
||||||
|
}
|
||||||
|
} else if (act->name[0]=='P') { // Es una part
|
||||||
|
if (actor::hero::wasPartCollected(&act->name[2]))
|
||||||
|
{
|
||||||
|
actor::remove(act);
|
||||||
|
act = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (act) actor::setDirty(act, true);
|
if (act) actor::setDirty(act, true);
|
||||||
@@ -209,7 +228,7 @@ namespace room
|
|||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
draw::pushSource();
|
draw::pushSource();
|
||||||
draw::swapcol(1, color);
|
draw::swapcol(1, color_schemes[color][0]);
|
||||||
|
|
||||||
const int floor_row_tiles = int(floor_surf->w/32);
|
const int floor_row_tiles = int(floor_surf->w/32);
|
||||||
const int floor_x = (floor_type%floor_row_tiles)*32;
|
const int floor_x = (floor_type%floor_row_tiles)*32;
|
||||||
@@ -306,7 +325,7 @@ namespace room
|
|||||||
void draw2()
|
void draw2()
|
||||||
{
|
{
|
||||||
draw::pushSource();
|
draw::pushSource();
|
||||||
draw::swapcol(1, color);
|
draw::swapcol(1, color_schemes[color][0]);
|
||||||
|
|
||||||
const int doors_row_tiles = int(doors_surf->w/40);
|
const int doors_row_tiles = int(doors_surf->w/40);
|
||||||
const int doors_x = (doors_type%doors_row_tiles)*40;
|
const int doors_x = (doors_type%doors_row_tiles)*40;
|
||||||
@@ -383,9 +402,9 @@ namespace room
|
|||||||
return exits[d];
|
return exits[d];
|
||||||
}
|
}
|
||||||
|
|
||||||
int getColor()
|
int getColor(int which)
|
||||||
{
|
{
|
||||||
return color;
|
return color_schemes[color][which];
|
||||||
}
|
}
|
||||||
|
|
||||||
int getFloorCount()
|
int getFloorCount()
|
||||||
@@ -440,7 +459,7 @@ namespace room
|
|||||||
const char *numToColor(uint8_t value)
|
const char *numToColor(uint8_t value)
|
||||||
{
|
{
|
||||||
const char* colors[5] = {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"};
|
const char* colors[5] = {"PURPLE", "GREEN", "CYAN", "YELLOW", "WHITE"};
|
||||||
return colors[value-7];
|
return colors[value];
|
||||||
}
|
}
|
||||||
|
|
||||||
void modify() { modified = true; }
|
void modify() { modified = true; }
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace room
|
|||||||
int getDoors();
|
int getDoors();
|
||||||
int getDoor(const int d);
|
int getDoor(const int d);
|
||||||
int getExit(const int d);
|
int getExit(const int d);
|
||||||
int getColor();
|
int getColor(int which);
|
||||||
|
|
||||||
int getFloorCount();
|
int getFloorCount();
|
||||||
int getDoorCount();
|
int getDoorCount();
|
||||||
|
|||||||
Reference in New Issue
Block a user