mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2024-11-28 19:23:53 +00:00
Huge Game.cpp refactor and various other things
Started working on a tiny input/ActionMapper refactor, then everything fell apart and i ended up doing this. I'm sorry. Pretty much untested because input mapping is broken right now, will fix that next.
This commit is contained in:
parent
e2e7753226
commit
9414be864a
45 changed files with 4540 additions and 6812 deletions
|
@ -232,11 +232,11 @@ void AnimationEditor::applyState()
|
|||
editSprite->position = Vector(400,300);
|
||||
|
||||
|
||||
addAction(MakeFunctionEvent(AnimationEditor, lmbu), ActionMapper::MOUSE_BUTTON_LEFT, 0);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, lmbd), ActionMapper::MOUSE_BUTTON_LEFT, 1);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, rmbu), ActionMapper::MOUSE_BUTTON_RIGHT, 0);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, rmbd), ActionMapper::MOUSE_BUTTON_RIGHT, 1);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, mmbd), ActionMapper::MOUSE_BUTTON_MIDDLE, 1);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, lmbu), MOUSE_BUTTON_LEFT, 0);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, lmbd), MOUSE_BUTTON_LEFT, 1);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, rmbu), MOUSE_BUTTON_RIGHT, 0);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, rmbd), MOUSE_BUTTON_RIGHT, 1);
|
||||
addAction(MakeFunctionEvent(AnimationEditor, mmbd), MOUSE_BUTTON_MIDDLE, 1);
|
||||
|
||||
|
||||
addAction(MakeFunctionEvent(AnimationEditor, cloneBoneAhead), KEY_SPACE, 0);
|
||||
|
@ -531,9 +531,8 @@ void AnimationEditor::redo()
|
|||
}
|
||||
}
|
||||
|
||||
void AnimationEditor::action(int id, int state)
|
||||
void AnimationEditor::action(int id, int state, int source)
|
||||
{
|
||||
StateObject::action(id, state);
|
||||
if (editingBone && state)
|
||||
{
|
||||
if (dsq->isNested()) return;
|
||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "AquariaMenuItem.h"
|
||||
#include "DSQ.h"
|
||||
#include "Game.h"
|
||||
#include "ActionInput.h"
|
||||
|
||||
float AquariaGuiElement::guiMoveTimer = 0;
|
||||
AquariaGuiElement::GuiElements AquariaGuiElement::guiElements;
|
||||
|
@ -671,7 +672,7 @@ void AquariaKeyConfig::onUpdate(float dt)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (int i = ActionMapper::JOY1_BUTTON_0; i <= MAX_JOYSTICK_BTN; i++)
|
||||
for (int i = JOY_BUTTON_0; i <= MAX_JOYSTICK_BTN; i++)
|
||||
{
|
||||
if (dsq->game->getKeyState(i))
|
||||
{
|
||||
|
@ -778,8 +779,8 @@ AquariaMenuItem::AquariaMenuItem() : Quad(), ActionMapper(), AquariaGuiElement()
|
|||
|
||||
cull = false;
|
||||
followCamera = 1;
|
||||
addAction(MakeFunctionEvent(AquariaMenuItem, onClick), ActionMapper::MOUSE_BUTTON_LEFT, 0);
|
||||
addAction(MakeFunctionEvent(AquariaMenuItem, onClick), ActionMapper::MOUSE_BUTTON_RIGHT, 0);
|
||||
addAction(MakeFunctionEvent(AquariaMenuItem, onClick), MOUSE_BUTTON_LEFT, 0);
|
||||
addAction(MakeFunctionEvent(AquariaMenuItem, onClick), MOUSE_BUTTON_RIGHT, 0);
|
||||
|
||||
renderQuad = false;
|
||||
}
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
bool useQuad(const std::string &tex);
|
||||
void useGlow(const std::string &tex, int w, int h);
|
||||
void useSound(const std::string &tex);
|
||||
virtual void action(int actionID, int state, int source) {}
|
||||
|
||||
virtual bool isCursorInMenuItem();
|
||||
Vector getGuiPosition();
|
||||
|
|
|
@ -4291,7 +4291,7 @@ Vector Avatar::getVectorToCursor(bool trueMouse)
|
|||
//return core->mouse.position - Vector(400,300);
|
||||
}
|
||||
|
||||
void Avatar::action(int id, int state)
|
||||
void Avatar::action(int id, int state, int source)
|
||||
{
|
||||
if(dsq->game->isIgnoreAction((AquariaActions)id))
|
||||
return;
|
||||
|
@ -7015,54 +7015,11 @@ bool Avatar::checkWarpAreas()
|
|||
//dsq->fade(0, t);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
for (i = 0; i < dsq->game->warpAreas.size(); i++)
|
||||
{
|
||||
WarpArea *a = &dsq->game->warpAreas[i];
|
||||
if (a->radius)
|
||||
{
|
||||
Vector diff = a->position - this->position;
|
||||
if (diff.getSquaredLength2D() < sqr(a->radius))
|
||||
{
|
||||
if (canWarp)
|
||||
{
|
||||
dsq->game->warpToArea(a);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = lastPosition;
|
||||
vel = -diff;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (position.x > a->position.x - a->w && position.x < a->position.x + a->w)
|
||||
{
|
||||
if (position.y > a->position.y - a->h && position.y < a->position.y + a->h)
|
||||
{
|
||||
if (canWarp)
|
||||
{
|
||||
dsq->game->warpToArea(a);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = lastPosition;
|
||||
vel = -vel*1.1f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public:
|
|||
Avatar();
|
||||
virtual ~Avatar();
|
||||
void destroy();
|
||||
void action(int actionID, int state);
|
||||
void action(int actionID, int state, int source);
|
||||
AvatarState state;
|
||||
float burst, burstTimer;
|
||||
float burstDelay;
|
||||
|
|
|
@ -1521,10 +1521,6 @@ void Continuity::castSong(int num)
|
|||
dsq->game->avatar->changeForm(FORM_ENERGY);
|
||||
break;
|
||||
#ifndef AQUARIA_DEMO
|
||||
case SONG_MAP:
|
||||
if (dsq->game->autoMap)
|
||||
dsq->game->autoMap->toggle(true);
|
||||
break;
|
||||
case SONG_HEAL:
|
||||
|
||||
// do heal effects
|
||||
|
@ -1635,6 +1631,7 @@ void Continuity::castSong(int num)
|
|||
dsq->game->avatar->changeForm(FORM_FISH);
|
||||
break;
|
||||
case SONG_SONGDOOR1:
|
||||
case SONG_MAP:
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
@ -2083,8 +2080,6 @@ void Continuity::applyWorldEffects(WorldType type, bool transition, bool affectM
|
|||
|
||||
dsq->game->avatar->canWarp = false;
|
||||
|
||||
|
||||
dsq->game->backupSceneColor = dsq->game->sceneColor;
|
||||
dsq->game->sceneColor.interpolateTo(Vector(0.4, 0.8, 0.9), time);
|
||||
dsq->game->avatar->applyWorldEffects(type);
|
||||
}
|
||||
|
@ -3479,16 +3474,8 @@ void Continuity::reset()
|
|||
dualFormMode = DUALFORM_LI;
|
||||
dualFormCharge = 0;
|
||||
|
||||
lastMenuPage = MENUPAGE_NONE;
|
||||
lastOptionsMenuPage = MENUPAGE_NONE;
|
||||
|
||||
if (dsq->game)
|
||||
{
|
||||
dsq->game->currentMenuPage = MENUPAGE_NONE;
|
||||
dsq->game->currentFoodPage = 0;
|
||||
dsq->game->currentTreasurePage = 0;
|
||||
dsq->game->recipeMenu.currentPage = 0;
|
||||
}
|
||||
dsq->game->onContinuityReset();
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -651,10 +651,6 @@ void DSQ::debugMenu()
|
|||
{
|
||||
dsq->demo.clearRecordedFrames();
|
||||
}
|
||||
else if (c == 'M')
|
||||
{
|
||||
dsq->game->autoMap->toggle(!dsq->game->autoMap->isOn());
|
||||
}
|
||||
else if (c == 'H')
|
||||
{
|
||||
std::ostringstream os;
|
||||
|
@ -831,7 +827,6 @@ This build is not yet final, and as such there are a couple things lacking. They
|
|||
fpsText = 0;
|
||||
cmDebug = 0;
|
||||
|
||||
routeShoulder = true;
|
||||
debugLog("DSQ init");
|
||||
|
||||
useFrameBuffer = false;
|
||||
|
@ -3802,9 +3797,9 @@ void DSQ::watch(float t, int canQuit)
|
|||
}
|
||||
}
|
||||
|
||||
void DSQ::action(int id, int state)
|
||||
void DSQ::action(int id, int state, int source)
|
||||
{
|
||||
Core::action(id, state);
|
||||
Core::action(id, state, source);
|
||||
|
||||
if (id == ACTION_ESC && !state)
|
||||
{
|
||||
|
|
|
@ -174,15 +174,6 @@ typedef std::vector<Entity*> EntityContainer;
|
|||
#define FOR_ENTITIES(i) for (size_t i##_i = 0; dsq->entities[i##_i] != 0; ++i##_i) if (Entity **i = &dsq->entities[i##_i])
|
||||
|
||||
|
||||
enum MenuPage
|
||||
{
|
||||
MENUPAGE_NONE = -1,
|
||||
MENUPAGE_SONGS = 0,
|
||||
MENUPAGE_FOOD = 1,
|
||||
MENUPAGE_TREASURES = 2,
|
||||
MENUPAGE_PETS = 3
|
||||
};
|
||||
|
||||
enum WorldMapRevealMethod
|
||||
{
|
||||
REVEAL_UNSPECIFIED = -1,
|
||||
|
@ -1115,8 +1106,6 @@ public:
|
|||
|
||||
float poisonBitTime, poisonBitTimeAvatar;
|
||||
|
||||
MenuPage lastMenuPage, lastOptionsMenuPage;
|
||||
|
||||
enum { DUALFORM_NAIJA = 0, DUALFORM_LI = 1 };
|
||||
int dualFormMode, dualFormCharge;
|
||||
|
||||
|
@ -1249,7 +1238,7 @@ public:
|
|||
|
||||
void nag(NagType type);
|
||||
|
||||
void action(int id, int state);
|
||||
void action(int id, int state, int source);
|
||||
|
||||
void title(bool fadeMusic=true);
|
||||
|
||||
|
@ -1489,8 +1478,6 @@ public:
|
|||
void centerText(const std::string &text);
|
||||
void centerMessage(const std::string &text, float y=300, int type=0);
|
||||
|
||||
bool routeShoulder;
|
||||
|
||||
void toggleVersionLabel(bool on);
|
||||
|
||||
void onConfirmYes();
|
||||
|
|
|
@ -284,8 +284,6 @@ public:
|
|||
|
||||
void freeze(float time);
|
||||
|
||||
virtual void onSceneFlipped() {}
|
||||
|
||||
bool isNearObstruction(int sz, int type=0, TileVector *hitTile=0);
|
||||
|
||||
enum
|
||||
|
|
5856
Aquaria/Game.cpp
5856
Aquaria/Game.cpp
File diff suppressed because it is too large
Load diff
406
Aquaria/Game.h
406
Aquaria/Game.h
|
@ -35,47 +35,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
using namespace tinyxml2;
|
||||
|
||||
|
||||
class RecipeMenuEntry : public RenderObject
|
||||
{
|
||||
public:
|
||||
RecipeMenuEntry(Recipe *recipe);
|
||||
protected:
|
||||
void onUpdate(float dt);
|
||||
Quad *result, *ing[3];
|
||||
Quad *glow;
|
||||
BitmapText *description;
|
||||
IngredientData *data;
|
||||
|
||||
Recipe *recipe;
|
||||
|
||||
int selected;
|
||||
};
|
||||
|
||||
struct RecipeMenu
|
||||
{
|
||||
RecipeMenu();
|
||||
Quad *scroll;
|
||||
Quad *scrollEnd;
|
||||
BitmapText *header, *page, *description;
|
||||
AquariaMenuItem *nextPage, *prevPage;
|
||||
|
||||
|
||||
void toggle(bool on, bool watch=false);
|
||||
void createPage(int p);
|
||||
void slide(RenderObject *r, bool in, float t);
|
||||
void destroyPage();
|
||||
void goNextPage();
|
||||
void goPrevPage();
|
||||
int getNumPages();
|
||||
int getNumKnown();
|
||||
|
||||
int currentPage;
|
||||
|
||||
bool on;
|
||||
|
||||
std::vector<RecipeMenuEntry*> recipeMenuEntries;
|
||||
};
|
||||
|
||||
class Avatar;
|
||||
class Gradient;
|
||||
class CurrentRender;
|
||||
|
@ -84,8 +43,9 @@ class SongLineRender;
|
|||
class AutoMap;
|
||||
class DebugButton;
|
||||
class WorldMapRender;
|
||||
class InGameMenu;
|
||||
|
||||
const float boxElementZ = -0.1f;
|
||||
// FIXME: this should be made dynamic, or at least a power of 2
|
||||
const int MAX_GRID = 2222;
|
||||
|
||||
const char CHAR_DOWN = 'd';
|
||||
|
@ -184,122 +144,6 @@ protected:
|
|||
|
||||
typedef std::list<Ingredient*> Ingredients;
|
||||
|
||||
class WarpArea
|
||||
{
|
||||
public:
|
||||
WarpArea()
|
||||
{
|
||||
w = h = radius = 0;
|
||||
generated = false;
|
||||
}
|
||||
Vector position;
|
||||
Vector avatarPosition;
|
||||
int radius;
|
||||
bool generated;
|
||||
int w, h;
|
||||
Vector spawnOffset;
|
||||
std::string sceneName, warpAreaType;
|
||||
};
|
||||
|
||||
class SongSlot : public AquariaGuiQuad
|
||||
{
|
||||
public:
|
||||
SongSlot(int songSlot);
|
||||
|
||||
int songSlot, songType;
|
||||
bool mbDown;
|
||||
protected:
|
||||
Quad *glow;
|
||||
void onUpdate(float dt);
|
||||
};
|
||||
|
||||
class FoodSlot : public AquariaGuiQuad
|
||||
{
|
||||
public:
|
||||
FoodSlot(int slot);
|
||||
|
||||
void refresh(bool effects);
|
||||
int slot;
|
||||
void toggle(bool f);
|
||||
static int foodSlotIndex;
|
||||
|
||||
IngredientData *getIngredient() { return ingredient; }
|
||||
|
||||
float scaleFactor;
|
||||
|
||||
void eatMe();
|
||||
void moveRight();
|
||||
void discard();
|
||||
|
||||
bool isCursorIn();
|
||||
|
||||
void setOriginalPosition(const Vector &op);
|
||||
|
||||
protected:
|
||||
int rmb;
|
||||
bool right;
|
||||
float doubleClickDelay;
|
||||
float grabTime;
|
||||
int lastAmount;
|
||||
IngredientData *lastIngredient;
|
||||
Vector originalPosition;
|
||||
void onUpdate(float dt);
|
||||
DebugFont *label;
|
||||
bool inCookSlot;
|
||||
IngredientData *ingredient;
|
||||
Quad *lid;
|
||||
};
|
||||
|
||||
class PetSlot : public AquariaGuiQuad
|
||||
{
|
||||
public:
|
||||
PetSlot(int pet);
|
||||
int petFlag;
|
||||
protected:
|
||||
bool wasSlot;
|
||||
int petidx;
|
||||
bool mouseDown;
|
||||
void onUpdate(float dt);
|
||||
};
|
||||
|
||||
class TreasureSlot : public AquariaGuiQuad
|
||||
{
|
||||
public:
|
||||
TreasureSlot(int treasureFlag);
|
||||
void refresh();
|
||||
protected:
|
||||
float doubleClickTimer;
|
||||
bool mbd;
|
||||
int flag;
|
||||
std::string treasureName, treasureDesc;
|
||||
int index;
|
||||
void onUpdate(float dt);
|
||||
};
|
||||
|
||||
class FoodHolder : public Quad
|
||||
{
|
||||
public:
|
||||
FoodHolder(int slot, bool trash=false);
|
||||
|
||||
bool isEmpty();
|
||||
bool isTrash();
|
||||
void setIngredient(IngredientData *i, bool effects=true);
|
||||
void dropFood();
|
||||
IngredientData *getIngredient();
|
||||
void animateLid(bool down, bool longAnim=true);
|
||||
protected:
|
||||
bool trash;
|
||||
Quad *wok, *ing;
|
||||
bool buttonDown;
|
||||
void onUpdate(float dt);
|
||||
|
||||
Quad *lid;
|
||||
|
||||
int slot;
|
||||
private:
|
||||
IngredientData *foodHolderIngredient;
|
||||
};
|
||||
|
||||
class ElementTemplate
|
||||
{
|
||||
public:
|
||||
|
@ -314,25 +158,6 @@ public:
|
|||
int idx;
|
||||
};
|
||||
|
||||
class MiniMapHint
|
||||
{
|
||||
public:
|
||||
std::string scene;
|
||||
std::string warpAreaType;
|
||||
void clear()
|
||||
{
|
||||
debugLog("miniMapHint: CLEAR");
|
||||
scene = warpAreaType = "";
|
||||
}
|
||||
};
|
||||
|
||||
class WarpAreaRender : public RenderObject
|
||||
{
|
||||
public:
|
||||
protected:
|
||||
void onRender();
|
||||
};
|
||||
|
||||
class ObsRow
|
||||
{
|
||||
public:
|
||||
|
@ -415,7 +240,7 @@ public:
|
|||
void flipElementVert();
|
||||
void deleteSelectedElement();
|
||||
void deleteElement(int selectedIdx);
|
||||
void action(int id, int state);
|
||||
virtual void action(int id, int state, int source);
|
||||
void scaleElementUp();
|
||||
void scaleElementDown();
|
||||
void scaleElement1();
|
||||
|
@ -436,10 +261,6 @@ public:
|
|||
|
||||
void regenLevel();
|
||||
|
||||
|
||||
void startDrawingWarpArea(char c);
|
||||
void endDrawingWarpArea(char c);
|
||||
|
||||
void updateSaveFileEnemyPosition(Entity *ent);
|
||||
void startMoveEntity();
|
||||
void endMoveEntity();
|
||||
|
@ -467,7 +288,6 @@ public:
|
|||
Entity *editingEntity;
|
||||
Path *editingPath;
|
||||
|
||||
void toggleWarpAreaRender();
|
||||
int selectedIdx;
|
||||
int selectedNode;
|
||||
Path *getSelectedPath();
|
||||
|
@ -536,8 +356,6 @@ protected:
|
|||
Vector oldPosition, oldRotation, oldScale, cursorOffset, oldRepeatScale;
|
||||
|
||||
Entity *movingEntity;
|
||||
void updateDrawingWarpArea(char c, int k);
|
||||
char drawingWarpArea;
|
||||
|
||||
void nextEntityType();
|
||||
void prevEntityType();
|
||||
|
@ -546,13 +364,8 @@ protected:
|
|||
|
||||
void selectEntityFromGroups();
|
||||
|
||||
|
||||
WarpAreaRender *warpAreaRender;
|
||||
Vector zoom;
|
||||
|
||||
Vector boxPos;
|
||||
Quad *boxPromo;
|
||||
bool drawingBox;
|
||||
void rotateElement();
|
||||
void rotateElement2();
|
||||
void updateText();
|
||||
|
@ -632,20 +445,11 @@ public:
|
|||
void applyState();
|
||||
void removeState();
|
||||
void update(float dt);
|
||||
void onLeftMouseButton();
|
||||
|
||||
|
||||
Avatar *avatar;
|
||||
Entity *li;
|
||||
|
||||
Element *elementWithMenu;
|
||||
|
||||
FoodSlot *moveFoodSlotToFront;
|
||||
|
||||
|
||||
|
||||
std::string getSelectedChoice() { return selectedChoice; }
|
||||
|
||||
ObsType getGrid(const TileVector &tile) const;
|
||||
ObsType getGridRaw(const TileVector &tile) const;
|
||||
unsigned char *getGridColumn(int tileX);
|
||||
|
@ -656,11 +460,6 @@ public:
|
|||
void trimGrid();
|
||||
void dilateGrid(unsigned int radius, ObsType test, ObsType set, ObsType allowOverwrite);
|
||||
|
||||
void clearPointers();
|
||||
|
||||
void sortFood();
|
||||
void updatePreviewRecipe();
|
||||
|
||||
void transitionToScene(std::string scene);
|
||||
bool loadScene(std::string scene);
|
||||
|
||||
|
@ -669,9 +468,9 @@ public:
|
|||
|
||||
void toggleWorldMap();
|
||||
|
||||
void action(int id, int state);
|
||||
void action(int id, int state, int source);
|
||||
|
||||
void adjustFoodSlotCursor();
|
||||
InGameMenu *getInGameMenu() { return themenu; }
|
||||
|
||||
void loadElementTemplates(std::string pack);
|
||||
Element* createElement(int etidx, Vector position, int bgLayer=0, RenderObject *copy=0, ElementTemplate *et=0);
|
||||
|
@ -704,16 +503,11 @@ public:
|
|||
ElementTemplate *getElementTemplateByIdx(int idx);
|
||||
|
||||
bool saveScene(std::string scene);
|
||||
typedef std::vector<WarpArea> WarpAreas;
|
||||
WarpAreas warpAreas;
|
||||
|
||||
void postInitEntities();
|
||||
EntityClass *getEntityClassForEntityType(const std::string &type);
|
||||
|
||||
void warpToArea(WarpArea *area);
|
||||
|
||||
InterpolatedVector sceneColor, sceneColor2, sceneColor3;
|
||||
Vector backupSceneColor;
|
||||
|
||||
Vector getCameraPositionFor(const Vector &vec);
|
||||
|
||||
|
@ -743,16 +537,9 @@ public:
|
|||
XMLDocument *saveFile;
|
||||
|
||||
Vector positionToAvatar;
|
||||
float getCoverage(Vector pos, int sampleArea = 5);
|
||||
|
||||
float getPercObsInArea(Vector position, int range, int obs=-1);
|
||||
Vector getWallNormal(Vector pos, int sampleArea = 5, float *dist=0, int obs = -1);
|
||||
|
||||
// HACK:: clean up these vars
|
||||
std::string warpAreaType, warpAreaSide;
|
||||
Vector spawnOffset;
|
||||
Vector miniMapHintPosition;
|
||||
MiniMapHint miniMapHint;
|
||||
void updateMiniMapHintPosition();
|
||||
EntitySaveData *getEntitySaveDataForEntity(Entity *e, Vector pos);
|
||||
Entity *createEntity(int idx, int id, Vector position, int rot, bool createSaveData, std::string name, EntityType = ET_ENEMY, bool doPostInit=false);
|
||||
|
@ -760,23 +547,17 @@ public:
|
|||
Entity *establishEntity(Entity *e, int id=0, Vector position=Vector(0,0), int rot=0, bool createSaveData=false, std::string name="", EntityType = ET_ENEMY,bool doPostInit=false);
|
||||
void setCameraFollow(RenderObject *r);
|
||||
void setCameraFollowEntity(Entity *e);
|
||||
void setMenuDescriptionText(const std::string &text);
|
||||
|
||||
bool removeEntityAtCursor();
|
||||
void toggleOverrideZoom(bool on);
|
||||
bool doFlagCheck(const std::string &flagCheck, FlagCheckType type=NO_TYPE, bool lastTruth=false);
|
||||
|
||||
bool useWaterLevel;
|
||||
InterpolatedVector waterLevel;
|
||||
int saveWaterLevel;
|
||||
void flipSceneVertical(int flipY);
|
||||
void warpCameraTo(RenderObject *r);
|
||||
bool isSceneFlipped();
|
||||
void refreshItemSlotIcons();
|
||||
|
||||
void addObsRow(int tx, int ty, int len);
|
||||
void clearObsRows();
|
||||
void setWarpAreaSceneName(WarpArea &warpArea);
|
||||
Entity *getEntityAtCursor();
|
||||
Vector cameraMin, cameraMax;
|
||||
bool removeEntity(Entity *e);
|
||||
|
@ -815,19 +596,10 @@ public:
|
|||
void loadEntityTypeList();
|
||||
std::vector<EntitySaveData> entitySaveData;
|
||||
int getIdxForEntityType(std::string type);
|
||||
void hideInGameMenu(bool effects=true, bool cancel=false);
|
||||
void showInGameMenu(bool force=false, bool optionsOnly=false, MenuPage menuPage = MENUPAGE_NONE);
|
||||
bool optionsOnly;
|
||||
|
||||
MenuPage currentMenuPage;
|
||||
int currentFoodPage, currentTreasurePage;
|
||||
|
||||
Precacher tileCache;
|
||||
|
||||
|
||||
|
||||
void setCameraFollow(Vector *position);
|
||||
Shot *fireShot(Entity *firer, const std::string &particleEffect, Vector position, bool big, Vector direction, Entity *target, int homing=0, int velLenOverride=0, int targetPt=-1);
|
||||
Shot *fireShot(const std::string &bankShot, Entity *firer, Entity *target=0, const Vector &pos=Vector(0,0,0), const Vector &aim=Vector(0,0,0), bool playSfx=true);
|
||||
void playBurstSound(bool wallJump=false);
|
||||
void toggleMiniMapRender();
|
||||
|
@ -839,7 +611,6 @@ public:
|
|||
void setTimerText(float time);
|
||||
|
||||
void generateCollisionMask(Quad *q, float overrideCollideRadius=0);
|
||||
std::string sceneNatureForm;
|
||||
std::string fromScene, toNode;
|
||||
int toFlip;
|
||||
char fromWarpType;
|
||||
|
@ -861,18 +632,8 @@ public:
|
|||
void setControlHint(const std::string &hint, bool left, bool right, bool middle, float time, std::string image="", bool ignoreClear=false, int songType=0, float scale=1);
|
||||
void clearControlHint();
|
||||
|
||||
void colorTest();
|
||||
|
||||
void playSongInMenu(int songType, bool override=false);
|
||||
|
||||
bool trace(Vector start, Vector target);
|
||||
|
||||
Quad *menuSongs;
|
||||
std::vector<SongSlot*> songSlots;
|
||||
std::vector<FoodSlot*> foodSlots;
|
||||
std::vector<TreasureSlot*> treasureSlots;
|
||||
BitmapText* songDescription;
|
||||
|
||||
BitmapText *timerText;
|
||||
|
||||
float cameraLerpDelay;
|
||||
|
@ -884,23 +645,17 @@ public:
|
|||
void setElementLayerVisible(int bgLayer, bool v);
|
||||
bool isElementLayerVisible(int bgLayer);
|
||||
|
||||
void showInGameMenuExitCheck();
|
||||
void hideInGameMenuExitCheck(bool refocus);
|
||||
bool isControlHint();
|
||||
|
||||
int getNumberOfEntitiesNamed(const std::string &name);
|
||||
MiniMapRender *miniMapRender;
|
||||
WorldMapRender *worldMapRender;
|
||||
AutoMap *autoMap;
|
||||
|
||||
Quad *hudUnderlay;
|
||||
|
||||
int worldMapIndex;
|
||||
|
||||
bool loadingScene;
|
||||
|
||||
WaterSurfaceRender *waterSurfaceRender;
|
||||
Quad *shapeDebug;
|
||||
|
||||
#ifdef AQUARIA_BUILD_SCENEEDITOR
|
||||
EntityGroups entityGroups;
|
||||
|
@ -924,14 +679,8 @@ public:
|
|||
void hideImage();
|
||||
|
||||
bool bNatural;
|
||||
void onLips();
|
||||
std::string sceneToLoad;
|
||||
void snapCam();
|
||||
|
||||
void updateOptionsMenu(float dt);
|
||||
BitmapText *songLabel, *foodLabel, *foodDescription, *treasureLabel;
|
||||
ToolTip *treasureDescription;
|
||||
Quad *treasureCloseUp;
|
||||
void updateBgSfxLoop();
|
||||
void preLocalWarp(LocalWarpType localWarpType);
|
||||
void postLocalWarp();
|
||||
|
@ -940,30 +689,6 @@ public:
|
|||
bool isShuttingDownGameState() { return shuttingDownGameState; }
|
||||
void warpToSceneNode(std::string scene, std::string node);
|
||||
|
||||
AquariaProgressBar *progressBar;
|
||||
void addProgress();
|
||||
void endProgress();
|
||||
|
||||
void refreshFoodSlots(bool effects);
|
||||
void refreshTreasureSlots();
|
||||
|
||||
Recipe *findRecipe(const std::vector<IngredientData*> &list);
|
||||
void onCook();
|
||||
void onRecipes();
|
||||
void updateCookList();
|
||||
void onUseTreasure();
|
||||
void onUseTreasure(int flag);
|
||||
|
||||
void onPrevFoodPage();
|
||||
void onNextFoodPage();
|
||||
|
||||
void onPrevTreasurePage();
|
||||
void onNextTreasurePage();
|
||||
|
||||
std::vector<std::string> dropIngrNames;
|
||||
|
||||
AquariaMenuItem *lips;
|
||||
|
||||
int lastCollideMaskIndex;
|
||||
|
||||
void ensureLimit(Entity *e, int num, int state=0);
|
||||
|
@ -973,7 +698,6 @@ public:
|
|||
|
||||
float getTimer(float mod=1);
|
||||
float getHalfTimer(float mod=1);
|
||||
float getHalf2WayTimer(float mod=1);
|
||||
|
||||
std::string bgSfxLoopPlaying2;
|
||||
|
||||
|
@ -1008,16 +732,10 @@ public:
|
|||
void pickupIngredientEffects(IngredientData *data);
|
||||
|
||||
void bindInput();
|
||||
RecipeMenu recipeMenu;
|
||||
|
||||
AquariaMenuItem *eYes, *eNo, *cook, *recipes, *nextFood, *prevFood, *nextTreasure, *prevTreasure, *use, *keyConfigButton;
|
||||
AquariaMenuItem *opt_cancel, *opt_save, *foodSort;
|
||||
|
||||
bool cameraOffBounds;
|
||||
|
||||
void enqueuePreviewRecipe();
|
||||
|
||||
void toggleHelpScreen() { action(ACTION_TOGGLEHELPSCREEN, 0); }
|
||||
void toggleHelpScreen() { action(ACTION_TOGGLEHELPSCREEN, 0, -1); }
|
||||
|
||||
void setWorldPaused(bool b) { worldPaused = b; }
|
||||
bool isWorldPaused() const { return worldPaused; }
|
||||
|
@ -1025,6 +743,8 @@ public:
|
|||
void setIgnoreAction(AquariaActions ac, bool ignore);
|
||||
bool isIgnoreAction(AquariaActions ac) const;
|
||||
|
||||
void onContinuityReset();
|
||||
|
||||
protected:
|
||||
|
||||
void toggleHelpScreen(bool on, const std::string &label="");
|
||||
|
@ -1038,30 +758,11 @@ protected:
|
|||
TTFText *helpText;
|
||||
bool inHelpScreen;
|
||||
|
||||
int enqueuedPreviewRecipe;
|
||||
|
||||
Quad *previewRecipe;
|
||||
Quad *menuIconGlow;
|
||||
Quad *showRecipe;
|
||||
|
||||
bool isCooking;
|
||||
|
||||
void doMenuSectionHighlight(int sect);
|
||||
|
||||
float cookDelay;
|
||||
|
||||
float ingOffY;
|
||||
float ingOffYTimer;
|
||||
|
||||
std::vector<RenderObject*> controlHintNotes;
|
||||
|
||||
void onPrevRecipePage();
|
||||
void onNextRecipePage();
|
||||
|
||||
|
||||
|
||||
typedef std::vector<IngredientData*> CookList;
|
||||
CookList cookList;
|
||||
|
||||
bool active;
|
||||
bool applyingState;
|
||||
|
@ -1071,70 +772,19 @@ protected:
|
|||
|
||||
void warpPrep();
|
||||
bool shuttingDownGameState;
|
||||
void onOptionsMenu();
|
||||
bool optionsMenu, foodMenu, petMenu, treasureMenu, keyConfigMenu;
|
||||
void toggleOptionsMenu(bool f, bool skipBackup=false, bool isKeyConfig=false);
|
||||
void toggleFoodMenu(bool f);
|
||||
void toggleMainMenu(bool f);
|
||||
void togglePetMenu(bool f);
|
||||
void toggleTreasureMenu(bool f);
|
||||
void toggleRecipeList(bool on);
|
||||
void toggleKeyConfigMenu(bool f);
|
||||
|
||||
void switchToSongMenu();
|
||||
void switchToFoodMenu();
|
||||
void switchToPetMenu();
|
||||
void switchToTreasureMenu();
|
||||
|
||||
void onKeyConfig();
|
||||
|
||||
void addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, int l1=0, int l2=0, int l3=0);
|
||||
|
||||
AquariaKeyConfig *addAxesConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, int offx);
|
||||
|
||||
void onOptionsSave();
|
||||
void onOptionsCancel();
|
||||
AquariaSlider *sfxslider, *musslider, *voxslider;
|
||||
AquariaCheckBox *autoAimCheck, *targetingCheck, *toolTipsCheck, *flipInputButtonsCheck, *micInputCheck, *blurEffectsCheck;
|
||||
AquariaCheckBox *subtitlesCheck, *fullscreenCheck, *ripplesCheck;
|
||||
AquariaComboBox *resBox;
|
||||
Quad *songBubbles, *energyIdol, *liCrystal;
|
||||
|
||||
RenderObject *group_keyConfig;
|
||||
|
||||
Quad *options;
|
||||
|
||||
Quad *image;
|
||||
void initEntities();
|
||||
|
||||
|
||||
void onExitCheckNo();
|
||||
void onExitCheckYes();
|
||||
|
||||
BitmapText *circlePageNum;
|
||||
|
||||
std::vector<ToolTip*> foodTips, songTips, petTips, treasureTips;
|
||||
|
||||
|
||||
|
||||
Quad *eAre;
|
||||
int inGameMenuExitState;
|
||||
float controlHintTimer;
|
||||
bool cameraConstrained;
|
||||
|
||||
void updateCursor(float dt);
|
||||
void updateInGameMenu(float dt);
|
||||
float songMenuPlayDelay;
|
||||
int currentSongMenuNote;
|
||||
int playingSongInMenu;
|
||||
|
||||
Quad *controlHint_mouseLeft, *controlHint_mouseRight, *controlHint_mouseBody, *controlHint_mouseMiddle, *controlHint_bg, *controlHint_image;
|
||||
Quad *controlHint_shine;
|
||||
bool controlHint_ignoreClear;
|
||||
BitmapText *controlHint_text;
|
||||
|
||||
|
||||
|
||||
void updateCurrentVisuals(float dt);
|
||||
std::string lastTileset;
|
||||
|
||||
|
||||
|
@ -1144,19 +794,6 @@ protected:
|
|||
void findMaxCameraValues();
|
||||
std::vector<ObsRow> obsRows;
|
||||
|
||||
bool sceneFlipped;
|
||||
|
||||
|
||||
void flipRenderObjectVertical(RenderObject *r, int flipY);
|
||||
void onFlipTest();
|
||||
|
||||
void onDebugSave();
|
||||
|
||||
BitmapText *menuDescription;
|
||||
BitmapText *menuEXP, *menuMoney;
|
||||
|
||||
std::vector<Quad*> spellIcons;
|
||||
int currentInventoryPage;
|
||||
float backgroundImageRepeat;
|
||||
|
||||
std::string musicToPlay;
|
||||
|
@ -1164,20 +801,8 @@ protected:
|
|||
float deathTimer;
|
||||
|
||||
|
||||
|
||||
void onInGameMenuInventory();
|
||||
void onInGameMenuSpellBook();
|
||||
void onInGameMenuContinue();
|
||||
void onInGameMenuOptions();
|
||||
void onInGameMenuSave();
|
||||
void onInGameMenuExit();
|
||||
|
||||
void onPressEscape();
|
||||
|
||||
|
||||
|
||||
std::vector<AquariaMenuItem*> menu;
|
||||
Quad *menuBg, *menuBg2;
|
||||
bool paused;
|
||||
bool worldPaused;
|
||||
|
||||
|
@ -1196,25 +821,16 @@ protected:
|
|||
void toggleSceneEditor();
|
||||
#endif
|
||||
|
||||
unsigned char grid[MAX_GRID][MAX_GRID];
|
||||
|
||||
|
||||
Quad *bg, *bg2;
|
||||
|
||||
bool inGameMenu;
|
||||
float menuOpenTimer;
|
||||
|
||||
std::vector <Quad*> itemSlotIcons, itemSlotEmptyIcons;
|
||||
|
||||
|
||||
std::string selectedChoice;
|
||||
|
||||
void warpCameraTo(Vector position);
|
||||
|
||||
std::set<int> ignoredActions;
|
||||
|
||||
private:
|
||||
Ingredients ingredients;
|
||||
InGameMenu *themenu;
|
||||
static unsigned char grid[MAX_GRID][MAX_GRID];
|
||||
};
|
||||
|
||||
extern Game *game;
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
Vector getAvatarWorldMapPosition();
|
||||
Vector getWorldToTile(WorldMapTile *tile, Vector position, bool fromCenter, bool tilePos);
|
||||
void setProperTileColor(WorldMapTile *tile);
|
||||
void action(int id, int state);
|
||||
void action(int id, int state, int source);
|
||||
GemMover* addGem(GemData *gemData);
|
||||
void bindInput();
|
||||
void createGemHint(const std::string &gfx);
|
||||
|
|
3986
Aquaria/InGameMenu.cpp
Normal file
3986
Aquaria/InGameMenu.cpp
Normal file
File diff suppressed because it is too large
Load diff
232
Aquaria/InGameMenu.h
Normal file
232
Aquaria/InGameMenu.h
Normal file
|
@ -0,0 +1,232 @@
|
|||
#ifndef IN_GAME_MENU_H
|
||||
#define IN_GAME_MENU_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ActionMapper.h"
|
||||
|
||||
class BitmapText;
|
||||
class ToolTip;
|
||||
class Quad;
|
||||
class AquariaMenuItem;
|
||||
class RenderObject;
|
||||
class SongSlot;
|
||||
class FoodSlot;
|
||||
class TreasureSlot;
|
||||
class IngredientData;
|
||||
class AquariaKeyConfig;
|
||||
class AquariaCheckBox;
|
||||
class AquariaSlider;
|
||||
class AquariaComboBox;
|
||||
class RecipeMenuEntry;
|
||||
class Recipe;
|
||||
|
||||
|
||||
enum MenuPage
|
||||
{
|
||||
MENUPAGE_NONE = -1,
|
||||
MENUPAGE_SONGS = 0,
|
||||
MENUPAGE_FOOD = 1,
|
||||
MENUPAGE_TREASURES = 2,
|
||||
MENUPAGE_PETS = 3
|
||||
};
|
||||
|
||||
struct RecipeMenu
|
||||
{
|
||||
RecipeMenu();
|
||||
Quad *scroll;
|
||||
Quad *scrollEnd;
|
||||
BitmapText *header, *page, *description;
|
||||
AquariaMenuItem *nextPage, *prevPage;
|
||||
|
||||
|
||||
void toggle(bool on, bool watch=false);
|
||||
void createPage(int p);
|
||||
void slide(RenderObject *r, bool in, float t);
|
||||
void destroyPage();
|
||||
void goNextPage();
|
||||
void goPrevPage();
|
||||
int getNumPages();
|
||||
int getNumKnown();
|
||||
|
||||
int currentPage;
|
||||
|
||||
bool on;
|
||||
|
||||
std::vector<RecipeMenuEntry*> recipeMenuEntries;
|
||||
};
|
||||
|
||||
|
||||
class InGameMenu : public ActionMapper
|
||||
{
|
||||
// These are defined in the cpp file and are exclusively used in menu code
|
||||
friend class FoodSlot;
|
||||
friend class PetSlot;
|
||||
friend class TreasureSlot;
|
||||
friend class SongSlot;
|
||||
friend class FoodHolder;
|
||||
|
||||
public:
|
||||
InGameMenu();
|
||||
~InGameMenu();
|
||||
|
||||
void create();
|
||||
void update(float dt);
|
||||
void updateOptions(float dt);
|
||||
void hide(bool effects=true, bool cancel=false);
|
||||
void show(bool force=false, bool optionsOnly=false, MenuPage menuPage = MENUPAGE_NONE);
|
||||
bool isInGameMenu() const { return inGameMenu; }
|
||||
bool isFoodMenuOpen() const { return foodMenu; }
|
||||
MenuPage getCurrentMenuPage() const { return currentMenuPage; }
|
||||
void reset();
|
||||
void onContinuityReset();
|
||||
|
||||
void bindInput();
|
||||
virtual void action(int actionID, int state, int source);
|
||||
|
||||
void refreshFoodSlots(bool effects);
|
||||
|
||||
RecipeMenu recipeMenu;
|
||||
|
||||
private:
|
||||
void updateOptionsMenu(float dt);
|
||||
|
||||
void sortFood();
|
||||
void updatePreviewRecipe();
|
||||
void adjustFoodSlotCursor();
|
||||
void playSongInMenu(int songType, bool override=false);
|
||||
|
||||
void refreshTreasureSlots();
|
||||
|
||||
Recipe *findRecipe(const std::vector<IngredientData*> &list);
|
||||
void onCook();
|
||||
void onRecipes();
|
||||
void updateCookList();
|
||||
void onUseTreasure();
|
||||
void onUseTreasure(int flag);
|
||||
|
||||
void onPrevFoodPage();
|
||||
void onNextFoodPage();
|
||||
|
||||
void onPrevTreasurePage();
|
||||
void onNextTreasurePage();
|
||||
void onLips();
|
||||
|
||||
void showInGameMenuExitCheck();
|
||||
void hideInGameMenuExitCheck(bool refocus);
|
||||
|
||||
void setMenuDescriptionText(const std::string &text);
|
||||
FoodSlot* getFoodSlotFromIndex();
|
||||
|
||||
BitmapText *songLabel, *foodLabel, *foodDescription, *treasureLabel;
|
||||
ToolTip *treasureDescription;
|
||||
Quad *treasureCloseUp;
|
||||
|
||||
Quad *menuBg, *menuBg2;
|
||||
|
||||
AquariaMenuItem *eYes, *eNo, *cook, *recipes, *nextFood, *prevFood, *nextTreasure, *prevTreasure, *use, *keyConfigButton;
|
||||
AquariaMenuItem *opt_cancel, *opt_save, *foodSort;
|
||||
|
||||
Quad *menu_blackout;
|
||||
|
||||
std::vector<SongSlot*> songSlots;
|
||||
std::vector<FoodSlot*> foodSlots;
|
||||
std::vector<TreasureSlot*> treasureSlots;
|
||||
BitmapText* songDescription;
|
||||
|
||||
int selectedTreasureFlag;
|
||||
|
||||
bool optionsOnly;
|
||||
|
||||
float cookDelay;
|
||||
|
||||
MenuPage currentMenuPage;
|
||||
int currentFoodPage, currentTreasurePage;
|
||||
|
||||
int enqueuedPreviewRecipe;
|
||||
|
||||
Quad *previewRecipe;
|
||||
Quad *menuIconGlow;
|
||||
Quad *showRecipe;
|
||||
|
||||
bool isCooking;
|
||||
float optsfxdly;
|
||||
|
||||
void doMenuSectionHighlight(int sect);
|
||||
|
||||
void onPrevRecipePage();
|
||||
void onNextRecipePage();
|
||||
void onDebugSave();
|
||||
|
||||
typedef std::vector<IngredientData*> CookList;
|
||||
CookList cookList;
|
||||
std::vector<std::string> dropIngrNames;
|
||||
|
||||
float songMenuPlayDelay;
|
||||
int currentSongMenuNote;
|
||||
int playingSongInMenu;
|
||||
|
||||
void onOptionsMenu();
|
||||
bool optionsMenu, foodMenu, petMenu, treasureMenu, keyConfigMenu;
|
||||
void toggleOptionsMenu(bool f, bool skipBackup=false, bool isKeyConfig=false);
|
||||
void toggleFoodMenu(bool f);
|
||||
void toggleMainMenu(bool f);
|
||||
void togglePetMenu(bool f);
|
||||
void toggleTreasureMenu(bool f);
|
||||
void toggleRecipeList(bool on);
|
||||
void toggleKeyConfigMenu(bool f);
|
||||
|
||||
void enqueuePreviewRecipe();
|
||||
|
||||
void switchToSongMenu();
|
||||
void switchToFoodMenu();
|
||||
void switchToPetMenu();
|
||||
void switchToTreasureMenu();
|
||||
|
||||
void onKeyConfig();
|
||||
|
||||
void addKeyConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, int l1=0, int l2=0, int l3=0);
|
||||
|
||||
AquariaKeyConfig *addAxesConfigLine(RenderObject *group, const std::string &label, const std::string &actionInputName, int y, int offx);
|
||||
|
||||
void onOptionsSave();
|
||||
void onOptionsCancel();
|
||||
AquariaSlider *sfxslider, *musslider, *voxslider;
|
||||
AquariaCheckBox *autoAimCheck, *targetingCheck, *toolTipsCheck, *flipInputButtonsCheck, *micInputCheck, *blurEffectsCheck;
|
||||
AquariaCheckBox *subtitlesCheck, *fullscreenCheck, *ripplesCheck;
|
||||
AquariaComboBox *resBox;
|
||||
Quad *songBubbles, *energyIdol, *liCrystal;
|
||||
|
||||
RenderObject *group_keyConfig;
|
||||
|
||||
Quad *options;
|
||||
|
||||
void onExitCheckNo();
|
||||
void onExitCheckYes();
|
||||
void onInGameMenuContinue();
|
||||
void onInGameMenuOptions();
|
||||
void onInGameMenuExit();
|
||||
|
||||
BitmapText *circlePageNum;
|
||||
|
||||
std::vector<ToolTip*> foodTips, songTips, petTips, treasureTips;
|
||||
|
||||
Quad *eAre;
|
||||
int inGameMenuExitState;
|
||||
|
||||
BitmapText *menuDescription;
|
||||
|
||||
std::vector<AquariaMenuItem*> menu;
|
||||
|
||||
bool inGameMenu;
|
||||
float menuOpenTimer;
|
||||
|
||||
FoodSlot *moveFoodSlotToFront;
|
||||
AquariaMenuItem *lips;
|
||||
|
||||
MenuPage lastMenuPage, lastOptionsMenuPage;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -412,7 +412,7 @@ void MiniMapRender::onUpdate(float dt)
|
|||
{
|
||||
doubleClickDelay = 0;
|
||||
if (!core->isStateJumpPending())
|
||||
dsq->game->action(ACTION_TOGGLEMENU, 1);
|
||||
dsq->game->action(ACTION_TOGGLEMENU, 1, -1);
|
||||
btn = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -164,6 +164,8 @@ public:
|
|||
AquariaMenuItem arrowUp, arrowDown;
|
||||
|
||||
void setSubText(const std::string& s);
|
||||
|
||||
virtual void action(int actionID, int state, int source) {}
|
||||
|
||||
protected:
|
||||
virtual void onUpdate(float dt);
|
||||
|
|
|
@ -640,12 +640,12 @@ void Path::update(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
bool Path::action(int id, int state)
|
||||
bool Path::action(int id, int state, int source)
|
||||
{
|
||||
if (hasScript())
|
||||
{
|
||||
bool dontRemove = true;
|
||||
if (!script->call("action", this, id, state, &dontRemove))
|
||||
if (!script->call("action", this, id, state, source, &dontRemove))
|
||||
luaDebugMsg("action", script->getLastError());
|
||||
return dontRemove;
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ public:
|
|||
void addNode(int idx);
|
||||
void update(float dt);
|
||||
void setActive(bool v);
|
||||
bool action(int id, int state);
|
||||
bool action(int id, int state, int source);
|
||||
void setEmitter(const std::string& name);
|
||||
|
||||
PathNode *getPathNode(int idx);
|
||||
|
|
|
@ -18,7 +18,11 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "RecipeMenuEntry.h"
|
||||
#include "Game.h"
|
||||
#include "InGameMenu.h"
|
||||
|
||||
|
||||
namespace RecipeMenuNamespace
|
||||
{
|
||||
|
@ -165,7 +169,9 @@ void RecipeMenuEntry::onUpdate(float dt)
|
|||
{
|
||||
RenderObject::onUpdate(dt);
|
||||
|
||||
if (!game->recipeMenu.description)
|
||||
RecipeMenu& recipeMenu = game->getInGameMenu()->recipeMenu;
|
||||
|
||||
if (!recipeMenu.description)
|
||||
return;
|
||||
|
||||
if (alpha.x == 1)
|
||||
|
@ -196,8 +202,8 @@ void RecipeMenuEntry::onUpdate(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
game->recipeMenu.description->setText(ds.str());
|
||||
game->recipeMenu.description->offset = Vector(0, -10 * (game->recipeMenu.description->getNumLines()-1));
|
||||
recipeMenu.description->setText(ds.str());
|
||||
recipeMenu.description->offset = Vector(0, -10 * (recipeMenu.description->getNumLines()-1));
|
||||
|
||||
selected = 1;
|
||||
}
|
||||
|
@ -208,15 +214,15 @@ void RecipeMenuEntry::onUpdate(float dt)
|
|||
|
||||
int n=0;
|
||||
|
||||
for (int i = 0; i < game->recipeMenu.recipeMenuEntries.size(); i++)
|
||||
for (int i = 0; i < recipeMenu.recipeMenuEntries.size(); i++)
|
||||
{
|
||||
if (!game->recipeMenu.recipeMenuEntries[i]->selected)
|
||||
if (!recipeMenu.recipeMenuEntries[i]->selected)
|
||||
n++;
|
||||
}
|
||||
|
||||
if (n == game->recipeMenu.recipeMenuEntries.size())
|
||||
if (n == recipeMenu.recipeMenuEntries.size())
|
||||
{
|
||||
game->recipeMenu.description->setText("");
|
||||
recipeMenu.description->setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
28
Aquaria/RecipeMenuEntry.h
Normal file
28
Aquaria/RecipeMenuEntry.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef RECIPEMENUENTRY_H
|
||||
#define RECIPEMENUENTRY_H
|
||||
|
||||
#include "RenderObject.h"
|
||||
|
||||
class Recipe;
|
||||
class Quad;
|
||||
class BitmapText;
|
||||
class IngredientData;
|
||||
|
||||
class RecipeMenuEntry : public RenderObject
|
||||
{
|
||||
public:
|
||||
RecipeMenuEntry(Recipe *recipe);
|
||||
protected:
|
||||
void onUpdate(float dt);
|
||||
Quad *result, *ing[3];
|
||||
Quad *glow;
|
||||
BitmapText *description;
|
||||
IngredientData *data;
|
||||
|
||||
Recipe *recipe;
|
||||
|
||||
int selected;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -91,57 +91,6 @@ std::string getMapTemplateFilename()
|
|||
return "";
|
||||
}
|
||||
|
||||
void WarpAreaRender::onRender()
|
||||
{
|
||||
for (int i = 0; i < dsq->game->warpAreas.size(); i++)
|
||||
{
|
||||
WarpArea *a = &dsq->game->warpAreas[i];
|
||||
glTranslatef(a->position.x, a->position.y,0);
|
||||
|
||||
if (a->warpAreaType == "Brown")
|
||||
glColor4f(0.5, 0.25, 0, alpha.getValue());
|
||||
else
|
||||
{
|
||||
switch (a->warpAreaType[0])
|
||||
{
|
||||
case 'B':
|
||||
glColor4f(0,0,1,alpha.getValue());
|
||||
break;
|
||||
case 'R':
|
||||
glColor4f(1,0,0,alpha.getValue());
|
||||
break;
|
||||
case 'G':
|
||||
glColor4f(0, 1, 0,alpha.getValue());
|
||||
break;
|
||||
case 'Y':
|
||||
glColor4f(1,1,0,alpha.getValue());
|
||||
break;
|
||||
case 'P':
|
||||
glColor4f(1,0,1,alpha.getValue());
|
||||
break;
|
||||
case 'O':
|
||||
glColor4f(1,0.5,0,alpha.getValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (a->radius)
|
||||
drawCircle(a->radius);
|
||||
else
|
||||
{
|
||||
glBegin(GL_QUADS);
|
||||
{
|
||||
glVertex2f(-a->w,-a->h);
|
||||
glVertex2f(-a->w,a->h);
|
||||
glVertex2f(a->w,a->h);
|
||||
glVertex2f(a->w,-a->h);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glTranslatef(-a->position.x, -a->position.y,0);
|
||||
}
|
||||
}
|
||||
|
||||
SceneEditor::SceneEditor() : ActionMapper(), on(false)
|
||||
{
|
||||
autoSaveFile = 0;
|
||||
|
@ -169,8 +118,6 @@ void SceneEditor::changeDepth()
|
|||
{
|
||||
if (editingElement)
|
||||
{
|
||||
|
||||
|
||||
editingElement->followCamera = 0.9;
|
||||
editingElement->cull = false;
|
||||
}
|
||||
|
@ -527,7 +474,6 @@ void SceneEditor::init()
|
|||
|
||||
editType = ET_ELEMENTS;
|
||||
state = ES_SELECTING;
|
||||
drawingWarpArea = 'N';
|
||||
|
||||
btnMenu = new DebugButton(200, &menuReceiver, 700);
|
||||
btnMenu->position = Vector(20, 20);
|
||||
|
@ -539,7 +485,6 @@ void SceneEditor::init()
|
|||
|
||||
selectedEntityType = 0;
|
||||
zoom = Vector(0.2,0.2);
|
||||
drawingBox = false;
|
||||
bgLayer = 5;
|
||||
text = new DebugFont();
|
||||
text->setFontSize(6);
|
||||
|
@ -550,26 +495,14 @@ void SceneEditor::init()
|
|||
dsq->game->addRenderObject(text, LR_HUD);
|
||||
text->alpha = 0;
|
||||
selectedVariation = -1;
|
||||
|
||||
boxPromo = new Quad;
|
||||
boxPromo->color = 0;
|
||||
boxPromo->alpha =0;
|
||||
boxPromo->cull = false;
|
||||
dsq->game->addRenderObject(boxPromo, LR_HUD);
|
||||
on = false;
|
||||
|
||||
|
||||
|
||||
addAction(MakeFunctionEvent(SceneEditor, loadScene), KEY_F1, 0);
|
||||
addAction(MakeFunctionEvent(SceneEditor, saveScene), KEY_F2, 0);
|
||||
|
||||
|
||||
|
||||
addAction(MakeFunctionEvent(SceneEditor, moveToBack), KEY_Z, 0);
|
||||
addAction(MakeFunctionEvent(SceneEditor, moveToFront), KEY_X, 0);
|
||||
|
||||
addAction(MakeFunctionEvent(SceneEditor, toggleWarpAreaRender), KEY_F4, 0);
|
||||
|
||||
addAction(MakeFunctionEvent(SceneEditor, editModeElements), KEY_F5, 0);
|
||||
addAction(MakeFunctionEvent(SceneEditor, editModeEntities), KEY_F6, 0);
|
||||
addAction(MakeFunctionEvent(SceneEditor, editModePaths), KEY_F7, 0);
|
||||
|
@ -689,11 +622,6 @@ void SceneEditor::init()
|
|||
placer->setTexture("missingimage");
|
||||
}
|
||||
|
||||
warpAreaRender = new WarpAreaRender;
|
||||
warpAreaRender->alpha = 0;
|
||||
warpAreaRender->toggleCull(false);
|
||||
dsq->game->addRenderObject(warpAreaRender, LR_HUD);
|
||||
|
||||
updateText();
|
||||
|
||||
doPrevElement();
|
||||
|
@ -856,16 +784,6 @@ void SceneEditor::reversePath()
|
|||
}
|
||||
}
|
||||
|
||||
void SceneEditor::toggleWarpAreaRender()
|
||||
{
|
||||
if (warpAreaRender->alpha.x == 0)
|
||||
warpAreaRender->alpha.x = 0.5;
|
||||
else if (warpAreaRender->alpha.x >= 0.5f)
|
||||
warpAreaRender->alpha.x = 0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SceneEditor::setGridPattern(int gi)
|
||||
{
|
||||
if (selectedElements.size())
|
||||
|
@ -1903,46 +1821,6 @@ void SceneEditor::generateLevel()
|
|||
|
||||
dsq->game->reconstructGrid(true);
|
||||
|
||||
// create warp areas
|
||||
dsq->game->warpAreas.clear();
|
||||
for (i = 0; i < MAX; i++)
|
||||
{
|
||||
if (firstColorX[i] != -1)
|
||||
{
|
||||
WarpArea warpArea;
|
||||
int w = lastColorX[i] - firstColorX[i];
|
||||
int h = lastColorY[i] - firstColorY[i];
|
||||
|
||||
warpArea.w = w*TILE_SIZE;
|
||||
warpArea.h = h*TILE_SIZE;
|
||||
warpArea.position = Vector(firstColorX[i]*TILE_SIZE + warpArea.w/2, firstColorY[i]*TILE_SIZE + warpArea.h/2);
|
||||
warpArea.w += TILE_SIZE*4;
|
||||
warpArea.h += TILE_SIZE*4;
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case RED: warpArea.warpAreaType = "Red"; break;
|
||||
case BLUE: warpArea.warpAreaType = "Blue"; break;
|
||||
case GREEN: warpArea.warpAreaType = "Green"; break;
|
||||
case YELLOW: warpArea.warpAreaType = "Yellow"; break;
|
||||
case PURPLE: warpArea.warpAreaType = "Purple"; break;
|
||||
case ORANGE: warpArea.warpAreaType = "Orange"; break;
|
||||
case BROWN: warpArea.warpAreaType = "Brown"; break;
|
||||
}
|
||||
|
||||
dsq->game->setWarpAreaSceneName(warpArea);
|
||||
|
||||
warpArea.generated = true;
|
||||
|
||||
std::ostringstream os;
|
||||
os << "WarpArea (" << warpArea.w << ", " << warpArea.h << ") - pos(" << warpArea.position.x << ", " <<
|
||||
warpArea.position.y << ")";
|
||||
debugLog(os.str());
|
||||
|
||||
dsq->game->warpAreas.push_back(warpArea);
|
||||
}
|
||||
}
|
||||
|
||||
maxX--;
|
||||
maxY--;
|
||||
this->skinMinX = 4;
|
||||
|
@ -1969,7 +1847,7 @@ void SceneEditor::removeEntity()
|
|||
void SceneEditor::placeAvatar()
|
||||
{
|
||||
dsq->game->avatar->position = dsq->getGameCursorPosition();
|
||||
dsq->game->action(ACTION_PLACE_AVATAR, 0);
|
||||
dsq->game->action(ACTION_PLACE_AVATAR, 0, -1);
|
||||
}
|
||||
|
||||
void SceneEditor::scaleElementUp()
|
||||
|
@ -2076,7 +1954,7 @@ void SceneEditor::updateMultiSelect()
|
|||
}
|
||||
}
|
||||
|
||||
void SceneEditor::action(int id, int state)
|
||||
void SceneEditor::action(int id, int state, int source)
|
||||
{
|
||||
if (core->getCtrlState() && editingElement)
|
||||
{
|
||||
|
@ -2625,7 +2503,7 @@ void SceneEditor::placeElement()
|
|||
{
|
||||
if (editType == ET_ELEMENTS)
|
||||
{
|
||||
if (!core->getShiftState() && !core->getKeyState(KEY_LALT) && !drawingBox)
|
||||
if (!core->getShiftState() && !core->getKeyState(KEY_LALT))
|
||||
{
|
||||
dsq->game->createElement(dsq->game->elementTemplates[curElement].idx, placer->position, bgLayer, placer);
|
||||
updateText();
|
||||
|
@ -2745,7 +2623,6 @@ void SceneEditor::toggle(bool on)
|
|||
btnMenu->alpha = 1;
|
||||
dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = true;
|
||||
|
||||
warpAreaRender->alpha = 0.5;
|
||||
dsq->game->togglePause(on);
|
||||
if (dsq->game->avatar)
|
||||
dsq->game->avatar->disableInput();
|
||||
|
@ -2786,7 +2663,6 @@ void SceneEditor::toggle(bool on)
|
|||
|
||||
dsq->getRenderObjectLayer(LR_BLACKGROUND)->update = false;
|
||||
|
||||
warpAreaRender->alpha = 0;
|
||||
dsq->game->togglePause(on);
|
||||
if (dsq->game->avatar)
|
||||
dsq->game->avatar->enableInput();
|
||||
|
@ -2867,70 +2743,6 @@ void SceneEditor::updateText()
|
|||
text->setText(os.str());
|
||||
}
|
||||
|
||||
void SceneEditor::startDrawingWarpArea(char c)
|
||||
{
|
||||
if (drawingWarpArea == 'N')
|
||||
{
|
||||
boxPos = dsq->getGameCursorPosition();
|
||||
boxPromo->alpha = 1;
|
||||
switch(c)
|
||||
{
|
||||
case 'Y': boxPromo->color = Vector(1,1,0); break;
|
||||
case 'U': boxPromo->color = Vector(1,0,0); break;
|
||||
case 'I': boxPromo->color = Vector(0,1,0); break;
|
||||
case 'O': boxPromo->color = Vector(0,0,1); break;
|
||||
case 'P': boxPromo->color = Vector(1,0,1); break;
|
||||
}
|
||||
drawingWarpArea = c;
|
||||
}
|
||||
if (drawingWarpArea == c)
|
||||
{
|
||||
Vector diff = dsq->getGameCursorPosition() - boxPos;
|
||||
boxPromo->setWidthHeight(diff.x, diff.y);
|
||||
boxPromo->position = boxPos + diff/2;
|
||||
}
|
||||
}
|
||||
|
||||
void SceneEditor::updateDrawingWarpArea(char c, int k)
|
||||
{
|
||||
if (core->getKeyState(k))
|
||||
{
|
||||
startDrawingWarpArea(c);
|
||||
}
|
||||
else
|
||||
{
|
||||
endDrawingWarpArea(c);
|
||||
}
|
||||
}
|
||||
|
||||
void SceneEditor::endDrawingWarpArea(char c)
|
||||
{
|
||||
if (drawingWarpArea == c)
|
||||
{
|
||||
drawingWarpArea = 'N';
|
||||
boxPromo->alpha = 0;
|
||||
if (boxPromo->getWidth() > TILE_SIZE && boxPromo->getHeight() > TILE_SIZE)
|
||||
{
|
||||
WarpArea a;
|
||||
a.position = boxPromo->position;
|
||||
a.w = boxPromo->getWidth()/2;
|
||||
a.h = boxPromo->getHeight()/2;
|
||||
switch (c)
|
||||
{
|
||||
case 'Y': a.warpAreaType = "Yellow"; break;
|
||||
case 'U': a.warpAreaType = "Red"; break;
|
||||
case 'I': a.warpAreaType = "Green"; break;
|
||||
case 'O': a.warpAreaType = "Blue"; break;
|
||||
case 'P': a.warpAreaType = "Purple"; break;
|
||||
}
|
||||
|
||||
a.sceneName = dsq->getUserInputString("Enter map to warp to");
|
||||
a.spawnOffset = dsq->getUserInputDirection("Enter warp direction");
|
||||
dsq->game->warpAreas.push_back(a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vector SceneEditor::getSelectedElementsCenter()
|
||||
{
|
||||
Vector c;
|
||||
|
|
|
@ -39,6 +39,7 @@ extern "C"
|
|||
#include "PathFinding.h"
|
||||
#include <algorithm>
|
||||
#include "Gradient.h"
|
||||
#include "InGameMenu.h"
|
||||
|
||||
#include "../BBGE/MathFunctions.h"
|
||||
|
||||
|
@ -2019,12 +2020,13 @@ luaFunc(sendAction)
|
|||
AquariaActions ac = (AquariaActions)lua_tointeger(L, 1);
|
||||
int state = lua_tointeger(L, 2);
|
||||
int mask = lua_tointeger(L, 3);
|
||||
int source = lua_tointeger(L, 4);
|
||||
if(!mask)
|
||||
mask = -1;
|
||||
if(mask & 1)
|
||||
dsq->game->action(ac, state);
|
||||
dsq->game->action(ac, state, source);
|
||||
if((mask & 2) && dsq->game->avatar)
|
||||
dsq->game->avatar->action(ac, state);
|
||||
dsq->game->avatar->action(ac, state, source);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
@ -3713,7 +3715,7 @@ luaFunc(unlearnSong)
|
|||
|
||||
luaFunc(showInGameMenu)
|
||||
{
|
||||
dsq->game->showInGameMenu(getBool(L, 1), getBool(L, 2), (MenuPage)lua_tointeger(L, 3));
|
||||
dsq->game->getInGameMenu()->show(getBool(L, 1), getBool(L, 2), (MenuPage)lua_tointeger(L, 3));
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
@ -3721,7 +3723,7 @@ luaFunc(hideInGameMenu)
|
|||
{
|
||||
bool skipEffect = getBool(L, 1);
|
||||
bool cancel = getBool(L, 2);
|
||||
dsq->game->hideInGameMenu(!skipEffect, cancel);
|
||||
dsq->game->getInGameMenu()->hide(!skipEffect, cancel);
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
|
@ -6430,15 +6432,6 @@ luaFunc(entity_setCurrentTarget)
|
|||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(setMiniMapHint)
|
||||
{
|
||||
std::istringstream is(getString(L, 1));
|
||||
is >> dsq->game->miniMapHint.scene >> dsq->game->miniMapHint.warpAreaType;
|
||||
dsq->game->updateMiniMapHintPosition();
|
||||
|
||||
luaReturnNil();
|
||||
}
|
||||
|
||||
luaFunc(entityFollowEntity)
|
||||
{
|
||||
Entity *e = dsq->getEntityByName(getString(L, 1));
|
||||
|
@ -9059,10 +9052,9 @@ luaFunc(inv_remove)
|
|||
if(data && data->amount > 0)
|
||||
{
|
||||
data->amount--;
|
||||
dsq->game->dropIngrNames.push_back(data->name);
|
||||
dsq->continuity.removeEmptyIngredients();
|
||||
if(dsq->game->isInGameMenu())
|
||||
dsq->game->refreshFoodSlots(true);
|
||||
dsq->game->getInGameMenu()->refreshFoodSlots(true);
|
||||
}
|
||||
luaReturnNil();
|
||||
}
|
||||
|
@ -9999,7 +9991,6 @@ static const struct {
|
|||
|
||||
luaRegister(entityFollowEntity),
|
||||
|
||||
luaRegister(setMiniMapHint),
|
||||
luaRegister(bedEffects),
|
||||
|
||||
luaRegister(warpNaijaToEntity),
|
||||
|
@ -11822,6 +11813,20 @@ bool Script::call(const char *name, void *param1, float param2, float param3, bo
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Script::call(const char *name, void *param1, int param2, int param3, int param4, bool *ret1)
|
||||
{
|
||||
lookupFunc(name);
|
||||
luaPushPointer(L, param1);
|
||||
lua_pushinteger(L, param2);
|
||||
lua_pushinteger(L, param3);
|
||||
lua_pushinteger(L, param4);
|
||||
if (!doCall(4, 1))
|
||||
return false;
|
||||
*ret1 = lua_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Script::call(const char *name, void *param1, const char *param2, float param3)
|
||||
{
|
||||
lookupFunc(name);
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
bool call(const char *name, void *param1, float param2, float param3);
|
||||
// boolean = function(pointer, number, number)
|
||||
bool call(const char *name, void *param1, float param2, float param3, bool *ret1);
|
||||
// boolean = function(pointer, int, int, int)
|
||||
bool call(const char *name, void *param1, int param2, int param3, int param4, bool *ret1);
|
||||
// function(pointer, string, number)
|
||||
bool call(const char *name, void *param1, const char *param2, float param3);
|
||||
// function(pointer, string, pointer)
|
||||
|
|
|
@ -225,7 +225,7 @@ public:
|
|||
|
||||
std::vector<KeyframeWidget*> keyframeWidgets;
|
||||
|
||||
void action(int id, int state);
|
||||
void action(int id, int state, int source);
|
||||
|
||||
void rebuildKeyframeWidgets();
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#include "ToolTip.h"
|
||||
#include "DSQ.h"
|
||||
#include "Game.h"
|
||||
#include "InGameMenu.h"
|
||||
|
||||
bool ToolTip::toolTipsOn = true;
|
||||
|
||||
|
@ -130,7 +131,7 @@ void ToolTip::onUpdate(float dt)
|
|||
|
||||
void ToolTip::render()
|
||||
{
|
||||
if (!dsq->game->recipeMenu.on && toolTipsOn)
|
||||
if (!game->getInGameMenu()->recipeMenu.on && toolTipsOn)
|
||||
{
|
||||
RenderObject::render();
|
||||
}
|
||||
|
|
|
@ -182,12 +182,6 @@ void UserSettings::save()
|
|||
}
|
||||
xml_control->InsertEndChild(xml_targeting);
|
||||
|
||||
XMLElement *xml_joyCursorSpeed = doc.NewElement("JoyCursorSpeed");
|
||||
{
|
||||
xml_joyCursorSpeed->SetAttribute("v", double(control.joyCursorSpeed));
|
||||
}
|
||||
xml_control->InsertEndChild(xml_joyCursorSpeed);
|
||||
|
||||
XMLElement *xml_joyAxes = doc.NewElement("JoyAxes");
|
||||
{
|
||||
xml_joyAxes->SetAttribute("s1ax", control.s1ax);
|
||||
|
@ -455,10 +449,6 @@ void UserSettings::load(bool doApply, const std::string &overrideFile)
|
|||
|
||||
readInt(xml_control, "Targeting", "on", &control.targeting);
|
||||
|
||||
XMLElement *xml_joyCursorSpeed = xml_control->FirstChildElement("JoyCursorSpeed");
|
||||
if (xml_joyCursorSpeed)
|
||||
xml_joyCursorSpeed->QueryFloatAttribute("v", &control.joyCursorSpeed);
|
||||
|
||||
XMLElement *xml_joyAxes = xml_control->FirstChildElement("JoyAxes");
|
||||
if (xml_joyAxes)
|
||||
{
|
||||
|
|
|
@ -133,7 +133,6 @@ public:
|
|||
toolTipsOn = 1;
|
||||
autoAim = 1;
|
||||
targeting = 1;
|
||||
joyCursorSpeed = 4.0;
|
||||
flipInputButtons = 0;
|
||||
s1ax = 0;
|
||||
s1ay = 0;
|
||||
|
@ -146,7 +145,6 @@ public:
|
|||
int joystickEnabled;
|
||||
int autoAim;
|
||||
int targeting;
|
||||
float joyCursorSpeed;
|
||||
int flipInputButtons;
|
||||
ActionSet actionSet;
|
||||
int s1ax, s1ay, s2ax, s2ay;
|
||||
|
|
|
@ -1481,7 +1481,7 @@ void WorldMapRender::updateEditor()
|
|||
areaLabel->setText(os.str());
|
||||
}
|
||||
|
||||
void WorldMapRender::action (int id, int state)
|
||||
void WorldMapRender::action (int id, int state, int source)
|
||||
{
|
||||
if (isOn())
|
||||
{
|
||||
|
|
|
@ -18,9 +18,65 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "ActionInput.h"
|
||||
// crap
|
||||
#include "Core.h"
|
||||
#include "ActionMapper.h"
|
||||
|
||||
#ifndef BBGE_BUILD_SDL2
|
||||
#error Needs fixes for SDL 1.2, doesnt support scancodes
|
||||
#endif
|
||||
|
||||
|
||||
std::string getInputCodeToString(int k)
|
||||
{
|
||||
if(k < SDL_NUM_SCANCODES)
|
||||
{
|
||||
const char *name = SDL_GetScancodeName((SDL_Scancode)k);
|
||||
if(name)
|
||||
return name;
|
||||
|
||||
std::stringstream os;
|
||||
os << "K:" << k;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
if(k >= JOY_BUTTON_0 && k < JOY_BUTTON_END)
|
||||
{
|
||||
std::stringstream os;
|
||||
os << "JB:" << (k - JOY_BUTTON_0);
|
||||
return os.str();
|
||||
}
|
||||
|
||||
switch(k)
|
||||
{
|
||||
case MOUSE_BUTTON_LEFT:
|
||||
return "LMB";
|
||||
case MOUSE_BUTTON_RIGHT:
|
||||
return "RMB";
|
||||
case MOUSE_BUTTON_MIDDLE:
|
||||
return "MMB";
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
int getStringToInputCode(const std::string& s)
|
||||
{
|
||||
if(s == "LMB")
|
||||
return MOUSE_BUTTON_LEFT;
|
||||
if(s == "RMB")
|
||||
return MOUSE_BUTTON_RIGHT;
|
||||
if(s == "MMB")
|
||||
return MOUSE_BUTTON_MIDDLE;
|
||||
if(!strncmp(s.c_str(), "K:", 2))
|
||||
return SDL_GetScancodeFromName(s.c_str() + 2);
|
||||
if(!strncmp(s.c_str(), "JB:", 3))
|
||||
return JOY_BUTTON_0 + atoi(s.c_str() + 3);
|
||||
|
||||
return -1; // FIXME: is this correct?
|
||||
}
|
||||
|
||||
|
||||
|
||||
ActionInput::ActionInput()
|
||||
{
|
||||
|
|
|
@ -22,13 +22,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define ACTIONINPUT_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
#define INP_MSESIZE 1
|
||||
#define INP_KEYSIZE 2
|
||||
#define INP_JOYSIZE 1
|
||||
|
||||
std::string getInputCodeToString(int k);
|
||||
int getStringToInputCode(const std::string& s);
|
||||
|
||||
class ActionInput
|
||||
{
|
||||
public:
|
||||
|
@ -44,8 +46,6 @@ public:
|
|||
void fromString(const std::string &read);
|
||||
};
|
||||
|
||||
typedef std::vector<ActionInput> ActionInputSet;
|
||||
|
||||
enum InputSetType
|
||||
{
|
||||
INPUTSET_NONE = 0,
|
||||
|
|
|
@ -60,11 +60,7 @@ void ActionMapper::addAction (int actionID, int k)
|
|||
{
|
||||
ActionData *ad = getActionDataByID(actionID);
|
||||
|
||||
if (ad)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
if (!ad)
|
||||
{
|
||||
ActionData data;
|
||||
data.id = actionID;
|
||||
|
@ -211,12 +207,13 @@ bool ActionMapper::getKeyState(int k)
|
|||
{
|
||||
keyState = (core->mouse.buttons.middle == DOWN);
|
||||
}
|
||||
else if (k >= JOY1_BUTTON_0 && k < JOY1_BUTTON_END)
|
||||
else if (k >= JOY_BUTTON_0 && k < JOY_BUTTON_END)
|
||||
{
|
||||
int v = k - JOY1_BUTTON_0;
|
||||
int v = k - JOY_BUTTON_0;
|
||||
|
||||
if (core->joystickEnabled)
|
||||
keyState = core->joystick.getButton(v);
|
||||
for(size_t i = 0; i < core->joysticks.size(); ++i)
|
||||
if( ((keyState = core->joysticks[i]->getButton(v))) )
|
||||
break;
|
||||
}
|
||||
|
||||
return keyState;
|
||||
|
@ -257,7 +254,7 @@ void ActionMapper::onUpdate (float dt)
|
|||
}
|
||||
else
|
||||
{
|
||||
action(ad->id, keyState);
|
||||
action(ad->id, keyState, -1); // FG: FIXME
|
||||
}
|
||||
if (core->loopDone) goto out;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,19 @@ struct ActionData
|
|||
ButtonList buttonList;
|
||||
};
|
||||
|
||||
#define ACTION_EVENT = -1
|
||||
enum ActionButtonType
|
||||
{
|
||||
// must start at > 512 (SDL scancodes end there)
|
||||
MOUSE_BUTTON_LEFT = 999,
|
||||
MOUSE_BUTTON_RIGHT = 1000,
|
||||
MOUSE_BUTTON_MIDDLE = 1001,
|
||||
|
||||
JOY_BUTTON_0 = 2000,
|
||||
JOY_BUTTON_END = JOY_BUTTON_0 + MAX_JOYSTICK_BTN, // one past end
|
||||
|
||||
JOY_AXIS_0 = 3000,
|
||||
JOY_AXIS_END = JOY_AXIS_0 + MAX_JOYSTICK_AXIS,
|
||||
};
|
||||
|
||||
class ActionMapper
|
||||
{
|
||||
|
@ -57,7 +69,7 @@ public:
|
|||
void removeAllActions();
|
||||
|
||||
bool isActing(int actionID);
|
||||
virtual void action(int actionID, int state){}
|
||||
virtual void action(int actionID, int state, int source) = 0;
|
||||
|
||||
|
||||
void clearActions();
|
||||
|
@ -74,17 +86,6 @@ public:
|
|||
|
||||
bool cleared;
|
||||
|
||||
|
||||
|
||||
enum {
|
||||
MOUSE_BUTTON_LEFT = 999,
|
||||
MOUSE_BUTTON_RIGHT = 1000,
|
||||
MOUSE_BUTTON_MIDDLE = 1001,
|
||||
|
||||
JOY1_BUTTON_0 = 2000,
|
||||
JOY1_BUTTON_END = JOY1_BUTTON_0 + MAX_JOYSTICK_BTN, // one past end
|
||||
};
|
||||
|
||||
virtual void enableInput();
|
||||
virtual void disableInput();
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ ActionInput *ActionSet::addActionInput(const std::string &name)
|
|||
return a;
|
||||
}
|
||||
|
||||
/*
|
||||
std::string ActionSet::insertInputIntoString(const std::string &string)
|
||||
{
|
||||
std::string str = string;
|
||||
|
@ -152,4 +153,5 @@ std::string ActionSet::insertInputIntoString(const std::string &string)
|
|||
std::string part2 = getInputCodeToUserString(inputCode);
|
||||
return part1 + part2 + part3;
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include "ActionInput.h"
|
||||
|
||||
typedef std::vector<ActionInput> ActionInputSet;
|
||||
|
||||
class ActionMapper;
|
||||
class Event;
|
||||
|
||||
|
@ -45,7 +47,7 @@ public:
|
|||
|
||||
ActionInputSet inputSet;
|
||||
|
||||
std::string insertInputIntoString(const std::string &string);
|
||||
//std::string insertInputIntoString(const std::string &string);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -664,11 +664,7 @@ void Core::init()
|
|||
|
||||
loopDone = false;
|
||||
|
||||
initInputCodeMap();
|
||||
|
||||
initLocalization();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Core::initRenderObjectLayers(int num)
|
||||
|
@ -3324,9 +3320,28 @@ void Core::initLocalization()
|
|||
|
||||
void Core::onJoystickAdded(int deviceID)
|
||||
{
|
||||
|
||||
debugLog("Add new joystick");
|
||||
Joystick *j = new Joystick;
|
||||
j->init(deviceID);
|
||||
for(size_t i = 0; i < joysticks.size(); ++i)
|
||||
if(!joysticks[i])
|
||||
{
|
||||
joysticks[i] = j;
|
||||
goto done;
|
||||
}
|
||||
joysticks.push_back(j);
|
||||
done:
|
||||
; // TODO: fixup ActionMapper?
|
||||
}
|
||||
|
||||
void Core::onJoystickRemoved(int instanceID)
|
||||
{
|
||||
for(size_t i = 0; i < joysticks.size(); ++i)
|
||||
if(joysticks[i]->getInstanceID() == instanceID)
|
||||
{
|
||||
joysticks[i]->shutdown();
|
||||
delete joysticks[i];
|
||||
joysticks[i] = NULL;
|
||||
}
|
||||
// TODO: fixup ActionMapper?
|
||||
}
|
||||
|
|
23
BBGE/Core.h
23
BBGE/Core.h
|
@ -49,12 +49,6 @@ class ParticleEffect;
|
|||
|
||||
class ParticleManager;
|
||||
|
||||
void initInputCodeMap();
|
||||
void clearInputCodeMap();
|
||||
std::string getInputCodeToString(int key);
|
||||
std::string getInputCodeToUserString(int key);
|
||||
int getStringToInputCode(const std::string &string);
|
||||
|
||||
struct ScreenMode
|
||||
{
|
||||
ScreenMode() { idx = x = y = hz = 0; }
|
||||
|
@ -72,12 +66,6 @@ struct CoreSettings
|
|||
bool prebufferSounds;
|
||||
};
|
||||
|
||||
enum CoreFlags
|
||||
{
|
||||
CF_CLEARBUFFERS = 0x00000001,
|
||||
CF_SORTENABLED = 0x00000010
|
||||
};
|
||||
|
||||
enum CoreLayers
|
||||
{
|
||||
LR_NONE = -1
|
||||
|
@ -413,7 +401,7 @@ public:
|
|||
|
||||
void setReentryInputGrab(int on);
|
||||
|
||||
void action(int id, int state){}
|
||||
virtual void action(int id, int state, int source){}
|
||||
|
||||
bool exists(const std::string &file);
|
||||
|
||||
|
@ -554,8 +542,6 @@ public:
|
|||
|
||||
bool debugLogTextures;
|
||||
|
||||
|
||||
Joystick joystick;
|
||||
void setClearColor(const Vector &c);
|
||||
Vector getClearColor();
|
||||
int flipMouseButtons;
|
||||
|
@ -694,14 +680,17 @@ protected:
|
|||
|
||||
CountedPtr<Texture> texError;
|
||||
|
||||
|
||||
|
||||
int tgaSaveSeries(char *filename, short int width, short int height, unsigned char pixelDepth, unsigned char *imageData);
|
||||
virtual void onUpdate(float dt);
|
||||
virtual void onRender(){}
|
||||
|
||||
void setupFileAccess();
|
||||
std::string _extraDataDir;
|
||||
|
||||
public:
|
||||
std::vector<Joystick*> joysticks;
|
||||
|
||||
Joystick joystick; // TEMP: TO GET IT TO COMPILE
|
||||
};
|
||||
|
||||
extern Core *core;
|
||||
|
|
|
@ -64,7 +64,7 @@ void EventPtr::call()
|
|||
}
|
||||
if (actionMapperCallback)
|
||||
{
|
||||
actionMapperCallback->action(actionValue, stateToCall);
|
||||
actionMapperCallback->action(actionValue, stateToCall, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,11 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef BBGE_BUILD_SDL2
|
||||
#error test this
|
||||
#endif
|
||||
|
||||
#include "Joystick.h"
|
||||
#include "Core.h"
|
||||
|
||||
|
||||
|
@ -30,7 +35,6 @@ Joystick::Joystick()
|
|||
sdl_haptic = NULL;
|
||||
# endif
|
||||
sdl_joy = NULL;
|
||||
inited = false;
|
||||
buttonBitmask = 0;
|
||||
deadZone1 = 0.3;
|
||||
deadZone2 = 0.3;
|
||||
|
@ -82,13 +86,16 @@ void Joystick::init(int stick)
|
|||
|
||||
if (sdl_joy)
|
||||
{
|
||||
inited = true;
|
||||
#ifdef BBGE_BUILD_SDL2
|
||||
debugLog(std::string("Initialized Joystick [") + std::string(SDL_JoystickName(sdl_joy)) + std::string("]"));
|
||||
if (sdl_controller) debugLog(std::string("Joystick is a Game Controller"));
|
||||
if (sdl_haptic) debugLog(std::string("Joystick has force feedback support"));
|
||||
debugLog(std::string("Initialized Joystick [") + SDL_JoystickName(sdl_joy) + "]");
|
||||
if (sdl_controller)
|
||||
debugLog("Joystick is a Game Controller");
|
||||
if (sdl_haptic)
|
||||
debugLog("Joystick has force feedback support");
|
||||
instanceID = SDL_JoystickInstanceID(sdl_joy);
|
||||
#else
|
||||
debugLog(std::string("Initialized Joystick [") + std::string(SDL_JoystickName(stick)) + std::string("]"));
|
||||
debugLog(std::string("Initialized Joystick [") + SDL_JoystickName(stick)) + std::string("]"));
|
||||
instanceID = SDL_JoystickIndex(sdl_joy);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
|
@ -128,7 +135,7 @@ void Joystick::shutdown()
|
|||
|
||||
void Joystick::rumble(float leftMotor, float rightMotor, float time)
|
||||
{
|
||||
if (core->joystickEnabled && inited)
|
||||
if (core->joystickEnabled)
|
||||
{
|
||||
#ifdef BBGE_BUILD_SDL2
|
||||
if (sdl_haptic)
|
||||
|
@ -149,7 +156,7 @@ void Joystick::rumble(float leftMotor, float rightMotor, float time)
|
|||
}
|
||||
}
|
||||
|
||||
void Joystick::callibrate(Vector &calvec, float deadZone)
|
||||
void Joystick::calibrate(Vector &calvec, float deadZone)
|
||||
{
|
||||
|
||||
if (calvec.isLength2DIn(deadZone))
|
||||
|
@ -181,25 +188,13 @@ void Joystick::callibrate(Vector &calvec, float deadZone)
|
|||
|
||||
void Joystick::update(float dt)
|
||||
{
|
||||
if (core->joystickEnabled && inited && sdl_joy && stickIndex != -1)
|
||||
if (core->joystickEnabled && sdl_joy && stickIndex != -1)
|
||||
{
|
||||
#ifdef BBGE_BUILD_SDL2
|
||||
if (!SDL_JoystickGetAttached(sdl_joy))
|
||||
{
|
||||
debugLog("Lost Joystick");
|
||||
if (sdl_haptic)
|
||||
{
|
||||
SDL_HapticClose(sdl_haptic);
|
||||
sdl_haptic = NULL;
|
||||
}
|
||||
if (!sdl_controller)
|
||||
SDL_JoystickClose(sdl_joy);
|
||||
else
|
||||
{
|
||||
SDL_GameControllerClose(sdl_controller);
|
||||
sdl_controller = NULL;
|
||||
}
|
||||
sdl_joy = NULL;
|
||||
shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -248,9 +243,9 @@ void Joystick::update(float dt)
|
|||
|
||||
|
||||
|
||||
callibrate(position, deadZone1);
|
||||
calibrate(position, deadZone1);
|
||||
|
||||
callibrate(rightStick, deadZone2);
|
||||
calibrate(rightStick, deadZone2);
|
||||
|
||||
|
||||
buttonBitmask = 0;
|
||||
|
@ -279,7 +274,7 @@ void Joystick::update(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
bool Joystick::anyButton()
|
||||
bool Joystick::anyButton() const
|
||||
{
|
||||
return !!buttonBitmask;;
|
||||
}
|
||||
|
|
|
@ -3,9 +3,15 @@
|
|||
|
||||
#include <SDL_joystick.h>
|
||||
|
||||
#ifdef BBGE_BUILD_SDL2
|
||||
#include <SDL_gamecontroller.h>
|
||||
#include <SDL_haptic.h>
|
||||
#endif
|
||||
|
||||
#include "Vector.h"
|
||||
|
||||
#define MAX_JOYSTICK_BTN 32
|
||||
#define MAX_JOYSTICK_AXIS 32
|
||||
|
||||
class Joystick
|
||||
{
|
||||
|
@ -13,25 +19,27 @@ public:
|
|||
Joystick();
|
||||
void init(int stick=0);
|
||||
void shutdown();
|
||||
//Ranges from 0 to 65535 (full speed).
|
||||
//Ranges from 0 to 1 (full speed).
|
||||
void rumble(float leftMotor, float rightMotor, float time);
|
||||
void update(float dt);
|
||||
Vector position, lastPosition;
|
||||
Vector position;
|
||||
|
||||
float deadZone1, deadZone2;
|
||||
float clearRumbleTime;
|
||||
|
||||
void callibrate(Vector &vec, float dead);
|
||||
bool anyButton();
|
||||
bool getButton(unsigned id) const { return buttonBitmask & (1u << id); }
|
||||
void calibrate(Vector &vec, float dead);
|
||||
bool anyButton() const;
|
||||
bool getButton(unsigned id) const { return !!(buttonBitmask & (1u << id)); }
|
||||
int getIndex() const { return stickIndex; }
|
||||
int getInstanceID() const { return instanceID; }
|
||||
|
||||
Vector rightStick;
|
||||
|
||||
int stickIndex;
|
||||
int s1ax, s1ay, s2ax, s2ay;
|
||||
|
||||
private:
|
||||
bool inited;
|
||||
int stickIndex;
|
||||
int instanceID;
|
||||
unsigned buttonBitmask; // FIXME: this should go
|
||||
SDL_Joystick *sdl_joy;
|
||||
|
||||
|
|
|
@ -54,10 +54,6 @@ void StateObject::removeRenderObject(RenderObject *renderObject)
|
|||
stateManager->getState(name)->removeRenderObject(renderObject);
|
||||
}
|
||||
|
||||
void StateObject::action(int id, int state)
|
||||
{
|
||||
}
|
||||
|
||||
void StateObject::update(float dt)
|
||||
{
|
||||
ActionMapper::onUpdate(dt);
|
||||
|
|
|
@ -54,7 +54,6 @@ class StateObject : public ActionMapper
|
|||
public:
|
||||
StateObject();
|
||||
virtual ~StateObject();
|
||||
void action(int id, int state);
|
||||
|
||||
virtual void applyState(){}
|
||||
virtual void removeState();
|
||||
|
@ -64,6 +63,8 @@ public:
|
|||
void removeRenderObject(RenderObject *renderObject);
|
||||
std::string name;
|
||||
|
||||
virtual void action(int actionID, int state, int source) {}
|
||||
|
||||
protected:
|
||||
void registerState(StateObject *sb, const std::string &name);
|
||||
};
|
||||
|
|
173
BBGE/Strings.cpp
173
BBGE/Strings.cpp
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
Copyright (C) 2007, 2010 - Bit-Blot
|
||||
|
||||
This file is part of Aquaria.
|
||||
|
||||
Aquaria is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include "Core.h"
|
||||
|
||||
typedef std::map<std::string, int> InputCodeMap;
|
||||
|
||||
InputCodeMap inputCodeMap;
|
||||
|
||||
void initInputCodeMap()
|
||||
{
|
||||
inputCodeMap["0"] = 0;
|
||||
|
||||
inputCodeMap["KEY_A"] = KEY_A;
|
||||
inputCodeMap["KEY_B"] = KEY_B;
|
||||
inputCodeMap["KEY_C"] = KEY_C;
|
||||
inputCodeMap["KEY_D"] = KEY_D;
|
||||
inputCodeMap["KEY_E"] = KEY_E;
|
||||
inputCodeMap["KEY_F"] = KEY_F;
|
||||
inputCodeMap["KEY_G"] = KEY_G;
|
||||
inputCodeMap["KEY_H"] = KEY_H;
|
||||
inputCodeMap["KEY_I"] = KEY_I;
|
||||
inputCodeMap["KEY_J"] = KEY_J;
|
||||
inputCodeMap["KEY_K"] = KEY_K;
|
||||
inputCodeMap["KEY_L"] = KEY_L;
|
||||
inputCodeMap["KEY_M"] = KEY_M;
|
||||
inputCodeMap["KEY_N"] = KEY_N;
|
||||
inputCodeMap["KEY_O"] = KEY_O;
|
||||
inputCodeMap["KEY_P"] = KEY_P;
|
||||
inputCodeMap["KEY_Q"] = KEY_Q;
|
||||
inputCodeMap["KEY_R"] = KEY_R;
|
||||
inputCodeMap["KEY_S"] = KEY_S;
|
||||
inputCodeMap["KEY_T"] = KEY_T;
|
||||
inputCodeMap["KEY_U"] = KEY_U;
|
||||
inputCodeMap["KEY_V"] = KEY_V;
|
||||
inputCodeMap["KEY_W"] = KEY_W;
|
||||
inputCodeMap["KEY_X"] = KEY_X;
|
||||
inputCodeMap["KEY_Y"] = KEY_Y;
|
||||
inputCodeMap["KEY_Z"] = KEY_Z;
|
||||
|
||||
inputCodeMap["KEY_1"] = KEY_1;
|
||||
inputCodeMap["KEY_2"] = KEY_2;
|
||||
inputCodeMap["KEY_3"] = KEY_3;
|
||||
inputCodeMap["KEY_4"] = KEY_4;
|
||||
inputCodeMap["KEY_5"] = KEY_5;
|
||||
inputCodeMap["KEY_6"] = KEY_6;
|
||||
inputCodeMap["KEY_7"] = KEY_7;
|
||||
inputCodeMap["KEY_8"] = KEY_8;
|
||||
inputCodeMap["KEY_9"] = KEY_9;
|
||||
inputCodeMap["KEY_0"] = KEY_0;
|
||||
|
||||
inputCodeMap["KEY_NUMPAD1"] = KEY_NUMPAD1;
|
||||
inputCodeMap["KEY_NUMPAD2"] = KEY_NUMPAD2;
|
||||
inputCodeMap["KEY_NUMPAD3"] = KEY_NUMPAD3;
|
||||
inputCodeMap["KEY_NUMPAD4"] = KEY_NUMPAD4;
|
||||
inputCodeMap["KEY_NUMPAD5"] = KEY_NUMPAD5;
|
||||
inputCodeMap["KEY_NUMPAD6"] = KEY_NUMPAD6;
|
||||
inputCodeMap["KEY_NUMPAD7"] = KEY_NUMPAD7;
|
||||
inputCodeMap["KEY_NUMPAD8"] = KEY_NUMPAD8;
|
||||
inputCodeMap["KEY_NUMPAD9"] = KEY_NUMPAD9;
|
||||
inputCodeMap["KEY_NUMPAD0"] = KEY_NUMPAD0;
|
||||
|
||||
inputCodeMap["KEY_F1"] = KEY_F1;
|
||||
inputCodeMap["KEY_F2"] = KEY_F2;
|
||||
inputCodeMap["KEY_F3"] = KEY_F3;
|
||||
inputCodeMap["KEY_F4"] = KEY_F4;
|
||||
inputCodeMap["KEY_F5"] = KEY_F5;
|
||||
inputCodeMap["KEY_F6"] = KEY_F6;
|
||||
inputCodeMap["KEY_F7"] = KEY_F7;
|
||||
inputCodeMap["KEY_F8"] = KEY_F8;
|
||||
inputCodeMap["KEY_F9"] = KEY_F9;
|
||||
inputCodeMap["KEY_F10"] = KEY_F10;
|
||||
inputCodeMap["KEY_F11"] = KEY_F11;
|
||||
inputCodeMap["KEY_F12"] = KEY_F12;
|
||||
|
||||
inputCodeMap["KEY_LEFT"] = KEY_LEFT;
|
||||
inputCodeMap["KEY_RIGHT"] = KEY_RIGHT;
|
||||
inputCodeMap["KEY_UP"] = KEY_UP;
|
||||
inputCodeMap["KEY_DOWN"] = KEY_DOWN;
|
||||
|
||||
inputCodeMap["KEY_SPACE"] = KEY_SPACE;
|
||||
inputCodeMap["KEY_LCONTROL"] = KEY_LCONTROL;
|
||||
inputCodeMap["KEY_RCONTROL"] = KEY_RCONTROL;
|
||||
inputCodeMap["KEY_LSHIFT"] = KEY_LSHIFT;
|
||||
inputCodeMap["KEY_RSHIFT"] = KEY_RSHIFT;
|
||||
inputCodeMap["KEY_LMETA"] = KEY_LMETA;
|
||||
inputCodeMap["KEY_RMETA"] = KEY_RMETA;
|
||||
inputCodeMap["KEY_LALT"] = KEY_LALT;
|
||||
inputCodeMap["KEY_RALT"] = KEY_RALT;
|
||||
inputCodeMap["KEY_RETURN"] = KEY_RETURN;
|
||||
inputCodeMap["KEY_TAB"] = KEY_TAB;
|
||||
|
||||
inputCodeMap["KEY_ESCAPE"] = KEY_ESCAPE;
|
||||
|
||||
inputCodeMap["MOUSE_BUTTON_LEFT"] = ActionMapper::MOUSE_BUTTON_LEFT;
|
||||
inputCodeMap["MOUSE_BUTTON_RIGHT"] = ActionMapper::MOUSE_BUTTON_RIGHT;
|
||||
inputCodeMap["MOUSE_BUTTON_MIDDLE"] = ActionMapper::MOUSE_BUTTON_MIDDLE;
|
||||
|
||||
for (int i = 0; i < 17; i++)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os << "JOY_BUTTON_" << i;
|
||||
inputCodeMap[os.str()] = ActionMapper::JOY1_BUTTON_0+i;
|
||||
}
|
||||
}
|
||||
|
||||
void clearInputCodeMap()
|
||||
{
|
||||
inputCodeMap.clear();
|
||||
}
|
||||
|
||||
std::string getInputCodeToString(int key)
|
||||
{
|
||||
for (InputCodeMap::iterator i = inputCodeMap.begin(); i != inputCodeMap.end(); i++)
|
||||
{
|
||||
if ((*i).second == key)
|
||||
{
|
||||
return (*i).first;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
// FIXME: Move stringbank to BBGE and move these strings into it. -- fg
|
||||
|
||||
std::string getInputCodeToUserString(int key)
|
||||
{
|
||||
for (InputCodeMap::iterator i = inputCodeMap.begin(); i != inputCodeMap.end(); i++)
|
||||
{
|
||||
if ((*i).second == key)
|
||||
{
|
||||
std::string use = (*i).first;
|
||||
int idx = 0;
|
||||
idx = use.find("KEY_");
|
||||
if (idx != std::string::npos)
|
||||
{
|
||||
use = use.substr(4, use.size());
|
||||
}
|
||||
if (use == "MOUSE_BUTTON_LEFT")
|
||||
use = "Left Mouse Button";
|
||||
if (use == "MOUSE_BUTTON_RIGHT")
|
||||
use = "Right Mouse Button";
|
||||
if (use == "MOUSE_BUTTON_MIDDLE")
|
||||
use = "Middle Mouse Button";
|
||||
|
||||
return use;
|
||||
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
int getStringToInputCode(const std::string &string)
|
||||
{
|
||||
return inputCodeMap[string];
|
||||
}
|
|
@ -413,6 +413,7 @@ SET(AQUARIA_SRCS
|
|||
${SRCDIR}/GridRender.cpp
|
||||
${SRCDIR}/Hair.cpp
|
||||
${SRCDIR}/Ingredient.cpp
|
||||
${SRCDIR}/InGameMenu.cpp
|
||||
${SRCDIR}/Intro.cpp
|
||||
${SRCDIR}/Logo.cpp
|
||||
${SRCDIR}/Main.cpp
|
||||
|
@ -505,7 +506,6 @@ SET(BBGE_SRCS
|
|||
${BBGEDIR}/SpawnParticleData.cpp
|
||||
${BBGEDIR}/StateMachine.cpp
|
||||
${BBGEDIR}/StateManager.cpp
|
||||
${BBGEDIR}/Strings.cpp
|
||||
${BBGEDIR}/Texture.cpp
|
||||
${BBGEDIR}/TTFFont.cpp
|
||||
${BBGEDIR}/Vector.cpp
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config";"$(SolutionDir)\..\ExternalLibs\gl";"$(SolutionDir)\..\ExternalLibs\glpng\zlib";"$(SolutionDir)\..\ExternalLibs\glpng\png";"$(SolutionDir)\..\ExternalLibs\libogg-1.3.0\include";"$(SolutionDir)\..\ExternalLibs\libvorbis-1.3.3\include";"$(SolutionDir)\..\ExternalLibs\freetype2\include";"$(SolutionDir)\..\ExternalLibs\FTGL\include";"$(SolutionDir)\..\ExternalLibs\SDL2\include";"$(SolutionDir)\..\ExternalLibs\AL\include";"$(SolutionDir)\..\BBGE";"$(SolutionDir)\..\ExternalLibs\lua-5.1.4\src";"$(SolutionDir)\..\ExternalLibs\lvpa\include";"$(SolutionDir)\..\ExternalLibs\lvpa";"$(SolutionDir)\..\ExternalLibs\ttvfs";"$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi";"$(SolutionDir)\..\ExternalLibs""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -124,7 +124,7 @@
|
|||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config";"$(SolutionDir)\..\ExternalLibs\gl";"$(SolutionDir)\..\ExternalLibs\glpng\zlib";"$(SolutionDir)\..\ExternalLibs\glpng\png";"$(SolutionDir)\..\ExternalLibs\libogg-1.3.0\include";"$(SolutionDir)\..\ExternalLibs\libvorbis-1.3.3\include";"$(SolutionDir)\..\ExternalLibs\freetype2\include";"$(SolutionDir)\..\ExternalLibs\FTGL\include";"$(SolutionDir)\..\ExternalLibs\SDL2\include";"$(SolutionDir)\..\ExternalLibs\AL\include";"$(SolutionDir)\..\BBGE";"$(SolutionDir)\..\ExternalLibs\lua-5.1.4\src";"$(SolutionDir)\..\ExternalLibs\lvpa\include";"$(SolutionDir)\..\ExternalLibs\lvpa";"$(SolutionDir)\..\ExternalLibs\ttvfs";"$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi";"$(SolutionDir)\..\ExternalLibs""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;BBGE_BUILD_VFS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -218,14 +218,6 @@
|
|||
RelativePath="..\..\Aquaria\AStar.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\AutoMap.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\AutoMap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\Avatar.cpp"
|
||||
>
|
||||
|
@ -334,6 +326,14 @@
|
|||
RelativePath="..\..\Aquaria\Hair.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\InGameMenu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\InGameMenu.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\Ingredient.cpp"
|
||||
>
|
||||
|
@ -406,6 +406,10 @@
|
|||
RelativePath="..\..\Aquaria\RecipeMenuEntry.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\RecipeMenuEntry.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\Aquaria\resource.h"
|
||||
>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config";"$(SolutionDir)\..\ExternalLibs\gl";"$(SolutionDir)\..\ExternalLibs\glpng\zlib";"$(SolutionDir)\..\ExternalLibs\glpng\png";"$(SolutionDir)\..\ExternalLibs\libogg-1.3.0\include";"$(SolutionDir)\..\ExternalLibs\libvorbis-1.3.3\include";"$(SolutionDir)\..\ExternalLibs\freetype2\include";"$(SolutionDir)\..\ExternalLibs\FTGL\include";"$(SolutionDir)\..\ExternalLibs\SDL2\include";"$(SolutionDir)\..\ExternalLibs\AL\include";"$(SolutionDir)\..\ExternalLibs\ttvfs";"$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi";"$(SolutionDir)\..\ExternalLibs\lvpa";"$(SolutionDir)\..\ExternalLibs\lvpa\include";"$(SolutionDir)\..\ExternalLibs""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="0"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -116,7 +116,7 @@
|
|||
OmitFramePointers="true"
|
||||
EnableFiberSafeOptimizations="true"
|
||||
AdditionalIncludeDirectories=""$(SolutionDir)\..\ExternalLibs\freetype2\include\freetype\config";"$(SolutionDir)\..\ExternalLibs\gl";"$(SolutionDir)\..\ExternalLibs\glpng\zlib";"$(SolutionDir)\..\ExternalLibs\glpng\png";"$(SolutionDir)\..\ExternalLibs\libogg-1.3.0\include";"$(SolutionDir)\..\ExternalLibs\libvorbis-1.3.3\include";"$(SolutionDir)\..\ExternalLibs\freetype2\include";"$(SolutionDir)\..\ExternalLibs\FTGL\include";"$(SolutionDir)\..\ExternalLibs\SDL2\include";"$(SolutionDir)\..\ExternalLibs\AL\include";"$(SolutionDir)\..\ExternalLibs\ttvfs";"$(SolutionDir)\..\ExternalLibs\ttvfs_cfileapi";"$(SolutionDir)\..\ExternalLibs\lvpa";"$(SolutionDir)\..\ExternalLibs\lvpa\include";"$(SolutionDir)\..\ExternalLibs""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GL_GLEXT_LEGACY=1;HAVE_PUTENV=1;FTGL_LIBRARY_STATIC;_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;BBGE_BUILD_WINDOWS=1;_HAS_EXCEPTIONS=0;VFS_ENABLE_C_API=1;BBGE_USE_GLM=1;AQUARIA_INTERNAL_FTGL=1;BBGE_BUILD_SDL2"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -488,10 +488,6 @@
|
|||
RelativePath="..\..\BBGE\StateManager.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\BBGE\Strings.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\BBGE\Texture.cpp"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue