- [NEW] Nova debug info: flags
- [NEW] Só de caminar i botar funcionant - [NEW] Só de enemics rebotant - [NEW] Menus amb só (MOC MOC!) - [FIX] El so de caminar ja no continua durant el menu ingame
This commit is contained in:
@@ -32,7 +32,6 @@ namespace actor
|
|||||||
bool floating_editing = false;
|
bool floating_editing = false;
|
||||||
|
|
||||||
int walk_channel = -1;
|
int walk_channel = -1;
|
||||||
int falling_sound = -1;
|
|
||||||
|
|
||||||
void resetTag()
|
void resetTag()
|
||||||
{
|
{
|
||||||
@@ -858,9 +857,6 @@ namespace actor
|
|||||||
{
|
{
|
||||||
act->react_mask = 0; // desactivem la guarda (react_mask=0)
|
act->react_mask = 0; // desactivem la guarda (react_mask=0)
|
||||||
act->flags |= FLAG_GRAVITY; // i reactivem el flag de gravetat
|
act->flags |= FLAG_GRAVITY; // i reactivem el flag de gravetat
|
||||||
|
|
||||||
if (falling_sound!=-1) { audio::stopChannel(falling_sound); falling_sound = -1; }
|
|
||||||
falling_sound = audio::playSound("snd_fall.wav", SOUND_ALL, -1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -868,7 +864,7 @@ namespace actor
|
|||||||
if (moving)
|
if (moving)
|
||||||
{
|
{
|
||||||
act->flags |= FLAG_ANIMATED;
|
act->flags |= FLAG_ANIMATED;
|
||||||
if (act->react_mask==0 && !(act->flags&FLAG_GRAVITY)) audio::resumeChannel(walk_channel);
|
if (act->react_mask==0 && ( (act->below) || (act->pos.z==0) )) audio::resumeChannel(walk_channel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -886,6 +882,7 @@ namespace actor
|
|||||||
|
|
||||||
void changeMoving(actor_t *act)
|
void changeMoving(actor_t *act)
|
||||||
{
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
switch (act->movement)
|
switch (act->movement)
|
||||||
{
|
{
|
||||||
case MOV_X:
|
case MOV_X:
|
||||||
@@ -1260,8 +1257,6 @@ namespace actor
|
|||||||
// Si estic sobre el piso, no faig res
|
// Si estic sobre el piso, no faig res
|
||||||
if (act->pos.z == 0)
|
if (act->pos.z == 0)
|
||||||
{
|
{
|
||||||
if (act->flags&FLAG_HERO && falling_sound!=-1) { audio::stopChannel(falling_sound); falling_sound = -1; }
|
|
||||||
|
|
||||||
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
|
if ((act->flags & FLAG_MOVING) && (act->movement == MOV_Z))
|
||||||
changeMoving(act);
|
changeMoving(act);
|
||||||
act->push &= ~PUSH_ZN;
|
act->push &= ~PUSH_ZN;
|
||||||
@@ -1302,7 +1297,6 @@ namespace actor
|
|||||||
// Si sí que hi ha...
|
// Si sí que hi ha...
|
||||||
if (below)
|
if (below)
|
||||||
{
|
{
|
||||||
if (act->flags&FLAG_HERO && falling_sound!=-1) { audio::stopChannel(falling_sound); falling_sound = -1; }
|
|
||||||
// ...el asociem...
|
// ...el asociem...
|
||||||
act->below = below;
|
act->below = below;
|
||||||
below->above = act;
|
below->above = act;
|
||||||
@@ -1496,6 +1490,13 @@ namespace actor
|
|||||||
draw::swapcol(1, room::getColor(0)); // Tornem al color per defecte
|
draw::swapcol(1, room::getColor(0)); // Tornem al color per defecte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((act->flags & FLAG_HERO) && debug::isEnabled(DEBUG_ACTOR_FLAGS))
|
||||||
|
{
|
||||||
|
char tmp[100];
|
||||||
|
draw::print(SDL_itoa(act->flags, tmp, 2), 1, 1, LIGHT + WHITE, BLACK);
|
||||||
|
draw::swapcol(1, room::getColor(0)); // Tornem al color per defecte
|
||||||
|
}
|
||||||
|
|
||||||
if (draw_all && act->next)
|
if (draw_all && act->next)
|
||||||
draw(act->next);
|
draw(act->next);
|
||||||
}
|
}
|
||||||
@@ -1671,6 +1672,11 @@ namespace actor
|
|||||||
{
|
{
|
||||||
return floating_editing;
|
return floating_editing;
|
||||||
}
|
}
|
||||||
|
void pauseWalkSound()
|
||||||
|
{
|
||||||
|
audio::pauseChannel(walk_channel);
|
||||||
|
}
|
||||||
|
|
||||||
namespace templates
|
namespace templates
|
||||||
{
|
{
|
||||||
std::vector<actor_t> templates;
|
std::vector<actor_t> templates;
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ namespace actor
|
|||||||
|
|
||||||
const bool getFloatingEditing();
|
const bool getFloatingEditing();
|
||||||
|
|
||||||
|
void pauseWalkSound();
|
||||||
|
|
||||||
namespace templates
|
namespace templates
|
||||||
{
|
{
|
||||||
void load();
|
void load();
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ namespace console
|
|||||||
strcpy(msg, "ERROR: Nothing to show.");
|
strcpy(msg, "ERROR: Nothing to show.");
|
||||||
} else {
|
} else {
|
||||||
strcpy(msg, "Ok.");
|
strcpy(msg, "Ok.");
|
||||||
const int value = getIndexFromString(tokens[1], {"NOTHING", "ACTOR-POS"});
|
const int value = getIndexFromString(tokens[1], {"NOTHING", "POS", "FLAGS"});
|
||||||
if (value==-1)
|
if (value==-1)
|
||||||
strcpy(msg, "ERROR: Cannot show that.");
|
strcpy(msg, "ERROR: Cannot show that.");
|
||||||
else
|
else
|
||||||
@@ -276,7 +276,7 @@ namespace console
|
|||||||
strcpy(msg, "ERROR: Nothing to hide.");
|
strcpy(msg, "ERROR: Nothing to hide.");
|
||||||
} else {
|
} else {
|
||||||
strcpy(msg, "Ok.");
|
strcpy(msg, "Ok.");
|
||||||
const int value = getIndexFromString(tokens[1], {"NOTHING", "ACTOR-POS"});
|
const int value = getIndexFromString(tokens[1], {"NOTHING", "POS", "FLAGS"});
|
||||||
if (value==-1)
|
if (value==-1)
|
||||||
strcpy(msg, "ERROR: Cannot hide that.");
|
strcpy(msg, "ERROR: Cannot hide that.");
|
||||||
else
|
else
|
||||||
@@ -309,10 +309,10 @@ namespace console
|
|||||||
strcpy(msg, "Exits the game.");
|
strcpy(msg, "Exits the game.");
|
||||||
break;
|
break;
|
||||||
case CMD_SHOW:
|
case CMD_SHOW:
|
||||||
strcpy(msg, "NOTHING ACTOR-POS");
|
strcpy(msg, "NOTHING POS FLAGS");
|
||||||
break;
|
break;
|
||||||
case CMD_HIDE:
|
case CMD_HIDE:
|
||||||
strcpy(msg, "NOTHING ACTOR-POS");
|
strcpy(msg, "NOTHING POS FLAGS");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace debug
|
namespace debug
|
||||||
{
|
{
|
||||||
bool debug_info[2] {false, false};
|
bool debug_info[3] {false, false, false};
|
||||||
|
|
||||||
void enable(int info_type)
|
void enable(int info_type)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace debug
|
namespace debug
|
||||||
{
|
{
|
||||||
#define DEBUG_ACTOR_POS 1
|
#define DEBUG_ACTOR_POS 1
|
||||||
|
#define DEBUG_ACTOR_FLAGS 2
|
||||||
|
|
||||||
void enable(int info_type);
|
void enable(int info_type);
|
||||||
void disable(int info_type);
|
void disable(int info_type);
|
||||||
|
|||||||
@@ -298,6 +298,8 @@ namespace modules
|
|||||||
console::toggle();
|
console::toggle();
|
||||||
} else {
|
} else {
|
||||||
if (room::editor::isModified()) room::editor::save();
|
if (room::editor::isModified()) room::editor::save();
|
||||||
|
actor::pauseWalkSound();
|
||||||
|
|
||||||
return GAME_MENU;
|
return GAME_MENU;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "jdraw.h"
|
#include "jdraw.h"
|
||||||
|
#include "jaudio.h"
|
||||||
#include "actor.h"
|
#include "actor.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -18,6 +19,7 @@ namespace modules
|
|||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
|
|
||||||
selected_option = INGAME_CONTINUAR;
|
selected_option = INGAME_CONTINUAR;
|
||||||
|
|
||||||
surf = draw::getSurface("objectes.gif");
|
surf = draw::getSurface("objectes.gif");
|
||||||
@@ -71,10 +73,18 @@ namespace modules
|
|||||||
return INGAME_CONTINUAR;
|
return INGAME_CONTINUAR;
|
||||||
}
|
}
|
||||||
if (controller::pressed(KEY_DOWN))
|
if (controller::pressed(KEY_DOWN))
|
||||||
|
{
|
||||||
selected_option = (selected_option+1)&1;
|
selected_option = (selected_option+1)&1;
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
|
}
|
||||||
if (controller::pressed(KEY_UP))
|
if (controller::pressed(KEY_UP))
|
||||||
|
{
|
||||||
selected_option = (selected_option-1)&1;
|
selected_option = (selected_option-1)&1;
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) {
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
|
}
|
||||||
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK))
|
||||||
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
return selected_option;
|
return selected_option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,15 +33,19 @@ namespace modules
|
|||||||
}
|
}
|
||||||
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
||||||
{
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
selected_option++; if (selected_option==5) selected_option=0;
|
selected_option++; if (selected_option==5) selected_option=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP))
|
if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP))
|
||||||
{
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
selected_option--; if (selected_option<0) selected_option=4;
|
selected_option--; if (selected_option<0) selected_option=4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE) ) {
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE) )
|
||||||
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
return selected_option;
|
return selected_option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "m_menu_gamepad.h"
|
#include "m_menu_gamepad.h"
|
||||||
#include "jdraw.h"
|
#include "jdraw.h"
|
||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
|
#include "jaudio.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
@@ -35,12 +36,20 @@ namespace modules
|
|||||||
return MENU_GAMEPAD_TORNAR;
|
return MENU_GAMEPAD_TORNAR;
|
||||||
}
|
}
|
||||||
if (controller::pressed(KEY_DOWN))
|
if (controller::pressed(KEY_DOWN))
|
||||||
{ selected_option++; if (selected_option>6) selected_option=0; }
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
|
selected_option++; if (selected_option>6) selected_option=0;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_UP))
|
if (controller::pressed(KEY_UP))
|
||||||
{ selected_option--; if (selected_option<0) selected_option=6; }
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
|
selected_option--; if (selected_option<0) selected_option=6;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) {
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK))
|
||||||
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
if (selected_option==MENU_GAMEPAD_TORNAR)
|
if (selected_option==MENU_GAMEPAD_TORNAR)
|
||||||
return MENU_GAMEPAD_TORNAR;
|
return MENU_GAMEPAD_TORNAR;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "m_menu_tecles.h"
|
#include "m_menu_tecles.h"
|
||||||
#include "jdraw.h"
|
#include "jdraw.h"
|
||||||
#include "jinput.h"
|
#include "jinput.h"
|
||||||
|
#include "jaudio.h"
|
||||||
#include "controller.h"
|
#include "controller.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
@@ -44,12 +45,20 @@ namespace modules
|
|||||||
return MENU_TECLES_TORNAR;
|
return MENU_TECLES_TORNAR;
|
||||||
}
|
}
|
||||||
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
|
||||||
{ selected_option++; if (selected_option>6) selected_option=0; }
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
|
selected_option++; if (selected_option>6) selected_option=0;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP))
|
if (controller::pressed(KEY_UP) || input::keyPressed(SDL_SCANCODE_UP))
|
||||||
{ selected_option--; if (selected_option<0) selected_option=6; }
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
|
selected_option--; if (selected_option<0) selected_option=6;
|
||||||
|
}
|
||||||
|
|
||||||
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE)) {
|
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_SPACE))
|
||||||
|
{
|
||||||
|
audio::playSound("snd_push.wav", SOUND_BASIC);
|
||||||
if (selected_option==MENU_TECLES_TORNAR)
|
if (selected_option==MENU_TECLES_TORNAR)
|
||||||
return MENU_TECLES_TORNAR;
|
return MENU_TECLES_TORNAR;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user