Skip to content

Commit e2d52c5

Browse files
committed
Added patches from dmitrysmagin to CGW-Zero support
1 parent ea0ead9 commit e2d52c5

File tree

6 files changed

+115
-38
lines changed

6 files changed

+115
-38
lines changed

abbaye2.png

897 Bytes
Loading

graphics/intro-gcw.png

7.85 KB
Loading

make_opk.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
OPK_NAME=abbaye.opk
4+
echo ${OPK_NAME}
5+
6+
# create default.gcw0.desktop
7+
cat > default.gcw0.desktop <<EOF
8+
[Desktop Entry]
9+
Name=Abbaye des Morts
10+
Comment=Labyrinth roaming
11+
Exec=abbaye
12+
Terminal=false
13+
Type=Application
14+
StartupNotify=true
15+
Icon=abbaye2
16+
Categories=games;
17+
EOF
18+
19+
# create opk
20+
FLIST="fonts"
21+
FLIST="${FLIST} graphics"
22+
FLIST="${FLIST} mapa"
23+
FLIST="${FLIST} music"
24+
FLIST="${FLIST} sounds"
25+
FLIST="${FLIST} README"
26+
FLIST="${FLIST} abbaye"
27+
FLIST="${FLIST} abbaye2.png"
28+
FLIST="${FLIST} default.gcw0.desktop"
29+
30+
rm -f ${OPK_NAME}
31+
mksquashfs ${FLIST} ${OPK_NAME} -all-root -no-xattrs -noappend -no-exports
32+
33+
cat default.gcw0.desktop
34+
rm -f default.gcw0.desktop

makefile

+51-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,58 @@
1-
# Compilation
1+
#
2+
# use `make TARGET=gcw0` to build for GCW-Zero
3+
# and `make` for normal build
4+
#
25

3-
all: abbaye abbaye-pandora
6+
#TARGET = gcw0
7+
#TARGET = pandora
48

