- Dev Mode i Game Mode
This commit is contained in:
@@ -2,9 +2,20 @@
|
|||||||
|
|
||||||
namespace editor
|
namespace editor
|
||||||
{
|
{
|
||||||
static bool editing = true;
|
static bool devMode = false;
|
||||||
|
static bool editing = false;
|
||||||
static int current_template = 0;
|
static int current_template = 0;
|
||||||
|
|
||||||
|
void setDevMode()
|
||||||
|
{
|
||||||
|
devMode = editing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool isDevMode()
|
||||||
|
{
|
||||||
|
return devMode;
|
||||||
|
}
|
||||||
|
|
||||||
void setEditing(const bool value)
|
void setEditing(const bool value)
|
||||||
{
|
{
|
||||||
editing = value;
|
editing = value;
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
|
|
||||||
namespace editor
|
namespace editor
|
||||||
{
|
{
|
||||||
|
void setDevMode();
|
||||||
|
const bool isDevMode();
|
||||||
|
|
||||||
void setEditing(const bool value);
|
void setEditing(const bool value);
|
||||||
const bool isEditing();
|
const bool isEditing();
|
||||||
|
|
||||||
|
|||||||
@@ -5,16 +5,28 @@
|
|||||||
|
|
||||||
namespace game
|
namespace game
|
||||||
{
|
{
|
||||||
|
static int param_count = 0;
|
||||||
|
static char **params = nullptr;
|
||||||
|
|
||||||
static unsigned int ticks_per_frame = 1000/60;
|
static unsigned int ticks_per_frame = 1000/60;
|
||||||
|
|
||||||
void setUpdateTicks(const int ticks)
|
void setUpdateTicks(const int ticks)
|
||||||
{
|
{
|
||||||
ticks_per_frame = ticks;
|
ticks_per_frame = ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* getParams(const int index)
|
||||||
|
{
|
||||||
|
if (index<param_count) return params[index];
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
game::param_count = argc;
|
||||||
|
game::params = argv;
|
||||||
|
|
||||||
game::init();
|
game::init();
|
||||||
input::init(draw::getZoom());
|
input::init(draw::getZoom());
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ namespace game
|
|||||||
|
|
||||||
bool loop();
|
bool loop();
|
||||||
|
|
||||||
|
const char* getParams(const int index);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ int treeview_scroll = 0;
|
|||||||
void restart()
|
void restart()
|
||||||
{
|
{
|
||||||
actor::hero::init();
|
actor::hero::init();
|
||||||
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);
|
room::load(1); //room_w, room_h, room_xp, room_xn, room_yp, room_yn, room_color, room_floor, room_walls, room_doors, room_walldoors);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -52,7 +52,12 @@ void restart()
|
|||||||
|
|
||||||
void game::init()
|
void game::init()
|
||||||
{
|
{
|
||||||
|
if (game::getParams(1) && strcmp(game::getParams(1), "editor")==0) editor::setDevMode();
|
||||||
|
|
||||||
|
if (editor::isDevMode())
|
||||||
draw::init("The Pool", 520, 240, 3);
|
draw::init("The Pool", 520, 240, 3);
|
||||||
|
else
|
||||||
|
draw::init("The Pool", 320, 240, 3);
|
||||||
|
|
||||||
//room::init();
|
//room::init();
|
||||||
surf = draw::getSurface("test.gif");
|
surf = draw::getSurface("test.gif");
|
||||||
@@ -362,10 +367,10 @@ bool game::loop()
|
|||||||
draw::resetViewport();
|
draw::resetViewport();
|
||||||
draw::cls(2);
|
draw::cls(2);
|
||||||
|
|
||||||
draw::setViewport(100,0,320,240);
|
if (editor::isDevMode()) draw::setViewport(100,0,320,240);
|
||||||
|
|
||||||
actor::reorder();
|
actor::reorder();
|
||||||
editor_select_by_keyboard();
|
if (editor::isEditing()) editor_select_by_keyboard();
|
||||||
|
|
||||||
room::draw();
|
room::draw();
|
||||||
actor::draw(actor::getFirst());
|
actor::draw(actor::getFirst());
|
||||||
@@ -400,32 +405,23 @@ bool game::loop()
|
|||||||
print(0,40,input::mouseBtn(2)?1:0);
|
print(0,40,input::mouseBtn(2)?1:0);
|
||||||
print(0,50,input::mouseBtn(3)?1:0);
|
print(0,50,input::mouseBtn(3)?1:0);
|
||||||
*/
|
*/
|
||||||
|
if (!editor::isDevMode())
|
||||||
/*
|
{
|
||||||
if (section==0) {
|
draw::render();
|
||||||
draw::print("ROOM", 334, 13, YELLOW, LIGHT+BLACK);
|
return true;
|
||||||
if (ui::button("ACTORS", 365, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=1;
|
|
||||||
} else {
|
|
||||||
if (ui::button("ROOM", 330, 10, 30, 11, TEAL, LIGHT+TEAL, LIGHT+PURPLE)) section=0;
|
|
||||||
draw::print("ACTORS", 369, 13, YELLOW, BLACK);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
actor::actor_t *act = nullptr;
|
actor::actor_t *act = nullptr;
|
||||||
|
|
||||||
/*
|
|
||||||
switch (section) {
|
|
||||||
case 0:
|
|
||||||
*/
|
|
||||||
draw::setViewport(0,0,100,240);
|
draw::setViewport(0,0,100,240);
|
||||||
draw::color(WHITE);
|
draw::color(WHITE);
|
||||||
draw::fillrect(0, 0, 100, 240);
|
draw::fillrect(0, 0, 100, 240);
|
||||||
|
|
||||||
//if (ui::button("+ACTOR", 2, 2, 28, 11))
|
|
||||||
//{
|
|
||||||
//room::load(room::editor::getCurrentRoom());
|
|
||||||
//editor::setEditing(!editor::isEditing());
|
|
||||||
//}
|
|
||||||
int result = ui::combo(actor::templates::get(editor::getCurrentTemplate())->name, 2, 2, 76, 11);
|
int result = ui::combo(actor::templates::get(editor::getCurrentTemplate())->name, 2, 2, 76, 11);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
@@ -526,10 +522,13 @@ bool game::loop()
|
|||||||
draw::color(WHITE);
|
draw::color(WHITE);
|
||||||
draw::fillrect(95, ascensor_pos, 2, ascensor_length);
|
draw::fillrect(95, ascensor_pos, 2, ascensor_length);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
draw::setViewport(420, 0, 100, 240);
|
draw::setViewport(420, 0, 100, 240);
|
||||||
draw::color(WHITE);
|
draw::color(WHITE);
|
||||||
draw::fillrect(0, 0, 100, 240);
|
draw::fillrect(0, 0, 100, 240);
|
||||||
@@ -541,15 +540,13 @@ bool game::loop()
|
|||||||
editor::setEditing(!editor::isEditing());
|
editor::setEditing(!editor::isEditing());
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw::color(PAPER); // el borde del propertyview es pinta al final de tot
|
|
||||||
//draw::rect(2, 22, 96, 216);
|
|
||||||
draw::setViewport(420, 15, 100, 225);
|
draw::setViewport(420, 15, 100, 225);
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
|
|
||||||
switch (section)
|
switch (section)
|
||||||
{
|
{
|
||||||
case SECTION_GENERAL:
|
case SECTION_GENERAL:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -774,44 +771,8 @@ switch (section)
|
|||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* case 2:
|
|
||||||
draw::setViewport(320, 38, 100, 100);
|
|
||||||
draw::color(LIGHT+WHITE);
|
|
||||||
draw::fillrect(2, 0, 96, 100);
|
|
||||||
draw::color(PAPER);
|
|
||||||
draw::rect(2, 0, 96, 100);
|
|
||||||
|
|
||||||
const int mx = draw::getLocalX(input::mouseX());
|
|
||||||
const int my = draw::getLocalY(input::mouseY());
|
|
||||||
const bool btnDown = input::mouseBtn(1) || input::mouseBtn(3);
|
|
||||||
|
|
||||||
int line = 0;
|
|
||||||
act = actor::getFirst();
|
|
||||||
while (act) {
|
|
||||||
if ((act->flags&FLAG_NOEDITOR)!=FLAG_NOEDITOR) {
|
|
||||||
if (act==actor::getSelected()) {
|
|
||||||
draw::color(LIGHT+BLUE);
|
|
||||||
draw::fillrect(4, 2+line*9, 92, 9);
|
|
||||||
}
|
|
||||||
if ((mx>=2) && (mx<98) && (my>=2+line*9) && (my<2+9+line*9) && btnDown) {
|
|
||||||
actor::select(act);
|
|
||||||
//section=1;
|
|
||||||
}
|
|
||||||
draw::print(act->name, 6, 4+line*9, LIGHT+WHITE, BLACK);
|
|
||||||
line++;
|
|
||||||
}
|
|
||||||
act = act->next;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
draw::render();
|
draw::render();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace room
|
namespace room
|
||||||
{
|
{
|
||||||
static int current_room = 0;
|
static int current_room = 1;
|
||||||
|
|
||||||
static int inner_w = 2;
|
static int inner_w = 2;
|
||||||
static int inner_h = 2;
|
static int inner_h = 2;
|
||||||
|
|||||||
2
todo.txt
2
todo.txt
@@ -44,7 +44,7 @@ x Gràfics de bancada de cuina
|
|||||||
x Implementar eixides per dalt
|
x Implementar eixides per dalt
|
||||||
x Implementar eixides per baix
|
x Implementar eixides per baix
|
||||||
x Implementar pickar objectes
|
x Implementar pickar objectes
|
||||||
- Implementar inventari
|
x Implementar inventari
|
||||||
|
|
||||||
- Menus
|
- Menus
|
||||||
- Molt bàsics, com els del Batman de Spectrum
|
- Molt bàsics, com els del Batman de Spectrum
|
||||||
|
|||||||
Reference in New Issue
Block a user