Skip to content

Commit

Permalink
Reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jul 17, 2020
1 parent 56e7aad commit f860f07
Show file tree
Hide file tree
Showing 13 changed files with 171 additions and 170 deletions.
2 changes: 1 addition & 1 deletion CDebug.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include "defines.h"
#include "CDebug.h"
#include "CGame.h"
#include "CIO/CFont.h"
#include "CIO/CWindow.h"
#include "CMap.h"
#include "defines.h"
#include "globals.h"
#include "helpers/format.hpp"
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion CGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ bool checkWriteable(const bfs::path& folder)
} // namespace

#undef main
int main(int /*argc*/, char* /*argv*/ [])
int main(int /*argc*/, char* /*argv*/[])
{
if(!RTTRCONFIG.Init())
{
Expand Down
2 changes: 1 addition & 1 deletion CIO/CButton.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _CBUTTON_H
#define _CBUTTON_H

#include "defines.h"
#include "SdlSurface.h"
#include "defines.h"

class CButton
{
Expand Down
2 changes: 1 addition & 1 deletion CIO/CSelectBox.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _CSELECTBOX_H
#define _CSELECTBOX_H

#include "defines.h"
#include "SdlSurface.h"
#include "defines.h"
#include <functional>
#include <memory>
#include <vector>
Expand Down
14 changes: 4 additions & 10 deletions CSurface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,9 @@ Uint32 CSurface::GetPixel(SDL_Surface* surface, int x, int y)
else
return p[0] | p[1] << 8 | p[2] << 16;

case 4:
return *(Uint32*)p; //-V206
case 4: return *(Uint32*)p; //-V206

default:
return 0; /* shouldn't happen, but avoids warnings */
default: return 0; /* shouldn't happen, but avoids warnings */
}
}

Expand Down Expand Up @@ -1054,13 +1052,9 @@ void CSurface::DrawTriangle(SDL_Surface* display, const DisplayRectangle& displa
}
break;
// stone
case 0xCC:
objIdx = MAPPIC_GRANITE_1_1 + (P2.objectType - 0x01);
break;
case 0xCC: objIdx = MAPPIC_GRANITE_1_1 + (P2.objectType - 0x01); break;
// stone
case 0xCD:
objIdx = MAPPIC_GRANITE_2_1 + (P2.objectType - 0x01);
break;
case 0xCD: objIdx = MAPPIC_GRANITE_2_1 + (P2.objectType - 0x01); break;
// headquarter
case 0x80: // node2.objectType is the number of the player beginning with 0x00
//%7 cause in the original game there are only 7 players and 7 different flags
Expand Down
2 changes: 1 addition & 1 deletion CSurface.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef _CSURFACE_H
#define _CSURFACE_H

#include "defines.h"
#include "SdlSurface.h"
#include "defines.h"
#include <SDL.h>

struct vector;
Expand Down
98 changes: 50 additions & 48 deletions SGE/include/SGE/sge_blib.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,61 +21,63 @@
#include "sge_internal.h"

#ifdef _SGE_C
extern "C" {
extern "C"
{
#endif
DECLSPEC void sge_FadedLine(SDL_Surface* dest, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r1, Uint8 g1, Uint8 b1, Uint8 r2, Uint8 g2, Uint8 b2);
// works at the moment only if destination and source surface have both 32bpp
DECLSPEC void sge_FadedTexturedLine(SDL_Surface* dest, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface* source, Sint16 sx1, Sint16 sy1,
Sint16 sx2, Sint16 sy2, Sint32 i1, Sint32 i2);
DECLSPEC void sge_FadedLine(SDL_Surface* dest, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r1, Uint8 g1, Uint8 b1, Uint8 r2, Uint8 g2,
Uint8 b2);
// works at the moment only if destination and source surface have both 32bpp
DECLSPEC void sge_FadedTexturedLine(SDL_Surface* dest, Sint16 x1, Sint16 x2, Sint16 y, SDL_Surface* source, Sint16 sx1, Sint16 sy1,
Sint16 sx2, Sint16 sy2, Sint32 i1, Sint32 i2);

DECLSPEC void sge_Trigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
DECLSPEC void sge_TrigonAlpha(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color,
Uint8 alpha);
DECLSPEC void sge_AATrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
DECLSPEC void sge_AATrigonAlpha(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color,
Uint8 alpha);

DECLSPEC void sge_FilledTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
DECLSPEC void sge_FilledTrigonAlpha(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color,
DECLSPEC void sge_Trigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
DECLSPEC void sge_TrigonAlpha(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color,
Uint8 alpha);
DECLSPEC void sge_AATrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
DECLSPEC void sge_AATrigonAlpha(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color,
Uint8 alpha);

DECLSPEC void sge_FadedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 c1, Uint32 c2,
Uint32 c3);
DECLSPEC void sge_TexturedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, SDL_Surface* source,
Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3);
// works at the moment only if destination and source surface have both 32bpp
DECLSPEC void sge_FadedTexturedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3,
Sint32 I1, Sint32 I2, Sint32 I3);
// works at the moment only if destination and source surface have both 8bpp
DECLSPEC void sge_PreCalcFadedTexturedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3,
Uint16 I1, Uint16 I2, Uint16 I3, Uint8 PreCalcPalettes[][256]);
// if destination and source surface have both 32bpp then a few colorkeys will be respected
DECLSPEC void sge_FadedTexturedTrigonColorKeys(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3,
Sint32 I1, Sint32 I2, Sint32 I3, Uint32 keys[], int keycount);
// if destination and source surface have both 8bpp then a few colorkeys will be respected
DECLSPEC void sge_PreCalcFadedTexturedTrigonColorKeys(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3,
Sint16 sy3, Uint16 I1, Uint16 I2, Uint16 I3, Uint8 PreCalcPalettes[][256],
Uint32 keys[], int keycount);
DECLSPEC void sge_FilledTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color);
DECLSPEC void sge_FilledTrigonAlpha(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 color,
Uint8 alpha);