5-
abbaye: ./src/main.c ./src/barradeestado.c ./src/bosses.c ./src/enemigos.c ./src/fase.c ./src/jean.c ./src/musica.c ./src/pantallas.c ./src/comun.h
6-
gcc -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize ./src/main.c ./src/barradeestado.c ./src/bosses.c ./src/enemigos.c ./src/fase.c ./src/jean.c ./src/musica.c ./src/pantallas.c -o abbaye `sdl-config --cflags --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx -lm
9+
NAME = abbaye
710

8-
abbaye-pandora: ./src/main.c ./src/barradeestado.c ./src/bosses.c ./src/enemigos.c ./src/fase.c ./src/jean.c ./src/musica.c ./src/pantallas.c ./src/comun.h
9-
$(PREFIX)gcc -O3 -finline-functions -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize ./src/main.c ./src/barradeestado.c ./src/bosses.c ./src/enemigos.c ./src/fase.c ./src/jean.c ./src/musica.c ./src/pantallas.c -o abbaye-pandora `sdl-config --cflags --libs` -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx -lm -D_OPENPANDORA
11+
CFLAGS = -s -O2 `sdl-config --cflags`
12+
LIBS = -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx `sdl-config --libs` -lm
13+
14+
# assume cross-compilation
15+
ifeq "$(TARGET)" "gcw0"
16+
CC = mipsel-linux-gcc
17+
CFLAGS += -mips32 -D_GCW_ZERO
18+
else
19+
ifeq "$(TARGET)" "pandora"
20+
CC = $(PREFIX)gcc
21+
CFLAGS += -D_OPENPANDORA \
22+
-finline-functions -funswitch-loops -fpredictive-commoning \
23+
-fgcse-after-reload -ftree-vectorize
24+
NAME = abbaye-pandora
25+
else
26+
CC = gcc
27+
28+
# detect mingw and do some fixes
29+
ifeq ($(OS),Windows_NT)
30+
CFLAGS += -Dsleep=SDL_Delay -D_RUTAS_RELATIVAS
31+
NAME = abbaye.exe
32+
endif
33+
endif
34+
endif
35+
36+
SRC = ./src/main.c \
37+
./src/barradeestado.c \
38+
./src/bosses.c \
39+
./src/enemigos.c \
40+
./src/fase.c \
41+
./src/jean.c \
42+
./src/musica.c \
43+
./src/pantallas.c
44+
45+
all: $(NAME)
46+
47+
$(NAME): $(SRC) ./src/comun.h
48+
$(CC) $(CFLAGS) $(SRC) $(LIBS) -o $(NAME)
1049

1150
clean:
12-
rm -f abbaye
13-
rm -f abbaye-pandora
51+
rm -f $(NAME)
1452

1553
# Installation
1654
install:
17-
cp abbaye /usr/bin/
55+
cp $(NAME) /usr/bin/
1856
cp abbaye.desktop /usr/share/applications
1957
mkdir -p /usr/share/abbaye/music
2058
cp ./music/* /usr/share/abbaye/music
@@ -29,7 +67,10 @@ install:
2967
cp -r ./graphics/* /usr/share/abbaye/graphics
3068

3169
uninstall:
32-
rm /usr/bin/abbaye
70+
rm /usr/bin/$(NAME)
3371
rm /usr/share/applications/abbaye.desktop
3472
rm /usr/share/pixmaps/abbaye.png
3573
rm -rf /usr/share/abbaye
74+
75+
opk: $(NAME)
76+
./make_opk.sh

src/comun.h

+20-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#ifndef _COMUN_H_
44
#define _COMUN_H_
55

6-
#ifdef _OPENPANDORA
6+
#if defined(_OPENPANDORA) || defined (_GCW_ZERO)
77
/* La versión para OpenPandora usa rutas relativas */
88
#define _RUTAS_RELATIVAS
99
/* La versión para OpenPandora renderiza internamente a 320x240 */
@@ -134,8 +134,25 @@
134134
#endif
135135

136136
#ifdef _OPENPANDORA
137-
#undef RUTA_GRA_INTRO
138-
#define RUTA_GRA_INTRO "graphics/intro-pandora.png"
137+
#undef RUTA_GRA_INTRO
138+
#define RUTA_GRA_INTRO "graphics/intro-pandora.png"
139+
#define KEY_JUMP SDLK_PAGEDOWN
140+
#define KEY_START SDLK_PAGEDOWN
141+
#define KEY_GRAPHICS SDLK_c
142+
#define KEY_INFO SDLK_i
143+
144+
#elif defined(_GCW_ZERO)
145+
#undef RUTA_GRA_INTRO
146+
#define RUTA_GRA_INTRO "graphics/intro-gcw.png"
147+
#define KEY_JUMP SDLK_LCTRL
148+
#define KEY_START SDLK_RETURN
149+
#define KEY_GRAPHICS SDLK_LALT
150+
#define KEY_INFO SDLK_SPACE
151+
#else
152+
#define KEY_JUMP SDLK_UP
153+
#define KEY_START SDLK_SPACE
154+
#define KEY_GRAPHICS SDLK_c
155+
#define KEY_INFO SDLK_i
139156
#endif
140157

141158
#endif /* _COMUN_H_ */

src/main.c

+10-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* Abbaye des Morts */
2-
/* Version 1.0 */
2+
/* Version 1.13 */
33
/* Port iniciado el 18/10/2012 */
44
/* Version 1.0 finalizada el 28/12/2012 */
55
/* Version 1.1 finalizada el 14/01/2013 */
@@ -36,6 +36,7 @@
3636
#include <SDL_getenv.h>
3737
#include "main.h"
3838

39+
#undef main
3940
main () {
4041

4142
/* Variables */
@@ -46,7 +47,7 @@ main () {
4647

4748
/* Iniciar SDL */
4849
iniciar_sdl ();
49-
SDL_WM_SetCaption("Abbaye des Morts - v1.11", "Abbaye des Morts");
50+
SDL_WM_SetCaption("Abbaye des Morts - v1.13", "Abbaye des Morts");
5051
#ifdef _RENDER_320_240
5152
pantalla = SDL_SetVideoMode(320,240,8,SDL_HWSURFACE|SDL_DOUBLEBUF);
5253
#else
@@ -1222,11 +1223,7 @@ void tecladoj (struct protagonista *jean, int *tecla) {
12221223
if (evento.type == SDL_QUIT)
12231224
exit(0);
12241225
if (evento.type == SDL_KEYDOWN) {
1225-
#ifdef _OPENPANDORA
1226-
if (evento.key.keysym.sym == SDLK_PAGEDOWN) {
1227-
#else
1228-
if (evento.key.keysym.sym == SDLK_UP) {
1229-
#endif
1226+
if (evento.key.keysym.sym == KEY_JUMP) {
12301227
if ((jean->pulsa[0] == 0) && (jean->salto == 0) && (jean->agachado == 0))
12311228
jean->salto = 1;
12321229
}
@@ -1250,18 +1247,14 @@ void tecladoj (struct protagonista *jean, int *tecla) {
12501247
}
12511248
if (evento.key.keysym.sym == SDLK_f)
12521249
*tecla = 6;
1253-
if (evento.key.keysym.sym == SDLK_c)
1250+
if (evento.key.keysym.sym == KEY_GRAPHICS)
12541251
*tecla = 9;
12551252
if (evento.key.keysym.sym == SDLK_ESCAPE)
12561253
exit(0);
12571254
}
12581255

12591256
if (evento.type == SDL_KEYUP) {
1260-
#ifdef _OPENPANDORA
1261-
if (evento.key.keysym.sym == SDLK_PAGEDOWN)
1262-
#else
1263-
if (evento.key.keysym.sym == SDLK_UP)
1264-
#endif
1257+
if (evento.key.keysym.sym == KEY_JUMP)
12651258
jean->pulsa[0] = 0;
12661259
if (evento.key.keysym.sym == SDLK_DOWN) {
12671260
jean->pulsa[1] = 0;
@@ -1286,21 +1279,17 @@ void teclado (int *tecla, int fase) {
12861279
if (evento.type == SDL_QUIT)
12871280
exit(0);
12881281
if (evento.type == SDL_KEYDOWN) {
1289-
if (evento.key.keysym.sym == SDLK_i) {
1282+
if (evento.key.keysym.sym == KEY_INFO) {
12901283
if (fase == 1)
12911284
*tecla = 7;
12921285
}
12931286
if (evento.key.keysym.sym == SDLK_ESCAPE)
12941287
exit(0);
12951288
if (evento.key.keysym.sym == SDLK_f)
12961289
*tecla = 6;
1297-
if (evento.key.keysym.sym == SDLK_c)
1290+
if (evento.key.keysym.sym == KEY_GRAPHICS)
12981291
*tecla = 9;
1299-
#ifdef _OPENPANDORA
1300-
if (evento.key.keysym.sym == SDLK_PAGEDOWN)
1301-
#else
1302-
if (evento.key.keysym.sym == SDLK_SPACE)
1303-
#endif
1292+
if (evento.key.keysym.sym == KEY_START)
13041293
*tecla = 5;
13051294
}
13061295
}
@@ -1313,11 +1302,7 @@ void tecladop (int *teclap) {
13131302

13141303
while (SDL_PollEvent(&evento)) {
13151304
if (evento.type == SDL_KEYDOWN) {
1316-
#ifdef _OPENPANDORA
1317-
if ((evento.key.keysym.sym == SDLK_PAGEDOWN) ||
1318-
#else
1319-
if ((evento.key.keysym.sym == SDLK_SPACE) ||
1320-
#endif
1305+
if ((evento.key.keysym.sym == KEY_START) ||
13211306
(evento.key.keysym.sym == SDLK_LEFT) || (evento.key.keysym.sym == SDLK_RIGHT))
13221307
*teclap = 1;
13231308
}

0 commit comments

Comments
 (0)