Compare commits
10 Commits
7e34efcf1a
...
96b9b92d53
| Author | SHA1 | Date | |
|---|---|---|---|
| 96b9b92d53 | |||
| 6adc44e9d6 | |||
| f6231a6f5c | |||
| 5e72414642 | |||
| a648390f29 | |||
| e399e287ae | |||
| 4f8404e105 | |||
| 04d5c41328 | |||
| 219bdd96b3 | |||
| d587b5a0a4 |
BIN
data/caixes.gif
BIN
data/caixes.gif
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
data/floor.gif
BIN
data/floor.gif
Binary file not shown.
|
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 651 B |
@@ -7,17 +7,9 @@ floor-texture: 0
|
||||
wall-texture: 2
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 5
|
||||
exit-xn: 1
|
||||
exit-zn: 0
|
||||
|
||||
actor{
|
||||
name: PLATFORM00
|
||||
bmp: test.gif
|
||||
bmp-rect: 64 0 32 24
|
||||
bmp-offset: 0 24
|
||||
pos: 8 28 0
|
||||
size: 8 8 4
|
||||
}
|
||||
exit-zn: 2
|
||||
|
||||
actor{
|
||||
name: PLATFORM02
|
||||
@@ -28,6 +20,15 @@ actor{
|
||||
size: 8 8 4
|
||||
}
|
||||
|
||||
actor{
|
||||
name: PLATFORM00
|
||||
bmp: test.gif
|
||||
bmp-rect: 64 0 32 24
|
||||
bmp-offset: 0 24
|
||||
pos: 8 28 0
|
||||
size: 8 8 4
|
||||
}
|
||||
|
||||
actor{
|
||||
name: PLATFORM01
|
||||
bmp: test.gif
|
||||
@@ -37,16 +38,6 @@ actor{
|
||||
size: 8 8 4
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX
|
||||
bmp: test.gif
|
||||
bmp-rect: 32 0 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 16 28 4
|
||||
size: 8 8 8
|
||||
flags: PUSHABLE GRAVITY
|
||||
}
|
||||
|
||||
actor{
|
||||
name: PLATFORM04
|
||||
bmp: test.gif
|
||||
|
||||
@@ -1,9 +1,99 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xp: 0
|
||||
door-height-yp: 1
|
||||
color: CYAN
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
floor-texture: 6
|
||||
wall-texture: 3
|
||||
door-texture: 1
|
||||
under-door-texture: 0
|
||||
exit-xp: 0
|
||||
exit-yp: 3
|
||||
|
||||
actor{
|
||||
name: ARMARI01
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 32 24 32
|
||||
bmp-offset: -8 36
|
||||
pos: 8 8 0
|
||||
size: 8 4 5
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: ARMARI02
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 96 32 24 32
|
||||
bmp-offset: -8 36
|
||||
pos: 8 8 8
|
||||
size: 8 4 8
|
||||
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{
|
||||
name: TAULA02
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 160 32 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 32 0
|
||||
size: 8 8 8
|
||||
orient: YP
|
||||
flags: ORIENTABLE
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: TAULETA
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 0 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 24 8 0
|
||||
size: 8 8 5
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: TV
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 32 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 24 7 5
|
||||
size: 8 5 8
|
||||
orient: XP
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: NES
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 96 0 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 24 16 0
|
||||
size: 8 8 6
|
||||
flags: PICKABLE PUSHABLE GRAVITY
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: ROOMBA
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 160 0 32 32
|
||||
bmp-offset: 0 34
|
||||
pos: 40 32 0
|
||||
size: 8 8 4
|
||||
orient: YP
|
||||
flags: MOVING
|
||||
movement: Y
|
||||
}
|
||||
|
||||
23
data/rooms/02.txt
Normal file
23
data/rooms/02.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
width: 2
|
||||
height: 1
|
||||
door-height-xn: 4
|
||||
door-height-yp: 0
|
||||
color: BLUE
|
||||
floor-texture: 1
|
||||
wall-texture: 2
|
||||
door-texture: 0
|
||||
under-door-texture: 2
|
||||
exit-xn: 3
|
||||
exit-yp: 4
|
||||
exit-zp: 0
|
||||
|
||||
actor{
|
||||
name: BOX
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 32 0 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 32 32 0
|
||||
size: 8 8 8
|
||||
flags: PUSHABLE GRAVITY
|
||||
movement: CW
|
||||
}
|
||||
33
data/rooms/03.txt
Normal file
33
data/rooms/03.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
width: 1
|
||||
height: 2
|
||||
door-height-xp: 0
|
||||
door-height-yn: 4
|
||||
color: PURPLE
|
||||
floor-texture: 0
|
||||
wall-texture: 0
|
||||
door-texture: 0
|
||||
under-door-texture: 0
|
||||
exit-xp: 2
|
||||
exit-yn: 1
|
||||
|
||||
actor{
|
||||
name: BOX
|
||||
bmp: test.gif
|
||||
bmp-rect: 32 0 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 32 32 0
|
||||
size: 8 8 8
|
||||
flags: PUSHABLE GRAVITY
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX01
|
||||
bmp: test.gif
|
||||
bmp-rect: 32 0 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 28 29 8
|
||||
size: 8 8 8
|
||||
flags: PUSHABLE GRAVITY
|
||||
movement: CW
|
||||
}
|
||||
250
data/rooms/04.txt
Normal file
250
data/rooms/04.txt
Normal file
@@ -0,0 +1,250 @@
|
||||
width: 2
|
||||
height: 3
|
||||
door-height-yp: 2
|
||||
door-height-yn: 2
|
||||
color: GREEN
|
||||
floor-texture: 1
|
||||
wall-texture: 5
|
||||
door-texture: 4
|
||||
under-door-texture: 0
|
||||
exit-yn: 2
|
||||
|
||||
actor{
|
||||
name: BOX
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 0 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX02
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 16 0 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX03
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 24 0 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX20
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 8 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX01
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 16 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX11
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 24 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX12
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 32 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX13
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 40 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX14
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 48 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX21
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 8 56 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX15
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 16 56 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX16
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 24 56 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX04
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 32 0 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX17
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 32 56 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX05
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 40 0 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX22
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 0 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX06
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 8 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX07
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 16 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX08
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 24 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX09
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 32 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX10
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 40 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX19
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 48 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX18
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 40 56 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
|
||||
actor{
|
||||
name: BOX23
|
||||
bmp: caixes.gif
|
||||
bmp-rect: 64 64 32 32
|
||||
bmp-offset: 0 32
|
||||
pos: 48 56 0
|
||||
size: 8 8 8
|
||||
movement: CW
|
||||
}
|
||||
9
data/rooms/05.txt
Normal file
9
data/rooms/05.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
width: 2
|
||||
height: 2
|
||||
door-height-xn: 0
|
||||
color: YELLOW
|
||||
floor-texture: 8
|
||||
wall-texture: 8
|
||||
door-texture: 5
|
||||
under-door-texture: 0
|
||||
exit-xn: 0
|
||||
BIN
data/walls.gif
BIN
data/walls.gif
Binary file not shown.
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
187
source/actor.cpp
187
source/actor.cpp
@@ -17,6 +17,8 @@ namespace actor
|
||||
actor_t *first = nullptr;
|
||||
actor_t *dirty = nullptr;
|
||||
actor_t *selected = nullptr;
|
||||
actor_t *picked = nullptr;
|
||||
static bool room_changed = false;
|
||||
|
||||
actor_t *getFirst()
|
||||
{
|
||||
@@ -162,6 +164,7 @@ namespace actor
|
||||
return t;
|
||||
}
|
||||
}
|
||||
if (t->flags&FLAG_MOVING) t->mov_push = t->orient;
|
||||
return t;
|
||||
}
|
||||
return nullptr;
|
||||
@@ -219,7 +222,7 @@ namespace actor
|
||||
{
|
||||
tmp[0]=0;
|
||||
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&4) strcat(tmp, "REACTIVE ");
|
||||
if (value&8) strcat(tmp, "MOVING ");
|
||||
@@ -284,6 +287,7 @@ namespace actor
|
||||
other = other->next;
|
||||
if (other == act) other = other->next;
|
||||
}
|
||||
/*
|
||||
other = dirty;
|
||||
while (other)
|
||||
{
|
||||
@@ -291,6 +295,7 @@ namespace actor
|
||||
other = other->next;
|
||||
if (other == act) other = other->next;
|
||||
}
|
||||
*/
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -303,6 +308,7 @@ namespace actor
|
||||
other = other->next;
|
||||
if (other == act) other = other->next;
|
||||
}
|
||||
/*
|
||||
other = dirty;
|
||||
while (other)
|
||||
{
|
||||
@@ -310,12 +316,19 @@ namespace actor
|
||||
other = other->next;
|
||||
if (other == act) other = other->next;
|
||||
}
|
||||
*/
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
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) act->prev->next = act->next;
|
||||
@@ -325,15 +338,27 @@ namespace actor
|
||||
act->prev = nullptr;
|
||||
act->next = dirty;
|
||||
dirty = act;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
void select(actor_t *act) {
|
||||
selected = act;
|
||||
}
|
||||
|
||||
const bool isInFront(actor_t *act1, actor_t *act2) {
|
||||
const bool overlap(actor_t *act1, actor_t *act2)
|
||||
{
|
||||
return act1->inner_x < act2->inner_x+act2->bmp_rect.w &&
|
||||
act1->inner_x+act1->bmp_rect.w > act2->inner_x &&
|
||||
act1->inner_y > act2->inner_y+act2->bmp_rect.h &&
|
||||
act1->inner_y+act1->bmp_rect.h < act2->inner_y;
|
||||
}
|
||||
|
||||
const bool isInFront(actor_t *act1, actor_t *act2)
|
||||
{
|
||||
return (act1->pos.x >= act2->pos.x+act2->size.x) ||
|
||||
(act1->pos.y >= act2->pos.y+act2->size.y) ||
|
||||
(act1->pos.z >= act2->pos.z+act2->size.z);
|
||||
/*
|
||||
if (act1->pos.x >= act2->pos.x+act2->size.x) { return true; }
|
||||
else if (act2->pos.x >= act1->pos.x+act1->size.x) { return false; }
|
||||
else if (act1->pos.y >= act2->pos.y+act2->size.y) { return true; }
|
||||
@@ -341,28 +366,25 @@ namespace actor
|
||||
else if (act1->pos.z >= act2->pos.z+act2->size.z) { return true; }
|
||||
else if (act2->pos.z >= act1->pos.z+act1->size.z) { return false; }
|
||||
else { return false; }
|
||||
*/
|
||||
}
|
||||
|
||||
void reorder()
|
||||
{
|
||||
dirty = first;
|
||||
first = nullptr;
|
||||
|
||||
while (dirty)
|
||||
{
|
||||
dirty->inner_x = 148-dirty->bmp_offset.x + dirty->pos.x*2 - dirty->pos.y*2;
|
||||
dirty->inner_y = 91-dirty->bmp_offset.y + dirty->pos.x + dirty->pos.y - dirty->pos.z*2;
|
||||
|
||||
if (first)
|
||||
{
|
||||
actor_t *current = first;
|
||||
while (true)
|
||||
{
|
||||
if (isInFront(current, dirty))
|
||||
{
|
||||
dirty->prev = current->prev;
|
||||
current->prev = dirty;
|
||||
if (dirty->prev) dirty->prev->next = dirty;
|
||||
dirty = dirty->next;
|
||||
current->prev->next = current;
|
||||
if (current==first) first=current->prev;
|
||||
break;
|
||||
}
|
||||
else
|
||||
if (overlap(dirty, current) || isInFront(dirty, current))
|
||||
{
|
||||
if (current->next)
|
||||
{
|
||||
@@ -377,6 +399,16 @@ namespace actor
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dirty->prev = current->prev;
|
||||
current->prev = dirty;
|
||||
if (dirty->prev) dirty->prev->next = dirty;
|
||||
dirty = dirty->next;
|
||||
current->prev->next = current;
|
||||
if (current==first) first=current->prev;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -407,7 +439,7 @@ namespace actor
|
||||
if ( input::keyDown(SDL_SCANCODE_LEFT) )
|
||||
{
|
||||
act->orient=PUSH_XN;
|
||||
if ( (act->pos.x>min.x && act->pos.y>=min.y && act->pos.y<=max.y) || ( (room::getDoors()&DOOR_XN) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
if ( (act->pos.x>min.x && act->pos.y>=min.y && (act->pos.y+act->size.y)<=max.y) || ( (room::getDoors()&DOOR_XN) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.x<=min.x) && (act->pos.z==room::getDoor(XN)*4) && (room::getDoors()&DOOR_XN) ) {
|
||||
@@ -421,13 +453,13 @@ namespace actor
|
||||
act->push |= PUSH_XN;
|
||||
}
|
||||
}
|
||||
if ( input::keyDown(SDL_SCANCODE_RIGHT) )
|
||||
else if ( input::keyDown(SDL_SCANCODE_RIGHT) )
|
||||
{
|
||||
act->orient=PUSH_XP;
|
||||
if ( (act->pos.x<max.x && act->pos.y>=min.y && act->pos.y<=max.y) || ( (room::getDoors()&DOOR_XP) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
if ( ((act->pos.x+act->size.x)<max.x && act->pos.y>=min.y && (act->pos.y+act->size.y)<=max.y) || ( (room::getDoors()&DOOR_XP) && (act->pos.y>=24) && (act->pos.y<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.x>=max.x) && (act->pos.z==room::getDoor(XP)*4) && (room::getDoors()&DOOR_XP) ) {
|
||||
if ( ((act->pos.x+act->size.x)>=max.x) && (act->pos.z==room::getDoor(XP)*4) && (room::getDoors()&DOOR_XP) ) {
|
||||
if (act->pos.y<28)
|
||||
act->push |= PUSH_YP;
|
||||
else if (act->pos.y>28)
|
||||
@@ -438,10 +470,10 @@ namespace actor
|
||||
act->push |= PUSH_XP;
|
||||
}
|
||||
}
|
||||
if ( input::keyDown(SDL_SCANCODE_UP) )
|
||||
else if ( input::keyDown(SDL_SCANCODE_UP) )
|
||||
{
|
||||
act->orient=PUSH_YN;
|
||||
if ( (act->pos.y>min.y && act->pos.x>=min.x && act->pos.x<=max.x) || ( (room::getDoors()&DOOR_YN) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
if ( (act->pos.y>min.y && act->pos.x>=min.x && (act->pos.x+act->size.x)<=max.x) || ( (room::getDoors()&DOOR_YN) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.y<=min.y) && (act->pos.z==room::getDoor(YN)*4) && (room::getDoors()&DOOR_YN) ) {
|
||||
@@ -455,13 +487,13 @@ namespace actor
|
||||
act->push |= PUSH_YN;
|
||||
}
|
||||
}
|
||||
if ( input::keyDown(SDL_SCANCODE_DOWN) )
|
||||
else if ( input::keyDown(SDL_SCANCODE_DOWN) )
|
||||
{
|
||||
act->orient=PUSH_YP;
|
||||
if ( (act->pos.y<max.y && act->pos.x>=min.x && act->pos.x<=max.x) || ( (room::getDoors()&DOOR_YP) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
if ( ((act->pos.y+act->size.y)<max.y && act->pos.x>=min.x && (act->pos.x+act->size.x)<=max.x) || ( (room::getDoors()&DOOR_YP) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||
{
|
||||
moving = true;
|
||||
if ( (act->pos.y>=max.y) && (act->pos.z==room::getDoor(YP)*4) && (room::getDoors()&DOOR_YP) ) {
|
||||
if ( ((act->pos.y+act->size.y)>=max.y) && (act->pos.z==room::getDoor(YP)*4) && (room::getDoors()&DOOR_YP) ) {
|
||||
if (act->pos.x<28)
|
||||
act->push |= PUSH_XP;
|
||||
else if (act->pos.x>28)
|
||||
@@ -472,7 +504,35 @@ namespace actor
|
||||
act->push |= PUSH_YP;
|
||||
}
|
||||
}
|
||||
if ( input::keyDown(SDL_SCANCODE_SPACE) && act->pos.y<=max.y && act->pos.y>=min.y && act->pos.x<=max.x && act->pos.x>=min.x && act->react_mask==0 && (act->pos.z==0 || act->below))
|
||||
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))
|
||||
{
|
||||
// [RZC 14/05/2024] hack usant react_mask i react_push del heroi. Llegir més avall.
|
||||
act->react_mask=1; // =1 estic botant (anant cap amunt)
|
||||
@@ -494,7 +554,7 @@ namespace actor
|
||||
if (act->react_mask)
|
||||
{
|
||||
// Si topetem en una vora de l'habitació, s'acabat el bot
|
||||
if (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) act->react_push=9;
|
||||
if ((act->pos.x+act->size.x)>max.x || act->pos.x<min.x || (act->pos.y+act->size.y)>max.y || act->pos.y<min.y) act->react_push=9;
|
||||
|
||||
// Si encara està botant (react_push < 8)...
|
||||
if (act->react_push<9)
|
||||
@@ -522,6 +582,7 @@ namespace actor
|
||||
|
||||
void updateMoving(actor_t *act)
|
||||
{
|
||||
if (act->flags&FLAG_MOVING && act->mov_push==0) act->mov_push = act->orient; // Per a activar-lo si no ho està
|
||||
act->push |= act->mov_push;
|
||||
}
|
||||
|
||||
@@ -625,11 +686,11 @@ namespace actor
|
||||
}
|
||||
|
||||
// Si ja havem atravesat la porta, ens movem a la porta de l'altra costat
|
||||
// [TODO] que es moga a l'habitació que toca!!!
|
||||
if (act->pos.x<min.x-4) {
|
||||
room::load(room::getExit(XN));
|
||||
act->pos.x = room::getMax().x+3;
|
||||
act->pos.x = room::getMax().x-4;
|
||||
act->pos.z = room::getDoor(XP)*4;
|
||||
room_changed = true;
|
||||
}
|
||||
|
||||
actor::setDirty(act);
|
||||
@@ -640,7 +701,7 @@ namespace actor
|
||||
if (act->push & PUSH_XP) {
|
||||
act->pos.x++;
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || (act->pos.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);
|
||||
act->pos.x--;
|
||||
@@ -652,10 +713,11 @@ namespace actor
|
||||
push(act->above, PUSH_XP);
|
||||
}
|
||||
|
||||
if (act->pos.x>max.x+4) {
|
||||
if ((act->pos.x+act->size.x)>max.x+4) {
|
||||
room::load(room::getExit(XP));
|
||||
act->pos.x = room::getMin().x-3;
|
||||
act->pos.z = room::getDoor(XN)*4;
|
||||
room_changed = true;
|
||||
}
|
||||
|
||||
actor::setDirty(act);
|
||||
@@ -666,7 +728,7 @@ namespace actor
|
||||
if (act->push & PUSH_YN) {
|
||||
act->pos.y--;
|
||||
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(XN)*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);
|
||||
act->pos.y++;
|
||||
@@ -680,8 +742,9 @@ namespace actor
|
||||
|
||||
if (act->pos.y<min.y-4) {
|
||||
room::load(room::getExit(YN));
|
||||
act->pos.y = room::getMax().y+3;
|
||||
act->pos.y = room::getMax().y-4;
|
||||
act->pos.z = room::getDoor(YP)*4;
|
||||
room_changed = true;
|
||||
}
|
||||
|
||||
actor::setDirty(act);
|
||||
@@ -692,7 +755,7 @@ namespace actor
|
||||
if (act->push & PUSH_YP) {
|
||||
act->pos.y++;
|
||||
actor::actor_t *other = actor::get_collision(act);
|
||||
if (other || ( act->pos.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);
|
||||
act->pos.y--;
|
||||
@@ -704,10 +767,11 @@ namespace actor
|
||||
push(act->above, PUSH_YP);
|
||||
}
|
||||
|
||||
if (act->pos.y>max.y+4) {
|
||||
if ((act->pos.y+act->size.y)>max.y+4) {
|
||||
room::load(room::getExit(YP));
|
||||
act->pos.y = room::getMin().y-3;
|
||||
act->pos.z = room::getDoor(YN)*4;
|
||||
room_changed = true;
|
||||
}
|
||||
|
||||
actor::setDirty(act);
|
||||
@@ -717,7 +781,16 @@ namespace actor
|
||||
|
||||
if (act->push & PUSH_ZN) {
|
||||
// Si estic sobre el piso, no faig res [TODO]: Si no hi ha piso ha de caure
|
||||
if (act->pos.z == 0) return;
|
||||
if (act->pos.z == 0)
|
||||
{
|
||||
if ( ((act->flags&FLAG_HERO)==0) || (room::getExit(ZN)==-1) ) return;
|
||||
|
||||
room::load(room::getExit(ZN));
|
||||
act->pos.z = room::getMax().z;
|
||||
actor::setDirty(act);
|
||||
room_changed = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Si tinc a algú baix...
|
||||
if (act->below)
|
||||
@@ -752,7 +825,7 @@ namespace actor
|
||||
}
|
||||
|
||||
// Si estem dins d'una porta, no caiguem. [TODO] Revisar
|
||||
if (act->flags&FLAG_HERO && (act->pos.x>max.x || act->pos.x<min.x || act->pos.y>max.y || act->pos.y<min.y) ) return;
|
||||
if (act->flags&FLAG_HERO && ((act->pos.x+act->size.x)>max.x || act->pos.x<min.x || (act->pos.y+act->size.y)>max.y || act->pos.y<min.y) ) return;
|
||||
|
||||
// Si arribem fins ací, podem moure la posició
|
||||
act->push &= ~PUSH_ZN;
|
||||
@@ -783,6 +856,8 @@ namespace actor
|
||||
|
||||
void update(actor_t *act, const bool update_all)
|
||||
{
|
||||
if (!act) return;
|
||||
|
||||
actor_t *next = act->next;
|
||||
|
||||
// Actualitzem el frame de l'animació (si no te el flag de animat, no afectarà per a res)
|
||||
@@ -804,11 +879,14 @@ namespace actor
|
||||
|
||||
//act->push = PUSH_NONE;
|
||||
|
||||
if (update_all && next) update(next);
|
||||
if (!room_changed && update_all && next) update(next);
|
||||
room_changed = false;
|
||||
}
|
||||
|
||||
void updateEditor(actor_t *act, const bool update_all)
|
||||
{
|
||||
if (!act) return;
|
||||
|
||||
actor_t *next = act->next;
|
||||
|
||||
if (act->anim_wait_count==act->anim_wait) {
|
||||
@@ -847,8 +925,8 @@ namespace actor
|
||||
|
||||
if (!editor::isEditing() || ( (act->flags&FLAG_HERO)==0))
|
||||
{
|
||||
const int x = 148-act->bmp_offset.x + act->pos.x*2 - act->pos.y*2;
|
||||
const int y = 91-act->bmp_offset.y + act->pos.x + act->pos.y - act->pos.z*2;
|
||||
const int x = act->inner_x; // 148-act->bmp_offset.x + act->pos.x*2 - act->pos.y*2;
|
||||
const int y = act->inner_y; // 91-act->bmp_offset.y + act->pos.x + act->pos.y - act->pos.z*2;
|
||||
|
||||
const bool flip = ( (act->flags & FLAG_ORIENTABLE) && (act->orient==PUSH_XN || act->orient==PUSH_YP) ) ? DRAW_FLIP_HORIZONTAL : DRAW_FLIP_NONE;
|
||||
const int oo = ( (act->flags & FLAG_ORIENTABLE) && (act->orient==PUSH_XN || act->orient==PUSH_YN) ) ? act->bmp_rect.h : 0;
|
||||
@@ -882,6 +960,7 @@ namespace actor
|
||||
act = act->next;
|
||||
}
|
||||
|
||||
/*
|
||||
act = dirty;
|
||||
while (act)
|
||||
{
|
||||
@@ -891,6 +970,7 @@ namespace actor
|
||||
}
|
||||
act = act->next;
|
||||
}
|
||||
*/
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -922,6 +1002,7 @@ namespace actor
|
||||
other = other->next;
|
||||
}
|
||||
|
||||
/*
|
||||
other = dirty;
|
||||
while (other)
|
||||
{
|
||||
@@ -934,6 +1015,7 @@ namespace actor
|
||||
}
|
||||
other = other->next;
|
||||
}
|
||||
*/
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -960,6 +1042,24 @@ namespace actor
|
||||
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;
|
||||
picked->inner_x = 148-act->bmp_offset.x + act->pos.x*2 - act->pos.y*2;
|
||||
picked->inner_y = 91-act->bmp_offset.y + act->pos.x + act->pos.y - act->pos.z*2;
|
||||
|
||||
}
|
||||
|
||||
actor_t *getPicked() { return picked; }
|
||||
|
||||
void clear()
|
||||
{
|
||||
actor_t *hero = nullptr;
|
||||
@@ -975,6 +1075,7 @@ namespace actor
|
||||
}
|
||||
act = tmp;
|
||||
}
|
||||
/*
|
||||
act = dirty;
|
||||
while (act)
|
||||
{
|
||||
@@ -987,10 +1088,16 @@ namespace actor
|
||||
}
|
||||
act = tmp;
|
||||
}
|
||||
*/
|
||||
if (picked)
|
||||
{
|
||||
free(picked);
|
||||
picked = nullptr;
|
||||
}
|
||||
first = dirty = nullptr;
|
||||
if (hero) {
|
||||
hero->above = hero->below = hero->next = hero->prev = nullptr;
|
||||
dirty = hero;
|
||||
first = hero;
|
||||
}
|
||||
selected = nullptr;
|
||||
}
|
||||
|
||||
@@ -76,6 +76,9 @@ namespace actor
|
||||
|
||||
actor_t *prev;
|
||||
actor_t *next;
|
||||
|
||||
int inner_x;
|
||||
int inner_y;
|
||||
};
|
||||
|
||||
// Torna el primer actor de la llista
|
||||
@@ -123,6 +126,10 @@ namespace actor
|
||||
|
||||
void remove(actor_t *act);
|
||||
|
||||
void pick(actor_t *act);
|
||||
|
||||
actor_t *getPicked();
|
||||
|
||||
void clear();
|
||||
|
||||
namespace templates
|
||||
|
||||
@@ -26,6 +26,8 @@ int room_walldoors = 0;
|
||||
|
||||
std::vector<std::string> gifs;
|
||||
|
||||
int treeview_scroll = 0;
|
||||
|
||||
void restart()
|
||||
{
|
||||
room::load(0); //room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color, room_floor, room_walls, room_doors, room_walldoors);
|
||||
@@ -331,9 +333,9 @@ void editor_move_selected()
|
||||
vec3_t max = room::getMax();
|
||||
|
||||
if ( input::keyDown(SDL_SCANCODE_LEFT) && selected->pos.x>min.x ) { selected->pos.x--; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_RIGHT) && selected->pos.x<max.x ) { selected->pos.x++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_RIGHT) && (selected->pos.x+selected->size.x)<max.x ) { selected->pos.x++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_UP) && selected->pos.y>min.y ) { selected->pos.y--; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_DOWN) && selected->pos.y<max.y ) { selected->pos.y++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_DOWN) && (selected->pos.y+selected->size.y)<max.y ) { selected->pos.y++; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_PAGEDOWN) && selected->pos.z>min.z ) { selected->pos.z--; actor::setDirty(selected); room::editor::modify(); }
|
||||
if ( input::keyDown(SDL_SCANCODE_PAGEUP) /*&& selected->pos.z<max.z*/ ) { selected->pos.z++; actor::setDirty(selected); room::editor::modify(); }
|
||||
}
|
||||
@@ -354,17 +356,19 @@ bool game::loop()
|
||||
actor::update(actor::getFirst());
|
||||
}
|
||||
|
||||
actor::reorder();
|
||||
editor_select_by_keyboard();
|
||||
|
||||
draw::resetViewport();
|
||||
draw::cls(2);
|
||||
|
||||
draw::setViewport(100,0,320,240);
|
||||
|
||||
actor::reorder();
|
||||
editor_select_by_keyboard();
|
||||
|
||||
room::draw();
|
||||
actor::draw(actor::getFirst());
|
||||
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);
|
||||
|
||||
/*
|
||||
@@ -422,13 +426,25 @@ bool game::loop()
|
||||
draw::color(PAPER);
|
||||
draw::rect(2, 15, 96, 223);
|
||||
|
||||
draw::setViewport(0, 15, 100, 225);
|
||||
draw::setViewport(0, 15, 100, 222);
|
||||
|
||||
const int mx = draw::getLocalX(input::mouseX());
|
||||
const int my = draw::getLocalY(input::mouseY());
|
||||
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
||||
|
||||
if (mx>=0 && mx <=100 && my>=0 && my<=221)
|
||||
{
|
||||
treeview_scroll -= input::mouseWheel();
|
||||
if (treeview_scroll<0) treeview_scroll=0;
|
||||
}
|
||||
|
||||
int line = 0;
|
||||
switch (section)
|
||||
{
|
||||
case SECTION_GENERAL: treeview_scroll = 0; break;
|
||||
case SECTION_ROOM: if (treeview_scroll > room::editor::getCurrentRoom()+1) treeview_scroll = room::editor::getCurrentRoom()+1;
|
||||
}
|
||||
|
||||
int line = -treeview_scroll;
|
||||
if (section==SECTION_GENERAL)
|
||||
{
|
||||
draw::color(LIGHT+BLUE);
|
||||
@@ -461,7 +477,8 @@ bool game::loop()
|
||||
{
|
||||
act = actor::getFirst();
|
||||
while (act) {
|
||||
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR && (act->flags&FLAG_HERO)!=FLAG_HERO) {
|
||||
// [WORKING HERE]
|
||||
//if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR && (act->flags&FLAG_HERO)!=FLAG_HERO) {
|
||||
if (section==SECTION_ACTOR && act==actor::getSelected()) {
|
||||
draw::color(LIGHT+BLUE);
|
||||
draw::fillrect(4, 2+line*9, 92, 9);
|
||||
@@ -472,7 +489,7 @@ bool game::loop()
|
||||
}
|
||||
draw::print(act->name, 14, 4+line*9, LIGHT+WHITE, BLACK);
|
||||
line++;
|
||||
}
|
||||
//}
|
||||
act = act->next;
|
||||
}
|
||||
|
||||
@@ -480,6 +497,14 @@ bool game::loop()
|
||||
}
|
||||
}
|
||||
|
||||
if ((line+treeview_scroll)>24)
|
||||
{
|
||||
const float total_size = float(line+treeview_scroll);
|
||||
int ascensor_length = 222.0f/(total_size/24.0f);
|
||||
int ascensor_pos = 222.0f/(total_size/treeview_scroll);
|
||||
draw::color(WHITE);
|
||||
draw::fillrect(95, ascensor_pos, 2, ascensor_length);
|
||||
}
|
||||
/*
|
||||
break;
|
||||
case 1:
|
||||
@@ -491,6 +516,7 @@ bool game::loop()
|
||||
if (ui::button("EDITING", 2, 2, 96, 11, editor::isEditing()))
|
||||
{
|
||||
room::load(room::editor::getCurrentRoom());
|
||||
if (!editor::isEditing()) actor::find("HERO")->pos.z=24;
|
||||
editor::setEditing(!editor::isEditing());
|
||||
}
|
||||
|
||||
@@ -543,16 +569,16 @@ switch (section)
|
||||
//changed |= btn_small(64, line, room::editor::refColor(), 5, 11);
|
||||
line += 10;
|
||||
ui::label("FLOOR", 2, line, 48, 11);
|
||||
changed |= btn_small(48, line, room::editor::refFloorTex(), 0, 5, 50);
|
||||
changed |= btn_small(48, line, room::editor::refFloorTex(), 0, room::getFloorCount()-1, 50);
|
||||
line += 10;
|
||||
ui::label("WALL", 2, line, 48, 11);
|
||||
changed |= btn_small(48, line, room::editor::refWallTex(), 0, 5, 50);
|
||||
changed |= btn_small(48, line, room::editor::refWallTex(), 0, room::getWallsCount()-1, 50);
|
||||
line += 10;
|
||||
ui::label("DOOR", 2, line, 48, 11);
|
||||
changed |= btn_small(48, line, room::editor::refDoorTex(), 0, 4, 50);
|
||||
changed |= btn_small(48, line, room::editor::refDoorTex(), 0, room::getDoorCount()-1, 50);
|
||||
line += 10;
|
||||
ui::label("UNDER DOOR", 2, line, 48, 11);
|
||||
changed |= btn_small(48, line, room::editor::refWallDoorTex(), 0, 5, 50);
|
||||
changed |= btn_small(48, line, room::editor::refWallDoorTex(), 0, room::getWallsCount()-1, 50);
|
||||
line += 10;
|
||||
|
||||
ui::label("EXITS", 2, line, 96, 11, GRAY); line+=10;
|
||||
|
||||
103
source/room.cpp
103
source/room.cpp
@@ -16,7 +16,7 @@ namespace room
|
||||
static vec3_t tmin = {0,0,0}; // primer tile en cada coordenada
|
||||
static vec3_t tmax = {7,7,7}; // ultim tile en cada coordenada
|
||||
static vec3_t min = {0,0,0}; // primer "pixel isometric" en cada coordenada
|
||||
static vec3_t max = {56,56,56}; // ultim "pixel isometric" en cada coordenada
|
||||
static vec3_t max = {64,64,64}; // ultim "pixel isometric" en cada coordenada
|
||||
|
||||
static int doors = NO_DOOR; // Portes obertes
|
||||
static int door_height[4]; // Altura de cada porta
|
||||
@@ -61,7 +61,7 @@ namespace room
|
||||
tmin = {3-inner_w,3-inner_h,0};
|
||||
tmax = {4+inner_w,4+inner_h,3};
|
||||
min = {tmin.x*8,tmin.y*8,0};
|
||||
max = {tmax.x*8,tmax.y*8,24};
|
||||
max = {(tmax.x+1)*8,(tmax.y+1)*8,32};
|
||||
doors = (door_height[XP]>=0?DOOR_XP:0) | (door_height[XN]>=0?DOOR_XN:0) | (door_height[YP]>=0?DOOR_YP:0) | (door_height[YN]>=0?DOOR_YN:0);
|
||||
//door_height[0] = inner_xp; //XP
|
||||
//door_height[1] = inner_xn; //XN
|
||||
@@ -206,26 +206,42 @@ namespace room
|
||||
draw::pushSource();
|
||||
draw::swapcol(1, color);
|
||||
|
||||
const int floor_row_tiles = int(floor_surf->w/32);
|
||||
const int floor_x = (floor_type%floor_row_tiles)*32;
|
||||
const int floor_y = int(floor_type/floor_row_tiles)*16;
|
||||
|
||||
const int walls_row_tiles = int(walls_surf->w/16);
|
||||
const int walls_x = (walls_type%walls_row_tiles)*16;
|
||||
const int walls_y = int(walls_type/walls_row_tiles)*48;
|
||||
|
||||
const int doors_row_tiles = int(doors_surf->w/40);
|
||||
const int doors_x = (doors_type%doors_row_tiles)*40;
|
||||
const int doors_y = int(doors_type/doors_row_tiles)*59;
|
||||
|
||||
const int walldoors_row_tiles = int(walls_surf->w/16);
|
||||
const int walldoors_x = (walldoors_type%walldoors_row_tiles)*16;
|
||||
const int walldoors_y = int(walldoors_type/walldoors_row_tiles)*48;
|
||||
|
||||
// RUTINES DE PINTAT DE LA PORTA DE DALT A LA DRETA
|
||||
if (doors & DOOR_YN)
|
||||
{
|
||||
// Si la porta està elevada, pintar la part frontal de baix de la porta
|
||||
if (door_height[3] > 0) {
|
||||
draw::setSource(walls_surf);
|
||||
draw::draw( 164+3*16-tmin.y*16, (36+3*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walldoors_type*16, (5-door_height[3])*8);
|
||||
draw::draw( 164+4*16-tmin.y*16, (36+4*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walldoors_type*16, (5-door_height[3])*8);
|
||||
draw::draw( 164+3*16-tmin.y*16, (36+3*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walldoors_x, walldoors_y+(5-door_height[3])*8);
|
||||
draw::draw( 164+4*16-tmin.y*16, (36+4*8+tmin.y*8) + (5-door_height[3])*8, 16, 48-(5-door_height[3])*8, walldoors_x, walldoors_y+(5-door_height[3])*8);
|
||||
}
|
||||
|
||||
// Pintem els dos tiles baix de la porta
|
||||
draw::setSource(walls_surf);
|
||||
draw::draw(164+4*16-(tmin.y-1)*16, -door_height[3]*8+84+4*8+(tmin.y-1)*8, 16, 15, walls_type*16, 33, DRAW_FLIP_HORIZONTAL); // Vora
|
||||
draw::draw(164+4*16-(tmin.y-1)*16, -door_height[3]*8+84+4*8+(tmin.y-1)*8, 16, 15, walls_x, walls_y+33, DRAW_FLIP_HORIZONTAL); // Vora
|
||||
draw::setSource(floor_surf);
|
||||
draw::draw(148+3*16-(tmin.y-1)*16, -door_height[3]*8+76+3*8+(tmin.y-1)*8, 32, 15, floor_type*32, 1); // Tile de Piso
|
||||
draw::draw(148+4*16-(tmin.y-1)*16, -door_height[3]*8+76+4*8+(tmin.y-1)*8, 32, 15, floor_type*32, 1); // Tile de Piso
|
||||
draw::draw(148+3*16-(tmin.y-1)*16, -door_height[3]*8+76+3*8+(tmin.y-1)*8, 32, 15, floor_x, floor_y+1); // Tile de Piso
|
||||
draw::draw(148+4*16-(tmin.y-1)*16, -door_height[3]*8+76+4*8+(tmin.y-1)*8, 32, 15, floor_x, floor_y+1); // Tile de Piso
|
||||
|
||||
// Pintem la porta
|
||||
draw::setSource(doors_surf);
|
||||
draw::draw(164+3*16-tmin.y*16, -door_height[3]*8+32+3*8+tmin.y*8,40,59,doors_type*40,0);
|
||||
draw::draw(164+3*16-tmin.y*16, -door_height[3]*8+32+3*8+tmin.y*8,40,59,doors_x,doors_y);
|
||||
}
|
||||
|
||||
// RUTINES DE PINTAT DE LA PORTA DE DALT A LA ESQUERRA
|
||||
@@ -234,40 +250,40 @@ namespace room
|
||||
// Si la porta està elevada, pintar la part frontal de baix de la porta
|
||||
if (door_height[1] > 0) {
|
||||
draw::setSource(walls_surf);
|
||||
draw::draw(148+tmin.x*16-3*16, (36+tmin.x*8+3*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walldoors_type*16, (5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(148+tmin.x*16-4*16, (36+tmin.x*8+4*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walldoors_type*16, (5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(148+tmin.x*16-3*16, (36+tmin.x*8+3*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walldoors_x, walldoors_y+(5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(148+tmin.x*16-4*16, (36+tmin.x*8+4*8)+(5-door_height[1])*8, 16, 48-(5-door_height[1])*8, walldoors_x, walldoors_y+(5-door_height[1])*8, DRAW_FLIP_HORIZONTAL);
|
||||
}
|
||||
|
||||
// Pintem els dos tiles baix de la porta
|
||||
draw::setSource(walls_surf);
|
||||
draw::draw(164+(tmin.x-1)*16-5*16, -door_height[1]*8+84+(tmin.x-1)*8+4*8, 16, 15, walls_type*16, 33); // Vora
|
||||
draw::draw(164+(tmin.x-1)*16-5*16, -door_height[1]*8+84+(tmin.x-1)*8+4*8, 16, 15, walls_x, walls_y+33); // Vora
|
||||
draw::setSource(floor_surf);
|
||||
draw::draw(148+(tmin.x-1)*16-3*16, -door_height[1]*8+76+(tmin.x-1)*8+3*8,32,15,floor_type*32,1);
|
||||
draw::draw(148+(tmin.x-1)*16-4*16, -door_height[1]*8+76+(tmin.x-1)*8+4*8,32,15,floor_type*32,1);
|
||||
draw::draw(148+(tmin.x-1)*16-3*16, -door_height[1]*8+76+(tmin.x-1)*8+3*8,32,15,floor_x, floor_y+1);
|
||||
draw::draw(148+(tmin.x-1)*16-4*16, -door_height[1]*8+76+(tmin.x-1)*8+4*8,32,15,floor_x, floor_y+1);
|
||||
|
||||
// Pintem la porta
|
||||
draw::setSource(doors_surf);
|
||||
draw::draw(164+(tmin.x-1)*16-4*16-8, -door_height[1]*8+32+3*8+9+(tmin.x-1)*8, 40,59, doors_type*40,0, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(164+(tmin.x-1)*16-4*16-8, -door_height[1]*8+32+3*8+9+(tmin.x-1)*8, 40,59, doors_x,doors_y, DRAW_FLIP_HORIZONTAL);
|
||||
}
|
||||
|
||||
draw::setSource(walls_surf);
|
||||
for (int x=tmin.x;x<=tmax.x;++x)
|
||||
{
|
||||
// Si hi ha porta en YP i està a altura 0, no pintem la vorera en eixos dos tiles
|
||||
if (exits[ZN]==-1) if ( !(doors & DOOR_YP) || (door_height[2] != 0) || (x!=3 && x!=4) ) draw::draw(148+x*16-tmax.y*16,84+x*8+tmax.y*8,16,15,walls_type*16, 33);
|
||||
if (exits[ZN]==-1) if ( !(doors & DOOR_YP) || (door_height[2] != 0) || (x!=3 && x!=4) ) draw::draw(148+x*16-tmax.y*16,84+x*8+tmax.y*8,16,15,walls_x, walls_y+33);
|
||||
|
||||
// Si hi ha porta en YN, no pintem la pared en eixos dos tiles
|
||||
if ( !(doors & DOOR_YN) || (x!=3 && x!=4) ) draw::draw(164+x*16-tmin.y*16,36+x*8+tmin.y*8,16,48,walls_type*16, 0);
|
||||
if ( !(doors & DOOR_YN) || (x!=3 && x!=4) ) draw::draw(164+x*16-tmin.y*16,36+x*8+tmin.y*8,16,48,walls_x, walls_y);
|
||||
}
|
||||
|
||||
for (int y=tmin.y;y<=tmax.y;++y)
|
||||
{
|
||||
draw::setSource(walls_surf);
|
||||
// Si hi ha porta en XP i està a altura 0, no pintem la vorera en eixos dos tiles
|
||||
if (exits[ZN]==-1) if ( !(doors & DOOR_XP) || (door_height[0] != 0) || (y!=3 && y!=4) ) draw::draw(164+tmax.x*16-y*16,84+tmax.x*8+y*8,16,15,walls_type*16, 33, DRAW_FLIP_HORIZONTAL);
|
||||
if (exits[ZN]==-1) if ( !(doors & DOOR_XP) || (door_height[0] != 0) || (y!=3 && y!=4) ) draw::draw(164+tmax.x*16-y*16,84+tmax.x*8+y*8,16,15,walls_x, walls_y+33, DRAW_FLIP_HORIZONTAL);
|
||||
|
||||
// Si hi ha porta en XN, no pintem la pared en eixos dos tiles
|
||||
if ( !(doors & DOOR_XN) || (y!=3 && y!=4) ) draw::draw(148+tmin.x*16-y*16,36+tmin.x*8+y*8,16,48,walls_type*16,0, DRAW_FLIP_HORIZONTAL);
|
||||
if ( !(doors & DOOR_XN) || (y!=3 && y!=4) ) draw::draw(148+tmin.x*16-y*16,36+tmin.x*8+y*8,16,48,walls_x, walls_y, DRAW_FLIP_HORIZONTAL);
|
||||
|
||||
// Pintem tots els tiles del piso
|
||||
if (exits[ZN]==-1)
|
||||
@@ -275,7 +291,7 @@ namespace room
|
||||
draw::setSource(floor_surf);
|
||||
for (int x=tmin.x;x<=tmax.x;++x)
|
||||
{
|
||||
draw::draw(148+x*16-y*16,76+x*8+y*8,32,15,floor_type*32,1);
|
||||
draw::draw(148+x*16-y*16,76+x*8+y*8,32,15,floor_x, floor_y+1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -287,13 +303,21 @@ namespace room
|
||||
draw::pushSource();
|
||||
draw::swapcol(1, color);
|
||||
|
||||
const int doors_row_tiles = int(doors_surf->w/40);
|
||||
const int doors_x = (doors_type%doors_row_tiles)*40;
|
||||
const int doors_y = int(doors_type/doors_row_tiles)*59;
|
||||
|
||||
const int walldoors_row_tiles = int(walls_surf->w/16);
|
||||
const int walldoors_x = (walldoors_type%walldoors_row_tiles)*16;
|
||||
const int walldoors_y = int(walldoors_type/walldoors_row_tiles)*48;
|
||||
|
||||
if (doors & DOOR_YP)
|
||||
{
|
||||
// Pintem les voreres dels dos tiles extra per a la porta YP
|
||||
draw::setSource(walls_surf);
|
||||
draw::draw(164+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_type*16, 1, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(148+3*16-(tmax.y+1)*16, -door_height[2]*8+84+3*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_type*16, 1);
|
||||
draw::draw(148+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_type*16, 1);
|
||||
draw::draw(164+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_x, walldoors_y+1, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(148+3*16-(tmax.y+1)*16, -door_height[2]*8+84+3*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_x, walldoors_y+1);
|
||||
draw::draw(148+4*16-(tmax.y+1)*16, -door_height[2]*8+84+4*8+(tmax.y+1)*8, 16, 15+door_height[2]*8, walldoors_x, walldoors_y+1);
|
||||
|
||||
draw::setSource(aux_surf);
|
||||
draw::draw(164+4*16-(tmax.y+1)*16, 91+4*8+(tmax.y+1)*8, 16, 8, 16, 0);
|
||||
@@ -302,15 +326,15 @@ namespace room
|
||||
|
||||
// Pintem la porta YP
|
||||
draw::setSource(doors_surf);
|
||||
draw::draw(164+3*16-8-(tmax.y+1)*16, -door_height[2]*8+32+3*8+4+(tmax.y+1)*8,40,59,doors_type*40,0);
|
||||
draw::draw(164+3*16-8-(tmax.y+1)*16, -door_height[2]*8+32+3*8+4+(tmax.y+1)*8,40,59,doors_x,doors_y);
|
||||
}
|
||||
if (doors & DOOR_XP)
|
||||
{
|
||||
// Pintem les voreres dels dos tiles extra per a la porta XP
|
||||
draw::setSource(walls_surf);
|
||||
draw::draw(148+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walldoors_type*16, 1);
|
||||
draw::draw(164+(tmax.x+1)*16-3*16, -door_height[0]*8+84+(tmax.x+1)*8+3*8,16,15+door_height[0]*8,walldoors_type*16, 1, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(164+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walldoors_type*16, 1, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(148+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walldoors_x, walldoors_y+1);
|
||||
draw::draw(164+(tmax.x+1)*16-3*16, -door_height[0]*8+84+(tmax.x+1)*8+3*8,16,15+door_height[0]*8,walldoors_x, walldoors_y+1, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw(164+(tmax.x+1)*16-4*16, -door_height[0]*8+84+(tmax.x+1)*8+4*8,16,15+door_height[0]*8,walldoors_x, walldoors_y+1, DRAW_FLIP_HORIZONTAL);
|
||||
|
||||
draw::setSource(aux_surf);
|
||||
draw::draw(148+(tmax.x+1)*16-4*16, 91+(tmax.x+1)*8+4*8,16,8,0,0);
|
||||
@@ -319,7 +343,7 @@ namespace room
|
||||
|
||||
// Pintem la porta XP
|
||||
draw::setSource(doors_surf);
|
||||
draw::draw( 164+(tmax.x+1)*16-4*16-16, -door_height[0]*8+32+3*8+4+(tmax.x+1)*8, 40,59, doors_type*40,0, DRAW_FLIP_HORIZONTAL);
|
||||
draw::draw( 164+(tmax.x+1)*16-4*16-16, -door_height[0]*8+32+3*8+4+(tmax.x+1)*8, 40,59, doors_x,doors_y, DRAW_FLIP_HORIZONTAL);
|
||||
}
|
||||
draw::popSource();
|
||||
}
|
||||
@@ -339,26 +363,43 @@ namespace room
|
||||
return max;
|
||||
}
|
||||
|
||||
uint8_t getDoors()
|
||||
int getDoors()
|
||||
{
|
||||
return doors;
|
||||
}
|
||||
|
||||
uint8_t getDoor(const int d)
|
||||
int getDoor(const int d)
|
||||
{
|
||||
return door_height[d];
|
||||
}
|
||||
|
||||
uint8_t getExit(const int d)
|
||||
int getExit(const int d)
|
||||
{
|
||||
return exits[d];
|
||||
}
|
||||
|
||||
uint8_t getColor()
|
||||
int getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
int getFloorCount()
|
||||
{
|
||||
return int(floor_surf->w / 32) * int(floor_surf->h / 16);
|
||||
}
|
||||
|
||||
int getDoorCount()
|
||||
{
|
||||
return int(doors_surf->w / 40) * int(doors_surf->h / 59);
|
||||
}
|
||||
|
||||
int getWallsCount()
|
||||
{
|
||||
int num = int(walls_surf->w / 16) * int(walls_surf->h / 48);
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
namespace editor
|
||||
{
|
||||
static bool room_exists[256];
|
||||
|
||||
@@ -27,10 +27,14 @@ namespace room
|
||||
vec3_t getSize();
|
||||
vec3_t getMin();
|
||||
vec3_t getMax();
|
||||
uint8_t getDoors();
|
||||
uint8_t getDoor(const int d);
|
||||
uint8_t getExit(const int d);
|
||||
uint8_t getColor();
|
||||
int getDoors();
|
||||
int getDoor(const int d);
|
||||
int getExit(const int d);
|
||||
int getColor();
|
||||
|
||||
int getFloorCount();
|
||||
int getDoorCount();
|
||||
int getWallsCount();
|
||||
|
||||
namespace editor
|
||||
{
|
||||
|
||||
24
todo.txt
24
todo.txt
@@ -1,22 +1,28 @@
|
||||
- Gràfics per a la roomba
|
||||
- Més gràfics de caixes
|
||||
- Gràfics de piso, per a quan no hi ha piso
|
||||
x Gràfics per a la roomba
|
||||
- Fer la roomba mes xicoteta
|
||||
x Més gràfics de caixes
|
||||
x Gràfics de piso, per a quan no hi ha piso
|
||||
- Gràfics de barril, en foc
|
||||
- Gràfics de yonki
|
||||
- Gràfics de tele
|
||||
- Gràfics de armari
|
||||
- Gràfics de taula
|
||||
x Gràfics de tele
|
||||
x Gràfics de armari
|
||||
x Gràfics de taula
|
||||
- Grafics de cadires
|
||||
- Gràfics de conveyor belt
|
||||
- Gràfics de consoles i comps
|
||||
x Gràfics de consoles i comps
|
||||
- Gràfics de nevera
|
||||
- Gràfics de bancada de cuina
|
||||
- Gràfics de sofà?
|
||||
- Gràfics de Plantes, arbres...
|
||||
|
||||
- Decidir objectes de habilitats
|
||||
- Motxilla, espardenyes...
|
||||
- Va a haber boosters? (mes rapid, immune, bot mes llarg...) Decidir
|
||||
- Decidir parts de escavadora
|
||||
|
||||
- Implementar eixides per dalt i per baix
|
||||
- Implementar pickar objectes
|
||||
- Implementar eixides per dalt
|
||||
x Implementar eixides per baix
|
||||
x Implementar pickar objectes
|
||||
- Implementar inventari
|
||||
|
||||
- Menus
|
||||
|
||||
Reference in New Issue
Block a user