- [NEW] Habitació de prova de parts
- [NEW] Templates de les parts - [NEW] Mòdul de debug - [NEW] Debug info de la posicio dels actors - [FIX] Al reiniciar partida el heroi estava en posició incorrecta - [NEW] Mòdul de config - [NEW] El joc ja permet canviar zoom i ficar fullscreen - [NEW] F1, F2 i F3 per a zoom i fullscreen - [NEW] Ja es guarda en arxiu de config el zoom, fullscreen, musica i só. - [FIX] Al eixir prematurament del logo de vegades la paleta estava loca - [NEW] Menú de configuració del àudio - [NEW] Menú de pausa dins del joc (es veu peces que falten per arreplegar) - [ONGOING] Comença l'implementació de tecles redefinides
This commit is contained in:
108
source/m_ingame.cpp
Normal file
108
source/m_ingame.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
#include "m_ingame.h"
|
||||
#include "jgame.h"
|
||||
#include "jinput.h"
|
||||
#include "jdraw.h"
|
||||
#include "actor.h"
|
||||
#include "room.h"
|
||||
#include "config.h"
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
namespace modules
|
||||
{
|
||||
namespace ingame
|
||||
{
|
||||
draw::surface *surf;
|
||||
int selected_option = INGAME_CONTINUAR;
|
||||
actor::actor_t *parts[6] = {nullptr,nullptr,nullptr,nullptr,nullptr,nullptr};
|
||||
|
||||
void init()
|
||||
{
|
||||
selected_option = INGAME_CONTINUAR;
|
||||
|
||||
surf = draw::getSurface("objectes.gif");
|
||||
if (parts[0]==nullptr)
|
||||
{
|
||||
parts[0] = actor::createFromTemplate("P-ELBOW");
|
||||
parts[0]->inner_x=166+16;
|
||||
parts[0]->inner_y=68+8;
|
||||
}
|
||||
if (parts[1]==nullptr)
|
||||
{
|
||||
parts[1] = actor::createFromTemplate("P-PIPE");
|
||||
parts[1]->inner_x=148+16;
|
||||
parts[1]->inner_y=75+8;
|
||||
}
|
||||
if (parts[2]==nullptr)
|
||||
{
|
||||
parts[2] = actor::createFromTemplate("P-SALT");
|
||||
parts[2]->inner_x=123+16;
|
||||
parts[2]->inner_y=84+8;
|
||||
}
|
||||
if (parts[3]==nullptr)
|
||||
{
|
||||
parts[3] = actor::createFromTemplate("P-FILTER");
|
||||
parts[3]->inner_x=144+16;
|
||||
parts[3]->inner_y=45+8;
|
||||
}
|
||||
if (parts[4]==nullptr)
|
||||
{
|
||||
parts[4] = actor::createFromTemplate("P-PUMP");
|
||||
parts[4]->inner_x=121+16;
|
||||
parts[4]->inner_y=54+8;
|
||||
}
|
||||
if (parts[5]==nullptr)
|
||||
{
|
||||
parts[5] = actor::createFromTemplate("P-TIMER");
|
||||
parts[5]->inner_x=96+16;
|
||||
parts[5]->inner_y=69+8;
|
||||
}
|
||||
}
|
||||
|
||||
int loop()
|
||||
{
|
||||
if (input::keyPressed(SDL_SCANCODE_ESCAPE)) {
|
||||
return INGAME_CONTINUAR;
|
||||
}
|
||||
if (input::keyPressed(SDL_SCANCODE_DOWN) || input::keyPressed(config::getKey(KEY_DOWN)))
|
||||
selected_option = (selected_option+1)&1;
|
||||
if (input::keyPressed(SDL_SCANCODE_UP) || input::keyPressed(config::getKey(KEY_UP)))
|
||||
selected_option = (selected_option-1)&1;
|
||||
if (input::keyPressed(SDL_SCANCODE_SPACE) || input::keyPressed(SDL_SCANCODE_RETURN) ||
|
||||
input::keyPressed(config::getKey(KEY_JUMP)) || input::keyPressed(config::getKey(KEY_PICK))) {
|
||||
return selected_option;
|
||||
}
|
||||
|
||||
draw::cls(2);
|
||||
draw::color(1);
|
||||
|
||||
draw::setSource(surf);
|
||||
static int part[6] = { PART_ELBOW, PART_PIPE, PART_SALT, PART_FILTER, PART_PUMP, PART_TIMER};
|
||||
for (int i=0;i<6;++i)
|
||||
{
|
||||
draw::swapcol(1, room::getColor((actor::hero::getParts() & part[i])?1:3));
|
||||
actor::drawAt(parts[i], parts[i]->inner_x, parts[i]->inner_y);
|
||||
}
|
||||
|
||||
|
||||
draw::print2("PAUSA", 17, 3, YELLOW, FONT_ZOOM_VERTICAL);
|
||||
|
||||
switch (selected_option)
|
||||
{
|
||||
case INGAME_CONTINUAR:
|
||||
draw::print2("fg CONTINUAR", 13, 19, YELLOW, FONT_ZOOM_VERTICAL);
|
||||
draw::print2("de EIXIR", 13, 22, TEAL, FONT_ZOOM_NONE);
|
||||
break;
|
||||
case INGAME_EIXIR:
|
||||
draw::print2("de CONTINUAR", 13, 19, TEAL, FONT_ZOOM_NONE);
|
||||
draw::print2("fg EIXIR", 13, 21, YELLOW, FONT_ZOOM_VERTICAL);
|
||||
break;
|
||||
|
||||
};
|
||||
|
||||
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);
|
||||
|
||||
draw::render();
|
||||
return INGAME_NONE;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user