Skip to content

Commit

Permalink
Move data into either cpp files or const arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
mniip committed May 8, 2018
1 parent deaa17a commit 32aaafe
Show file tree
Hide file tree
Showing 15 changed files with 410 additions and 361 deletions.
2 changes: 1 addition & 1 deletion SConscript
Expand Up @@ -543,7 +543,7 @@ if GetOption('beta'):


#Generate list of sources to compile
sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + Glob("src/*/*/*.cpp") + Glob("generated/*.cpp")
sources = Glob("src/*.cpp") + Glob("src/*/*.cpp") + Glob("src/*/*/*.cpp") + Glob("generated/*.cpp") + Glob("data/*.cpp")
if not GetOption('nolua') and not GetOption('renderer') and not GetOption('font'):
sources += Glob("src/lua/socket/*.c") + Glob("src/lua/LuaCompat.c")

Expand Down
3 changes: 2 additions & 1 deletion data/IntroText.h
@@ -1,4 +1,5 @@
static const char *introTextData =
#pragma once
const char *const introTextData =
"\blThe Powder Toy - Version " MTOS(SAVE_VERSION) "." MTOS(MINOR_VERSION) " - http://powdertoy.co.uk, irc.freenode.net #powder\n"
"\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\n"
"\n"
Expand Down
25 changes: 11 additions & 14 deletions data/Shaders.h
@@ -1,19 +1,18 @@
#ifndef SHADERS_H_
#define SHADERS_H_
#pragma once

const char * fireFragment = "#version 120\n\
const char *const fireFragment = "#version 120\n\
uniform sampler2D fireAlpha;\
void main () {\
vec4 texColor = texture2D(fireAlpha, gl_PointCoord);\
gl_FragColor = vec4(gl_Color.rgb, texColor.a*gl_Color.a);\
}";
const char * fireVertex = "#version 120\n\
const char *const fireVertex = "#version 120\n\
void main(void)\
{\
gl_Position = ftransform();;\
gl_FrontColor = gl_Color;\
}";
const char * lensFragment = "#version 120\n\
const char *const lensFragment = "#version 120\n\
uniform sampler2D pTex;\
uniform sampler2D tfX;\
uniform sampler2D tfY;\
Expand All @@ -32,14 +31,14 @@ void main () {\
);\
gl_FragColor = texColor;\
}";
const char * lensVertex = "#version 120\n\
const char *const lensVertex = "#version 120\n\
void main(void)\
{\
gl_TexCoord[0] = gl_MultiTexCoord0;\
gl_Position = ftransform();;\
gl_FrontColor = gl_Color;\
}";
const char * airVFragment = "#version 120\n\
const char *const airVFragment = "#version 120\n\
uniform sampler2D airX;\
uniform sampler2D airY;\
uniform sampler2D airP;\
Expand All @@ -49,29 +48,29 @@ void main () {\
vec4 texP = texture2D(airP, gl_TexCoord[0].st);\
gl_FragColor = vec4(abs(texX.r)/2.0, texP.b/2.0, abs(texY.g)/2.0, 1.0);\
}";
const char * airVVertex = "#version 120\n\
const char *const airVVertex = "#version 120\n\
void main(void)\
{\
gl_TexCoord[0] = gl_MultiTexCoord0;\
gl_Position = ftransform();;\
gl_FrontColor = gl_Color;\
}";
const char * airPFragment = "#version 120\n\
const char *const airPFragment = "#version 120\n\
uniform sampler2D airX;\
uniform sampler2D airY;\
uniform sampler2D airP;\
void main () {\
vec4 texP = texture2D(airP, gl_TexCoord[0].st);\
gl_FragColor = vec4(max(texP.b/2.0, 0), 0, abs(min(texP.b/2.0, 0)), 1.0);\
}";
const char * airPVertex = "#version 120\n\
const char *const airPVertex = "#version 120\n\
void main(void)\
{\
gl_TexCoord[0] = gl_MultiTexCoord0;\
gl_Position = ftransform();;\
gl_FrontColor = gl_Color;\
}";
const char * airCFragment = "#version 120\n\
const char *const airCFragment = "#version 120\n\
uniform sampler2D airX;\
uniform sampler2D airY;\
uniform sampler2D airP;\
Expand All @@ -81,12 +80,10 @@ void main () {\
vec4 texP = texture2D(airP, gl_TexCoord[0].st);\
gl_FragColor = vec4(max(texP.b/2.0, 0), 0, abs(min(texP.b/2.0, 0)), 1.0) + vec4(abs(texX.r)/8.0, abs(texX.r)/8.0, abs(texX.r)/8.0, 1.0) + vec4(abs(texY.g)/8.0, abs(texY.g)/8.0, abs(texY.g)/8.0, 1.0);\
}";
const char * airCVertex = "#version 120\n\
const char *const airCVertex = "#version 120\n\
void main(void)\
{\
gl_TexCoord[0] = gl_MultiTexCoord0;\
gl_Position = ftransform();;\
gl_FrontColor = gl_Color;\
}";