DECLSPEC void sge_FadedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Uint32 c1, Uint32 c2,
Uint32 c3);
DECLSPEC void sge_TexturedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3);
// works at the moment only if destination and source surface have both 32bpp
DECLSPEC void sge_FadedTexturedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3,
Sint32 I1, Sint32 I2, Sint32 I3);
// works at the moment only if destination and source surface have both 8bpp
DECLSPEC void sge_PreCalcFadedTexturedTrigon(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3,
Sint16 sy3, Uint16 I1, Uint16 I2, Uint16 I3, Uint8 PreCalcPalettes[][256]);
// if destination and source surface have both 32bpp then a few colorkeys will be respected
DECLSPEC void sge_FadedTexturedTrigonColorKeys(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3,
Sint16 sy3, Sint32 I1, Sint32 I2, Sint32 I3, Uint32 keys[], int keycount);
// if destination and source surface have both 8bpp then a few colorkeys will be respected
DECLSPEC void sge_PreCalcFadedTexturedTrigonColorKeys(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3,
Sint16 y3, SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2,
Sint16 sx3, Sint16 sy3, Uint16 I1, Uint16 I2, Uint16 I3,
Uint8 PreCalcPalettes[][256], Uint32 keys[], int keycount);

// NOTE: Sort of the coords P1 P2
// P3 P4
DECLSPEC void sge_TexturedRect(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Sint16 x4, Sint16 y4,
SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3, Sint16 sx4,
Sint16 sy4);
// NOTE: Sort of the coords P1 P2
// P3 P4
DECLSPEC void sge_TexturedRect(SDL_Surface* dest, Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Sint16 x3, Sint16 y3, Sint16 x4,
Sint16 y4, SDL_Surface* source, Sint16 sx1, Sint16 sy1, Sint16 sx2, Sint16 sy2, Sint16 sx3, Sint16 sy3,
Sint16 sx4, Sint16 sy4);

DECLSPEC int sge_FilledPolygon(SDL_Surface* dest, Uint16 n, Sint16* x, Sint16* y, Uint32 color);
DECLSPEC int sge_FilledPolygonAlpha(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, Uint32 color, Uint8 alpha);
DECLSPEC int sge_AAFilledPolygon(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, Uint32 color);
DECLSPEC int sge_FilledPolygon(SDL_Surface* dest, Uint16 n, Sint16* x, Sint16* y, Uint32 color);
DECLSPEC int sge_FilledPolygonAlpha(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, Uint32 color, Uint8 alpha);
DECLSPEC int sge_AAFilledPolygon(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, Uint32 color);

