Skip to content

Commit

Permalink
Merge branch 'data'
Browse files Browse the repository at this point in the history
  • Loading branch information
mniip committed May 9, 2018
2 parents f30215b + 12e79ea commit 3781b36
Show file tree
Hide file tree
Showing 20 changed files with 423 additions and 375 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.

323 changes: 7 additions & 316 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
2 changes: 0 additions & 2 deletions src/graphics/Font.cpp

This file was deleted.

7 changes: 4 additions & 3 deletions src/graphics/Font.h → src/graphics/FontReader.h
@@ -1,23 +1,24 @@
#pragma once
#include <cstddef>

#include "common/String.h"
#include "font.h"

class FontReader
{
unsigned char *pointer;
unsigned char const *pointer;
int width;
int pixels;
int data;

inline FontReader(unsigned char *_pointer):
inline FontReader(unsigned char const *_pointer):
pointer(_pointer + 1),
width(*_pointer),
pixels(0),
data(0)
{}

static inline unsigned char *lookupChar(String::value_type ch)
static inline unsigned char const *lookupChar(String::value_type ch)
{
size_t offset = 0;
for(int i = 0; font_ranges[i][1]; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/Graphics.cpp
Expand Up @@ -5,7 +5,7 @@
#include "Config.h"
#include "Misc.h"
#include "Graphics.h"
#include "Font.h"
#include "FontReader.h"
#ifdef HIGH_QUALITY_RESAMPLE
#include "resampler/resampler.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/graphics/OpenGLGraphics.cpp
@@ -1,5 +1,5 @@
#include "Graphics.h"
#include "Font.h"
#include "FontReader.h"
#include "common/tpt-thread.h"
#ifdef OGLI

Expand Down
2 changes: 1 addition & 1 deletion src/graphics/RasterDrawMethods.inl
@@ -1,5 +1,5 @@
#include <cmath>
#include "Font.h"
#include "FontReader.h"

int PIXELMETHODS_CLASS::drawtext_outline(int x, int y, String s, int r, int g, int b, int a)
{
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 3781b36

Please sign in to comment.