- Portes almost completades
This commit is contained in:
BIN
data/test.gif
BIN
data/test.gif
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.6 KiB |
@@ -182,7 +182,7 @@ namespace actor
|
|||||||
if ( input::keyDown(SDL_SCANCODE_UP) )
|
if ( input::keyDown(SDL_SCANCODE_UP) )
|
||||||
{
|
{
|
||||||
act->orient=PUSH_YN;
|
act->orient=PUSH_YN;
|
||||||
if ( (act->pos.y>min.y && act->pos.x>=min.y && 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<=max.x) || ( (room::getDoors()&DOOR_YN) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
||||||
{
|
{
|
||||||
act->push |= PUSH_YN;
|
act->push |= PUSH_YN;
|
||||||
moving = true;
|
moving = true;
|
||||||
@@ -191,13 +191,13 @@ namespace actor
|
|||||||
if ( input::keyDown(SDL_SCANCODE_DOWN) )
|
if ( input::keyDown(SDL_SCANCODE_DOWN) )
|
||||||
{
|
{
|
||||||
act->orient=PUSH_YP;
|
act->orient=PUSH_YP;
|
||||||
if ( (act->pos.y<max.y && act->pos.x>=min.y && act->pos.x<=max.x) || ( (room::getDoors()&DOOR_YP) && (act->pos.x>=24) && (act->pos.x<=32) ) )
|
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) ) )
|
||||||
{
|
{
|
||||||
act->push |= PUSH_YP;
|
act->push |= PUSH_YP;
|
||||||
moving = true;
|
moving = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( input::keyDown(SDL_SCANCODE_SPACE) && act->react_mask==0 && (act->pos.z==0 || act->below))
|
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))
|
||||||
{
|
{
|
||||||
act->react_mask=1;
|
act->react_mask=1;
|
||||||
act->react_push=0;
|
act->react_push=0;
|
||||||
@@ -520,9 +520,9 @@ namespace actor
|
|||||||
const int ao = (act->flags & FLAG_ANIMATED) ? anims[act->anim_cycle][anim_frame]*act->bmp_rect.w : 0;
|
const int ao = (act->flags & FLAG_ANIMATED) ? anims[act->anim_cycle][anim_frame]*act->bmp_rect.w : 0;
|
||||||
|
|
||||||
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);
|
||||||
//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);
|
||||||
print(x+5,y,act->pos.z);
|
print(x+5,y+12,act->pos.z);
|
||||||
//print(x+5,y+12,order);
|
//print(x+5,y+12,order);
|
||||||
//print(x+5,y,act->flags);
|
//print(x+5,y,act->flags);
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ void game::init()
|
|||||||
draw::loadPalette("test.gif");
|
draw::loadPalette("test.gif");
|
||||||
game::setUpdateTicks(64);
|
game::setUpdateTicks(64);
|
||||||
|
|
||||||
room::load(2,0);
|
room::load(3,3);
|
||||||
|
|
||||||
box = actor::create({16,16,0}, {8,8,4}, {64,0,32,24}, {0,24});
|
box = actor::create({16,32,0}, {8,8,4}, {64,0,32,24}, {0,24});
|
||||||
box->flags = FLAG_MOVING;
|
box->flags = FLAG_MOVING;
|
||||||
box->movement = MOV_Z;
|
box->movement = MOV_Z;
|
||||||
box->mov_push = PUSH_ZP;
|
box->mov_push = PUSH_ZP;
|
||||||
@@ -30,7 +30,7 @@ void game::init()
|
|||||||
box->mov_push = PUSH_XN;
|
box->mov_push = PUSH_XN;
|
||||||
actor::setDirty(box, true);
|
actor::setDirty(box, true);
|
||||||
|
|
||||||
box = actor::create({16,16,8}, {8,8,12}, {0,32,20,32}, {-6,38});
|
box = actor::create({16,32,8}, {8,8,12}, {0,32,20,32}, {-6,38});
|
||||||
box->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
|
box->flags = FLAG_HERO | FLAG_PUSHABLE | FLAG_GRAVITY | FLAG_ORIENTABLE | FLAG_ANIMATED;
|
||||||
actor::setDirty(box, true);
|
actor::setDirty(box, true);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "jdraw.h"
|
#include "jdraw.h"
|
||||||
|
#include "actor.h"
|
||||||
|
|
||||||
namespace room
|
namespace room
|
||||||
{
|
{
|
||||||
@@ -9,7 +10,7 @@ namespace room
|
|||||||
static vec3_t min = {0,0,0};
|
static vec3_t min = {0,0,0};
|
||||||
static vec3_t max = {56,56,56};
|
static vec3_t max = {56,56,56};
|
||||||
|
|
||||||
static uint8_t doors = DOOR_XN | DOOR_YN ;
|
static uint8_t doors = 15; //OOR_XP /*| DOOR_YP*/ ;
|
||||||
static uint8_t door_height[4];
|
static uint8_t door_height[4];
|
||||||
|
|
||||||
void load(int x, int y)
|
void load(int x, int y)
|
||||||
@@ -23,12 +24,34 @@ namespace room
|
|||||||
door_height[1] = 3; //XN
|
door_height[1] = 3; //XN
|
||||||
door_height[2] = 2; //YP
|
door_height[2] = 2; //YP
|
||||||
door_height[3] = 5; //YN
|
door_height[3] = 5; //YN
|
||||||
|
|
||||||
|
if (doors & DOOR_YP)
|
||||||
|
{
|
||||||
|
actor::actor_t *act = actor::create({24,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, {0,1,32,15}, {0,15+door_height[2]*8});
|
||||||
|
act->flags = FLAG_NONE;
|
||||||
|
actor::setDirty(act, true);
|
||||||
|
act = actor::create({32,(tmax.y+1)*8,0}, {8,8,(door_height[2])*4}, {0,1,32,15}, {0,15+door_height[2]*8});
|
||||||
|
act->flags = FLAG_NONE;
|
||||||
|
actor::setDirty(act, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doors & DOOR_XP)
|
||||||
|
{
|
||||||
|
actor::actor_t *act = actor::create({(tmax.x+1)*8,24,0}, {8,8,(door_height[0])*4}, {0,1,32,15}, {0,15+door_height[0]*8});
|
||||||
|
act->flags = FLAG_NONE;
|
||||||
|
actor::setDirty(act, true);
|
||||||
|
act = actor::create({(tmax.x+1)*8,32,0}, {8,8,(door_height[0])*4}, {0,1,32,15}, {0,15+door_height[0]*8});
|
||||||
|
act->flags = FLAG_NONE;
|
||||||
|
actor::setDirty(act, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw()
|
void draw()
|
||||||
{
|
{
|
||||||
|
// RUTINES DE PINTAT DE LA PORTA DE DALT A LA DRETA
|
||||||
if (doors & DOOR_YN)
|
if (doors & DOOR_YN)
|
||||||
{
|
{
|
||||||
|
// Si la porta està elevada, pintar la part frontal de baix de la porta
|
||||||
if (door_height[3] > 0) {
|
if (door_height[3] > 0) {
|
||||||
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, 128, 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, 128, 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, 128, 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, 128, 16+(5-door_height[3])*8);
|
||||||
@@ -42,8 +65,11 @@ namespace room
|
|||||||
// Pintem la porta
|
// Pintem la porta
|
||||||
draw::draw(164+3*16-tmin.y*16, -door_height[3]*8+32+3*8+tmin.y*8,40,59,18,133);
|
draw::draw(164+3*16-tmin.y*16, -door_height[3]*8+32+3*8+tmin.y*8,40,59,18,133);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RUTINES DE PINTAT DE LA PORTA DE DALT A LA ESQUERRA
|
||||||
if (doors & DOOR_XN)
|
if (doors & DOOR_XN)
|
||||||
{
|
{
|
||||||
|
// Si la porta està elevada, pintar la part frontal de baix de la porta
|
||||||
if (door_height[1] > 0) {
|
if (door_height[1] > 0) {
|
||||||
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, 144, 16+(5-door_height[1])*8);
|
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, 144, 16+(5-door_height[1])*8);
|
||||||
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, 144, 16+(5-door_height[1])*8);
|
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, 144, 16+(5-door_height[1])*8);
|
||||||
@@ -81,41 +107,35 @@ namespace room
|
|||||||
draw::draw(148+x*16-y*16,76+x*8+y*8,32,15,0,1);
|
draw::draw(148+x*16-y*16,76+x*8+y*8,32,15,0,1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doors & DOOR_YP)
|
|
||||||
{
|
|
||||||
// Pintem les voreres dels dos tiles extra per a la porta YP
|
|
||||||
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,144,49-door_height[2]*8);
|
|
||||||
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,128,49-door_height[2]*8);
|
|
||||||
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,128,49-door_height[2]*8);
|
|
||||||
|
|
||||||
// Pintem els dos tiles de piso extra de la porta YP
|
|
||||||
draw::draw(148+3*16-(tmax.y+1)*16, -door_height[2]*8+76+3*8+(tmax.y+1)*8,32,15,0,1);
|
|
||||||
draw::draw(148+4*16-(tmax.y+1)*16, -door_height[2]*8+76+4*8+(tmax.y+1)*8,32,15,0,1);
|
|
||||||
}
|
|
||||||
if (doors & DOOR_XP)
|
|
||||||
{
|
|
||||||
// Pintem les voreres dels dos tiles extra per a la porta XP
|
|
||||||
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,128,49-door_height[0]*8);
|
|
||||||
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,144,49-door_height[0]*8);
|
|
||||||
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,144,49-door_height[0]*8);
|
|
||||||
|
|
||||||
// Pintem els dos tiles de piso extra de la porta XP
|
|
||||||
draw::draw(148+(tmax.x+1)*16-3*16, -door_height[0]*8+76+(tmax.x+1)*8+3*8,32,15,0,1);
|
|
||||||
draw::draw(148+(tmax.x+1)*16-4*16, -door_height[0]*8+76+(tmax.x+1)*8+4*8,32,15,0,1);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw2()
|
void draw2()
|
||||||
{
|
{
|
||||||
if (doors & DOOR_YP)
|
if (doors & DOOR_YP)
|
||||||
{
|
{
|
||||||
|
// Pintem les voreres dels dos tiles extra per a la porta YP
|
||||||
|
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, 144, 17);
|
||||||
|
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, 128, 17);
|
||||||
|
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, 128, 17);
|
||||||
|
|
||||||
|
draw::draw(164+4*16-(tmax.y+1)*16, 91+4*8+(tmax.y+1)*8, 16, 8, 16, 24);
|
||||||
|
draw::draw(148+3*16-(tmax.y+1)*16, 91+3*8+(tmax.y+1)*8, 16, 8, 0, 24);
|
||||||
|
draw::draw(148+4*16-(tmax.y+1)*16, 91+4*8+(tmax.y+1)*8, 16, 8, 0, 24);
|
||||||
|
|
||||||
// Pintem la porta YP
|
// Pintem la porta YP
|
||||||
draw::draw(164+3*16-8-(tmax.y+1)*16, -door_height[2]*8+32+3*8+4+(tmax.y+1)*8,40,59,18,133);
|
draw::draw(164+3*16-8-(tmax.y+1)*16, -door_height[2]*8+32+3*8+4+(tmax.y+1)*8,40,59,18,133);
|
||||||
}
|
}
|
||||||
if (doors & DOOR_XP)
|
if (doors & DOOR_XP)
|
||||||
{
|
{
|
||||||
|
// Pintem les voreres dels dos tiles extra per a la porta XP
|
||||||
|
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,128,17);
|
||||||
|
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,144,17);
|
||||||
|
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,144,17);
|
||||||
|
|
||||||
|
draw::draw(148+(tmax.x+1)*16-4*16, 91+(tmax.x+1)*8+4*8,16,8,0,24);
|
||||||
|
draw::draw(164+(tmax.x+1)*16-3*16, 91+(tmax.x+1)*8+3*8,16,8,16,24);
|
||||||
|
draw::draw(164+(tmax.x+1)*16-4*16, 91+(tmax.x+1)*8+4*8,16,8,16,24);
|
||||||
|
|
||||||
// Pintem la porta XP
|
// Pintem la porta XP
|
||||||
draw::draw( 164+(tmax.x+1)*16-4*16-16, -door_height[0]*8+32+3*8+4+(tmax.x+1)*8, 40,59, 64,133);
|
draw::draw( 164+(tmax.x+1)*16-4*16-16, -door_height[0]*8+32+3*8+4+(tmax.x+1)*8, 40,59, 64,133);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user