Apparently it had only been applied to .cpp files until now.
Also added `AccessModifierOffset: -4` in the configuration.
BasedOnStyle: Mozilla
---
Language: Cpp
+AccessModifierOffset: -4
AllowShortIfStatementsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
#include <vector>
-enum anim_attack_type {
- neutral, normalattack, reversed, reversal
+enum anim_attack_type
+{
+ neutral,
+ normalattack,
+ reversed,
+ reversal
};
-enum anim_height_type {
- lowheight, middleheight, highheight
+enum anim_height_type
+{
+ lowheight,
+ middleheight,
+ highheight
};
-enum animation_type {
+enum animation_type
+{
#define DECLARE_ANIM(id, ...) id,
#include "Animation.def"
#undef DECLARE_ANIM
animation_count
};
-enum animation_bit_offsets {
+enum animation_bit_offsets
+{
#define DECLARE_ANIM_BIT(bit) o_##bit,
#include "Animation.def"
#undef DECLARE_ANIM_BIT
animation_bit_count
};
-enum animation_bits_def {
+enum animation_bits_def
+{
#define DECLARE_ANIM_BIT(bit) bit = 1 << o_##bit,
#include "Animation.def"
#undef DECLARE_ANIM_BIT
struct AnimationFrameJointInfo
{
- XYZ position;
+ XYZ position;
float twist;
float twist2;
bool onground;
#include <vector>
-enum bodypart {
- head, neck,
- leftshoulder, leftelbow, leftwrist, lefthand,
- rightshoulder, rightelbow, rightwrist, righthand,
- abdomen, lefthip, righthip, groin,
- leftknee, leftankle, leftfoot,
- rightknee, rightankle, rightfoot
+enum bodypart
+{
+ head,
+ neck,
+ leftshoulder,
+ leftelbow,
+ leftwrist,
+ lefthand,
+ rightshoulder,
+ rightelbow,
+ rightwrist,
+ righthand,
+ abdomen,
+ lefthip,
+ righthip,
+ groin,
+ leftknee,
+ leftankle,
+ leftfoot,
+ rightknee,
+ rightankle,
+ rightfoot
};
class Joint
#include <vector>
-enum muscle_type {boneconnect, constraint, muscle};
+enum muscle_type
+{
+ boneconnect,
+ constraint,
+ muscle
+};
class Muscle
{
#include "Animation/Animation.hpp"
#include "Animation/Joint.hpp"
#include "Animation/Muscle.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Models.hpp"
#include "Graphic/Sprite.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/XYZ.hpp"
#include "Objects/Object.hpp"
#include "Utils/binio.h"
bool freefall;
void FindForwards();
- float DoConstraints(XYZ *coords, float *scale);
- void DoGravity(float *scale);
+ float DoConstraints(XYZ* coords, float* scale);
+ void DoGravity(float* scale);
void FindRotationJoint(int which);
void FindRotationJointSameTwist(int which);
void FindRotationMuscle(int which, int animation);
inline Joint& joint(int bodypart) { return joints[jointlabels[bodypart]]; }
inline XYZ& jointPos(int bodypart) { return joint(bodypart).position; }
inline XYZ& jointVel(int bodypart) { return joint(bodypart).velocity; }
-
};
#endif
#include "Math/XYZ.hpp"
-enum sound_type {
+enum sound_type
+{
#define DECLARE_SOUND(id, filename) id,
#include "Sounds.def"
#undef DECLARE_SOUND
sounds_count
};
-extern struct OPENAL_SAMPLE *samp[sounds_count];
+extern struct OPENAL_SAMPLE* samp[sounds_count];
extern int channels[];
extern void loadAllSounds();
extern void addEnvSound(XYZ coords, float vol = 16, float life = .4);
-extern void emit_sound_at(int soundid, const XYZ &pos = XYZ(), float vol = 256.f);
+extern void emit_sound_at(int soundid, const XYZ& pos = XYZ(), float vol = 256.f);
extern void emit_sound_np(int soundid, float vol = 256.f);
-extern void emit_stream_at(int soundid, const XYZ &pos = XYZ(), float vol = 256.f);
+extern void emit_stream_at(int soundid, const XYZ& pos = XYZ(), float vol = 256.f);
extern void emit_stream_np(int soundid, float vol = 256.f);
extern void resume_stream(int soundid);
extern void pause_sound(int soundid);
#include "Platform/Platform.hpp"
#ifdef __APPLE__
- #include <OpenAL/al.h>
- #include <OpenAL/alc.h>
+#include <OpenAL/al.h>
+#include <OpenAL/alc.h>
#else
- #include <AL/al.h>
- #include <AL/alc.h>
+#include <AL/al.h>
+#include <AL/alc.h>
#endif
#include <ogg/ogg.h>
#endif /* DLL_EXPORTS */
#endif /* if 0 */
+typedef struct OPENAL_SAMPLE OPENAL_SAMPLE;
+typedef OPENAL_SAMPLE OPENAL_STREAM;
+typedef struct OPENAL_DSPUNIT OPENAL_DSPUNIT;
-typedef struct OPENAL_SAMPLE OPENAL_SAMPLE;
-typedef OPENAL_SAMPLE OPENAL_STREAM;
-typedef struct OPENAL_DSPUNIT OPENAL_DSPUNIT;
-
-#define OPENAL_LOOP_OFF 0x00000001 /* For non looping samples. */
-#define OPENAL_LOOP_NORMAL 0x00000002 /* For forward looping samples. */
-#define OPENAL_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */
-#define OPENAL_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */
-#define OPENAL_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */
-#define OPENAL_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */
+#define OPENAL_LOOP_OFF 0x00000001 /* For non looping samples. */
+#define OPENAL_LOOP_NORMAL 0x00000002 /* For forward looping samples. */
+#define OPENAL_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */
+#define OPENAL_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */
+#define OPENAL_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */
+#define OPENAL_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */
#ifdef __cplusplus
extern "C" {
#undef AL_API
#define AL_API
- AL_API void OPENAL_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
- AL_API signed char OPENAL_3D_SetAttributes(int channel, const float *pos);
- AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ &pos);
- AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
- AL_API void OPENAL_Close();
- AL_API OPENAL_SAMPLE *OPENAL_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length);
- AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE *sptr);
- AL_API signed char OPENAL_SetFrequency(int channel, bool slomo = false);
- AL_API signed char OPENAL_SetVolume(int channel, int vol);
- AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
- AL_API void OPENAL_SetSFXMasterVolume(int volume);
- AL_API signed char OPENAL_StopSound(int channel);
- AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM *stream, unsigned int mode);
- AL_API void OPENAL_Update();
- void PlaySoundEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
- void PlayStreamEx(int chan, OPENAL_SAMPLE *sptr, OPENAL_DSPUNIT *dsp, signed char startpaused);
+AL_API void OPENAL_3D_Listener_SetAttributes(const float* pos, const float* vel, float fx, float fy, float fz, float tx, float ty, float tz);
+AL_API signed char OPENAL_3D_SetAttributes(int channel, const float* pos);
+AL_API signed char OPENAL_3D_SetAttributes_(int channel, const XYZ& pos);
+AL_API signed char OPENAL_Init(int mixrate, int maxsoftwarechannels, unsigned int flags);
+AL_API void OPENAL_Close();
+AL_API OPENAL_SAMPLE* OPENAL_Sample_Load(int index, const char* name_or_data, unsigned int mode, int offset, int length);
+AL_API void OPENAL_Sample_Free(OPENAL_SAMPLE* sptr);
+AL_API signed char OPENAL_SetFrequency(int channel, bool slomo = false);
+AL_API signed char OPENAL_SetVolume(int channel, int vol);
+AL_API signed char OPENAL_SetPaused(int channel, signed char paused);
+AL_API void OPENAL_SetSFXMasterVolume(int volume);
+AL_API signed char OPENAL_StopSound(int channel);
+AL_API signed char OPENAL_Stream_SetMode(OPENAL_STREAM* stream, unsigned int mode);
+AL_API void OPENAL_Update();
+void PlaySoundEx(int chan, OPENAL_SAMPLE* sptr, OPENAL_DSPUNIT* dsp, signed char startpaused);
+void PlayStreamEx(int chan, OPENAL_SAMPLE* sptr, OPENAL_DSPUNIT* dsp, signed char startpaused);
#ifdef __cplusplus
}
along with Lugaru. If not, see <http://www.gnu.org/licenses/>.
*/
-typedef void (*console_handler)(const char *args);
+typedef void (*console_handler)(const char* args);
-#define DECLARE_COMMAND(cmd) void ch_##cmd(const char *args);
+#define DECLARE_COMMAND(cmd) void ch_##cmd(const char* args);
#include "ConsoleCmds.def"
-#undef DECLARE_COMMAND
+#undef DECLARE_COMMAND
/* FIXME - This is only to get cmd_count, not very clean */
-enum console_command {
+enum console_command
+{
#define DECLARE_COMMAND(cmd) cmd_##cmd,
#include "ConsoleCmds.def"
#undef DECLARE_COMMAND
cmd_count
};
-extern const char *cmd_names[cmd_count];
+extern const char* cmd_names[cmd_count];
extern console_handler cmd_handlers[cmd_count];
int attach;
XYZ location;
inline void setColors(GLfloat cr, GLfloat cg, GLfloat cb,
- GLfloat ar, GLfloat ag, GLfloat ab) {
+ GLfloat ar, GLfloat ag, GLfloat ab)
+ {
color[0] = cr;
color[1] = cg;
color[2] = cb;
#ifndef _SKYBOX_HPP_
#define _SKYBOX_HPP_
-#include "Graphic/gamegl.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/XYZ.hpp"
#include "Math/XYZ.hpp"
#include "Utils/ImageIO.hpp"
Texture front, left, back, right, up, down;
void load(const std::string& ffront, const std::string& fleft, const std::string& fback,
- const std::string& fright, const std::string& fup, const std::string& fdown);
+ const std::string& fright, const std::string& fup, const std::string& fdown);
void draw();
SkyBox() {}
#include "Environment/Lights.hpp"
#include "Graphic/Decal.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/Frustum.hpp"
#include "Math/XYZ.hpp"
#include "Utils/ImageIO.hpp"
-#define max_terrain_size 256
-#define curr_terrain_size size
-#define subdivision 64
-#define max_patch_elements (max_terrain_size/subdivision)*(max_terrain_size/subdivision)*54
+#define max_terrain_size 256
+#define curr_terrain_size size
+#define subdivision 64
+#define max_patch_elements (max_terrain_size / subdivision) * (max_terrain_size / subdivision) * 54
#define allfirst 0
#define mixed 1
int numtris[subdivision][subdivision];
int textureness[subdivision][subdivision];
- GLfloat vArray[(max_patch_elements)*subdivision*subdivision];
+ GLfloat vArray[(max_patch_elements)*subdivision * subdivision];
bool visible[subdivision][subdivision];
float avgypatch[subdivision][subdivision];
void DeleteDecal(int which);
void MakeDecal(decal_type type, XYZ where, float size, float opacity, float rotation);
void MakeDecalLock(decal_type type, XYZ where, int whichx, int whichy, float size, float opacity, float rotation);
- int lineTerrain(XYZ p1, XYZ p2, XYZ *p);
+ int lineTerrain(XYZ p1, XYZ p2, XYZ* p);
float getHeight(float pointx, float pointz);
float getOpacity(float pointx, float pointz);
XYZ getLighting(float pointx, float pointz);
#include "Environment/Lights.hpp"
#include "Environment/Skybox.hpp"
#include "Environment/Terrain.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Models.hpp"
#include "Graphic/Sprite.hpp"
#include "Graphic/Stereo.hpp"
#include "Graphic/Text.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Objects/Object.hpp"
#include "Objects/Person.hpp"
#include "Objects/Weapons.hpp"
#include "Thirdparty/optionparser.h"
#include "User/Account.hpp"
-#include "Utils/binio.h"
#include "Utils/ImageIO.hpp"
+#include "Utils/binio.h"
-#include <fstream>
#include <SDL.h>
+#include <fstream>
#define NB_CAMPAIGN_MENU_ITEM 7
extern int mousecoordh, mousecoordv;
extern int oldmousecoordh, oldmousecoordv;
extern float yaw, pitch;
-extern SkyBox *skybox;
+extern SkyBox* skybox;
extern bool cameramode;
extern bool firstLoadDone;
extern XYZ mapcenter;
extern float mapradius;
-extern Text *text;
-extern Text *textmono;
+extern Text* text;
+extern Text* textmono;
extern float fps;
extern bool editorenabled;
float sq(float n);
#ifndef __forceinline
-# ifdef __GNUC__
-# define __forceinline inline __attribute__((always_inline))
-# endif
+#ifdef __GNUC__
+#define __forceinline inline __attribute__((always_inline))
+#endif
#endif
static __forceinline void swap_gl_buffers(void)
{
- extern SDL_Window *sdlwindow;
+ extern SDL_Window* sdlwindow;
SDL_GL_SwapWindow(sdlwindow);
// try to limit this to 60fps, even if vsync fails.
Uint32 now;
static Uint32 frameticks = 0;
const Uint32 endticks = (frameticks + 16);
- while ((now = SDL_GetTicks()) < endticks) { /* spin. */ }
+ while ((now = SDL_GetTicks()) < endticks) { /* spin. */
+ }
frameticks = now;
}
-enum maptypes {
- mapkilleveryone, mapgosomewhere,
- mapkillsomeone, mapkillmost // These two are unused
+enum maptypes
+{
+ mapkilleveryone,
+ mapgosomewhere,
+ mapkillsomeone,
+ mapkillmost // These two are unused
};
-enum pathtypes {wpkeepwalking, wppause};
-
-extern const char *pathtypenames[2];
+enum pathtypes
+{
+ wpkeepwalking,
+ wppause
+};
-enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
- typedead1, typedead2, typedead3, typedead4
- };
+extern const char* pathtypenames[2];
-extern const char *editortypenames[8];
+enum editortypes
+{
+ typeactive,
+ typesitting,
+ typesittingwall,
+ typesleeping,
+ typedead1,
+ typedead2,
+ typedead3,
+ typedead4
+};
-SDL_bool sdlEventProc(const SDL_Event &e);
+extern const char* editortypenames[8];
+SDL_bool sdlEventProc(const SDL_Event& e);
-enum optionIndex { UNKNOWN, VERSION, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS, DEVTOOLS };
+enum optionIndex
+{
+ UNKNOWN,
+ VERSION,
+ HELP,
+ FULLSCREEN,
+ NOMOUSEGRAB,
+ SOUND,
+ OPENALINFO,
+ SHOWRESOLUTIONS,
+ DEVTOOLS
+};
/* Number of options + 1 */
const int commandLineOptionsNumber = 10;
#include "Math/XYZ.hpp"
-enum decal_type {
+enum decal_type
+{
shadowdecal = 0,
footprintdecal = 1,
blooddecal = 2,
#define _MODELS_HPP_
#include "Environment/Terrain.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/XYZ.hpp"
#include "Utils/binio.h"
//
// Textures List
//
-typedef struct {
+typedef struct
+{
long xsz, ysz;
- GLubyte *txt;
+ GLubyte* txt;
} ModelTexture;
//
Model();
~Model();
void DeleteDecal(int which);
- void MakeDecal(decal_type atype, XYZ *where, float *size, float *opacity, float *rotation);
+ void MakeDecal(decal_type atype, XYZ* where, float* size, float* opacity, float* rotation);
void MakeDecal(decal_type atype, XYZ where, float size, float opacity, float rotation);
const XYZ& getTriangleVertex(unsigned triangleId, unsigned vertexId) const;
void drawdecals(Texture shadowtexture, Texture bloodtexture, Texture bloodtexture2, Texture breaktexture);
- int SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate);
- int SphereCheckPossible(XYZ *p1, float radius, XYZ *move, float *rotate);
- int LineCheck(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
- int LineCheckPossible(XYZ *p1, XYZ *p2, XYZ *p, XYZ *move, float *rotate);
- int LineCheckSlidePossible(XYZ *p1, XYZ *p2, XYZ *move, float *rotate);
+ int SphereCheck(XYZ* p1, float radius, XYZ* p, XYZ* move, float* rotate);
+ int SphereCheckPossible(XYZ* p1, float radius, XYZ* move, float* rotate);
+ int LineCheck(XYZ* p1, XYZ* p2, XYZ* p, XYZ* move, float* rotate);
+ int LineCheckPossible(XYZ* p1, XYZ* p2, XYZ* p, XYZ* move, float* rotate);
+ int LineCheckSlidePossible(XYZ* p1, XYZ* p2, XYZ* move, float* rotate);
void UpdateVertexArray();
void UpdateVertexArrayNoTex();
void UpdateVertexArrayNoTexNoNorm();
#include "Environment/Lights.hpp"
#include "Environment/Terrain.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/Frustum.hpp"
#include "Math/XYZ.hpp"
#include "Objects/Object.hpp"
#define max_sprites 20000
-enum {
+enum
+{
cloudsprite = 0,
bloodsprite,
flamesprite,
static void DeleteSprite(int which);
static void MakeSprite(int atype, XYZ where, XYZ avelocity, float red, float green, float blue, float asize, float aopacity);
static void Draw();
- static void deleteSprites() {
+ static void deleteSprites()
+ {
sprites.clear();
}
- static void setLastSpriteSpecial(int s) {
+ static void setLastSpriteSpecial(int s)
+ {
sprites.back()->special = s;
}
- static void setLastSpriteSpeed(int s) {
+ static void setLastSpriteSpeed(int s)
+ {
sprites.back()->speed = s;
}
- static void setLastSpriteAlivetime(float al) {
+ static void setLastSpriteAlivetime(float al)
+ {
sprites.back()->alivetime = al;
}
#include <string>
-enum StereoMode {
+enum StereoMode
+{
stereoNone,
stereoAnaglyph, /* red/cyan */
stereoHorizontalInterlaced, /* some 3D monitors */
stereoVerticalInterlaced,
- stereoHorizontalSplit, /* cross-eyed view */
+ stereoHorizontalSplit, /* cross-eyed view */
stereoVerticalSplit,
- stereoOpenGL, /* Whatever OpenGL does, if supported */
- stereoCount /* must be last element */
+ stereoOpenGL, /* Whatever OpenGL does, if supported */
+ stereoCount /* must be last element */
};
-
-enum StereoSide {
+enum StereoSide
+{
// Code multiplies by StereoSide to calculate camera offsets
- stereoLeft = -1,
+ stereoLeft = -1,
stereoCenter = 0,
- stereoRight = 1
+ stereoRight = 1
};
extern StereoMode stereomode;
extern StereoMode newstereomode;
extern float stereoseparation;
-extern bool stereoreverse;
+extern bool stereoreverse;
bool CanInitStereo(StereoMode mode);
void InitStereo(StereoMode mode);
#ifndef _TEXT_HPP_
#define _TEXT_HPP_
-#include "Graphic/gamegl.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/XYZ.hpp"
#include "Utils/ImageIO.hpp"
#include "Graphic/gamegl.hpp"
#include <map>
+#include <memory>
#include <string>
#include <vector>
-#include <memory>
class TextureRes
{
/* Make sure TextureRes never gets copied */
TextureRes(TextureRes const& other) = delete;
- TextureRes & operator=(TextureRes const& other) = delete;
+ TextureRes& operator=(TextureRes const& other) = delete;
};
class Texture
{
private:
std::shared_ptr<TextureRes> tex;
+
public:
- inline Texture(): tex(nullptr) {}
+ inline Texture()
+ : tex(nullptr)
+ {
+ }
void load(const string& filename, bool hasMipmap);
void load(const string& filename, bool hasMipmap, GLubyte* array, int* skinsizep);
void bind();
#include <string>
#ifdef WIN32
- #define WIN32_LEAN_AND_MEAN
- #define Polygon WinPolygon
- #include <windows.h>
- #undef Polygon
+#define WIN32_LEAN_AND_MEAN
+#define Polygon WinPolygon
+#include <windows.h>
+#undef Polygon
#endif
#define GL_GLEXT_PROTOTYPES 1
#ifdef __APPLE__
- #include <OpenGL/gl.h>
- #include <OpenGL/glu.h>
- #include <OpenGL/glext.h>
+#include <OpenGL/gl.h>
+#include <OpenGL/glext.h>
+#include <OpenGL/glu.h>
#else
- #include <GL/gl.h>
- #include <GL/glu.h>
- #include <GL/glext.h>
+#include <GL/gl.h>
+#include <GL/glext.h>
+#include <GL/glu.h>
#endif
using namespace std;
/* !!! FIXME: until we replace logger better. --ryan. */
#define LOGFUNC
-void LOG(const std::string &fmt, ...);
+void LOG(const std::string& fmt, ...);
#endif
-
-
#ifndef _AWARDS_HPP_
#define _AWARDS_HPP_
-enum bonus_types {
+enum bonus_types
+{
#define DECLARE_BONUS(id, ...) id,
#include "Bonuses.def"
#undef DECLARE_BONUS
bonus_count
};
-extern const char *bonus_names[bonus_count];
+extern const char* bonus_names[bonus_count];
extern int bonus;
extern int bonusvalue;
extern void award_bonus(int playerid, int bonusid, int alt_value = 0);
-enum award_types {
+enum award_types
+{
#define DECLARE_AWARD(id, name) id,
#include "Awards.def"
#undef DECLARE_AWARD
award_count
};
-extern const char *award_names[award_count];
+extern const char* award_names[award_count];
-extern int award_awards(int *);
+extern int award_awards(int*);
extern float damagetaken;
extern int numfalls;
extern int numattacks;
extern int maxalarmed;
#endif
-
{
private:
int width;
- struct Position {
+ struct Position
+ {
int x, y;
};
+
public:
std::string mapname;
std::string description;
int getEndY();
XYZ getCenter();
int getWidth();
- std::istream& operator<< (std::istream& is);
- friend std::istream& operator>> (std::istream& is, CampaignLevel& cl) {
+ std::istream& operator<<(std::istream& is);
+ friend std::istream& operator>>(std::istream& is, CampaignLevel& cl)
+ {
return cl << is;
}
};
{
public:
DialogScene(FILE* tfile);
- DialogScene(ifstream &ipstream);
+ DialogScene(ifstream& ipstream);
void save(FILE* tfile);
int location;
XYZ position;
int type;
float size;
- char text[256] = {0};
+ char text[256] = { 0 };
};
#endif
float x;
float y;
float z;
- XYZ() : x(0.0f), y(0.0f), z(0.0f) {}
+ XYZ()
+ : x(0.0f)
+ , y(0.0f)
+ , z(0.0f)
+ {
+ }
inline XYZ operator+(XYZ add);
inline XYZ operator-(XYZ add);
inline XYZ operator*(float add);
inline bool operator==(XYZ add);
};
-inline void CrossProduct(XYZ *P, XYZ *Q, XYZ *V);
-inline void CrossProduct(XYZ P, XYZ Q, XYZ *V);
-inline void Normalise(XYZ *vectory);
+inline void CrossProduct(XYZ* P, XYZ* Q, XYZ* V);
+inline void CrossProduct(XYZ P, XYZ Q, XYZ* V);
+inline void Normalise(XYZ* vectory);
inline float normaldotproduct(XYZ point1, XYZ point2);
-inline float fast_sqrt (register float arg);
-bool PointInTriangle(XYZ *p, XYZ normal, XYZ *p1, XYZ *p2, XYZ *p3);
-bool LineFacet(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p);
-float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ *p);
-float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ n, XYZ *p);
-float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *n, XYZ *p);
-float LineFacetd(XYZ *p1, XYZ *p2, XYZ *pa, XYZ *pb, XYZ *pc, XYZ *p);
-inline void ReflectVector(XYZ *vel, const XYZ *n);
-inline void ReflectVector(XYZ *vel, const XYZ &n);
+inline float fast_sqrt(register float arg);
+bool PointInTriangle(XYZ* p, XYZ normal, XYZ* p1, XYZ* p2, XYZ* p3);
+bool LineFacet(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ* p);
+float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ* p);
+float LineFacetd(XYZ p1, XYZ p2, XYZ pa, XYZ pb, XYZ pc, XYZ n, XYZ* p);
+float LineFacetd(XYZ* p1, XYZ* p2, XYZ* pa, XYZ* pb, XYZ* pc, XYZ* n, XYZ* p);
+float LineFacetd(XYZ* p1, XYZ* p2, XYZ* pa, XYZ* pb, XYZ* pc, XYZ* p);
+inline void ReflectVector(XYZ* vel, const XYZ* n);
+inline void ReflectVector(XYZ* vel, const XYZ& n);
inline XYZ DoRotation(XYZ thePoint, float xang, float yang, float zang);
inline XYZ DoRotationRadian(XYZ thePoint, float xang, float yang, float zang);
-inline float findDistance(XYZ *point1, XYZ *point2);
-inline float findLength(XYZ *point1);
-inline float findLengthfast(XYZ *point1);
-inline float distsq(XYZ *point1, XYZ *point2);
+inline float findDistance(XYZ* point1, XYZ* point2);
+inline float findLength(XYZ* point1);
+inline float findLengthfast(XYZ* point1);
+inline float distsq(XYZ* point1, XYZ* point2);
inline float distsq(XYZ point1, XYZ point2);
-inline float distsqflat(XYZ *point1, XYZ *point2);
-inline float dotproduct(const XYZ *point1, const XYZ *point2);
-bool sphere_line_intersection (
- float x1, float y1 , float z1,
- float x2, float y2 , float z2,
- float x3, float y3 , float z3, float r );
-bool sphere_line_intersection (
- XYZ *p1, XYZ *p2, XYZ *p3, float *r );
-inline bool DistancePointLine( XYZ *Point, XYZ *LineStart, XYZ *LineEnd, float *Distance, XYZ *Intersection );
-
-
-inline void Normalise(XYZ *vectory)
+inline float distsqflat(XYZ* point1, XYZ* point2);
+inline float dotproduct(const XYZ* point1, const XYZ* point2);
+bool sphere_line_intersection(
+ float x1, float y1, float z1,
+ float x2, float y2, float z2,
+ float x3, float y3, float z3, float r);
+bool sphere_line_intersection(
+ XYZ* p1, XYZ* p2, XYZ* p3, float* r);
+inline bool DistancePointLine(XYZ* Point, XYZ* LineStart, XYZ* LineEnd, float* Distance, XYZ* Intersection);
+
+inline void Normalise(XYZ* vectory)
{
static float d;
d = fast_sqrt(vectory->x * vectory->x + vectory->y * vectory->y + vectory->z * vectory->z);
return 0;
}
-inline void CrossProduct(XYZ *P, XYZ *Q, XYZ *V)
+inline void CrossProduct(XYZ* P, XYZ* Q, XYZ* V)
{
V->x = P->y * Q->z - P->z * Q->y;
V->y = P->z * Q->x - P->x * Q->z;
V->z = P->x * Q->y - P->y * Q->x;
}
-inline void CrossProduct(XYZ P, XYZ Q, XYZ *V)
+inline void CrossProduct(XYZ P, XYZ Q, XYZ* V)
{
V->x = P.y * Q.z - P.z * Q.y;
V->y = P.z * Q.x - P.x * Q.z;
V->z = P.x * Q.y - P.y * Q.x;
}
-inline float fast_sqrt (register float arg)
+inline float fast_sqrt(register float arg)
{
return sqrtf(arg);
}
return returnvalue;
}
-inline void ReflectVector(XYZ *vel, const XYZ *n)
+inline void ReflectVector(XYZ* vel, const XYZ* n)
{
ReflectVector(vel, *n);
}
-inline void ReflectVector(XYZ *vel, const XYZ &n)
+inline void ReflectVector(XYZ* vel, const XYZ& n)
{
static XYZ vn;
static XYZ vt;
vel->z = vt.z - vn.z;
}
-inline float dotproduct(const XYZ *point1, const XYZ *point2)
+inline float dotproduct(const XYZ* point1, const XYZ* point2)
{
static GLfloat returnvalue;
returnvalue = (point1->x * point2->x + point1->y * point2->y + point1->z * point2->z);
return returnvalue;
}
-inline float findDistance(XYZ *point1, XYZ *point2)
+inline float findDistance(XYZ* point1, XYZ* point2)
{
- return(fast_sqrt((point1->x - point2->x) * (point1->x - point2->x) + (point1->y - point2->y) * (point1->y - point2->y) + (point1->z - point2->z) * (point1->z - point2->z)));
+ return (fast_sqrt((point1->x - point2->x) * (point1->x - point2->x) + (point1->y - point2->y) * (point1->y - point2->y) + (point1->z - point2->z) * (point1->z - point2->z)));
}
-inline float findLength(XYZ *point1)
+inline float findLength(XYZ* point1)
{
- return(fast_sqrt((point1->x) * (point1->x) + (point1->y) * (point1->y) + (point1->z) * (point1->z)));
+ return (fast_sqrt((point1->x) * (point1->x) + (point1->y) * (point1->y) + (point1->z) * (point1->z)));
}
-
-inline float findLengthfast(XYZ *point1)
+inline float findLengthfast(XYZ* point1)
{
- return((point1->x) * (point1->x) + (point1->y) * (point1->y) + (point1->z) * (point1->z));
+ return ((point1->x) * (point1->x) + (point1->y) * (point1->y) + (point1->z) * (point1->z));
}
-inline float distsq(XYZ *point1, XYZ *point2)
+inline float distsq(XYZ* point1, XYZ* point2)
{
- return((point1->x - point2->x) * (point1->x - point2->x) + (point1->y - point2->y) * (point1->y - point2->y) + (point1->z - point2->z) * (point1->z - point2->z));
+ return ((point1->x - point2->x) * (point1->x - point2->x) + (point1->y - point2->y) * (point1->y - point2->y) + (point1->z - point2->z) * (point1->z - point2->z));
}
inline float distsq(XYZ point1, XYZ point2)
{
- return((point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y) * (point1.y - point2.y) + (point1.z - point2.z) * (point1.z - point2.z));
+ return ((point1.x - point2.x) * (point1.x - point2.x) + (point1.y - point2.y) * (point1.y - point2.y) + (point1.z - point2.z) * (point1.z - point2.z));
}
-inline float distsqflat(XYZ *point1, XYZ *point2)
+inline float distsqflat(XYZ* point1, XYZ* point2)
{
- return((point1->x - point2->x) * (point1->x - point2->x) + (point1->z - point2->z) * (point1->z - point2->z));
+ return ((point1->x - point2->x) * (point1->x - point2->x) + (point1->z - point2->z) * (point1->z - point2->z));
}
inline XYZ DoRotation(XYZ thePoint, float xang, float yang, float zang)
zang /= 360;
}
-
if (yang) {
newpoint.z = thePoint.z * cosf(yang) - thePoint.x * sinf(yang);
newpoint.x = thePoint.z * sinf(yang) + thePoint.x * cosf(yang);
return thePoint;
}
-inline float square( float f )
+inline float square(float f)
{
- return (f * f) ;
+ return (f * f);
}
-inline bool sphere_line_intersection (
- float x1, float y1 , float z1,
- float x2, float y2 , float z2,
- float x3, float y3 , float z3, float r )
+inline bool sphere_line_intersection(
+ float x1, float y1, float z1,
+ float x2, float y2, float z2,
+ float x3, float y3, float z3, float r)
{
// x1,y1,z1 P1 coordinates (point of line)
// the number of intersection point, followed by coordinate pairs.
//~ static float x , y , z;
- static float a, b, c, /*mu,*/ i ;
-
- if (x1 > x3 + r && x2 > x3 + r) return(0);
- if (x1 < x3 - r && x2 < x3 - r) return(0);
- if (y1 > y3 + r && y2 > y3 + r) return(0);
- if (y1 < y3 - r && y2 < y3 - r) return(0);
- if (z1 > z3 + r && z2 > z3 + r) return(0);
- if (z1 < z3 - r && z2 < z3 - r) return(0);
- a = square(x2 - x1) + square(y2 - y1) + square(z2 - z1);
- b = 2 * ( (x2 - x1) * (x1 - x3)
- + (y2 - y1) * (y1 - y3)
- + (z2 - z1) * (z1 - z3) ) ;
- c = square(x3) + square(y3) +
- square(z3) + square(x1) +
- square(y1) + square(z1) -
- 2 * ( x3 * x1 + y3 * y1 + z3 * z1 ) - square(r) ;
- i = b * b - 4 * a * c ;
-
- if ( i < 0.0 ) {
+ static float a, b, c, /*mu,*/ i;
+
+ if (x1 > x3 + r && x2 > x3 + r)
+ return (0);
+ if (x1 < x3 - r && x2 < x3 - r)
+ return (0);
+ if (y1 > y3 + r && y2 > y3 + r)
+ return (0);
+ if (y1 < y3 - r && y2 < y3 - r)
+ return (0);
+ if (z1 > z3 + r && z2 > z3 + r)
+ return (0);
+ if (z1 < z3 - r && z2 < z3 - r)
+ return (0);
+ a = square(x2 - x1) + square(y2 - y1) + square(z2 - z1);
+ b = 2 * ((x2 - x1) * (x1 - x3) + (y2 - y1) * (y1 - y3) + (z2 - z1) * (z1 - z3));
+ c = square(x3) + square(y3) +
+ square(z3) + square(x1) +
+ square(y1) + square(z1) -
+ 2 * (x3 * x1 + y3 * y1 + z3 * z1) - square(r);
+ i = b * b - 4 * a * c;
+
+ if (i < 0.0) {
// no intersection
- return(0);
+ return (0);
}
- return(1);
+ return (1);
}
-inline bool sphere_line_intersection (
- XYZ *p1, XYZ *p2, XYZ *p3, float *r )
+inline bool sphere_line_intersection(
+ XYZ* p1, XYZ* p2, XYZ* p3, float* r)
{
// x1,p1->y,p1->z P1 coordinates (point of line)
// the number of intersection point, followed by coordinate pairs.
//~ static float x , y , z;
- static float a, b, c, /*mu,*/ i ;
-
- if (p1->x > p3->x + *r && p2->x > p3->x + *r) return(0);
- if (p1->x < p3->x - *r && p2->x < p3->x - *r) return(0);
- if (p1->y > p3->y + *r && p2->y > p3->y + *r) return(0);
- if (p1->y < p3->y - *r && p2->y < p3->y - *r) return(0);
- if (p1->z > p3->z + *r && p2->z > p3->z + *r) return(0);
- if (p1->z < p3->z - *r && p2->z < p3->z - *r) return(0);
- a = square(p2->x - p1->x) + square(p2->y - p1->y) + square(p2->z - p1->z);
- b = 2 * ( (p2->x - p1->x) * (p1->x - p3->x)
- + (p2->y - p1->y) * (p1->y - p3->y)
- + (p2->z - p1->z) * (p1->z - p3->z) ) ;
- c = square(p3->x) + square(p3->y) +
- square(p3->z) + square(p1->x) +
- square(p1->y) + square(p1->z) -
- 2 * ( p3->x * p1->x + p3->y * p1->y + p3->z * p1->z ) - square(*r) ;
- i = b * b - 4 * a * c ;
-
- if ( i < 0.0 ) {
+ static float a, b, c, /*mu,*/ i;
+
+ if (p1->x > p3->x + *r && p2->x > p3->x + *r)
+ return (0);
+ if (p1->x < p3->x - *r && p2->x < p3->x - *r)
+ return (0);
+ if (p1->y > p3->y + *r && p2->y > p3->y + *r)
+ return (0);
+ if (p1->y < p3->y - *r && p2->y < p3->y - *r)
+ return (0);
+ if (p1->z > p3->z + *r && p2->z > p3->z + *r)
+ return (0);
+ if (p1->z < p3->z - *r && p2->z < p3->z - *r)
+ return (0);
+ a = square(p2->x - p1->x) + square(p2->y - p1->y) + square(p2->z - p1->z);
+ b = 2 * ((p2->x - p1->x) * (p1->x - p3->x) + (p2->y - p1->y) * (p1->y - p3->y) + (p2->z - p1->z) * (p1->z - p3->z));
+ c = square(p3->x) + square(p3->y) +
+ square(p3->z) + square(p1->x) +
+ square(p1->y) + square(p1->z) -
+ 2 * (p3->x * p1->x + p3->y * p1->y + p3->z * p1->z) - square(*r);
+ i = b * b - 4 * a * c;
+
+ if (i < 0.0) {
// no intersection
- return(0);
+ return (0);
}
- return(1);
+ return (1);
}
inline XYZ DoRotationRadian(XYZ thePoint, float xang, float yang, float zang)
}
return oldpoint;
-
}
-inline bool DistancePointLine( XYZ *Point, XYZ *LineStart, XYZ *LineEnd, float *Distance, XYZ *Intersection )
+inline bool DistancePointLine(XYZ* Point, XYZ* LineStart, XYZ* LineEnd, float* Distance, XYZ* Intersection)
{
float LineMag;
float U;
- LineMag = findDistance( LineEnd, LineStart );
+ LineMag = findDistance(LineEnd, LineStart);
- U = ( ( ( Point->x - LineStart->x ) * ( LineEnd->x - LineStart->x ) ) +
- ( ( Point->y - LineStart->y ) * ( LineEnd->y - LineStart->y ) ) +
- ( ( Point->z - LineStart->z ) * ( LineEnd->z - LineStart->z ) ) ) /
- ( LineMag * LineMag );
+ U = (((Point->x - LineStart->x) * (LineEnd->x - LineStart->x)) +
+ ((Point->y - LineStart->y) * (LineEnd->y - LineStart->y)) +
+ ((Point->z - LineStart->z) * (LineEnd->z - LineStart->z))) /
+ (LineMag * LineMag);
- if ( U < 0.0f || U > 1.0f )
- return 0; // closest point does not fall within the line segment
+ if (U < 0.0f || U > 1.0f)
+ return 0; // closest point does not fall within the line segment
- Intersection->x = LineStart->x + U * ( LineEnd->x - LineStart->x );
- Intersection->y = LineStart->y + U * ( LineEnd->y - LineStart->y );
- Intersection->z = LineStart->z + U * ( LineEnd->z - LineStart->z );
+ Intersection->x = LineStart->x + U * (LineEnd->x - LineStart->x);
+ Intersection->y = LineStart->y + U * (LineEnd->y - LineStart->y);
+ Intersection->z = LineStart->z + U * (LineEnd->z - LineStart->z);
- *Distance = findDistance( Point, Intersection );
+ *Distance = findDistance(Point, Intersection);
return 1;
}
#include "Game.hpp"
-struct MenuItem {
- enum MenuItemType {NONE, LABEL, BUTTON, IMAGE, IMAGEBUTTON, MAPMARKER, MAPLINE, MAPLABEL} type;
+struct MenuItem
+{
+ enum MenuItemType
+ {
+ NONE,
+ LABEL,
+ BUTTON,
+ IMAGE,
+ IMAGEBUTTON,
+ MAPMARKER,
+ MAPLINE,
+ MAPLABEL
+ } type;
int id;
string text;
Texture texture;
float lineendsize;
MenuItem(MenuItemType _type, int _id, const string& _text, Texture _texture,
- int _x, int _y, int _w, int _h, float _r, float _g, float _b,
- float _linestartsize = 1, float _lineendsize = 1);
+ int _x, int _y, int _w, int _h, float _r, float _g, float _b,
+ float _linestartsize = 1, float _lineendsize = 1);
};
class Menu
#include "Environment/Lights.hpp"
#include "Environment/Terrain.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Models.hpp"
#include "Graphic/Sprite.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/Frustum.hpp"
#include "Math/XYZ.hpp"
#include "Utils/ImageIO.hpp"
#define max_objects 300
-enum object_type {
+enum object_type
+{
boxtype = 0,
weirdtype = 1,
spiketype = 2,
firetype = 13
};
-
class Object
{
public:
static void ComputeRadius();
static void AddObjectsToTerrain();
static void LoadObjectsFromFile(FILE* tfile, bool skip);
- static void SphereCheckPossible(XYZ *p1, float radius);
+ static void SphereCheckPossible(XYZ* p1, float radius);
static void DeleteObject(int which);
static void MakeObject(int atype, XYZ where, float ayaw, float apitch, float ascale);
static void Draw();
};
#endif
-
#include "Animation/Animation.hpp"
#include "Animation/Skeleton.hpp"
#include "Environment/Terrain.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Models.hpp"
#include "Graphic/Sprite.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/XYZ.hpp"
#include "Objects/PersonType.hpp"
#include "Objects/Weapons.hpp"
#define getweapontype 7
#define pathfindtype 8
-struct InvalidPersonException : public exception {
- const char * what () const throw () {
- return "Invalid weapon number";
- }
+struct InvalidPersonException : public exception
+{
+ const char* what() const throw()
+ {
+ return "Invalid weapon number";
+ }
};
class Person : public enable_shared_from_this<Person>
float jumpkeydowntime;
bool freefall;
-
float turnspeed;
int aitype;
void Reverse();
void DoDamage(float howmuch);
void DoHead();
- void DoMipmaps() {
+ void DoMipmaps()
+ {
skeleton.drawmodel.textureptr.bind();
glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, skeleton.skinsize, skeleton.skinsize, 0, GL_RGB, GL_UNSIGNED_BYTE, &skeleton.skinText[0]);
}
- int SphereCheck(XYZ *p1, float radius, XYZ *p, XYZ *move, float *rotate, Model *model);
+ int SphereCheck(XYZ* p1, float radius, XYZ* p, XYZ* move, float* rotate, Model* model);
int DrawSkeleton();
void Puff(int whichlabel);
void FootLand(bodypart whichfoot, float opacity);
void DoAnimations();
void RagDoll(bool checkcollision);
- void takeWeapon (int weaponId);
+ void takeWeapon(int weaponId);
bool addClothes(const int& clothesId);
void addClothes();
#include "Animation/Skeleton.hpp"
#include "Environment/Terrain.hpp"
-#include "Graphic/gamegl.hpp"
#include "Graphic/Models.hpp"
#include "Graphic/Sprite.hpp"
#include "Graphic/Texture.hpp"
+#include "Graphic/gamegl.hpp"
#include "Math/XYZ.hpp"
#include "Objects/Person.hpp"
void draw();
void doStuff(int);
- int getType() {
+ int getType()
+ {
return type;
}
void setType(int);
#include <stdio.h>
#if defined(WIN32) && !defined(strcasecmp)
-#define strcasecmp(a,b) stricmp(a,b)
+#define strcasecmp(a, b) stricmp(a, b)
#endif
-
-struct Point {
+struct Point
+{
short v;
short h;
};
typedef signed char SInt8;
typedef unsigned int UInt32;
-typedef struct AbsoluteTime {
- unsigned long hi;
- unsigned long lo;
+typedef struct AbsoluteTime
+{
+ unsigned long hi;
+ unsigned long lo;
} AbsoluteTime;
/* Returns time since the app started, not system start. */
typedef long Duration;
-enum {
+enum
+{
durationMicrosecond = -1,
durationMillisecond = 1,
- durationSecond = 1000,
- durationMinute = 1000 * 60,
- durationHour = 1000 * 60 * 60,
- durationDay = 1000 * 60 * 60 * 24,
- durationForever = 0x7FFFFFFF,
- durationImmediate = 0,
+ durationSecond = 1000,
+ durationMinute = 1000 * 60,
+ durationHour = 1000 * 60 * 60,
+ durationDay = 1000 * 60 * 60 * 24,
+ durationForever = 0x7FFFFFFF,
+ durationImmediate = 0,
};
Duration AbsoluteDeltaToDuration(AbsoluteTime& a, AbsoluteTime& b);
-
/* Workaround missing math stuff on MSVC
* FIXME: Check that it is still necessary nowadays.
*/
#ifdef _MSC_VER
-inline bool isnormal( double x)
+inline bool isnormal(double x)
{
- int ret = _fpclass( x);
+ int ret = _fpclass(x);
return (ret == _FPCLASS_NN || ret == _FPCLASS_PN);
}
class AppTime
{
- public:
+public:
AppTime()
{
counterRate = 1;
class AppTime
{
- public:
+public:
AppTime()
{
counterRate = 1;
#include <string>
#include <vector>
-struct CampaignProgress {
+struct CampaignProgress
+{
int highscore;
float fasttime;
int score;
float time;
std::vector<int> choices;
- CampaignProgress() {
+ CampaignProgress()
+ {
highscore = 0;
fasttime = 0;
score = 0;
// getter and setters
int getDifficulty();
- void setDifficulty(int i) {
+ void setDifficulty(int i)
+ {
difficulty = i;
};
- const std::string& getName() {
+ const std::string& getName()
+ {
return name;
};
- int getCampaignScore() {
+ int getCampaignScore()
+ {
return campaignProgress[currentCampaign].score;
};
- int getCampaignChoicesMade() {
+ int getCampaignChoicesMade()
+ {
return campaignProgress[currentCampaign].choices.size();
};
- int getCampaignChoice(int i) {
+ int getCampaignChoice(int i)
+ {
return campaignProgress[currentCampaign].choices[i];
};
- void setCampaignScore(int s) {
+ void setCampaignScore(int s)
+ {
campaignProgress[currentCampaign].score = s;
if (s > campaignProgress[currentCampaign].highscore) {
campaignProgress[currentCampaign].highscore = s;
}
};
- void setCampaignFinalTime(float t) {
+ void setCampaignFinalTime(float t)
+ {
campaignProgress[currentCampaign].time = t;
if ((t < campaignProgress[currentCampaign].fasttime) || ((campaignProgress[currentCampaign].fasttime == 0) && (t != 0))) {
campaignProgress[currentCampaign].fasttime = t;
}
};
- float getCampaignFasttime() {
+ float getCampaignFasttime()
+ {
return campaignProgress[currentCampaign].fasttime;
};
- void resetFasttime() {
+ void resetFasttime()
+ {
campaignProgress[currentCampaign].fasttime = 0;
};
- int getCampaignHighScore() {
+ int getCampaignHighScore()
+ {
return campaignProgress[currentCampaign].highscore;
};
- int getHighScore(int i) {
+ int getHighScore(int i)
+ {
return highscore[i];
};
- float getFastTime(int i) {
+ float getFastTime(int i)
+ {
return fasttime[i];
};
- int getProgress() {
+ int getProgress()
+ {
return progress;
};
- std::string getCurrentCampaign() {
+ std::string getCurrentCampaign()
+ {
return currentCampaign;
};
void setCurrentCampaign(const std::string& name);
void SaveSettings();
bool LoadSettings();
-
#endif
#define DATA_DIR "Data"
#endif
-struct FileNotFoundException: public std::exception
+struct FileNotFoundException : public std::exception
{
std::string errorText;
- FileNotFoundException (const std::string& filename)
- : errorText(filename + " could not be found")
- {}
+ FileNotFoundException(const std::string& filename)
+ : errorText(filename + " could not be found")
+ {
+ }
- const char * what () const throw () {
+ const char* what() const throw()
+ {
return errorText.c_str();
}
};
/* Returns full path for a game resource */
static inline std::string getResourcePath(const std::string& filepath)
- { return dataDir + '/' + filepath; }
+ {
+ return dataDir + '/' + filepath;
+ }
/** Returns full path for user progress save */
static inline std::string getUserSavePath()
- { return getUserDataPath() + "/users"; }
+ {
+ return getUserDataPath() + "/users";
+ }
static bool makeDirectory(const std::string& path);
#endif
/**> DATA STRUCTURES <**/
-class ImageRec {
+class ImageRec
+{
public:
- GLubyte *data; // Image Data (Up To 32 Bits)
- GLuint bpp; // Image Color Depth In Bits Per Pixel.
+ GLubyte* data; // Image Data (Up To 32 Bits)
+ GLuint bpp; // Image Color Depth In Bits Per Pixel.
GLuint sizeX;
GLuint sizeY;
ImageRec();
~ImageRec();
+
private:
/* Make sure this class cannot be copied to avoid memory problems */
- ImageRec(ImageRec const &);
- ImageRec& operator=(ImageRec const &);
+ ImageRec(ImageRec const&);
+ ImageRec& operator=(ImageRec const&);
};
-bool load_image(const char * fname, ImageRec & tex);
-bool save_screenshot(const char * fname);
+bool load_image(const char* fname, ImageRec& tex);
+bool save_screenshot(const char* fname);
#endif
-