1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-25 01:36:38 +00:00
Aquaria/Aquaria/GameStructs.h

204 lines
3.8 KiB
C
Raw Normal View History

#ifndef GAMESTRUCTS_H
#define GAMESTRUCTS_H
#include <vector>
#include <string>
#include "Vector.h"
#include "GameEnums.h"
class Path;
struct EmoteData
{
EmoteData()
{
index = -1; variations = 0;
}
int index;
std::string name;
int variations;
};
struct GemData
{
GemData() { canMove=false; blink = false; global = false; isPlayer = false; id = -1; }
std::string name;
std::string userString;
std::string mapName;
Vector pos;
bool canMove;
bool blink; // not saved on older versions
Worldmap overhaul, part 1 In short: - No more grid-for-alpha; everything uses generated textures now (With proper bilinear filtering so it looks like the old method) - All tiles are now shown partially uncovered at the same time; selecting one is no longer needed - Gems can now be local (associated to a tile) or global. Local games move with their tile, global ones stay where they were placed Background: Originally there were two possible implementations of how to render the world map: - One used write-alpha-to-texture to implement graual uncovering. - The other (permanently enabled) used the DrawGrid to render the map tiles as a fine grid, each little square having its own alpha value The downside of the first method was that it didn't look as good as the second, so i guess that's why it was never fully finished. The main downside of the second method was that it burned a lot of vertices just to do alpha, so only one tile at a time could show the detailed grid. I also never liked how an entire tile was effectively fully uncovered once the map was first entered, taking away a lot of the exploration feeling that could have been there if everything that hasn't been explored would be completely invisible. I've added this worldmap uncovering method as an optional config param, <WorldMap revealMethod="1"/> but i've decided to fully switch over now. Things left to be done: - create a WorldMapRender instance only once and keep the tiles across map loads - add debug option to reload/recreate worldmap at runtime - cleanup gem storage and carry over the player gem properly (ged rid of std::list) - remove "worldmap" grid render type - Add more user "pyramid" gems as world map markers. More colors! - check that gems and beacons still work as they should
2024-11-15 02:12:14 +00:00
bool global; // local gems use their parent container's coordinate system, global gems are placed directly on the map screen
bool isPlayer;
int id; // used to identify a gem via scripts
};
struct BeaconData
{
BeaconData(){ index=-1; on=0; }
int index;
Vector pos,color;
bool on;
};
struct PetData
{
std::string namePart;
};
struct TreasureDataEntry
{
TreasureDataEntry() { sz = 1; use = 0;}
std::string gfx;
float sz;
int use;
};
struct FoodSortOrder
{
FoodSortOrder(IngredientType t, IngredientEffectType et = IET_NONE, std::string name="", int effectAmount=0)
{ type = t; effectType = et; this->name = name; this->effectAmount=effectAmount;}
FoodSortOrder() { type = IT_NONE; effectType = IET_NONE; }
std::string name;
IngredientType type;
IngredientEffectType effectType;
int effectAmount;
};
struct EatData
{
EatData() { ammoUnitSize=getUnits=1; health=0; ammo=1;}
std::string name, shot;
int ammoUnitSize, getUnits, ammo;
float health;
};
struct PECue
{
PECue(std::string name, Vector pos, float rot, float t)
: name(name), pos(pos), rot(rot), t(t) {}
std::string name;
Vector pos;
float rot;
float t;
};
struct RecipeType
{
RecipeType(IngredientType type, const std::string &typeName) : type(type), amount(1) { this->typeName = typeName; }
RecipeType() { amount = 1; type = IT_NONE; }
IngredientType type;
int amount;
std::string typeName;
};
struct RecipeName
{
RecipeName(const std::string &name) : name(name), amount(1) {}
RecipeName() : amount(1) {}
std::string name;
int amount;
};
class Recipe
{
public:
Recipe();
std::vector<RecipeType> types;
std::vector<RecipeName> names;
std::string result;
std::string resultDisplayName;
int index;
void addName(const std::string &name);
void addType(IngredientType type, const std::string &typeName);
void clear();
void learn();
bool isKnown() { return known; }
protected:
bool known;
};
typedef std::vector<int> SongNotes;
struct Song
{
Song() { index=0; script=0; }
int index;
SongNotes notes;
int script;
};
class Emote
{
public:
Emote();
void load(const std::string &file);
void playSfx(size_t index);
void update(float dt);
float emoteTimer;
int lastVariation;
typedef std::vector<EmoteData> Emotes;
Emotes emotes;
};
struct IngredientEffect
{
IngredientEffect() : magnitude(0), type(IET_NONE) {}
float magnitude;
IngredientEffectType type;
std::string string;
};
class IngredientData
{
public:
IngredientData(const std::string &name, const std::string &gfx, IngredientType type);
int getIndex() const;
const std::string name, gfx;
std::string displayName;
const IngredientType type;
int amount;
int maxAmount;
int held;
int marked;
bool sorted;
bool rotKind;
bool hasIET(IngredientEffectType iet);
typedef std::vector<IngredientEffect> IngredientEffects;
IngredientEffects effects;
private:
// ensure that IngredientData instances are never copied:
IngredientData(const IngredientData&);
const IngredientData& operator=(const IngredientData&);
};
typedef std::vector<IngredientData*> IngredientDatas;
struct UnderWaterResult
{
bool uw;
Path *waterbubble;
};
class ObsRow
{
public:
inline ObsRow(unsigned tx, unsigned ty, unsigned len)
: tx(tx), ty(ty), len(len) {}
inline ObsRow(const ObsRow& o)
: tx(o.tx), ty(o.ty), len(o.len) {}
const unsigned tx, ty, len;
};
#endif