#endif /* SHADERS_H_ */
305 changes: 305 additions & 0 deletions data/font.cpp

Large diffs are not rendered by default.

311 changes: 1 addition & 310 deletions data/font.h

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions data/hmap.cpp

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions data/hmap.h

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions data/icon.cpp

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions data/icon.h

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions data/icondoc.h
Expand Up @@ -18,8 +18,8 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/

const static unsigned char icon_doc_32_png[] = {
#pragma once
const unsigned char icon_doc_32_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x08, 0x06, 0x00, 0x00, 0x00, 0x73, 0x7a, 0x7a,
0xf4, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
Expand Down Expand Up @@ -100,7 +100,7 @@ const static unsigned char icon_doc_32_png[] = {
0xbf, 0x2f, 0x89, 0x69, 0x46, 0x25, 0x68, 0x1c, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e,
0x44, 0xae, 0x42, 0x60, 0x82
};
const static unsigned char icon_doc_16_png[] = {
const unsigned char icon_doc_16_png[] = {
0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x08, 0x06, 0x00, 0x00, 0x00, 0x1f, 0xf3, 0xff,
0x61, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
Expand Down Expand Up @@ -137,7 +137,7 @@ const static unsigned char icon_doc_16_png[] = {
0x44, 0xae, 0x42, 0x60, 0x82
};

const static unsigned char icon_desktop_48_png[] = {
const unsigned char icon_desktop_48_png[] = {
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x08, 0x06, 0x00, 0x00, 0x00, 0x57, 0x02, 0xF9,
0x87, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xAE, 0xCE, 0x1C, 0xE9, 0x00, 0x00,
Expand Down
26 changes: 26 additions & 0 deletions data/images.cpp

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions data/images.h

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions src/client/GameSave.cpp
Expand Up @@ -11,10 +11,7 @@
#include "GameSave.h"
#include "simulation/SimulationData.h"
#include "ElementClasses.h"
extern "C"
{
#include "hmap.h"
}
#include "hmap.h"

GameSave::GameSave(GameSave & save):
majorVersion(save.majorVersion),
Expand Down
5 changes: 1 addition & 4 deletions src/simulation/elements/CFLM.cpp
@@ -1,8 +1,5 @@
#include "simulation/Elements.h"
extern "C"
{
#include "hmap.h"
}
#include "hmap.h"

//#TPT-Directive ElementClass Element_CFLM PT_CFLM 68
Element_CFLM::Element_CFLM()
Expand Down
5 changes: 1 addition & 4 deletions src/simulation/elements/FIRW.cpp
@@ -1,8 +1,5 @@
#include "simulation/Elements.h"
extern "C"
{
#include "hmap.h"
}
#include "hmap.h"
//#TPT-Directive ElementClass Element_FIRW PT_FIRW 69
Element_FIRW::Element_FIRW()
{
Expand Down

0 comments on commit 32aaafe

Please sign in to comment.