Skip to content

Commit

Permalink
Added patches from dmitrysmagin to CGW-Zero support
Browse files Browse the repository at this point in the history
  • Loading branch information
nevat committed Nov 5, 2013
1 parent ea0ead9 commit e2d52c5
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 38 deletions.
Binary file added abbaye2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/intro-gcw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions make_opk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

OPK_NAME=abbaye.opk
echo ${OPK_NAME}

# create default.gcw0.desktop
cat > default.gcw0.desktop <<EOF
[Desktop Entry]
Name=Abbaye des Morts
Comment=Labyrinth roaming
Exec=abbaye
Terminal=false
Type=Application
StartupNotify=true
Icon=abbaye2
Categories=games;
EOF

# create opk
FLIST="fonts"
FLIST="${FLIST} graphics"
FLIST="${FLIST} mapa"
FLIST="${FLIST} music"
FLIST="${FLIST} sounds"
FLIST="${FLIST} README"
FLIST="${FLIST} abbaye"
FLIST="${FLIST} abbaye2.png"
FLIST="${FLIST} default.gcw0.desktop"

rm -f ${OPK_NAME}
mksquashfs ${FLIST} ${OPK_NAME} -all-root -no-xattrs -noappend -no-exports

cat default.gcw0.desktop
rm -f default.gcw0.desktop
61 changes: 51 additions & 10 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,58 @@
# Compilation
#
# use `make TARGET=gcw0` to build for GCW-Zero
# and `make` for normal build
#

