2012-03-25 19:01:45 +02:00
|
|
|
From: Jan Engelhardt <jengelh@medozas.de>
|
|
|
|
Date: 2012-03-25 16:06:07.551725021 +0200
|
|
|
|
|
|
|
|
---
|
2015-04-06 22:42:15 +02:00
|
|
|
BlockOut/EditControl.cpp | 2 +-
|
|
|
|
BlockOut/EditControl.h | 2 +-
|
|
|
|
BlockOut/GLApp/GLApp.h | 2 +-
|
|
|
|
BlockOut/GLApp/GLFont.cpp | 2 +-
|
|
|
|
BlockOut/GLApp/GLSprite.cpp | 5 ++---
|
|
|
|
BlockOut/GLApp/GLSprite.h | 2 +-
|
|
|
|
BlockOut/Menu.h | 4 ++--
|
|
|
|
BlockOut/MenuGraphics.cpp | 4 ++--
|
|
|
|
BlockOut/SetupManager.cpp | 2 +-
|
|
|
|
BlockOut/SetupManager.h | 2 +-
|
|
|
|
BlockOut/Types.h | 6 +++---
|
|
|
|
BlockOut/Utils.cpp | 6 +++---
|
|
|
|
ImageLib/src/jpg/jpegdecodermain.cpp | 4 ++--
|
|
|
|
ImageLib/src/png/hpng.c | 7 ++-----
|
|
|
|
14 files changed, 23 insertions(+), 27 deletions(-)
|
2012-03-25 19:01:45 +02:00
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/EditControl.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/EditControl.cpp
|
|
|
|
+++ BL_SRC/BlockOut/EditControl.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
@@ -30,7 +30,7 @@ void EditControl::SetDisplayLength(int l
|
|
|
|
|
|
|
|
// ------------------------------------------------
|
|
|
|
|
|
|
|
-void EditControl::SetMode(char *text,BOOL edit,BYTE *keys) {
|
|
|
|
+void EditControl::SetMode(const char *text,BOOL edit,BYTE *keys) {
|
|
|
|
|
|
|
|
if( strlen(text)>=255 ) {
|
|
|
|
strncpy(editText,text,255);
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/EditControl.h
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/EditControl.h
|
|
|
|
+++ BL_SRC/BlockOut/EditControl.h
|
2012-03-25 19:01:45 +02:00
|
|
|
@@ -27,7 +27,7 @@ class EditControl {
|
|
|
|
void SetDisplayLength(int length);
|
|
|
|
|
|
|
|
// Set edit control mode (keys can be NULL)
|
|
|
|
- void SetMode(char *text,BOOL edit,BYTE *keys);
|
|
|
|
+ void SetMode(const char *text,BOOL edit,BYTE *keys);
|
|
|
|
|
|
|
|
// Get the mode
|
|
|
|
BOOL GetMode();
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/GLApp/GLApp.h
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/GLApp/GLApp.h
|
|
|
|
+++ BL_SRC/BlockOut/GLApp/GLApp.h
|
|
|
|
@@ -60,7 +60,7 @@ protected:
|
2012-03-25 19:01:45 +02:00
|
|
|
|
|
|
|
// Internal variables for the state of the app
|
|
|
|
BOOL m_bWindowed;
|
|
|
|
- char* m_strWindowTitle;
|
|
|
|
+ const char *m_strWindowTitle;
|
|
|
|
int m_screenWidth;
|
|
|
|
int m_screenHeight;
|
2015-04-06 22:42:15 +02:00
|
|
|
BOOL m_bVSync;
|
|
|
|
Index: BL_SRC/BlockOut/GLApp/GLFont.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/GLApp/GLFont.cpp
|
|
|
|
+++ BL_SRC/BlockOut/GLApp/GLFont.cpp
|
|
|
|
@@ -8,7 +8,7 @@
|
|
|
|
#undef LoadImage
|
|
|
|
#include <CImage.h>
|
|
|
|
|
2012-03-25 19:01:45 +02:00
|
|
|
-extern char *LID(char *fileName);
|
|
|
|
+#include "../Types.h"
|
|
|
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/GLApp/GLSprite.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/GLApp/GLSprite.cpp
|
|
|
|
+++ BL_SRC/BlockOut/GLApp/GLSprite.cpp
|
|
|
|
@@ -7,8 +7,7 @@
|
2012-03-25 19:01:45 +02:00
|
|
|
#include <string.h>
|
2015-04-06 22:42:15 +02:00
|
|
|
#undef LoadImage
|
|
|
|
#include <CImage.h>
|
|
|
|
-
|
2012-03-25 19:01:45 +02:00
|
|
|
-extern char *LID(char *fileName);
|
2015-04-06 22:42:15 +02:00
|
|
|
+#include "../Types.h"
|
2012-03-25 19:01:45 +02:00
|
|
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
@@ -54,7 +53,7 @@ void Sprite2D::UpdateSprite(int x1,int y
|
2012-03-25 19:01:45 +02:00
|
|
|
|
|
|
|
// -------------------------------------------
|
|
|
|
|
|
|
|
-int Sprite2D::RestoreDeviceObjects(char *diffName,char *alphaName,int scrWidth,int scrHeight) {
|
|
|
|
+int Sprite2D::RestoreDeviceObjects(const char *diffName, const char *alphaName,int scrWidth,int scrHeight) {
|
|
|
|
|
|
|
|
GLint bpp;
|
|
|
|
GLenum format;
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/GLApp/GLSprite.h
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/GLApp/GLSprite.h
|
|
|
|
+++ BL_SRC/BlockOut/GLApp/GLSprite.h
|
2012-03-25 19:01:45 +02:00
|
|
|
@@ -15,7 +15,7 @@ public:
|
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
// Initialise the sprite
|
2012-03-25 19:01:45 +02:00
|
|
|
// return 1 when success, 0 otherwise
|
|
|
|
- int RestoreDeviceObjects(char *diffName,char *alphaName,int srcWidth,int scrHeight);
|
|
|
|
+ int RestoreDeviceObjects(const char *diffName, const char *alphaName,int srcWidth,int scrHeight);
|
|
|
|
|
|
|
|
// Update sprite mapping and coordinates
|
|
|
|
void UpdateSprite(int x1,int y1,int x2,int y2);
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/Menu.h
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/Menu.h
|
|
|
|
+++ BL_SRC/BlockOut/Menu.h
|
|
|
|
@@ -61,8 +61,8 @@ class Menu {
|
2012-03-25 19:01:45 +02:00
|
|
|
// Menu page
|
|
|
|
void ToPage(MenuPage *page);
|
|
|
|
void ToPage(MenuPage *page,int iParam,void *wParam);
|
|
|
|
- void RenderText(int x,int y,BOOL selected,char *text);
|
|
|
|
- void RenderTitle(char *title);
|
|
|
|
+ void RenderText(int x,int y,BOOL selected, const char *text);
|
|
|
|
+ void RenderTitle(const char *title);
|
|
|
|
|
|
|
|
PageMainMenu mainMenuPage;
|
|
|
|
PageStartGame startGamePage;
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/MenuGraphics.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/MenuGraphics.cpp
|
|
|
|
+++ BL_SRC/BlockOut/MenuGraphics.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
@@ -438,7 +438,7 @@ void Menu::RenderChar(int x,int y,int w,
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
-void Menu::RenderTitle(char *title) {
|
|
|
|
+void Menu::RenderTitle(const char *title) {
|
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
int lgth = (int)strlen(title);
|
2012-03-25 19:01:45 +02:00
|
|
|
int nwFont = fround((float)wFont*1.1f);
|
|
|
|
@@ -454,7 +454,7 @@ void Menu::RenderTitle(char *title) {
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------
|
|
|
|
|
|
|
|
-void Menu::RenderText(int x,int y,BOOL selected,char *text) {
|
|
|
|
+void Menu::RenderText(int x,int y,BOOL selected, const char *text) {
|
|
|
|
|
|
|
|
float startLine = 0.515f;
|
|
|
|
float startColumn = 0.15f;
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/SetupManager.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/SetupManager.cpp
|
|
|
|
+++ BL_SRC/BlockOut/SetupManager.cpp
|
|
|
|
@@ -364,7 +364,7 @@ int SetupManager::GetTimeout() {
|
|
|
|
|
|
|
|
// ------------------------------------------------
|
|
|
|
|
|
|
|
-char *SetupManager::GetName() {
|
|
|
|
+const char *SetupManager::GetName() {
|
|
|
|
|
|
|
|
static char ret[32];
|
|
|
|
strcpy(ret,"");
|
|
|
|
Index: BL_SRC/BlockOut/SetupManager.h
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/SetupManager.h
|
|
|
|
+++ BL_SRC/BlockOut/SetupManager.h
|
|
|
|
@@ -67,7 +67,7 @@ class SetupManager {
|
|
|
|
float GetAnimationTime(); /* in seconds */
|
|
|
|
|
|
|
|
// Names
|
|
|
|
- char *GetName();
|
|
|
|
+ const char *GetName();
|
|
|
|
const char *GetBlockSetName();
|
|
|
|
|
|
|
|
// Sound
|
|
|
|
Index: BL_SRC/BlockOut/Types.h
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/Types.h
|
|
|
|
+++ BL_SRC/BlockOut/Types.h
|
|
|
|
@@ -203,15 +203,15 @@ extern int fround(float x);
|
2012-03-25 19:01:45 +02:00
|
|
|
extern char *FormatTime(float seconds);
|
2015-04-06 22:42:15 +02:00
|
|
|
extern char *FormatDate(uint32 time);
|
|
|
|
extern char *FormatDateShort(uint32 time);
|
2012-03-25 19:01:45 +02:00
|
|
|
-extern int CreateTexture(int width,int height,char *imgName,GLuint *hmap);
|
2015-04-06 22:42:15 +02:00
|
|
|
+extern int CreateTexture(int width,int height,const char *imgName,GLuint *hmap);
|
2012-03-25 19:01:45 +02:00
|
|
|
extern char GetChar(BYTE *keys);
|
2015-04-06 22:42:15 +02:00
|
|
|
#ifndef WINDOWS
|
2012-03-25 19:01:45 +02:00
|
|
|
extern void ZeroMemory(void *buff,int size);
|
2015-04-06 22:42:15 +02:00
|
|
|
#endif
|
2012-03-25 19:01:45 +02:00
|
|
|
extern BOOL DirExists(char *dirname);
|
|
|
|
extern BOOL CheckEnv();
|
|
|
|
-extern char *LID(char *fileName);
|
|
|
|
-extern char *LHD(char *fileName);
|
|
|
|
+extern char *LID(const char *fileName);
|
|
|
|
+extern char *LHD(const char *fileName);
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* TYPESH */
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/BlockOut/Utils.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/BlockOut/Utils.cpp
|
|
|
|
+++ BL_SRC/BlockOut/Utils.cpp
|
|
|
|
@@ -238,7 +238,7 @@ BOOL CheckEnv() {
|
2012-03-25 19:01:45 +02:00
|
|
|
// Name: LID()
|
|
|
|
// Desc: Locate file in the installation directory
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
-char *LID(char *fileName) {
|
|
|
|
+char *LID(const char *fileName) {
|
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
#ifdef WINDOWS
|
|
|
|
return fileName;
|
|
|
|
@@ -254,7 +254,7 @@ char *LID(char *fileName) {
|
2012-03-25 19:01:45 +02:00
|
|
|
// Name: LHD()
|
|
|
|
// Desc: Locate file in the home directory
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
-char *LHD(char *fileName) {
|
|
|
|
+char *LHD(const char *fileName) {
|
|
|
|
|
|
|
|
static char ret[512];
|
2015-04-06 22:42:15 +02:00
|
|
|
|
|
|
|
@@ -278,7 +278,7 @@ char *LHD(char *fileName) {
|
2012-03-25 19:01:45 +02:00
|
|
|
// Name: CreateTexture()
|
|
|
|
// Desc: Create a texture (no alpha)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
-int CreateTexture(int width,int height,char *imgName,GLuint *hmap) {
|
|
|
|
+int CreateTexture(int width,int height, const char *imgName,GLuint *hmap) {
|
|
|
|
|
|
|
|
*hmap = 0;
|
|
|
|
CImage img;
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/ImageLib/src/jpg/jpegdecodermain.cpp
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/ImageLib/src/jpg/jpegdecodermain.cpp
|
|
|
|
+++ BL_SRC/ImageLib/src/jpg/jpegdecodermain.cpp
|
|
|
|
@@ -54,7 +54,7 @@ int LoadJpegImage(JPEG_IMAGE *d) {
|
|
|
|
Pjpeg_decoder_file_stream Pinput_stream = new jpeg_decoder_file_stream();
|
2012-03-25 19:01:45 +02:00
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
if( !Pinput_stream ) {
|
|
|
|
- sprintf(JpegErrorMessage,"Error: Unable to allocate memory for stream object!\n", Psrc_filename);
|
|
|
|
+ sprintf(JpegErrorMessage,"Error: Unable to allocate memory for stream object! %s\n", Psrc_filename);
|
|
|
|
return (FALSE);
|
|
|
|
}
|
2012-03-25 19:01:45 +02:00
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
@@ -69,7 +69,7 @@ int LoadJpegImage(JPEG_IMAGE *d) {
|
2012-03-25 19:01:45 +02:00
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
if( !Pd ) {
|
|
|
|
delete Pinput_stream;
|
|
|
|
- sprintf(JpegErrorMessage,"Error: Unable to allocate memory for decoder object!\n", Psrc_filename);
|
|
|
|
+ sprintf(JpegErrorMessage,"Error: Unable to allocate memory for decoder object! %s\n", Psrc_filename);
|
|
|
|
return (FALSE);
|
|
|
|
}
|
2012-03-25 19:01:45 +02:00
|
|
|
|
2015-04-06 22:42:15 +02:00
|
|
|
Index: BL_SRC/ImageLib/src/png/hpng.c
|
2012-03-25 19:01:45 +02:00
|
|
|
===================================================================
|
2015-04-06 22:42:15 +02:00
|
|
|
--- BL_SRC.orig/ImageLib/src/png/hpng.c
|
|
|
|
+++ BL_SRC/ImageLib/src/png/hpng.c
|
2013-02-19 09:54:49 +01:00
|
|
|
@@ -1,6 +1,7 @@
|
|
|
|
#include <malloc.h>
|
|
|
|
#include <math.h>
|
|
|
|
#include <png.h>
|
|
|
|
+#include <string.h>
|
|
|
|
#include "hpng.h"
|
|
|
|
|
|
|
|
char PngErrorMessage[1024];
|
|
|
|
@@ -45,10 +46,6 @@ int LoadPngImage(PNG_IMAGE *d) {
|
2012-03-25 19:01:45 +02:00
|
|
|
// ---------------- Error handling
|
|
|
|
|
|
|
|
png_set_error_fn(png,NULL,my_png_error,NULL);
|
|
|
|
- if (setjmp(png->jmpbuf)) {
|
|
|
|
- png_destroy_read_struct(&png, &info, &endinfo);
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
|
|
|
|
// ----------------- Read the image
|
|
|
|
|
2013-02-19 09:54:49 +01:00
|
|
|
@@ -154,7 +151,7 @@ char *WritePngImage(char *file_name,unsi
|
2012-03-25 19:01:45 +02:00
|
|
|
{
|
|
|
|
sprintf(PngErrorMessage,"png_create_info_struct() failed");
|
|
|
|
fclose(fp);
|
|
|
|
- png_destroy_write_struct(&png_ptr, png_infopp_NULL);
|
|
|
|
+ png_destroy_write_struct(&png_ptr, NULL);
|
|
|
|
return PngErrorMessage;
|
|
|
|
}
|
|
|
|
|