MM's Other Games > R, Crimson Glory
A word from the other guy behind R...
sqweek:
The source changes required for linux are trivial. I'm not sure what library itoa() comes from but it doesn't appear to be standard - I changed all occurences to use snprintf().
The other problem was the "pick" variable being defined as an int then set to 99923909011, which isn't guarenteed to fit in an int (and which gcc won't accept as a literal int). long is only 32-bits here aswell so I changed pick to int64_t which is defined in <inttypes.h> - probably best to double check whether that's portable back to windows.
Oh yeah, the code isn't clean enough to compile with gcc4 and I'm not particularly interested in making it so so I used gcc34. The following patch contains a Makefile which you'll need to edit some paths in.
diff -u source code/game-AI.cpp ./game-AI.cpp
--- source code/game-AI.cpp 2006-12-16 20:55:34.000000000 +0900
+++ ./game-AI.cpp 2006-12-31 16:51:59.000000000 +0900
@@ -1,7 +1,6 @@
#include "preheader.h"
#include "game.h"
-
void CGame::LudensAI(int num)
{
Ludens[num].state = 0;
@@ -1172,12 +1171,12 @@
if (Engine.key_0)
{
Dialog.SetDialog("10", DIALOG_HERO_X, DIALOG_HERO_Y, 20, sceneTimer);
- pick = 99923909011;
+ pick = 99923909011LL;
}
}
static char buffer[10];
- itoa(pick, buffer, 10);
+ snprintf(buffer, sizeof(buffer), "%d", pick);
if ((sceneTimer == Dialog.lastTime + Dialog.duration)&&(Dialog.count == 9))
Dialog.SetDialog(buffer, DIALOG_RIDDLER_X, DIALOG_RIDDLER_Y, 25, sceneTimer);
Only in .: game-AI.o
diff -u source code/game.cpp ./game.cpp
--- source code/game.cpp 2006-12-22 13:45:36.000000000 +0900
+++ ./game.cpp 2006-12-31 16:56:01.000000000 +0900
@@ -869,7 +869,7 @@
drawString(Engine.Screen, Engine.font, 60, SCREEN_HEIGHT-40, editLudensName);
drawString(Engine.Screen, Engine.font, SCREEN_WIDTH-160, SCREEN_HEIGHT-40, "Sprite Num: ");
- itoa(editLudensNum,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", editLudensNum);
drawString(Engine.Screen, Engine.font, SCREEN_WIDTH-80, SCREEN_HEIGHT-40, buffer);
// debug
@@ -898,31 +898,31 @@
drawString(Engine.Screen, Engine.font, 0, 0, Engine.LastVideoError);
drawString(Engine.Screen, Engine.font, 0, 20, "XY");
- itoa(Ludens[myLudens].posX >> FIX, buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", Ludens[myLudens].posX >> FIX);
drawString(Engine.Screen, Engine.font, 40, 20, buffer);
- itoa(Ludens[myLudens].posY >> FIX, buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", Ludens[myLudens].posY >> FIX);
drawString(Engine.Screen, Engine.font, 80, 20, buffer);
- itoa(mapNum,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", mapNum);
drawString(Engine.Screen, Engine.font, 0, 40, "map:");
drawString(Engine.Screen, Engine.font, 40, 40, buffer);
- itoa(sceneTimer,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", sceneTimer);
drawString(Engine.Screen, Engine.font, 0, 60, "timer:");
drawString(Engine.Screen, Engine.font, 40, 60, buffer);
- itoa(fps,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", fps);
drawString(Engine.Screen, Engine.font, 0, 80, "fps:");
drawString(Engine.Screen, Engine.font, 40, 80, buffer);
- itoa(Ludens[1].counter,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", Ludens[1].counter);
drawString(Engine.Screen, Engine.font, 0, 100, "c:");
drawString(Engine.Screen, Engine.font, 40, 100, buffer);
if (useMusicCheck)
{
int k = FSOUND_GetCurrentPosition(Engine.Sound.SpecialChannel);
- itoa(k,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", k);
drawString(Engine.Screen, Engine.font, 0, 120, "mlen:");
drawString(Engine.Screen, Engine.font, 40, 120, buffer);
}
@@ -2468,7 +2468,7 @@
SaveGame();
- itoa (mapNum, num, 10);
+ snprintf(num, sizeof(num), "%d", mapNum);
map = new char[2+strlen(mapName)+strlen(num)+4+1];
strcpy(map, "m/");
strcat(map, mapName);
@@ -2907,7 +2907,7 @@
drawString(Engine.Screen, Engine.menufont, MENU_STARTX, MENU_STARTY + 0*MENU_SPACE, "Back");
for (i=0; i<level+1; i++)
{
- itoa(i,buffer,10);
+ snprintf(buffer, sizeof(buffer), "%d", i);
drawString(Engine.Screen, Engine.menufont, MENU_STARTX, MENU_STARTY + (i+1)*MENU_SPACE, buffer);
drawString(Engine.Screen, Engine.menufont, MENU_STARTX + 30, MENU_STARTY + (i+1)*MENU_SPACE, Levels);
}
diff -u source code/game.h ./game.h
--- source code/game.h 2006-12-22 13:36:42.000000000 +0900
+++ ./game.h 2006-12-31 16:51:45.000000000 +0900
@@ -8,6 +8,7 @@
#include "ludens.h"
#include "part.h"
#include "cutscenes.h"
+#include <inttypes.h>
static char *Levels[] =
{ "R intro",
@@ -151,7 +152,7 @@
int oldSecretX, oldSecretY;
int sceneLudens[2];
int oldT;
- int pick;
+ int64_t pick;
int bagsPicked;
diff -Nu source\ code/Makefile ./Makefile
--- source code/Makefile 1970-01-01 08:00:00.000000000 +0800
+++ ./Makefile 2006-12-31 17:01:31.000000000 +0900
@@ -0,0 +1,11 @@
+OBJS=cutscenes.o engine.o filters.o font.o game-action.o game-AI.o game.o game-physics.o game-terminals.o game-tick.o ludens.o part.o r.o sound.o sprite.o tilemap.o
+
+#point this to your C++ compiler, gcc4 or later probably won't work
+CXX=/opt/gcc34/bin/g++
+#You'll have to change the fmod path to where you have it installed, of course <http://www.fmod.org/>
+CPPFLAGS=-I/usr/include/SDL -I/home/sqweek/pkg/fmodapi375linux/api/inc
+LDFLAGS=-L/home/sqweek/pkg/fmodapi375linux/api
+LDLIBS=-lSDL -lfmod-3.75
+
+all: r
+
+r: $(OBJS)
+ $(LINK.cc) $^ $(LDLIBS) -o $@
temporarysanity:
I'm an idiot when it comes to applying patches in Linux if it isn't described really idiot-friendly. I don't get it o_O
Michal Marcinkowski:
There is no such thing as idiot-friendly in linux haha!
M.rSnow:
nope its no idea creating some thing idiot friendly to Linux u gotta buy (or read on the net) a book to get threw Linux. really hard. So that code or something is enough. (If it works)
miketh2005:
--- Quote from: Ender on December 26, 2006, 09:29:29 am ---Heh i love your (and michal's) humour :)
But yeah, the game just doesn't play natural, plus it starts hella slow and it keeps crashing on controlling the mole in level 20 so i can't even finish it. Too bad, maybe another programmer could work on it but i doubt he would have the same sense of humour and that's really the best thing about the project.
Still, a fun christmas gift :D
--- End quote ---
Wow, you missed the best part, which was the ending. The mole level was hard. You have to jump over the predator's head just as he turns around.
Navigation
[0] Message Index
[*] Previous page
Go to full version