all: abbaye abbaye-pandora
#TARGET = gcw0
#TARGET = pandora

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
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
NAME = abbaye

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
$(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
CFLAGS = -s -O2 `sdl-config --cflags`
LIBS = -lSDL_image -lSDL_ttf -lSDL_mixer -lSDL_gfx `sdl-config --libs` -lm

# assume cross-compilation
ifeq "$(TARGET)" "gcw0"
CC = mipsel-linux-gcc
CFLAGS += -mips32 -D_GCW_ZERO
else
ifeq "$(TARGET)" "pandora"
CC = $(PREFIX)gcc
CFLAGS += -D_OPENPANDORA \
-finline-functions -funswitch-loops -fpredictive-commoning \
-fgcse-after-reload -ftree-vectorize
NAME = abbaye-pandora
else
CC = gcc

# detect mingw and do some fixes
ifeq ($(OS),Windows_NT)
CFLAGS += -Dsleep=SDL_Delay -D_RUTAS_RELATIVAS
NAME = abbaye.exe
endif
endif
endif

SRC = ./src/main.c \
./src/barradeestado.c \
./src/bosses.c \
./src/enemigos.c \
./src/fase.c \
./src/jean.c \
./src/musica.c \
./src/pantallas.c

all: $(NAME)

$(NAME): $(SRC) ./src/comun.h
$(CC) $(CFLAGS) $(SRC) $(LIBS) -o $(NAME)

clean:
rm -f abbaye
rm -f abbaye-pandora
rm -f $(NAME)

# Installation
install:
cp abbaye /usr/bin/
cp $(NAME) /usr/bin/
cp abbaye.desktop /usr/share/applications
mkdir -p /usr/share/abbaye/music
cp ./music/* /usr/share/abbaye/music
Expand All @@ -29,7 +67,10 @@ install:
cp -r ./graphics/* /usr/share/abbaye/graphics

uninstall:
rm /usr/bin/abbaye
rm /usr/bin/$(NAME)
rm /usr/share/applications/abbaye.desktop
rm /usr/share/pixmaps/abbaye.png
rm -rf /usr/share/abbaye

opk: $(NAME)
./make_opk.sh
23 changes: 20 additions & 3 deletions src/comun.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#ifndef _COMUN_H_
#define _COMUN_H_

#ifdef _OPENPANDORA
#if defined(_OPENPANDORA) || defined (_GCW_ZERO)
/* La versión para OpenPandora usa rutas relativas */
#define _RUTAS_RELATIVAS
/* La versión para OpenPandora renderiza internamente a 320x240 */
Expand Down Expand Up @@ -134,8 +134,25 @@
#endif

#ifdef _OPENPANDORA
#undef RUTA_GRA_INTRO
#define RUTA_GRA_INTRO "graphics/intro-pandora.png"
#undef RUTA_GRA_INTRO
#define RUTA_GRA_INTRO "graphics/intro-pandora.png"
#define KEY_JUMP SDLK_PAGEDOWN
#define KEY_START SDLK_PAGEDOWN
#define KEY_GRAPHICS SDLK_c
#define KEY_INFO SDLK_i

#elif defined(_GCW_ZERO)
#undef RUTA_GRA_INTRO
#define RUTA_GRA_INTRO "graphics/intro-gcw.png"
#define KEY_JUMP SDLK_LCTRL
#define KEY_START SDLK_RETURN
#define KEY_GRAPHICS SDLK_LALT
#define KEY_INFO SDLK_SPACE
#else
#define KEY_JUMP SDLK_UP
#define KEY_START SDLK_SPACE
#define KEY_GRAPHICS SDLK_c
#define KEY_INFO SDLK_i
#endif

#endif /* _COMUN_H_ */
Expand Down
35 changes: 10 additions & 25 deletions src/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Abbaye des Morts */
/* Version 1.0 */
/* Version 1.13 */
/* Port iniciado el 18/10/2012 */
/* Version 1.0 finalizada el 28/12/2012 */
/* Version 1.1 finalizada el 14/01/2013 */
Expand Down Expand Up @@ -36,6 +36,7 @@
#include <SDL_getenv.h>
#include "main.h"

#undef main
main () {

/* Variables */
Expand All @@ -46,7 +47,7 @@ main () {

/* Iniciar SDL */
iniciar_sdl ();
SDL_WM_SetCaption("Abbaye des Morts - v1.11", "Abbaye des Morts");
SDL_WM_SetCaption("Abbaye des Morts - v1.13", "Abbaye des Morts");
#ifdef _RENDER_320_240
pantalla = SDL_SetVideoMode(320,240,8,SDL_HWSURFACE|SDL_DOUBLEBUF);
#else
Expand Down Expand Up @@ -1222,11 +1223,7 @@ void tecladoj (struct protagonista *jean, int *tecla) {
if (evento.type == SDL_QUIT)
exit(0);
if (evento.type == SDL_KEYDOWN) {
#ifdef _OPENPANDORA
if (evento.key.keysym.sym == SDLK_PAGEDOWN) {
#else
if (evento.key.keysym.sym == SDLK_UP) {
#endif
if (evento.key.keysym.sym == KEY_JUMP) {
if ((jean->pulsa[0] == 0) && (jean->salto == 0) && (jean->agachado == 0))
jean->salto = 1;
}
Expand All @@ -1250,18 +1247,14 @@ void tecladoj (struct protagonista *jean, int *tecla) {
}
if (evento.key.keysym.sym == SDLK_f)
*tecla = 6;
if (evento.key.keysym.sym == SDLK_c)
if (evento.key.keysym.sym == KEY_GRAPHICS)
*tecla = 9;
if (evento.key.keysym.sym == SDLK_ESCAPE)
exit(0);
}

if (evento.type == SDL_KEYUP) {
#ifdef _OPENPANDORA
if (evento.key.keysym.sym == SDLK_PAGEDOWN)
#else
if (evento.key.keysym.sym == SDLK_UP)
#endif
if (evento.key.keysym.sym == KEY_JUMP)
jean->pulsa[0] = 0;
if (evento.key.keysym.sym == SDLK_DOWN) {
jean->pulsa[1] = 0;
Expand All @@ -1286,21 +1279,17 @@ void teclado (int *tecla, int fase) {
if (evento.type == SDL_QUIT)
exit(0);
if (evento.type == SDL_KEYDOWN) {
if (evento.key.keysym.sym == SDLK_i) {
if (evento.key.keysym.sym == KEY_INFO) {
if (fase == 1)
*tecla = 7;
}
if (evento.key.keysym.sym == SDLK_ESCAPE)
exit(0);
if (evento.key.keysym.sym == SDLK_f)
*tecla = 6;
if (evento.key.keysym.sym == SDLK_c)
if (evento.key.keysym.sym == KEY_GRAPHICS)
*tecla = 9;
#ifdef _OPENPANDORA
if (evento.key.keysym.sym == SDLK_PAGEDOWN)
#else
if (evento.key.keysym.sym == SDLK_SPACE)
#endif
if (evento.key.keysym.sym == KEY_START)
*tecla = 5;
}
}
Expand All @@ -1313,11 +1302,7 @@ void tecladop (int *teclap) {

while (SDL_PollEvent(&evento)) {
if (evento.type == SDL_KEYDOWN) {
#ifdef _OPENPANDORA
if ((evento.key.keysym.sym == SDLK_PAGEDOWN) ||
#else
if ((evento.key.keysym.sym == SDLK_SPACE) ||
#endif
if ((evento.key.keysym.sym == KEY_START) ||
(evento.key.keysym.sym == SDLK_LEFT) || (evento.key.keysym.sym == SDLK_RIGHT))
*teclap = 1;
}
Expand Down

0 comments on commit e2d52c5

Please sign in to comment.