DECLSPEC int sge_FadedPolygon(SDL_Surface* dest, Uint16 n, Sint16* x, Sint16* y, Uint8* R, Uint8* G, Uint8* B);
DECLSPEC int sge_FadedPolygonAlpha(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, const Uint8* R, const Uint8* G,
const Uint8* B, Uint8 alpha);
DECLSPEC int sge_AAFadedPolygon(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, const Uint8* R, const Uint8* G,
const Uint8* B);
DECLSPEC int sge_FadedPolygon(SDL_Surface* dest, Uint16 n, Sint16* x, Sint16* y, Uint8* R, Uint8* G, Uint8* B);
DECLSPEC int sge_FadedPolygonAlpha(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, const Uint8* R, const Uint8* G,
const Uint8* B, Uint8 alpha);
DECLSPEC int sge_AAFadedPolygon(SDL_Surface* dest, Uint16 n, const Sint16* x, const Sint16* y, const Uint8* R, const Uint8* G,
const Uint8* B);
#ifdef _SGE_C
}
#endif
Expand Down
23 changes: 12 additions & 11 deletions SGE/include/SGE/sge_collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ struct sge_cdata
};

#ifdef _SGE_C
extern "C" {
extern "C"
{
#endif
DECLSPEC sge_cdata* sge_make_cmap(SDL_Surface* img);
DECLSPEC int sge_bbcheck(sge_cdata* cd1, Sint16 x1, Sint16 y1, sge_cdata* cd2, Sint16 x2, Sint16 y2);
DECLSPEC int _sge_bbcheck(Sint16 x1, Sint16 y1, Sint16 w1, Sint16 h1, Sint16 x2, Sint16 y2, Sint16 w2, Sint16 h2);
DECLSPEC int _sge_cmcheck(sge_cdata* cd1, Sint16 x1, Sint16 y1, sge_cdata* cd2, Sint16 x2, Sint16 y2);
DECLSPEC int sge_cmcheck(sge_cdata* cd1, Sint16 x1, Sint16 y1, sge_cdata* cd2, Sint16 x2, Sint16 y2);
DECLSPEC Sint16 sge_get_cx();
DECLSPEC Sint16 sge_get_cy();
DECLSPEC void sge_destroy_cmap(sge_cdata* cd);
DECLSPEC void sge_unset_cdata(sge_cdata* cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
DECLSPEC void sge_set_cdata(sge_cdata* cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
DECLSPEC sge_cdata* sge_make_cmap(SDL_Surface* img);
DECLSPEC int sge_bbcheck(sge_cdata* cd1, Sint16 x1, Sint16 y1, sge_cdata* cd2, Sint16 x2, Sint16 y2);
DECLSPEC int _sge_bbcheck(Sint16 x1, Sint16 y1, Sint16 w1, Sint16 h1, Sint16 x2, Sint16 y2, Sint16 w2, Sint16 h2);
DECLSPEC int _sge_cmcheck(sge_cdata* cd1, Sint16 x1, Sint16 y1, sge_cdata* cd2, Sint16 x2, Sint16 y2);
DECLSPEC int sge_cmcheck(sge_cdata* cd1, Sint16 x1, Sint16 y1, sge_cdata* cd2, Sint16 x2, Sint16 y2);
DECLSPEC Sint16 sge_get_cx();
DECLSPEC Sint16 sge_get_cy();
DECLSPEC void sge_destroy_cmap(sge_cdata* cd);
DECLSPEC void sge_unset_cdata(sge_cdata* cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
DECLSPEC void sge_set_cdata(sge_cdata* cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h);
#ifdef _SGE_C
}
#endif
Expand Down
13 changes: 7 additions & 6 deletions SGE/include/SGE/sge_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@
#include "sge_internal.h"

#ifdef _SGE_C
extern "C" {
extern "C"
{
#endif
DECLSPEC int sge_Random(int min, int max);
DECLSPEC void sge_Randomize();
DECLSPEC int sge_Random(int min, int max);
DECLSPEC void sge_Randomize();

DECLSPEC Uint32 sge_CalibrateDelay();
DECLSPEC Uint32 sge_DelayRes();
DECLSPEC Uint32 sge_Delay(Uint32 ticks);
DECLSPEC Uint32 sge_CalibrateDelay();
DECLSPEC Uint32 sge_DelayRes();
DECLSPEC Uint32 sge_Delay(Uint32 ticks);
#ifdef _SGE_C
}
#endif
Expand Down
Loading

0 comments on commit f860f07

Please sign in to comment.