100 Commits
v1.02 ... v1.07

Author SHA1 Message Date
2abde36a5e Actualizadas las etiquetas a la versión 1.07 2022-12-02 19:16:00 +01:00
0a083af712 El nombre de la habitación se pinta a partir de una textura 2022-12-02 09:35:49 +01:00
f322b1b81b Eliminada una variable static que no se utilizaba 2022-12-01 22:36:41 +01:00
13fe98edb3 Arreglado un poco el metodo de apertura de la Jail 2022-12-01 22:27:23 +01:00
c90b49c8be Añadido Batman a FEEL THE HEAT 2022-12-01 22:14:51 +01:00
d3a5c0e54f Cambiado el tamaño de la textura usado para pintar el mapa 2022-12-01 22:07:03 +01:00
254ff50ef3 Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma 2022-12-01 22:05:05 +01:00
e551206351 Actualizado el cielo de la Jail 2022-12-01 22:04:47 +01:00
b22e830dac Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma 2022-12-01 21:05:37 +01:00
a81d42cb25 Corregido bug: en la jail se rellenaban las vidas mientras estaba activa la pausa 2022-12-01 21:05:34 +01:00
3ea0025fb4 Retocada la pantalla de titulo 2022-12-01 21:03:12 +01:00
d7c49a0578 Modificado el sprite de PACO 2022-12-01 20:15:34 +01:00
4cbe55c2d4 Actualizado jail_audio a la última versión 2022-12-01 19:51:53 +01:00
564f316586 Cambiado el nombre del enemigo diskette a floppy 2022-12-01 19:32:59 +01:00
522ab8e726 Cambios cosméticos en algunas habitaciones. Cambiado el nombre de STATIC a BE CAREFUL WITH THE FUSE 2022-12-01 19:31:35 +01:00
4911282777 El color de fondo de la habitación se pinta en la textura del mapa 2022-12-01 11:40:35 +01:00
06ecabc676 Corregido un "memory leak" en texture.cpp 2022-12-01 10:43:58 +01:00
5d89a3057e Optimizado un poco el title.cpp 2022-11-30 13:43:47 +01:00
75228cc451 Eliminado el resto de accesos a vector mediante at() 2022-11-30 12:09:45 +01:00
357eec20b1 Eliminados la mayor parte de accesos a vector mediante at() 2022-11-30 12:03:37 +01:00
62c1e2715e Preparando el juego para ser compatble con consolas 2022-11-30 11:06:27 +01:00
34fc2b6b06 Optimizada la intro 2022-11-30 10:10:10 +01:00
6557dea2bb Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma 2022-11-30 08:27:11 +01:00
2caea7ba6e Optimizando la intro 2022-11-30 08:26:16 +01:00
d33d2e4a09 Cambiado el nombre de algunos enemigos 2022-11-29 21:26:28 +01:00
d9174dcdb9 Cambiado el nombre de algunos enemigos 2022-11-29 21:08:33 +01:00
22f7204e08 Añadidas mas dll para el release de windows 2022-11-29 19:41:14 +01:00
06fab0d457 Actualizado Makefile 2022-11-29 19:16:14 +01:00
f180f88068 Corregido error en el texto de las teclas nuevas para moverse 2022-11-29 19:12:04 +01:00
4109d6c938 Actualizado Readme.md. Cambiado LICENSE a LICENSE.txt 2022-11-29 19:11:02 +01:00
9c2264ca75 Actualizado Makefile 2022-11-29 19:07:59 +01:00
c59739c7ba Cambiado el tamaño del borde de porcentaje a valor absoluto en pixeles 2022-11-29 18:45:25 +01:00
4a430c0d5b Actualizadas las instrucciones con el método de control escogido 2022-11-29 18:22:40 +01:00
5a7f637f4b Cambiada la tecla de pausa a la tecla H (HOLD) 2022-11-29 18:07:31 +01:00
c63298b555 Posibilidad de escoger diferentes configuraciónes prefijadas de teclas de control desde el fichero de configuración 2022-11-29 18:05:38 +01:00
82aa91bead Corregida la funcion para verificar si existen los ficheros de recursos 2022-11-29 17:29:18 +01:00
f4129e109a Actualizado Makefile 2022-11-29 17:25:08 +01:00
5e8714697d Añadido un tile para poder bajar en la fase ULA HOP! 2022-11-29 17:23:12 +01:00
dd4355051f Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma 2022-11-28 09:01:22 +01:00
160b212a43 Actualizado info.plist 2022-11-28 09:01:21 +01:00
69d3b076d7 Modificadas algunas fases para prevenir glitches 2022-11-28 07:53:07 +01:00
3817a01712 Guardado de las opciones de las notificaciones 2022-11-24 12:55:34 +01:00
ba19dcb904 Actualizar 'README.md' 2022-11-23 22:37:02 +01:00
b035b92ff4 Retocada ROAD TO THE JAIL 2022-11-23 22:32:57 +01:00
8c425f5698 Fix: De enter_id iba siempre a intro 2022-11-23 22:22:32 +01:00
d382bb6403 Optimizado el calculo del tamaño de las notificaciones 2022-11-23 20:53:01 +01:00
da64a5e082 Oculta el ratón en el modo a pantalla completa 2022-11-23 20:38:21 +01:00
7070dac482 Arreglado tamaño de las notificaciones en pantalla completa 2022-11-23 20:33:54 +01:00
ea5360ea74 Trabajando en las notificaciones 2022-11-23 20:14:53 +01:00
3aa4440390 Trabajando en las notificaciones 2022-11-23 20:05:07 +01:00
ce105e252e Trabajando en el tamaño de las notificaciones 2022-11-23 19:52:10 +01:00
1aac5b7719 Trabajando en las notificaciones 2022-11-23 18:20:29 +01:00
a8b467290f Completado el ciclo para pedir el ID online. Añadido sonido a las notificaciones. Agregado control de versión del fichero de configuración 2022-11-23 16:59:40 +01:00
706ad6f9c0 Trabajando en el escalado de las notificaciones 2022-11-23 14:11:47 +01:00
54d428ed96 Ya permite establecer el online ID desde el propio juego 2022-11-23 13:29:35 +01:00
c71adfbac4 Trabajando en la sección EnterID 2022-11-23 09:54:08 +01:00
c955543d31 Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma 2022-11-22 16:44:27 +01:00
fae8e2d82c Actualizado Makefile 2022-11-22 16:44:23 +01:00
ff7b825cbb Actualizar 'README.md' 2022-11-22 16:39:39 +01:00
09ed0105e9 Cambiada la ubicación del fichero config.txt a la carpeta de sistema 2022-11-22 16:26:58 +01:00
07ae93fd3a Actualizado Makefile 2022-11-22 14:11:17 +01:00
72fb30b927 Actualizado Makefile 2022-11-22 13:59:41 +01:00
8d37f31a08 Cambiada una frase de castellano a ingles en el fichero de estadisticas 2022-11-22 13:35:15 +01:00
e6fb412c4d Fix: La pantalla de Game Over no mostraba Tu peor pesadilla 2022-11-22 13:34:33 +01:00
10c29eb547 Actualizado Makefile 2022-11-22 13:20:13 +01:00
1f9e36dc93 Actualizado info.plist 2022-11-22 13:07:12 +01:00
c114884de1 FIx: El logo se formaba mal despues de haber toqueteado cosas de la clase Sprite 2022-11-22 13:05:34 +01:00
d6a366555d Actualizado Makefile 2022-11-22 12:53:56 +01:00
fd0d8a05fe Actualizado Makefile 2022-11-22 12:45:47 +01:00
79d610a7d9 Actualizado Makefile 2022-11-22 12:42:25 +01:00
9060e1c92a Añadida carpeta de sistema para el modo debug 2022-11-22 12:38:09 +01:00
0d586c0827 Ya funcionan las estadísticas online 2022-11-22 10:42:30 +01:00
fd0bebf533 Trabajando en las estadisticas online 2022-11-18 20:06:07 +01:00
2665b93b70 Añadida Tu peor pesadilla a la pantalla de Game Over 2022-11-18 16:07:33 +01:00
c35be7d21c Empezado a escribir datos de estadisticas en el servidor 2022-11-19 12:07:36 +01:00
bc84968b23 Ya funcionan las notificaciones 2022-11-19 10:28:15 +01:00
1b49097f80 Cambiado el tamaño por defecto del borde 2022-11-19 09:27:55 +01:00
859e3f3b44 Actualizado Makefile 2022-11-19 09:27:24 +01:00
3fa7657c79 Cuendo el jugador entra a la Jail, recupera todas sus vidas 2022-11-19 09:22:10 +01:00
e90c61a416 FIx: El jugador no se moria al caer de alto si se mantenia la tecla de slto pulsada 2022-11-19 09:02:35 +01:00
d003b51de4 Reparada la clase Screen 2022-11-19 07:49:01 +01:00
8d381010c8 Trabajando en la clase Screen 2022-11-19 07:37:03 +01:00
2216c9632e Trabajando en las notificaciones 2022-11-18 23:15:38 +01:00
fdc8797d2b Arreglada la clase Screen. Había un lio de conceptos con varias variables 2022-11-18 20:09:03 +01:00
90bdad7d51 Modificado Makefile 2022-11-18 10:43:54 +01:00
d50b193d9f Cambiado el fichero de estadisticas a stats.csv 2022-11-18 10:43:01 +01:00
ee885d5ca7 Ya crea correctamente la carpeta de sistema en las tres plataformas 2022-11-18 10:40:51 +01:00
bb3a0f263b Ya crea la carpeta de sistema en MacOS y Windows 2022-11-18 10:35:15 +01:00
85d6c48f42 Ya crea la carpeta de sistema en Linux 2022-11-18 09:48:46 +01:00
896dd9daef Trabajando en el guardado de las estadisticas en las carpetas del sistema 2022-11-18 07:32:15 +01:00
dc8c0c9e4f Fix: Algunas texturas desaparecen al bloquearse la pantalla 2022-11-17 17:54:05 +01:00
7af0dda1a0 En la pantalla de Game Over se muestran las habitaciones y los items conseguidos 2022-11-17 16:33:37 +01:00
0adf8c63f4 Las habitaciones solo cuentan como visitadas una vez por partida 2022-11-17 16:06:31 +01:00
d33f691743 Fix: Algunas texturas desaparecen al bloquearse la pantalla 2022-11-17 16:04:03 +01:00
a304f50e93 Merge branch 'master' of https://gitea.sustancia.synology.me/JailDesigner/jaildoctors_dilemma 2022-11-17 11:53:07 +01:00
496bf5c05c Actualizado Makefile 2022-11-17 11:53:00 +01:00
26a6bd6b1f Cambiada la posición y dirección inicial del tuno magenta en KILLING SPREE 2022-11-17 11:31:54 +01:00
c48dce8634 Actualizado Makefile 2022-11-17 09:36:12 +01:00
a0de547370 Eliminado un warning de variable no utilizada 2022-11-17 09:34:06 +01:00
5af554fecd Añadido soporte preliminar para estadisticas 2022-11-17 09:30:56 +01:00
122 changed files with 3045 additions and 1030 deletions

5
.gitignore vendored
View File

@@ -1,5 +1,6 @@
.vscode .vscode
*config.txt *data/config/config.txt
*stats.txt
*.DS_Store *.DS_Store
thumbs.db thumbs.db
*.exe *.exe
@@ -9,4 +10,4 @@ thumbs.db
*.tar.gz *.tar.gz
*.zip *.zip
*.app *.app
*_debug *_debug*

View File

@@ -2,7 +2,7 @@ executable = jaildoctors_dilemma
source = source/*.cpp source/common/*.cpp source = source/*.cpp source/common/*.cpp
appName = JailDoctor's Dilemma appName = JailDoctor's Dilemma
releaseFolder = jdd_release releaseFolder = jdd_release
version = v1.02 version = v1.07
# Release names # Release names
windowsRelease = $(executable)-$(version)-win32-x64.zip windowsRelease = $(executable)-$(version)-win32-x64.zip
@@ -12,34 +12,33 @@ linuxRelease = $(executable)-$(version)-linux.tar.gz
windows: windows:
@echo off @echo off
powershell if (Test-Path data\config) {Remove-Item data\config -Recurse -Force} g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable).exe"
powershell if (-not (Test-Path data\config)) {New-Item data\config -ItemType Directory} strip -s -R .comment -R .gnu.version "$(executable).exe" --strip-unneeded
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o $(executable).exe
strip -s -R .comment -R .gnu.version $(executable).exe --strip-unneeded windows_debug:
@echo off
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(executable)_debug.exe"
strip -s -R .comment -R .gnu.version "$(executable)_debug.exe" --strip-unneeded
windows_release: windows_release:
@echo off @echo off
# Remove data # Create release folder
powershell if (Test-Path data\config) {Remove-Item data\config -Recurse -Force} powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force}
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force} powershell if (-not (Test-Path "$(releaseFolder)")) {New-Item "$(releaseFolder)" -ItemType Directory}
# Create folders # Prepare data folder
powershell if (-not (Test-Path data\config)) {New-Item data\config -ItemType Directory}
powershell if (-not (Test-Path $(releaseFolder))) {New-Item $(releaseFolder) -ItemType Directory}
# Copy data
powershell Copy-Item -Path "data" -Destination "$(releaseFolder)" -recurse -Force powershell Copy-Item -Path "data" -Destination "$(releaseFolder)" -recurse -Force
powershell Copy-Item "LICENSE" -Destination "$(releaseFolder)"
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
powershell Copy-Item "release/SDL2.dll" -Destination "$(releaseFolder)"
# Remove data
powershell if (Test-Path "$(releaseFolder)\data\room\map.world") {Remove-Item "$(releaseFolder)\data\room\map.world" -Recurse -Force} powershell if (Test-Path "$(releaseFolder)\data\room\map.world") {Remove-Item "$(releaseFolder)\data\room\map.world" -Recurse -Force}
powershell if (Test-Path "$(releaseFolder)\data\room\standard.tsx") {Remove-Item "$(releaseFolder)\data\room\standard.tsx" -Recurse -Force} powershell if (Test-Path "$(releaseFolder)\data\room\standard.tsx") {Remove-Item "$(releaseFolder)\data\room\standard.tsx" -Recurse -Force}
# Copy root files
powershell Copy-Item "LICENSE.txt" -Destination "$(releaseFolder)"
powershell Copy-Item "README.md" -Destination "$(releaseFolder)"
powershell Copy-Item "release\*.dll" -Destination "$(releaseFolder)"
# Build # Build
g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe" g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lws2_32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o "$(releaseFolder)/$(executable).exe"
strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable).exe" --strip-unneeded
# Create ZIP # Create ZIP
@@ -47,16 +46,16 @@ windows_release:
powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease) powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease)
# Remove folder # Remove folder
powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force} powershell if (Test-Path "$(releaseFolder)") {Remove-Item "$(releaseFolder)" -Recurse -Force}
macos: macos:
rm -rdf data/config clang++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o "$(executable)"
mkdir -p data/config
clang++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o $(executable)_macos macos_debug:
clang++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o "$(executable)_debug"
macos_release: macos_release:
# Remove data and possible data # Remove data and possible data from previous builds
rm -rdf data/config
rm -rdf "$(releaseFolder)" rm -rdf "$(releaseFolder)"
rm -rdf Frameworks rm -rdf Frameworks
rm -f tmp.dmg rm -f tmp.dmg
@@ -64,7 +63,6 @@ macos_release:
rm -f "$(macosAppleSiliconRelease)" rm -f "$(macosAppleSiliconRelease)"
# Create folders # Create folders
mkdir -p data/config
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Frameworks" mkdir -p "$(releaseFolder)/$(appName).app/Contents/Frameworks"
mkdir -p "$(releaseFolder)/$(appName).app/Contents/MacOS" mkdir -p "$(releaseFolder)/$(appName).app/Contents/MacOS"
mkdir -p "$(releaseFolder)/$(appName).app/Contents/Resources" mkdir -p "$(releaseFolder)/$(appName).app/Contents/Resources"
@@ -82,6 +80,11 @@ macos_release:
# Copy files # Copy files
cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources" cp release/*.icns "$(releaseFolder)/$(appName).app/Contents/Resources"
cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents" cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents"
cp LICENSE.txt "$(releaseFolder)"
cp README.md "$(releaseFolder)"
# Create links
ln -s /Applications "$(releaseFolder)"/Applications
# Build INTEL # Build INTEL
clang++ $(source) -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12 clang++ $(source) -D MACOS_BUNDLE -std=c++11 -Wall -Os -framework SDL2 -F ./Frameworks -ffunction-sections -fdata-sections -o "$(releaseFolder)/$(appName).app/Contents/MacOS/$(executable)" -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
@@ -104,36 +107,36 @@ macos_release:
rm -rdf "$(releaseFolder)" rm -rdf "$(releaseFolder)"
linux: linux:
rm -rdf data/config g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)"
mkdir -p data/config strip -s -R .comment -R .gnu.version "$(executable)" --strip-unneeded
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(executable)_linux
strip -s -R .comment -R .gnu.version $(executable)_linux --strip-unneeded linux_debug:
g++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(executable)_debug"
strip -s -R .comment -R .gnu.version "$(executable)_debug" --strip-unneeded
linux_release: linux_release:
# Remove data # Remove data
rm -rdf data/config rm -rdf "$(releaseFolder)"
rm -rdf $(releaseFolder)
# Create folders # Create folders
mkdir -p data/config mkdir -p "$(releaseFolder)"
mkdir -p $(releaseFolder)
# Copy data # Copy data
cp -R data $(releaseFolder) cp -R data "$(releaseFolder)"
cp LICENSE $(releaseFolder) cp LICENSE.txt "$(releaseFolder)"
cp README.md $(releaseFolder) cp README.md "$(releaseFolder)"
# Delete data # Delete data
rm -f "$(releaseFolder)/data/room/map.world" rm -f "$(releaseFolder)/data/room/map.world"
rm -f "$(releaseFolder)/data/room/standard.tsx" rm -f "$(releaseFolder)/data/room/standard.tsx"
# Build # Build
g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(releaseFolder)/$(executable) g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o "$(releaseFolder)/$(executable)"
strip -s -R .comment -R .gnu.version $(releaseFolder)/$(executable) --strip-unneeded strip -s -R .comment -R .gnu.version "$(releaseFolder)/$(executable)" --strip-unneeded
# Pack files # Pack files
rm -f $(linuxRelease) rm -f "$(linuxRelease)"
cd $(releaseFolder) && tar -czvf ../$(linuxRelease) * cd "$(releaseFolder)" && tar -czvf "../$(linuxRelease)" *
# Remove data # Remove data
rm -rdf $(releaseFolder) rm -rdf "$(releaseFolder)"

View File

@@ -1,37 +1,87 @@
# JailDoctor's Dilemma # JailDoctor's Dilemma (v1.07)
JailDoc es un Jailer. A los Jailers les gusta empezar proyectos. A nadie le gusta terminarlos. Los Jailers viven en la Jail. A la Jail va uno a empezar proyectos. A la Jail va uno a enseñar sus proyectos. A la Jail va uno a aprender como empezar nuevos proyectos. A la Jail va uno a ayudar a sus compañeros a que empiecen nuevos proyectos. JailDoc es un Jailer. A los Jailers les gusta empezar proyectos. A nadie le gusta terminarlos. Los Jailers viven en la Jail. A la Jail va uno a empezar proyectos. A la Jail va uno a enseñar sus proyectos. A la Jail va uno a aprender como empezar nuevos proyectos. A la Jail va uno a ayudar a sus compañeros a que empiecen nuevos proyectos.
![JailDoctor's Dilemma - Title screen](https://php.sustancia.synology.me/images/jdd_title.png) ![JailDoctor's Dilemma - Title screen](https://php.sustancia.synology.me/images/jdd_title.png)
JailDoc es un Jailer destacado entre los Jailers. Tiene más proyectos empezados que nadie y es el que más ayuda a que los demas empiecen los suyos. JailDoc es un Jailer destacado entre los Jailers. Tiene más proyectos empezados que nadie y es el que más ayuda a que los demas empiecen los suyos.
Un día, ocurrió algo. Alguien terminó un proyecto. Alguien liberó el *Puzzle Jail Facker*. Algún desaprensivo. Un día, ocurrió algo. Alguien terminó un proyecto. Alguien liberó el *Puzzle Jail Facker*. Algún desaprensivo.
Esto hizo que JailDoc decidiera terminar y entregar uno de sus proyectos, pero, ¿cual? ¿JailBattle? ¿Sigmasuá? ¿Calculín Doom? Menudo dilema. JailDoc se arremangó y decidió finalizar y entregar todos sus proyectos inacabados. ¿Lo logrará? Esto hizo que JailDoc decidiera terminar y entregar uno de sus proyectos, pero, ¿cual? ¿JailBattle? ¿Sigmasuá? ¿Calculín Doom? Menudo dilema. JailDoc se arremangó y decidió finalizar y entregar todos sus proyectos inacabados. ¿Lo logrará?
## Jugabilidad ## Jugabilidad
Ayuda a JailDoc a recuperar las partes de su proyecto que estan desperdigadas por cualquier lugar del Universo Jailer. Hay mas de **150 piezas** desperdigadas por **60 pantallas**. Algunas son un paseo, pero en otras tendras que calcular muy bien tus movimientos si no quieres acabar como un arounder del montón. Ayuda a JailDoc a recuperar las partes de su proyecto que estan desperdigadas por cualquier lugar del Universo Jailer. Hay mas de **150 piezas** desperdigadas por **60 pantallas**. Algunas son un paseo, pero en otras tendras que calcular muy bien tus movimientos si no quieres acabar como un arounder del montón.
![JailDoctor's Dilemma - Gameplay](https://php.sustancia.synology.me/images/jdd_game1.png) ![JailDoctor's Dilemma - Gameplay](https://php.sustancia.synology.me/images/jdd_game1.png)
Cuando consigas recuperar gran parte de las piezas desperdigadas, dirigete a la Jail a mostrar a los Jailers como se termina un proyecto. Ten en cuenta que Bry no te dejará entrar. Solo aquellos que han realizado un *Fire Effect* o un *Facedor de Tornejos* son dignos de tal privilegio. Cuando consigas recuperar gran parte de las piezas desperdigadas, dirigete a la Jail a mostrar a los Jailers como se termina un proyecto. Ten en cuenta que Bry no te dejará entrar. Solo aquellos que han realizado un *Fire Effect* o un *Facedor de Tornejos* son dignos de tal privilegio.
## Controles ## Controles
El juego permite tanto el uso del teclado como de un mando de control. Las teclas para manejar el juego son las siguientes: El juego permite tanto el uso del teclado como de un mando de control. Las teclas para manejar el juego son las siguientes:
- **Cursores**: Para mover a izquierda o derecha a JailDoc y para saltar
- **Cursores**: Para mover a izquierda o derecha a JailDoc y para saltar. En el fichero de configuración se pueden cambiar las teclas por otras opciones prefijadas: O, P para moverse y Q para saltar o A, D para moverse y W para saltar.
- **Tecla M**: Activa o desactiva la música - **Tecla M**: Activa o desactiva la música
- **Tecla P**: Pone en pausa el juego - **Tecla P**: Pone en pausa el juego
- **Tecla ESC**: Sale del juego si estas jugando. Sale del programa en cualquier otra circunstancia - **Tecla ESC**: Sale del juego si estas jugando. Sale del programa en cualquier otra circunstancia
- **Tecla F**: Cambia a modo de pantalla completa o de ventana - **Tecla F**: Cambia a modo de pantalla completa o de ventana
- **Teclas F1 a F4**: Cambian el tamaño de la ventana - **Teclas F1 a F4**: Cambian el tamaño de la ventana
- **Tecla B**: Activa o desactiva el borde de colores de la pantalla cuando el programa se ejecuta en modo de ventana - **Tecla B**: Activa o desactiva el borde de colores de la pantalla cuando el programa se ejecuta en modo de ventana
![JailDoctor's Dilemma - Gameplay](https://php.sustancia.synology.me/images/jdd_game2.png) ![JailDoctor's Dilemma - Gameplay](https://php.sustancia.synology.me/images/jdd_game2.png)
## Datos del programa
El programa guarda automáticamente la configuración del modo de video y las estadísticas de juego en tu carpeta personal del sistema. Esta carpeta tiene una ubicación distinta en función del sistema operativo que utilices.
En **Windows** se encuentra en:
`C:\Users\<nombre_de_usuario>\AppData\Roaming\jaildoctors_dilemma`
En **MacOS** se encuentra en:
`~/Library/Application Support/jaildoctors_dilemma`
En **Linux** se encuentra en:
`~/.jaildoctors_dilemma`
La primera vez, el juego te pregunta por tu identificador online. Esta información se guarda para futuras partidas.
En la carpeta está el fichero de configuración `config.txt` donde se puede modificar la configuración para conectarse al servicio online y los ficheros `stats.csv` y `stats_buffer.csv` con información de las estadisticas de juego.
## Agradecimientos ## Agradecimientos
Agradecimientos como siempre a todos los Jailers por motivarme a hacer el juego y ayudarme en los momentos de duda a la hora de escribir el código. Y, como siempre, en especial a JailDoc por su unidad de Jail_Audio y cualquier otro código/ayuda/enseñanzas que haya necesitado para terminar el programa. Agradecimientos como siempre a todos los Jailers por motivarme a hacer el juego y ayudarme en los momentos de duda a la hora de escribir el código. Y, como siempre, en especial a JailDoc por su unidad de Jail_Audio y cualquier otro código/ayuda/enseñanzas que haya necesitado para terminar el programa.
Si no me he descontado, este es el cuarto juego que consigo crear. Si no me he descontado, este es el cuarto juego que consigo crear.
*13 de noviembre de 2022, JailDesigner* *13 de noviembre de 2022, JailDesigner*

View File

Before

Width:  |  Height:  |  Size: 310 B

After

Width:  |  Height:  |  Size: 310 B

View File

Before

Width:  |  Height:  |  Size: 271 B

After

Width:  |  Height:  |  Size: 271 B

View File

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 122 B

View File

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 205 B

View File

Before

Width:  |  Height:  |  Size: 189 B

After

Width:  |  Height:  |  Size: 189 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

View File

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 378 B

View File

@@ -3,7 +3,7 @@ frameHeight=16
[animation] [animation]
name=default name=default
speed=8 speed=4
loop=0 loop=0
frames=0,1,2,3 frames=0,1,2,3,4,5,6,7
[/animation] [/animation]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 357 B

View File

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

View File

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 129 B

View File

@@ -9,8 +9,8 @@ roomLeft=0
roomRight=02.room roomRight=02.room
[enemy] [enemy]
tileSetFile=jailer.png tileSetFile=jailer_#1.png
animation=jailer.ani animation=jailer_#1.ani
width=16 width=16
height=16 height=16
x=1 x=1
@@ -25,8 +25,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jailer3.png tileSetFile=jailer_#3.png
animation=jailer3.ani animation=jailer_#3.ani
width=16 width=16
height=16 height=16
x=4 x=4
@@ -41,8 +41,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jailer.png tileSetFile=jailer_#1.png
animation=jailer.ani animation=jailer_#1.ani
width=16 width=16
height=16 height=16
x=7 x=7
@@ -57,8 +57,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jailer2.png tileSetFile=jailer_#2.png
animation=jailer2.ani animation=jailer_#2.ani
width=16 width=16
height=16 height=16
x=10 x=10
@@ -73,8 +73,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jailer.png tileSetFile=jailer_#1.png
animation=jailer.ani animation=jailer_#1.ani
width=16 width=16
height=16 height=16
x=13 x=13
@@ -89,8 +89,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=printer.png tileSetFile=elsa.png
animation=printer.ani animation=elsa.ani
width=16 width=16
height=16 height=16
x=3 x=3
@@ -105,8 +105,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=printer.png tileSetFile=elsa.png
animation=printer.ani animation=elsa.ani
width=16 width=16
height=16 height=16
x=6 x=6

View File

@@ -3,9 +3,9 @@
<tileset firstgid="1" source="standard.tsx"/> <tileset firstgid="1" source="standard.tsx"/>
<layer id="1" name="Capa de patrones 1" width="32" height="16"> <layer id="1" name="Capa de patrones 1" width="32" height="16">
<data encoding="csv"> <data encoding="csv">
164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164, 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,164, 168,166,185,167,166,185,166,166,168,166,166,167,166,166,185,166,166,43,43,43,43,43,43,43,43,43,43,43,43,43,43,166,
164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 211,181,211,213,211,181,211,212,213,211,181,211,211,212,211,213,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,164,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,

View File

@@ -1,6 +1,6 @@
name=ROAD TO THE JAIL name=ROAD TO THE JAIL
bgColor=black bgColor=black
border=cyan border=blue
tileMapFile=02.tmx tileMapFile=02.tmx
tileSetFile=standard.png tileSetFile=standard.png
roomUp=0 roomUp=0

View File

@@ -3,22 +3,22 @@
<tileset firstgid="1" source="standard.tsx"/> <tileset firstgid="1" source="standard.tsx"/>
<layer id="1" name="Capa de patrones 1" width="32" height="16"> <layer id="1" name="Capa de patrones 1" width="32" height="16">
<data encoding="csv"> <data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,43,43,43,43, 192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,43,43,43,43,43,
43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25, 43,166,166,167,168,166,185,167,166,185,166,166,168,166,166,167,166,166,185,166,166,166,185,167,166,166,166,185,25,25,25,25,
43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,0,0,0, 43,43,211,212,212,211,181,211,213,211,181,211,212,213,211,181,211,211,211,211,212,213,211,181,211,213,181,211,135,0,0,0,
43,43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,0,0,0, 43,43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,135,0,0,0,
43,43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25, 43,43,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,
34,34,304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25, 34,34,304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,303,25,25, 34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,303,25,25,
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25, 34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,
34,34,0,413,413,413,413,0,0,0,0,413,413,413,413,413,0,0,0,0,413,413,413,413,413,413,413,0,0,0,25,25, 34,34,0,413,413,413,413,0,0,0,0,413,304,413,413,413,0,0,0,0,413,304,413,413,413,413,304,0,0,0,25,25,
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25, 34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,387,25,25, 34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,411,25,25,
34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25, 34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,
34,34,389,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,387,25,25, 34,34,413,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,411,25,25,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,513,190,189,190,537,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,524,189,191,548,0,0,0,0,
34,34,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,191,0,0,189,190,189,190,189,190,189,190,25,25 34,34,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,190,189,191,0,0,189,190,189,190,189,190,189,191,25,25
</data> </data>
</layer> </layer>
</map> </map>

View File

@@ -11,8 +11,8 @@ itemColor1=bright_green
itemColor2=green itemColor2=green
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=15 x=15

View File

@@ -10,7 +10,7 @@
134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117, 134,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117, 25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,117,
25,0,0,0,0,0,0,0,0,0,0,417,417,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141, 25,0,0,0,0,0,0,0,0,0,0,417,417,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,141,
25,0,0,556,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,387,25, 25,0,0,556,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,25,
25,25,25,25,25,25,0,0,0,417,417,0,0,0,0,0,0,0,305,31,0,0,0,0,0,0,0,0,0,0,0,305, 25,25,25,25,25,25,0,0,0,417,417,0,0,0,0,0,0,0,305,31,0,0,0,0,0,0,0,0,0,0,0,305,
0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,417,417,0,0,0,0,0,0, 0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,417,417,0,0,0,0,0,0,
0,0,0,0,0,0,0,417,417,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,417,417,0,0,0,0,0,0,0,0,0,0,31,0,0,0,0,0,0,0,0,0,0,0,0,

View File

@@ -18,7 +18,7 @@
0,0,0,0,0,0,0,0,531,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17, 0,0,0,0,0,0,0,0,531,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,
0,0,0,0,0,0,0,0,0,531,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17, 0,0,0,0,0,0,0,0,0,531,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,
0,0,0,0,0,0,0,0,0,0,349,349,349,349,349,349,349,349,349,349,349,538,0,0,0,0,0,0,0,0,0,17, 0,0,0,0,0,0,0,0,0,0,349,349,349,349,349,349,349,349,349,349,349,538,0,0,0,0,0,0,0,0,0,17,
0,0,0,0,0,0,0,0,0,0,0,0,0,41,41,41,41,349,349,349,349,349,349,349,349,349,349,0,0,349,349,349 563,563,563,563,563,563,563,563,563,563,0,0,0,41,41,41,41,349,349,349,349,349,349,349,349,349,349,0,0,349,349,349
</data> </data>
</layer> </layer>
</map> </map>

View File

@@ -11,8 +11,8 @@ itemColor1=red
itemColor2=magenta itemColor2=magenta
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=9 x=9
@@ -27,8 +27,8 @@ color=green
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=1 x=1

View File

@@ -9,13 +9,13 @@
25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
25,0,0,0,527,25,25,25,25,25,25,25,25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 25,0,0,0,527,25,25,25,25,25,25,25,25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,25,25,25,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,527, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,527,25,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,551,0,0,0,0,0,0,0,0,0,527,25,25, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,551,0,0,0,0,0,0,0,0,0,527,25,25,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,0,0,0,0,0,25,25,25,25,25, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,25,0,0,0,0,0,25,25,25,25,25,
25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 25,25,25,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,25,25,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,0,0,0,0,0,25,25,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,
0,0,0,0,395,395,395,395,395,371,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,0,0,0,0,0,0,0, 0,0,0,0,395,395,395,395,395,371,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,0,0,0,0,0,0,25,
0,0,0,0,0,0,0,0,0,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
25,25,551,0,0,0,0,0,0,347,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 25,25,551,0,0,0,0,0,0,347,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25

View File

@@ -48,9 +48,9 @@ animation=tuno.ani
width=16 width=16
height=16 height=16
x=28 x=28
y=8 y=6
vx=0 vx=0
vy=0.4 vy=-0.4
x1=28 x1=28
y1=2 y1=2
x2=28 x2=28

View File

@@ -30,7 +30,7 @@ flip=true
[enemy] [enemy]
tileSetFile=bat.png tileSetFile=bat.png
animation=bat.ani animation=bat.ani
width=9 width=8
height=7 height=7
x=14 x=14
y=2 y=2
@@ -46,7 +46,7 @@ color=bright_blue
[enemy] [enemy]
tileSetFile=bat.png tileSetFile=bat.png
animation=bat.ani animation=bat.ani
width=9 width=8
height=7 height=7
x=10 x=10
y=10 y=10
@@ -62,7 +62,7 @@ color=cyan
[enemy] [enemy]
tileSetFile=bat.png tileSetFile=bat.png
animation=bat.ani animation=bat.ani
width=9 width=8
height=7 height=7
x=15 x=15
y=1 y=1

View File

@@ -11,8 +11,8 @@ itemColor1=yellow
itemColor2=red itemColor2=red
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=5 x=5
@@ -27,8 +27,8 @@ color=green
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=12 x=12

View File

@@ -3,16 +3,16 @@
<tileset firstgid="1" source="standard.tsx"/> <tileset firstgid="1" source="standard.tsx"/>
<layer id="1" name="Capa de patrones 1" width="32" height="16"> <layer id="1" name="Capa de patrones 1" width="32" height="16">
<data encoding="csv"> <data encoding="csv">
5,5,5,5,5,5,5,5,5,5,5,0,0,0,506,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 5,5,5,5,5,5,5,5,0,0,0,0,0,0,506,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
5,5,5,5,5,5,5,5,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5, 5,5,5,5,5,5,5,0,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,
5,5,5,5,5,5,5,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 5,5,5,5,5,5,5,0,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
5,5,5,5,5,5,5,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 5,5,5,5,5,5,5,0,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
5,5,5,5,5,5,5,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 5,5,5,5,5,5,5,0,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
0,0,0,0,0,0,134,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 5,5,5,5,173,0,134,0,0,506,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
0,0,0,0,0,0,134,0,415,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 557,557,557,557,557,557,134,0,415,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
5,5,5,5,5,5,5,415,415,415,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 5,5,5,5,5,5,5,415,415,415,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
5,5,5,5,5,5,5,0,0,0,0,530,0,0,0,0,0,0,449,449,449,449,449,449,449,449,449,449,449,449,449,5, 5,5,5,5,5,5,0,0,0,0,0,530,0,0,0,0,0,0,449,449,449,449,449,449,449,449,449,449,449,449,449,5,
5,5,5,5,5,5,5,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5, 5,5,5,5,5,0,0,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,
0,0,0,0,0,0,0,0,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,517,367,5, 0,0,0,0,0,0,0,0,0,0,0,0,0,530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,517,367,5,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,367,367,367,367,429,429,0,429,429,367,367,367,367,367,367,367,367,5, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,367,367,367,367,429,429,0,429,429,367,367,367,367,367,367,367,367,5,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,343,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,343,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,5,

View File

@@ -4,15 +4,15 @@
<layer id="1" name="Capa de patrones 1" width="32" height="16"> <layer id="1" name="Capa de patrones 1" width="32" height="16">
<data encoding="csv"> <data encoding="csv">
349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349, 349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,349,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,38,38,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,38,38,38,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,188,
0,0,0,0,0,0,38,38,241,241,0,0,0,0,0,0,0,0,0,0,0,0,241,241,38,38,0,0,0,0,0,0, 0,0,0,0,0,0,38,38,241,241,0,0,0,0,0,0,0,0,0,0,0,0,241,241,38,38,0,0,0,0,0,188,
0,0,0,0,0,38,38,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,38,38,0,0,0,0,0, 0,0,0,0,0,38,38,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,38,38,0,0,0,0,0,
0,0,0,0,38,38,0,0,0,0,0,0,0,0,241,241,241,241,0,0,0,0,0,0,0,0,38,38,0,0,0,0, 0,0,0,0,38,38,0,0,0,0,0,0,0,0,241,241,241,241,0,0,0,0,0,0,0,0,38,38,0,0,0,0,
0,0,0,0,38,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,38,0,0,0,0, 0,0,0,0,38,0,0,0,0,0,0,241,241,0,0,0,0,0,0,241,241,0,0,0,0,0,0,38,0,0,0,0,

View File

@@ -9,8 +9,8 @@ roomLeft=26.room
roomRight=0 roomRight=0
#[enemy] #[enemy]
#tileSetFile=diskette.png #tileSetFile=floppy.png
#animation=diskette.ani #animation=floppy.ani
#width=16 #width=16
#height=16 #height=16
#x=2 #x=2

View File

@@ -3,17 +3,17 @@
<tileset firstgid="1" source="standard.tsx"/> <tileset firstgid="1" source="standard.tsx"/>
<layer id="1" name="Capa de patrones 1" width="32" height="16"> <layer id="1" name="Capa de patrones 1" width="32" height="16">
<data encoding="csv"> <data encoding="csv">
90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,90,41,235,235,0,0,235,235,41,89,90,89, 90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,94,41,235,235,0,0,235,235,41,89,90,89,
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,90, 89,94,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,214,215,0,0,0,0,0,0,0,0,214,89,90,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89, 214,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,214,89,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,235,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,235,0,0,0,0,0,214,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,235,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,235,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,0,0,0,0, 89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,0,0,0,0,
94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0, 94,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,415,415,415,415, 94,215,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,415,415,415,415,
89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,0,0,0,0,0, 89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,235,0,0,0,0,0,0,0,0,0,0,
90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
89,90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 89,90,89,94,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

View File

@@ -11,8 +11,8 @@ itemColor1=green
itemColor2=red itemColor2=red
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=20 x=20

View File

@@ -15,7 +15,7 @@
116,0,0,0,377,377,377,0,0,0,0,0,0,115,114,115,114,0,0,0,0,0,377,377,377,377,0,0,0,0,140,116, 116,0,0,0,377,377,377,0,0,0,0,0,0,115,114,115,114,0,0,0,0,0,377,377,377,377,0,0,0,0,140,116,
140,0,0,0,0,0,0,0,0,0,0,377,0,114,115,114,115,0,0,377,0,0,0,0,0,0,0,0,0,0,116,140, 140,0,0,0,0,0,0,0,0,0,0,377,0,114,115,114,115,0,0,377,0,0,0,0,0,0,0,0,0,0,116,140,
116,0,0,0,0,0,0,0,0,0,0,0,0,115,114,115,114,0,0,0,0,0,0,0,0,0,431,432,114,115,140,116, 116,0,0,0,0,0,0,0,0,0,0,0,0,115,114,115,114,0,0,0,0,0,0,0,0,0,431,432,114,115,140,116,
140,0,0,0,0,0,0,0,377,0,0,0,0,114,115,114,115,0,0,0,0,0,0,431,432,431,432,431,432,0,116,140, 140,0,0,0,0,0,0,377,377,0,0,0,0,114,115,114,115,0,0,0,0,0,0,431,432,431,432,431,432,0,116,140,
0,0,0,0,0,0,0,0,0,0,0,0,377,115,114,115,114,0,0,377,0,0,0,0,0,0,0,0,0,0,140,116, 0,0,0,0,0,0,0,0,0,0,0,0,377,115,114,115,114,0,0,377,0,0,0,0,0,0,0,0,0,0,140,116,
0,0,0,0,0,0,0,0,0,0,0,0,0,114,115,114,115,0,0,0,0,0,0,0,0,0,0,0,0,0,116,140, 0,0,0,0,0,0,0,0,0,0,0,0,0,114,115,114,115,0,0,0,0,0,0,0,0,0,0,0,0,0,116,140,
114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,0,0,114,115,114,115,114,115 114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,114,115,0,0,114,115,114,115,114,115

View File

@@ -1,4 +1,4 @@
name=STATIC name=BE CAREFUL WITH THE FUSE
bgColor=black bgColor=black
border=bright_cyan border=bright_cyan
tileMapFile=36.tmx tileMapFile=36.tmx

View File

@@ -9,8 +9,8 @@ roomLeft=39.room
roomRight=37.room roomRight=37.room
[enemy] [enemy]
tileSetFile=arounder_stop.png tileSetFile=stopped_arounder.png
animation=arounder_stop.ani animation=stopped_arounder.ani
width=7 width=7
height=8 height=8
x=9 x=9
@@ -25,8 +25,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_stop.png tileSetFile=stopped_arounder.png
animation=arounder_stop.ani animation=stopped_arounder.ani
width=7 width=7
height=8 height=8
x=18 x=18
@@ -41,8 +41,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=12 x=12
@@ -75,8 +75,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_fly.png tileSetFile=flying_arounder.png
animation=arounder_fly.ani animation=flying_arounder.ani
width=7 width=7
height=7 height=7
x=3 x=3

View File

@@ -27,8 +27,8 @@ color=white
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_fly.png tileSetFile=flying_arounder.png
animation=arounder_fly.ani animation=flying_arounder.ani
width=7 width=7
height=7 height=7
x=9 x=9
@@ -44,8 +44,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_fly.png tileSetFile=flying_arounder.png
animation=arounder_fly.ani animation=flying_arounder.ani
width=7 width=7
height=7 height=7
x=15 x=15
@@ -61,8 +61,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_fly.png tileSetFile=flying_arounder.png
animation=arounder_fly.ani animation=flying_arounder.ani
width=7 width=7
height=7 height=7
x=22 x=22
@@ -78,8 +78,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_fly.png tileSetFile=flying_arounder.png
animation=arounder_fly.ani animation=flying_arounder.ani
width=7 width=7
height=7 height=7
x=16 x=16

View File

@@ -25,8 +25,8 @@ color=red
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=10 x=10
@@ -42,8 +42,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=15 x=15
@@ -59,8 +59,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=20 x=20
@@ -76,8 +76,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=14 x=14

View File

@@ -25,8 +25,8 @@ color=bright_cyan
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_stop.png tileSetFile=stopped_arounder.png
animation=arounder_stop.ani animation=stopped_arounder.ani
width=7 width=7
height=8 height=8
x=8 x=8
@@ -41,8 +41,8 @@ color=bright_cyan
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_stop.png tileSetFile=stopped_arounder.png
animation=arounder_stop.ani animation=stopped_arounder.ani
width=7 width=7
height=8 height=8
x=11 x=11
@@ -57,8 +57,8 @@ color=bright_cyan
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_stop.png tileSetFile=stopped_arounder.png
animation=arounder_stop.ani animation=stopped_arounder.ani
width=7 width=7
height=8 height=8
x=24 x=24
@@ -73,8 +73,8 @@ color=bright_cyan
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=12 x=12
@@ -90,8 +90,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=14 x=14
@@ -107,8 +107,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=arounder_walk.png tileSetFile=walking_arounder.png
animation=arounder_walk.ani animation=walking_arounder.ani
width=5 width=5
height=8 height=8
x=14 x=14

View File

@@ -1,6 +1,6 @@
name=P.A.C.O. ON THE GO name=P.A.C.O. ON THE GO
bgColor=black bgColor=black
border=black border=blue
tileMapFile=42.tmx tileMapFile=42.tmx
tileSetFile=standard.png tileSetFile=standard.png
roomUp=0 roomUp=0
@@ -23,7 +23,7 @@ x1=10
y1=2 y1=2
x2=10 x2=10
y2=11 y2=11
color=green color=magenta
[/enemy] [/enemy]
[enemy] [enemy]

View File

@@ -11,8 +11,8 @@
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,421,62, 36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,421,62,
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0, 36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0,
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,421,415,0,0,0,0,0,0,0,0,0,0,0, 36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,421,415,0,0,0,0,0,0,0,0,0,0,0,
36,0,0,0,0,0,0,0,305,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 36,0,0,0,0,0,0,0,306,0,0,0,0,306,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
36,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 36,0,0,0,306,0,0,0,0,0,0,0,0,0,0,0,0,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
36,0,415,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,0,0,421,415,0,0,0,0,0,0, 36,0,415,421,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,415,0,0,421,415,0,0,0,0,0,0,
36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

View File

@@ -11,6 +11,22 @@ itemColor1=red
itemColor2=magenta itemColor2=magenta
autoSurface=left autoSurface=left
[enemy]
tileSetFile=batman_fire.png
animation=batman_fire.ani
width=16
height=16
x=10
y=13
vx=1.3
vy=0
x1=0
y1=13
x2=29
y2=13
color=cyan
flip=true
[/enemy]
[enemy] [enemy]
tileSetFile=heavy.png tileSetFile=heavy.png

View File

@@ -11,8 +11,8 @@ itemColor1=red
itemColor2=yellow itemColor2=yellow
[enemy] [enemy]
tileSetFile=jb_alien.png tileSetFile=jailbattle_alien.png
animation=jb_alien.ani animation=jailbattle_alien.ani
width=13 width=13
height=15 height=15
x=10 x=10
@@ -28,8 +28,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jb_alien.png tileSetFile=jailbattle_alien.png
animation=jb_alien.ani animation=jailbattle_alien.ani
width=13 width=13
height=15 height=15
x=25 x=25
@@ -45,8 +45,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jb_human.png tileSetFile=jailbattle_human.png
animation=jb_human.ani animation=jailbattle_human.ani
width=11 width=11
height=13 height=13
x=7 x=7
@@ -62,8 +62,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jb_human.png tileSetFile=jailbattle_human.png
animation=jb_human.ani animation=jailbattle_human.ani
width=11 width=11
height=13 height=13
x=18 x=18

View File

@@ -11,8 +11,8 @@ itemColor1=white
itemColor2=green itemColor2=green
[enemy] [enemy]
tileSetFile=jb_human.png tileSetFile=jailbattle_human.png
animation=jb_human.ani animation=jailbattle_human.ani
width=11 width=11
height=13 height=13
x=17 x=17
@@ -28,8 +28,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jb_human.png tileSetFile=jailbattle_human.png
animation=jb_human.ani animation=jailbattle_human.ani
width=11 width=11
height=13 height=13
x=2 x=2
@@ -45,8 +45,8 @@ flip=true
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=jb_alien.png tileSetFile=jailbattle_alien.png
animation=jb_alien.ani animation=jailbattle_alien.ani
width=11 width=11
height=13 height=13
x=24 x=24

View File

@@ -9,8 +9,8 @@ roomLeft=0
roomRight=49.room roomRight=49.room
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=7 x=7
@@ -25,8 +25,8 @@ color=magenta
[/enemy] [/enemy]
[enemy] [enemy]
tileSetFile=diskette.png tileSetFile=floppy.png
animation=diskette.ani animation=floppy.ani
width=16 width=16
height=16 height=16
x=20 x=20

View File

@@ -4,7 +4,7 @@
<layer id="1" name="Capa de patrones 1" width="32" height="16"> <layer id="1" name="Capa de patrones 1" width="32" height="16">
<data encoding="csv"> <data encoding="csv">
42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42, 42,42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,42,
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42, 42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42, 42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,
42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 42,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

View File

@@ -1,4 +1,4 @@
name=P.A.C.O WORKSHOP name=P.A.C.O. WORKSHOP
bgColor=black bgColor=black
border=yellow border=yellow
tileMapFile=53.tmx tileMapFile=53.tmx

BIN
data/sound/notify.wav Normal file

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -23,11 +23,11 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.4.3</string> <string>1.0.7</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>1.0.0</string> <string>1.0.7</string>
<key>CSResourcesFileMapped</key> <key>CSResourcesFileMapped</key>
<true/> <true/>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

BIN
release/libgcc_s_seh-1.dll Normal file

Binary file not shown.

BIN
release/libstdc++-6.dll Normal file

Binary file not shown.

BIN
release/libwinpthread-1.dll Normal file

Binary file not shown.

13
source/cheevos.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include "cheevos.h"
// Constructor
Cheevos::Cheevos(options_t *options)
{
this->options = options;
}
// Destructor
Cheevos::~Cheevos()
{
}

27
source/cheevos.h Normal file
View File

@@ -0,0 +1,27 @@
#pragma once
#include <SDL2/SDL.h>
#include "common/utils.h"
#include <string>
#include <vector>
#ifndef CHEEVOS_H
#define CHEEVOS_H
class Cheevos
{
private:
// Punteros y objetos
options_t *options;
// Variables
public:
// Constructor
Cheevos(options_t *options);
// Destructor
~Cheevos();
};
#endif

View File

@@ -222,121 +222,121 @@ int AnimatedSprite::getIndex(std::string name)
// Calcula el frame correspondiente a la animación // Calcula el frame correspondiente a la animación
void AnimatedSprite::animate() void AnimatedSprite::animate()
{ {
if (!enabled || animation.at(currentAnimation).speed == 0) if (!enabled || animation[currentAnimation].speed == 0)
{ {
return; return;
} }
// Calcula el frame actual a partir del contador // Calcula el frame actual a partir del contador
animation.at(currentAnimation).currentFrame = animation.at(currentAnimation).counter / animation.at(currentAnimation).speed; animation[currentAnimation].currentFrame = animation[currentAnimation].counter / animation[currentAnimation].speed;
// Si alcanza el final de la animación, reinicia el contador de la animación // Si alcanza el final de la animación, reinicia el contador de la animación
// en función de la variable loop y coloca el nuevo frame // en función de la variable loop y coloca el nuevo frame
if (animation.at(currentAnimation).currentFrame >= (int)animation.at(currentAnimation).frames.size()) if (animation[currentAnimation].currentFrame >= (int)animation[currentAnimation].frames.size())
{ {
if (animation.at(currentAnimation).loop == -1) if (animation[currentAnimation].loop == -1)
{ // Si no hay loop, deja el último frame { // Si no hay loop, deja el último frame
animation.at(currentAnimation).currentFrame = animation.at(currentAnimation).frames.size(); animation[currentAnimation].currentFrame = animation[currentAnimation].frames.size();
animation.at(currentAnimation).completed = true; animation[currentAnimation].completed = true;
} }
else else
{ // Si hay loop, vuelve al frame indicado { // Si hay loop, vuelve al frame indicado
animation.at(currentAnimation).counter = 0; animation[currentAnimation].counter = 0;
animation.at(currentAnimation).currentFrame = animation.at(currentAnimation).loop; animation[currentAnimation].currentFrame = animation[currentAnimation].loop;
} }
} }
// En caso contrario // En caso contrario
else else
{ {
// Escoge el frame correspondiente de la animación // Escoge el frame correspondiente de la animación
setSpriteClip(animation.at(currentAnimation).frames.at(animation.at(currentAnimation).currentFrame)); setSpriteClip(animation[currentAnimation].frames[animation[currentAnimation].currentFrame]);
// Incrementa el contador de la animacion // Incrementa el contador de la animacion
animation.at(currentAnimation).counter++; animation[currentAnimation].counter++;
} }
} }
// Obtiene el numero de frames de la animación actual // Obtiene el numero de frames de la animación actual
int AnimatedSprite::getNumFrames() int AnimatedSprite::getNumFrames()
{ {
return (int)animation.at(currentAnimation).frames.size(); return (int)animation[currentAnimation].frames.size();
} }
// Establece el frame actual de la animación // Establece el frame actual de la animación
void AnimatedSprite::setCurrentFrame(int num) void AnimatedSprite::setCurrentFrame(int num)
{ {
// Descarta valores fuera de rango // Descarta valores fuera de rango
if (num >= (int)animation.at(currentAnimation).frames.size()) if (num >= (int)animation[currentAnimation].frames.size())
{ {
num = 0; num = 0;
} }
// Cambia el valor de la variable // Cambia el valor de la variable
animation.at(currentAnimation).currentFrame = num; animation[currentAnimation].currentFrame = num;
animation.at(currentAnimation).counter = 0; animation[currentAnimation].counter = 0;
// Escoge el frame correspondiente de la animación // Escoge el frame correspondiente de la animación
setSpriteClip(animation.at(currentAnimation).frames.at(animation.at(currentAnimation).currentFrame)); setSpriteClip(animation[currentAnimation].frames[animation[currentAnimation].currentFrame]);
} }
// Establece el valor del contador // Establece el valor del contador
void AnimatedSprite::setAnimationCounter(std::string name, int num) void AnimatedSprite::setAnimationCounter(std::string name, int num)
{ {
animation.at(getIndex(name)).counter = num; animation[getIndex(name)].counter = num;
} }
// Establece la velocidad de una animación // Establece la velocidad de una animación
void AnimatedSprite::setAnimationSpeed(std::string name, int speed) void AnimatedSprite::setAnimationSpeed(std::string name, int speed)
{ {
animation.at(getIndex(name)).counter = speed; animation[getIndex(name)].counter = speed;
} }
// Establece la velocidad de una animación // Establece la velocidad de una animación
void AnimatedSprite::setAnimationSpeed(int index, int speed) void AnimatedSprite::setAnimationSpeed(int index, int speed)
{ {
animation.at(index).counter = speed; animation[index].counter = speed;
} }
// Establece si la animación se reproduce en bucle // Establece si la animación se reproduce en bucle
void AnimatedSprite::setAnimationLoop(std::string name, int loop) void AnimatedSprite::setAnimationLoop(std::string name, int loop)
{ {
animation.at(getIndex(name)).loop = loop; animation[getIndex(name)].loop = loop;
} }
// Establece si la animación se reproduce en bucle // Establece si la animación se reproduce en bucle
void AnimatedSprite::setAnimationLoop(int index, int loop) void AnimatedSprite::setAnimationLoop(int index, int loop)
{ {
animation.at(index).loop = loop; animation[index].loop = loop;
} }
// Establece el valor de la variable // Establece el valor de la variable
void AnimatedSprite::setAnimationCompleted(std::string name, bool value) void AnimatedSprite::setAnimationCompleted(std::string name, bool value)
{ {
animation.at(getIndex(name)).completed = value; animation[getIndex(name)].completed = value;
} }
// OLD - Establece el valor de la variable // OLD - Establece el valor de la variable
void AnimatedSprite::setAnimationCompleted(int index, bool value) void AnimatedSprite::setAnimationCompleted(int index, bool value)
{ {
animation.at(index).completed = value; animation[index].completed = value;
} }
// Comprueba si ha terminado la animación // Comprueba si ha terminado la animación
bool AnimatedSprite::animationIsCompleted() bool AnimatedSprite::animationIsCompleted()
{ {
return animation.at(currentAnimation).completed; return animation[currentAnimation].completed;
} }
// Devuelve el rectangulo de una animación y frame concreto // Devuelve el rectangulo de una animación y frame concreto
SDL_Rect AnimatedSprite::getAnimationClip(std::string name, Uint8 index) SDL_Rect AnimatedSprite::getAnimationClip(std::string name, Uint8 index)
{ {
return animation.at(getIndex(name)).frames.at(index); return animation[getIndex(name)].frames[index];
} }
// Devuelve el rectangulo de una animación y frame concreto // Devuelve el rectangulo de una animación y frame concreto
SDL_Rect AnimatedSprite::getAnimationClip(int indexA, Uint8 indexF) SDL_Rect AnimatedSprite::getAnimationClip(int indexA, Uint8 indexF)
{ {
return animation.at(indexA).frames.at(indexF); return animation[indexA].frames[indexF];
} }
// Carga la animación desde un vector // Carga la animación desde un vector
@@ -484,9 +484,9 @@ void AnimatedSprite::setCurrentAnimation(std::string name)
if (currentAnimation != newAnimation) if (currentAnimation != newAnimation)
{ {
currentAnimation = newAnimation; currentAnimation = newAnimation;
animation.at(currentAnimation).currentFrame = 0; animation[currentAnimation].currentFrame = 0;
animation.at(currentAnimation).counter = 0; animation[currentAnimation].counter = 0;
animation.at(currentAnimation).completed = false; animation[currentAnimation].completed = false;
} }
} }
@@ -497,9 +497,9 @@ void AnimatedSprite::setCurrentAnimation(int index)
if (currentAnimation != newAnimation) if (currentAnimation != newAnimation)
{ {
currentAnimation = newAnimation; currentAnimation = newAnimation;
animation.at(currentAnimation).currentFrame = 0; animation[currentAnimation].currentFrame = 0;
animation.at(currentAnimation).counter = 0; animation[currentAnimation].counter = 0;
animation.at(currentAnimation).completed = false; animation[currentAnimation].completed = false;
} }
} }
@@ -513,7 +513,7 @@ void AnimatedSprite::update()
// Establece el rectangulo para un frame de una animación // Establece el rectangulo para un frame de una animación
void AnimatedSprite::setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h) void AnimatedSprite::setAnimationFrames(Uint8 index_animation, Uint8 index_frame, int x, int y, int w, int h)
{ {
animation.at(index_animation).frames.push_back({x, y, w, h}); animation[index_animation].frames.push_back({x, y, w, h});
} }
// OLD - Establece el contador para todas las animaciones // OLD - Establece el contador para todas las animaciones
@@ -528,7 +528,7 @@ void AnimatedSprite::setAnimationCounter(int value)
// Reinicia la animación // Reinicia la animación
void AnimatedSprite::resetAnimation() void AnimatedSprite::resetAnimation()
{ {
animation.at(currentAnimation).currentFrame = 0; animation[currentAnimation].currentFrame = 0;
animation.at(currentAnimation).counter = 0; animation[currentAnimation].counter = 0;
animation.at(currentAnimation).completed = false; animation[currentAnimation].completed = false;
} }

View File

@@ -10,10 +10,10 @@ Asset::Asset(std::string executablePath)
} }
// Añade un elemento a la lista // Añade un elemento a la lista
void Asset::add(std::string file, enum assetType type, bool required) void Asset::add(std::string file, enum assetType type, bool required, bool absolute)
{ {
item_t temp; item_t temp;
temp.file = executablePath + file; temp.file = absolute ? file : executablePath + file;
temp.type = type; temp.type = type;
temp.required = required; temp.required = required;
fileList.push_back(temp); fileList.push_back(temp);
@@ -114,7 +114,7 @@ bool Asset::checkFile(std::string path)
// Comprueba si existe el fichero // Comprueba si existe el fichero
const std::string filename = path.substr(path.find_last_of("\\/") + 1); const std::string filename = path.substr(path.find_last_of("\\/") + 1);
SDL_RWops *file = SDL_RWFromFile(path.c_str(), "r+b"); SDL_RWops *file = SDL_RWFromFile(path.c_str(), "rb");
if (file != nullptr) if (file != nullptr)
{ {

View File

@@ -31,6 +31,7 @@ private:
std::string file; // Ruta del fichero desde la raiz del directorio std::string file; // Ruta del fichero desde la raiz del directorio
enum assetType type; // Indica el tipo de recurso enum assetType type; // Indica el tipo de recurso
bool required; // Indica si es un fichero que debe de existir bool required; // Indica si es un fichero que debe de existir
//bool absolute; // Indica si la ruta que se ha proporcionado es una ruta absoluta
}; };
// Variables // Variables
@@ -50,7 +51,7 @@ public:
Asset(std::string path); Asset(std::string path);
// Añade un elemento a la lista // Añade un elemento a la lista
void add(std::string file, enum assetType type, bool required = true); void add(std::string file, enum assetType type, bool required = true, bool absolute = false);
// Devuelve un elemento de la lista a partir de una cadena // Devuelve un elemento de la lista a partir de una cadena
std::string get(std::string text); std::string get(std::string text);

View File

@@ -34,13 +34,13 @@ void Input::update()
// Asigna inputs a teclas // Asigna inputs a teclas
void Input::bindKey(Uint8 input, SDL_Scancode code) void Input::bindKey(Uint8 input, SDL_Scancode code)
{ {
keyBindings.at(input).scancode = code; keyBindings[input].scancode = code;
} }
// Asigna inputs a botones del mando // Asigna inputs a botones del mando
void Input::bindGameControllerButton(Uint8 input, SDL_GameControllerButton button) void Input::bindGameControllerButton(Uint8 input, SDL_GameControllerButton button)
{ {
gameControllerBindings.at(input).button = button; gameControllerBindings[input].button = button;
} }
// Comprueba si un input esta activo // Comprueba si un input esta activo
@@ -65,7 +65,7 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
if (repeat) if (repeat)
{ {
if (keyStates[keyBindings.at(input).scancode] != 0) if (keyStates[keyBindings[input].scancode] != 0)
{ {
successKeyboard = true; successKeyboard = true;
} }
@@ -76,11 +76,11 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
} }
else else
{ {
if (!keyBindings.at(input).active) if (!keyBindings[input].active)
{ {
if (keyStates[keyBindings.at(input).scancode] != 0) if (keyStates[keyBindings[input].scancode] != 0)
{ {
keyBindings.at(input).active = true; keyBindings[input].active = true;
successKeyboard = true; successKeyboard = true;
} }
else else
@@ -90,9 +90,9 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
} }
else else
{ {
if (keyStates[keyBindings.at(input).scancode] == 0) if (keyStates[keyBindings[input].scancode] == 0)
{ {
keyBindings.at(input).active = false; keyBindings[input].active = false;
successKeyboard = false; successKeyboard = false;
} }
else else
@@ -108,7 +108,7 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
{ {
if (repeat) if (repeat)
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(input).button) != 0) if (SDL_GameControllerGetButton(connectedControllers[index], gameControllerBindings[input].button) != 0)
{ {
successGameController = true; successGameController = true;
} }
@@ -119,11 +119,11 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
} }
else else
{ {
if (!gameControllerBindings.at(input).active) if (!gameControllerBindings[input].active)
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(input).button) != 0) if (SDL_GameControllerGetButton(connectedControllers[index], gameControllerBindings[input].button) != 0)
{ {
gameControllerBindings.at(input).active = true; gameControllerBindings[input].active = true;
successGameController = true; successGameController = true;
} }
else else
@@ -133,9 +133,9 @@ bool Input::checkInput(Uint8 input, bool repeat, int device, int index)
} }
else else
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(input).button) == 0) if (SDL_GameControllerGetButton(connectedControllers[index], gameControllerBindings[input].button) == 0)
{ {
gameControllerBindings.at(input).active = false; gameControllerBindings[input].active = false;
successGameController = false; successGameController = false;
} }
else else
@@ -163,7 +163,7 @@ bool Input::checkAnyInput(int device, int index)
for (int i = 0; i < (int)keyBindings.size(); ++i) for (int i = 0; i < (int)keyBindings.size(); ++i)
{ {
if (mKeystates[keyBindings.at(i).scancode] != 0) if (mKeystates[keyBindings[i].scancode] != 0)
{ {
return true; return true;
} }
@@ -176,7 +176,7 @@ bool Input::checkAnyInput(int device, int index)
{ {
for (int i = 0; i < (int)gameControllerBindings.size(); ++i) for (int i = 0; i < (int)gameControllerBindings.size(); ++i)
{ {
if (SDL_GameControllerGetButton(connectedControllers.at(index), gameControllerBindings.at(i).button) != 0) if (SDL_GameControllerGetButton(connectedControllers[index], gameControllerBindings[i].button) != 0)
{ {
return true; return true;
} }
@@ -277,7 +277,7 @@ std::string Input::getControllerName(int index)
{ {
if (numGamepads > 0) if (numGamepads > 0)
{ {
return controllerNames.at(index); return controllerNames[index];
} }
else else
{ {

View File

@@ -1,3 +1,4 @@
#ifndef JA_USESDLMIXER
#include "jail_audio.h" #include "jail_audio.h"
#include "stb_vorbis.c" #include "stb_vorbis.c"
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
@@ -11,7 +12,7 @@ struct JA_Sound_t {
}; };
struct JA_Channel_t { struct JA_Channel_t {
JA_Sound sound; JA_Sound_t *sound;
int pos {0}; int pos {0};
int times {0}; int times {0};
JA_Channel_state state { JA_CHANNEL_FREE }; JA_Channel_state state { JA_CHANNEL_FREE };
@@ -25,7 +26,7 @@ struct JA_Music_t {
JA_Music_state state {JA_MUSIC_INVALID}; JA_Music_state state {JA_MUSIC_INVALID};
}; };
JA_Music current_music{NULL}; JA_Music_t *current_music{NULL};
JA_Channel_t channels[JA_MAX_SIMULTANEOUS_CHANNELS]; JA_Channel_t channels[JA_MAX_SIMULTANEOUS_CHANNELS];
int JA_freq {48000}; int JA_freq {48000};
@@ -86,7 +87,7 @@ void JA_Quit() {
sdlAudioDevice = 0; sdlAudioDevice = 0;
} }
JA_Music JA_LoadMusic(const char* filename) { JA_Music_t *JA_LoadMusic(const char* filename) {
int chan, samplerate; int chan, samplerate;
// [RZC 28/08/22] Carreguem primer el arxiu en memòria i després el descomprimim. Es algo més rapid. // [RZC 28/08/22] Carreguem primer el arxiu en memòria i després el descomprimim. Es algo més rapid.
@@ -98,7 +99,7 @@ JA_Music JA_LoadMusic(const char* filename) {
if (fread(buffer, fsize, 1, f)!=1) return NULL; if (fread(buffer, fsize, 1, f)!=1) return NULL;
fclose(f); fclose(f);
JA_Music music = new JA_Music_t(); JA_Music_t *music = new JA_Music_t();
music->samples = stb_vorbis_decode_memory(buffer, fsize, &chan, &samplerate, &music->output); music->samples = stb_vorbis_decode_memory(buffer, fsize, &chan, &samplerate, &music->output);
free(buffer); free(buffer);
@@ -121,7 +122,7 @@ JA_Music JA_LoadMusic(const char* filename) {
return music; return music;
} }
void JA_PlayMusic(JA_Music music, const int loop) { void JA_PlayMusic(JA_Music_t *music, const int loop) {
if (current_music != NULL) { if (current_music != NULL) {
current_music->pos = 0; current_music->pos = 0;
current_music->state = JA_MUSIC_STOPPED; current_music->state = JA_MUSIC_STOPPED;
@@ -153,21 +154,21 @@ JA_Music_state JA_GetMusicState() {
return current_music->state; return current_music->state;
} }
void JA_DeleteMusic(JA_Music music) { void JA_DeleteMusic(JA_Music_t *music) {
if (current_music == music) current_music = NULL; if (current_music == music) current_music = NULL;
free(music->output); free(music->output);
delete music; delete music;
} }
JA_Sound JA_NewSound(Uint8* buffer, Uint32 length) { JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length) {
JA_Sound sound = new JA_Sound_t(); JA_Sound_t *sound = new JA_Sound_t();
sound->buffer = buffer; sound->buffer = buffer;
sound->length = length; sound->length = length;
return sound; return sound;
} }
JA_Sound JA_LoadSound(const char* filename) { JA_Sound_t *JA_LoadSound(const char* filename) {
JA_Sound sound = new JA_Sound_t(); JA_Sound_t *sound = new JA_Sound_t();
SDL_AudioSpec wavSpec; SDL_AudioSpec wavSpec;
SDL_LoadWAV(filename, &wavSpec, &sound->buffer, &sound->length); SDL_LoadWAV(filename, &wavSpec, &sound->buffer, &sound->length);
@@ -184,7 +185,7 @@ JA_Sound JA_LoadSound(const char* filename) {
return sound; return sound;
} }
int JA_PlaySound(JA_Sound sound, const int loop) { int JA_PlaySound(JA_Sound_t *sound, const int loop) {
int channel = 0; int channel = 0;
while (channel < JA_MAX_SIMULTANEOUS_CHANNELS && channels[channel].state != JA_CHANNEL_FREE) { channel++; } while (channel < JA_MAX_SIMULTANEOUS_CHANNELS && channels[channel].state != JA_CHANNEL_FREE) { channel++; }
if (channel == JA_MAX_SIMULTANEOUS_CHANNELS) channel = 0; if (channel == JA_MAX_SIMULTANEOUS_CHANNELS) channel = 0;
@@ -196,7 +197,7 @@ int JA_PlaySound(JA_Sound sound, const int loop) {
return channel; return channel;
} }
void JA_DeleteSound(JA_Sound sound) { void JA_DeleteSound(JA_Sound_t *sound) {
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) { for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
if (channels[i].sound == sound) JA_StopChannel(i); if (channels[i].sound == sound) JA_StopChannel(i);
} }
@@ -247,3 +248,4 @@ int JA_SetVolume(int volume) {
JA_volume = volume > 128 ? 128 : volume < 0 ? 0 : volume; JA_volume = volume > 128 ? 128 : volume < 0 ? 0 : volume;
return JA_volume; return JA_volume;
} }
#endif

View File

@@ -4,27 +4,27 @@
enum JA_Channel_state { JA_CHANNEL_INVALID, JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED }; enum JA_Channel_state { JA_CHANNEL_INVALID, JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED };
enum JA_Music_state { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, JA_MUSIC_STOPPED }; enum JA_Music_state { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, JA_MUSIC_STOPPED };
typedef struct JA_Sound_t *JA_Sound; struct JA_Sound_t;
typedef struct JA_Music_t *JA_Music; struct JA_Music_t;
void JA_Init(const int freq, const SDL_AudioFormat format, const int channels); void JA_Init(const int freq, const SDL_AudioFormat format, const int channels);
void JA_Quit(); void JA_Quit();
JA_Music JA_LoadMusic(const char* filename); JA_Music_t *JA_LoadMusic(const char* filename);
void JA_PlayMusic(JA_Music music, const int loop = -1); void JA_PlayMusic(JA_Music_t *music, const int loop = -1);
void JA_PauseMusic(); void JA_PauseMusic();
void JA_ResumeMusic(); void JA_ResumeMusic();
void JA_StopMusic(); void JA_StopMusic();
JA_Music_state JA_GetMusicState(); JA_Music_state JA_GetMusicState();
void JA_DeleteMusic(JA_Music music); void JA_DeleteMusic(JA_Music_t *music);
JA_Sound JA_NewSound(Uint8* buffer, Uint32 length); JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length);
JA_Sound JA_LoadSound(const char* filename); JA_Sound_t *JA_LoadSound(const char* filename);
int JA_PlaySound(JA_Sound sound, const int loop = 0); int JA_PlaySound(JA_Sound_t *sound, const int loop = 0);
void JA_PauseChannel(const int channel); void JA_PauseChannel(const int channel);
void JA_ResumeChannel(const int channel); void JA_ResumeChannel(const int channel);
void JA_StopChannel(const int channel); void JA_StopChannel(const int channel);
JA_Channel_state JA_GetChannelState(const int channel); JA_Channel_state JA_GetChannelState(const int channel);
void JA_DeleteSound(JA_Sound sound); void JA_DeleteSound(JA_Sound_t *sound);
int JA_SetVolume(int volume); int JA_SetVolume(int volume);

View File

@@ -0,0 +1,101 @@
#ifdef JA_USESDLMIXER
#include "jail_audio.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
#include <stdio.h>
struct JA_Sound_t {}; // Dummy structs
struct JA_Music_t {};
int JA_freq {48000};
SDL_AudioFormat JA_format {AUDIO_S16};
Uint8 JA_channels {2};
void JA_Init(const int freq, const SDL_AudioFormat format, const int channels) {
JA_freq = freq;
JA_format = format;
JA_channels = channels;
Mix_OpenAudio(JA_freq, JA_format, JA_channels, 1024);
}
void JA_Quit() {
Mix_CloseAudio();
}
JA_Music_t *JA_LoadMusic(const char* filename) {
return (JA_Music_t*)Mix_LoadMUS(filename);
}
void JA_PlayMusic(JA_Music_t *music, const int loop) {
Mix_PlayMusic((Mix_Music*)music, loop);
}
void JA_PauseMusic() {
Mix_PauseMusic();
}
void JA_ResumeMusic() {
Mix_ResumeMusic();
}
void JA_StopMusic() {
Mix_HaltMusic();
}
JA_Music_state JA_GetMusicState() {
if (Mix_PausedMusic()) {
return JA_MUSIC_PAUSED;
} else if (Mix_PlayingMusic()) {
return JA_MUSIC_PLAYING;
} else {
return JA_MUSIC_STOPPED;
}
}
void JA_DeleteMusic(JA_Music_t *music) {
Mix_FreeMusic((Mix_Music*)music);
}
JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length) {
return NULL;
}
JA_Sound_t *JA_LoadSound(const char* filename) {
JA_Sound_t *sound = (JA_Sound_t*)Mix_LoadWAV(filename);
return sound;
}
int JA_PlaySound(JA_Sound_t *sound, const int loop) {
return Mix_PlayChannel(-1, (Mix_Chunk*)sound, loop);
}
void JA_DeleteSound(JA_Sound_t *sound) {
Mix_FreeChunk((Mix_Chunk*)sound);
}
void JA_PauseChannel(const int channel) {
Mix_Pause(channel);
}
void JA_ResumeChannel(const int channel) {
Mix_Resume(channel);
}
void JA_StopChannel(const int channel) {
Mix_HaltChannel(channel);
}
JA_Channel_state JA_GetChannelState(const int channel) {
if (Mix_Paused(channel)) {
return JA_CHANNEL_PAUSED;
} else if (Mix_Playing(channel)) {
return JA_CHANNEL_PLAYING;
} else {
return JA_CHANNEL_FREE;
}
}
int JA_SetVolume(int volume) {
return Mix_Volume(-1, volume);
}
#endif

154
source/common/jscore.cpp Normal file
View File

@@ -0,0 +1,154 @@
#include "jscore.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef _WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#endif
#include <unistd.h>
#include <string>
#include <vector>
namespace jscore {
using namespace std;
struct user {
string name;
int points;
};
vector<user> score;
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
int sock;
struct sockaddr_in client;
int PORT = 9911;
string HOST = "jaildoctor.duckdns.org";
#ifdef WIN32
WSADATA WsaData;
#endif
bool jscore_error = false;
string error_message;
void init(std::string host, const int port) {
PORT = port;
HOST = host;
}
void setErrorMessage(string message) {
jscore_error = true;
error_message = message;
}
string sendRequest(const string request) {
#ifdef WIN32
int ret = WSAStartup(0x101,&WsaData);
if (ret != 0) return 0;
#endif
struct hostent * host = gethostbyname(HOST.c_str());
if ( (host == NULL) || (host->h_addr == NULL) ) {
setErrorMessage("Error retrieving DNS information.\n");
return "";
}
bzero(&client, sizeof(client));
client.sin_family = AF_INET;
client.sin_port = htons( PORT );
memcpy(&client.sin_addr, host->h_addr, host->h_length);
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock < 0) {
setErrorMessage("Error creating socket.\n");
return "";
}
if ( connect(sock, (struct sockaddr *)&client, sizeof(client)) < 0 ) {
close(sock);
setErrorMessage("Could not connect\n");
return "";
}
string r = request + " HTTP/1.1\r\nHost: "+HOST+"\r\nConnection: close\r\n\r\n\r\n";
if (send(sock, r.c_str(), r.length(), 0) != (int)r.length()) {
setErrorMessage("Error sending request.\n");
return "";
}
char cur;
char start[5]="\r\n\r\n";
int pos = 0;
while ( recv(sock, &cur, 1,0) > 0 ) {
if (cur==start[pos]) { pos++; if (pos == 4) break; } else { pos = 0; }
}
char buffer[1024]; buffer[0]=0; pos=0;
while ( recv(sock, &cur, 1,0) > 0 ) {
buffer[pos] = cur;
pos++;
}
#ifdef WIN32
WSACleanup();
#endif
buffer[pos]=0;
return buffer;
}
const bool initOnlineScore(string game) {
string strbuff = sendRequest("GET /score-list.php?game=" + game);
if (jscore_error) return not jscore_error;
user u;
char buffer[1024];
strcpy(buffer, strbuff.c_str());
char *str = buffer;
char *p = str;
score.clear();
while (*p!=0) {
while (*p!=',') {p++;}
*p=0; u.name = str; p++; str=p;
while (*p!='\n') {p++;}
*p=0; u.points = atoi(str); p++; str=p;
score.push_back(u);
}
return not jscore_error;
}
const int getNumUsers() {
return score.size();
}
string getUserName(const int index) {
return score[index].name;
}
const int getPoints(const int index) {
return score[index].points;
}
const bool updateUserPoints(string game, string user, const int points) {
string strbuff = sendRequest("GET /score-update.php?game=" + game + "&user=" + user + "&points=" + to_string(points));
initOnlineScore(game);
return not jscore_error;
}
const int getUserPoints(string game, std::string user) {
return atoi(sendRequest("GET /getuserpoints.php?game=" + game + "&user=" + user).c_str());
}
string getUserData(string game, string user) {
return sendRequest("GET /getuserdata.php?game=" + game + "&user=" + user);
}
void setUserData(string game, string user, string data) {
sendRequest("GET /setuserdata.php?game=" + game + "&user=" + user + "&data=" + data);
}
};

16
source/common/jscore.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include <string>
namespace jscore {
void init(std::string host, const int port);
const bool initOnlineScore(std::string game);
const int getNumUsers();
std::string getUserName(const int index);
const int getPoints(const int index);
const int getUserPoints(std::string game, std::string user);
const bool updateUserPoints(std::string game, std::string user, const int points);
std::string getUserData(std::string game, std::string user);
void setUserData(std::string game, std::string user, std::string data);
};

View File

@@ -458,7 +458,7 @@ void Menu::setSelectorPos(int index)
if (index < (int)item.size()) if (index < (int)item.size())
{ {
selector.index = index; selector.index = index;
selector.rect.y = selector.y = selector.originY = selector.targetY = item.at(selector.index).rect.y; selector.rect.y = selector.y = selector.originY = selector.targetY = item[selector.index].rect.y;
selector.rect.w = rectBG.rect.w; selector.rect.w = rectBG.rect.w;
selector.rect.x = rectBG.rect.x; selector.rect.x = rectBG.rect.x;
selector.originH = selector.targetH = selector.rect.h = getSelectorHeight(selector.index); selector.originH = selector.targetH = selector.rect.h = getSelectorHeight(selector.index);
@@ -486,13 +486,13 @@ void Menu::reset()
{ {
itemSelected = MENU_NO_OPTION; itemSelected = MENU_NO_OPTION;
selector.index = 0; selector.index = 0;
selector.originY = selector.targetY = selector.y = item.at(0).rect.y; selector.originY = selector.targetY = selector.y = item[0].rect.y;
selector.originH = selector.targetH = item.at(0).rect.h; selector.originH = selector.targetH = item[0].rect.h;
selector.moving = false; selector.moving = false;
selector.resizing = false; selector.resizing = false;
// Si el primer elemento no es seleccionable, incrementa el selector // Si el primer elemento no es seleccionable, incrementa el selector
if (!item.at(selector.index).selectable) if (!item[selector.index].selectable)
{ {
increaseSelectorIndex(); increaseSelectorIndex();
setSelectorPos(selector.index); setSelectorPos(selector.index);
@@ -524,18 +524,18 @@ void Menu::reorganize()
bool Menu::increaseSelectorIndex() bool Menu::increaseSelectorIndex()
{ {
// Obten las coordenadas del elemento actual // Obten las coordenadas del elemento actual
selector.y = selector.originY = item.at(selector.index).rect.y; selector.y = selector.originY = item[selector.index].rect.y;
selector.h = selector.originH = getSelectorHeight(selector.index); selector.h = selector.originH = getSelectorHeight(selector.index);
// Calcula cual es el siguiente elemento // Calcula cual es el siguiente elemento
++selector.index %= item.size(); ++selector.index %= item.size();
while (!item.at(selector.index).selectable) while (!item[selector.index].selectable)
{ {
++selector.index %= item.size(); ++selector.index %= item.size();
} }
// Establece las coordenadas y altura de destino // Establece las coordenadas y altura de destino
selector.targetY = item.at(selector.index).rect.y; selector.targetY = item[selector.index].rect.y;
selector.despY = (selector.targetY - selector.originY) / selector.numJumps; selector.despY = (selector.targetY - selector.originY) / selector.numJumps;
selector.targetH = getSelectorHeight(selector.index); selector.targetH = getSelectorHeight(selector.index);
@@ -554,7 +554,7 @@ bool Menu::increaseSelectorIndex()
bool Menu::decreaseSelectorIndex() bool Menu::decreaseSelectorIndex()
{ {
// Obten las coordenadas del elemento actual // Obten las coordenadas del elemento actual
selector.y = selector.originY = item.at(selector.index).rect.y; selector.y = selector.originY = item[selector.index].rect.y;
selector.h = selector.originH = getSelectorHeight(selector.index); selector.h = selector.originH = getSelectorHeight(selector.index);
// Calcula cual es el siguiente elemento // Calcula cual es el siguiente elemento
@@ -567,7 +567,7 @@ bool Menu::decreaseSelectorIndex()
selector.index--; selector.index--;
} }
while (!item.at(selector.index).selectable) while (!item[selector.index].selectable)
{ {
if (selector.index == 0) if (selector.index == 0)
{ {
@@ -580,7 +580,7 @@ bool Menu::decreaseSelectorIndex()
} }
// Establece las coordenadas y altura de destino // Establece las coordenadas y altura de destino
selector.targetY = item.at(selector.index).rect.y; selector.targetY = item[selector.index].rect.y;
selector.despY = (selector.targetY - selector.originY) / selector.numJumps; selector.despY = (selector.targetY - selector.originY) / selector.numJumps;
selector.targetH = getSelectorHeight(selector.index); selector.targetH = getSelectorHeight(selector.index);
@@ -630,29 +630,29 @@ void Menu::render()
if (i == selector.index) if (i == selector.index)
{ {
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b}; const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, color); text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
} }
else if (item.at(i).selectable) else if (item[i].selectable)
{ {
text->write(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label); text->write(item[i].rect.x, item[i].rect.y, item[i].label);
} }
else if (item.at(i).greyed) else if (item[i].greyed)
{ {
text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, colorGreyed); text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, colorGreyed);
} }
else else
{ // No seleccionable { // No seleccionable
if ((item.at(i).linkedUp) && (i == selector.index + 1)) if ((item[i].linkedUp) && (i == selector.index + 1))
{ {
const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b}; const color_t color = {selector.itemColor.r, selector.itemColor.g, selector.itemColor.b};
text->writeColored(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label, color); text->writeColored(item[i].rect.x, item[i].rect.y, item[i].label, color);
} }
else // No enlazado con el de arriba else // No enlazado con el de arriba
{ {
text->write(item.at(i).rect.x, item.at(i).rect.y, item.at(i).label); text->write(item[i].rect.x, item[i].rect.y, item[i].label);
} }
} }
} }
@@ -822,7 +822,7 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
if (item.size() > 1) if (item.size() > 1)
{ {
if (item.at(item.size() - 2).linkedDown) if (item[item.size() - 2].linkedDown)
{ {
item.back().linkedUp = true; item.back().linkedUp = true;
} }
@@ -835,9 +835,9 @@ void Menu::addItem(std::string text, int hPaddingDown, bool selectable, bool gre
// Cambia el texto de un item // Cambia el texto de un item
void Menu::setItemCaption(int index, std::string text) void Menu::setItemCaption(int index, std::string text)
{ {
item.at(index).label = text; item[index].label = text;
item.at(index).rect.w = this->text->lenght(item.at(index).label); item[index].rect.w = this->text->lenght(item[index].label);
item.at(index).rect.h = this->text->getCharacterSize(); item[index].rect.h = this->text->getCharacterSize();
reorganize(); reorganize();
} }
@@ -914,42 +914,42 @@ int Menu::findHeight()
// Recoloca los elementos del menu en el eje Y // Recoloca los elementos del menu en el eje Y
void Menu::replaceElementsOnY() void Menu::replaceElementsOnY()
{ {
item.at(0).rect.y = y; item[0].rect.y = y;
for (int i = 1; i < (int)item.size(); i++) for (int i = 1; i < (int)item.size(); i++)
{ {
item.at(i).rect.y = item.at(i - 1).rect.y + item.at(i - 1).rect.h + item.at(i - 1).hPaddingDown; item[i].rect.y = item[i - 1].rect.y + item[i - 1].rect.h + item[i - 1].hPaddingDown;
} }
} }
// Establece el estado seleccionable de un item // Establece el estado seleccionable de un item
void Menu::setSelectable(int index, bool value) void Menu::setSelectable(int index, bool value)
{ {
item.at(index).selectable = value; item[index].selectable = value;
} }
// Establece el estado agrisado de un item // Establece el estado agrisado de un item
void Menu::setGreyed(int index, bool value) void Menu::setGreyed(int index, bool value)
{ {
item.at(index).greyed = value; item[index].greyed = value;
} }
// Establece el estado de enlace de un item // Establece el estado de enlace de un item
void Menu::setLinkedDown(int index, bool value) void Menu::setLinkedDown(int index, bool value)
{ {
item.at(index).linkedDown = value; item[index].linkedDown = value;
} }
// Calcula la altura del selector // Calcula la altura del selector
int Menu::getSelectorHeight(int value) int Menu::getSelectorHeight(int value)
{ {
if (item.at(value).linkedDown) if (item[value].linkedDown)
{ {
return item.at(value).rect.h + item.at(value).hPaddingDown + item.at(value + 1).rect.h; return item[value].rect.h + item[value].hPaddingDown + item[value + 1].rect.h;
} }
else else
{ {
return item.at(value).rect.h; return item[value].rect.h;
} }
} }

View File

@@ -91,9 +91,9 @@ private:
bool isCenteredOnY; // Variable para saber si el menu debe estar centrado respecto a un punto en el eje Y bool isCenteredOnY; // Variable para saber si el menu debe estar centrado respecto a un punto en el eje Y
bool areElementsCenteredOnX; // Variable para saber si los elementos van centrados en el eje X bool areElementsCenteredOnX; // Variable para saber si los elementos van centrados en el eje X
int widestItem; // Anchura del elemento más ancho int widestItem; // Anchura del elemento más ancho
JA_Sound soundAccept; // Sonido al aceptar o elegir una opción del menu JA_Sound_t* soundAccept; // Sonido al aceptar o elegir una opción del menu
JA_Sound soundCancel; // Sonido al cancelar el menu JA_Sound_t* soundCancel; // Sonido al cancelar el menu
JA_Sound soundMove; // Sonido al mover el selector JA_Sound_t* soundMove; // Sonido al mover el selector
color_t colorGreyed; // Color para los elementos agrisados color_t colorGreyed; // Color para los elementos agrisados
rectangle_t rectBG; // Rectangulo de fondo del menu rectangle_t rectBG; // Rectangulo de fondo del menu
std::vector<item_t> item; // Estructura para cada elemento del menu std::vector<item_t> item; // Estructura para cada elemento del menu

223
source/common/notify.cpp Normal file
View File

@@ -0,0 +1,223 @@
#include "notify.h"
#include <string>
#include <stdio.h>
#include <iostream>
// Constructor
Notify::Notify(SDL_Renderer *renderer, std::string bitmapFile, std::string textFile, std::string soundFile, options_t *options)
{
// Inicializa variables
this->renderer = renderer;
this->options = options;
bgColor = options->notifications.color;
waitTime = 300;
// Crea objetos
texture = new Texture(renderer, bitmapFile);
text = new Text(textFile, texture, renderer);
sound = JA_LoadSound(soundFile.c_str());
}
// Destructor
Notify::~Notify()
{
// Libera la memoria de los objetos
delete texture;
delete text;
JA_DeleteSound(sound);
for (auto notification : notifications)
{
delete notification.sprite;
delete notification.texture;
}
}
// Dibuja las notificaciones por pantalla
void Notify::render()
{
for (int i = (int)notifications.size() - 1; i >= 0; --i)
{
notifications[i].sprite->render();
}
}
// Actualiza el estado de las notificaiones
void Notify::update()
{
for (int i = 0; i < (int)notifications.size(); ++i)
{
notifications[i].counter++;
// Comprueba los estados
if (notifications[i].state == ns_rising)
{
const float step = ((float)notifications[i].counter / notifications[i].travelDist);
const int alpha = 255 * step;
if (options->notifications.posV == pos_top)
{
notifications[i].rect.y++;
}
else
{
notifications[i].rect.y--;
}
notifications[i].texture->setAlpha(alpha);
if (notifications[i].rect.y == notifications[i].y)
{
notifications[i].state = ns_stay;
notifications[i].texture->setAlpha(255);
notifications[i].counter = 0;
}
}
else if (notifications[i].state == ns_stay)
{
if (notifications[i].counter == waitTime)
{
notifications[i].state = ns_vanishing;
notifications[i].counter = 0;
}
}
else if (notifications[i].state == ns_vanishing)
{
const float step = (notifications[i].counter / (float)notifications[i].travelDist);
const int alpha = 255 * (1 - step);
if (options->notifications.posV == pos_top)
{
notifications[i].rect.y--;
}
else
{
notifications[i].rect.y++;
}
notifications[i].texture->setAlpha(alpha);
if (notifications[i].rect.y == notifications[i].y - notifications[i].travelDist)
{
notifications[i].state = ns_finished;
}
}
notifications[i].sprite->setRect(notifications[i].rect);
}
clearFinishedNotifications();
}
// Elimina las notificaciones finalizadas
void Notify::clearFinishedNotifications()
{
for (int i = (int)notifications.size() - 1; i >= 0; --i)
{
if (notifications[i].state == ns_finished)
{
delete notifications[i].sprite;
delete notifications[i].texture;
notifications.erase(notifications.begin() + i);
}
}
}
// Muestra una notificación de texto por pantalla;
void Notify::showText(std::string text)
{
// Inicializa variables
const int width = this->text->lenght(text) + (this->text->getCharacterSize() * 2);
const int height = this->text->getCharacterSize() * 2;
const int padding = (this->text->getCharacterSize() / 2);
// Posición horizontal
int despH = 0;
if (options->notifications.posH == pos_left)
{
despH = padding;
}
else if (options->notifications.posH == pos_middle)
{
despH = ((options->screen.windowWidth * options->windowSize) / 2 - (width / 2));
}
else
{
despH = (options->screen.windowWidth * options->windowSize) - width - padding;
}
// Posición vertical
int despV = 0;
if (options->notifications.posV == pos_top)
{
despV = padding;
}
else
{
despV = (options->screen.windowHeight * options->windowSize) - height - padding;
}
const int travelDist = height + padding;
// Offset
int offset = 0;
if (options->notifications.posV == pos_top)
{
offset = (int)notifications.size() > 0 ? notifications.back().y + travelDist : despV;
}
else
{
offset = (int)notifications.size() > 0 ? notifications.back().y - travelDist : despV;
}
// Crea la notificacion
notification_t n;
// Inicializa variables
n.y = offset;
n.travelDist = travelDist;
n.counter = 0;
n.state = ns_rising;
n.text = text;
if (options->notifications.posV == pos_top)
{
n.rect = {despH, offset - travelDist, width, height};
}
else
{
n.rect = {despH, offset + travelDist, width, height};
}
// Crea la textura
n.texture = new Texture(renderer);
n.texture->createBlank(renderer, width, height, SDL_TEXTUREACCESS_TARGET);
n.texture->setAsRenderTarget(renderer);
SDL_SetRenderDrawColor(renderer, bgColor.r, bgColor.g, bgColor.b, 255);
SDL_RenderClear(renderer);
n.texture->setBlendMode(SDL_BLENDMODE_BLEND);
this->text->writeDX(TXT_CENTER | TXT_STROKE, width / 2, padding, text, 1, {255, 255, 255}, 1, {0, 0, 0});
SDL_SetRenderTarget(renderer, nullptr);
// Crea el sprite
n.sprite = new Sprite(n.rect, n.texture, renderer);
// Añade la notificación a la lista
notifications.push_back(n);
// Reproduce el sonido de la notificación
if (options->notifications.sound)
{
JA_PlaySound(sound);
}
}
// Indica si hay notificaciones activas
bool Notify::active()
{
if ((int)notifications.size() > 0)
{
return true;
}
return false;
}

85
source/common/notify.h Normal file
View File

@@ -0,0 +1,85 @@
#pragma once
#include <SDL2/SDL.h>
#include "jail_audio.h"
#include "sprite.h"
#include "text.h"
#include "texture.h"
#include "utils.h"
#include <vector>
#ifndef NOTIFY_H
#define NOTIFY_H
class Notify
{
private:
enum notification_state_e
{
ns_rising,
ns_stay,
ns_vanishing,
ns_finished
};
enum notification_position_e
{
upperLeft,
upperCenter,
upperRight,
middleLeft,
middleRight,
bottomLeft,
bottomCenter,
bottomRight
};
struct notification_t
{
std::string text;
int counter;
notification_state_e state;
notification_position_e position;
Texture *texture;
Sprite *sprite;
SDL_Rect rect;
int y;
int travelDist;
};
// Objetos y punteros
SDL_Renderer *renderer; // El renderizador de la ventana
Texture *texture; // Textura para la fuente de las notificaciones
Text *text; // Objeto para dibujar texto
options_t *options; // Variable con todas las opciones del programa
// Variables
color_t bgColor; // Color de fondo de las notificaciones
int waitTime; // Tiempo que se ve la notificación
std::vector<notification_t> notifications; // La lista de notificaciones activas
JA_Sound_t* sound; // Sonido a reproducir cuando suena la notificación
// Elimina las notificaciones finalizadas
void clearFinishedNotifications();
public:
// Dibuja las notificaciones por pantalla
void render();
// Actualiza el estado de las notificaiones
void update();
// Constructor
Notify(SDL_Renderer *renderer, std::string bitmapFile, std::string textFile, std::string soundFile, options_t *options);
// Destructor
~Notify();
// Muestra una notificación de texto por pantalla;
void showText(std::string text);
// Indica si hay notificaciones activas
bool active();
};
#endif

View File

@@ -3,15 +3,23 @@
#include <iostream> #include <iostream>
// Constructor // Constructor
Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, int gameInternalResX, int gameInternalResY) Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options_t *options)
{ {
// Inicializa variables // Inicializa variables
this->window = window; this->window = window;
this->renderer = renderer; this->renderer = renderer;
this->options = options; this->options = options;
this->asset = asset;
gameCanvasWidth = gameInternalResX; // Crea los objetos
gameCanvasHeight = gameInternalResY; notify = new Notify(renderer, asset->get("smb2.png"), asset->get("smb2.txt"), asset->get("notify.wav"), options);
gameCanvasWidth = options->gameWidth;
gameCanvasHeight = options->gameHeight;
borderWidth = options->borderWidth * 2;
borderHeight = options->borderHeight * 2;
notificationLogicalWidth = gameCanvasWidth;
notificationLogicalHeight = gameCanvasHeight;
iniFade(); iniFade();
iniSpectrumFade(); iniSpectrumFade();
@@ -22,20 +30,24 @@ Screen::Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, i
// Crea la textura donde se dibujan los graficos del juego // Crea la textura donde se dibujan los graficos del juego
gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight); gameCanvas = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_TARGET, gameCanvasWidth, gameCanvasHeight);
if (gameCanvas == nullptr) if (gameCanvas == nullptr)
{
if (options->console)
{ {
std::cout << "TitleSurface could not be created!\nSDL Error: " << SDL_GetError() << std::endl; std::cout << "TitleSurface could not be created!\nSDL Error: " << SDL_GetError() << std::endl;
} }
}
// Establece el modo de video // Establece el modo de video
setVideoMode(options->fullScreenMode); setVideoMode(options->videoMode);
// Calcula los anclajes // Inicializa variables
anchor.left = 0; notifyActive = false;
anchor.right = gameCanvasWidth; }
anchor.center = gameCanvasWidth / 2;
anchor.top = 0; // Destructor
anchor.bottom = gameCanvasHeight; Screen::~Screen()
anchor.middle = gameCanvasHeight / 2; {
delete notify;
} }
// Limpia la pantalla // Limpia la pantalla
@@ -64,107 +76,111 @@ void Screen::blit()
// Copia la textura de juego en el renderizador en la posición adecuada // Copia la textura de juego en el renderizador en la posición adecuada
SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest); SDL_RenderCopy(renderer, gameCanvas, nullptr, &dest);
// Dibuja las notificaciones
renderNotifications();
// Muestra por pantalla el renderizador // Muestra por pantalla el renderizador
SDL_RenderPresent(renderer); SDL_RenderPresent(renderer);
} }
// Establece el modo de video // Establece el modo de video
void Screen::setVideoMode(int fullScreenMode) void Screen::setVideoMode(int videoMode)
{ {
// Muestra el puntero
SDL_ShowCursor(SDL_ENABLE);
// Aplica el modo de video // Aplica el modo de video
SDL_SetWindowFullscreen(window, fullScreenMode); SDL_SetWindowFullscreen(window, videoMode);
// Si está activo el modo ventana quita el borde // Si está activo el modo ventana quita el borde
if (fullScreenMode == 0) if (videoMode == 0)
{ {
if (options->borderEnabled) if (options->borderEnabled)
{ {
const int incWidth = gameCanvasWidth * options->borderSize; windowWidth = gameCanvasWidth + borderWidth;
const int incHeight = gameCanvasHeight * options->borderSize; windowHeight = gameCanvasHeight + borderHeight;
screenWidth = gameCanvasWidth + incWidth; dest = {0 + (borderWidth / 2), 0 + (borderHeight / 2), gameCanvasWidth, gameCanvasHeight};
screenHeight = gameCanvasHeight + incHeight;
dest = {0 + (incWidth / 2), 0 + (incHeight / 2), gameCanvasWidth, gameCanvasHeight};
} }
else else
{ {
screenWidth = gameCanvasWidth; windowWidth = gameCanvasWidth;
screenHeight = gameCanvasHeight; windowHeight = gameCanvasHeight;
dest = {0, 0, gameCanvasWidth, gameCanvasHeight}; dest = {0, 0, gameCanvasWidth, gameCanvasHeight};
} }
// Modifica el tamaño del renderizador y de la ventana // Modifica el tamaño del renderizador y de la ventana
SDL_RenderSetLogicalSize(renderer, screenWidth, screenHeight); SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
SDL_SetWindowSize(window, screenWidth * options->windowSize, screenHeight * options->windowSize); SDL_SetWindowSize(window, windowWidth * options->windowSize, windowHeight * options->windowSize);
} }
// Si está activo el modo de pantalla completa añade el borde // Si está activo el modo de pantalla completa añade el borde
else if (fullScreenMode == SDL_WINDOW_FULLSCREEN_DESKTOP) else if (videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP)
{ {
// Oculta el puntero
SDL_ShowCursor(SDL_DISABLE);
// Obten el alto y el ancho de la ventana // Obten el alto y el ancho de la ventana
SDL_GetWindowSize(window, &screenWidth, &screenHeight); SDL_GetWindowSize(window, &windowWidth, &windowHeight);
// Aplica el escalado al rectangulo donde se pinta la textura del juego // Aplica el escalado al rectangulo donde se pinta la textura del juego
if (options->integerScale) if (options->integerScale)
{ {
// Calcula el tamaño de la escala máxima // Calcula el tamaño de la escala máxima
int scale = 0; int scale = 0;
while (((gameCanvasWidth * (scale + 1)) <= screenWidth) && ((gameCanvasHeight * (scale + 1)) <= screenHeight)) while (((gameCanvasWidth * (scale + 1)) <= windowWidth) && ((gameCanvasHeight * (scale + 1)) <= windowHeight))
{ {
scale++; scale++;
} }
dest.w = gameCanvasWidth * scale; dest.w = gameCanvasWidth * scale;
dest.h = gameCanvasHeight * scale; dest.h = gameCanvasHeight * scale;
dest.x = (screenWidth - dest.w) / 2; dest.x = (windowWidth - dest.w) / 2;
dest.y = (screenHeight - dest.h) / 2; dest.y = (windowHeight - dest.h) / 2;
} }
else if (options->keepAspect) else if (options->keepAspect)
{ {
float ratio = (float)gameCanvasWidth / (float)gameCanvasHeight; float ratio = (float)gameCanvasWidth / (float)gameCanvasHeight;
if ((screenWidth - gameCanvasWidth) >= (screenHeight - gameCanvasHeight)) if ((windowWidth - gameCanvasWidth) >= (windowHeight - gameCanvasHeight))
{ {
dest.h = screenHeight; dest.h = windowHeight;
dest.w = (int)((screenHeight * ratio) + 0.5f); dest.w = (int)((windowHeight * ratio) + 0.5f);
dest.x = (screenWidth - dest.w) / 2; dest.x = (windowWidth - dest.w) / 2;
dest.y = (screenHeight - dest.h) / 2; dest.y = (windowHeight - dest.h) / 2;
} }
else else
{ {
dest.w = screenWidth; dest.w = windowWidth;
dest.h = (int)((screenWidth / ratio) + 0.5f); dest.h = (int)((windowWidth / ratio) + 0.5f);
dest.x = (screenWidth - dest.w) / 2; dest.x = (windowWidth - dest.w) / 2;
dest.y = (screenHeight - dest.h) / 2; dest.y = (windowHeight - dest.h) / 2;
} }
} }
else else
{ {
dest.w = screenWidth; dest.w = windowWidth;
dest.h = screenHeight; dest.h = windowHeight;
dest.x = dest.y = 0; dest.x = dest.y = 0;
} }
// Modifica el tamaño del renderizador // Modifica el tamaño del renderizador
SDL_RenderSetLogicalSize(renderer, screenWidth, screenHeight); SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
} }
// Actualiza el valor de la variable // Actualiza las opciones
options->fullScreenMode = fullScreenMode; options->videoMode = videoMode;
options->screen.windowWidth = windowWidth;
options->screen.windowHeight = windowHeight;
// Establece el tamaño de las notificaciones
setNotificationSize();
} }
// Camibia entre pantalla completa y ventana // Camibia entre pantalla completa y ventana
void Screen::switchVideoMode() void Screen::switchVideoMode()
{ {
if (options->fullScreenMode == 0) options->videoMode = (options->videoMode == 0) ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0;
{ setVideoMode(options->videoMode);
options->fullScreenMode = SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else
{
options->fullScreenMode = 0;
}
setVideoMode(options->fullScreenMode);
} }
// Cambia el tamaño de la ventana // Cambia el tamaño de la ventana
@@ -187,9 +203,15 @@ void Screen::setBlendMode(SDL_BlendMode blendMode)
} }
// Establece el tamaño del borde // Establece el tamaño del borde
void Screen::setBorderSize(float s) void Screen::setBorderWidth(int s)
{ {
options->borderSize = s; options->borderWidth = s;
}
// Establece el tamaño del borde
void Screen::setBorderHeight(int s)
{
options->borderHeight = s;
} }
// Establece si se ha de ver el borde en el modo ventana // Establece si se ha de ver el borde en el modo ventana
@@ -322,7 +344,7 @@ void Screen::renderSpectrumFade()
const float step = (float)spectrumFadeCounter / (float)spectrumFadeLenght; const float step = (float)spectrumFadeCounter / (float)spectrumFadeLenght;
const int max = spectrumColor.size() - 1; const int max = spectrumColor.size() - 1;
const int index = max + (0 - max) * step; const int index = max + (0 - max) * step;
const color_t c = spectrumColor.at(index); const color_t c = spectrumColor[index];
SDL_SetTextureColorMod(gameCanvas, c.r, c.g, c.b); SDL_SetTextureColorMod(gameCanvas, c.r, c.g, c.b);
} }
@@ -339,3 +361,53 @@ void Screen::renderFX()
renderFade(); renderFade();
renderSpectrumFade(); renderSpectrumFade();
} }
// Actualiza el notificador
void Screen::updateNotifier()
{
notify->update();
notifyActive = notify->active();
}
// Muestra una notificación de texto por pantalla;
void Screen::showNotification(std::string text)
{
notify->showText(text);
}
// Dibuja las notificaciones
void Screen::renderNotifications()
{
if (!notifyActive)
{
return;
}
//SDL_RenderSetLogicalSize(renderer, notificationLogicalWidth, notificationLogicalHeight);
notify->render();
//SDL_RenderSetLogicalSize(renderer, windowWidth, windowHeight);
}
// Establece el tamaño de las notificaciones
void Screen::setNotificationSize()
{
if (options->videoMode == 0)
{
if (options->windowSize == 3)
{
notificationLogicalWidth = (windowWidth * 3) / 2;
notificationLogicalHeight = (windowHeight * 3) / 2;
}
else
{
notificationLogicalWidth = windowWidth * 2;
notificationLogicalHeight = windowHeight * 2;
}
}
if (options->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP)
{
notificationLogicalWidth = windowWidth / 3;
notificationLogicalHeight = windowHeight / 3;
}
}

View File

@@ -1,6 +1,8 @@
#pragma once #pragma once
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include "asset.h"
#include "notify.h"
#include "utils.h" #include "utils.h"
#include <vector> #include <vector>
@@ -10,34 +12,29 @@
#define FILTER_NEAREST 0 #define FILTER_NEAREST 0
#define FILTER_LINEAL 1 #define FILTER_LINEAL 1
struct anchor_t
{
int left; // Parte izquierda de la pantalla de juego
int right; // Parte drecha de la pantalla de juego
int center; // Parte central horizontal de la pantalla de juego
int top; // Parte superior de la pantalla de juego
int bottom; // Parte infoerior de la pantalla de juego
int middle; // Parte central vertical de la pantalla de juego
};
// Clase Screen
class Screen class Screen
{ {
private: private:
// Objetos y punteros // Objetos y punteros
SDL_Window *window; // Ventana de la aplicación SDL_Window *window; // Ventana de la aplicación
SDL_Renderer *renderer; // El renderizador de la ventana SDL_Renderer *renderer; // El renderizador de la ventana
Asset *asset; // Objeto con el listado de recursos
SDL_Texture *gameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa SDL_Texture *gameCanvas; // Textura para completar la ventana de juego hasta la pantalla completa
options_t *options; // Variable con todas las opciones del programa options_t *options; // Variable con todas las opciones del programa
Notify *notify; // Dibuja notificaciones por pantalla
// Variables // Variables
int screenWidth; // Ancho de la pantalla o ventana int windowWidth; // Ancho de la pantalla o ventana
int screenHeight; // Alto de la pantalla o ventana int windowHeight; // Alto de la pantalla o ventana
int gameCanvasWidth; // Resolución interna del juego. Es el ancho de la textura donde se dibuja el juego int gameCanvasWidth; // Resolución interna del juego. Es el ancho de la textura donde se dibuja el juego
int gameCanvasHeight; // Resolución interna del juego. Es el alto de la textura donde se dibuja el juego int gameCanvasHeight; // Resolución interna del juego. Es el alto de la textura donde se dibuja el juego
anchor_t anchor; // Variable con los anclajes de la pantalla int borderWidth; // Anchura del borde
int borderHeight; // Anltura del borde
SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana SDL_Rect dest; // Coordenadas donde se va a dibujar la textura del juego sobre la pantalla o ventana
color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla color_t borderColor; // Color del borde añadido a la textura de juego para rellenar la pantalla
bool notifyActive; // Indica si hay notificaciones activas
int notificationLogicalWidth; // Ancho lógico de las notificaciones en relación al tamaño de pantalla
int notificationLogicalHeight; // Alto lógico de las notificaciones en relación al tamaño de pantalla
// Variables - Efectos // Variables - Efectos
bool fade; // Indica si esta activo el efecto de fade bool fade; // Indica si esta activo el efecto de fade
@@ -66,9 +63,18 @@ private:
// Dibuja el spectrum fade // Dibuja el spectrum fade
void renderSpectrumFade(); void renderSpectrumFade();
// Dibuja las notificaciones
void renderNotifications();
// Establece el tamaño de las notificaciones
void setNotificationSize();
public: public:
// Constructor // Constructor
Screen(SDL_Window *window, SDL_Renderer *renderer, options_t *options, int gameInternalResX, int gameInternalResY); Screen(SDL_Window *window, SDL_Renderer *renderer, Asset *asset, options_t *options);
// Destructor
~Screen();
// Limpia la pantalla // Limpia la pantalla
void clean(color_t color = {0x00, 0x00, 0x00}); void clean(color_t color = {0x00, 0x00, 0x00});
@@ -80,7 +86,7 @@ public:
void blit(); void blit();
// Establece el modo de video // Establece el modo de video
void setVideoMode(int fullScreenMode); void setVideoMode(int videoMode);
// Camibia entre pantalla completa y ventana // Camibia entre pantalla completa y ventana
void switchVideoMode(); void switchVideoMode();
@@ -95,7 +101,8 @@ public:
void setBlendMode(SDL_BlendMode blendMode); void setBlendMode(SDL_BlendMode blendMode);
// Establece el tamaño del borde // Establece el tamaño del borde
void setBorderSize(float s); void setBorderWidth(int s);
void setBorderHeight(int s);
// Establece si se ha de ver el borde en el modo ventana // Establece si se ha de ver el borde en el modo ventana
void setBorderEnabled(bool value); void setBorderEnabled(bool value);
@@ -120,6 +127,12 @@ public:
// Dibuja los efectos // Dibuja los efectos
void renderFX(); void renderFX();
// Actualiza el notificador
void updateNotifier();
// Muestra una notificación de texto por pantalla;
void showNotification(std::string text);
}; };
#endif #endif

View File

@@ -18,7 +18,7 @@ Sprite::Sprite(int x, int y, int w, int h, Texture *texture, SDL_Renderer *rende
this->texture = texture; this->texture = texture;
// Establece el rectangulo de donde coger la imagen // Establece el rectangulo de donde coger la imagen
spriteClip = {x, y, w, h}; spriteClip = {0, 0, w, h};
// Inicializa variables // Inicializa variables
enabled = true; enabled = true;
@@ -27,12 +27,12 @@ Sprite::Sprite(int x, int y, int w, int h, Texture *texture, SDL_Renderer *rende
Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer) Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer)
{ {
// Establece la posición X,Y del sprite // Establece la posición X,Y del sprite
x = rect.x; this->x = rect.x;
y = rect.y; this->y = rect.y;
// Establece el alto y el ancho del sprite // Establece el alto y el ancho del sprite
w = rect.w; this->w = rect.w;
h = rect.h; this->h = rect.h;
// Establece el puntero al renderizador de la ventana // Establece el puntero al renderizador de la ventana
this->renderer = renderer; this->renderer = renderer;
@@ -41,7 +41,7 @@ Sprite::Sprite(SDL_Rect rect, Texture *texture, SDL_Renderer *renderer)
this->texture = texture; this->texture = texture;
// Establece el rectangulo de donde coger la imagen // Establece el rectangulo de donde coger la imagen
spriteClip = {x, y, w, h}; spriteClip = {0, 0, w, h};
// Inicializa variables // Inicializa variables
enabled = true; enabled = true;
@@ -83,8 +83,8 @@ int Sprite::getHeight()
// Establece la posición del objeto // Establece la posición del objeto
void Sprite::setPos(SDL_Rect rect) void Sprite::setPos(SDL_Rect rect)
{ {
x = rect.x; this->x = rect.x;
y = rect.y; this->y = rect.y;
} }
// Establece el valor de la variable // Establece el valor de la variable
@@ -166,6 +166,12 @@ void Sprite::setRenderer(SDL_Renderer *renderer)
this->renderer = renderer; this->renderer = renderer;
} }
// Obten el valor de la variable
SDL_Renderer *Sprite::getRenderer()
{
return renderer;
}
// Establece el valor de la variable // Establece el valor de la variable
void Sprite::setEnabled(bool value) void Sprite::setEnabled(bool value)
{ {

View File

@@ -81,6 +81,9 @@ public:
// Establece el valor de la variable // Establece el valor de la variable
void setRenderer(SDL_Renderer *renderer); void setRenderer(SDL_Renderer *renderer);
// Obten el valor de la variable
SDL_Renderer *getRenderer();
// Establece el valor de la variable // Establece el valor de la variable
void setEnabled(bool value); void setEnabled(bool value);

View File

@@ -94,6 +94,9 @@ Text::Text(std::string textFile, Texture *texture, SDL_Renderer *renderer)
// Crea los objetos // Crea los objetos
sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer); sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer);
// Inicializa variables
fixedWidth = false;
} }
// Constructor // Constructor
@@ -111,6 +114,9 @@ Text::Text(textFile_t *textFile, Texture *texture, SDL_Renderer *renderer)
// Crea los objetos // Crea los objetos
sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer); sprite = new Sprite({0, 0, boxWidth, boxHeight}, texture, renderer);
// Inicializa variables
fixedWidth = false;
} }
// Destructor // Destructor
@@ -133,7 +139,8 @@ void Text::write(int x, int y, std::string text, int kerning, int lenght)
sprite->setPosX(x + shift); sprite->setPosX(x + shift);
sprite->setPosY(y); sprite->setPosY(y);
sprite->render(); sprite->render();
shift += (offset[int(text[i])].w + kerning); // shift += (offset[int(text[i])].w + kerning);
shift += fixedWidth ? boxWidth : (offset[int(text[i])].w + kerning);
} }
} }
@@ -226,3 +233,9 @@ void Text::reLoadTexture()
{ {
sprite->getTexture()->reLoad(); sprite->getTexture()->reLoad();
} }
// Establece si se usa un tamaño fijo de letra
void Text::setFixedWidth(bool value)
{
fixedWidth = value;
}

View File

@@ -38,6 +38,7 @@ private:
// Variables // Variables
int boxWidth; // Anchura de la caja de cada caracter en el png int boxWidth; // Anchura de la caja de cada caracter en el png
int boxHeight; // Altura de la caja de cada caracter en el png int boxHeight; // Altura de la caja de cada caracter en el png
bool fixedWidth; // Indica si el texto se ha de escribir con longitud fija en todas las letras
offset_t offset[128]; // Vector con las posiciones y ancho de cada letra offset_t offset[128]; // Vector con las posiciones y ancho de cada letra
public: public:
@@ -71,6 +72,9 @@ public:
// Recarga la textura // Recarga la textura
void reLoadTexture(); void reLoadTexture();
// Establece si se usa un tamaño fijo de letra
void setFixedWidth(bool value);
}; };
#endif #endif

View File

@@ -103,6 +103,7 @@ bool Texture::loadFromFile(std::string path, SDL_Renderer *renderer, bool verbos
} }
// Return success // Return success
stbi_image_free(data);
texture = newTexture; texture = newTexture;
return texture != nullptr; return texture != nullptr;
} }

View File

@@ -294,28 +294,6 @@ SDL_Point checkCollision(d_line_t &l1, v_line_t &l2)
return {-1, -1}; return {-1, -1};
} }
// Detector de colisiones entre una linea diagonal y una vertical
/*bool checkCollision(d_line_t &l1, v_line_t &l2)
{
// Normaliza la linea diagonal
normalizeLine(l1);
// Comprueba si la linea vertical esta a la izquierda de la linea diagonal
if (l2.x < l1.x1)
{
return false;
}
// Comprueba si la linea vertical esta a la derecha de la linea diagonal
if (l2.x > l1.x2)
{
return false;
}
// Inacabada
return true;
}*/
// Normaliza una linea diagonal // Normaliza una linea diagonal
void normalizeLine(d_line_t &l) void normalizeLine(d_line_t &l)
{ {
@@ -367,16 +345,6 @@ bool checkCollision(SDL_Point &p, d_line_t &l)
// En caso contrario, el punto está en la linea // En caso contrario, el punto está en la linea
return true; return true;
/*const int m = (l.y2 - l.y1) / (l.x2 - l.x1);
const int c = 0;
// Comprueba si p cumple la ecuación de la linea
if (p.y == ((m * p.x) + c))
return true;
return false;*/
} }
// Devuelve un color_t a partir de un string // Devuelve un color_t a partir de un string

View File

@@ -54,6 +54,33 @@ enum palette_e
p_zxarne p_zxarne
}; };
// Posiciones de las notificaciones
enum not_pos_e
{
pos_top,
pos_bottom,
pos_left,
pos_middle,
pos_right
};
// Tipos de control de teclado
enum ctrl_schem_e
{
ctrl_cursor,
ctrl_opqa,
ctrl_wasd
};
// Estructura para las opciones de las notificaciones
struct op_notification_t
{
not_pos_e posH; // Ubicación de las notificaciones en pantalla
not_pos_e posV; // Ubicación de las notificaciones en pantalla
bool sound; // Indica si las notificaciones suenan
color_t color; // Color de las notificaciones
};
// Estructura para saber la seccion y subseccion del programa // Estructura para saber la seccion y subseccion del programa
struct section_t struct section_t
{ {
@@ -70,22 +97,56 @@ struct cheat_t
bool altSkin; // Indicxa si se usa una skin diferente para el jugador bool altSkin; // Indicxa si se usa una skin diferente para el jugador
}; };
// Estructura para el servicio online
struct online_t
{
bool enabled; // Indica si se quiere usar el modo online o no
bool sessionEnabled; // Indica ya se ha hecho login
std::string server; // Servidor para los servicios online
int port; // Puerto del servidor
std::string gameID; // Identificador del juego para los servicios online
std::string jailerID; // Identificador del jugador para los servicios online
int score; // Puntuación almacenada online
};
// Estructura para almacenar estadísticas
struct op_stats_t
{
int rooms; // Cantidad de habitaciones visitadas
int items; // Cantidad de items obtenidos
std::string worstNightmare; // Habitación con más muertes acumuladas
};
// Estructura con opciones de la pantalla
struct op_screen_t
{
int windowWidth; // Ancho de la ventana
int windowHeight; // Alto de la ventana
};
// Estructura con todas las opciones de configuración del programa // Estructura con todas las opciones de configuración del programa
struct options_t struct options_t
{ {
Uint32 fullScreenMode; // Contiene el valor del modo de pantalla completa std::string configVersion; // Versión del programa. Sirve para saber si las opciones son compatibles
Uint32 videoMode; // Contiene el valor del modo de pantalla completa
int windowSize; // Contiene el valor por el que se multiplica el tamaño de la ventana int windowSize; // Contiene el valor por el que se multiplica el tamaño de la ventana
Uint32 filter; // Filtro usado para el escalado de la imagen Uint32 filter; // Filtro usado para el escalado de la imagen
bool vSync; // Indica si se quiere usar vsync o no bool vSync; // Indica si se quiere usar vsync o no
int screenWidth; // Ancho de la pantalla o ventana int gameWidth; // Ancho de la resolucion nativa del juego
int screenHeight; // Alto de la pantalla o ventana int gameHeight; // Alto de la resolucion nativa del juego
bool integerScale; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa bool integerScale; // Indica si el escalado de la imagen ha de ser entero en el modo a pantalla completa
bool keepAspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa bool keepAspect; // Indica si se ha de mantener la relación de aspecto al poner el modo a pantalla completa
bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana bool borderEnabled; // Indica si ha de mostrar el borde en el modo de ventana
float borderSize; // Porcentaje de borde que se añade a lo ventana int borderWidth; // Cantidad de pixels que se añade en el borde de la ventana
int borderHeight; // Cantidad de pixels que se añade en el borde de la ventana
palette_e palette; // Paleta de colores a usar en el juego palette_e palette; // Paleta de colores a usar en el juego
bool console; // Indica si ha de mostrar información por la consola de texto bool console; // Indica si ha de mostrar información por la consola de texto
cheat_t cheat; // Contiene trucos y ventajas para el juego cheat_t cheat; // Contiene trucos y ventajas para el juego
op_stats_t stats; // Datos con las estadisticas de juego
online_t online; // Datos del servicio online
op_notification_t notifications; // Opciones relativas a las notificaciones;
op_screen_t screen; // Opciones relativas a la clase screen
ctrl_schem_e keys; // Teclas usadas para jugar
}; };
// Calcula el cuadrado de la distancia entre dos puntos // Calcula el cuadrado de la distancia entre dos puntos

View File

@@ -57,7 +57,8 @@ const int GAMECANVAS_THIRD_QUARTER_Y = (GAMECANVAS_HEIGHT / 4) * 3;
#define SECTION_PROG_GAME_OVER 6 #define SECTION_PROG_GAME_OVER 6
#define SECTION_PROG_ENDING 7 #define SECTION_PROG_ENDING 7
#define SECTION_PROG_ENDING2 8 #define SECTION_PROG_ENDING2 8
#define SECTION_PROG_QUIT 9 #define SECTION_PROG_ENTER_ID 9
#define SECTION_PROG_QUIT 10
// Subsecciones // Subsecciones
#define SUBSECTION_LOGO_TO_INTRO 0 #define SUBSECTION_LOGO_TO_INTRO 0

View File

@@ -133,6 +133,20 @@ void Credits::checkEventHandler()
// Inicializa los textos // Inicializa los textos
void Credits::iniTexts() void Credits::iniTexts()
{ {
std::string keys = "";
if (options->keys == ctrl_cursor)
{
keys = "CURSORS";
}
else if (options->keys == ctrl_opqa)
{
keys = "O,P AND Q";
}
else
{
keys = "A,D AND W";
}
texts.clear(); texts.clear();
texts.push_back({"", stringToColor(options->palette, "white")}); texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"INSTRUCTIONS:", stringToColor(options->palette, "yellow")}); texts.push_back({"INSTRUCTIONS:", stringToColor(options->palette, "yellow")});
@@ -145,9 +159,9 @@ void Credits::iniTexts()
texts.push_back({"KEYS:", stringToColor(options->palette, "yellow")}); texts.push_back({"KEYS:", stringToColor(options->palette, "yellow")});
texts.push_back({"", stringToColor(options->palette, "white")}); texts.push_back({"", stringToColor(options->palette, "white")});
texts.push_back({"CURSORS TO MOVE AND JUMP", stringToColor(options->palette, "white")}); texts.push_back({keys + " TO MOVE AND JUMP", stringToColor(options->palette, "white")});
texts.push_back({"M TO TURN ON/OFF THE MUSIC", stringToColor(options->palette, "white")}); texts.push_back({"M TO TURN ON/OFF THE MUSIC", stringToColor(options->palette, "white")});
texts.push_back({"P TO PAUSE THE GAME", stringToColor(options->palette, "white")}); texts.push_back({"H TO HOLD/PAUSE THE GAME", stringToColor(options->palette, "white")});
texts.push_back({"F1-F4 TO CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")}); texts.push_back({"F1-F4 TO CHANGE WINDOWS SIZE", stringToColor(options->palette, "white")});
texts.push_back({"F TO SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")}); texts.push_back({"F TO SWITCH TO FULLSCREEN", stringToColor(options->palette, "white")});
texts.push_back({"B TO SWITCH THE BORDER SCREEN", stringToColor(options->palette, "white")}); texts.push_back({"B TO SWITCH THE BORDER SCREEN", stringToColor(options->palette, "white")});
@@ -186,7 +200,7 @@ void Credits::fillTexture()
} }
// Escribe el corazón // Escribe el corazón
const int textLenght = text->lenght(texts.at(22).label, 1) - text->lenght(" ", 1); // Se resta el ultimo caracter que es un espacio const int textLenght = text->lenght(texts[22].label, 1) - text->lenght(" ", 1); // Se resta el ultimo caracter que es un espacio
const int posX = ((PLAY_AREA_WIDTH - textLenght) / 2) + textLenght; const int posX = ((PLAY_AREA_WIDTH - textLenght) / 2) + textLenght;
text->writeColored(posX, 176, "}", stringToColor(options->palette, "bright_red")); text->writeColored(posX, 176, "}", stringToColor(options->palette, "bright_red"));
@@ -264,6 +278,9 @@ void Credits::update()
// Actualiza el contador // Actualiza el contador
updateCounter(); updateCounter();
// Actualiza las notificaciones
screen->updateNotifier();
// Actualiza el sprite con el brillo // Actualiza el sprite con el brillo
if (counter > 770) if (counter > 770)
{ {
@@ -315,14 +332,6 @@ section_t Credits::run()
// Cambia la paleta // Cambia la paleta
void Credits::switchPalette() void Credits::switchPalette()
{ {
if (options->palette == p_zxspectrum) options->palette = options->palette == p_zxspectrum ? p_zxarne : p_zxspectrum;
{
options->palette = p_zxarne;
}
else
{
options->palette = p_zxspectrum;
}
fillTexture(); fillTexture();
} }

View File

@@ -15,7 +15,7 @@ Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
rooms.push_back("44.room"); rooms.push_back("44.room");
roomIndex = 0; roomIndex = 0;
currentRoom = rooms.at(roomIndex); currentRoom = rooms[roomIndex];
// Copia los punteros // Copia los punteros
this->resource = resource; this->resource = resource;
@@ -40,7 +40,7 @@ Demo::Demo(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
board.lives = 9; board.lives = 9;
board.items = 0; board.items = 0;
board.rooms = 1; board.rooms = 1;
board.jailEnabled = options->cheat.jailEnabled; board.jailEnabled = false;
board.music = true; board.music = true;
setScoreBoardColor(); setScoreBoardColor();
@@ -153,6 +153,9 @@ void Demo::update()
scoreboard->update(); scoreboard->update();
screen->updateFX(); screen->updateFX();
checkRoomChange(); checkRoomChange();
// Actualiza las notificaciones
screen->updateNotifier();
} }
} }
@@ -161,8 +164,8 @@ void Demo::render()
{ {
// Prepara para dibujar el frame // Prepara para dibujar el frame
screen->start(); screen->start();
screen->clean(room->getBGColor());
// Dibuja los elementos del juego en orden
room->renderMap(); room->renderMap();
room->renderEnemies(); room->renderEnemies();
room->renderItems(); room->renderItems();
@@ -257,7 +260,7 @@ void Demo::checkRoomChange()
} }
else else
{ {
changeRoom(rooms.at(roomIndex)); changeRoom(rooms[roomIndex]);
} }
} }
} }

View File

@@ -1,7 +1,15 @@
#include "director.h" #include "common/jscore.h"
#include "common/utils.h" #include "common/utils.h"
#include "director.h"
#include <errno.h>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <sys/stat.h>
#include <unistd.h>
#ifndef _WIN32
#include <pwd.h>
#endif
// Constructor // Constructor
Director::Director(int argc, char *argv[]) Director::Director(int argc, char *argv[])
@@ -10,15 +18,18 @@ Director::Director(int argc, char *argv[])
section.subsection = SUBSECTION_LOGO_TO_INTRO; section.subsection = SUBSECTION_LOGO_TO_INTRO;
#ifdef DEBUG #ifdef DEBUG
section.name = SECTION_PROG_GAME; section.name = SECTION_PROG_LOGO;
#endif #endif
// Crea e inicializa las opciones del programa // Crea e inicializa las opciones del programa
iniOptions(); initOptions();
// Comprueba los parametros del programa // Comprueba los parametros del programa
checkProgramArguments(argc, argv); checkProgramArguments(argc, argv);
// Crea la carpeta del sistema donde guardar datos
createSystemFolder();
// Crea el objeto que controla los ficheros de recursos // Crea el objeto que controla los ficheros de recursos
asset = new Asset(executablePath); asset = new Asset(executablePath);
asset->setVerbose(options->console); asset->setVerbose(options->console);
@@ -26,7 +37,7 @@ Director::Director(int argc, char *argv[])
// Si falta algún fichero no inicia el programa // Si falta algún fichero no inicia el programa
if (!setFileList()) if (!setFileList())
{ {
section.name = SECTION_PROG_QUIT; exit(EXIT_FAILURE);
} }
// Inicializa variables desde el fichero de configuración // Inicializa variables desde el fichero de configuración
@@ -42,9 +53,8 @@ Director::Director(int argc, char *argv[])
resource = new Resource(renderer, asset, options); resource = new Resource(renderer, asset, options);
input = new Input(asset->get("gamecontrollerdb.txt")); input = new Input(asset->get("gamecontrollerdb.txt"));
initInput(); initInput();
screen = new Screen(window, renderer, options, GAMECANVAS_WIDTH, GAMECANVAS_HEIGHT); screen = new Screen(window, renderer, asset, options);
screen->setBorderColor(borderColor); screen->setBorderColor(borderColor);
screen->setVideoMode(options->fullScreenMode);
debug = new Debug(renderer, screen, asset); debug = new Debug(renderer, screen, asset);
music = JA_LoadMusic(asset->get("title.ogg").c_str()); music = JA_LoadMusic(asset->get("title.ogg").c_str());
} }
@@ -68,29 +78,87 @@ Director::~Director()
SDL_Quit(); SDL_Quit();
} }
// Inicializa los servicios online
void Director::initOnline()
{
if (options->online.jailerID == "")
{ // Jailer ID no definido
options->online.enabled = false;
}
else
{ // Jailer ID iniciado
if (options->online.enabled)
{ // Establece el servidor y el puerto
jscore::init(options->online.server, options->online.port);
const std::string caption = options->online.jailerID + " IS LOGGED IN";
screen->showNotification(caption);
if (options->console)
{
std::cout << caption << std::endl;
}
}
}
}
// Crea e inicializa las opciones del programa // Crea e inicializa las opciones del programa
void Director::iniOptions() void Director::initOptions()
{ {
// Crea el puntero a la estructura de opciones // Crea el puntero a la estructura de opciones
options = new options_t; options = new options_t;
// Inicializa valores // Version del archivo de configuración
options->fullScreenMode = 0; options->configVersion = "v1.06.1";
// Opciones de control
options->keys = ctrl_cursor;
// Opciones de video
options->gameWidth = GAMECANVAS_WIDTH;
options->gameHeight = GAMECANVAS_HEIGHT;
options->videoMode = 0;
options->windowSize = 3; options->windowSize = 3;
options->filter = FILTER_NEAREST; options->filter = FILTER_NEAREST;
options->vSync = true; options->vSync = true;
options->integerScale = true; options->integerScale = true;
options->keepAspect = true; options->keepAspect = true;
options->borderEnabled = true; options->borderEnabled = true;
options->borderSize = 0.1f; options->borderWidth = 32;
options->borderHeight = 24;
options->palette = p_zxspectrum; options->palette = p_zxspectrum;
#ifdef GAME_CONSOLE
options->windowSize = 2;
#endif
// Estos valores no se guardan en el fichero de configuraci´ón // Estos valores no se guardan en el fichero de configuraci´ón
options->console = false; options->console = false;
options->cheat.infiniteLives = false; options->cheat.infiniteLives = false;
options->cheat.invincible = false; options->cheat.invincible = false;
options->cheat.jailEnabled = false; options->cheat.jailEnabled = false;
options->cheat.altSkin = false; options->cheat.altSkin = false;
options->stats.rooms = 0;
options->stats.items = 0;
// Opciones online
options->online.enabled = true;
options->online.sessionEnabled = false;
options->online.server = "jaildoctor.duckdns.org";
options->online.port = 9911;
#ifdef DEBUG
options->online.gameID = "jaildoctors_dilemma_test";
#else
options->online.gameID = "jaildoctors_dilemma";
#endif
options->online.jailerID = "";
// Opciones de las notificaciones
options->notifications.posV = pos_top;
options->notifications.posH = pos_left;
options->notifications.sound = true;
options->notifications.color = {64, 64, 64};
} }
// Comprueba los parametros del programa // Comprueba los parametros del programa
@@ -135,6 +203,10 @@ bool Director::loadConfig()
// Indicador de éxito en la carga // Indicador de éxito en la carga
bool success = true; bool success = true;
// Versión actual del fichero
const std::string configVersion = options->configVersion;
options->configVersion = "";
// Variables para manejar el fichero // Variables para manejar el fichero
std::string line; std::string line;
std::ifstream file(asset->get("config.txt")); std::ifstream file(asset->get("config.txt"));
@@ -181,19 +253,40 @@ bool Director::loadConfig()
saveConfig(); saveConfig();
} }
// Si la versión de fichero no coincide, crea un fichero nuevo con los valores por defecto
if (configVersion != options->configVersion)
{
initOptions();
saveConfig();
}
// Normaliza los valores
const bool a = options->videoMode == 0;
const bool b = options->videoMode == SDL_WINDOW_FULLSCREEN;
const bool c = options->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP;
if (!(a || b || c))
{
options->videoMode = 0;
}
if (options->windowSize < 1 || options->windowSize > 4)
{
options->windowSize = 3;
}
// Aplica opciones // Aplica opciones
if (options->borderEnabled) // if (options->borderEnabled)
{ //{
const int incWidth = GAMECANVAS_WIDTH * options->borderSize; // const int incWidth = GAMECANVAS_WIDTH * options->borderSize;
const int incHeight = GAMECANVAS_HEIGHT * options->borderSize; // const int incHeight = GAMECANVAS_HEIGHT * options->borderSize;
options->screenWidth = (GAMECANVAS_WIDTH + incWidth) * options->windowSize; // options->gameWidth = GAMECANVAS_WIDTH + incWidth;
options->screenHeight = (GAMECANVAS_HEIGHT + incHeight) * options->windowSize; // options->gameHeight = GAMECANVAS_HEIGHT + incHeight;
} //}
else // else
{ //{
options->screenWidth = GAMECANVAS_WIDTH * options->windowSize; // options->gameWidth = GAMECANVAS_WIDTH;
options->screenHeight = GAMECANVAS_HEIGHT * options->windowSize; // options->gameHeight = GAMECANVAS_HEIGHT;
} //}
return success; return success;
} }
@@ -206,20 +299,54 @@ bool Director::saveConfig()
// Crea y abre el fichero de texto // Crea y abre el fichero de texto
std::ofstream file(asset->get("config.txt")); std::ofstream file(asset->get("config.txt"));
if (file.good())
{
if (options->console)
{
std::cout << asset->get("config.txt") << " open for writing" << std::endl;
}
}
else
{
if (options->console)
{
std::cout << asset->get("config.txt") << " can't be opened" << std::endl;
}
}
// Escribe en el fichero // Escribe en el fichero
if (options->fullScreenMode == 0) file << "## VERSION\n";
file << "configVersion=" + options->configVersion + "\n";
file << "\n## CONTROL OPTIONS\n";
file << "## keys = CURSOR | OPQA | WASD\n";
if (options->keys == ctrl_cursor)
{ {
file << "fullScreenMode=0\n"; file << "keys=CURSOR\n";
}
else if (options->keys == ctrl_opqa)
{
file << "keys=OPQA\n";
}
else if (options->keys == ctrl_wasd)
{
file << "keys=WASD\n";
} }
else if (options->fullScreenMode == SDL_WINDOW_FULLSCREEN) file << "\n## VISUAL OPTIONS\n";
if (options->videoMode == 0)
{ {
file << "fullScreenMode=SDL_WINDOW_FULLSCREEN\n"; file << "videoMode=0\n";
} }
else if (options->fullScreenMode == SDL_WINDOW_FULLSCREEN_DESKTOP) else if (options->videoMode == SDL_WINDOW_FULLSCREEN)
{ {
file << "fullScreenMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n"; file << "videoMode=SDL_WINDOW_FULLSCREEN\n";
}
else if (options->videoMode == SDL_WINDOW_FULLSCREEN_DESKTOP)
{
file << "videoMode=SDL_WINDOW_FULLSCREEN_DESKTOP\n";
} }
file << "windowSize=" + std::to_string(options->windowSize) + "\n"; file << "windowSize=" + std::to_string(options->windowSize) + "\n";
@@ -237,15 +364,104 @@ bool Director::saveConfig()
file << "integerScale=" + boolToString(options->integerScale) + "\n"; file << "integerScale=" + boolToString(options->integerScale) + "\n";
file << "keepAspect=" + boolToString(options->keepAspect) + "\n"; file << "keepAspect=" + boolToString(options->keepAspect) + "\n";
file << "borderEnabled=" + boolToString(options->borderEnabled) + "\n"; file << "borderEnabled=" + boolToString(options->borderEnabled) + "\n";
file << "borderSize=" + std::to_string(options->borderSize) + "\n"; file << "borderWidth=" + std::to_string(options->borderWidth) + "\n";
file << "borderHeight=" + std::to_string(options->borderHeight) + "\n";
file << "palette=" + std::to_string(options->palette) + "\n"; file << "palette=" + std::to_string(options->palette) + "\n";
file << "\n## ONLINE OPTIONS\n";
file << "enabled=" + boolToString(options->online.enabled) + "\n";
file << "server=" + options->online.server + "\n";
file << "port=" + std::to_string(options->online.port) + "\n";
file << "jailerID=" + options->online.jailerID + "\n";
file << "\n## NOTIFICATION OPTIONS\n";
file << "## notifications.posV = pos_top | pos_bottom\n";
if (options->notifications.posV == pos_top)
{
file << "notifications.posV=pos_top\n";
}
else
{
file << "notifications.posV=pos_bottom\n";
}
file << "## notifications.posH = pos_left | pos_middle | pos_right\n";
if (options->notifications.posH == pos_left)
{
file << "notifications.posH=pos_left\n";
}
else if (options->notifications.posH == pos_middle)
{
file << "notifications.posH=pos_middle\n";
}
else
{
file << "notifications.posH=pos_right\n";
}
file << "notifications.sound=" + boolToString(options->notifications.sound) + "\n";
// Cierra el fichero // Cierra el fichero
file.close(); file.close();
return success; return success;
} }
// Crea la carpeta del sistema donde guardar datos
void Director::createSystemFolder()
{
#ifdef DEBUG
const std::string folderName = "jaildoctors_dilemma_debug";
#else
const std::string folderName = "jaildoctors_dilemma";
#endif
#ifdef _WIN32
systemFolder = std::string(getenv("APPDATA")) + "/" + folderName;
#elif __APPLE__
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
systemFolder = std::string(homedir) + "/Library/Application Support/" + folderName;
#elif __linux__
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
systemFolder = std::string(homedir) + "/." + folderName;
#endif
struct stat st = {0};
if (stat(systemFolder.c_str(), &st) == -1)
{
errno = 0;
#ifdef _WIN32
int ret = mkdir(systemFolder.c_str());
#else
int ret = mkdir(systemFolder.c_str(), S_IRWXU);
#endif
if (ret == -1)
{
switch (errno)
{
case EACCES:
printf("the parent directory does not allow write");
exit(EXIT_FAILURE);
case EEXIST:
printf("pathname already exists");
exit(EXIT_FAILURE);
case ENAMETOOLONG:
printf("pathname is too long");
exit(EXIT_FAILURE);
default:
perror("mkdir");
exit(EXIT_FAILURE);
}
}
}
}
// Carga los recursos // Carga los recursos
void Director::loadResources(section_t section) void Director::loadResources(section_t section)
{ {
@@ -349,9 +565,9 @@ void Director::loadResources(section_t section)
textureList.push_back("abad.png"); textureList.push_back("abad.png");
textureList.push_back("abad_bell.png"); textureList.push_back("abad_bell.png");
textureList.push_back("amstrad_cs.png"); textureList.push_back("amstrad_cs.png");
textureList.push_back("arounder_fly.png"); textureList.push_back("flying_arounder.png");
textureList.push_back("arounder_stop.png"); textureList.push_back("stopped_arounder.png");
textureList.push_back("arounder_walk.png"); textureList.push_back("walking_arounder.png");
textureList.push_back("arounders_door.png"); textureList.push_back("arounders_door.png");
textureList.push_back("arounders_machine.png"); textureList.push_back("arounders_machine.png");
textureList.push_back("bat.png"); textureList.push_back("bat.png");
@@ -370,14 +586,14 @@ void Director::loadResources(section_t section)
textureList.push_back("demon.png"); textureList.push_back("demon.png");
textureList.push_back("heavy.png"); textureList.push_back("heavy.png");
textureList.push_back("dimallas.png"); textureList.push_back("dimallas.png");
textureList.push_back("diskette.png"); textureList.push_back("floppy.png");
textureList.push_back("dong.png"); textureList.push_back("dong.png");
textureList.push_back("guitar.png"); textureList.push_back("guitar.png");
textureList.push_back("jb_alien.png"); textureList.push_back("jailbattle_alien.png");
textureList.push_back("jb_human.png"); textureList.push_back("jailbattle_human.png");
textureList.push_back("jailer.png"); textureList.push_back("jailer_#1.png");
textureList.push_back("jailer2.png"); textureList.push_back("jailer_#2.png");
textureList.push_back("jailer3.png"); textureList.push_back("jailer_#3.png");
textureList.push_back("jeannine.png"); textureList.push_back("jeannine.png");
textureList.push_back("lamp.png"); textureList.push_back("lamp.png");
textureList.push_back("lord_abad.png"); textureList.push_back("lord_abad.png");
@@ -385,7 +601,7 @@ void Director::loadResources(section_t section)
textureList.push_back("matatunos.png"); textureList.push_back("matatunos.png");
textureList.push_back("mummy.png"); textureList.push_back("mummy.png");
textureList.push_back("paco.png"); textureList.push_back("paco.png");
textureList.push_back("printer.png"); textureList.push_back("elsa.png");
textureList.push_back("qvoid.png"); textureList.push_back("qvoid.png");
textureList.push_back("sam.png"); textureList.push_back("sam.png");
textureList.push_back("sigmasua.png"); textureList.push_back("sigmasua.png");
@@ -412,9 +628,9 @@ void Director::loadResources(section_t section)
animationList.push_back("abad.ani"); animationList.push_back("abad.ani");
animationList.push_back("abad_bell.ani"); animationList.push_back("abad_bell.ani");
animationList.push_back("amstrad_cs.ani"); animationList.push_back("amstrad_cs.ani");
animationList.push_back("arounder_fly.ani"); animationList.push_back("flying_arounder.ani");
animationList.push_back("arounder_stop.ani"); animationList.push_back("stopped_arounder.ani");
animationList.push_back("arounder_walk.ani"); animationList.push_back("walking_arounder.ani");
animationList.push_back("arounders_door.ani"); animationList.push_back("arounders_door.ani");
animationList.push_back("arounders_machine.ani"); animationList.push_back("arounders_machine.ani");
animationList.push_back("bat.ani"); animationList.push_back("bat.ani");
@@ -433,14 +649,14 @@ void Director::loadResources(section_t section)
animationList.push_back("demon.ani"); animationList.push_back("demon.ani");
animationList.push_back("heavy.ani"); animationList.push_back("heavy.ani");
animationList.push_back("dimallas.ani"); animationList.push_back("dimallas.ani");
animationList.push_back("diskette.ani"); animationList.push_back("floppy.ani");
animationList.push_back("dong.ani"); animationList.push_back("dong.ani");
animationList.push_back("guitar.ani"); animationList.push_back("guitar.ani");
animationList.push_back("jb_alien.ani"); animationList.push_back("jailbattle_alien.ani");
animationList.push_back("jb_human.ani"); animationList.push_back("jailbattle_human.ani");
animationList.push_back("jailer.ani"); animationList.push_back("jailer_#1.ani");
animationList.push_back("jailer2.ani"); animationList.push_back("jailer_#2.ani");
animationList.push_back("jailer3.ani"); animationList.push_back("jailer_#3.ani");
animationList.push_back("jeannine.ani"); animationList.push_back("jeannine.ani");
animationList.push_back("lamp.ani"); animationList.push_back("lamp.ani");
animationList.push_back("lord_abad.ani"); animationList.push_back("lord_abad.ani");
@@ -448,7 +664,7 @@ void Director::loadResources(section_t section)
animationList.push_back("matatunos.ani"); animationList.push_back("matatunos.ani");
animationList.push_back("mummy.ani"); animationList.push_back("mummy.ani");
animationList.push_back("paco.ani"); animationList.push_back("paco.ani");
animationList.push_back("printer.ani"); animationList.push_back("elsa.ani");
animationList.push_back("qvoid.ani"); animationList.push_back("qvoid.ani");
animationList.push_back("sam.ani"); animationList.push_back("sam.ani");
animationList.push_back("sigmasua.ani"); animationList.push_back("sigmasua.ani");
@@ -523,9 +739,9 @@ void Director::loadResources(section_t section)
textureList.push_back("abad.png"); textureList.push_back("abad.png");
textureList.push_back("aerojailer.png"); textureList.push_back("aerojailer.png");
textureList.push_back("amstrad_cs.png"); textureList.push_back("amstrad_cs.png");
textureList.push_back("arounder_fly.png"); textureList.push_back("flying_arounder.png");
textureList.push_back("arounder_stop.png"); textureList.push_back("stopped_arounder.png");
textureList.push_back("arounder_walk.png"); textureList.push_back("walking_arounder.png");
textureList.push_back("arounder.png"); textureList.push_back("arounder.png");
textureList.push_back("arounders_door.png"); textureList.push_back("arounders_door.png");
textureList.push_back("arounders_machine.png"); textureList.push_back("arounders_machine.png");
@@ -544,15 +760,15 @@ void Director::loadResources(section_t section)
textureList.push_back("crosshair.png"); textureList.push_back("crosshair.png");
textureList.push_back("demon.png"); textureList.push_back("demon.png");
textureList.push_back("dimallas.png"); textureList.push_back("dimallas.png");
textureList.push_back("diskette.png"); textureList.push_back("floppy.png");
textureList.push_back("dong.png"); textureList.push_back("dong.png");
textureList.push_back("guitar.png"); textureList.push_back("guitar.png");
textureList.push_back("heavy.png"); textureList.push_back("heavy.png");
textureList.push_back("jailer.png"); textureList.push_back("jailer_#1.png");
textureList.push_back("jailer2.png"); textureList.push_back("jailer_#2.png");
textureList.push_back("jailer3.png"); textureList.push_back("jailer_#3.png");
textureList.push_back("jb_alien.png"); textureList.push_back("jailbattle_alien.png");
textureList.push_back("jb_human.png"); textureList.push_back("jailbattle_human.png");
textureList.push_back("jeannine.png"); textureList.push_back("jeannine.png");
textureList.push_back("lamp.png"); textureList.push_back("lamp.png");
textureList.push_back("lord_abad.png"); textureList.push_back("lord_abad.png");
@@ -560,7 +776,7 @@ void Director::loadResources(section_t section)
textureList.push_back("mummy.png"); textureList.push_back("mummy.png");
textureList.push_back("paco.png"); textureList.push_back("paco.png");
textureList.push_back("pepe_rosita_job.png"); textureList.push_back("pepe_rosita_job.png");
textureList.push_back("printer.png"); textureList.push_back("elsa.png");
textureList.push_back("qvoid.png"); textureList.push_back("qvoid.png");
textureList.push_back("robot.png"); textureList.push_back("robot.png");
textureList.push_back("sam.png"); textureList.push_back("sam.png");
@@ -604,9 +820,9 @@ void Director::loadResources(section_t section)
animationList.push_back("abad.ani"); animationList.push_back("abad.ani");
animationList.push_back("aerojailer.ani"); animationList.push_back("aerojailer.ani");
animationList.push_back("amstrad_cs.ani"); animationList.push_back("amstrad_cs.ani");
animationList.push_back("arounder_fly.ani"); animationList.push_back("flying_arounder.ani");
animationList.push_back("arounder_stop.ani"); animationList.push_back("stopped_arounder.ani");
animationList.push_back("arounder_walk.ani"); animationList.push_back("walking_arounder.ani");
animationList.push_back("arounder.ani"); animationList.push_back("arounder.ani");
animationList.push_back("arounders_door.ani"); animationList.push_back("arounders_door.ani");
animationList.push_back("arounders_machine.ani"); animationList.push_back("arounders_machine.ani");
@@ -625,15 +841,15 @@ void Director::loadResources(section_t section)
animationList.push_back("crosshair.ani"); animationList.push_back("crosshair.ani");
animationList.push_back("demon.ani"); animationList.push_back("demon.ani");
animationList.push_back("dimallas.ani"); animationList.push_back("dimallas.ani");
animationList.push_back("diskette.ani"); animationList.push_back("floppy.ani");
animationList.push_back("dong.ani"); animationList.push_back("dong.ani");
animationList.push_back("guitar.ani"); animationList.push_back("guitar.ani");
animationList.push_back("heavy.ani"); animationList.push_back("heavy.ani");
animationList.push_back("jailer.ani"); animationList.push_back("jailer_#1.ani");
animationList.push_back("jailer2.ani"); animationList.push_back("jailer_#2.ani");
animationList.push_back("jailer3.ani"); animationList.push_back("jailer_#3.ani");
animationList.push_back("jb_alien.ani"); animationList.push_back("jailbattle_alien.ani");
animationList.push_back("jb_human.ani"); animationList.push_back("jailbattle_human.ani");
animationList.push_back("jeannine.ani"); animationList.push_back("jeannine.ani");
animationList.push_back("lamp.ani"); animationList.push_back("lamp.ani");
animationList.push_back("lord_abad.ani"); animationList.push_back("lord_abad.ani");
@@ -641,7 +857,7 @@ void Director::loadResources(section_t section)
animationList.push_back("mummy.ani"); animationList.push_back("mummy.ani");
animationList.push_back("paco.ani"); animationList.push_back("paco.ani");
animationList.push_back("pepe_rosita_job.ani"); animationList.push_back("pepe_rosita_job.ani");
animationList.push_back("printer.ani"); animationList.push_back("elsa.ani");
animationList.push_back("qvoid.ani"); animationList.push_back("qvoid.ani");
animationList.push_back("robot.ani"); animationList.push_back("robot.ani");
animationList.push_back("sam.ani"); animationList.push_back("sam.ani");
@@ -810,19 +1026,40 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
// Indicador de éxito en la asignación // Indicador de éxito en la asignación
bool success = true; bool success = true;
if (var == "fullScreenMode") if (var == "configVersion")
{ {
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP") options->configVersion = value;
{
options->fullScreenMode = SDL_WINDOW_FULLSCREEN_DESKTOP;
} }
else if (value == "SDL_WINDOW_FULLSCREEN")
else if (var == "keys")
{ {
options->fullScreenMode = SDL_WINDOW_FULLSCREEN; if (value == "OPQA")
{
options->keys = ctrl_opqa;
}
else if (value == "WASD")
{
options->keys = ctrl_wasd;
} }
else else
{ {
options->fullScreenMode = 0; options->keys = ctrl_cursor;
}
}
else if (var == "videoMode")
{
if (value == "SDL_WINDOW_FULLSCREEN_DESKTOP")
{
options->videoMode = SDL_WINDOW_FULLSCREEN_DESKTOP;
}
else if (value == "SDL_WINDOW_FULLSCREEN")
{
options->videoMode = SDL_WINDOW_FULLSCREEN;
}
else
{
options->videoMode = 0;
} }
} }
@@ -867,13 +1104,14 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
options->borderEnabled = stringToBool(value); options->borderEnabled = stringToBool(value);
} }
else if (var == "borderSize") else if (var == "borderWidth")
{ {
options->borderSize = std::stof(value); options->borderWidth = std::stoi(value);
if (options->borderSize < 0.0f || options->borderSize > 0.5f)
{
options->borderSize = 0.1f;
} }
else if (var == "borderHeight")
{
options->borderHeight = std::stoi(value);
} }
else if (var == "palette") else if (var == "palette")
@@ -891,7 +1129,64 @@ bool Director::setOptions(options_t *options, std::string var, std::string value
} }
} }
else if (var == "") else if (var == "enabled")
{
options->online.enabled = stringToBool(value);
}
else if (var == "server")
{
options->online.server = value;
}
else if (var == "port")
{
if (value == "")
{
value = "0";
}
options->online.port = std::stoi(value);
}
else if (var == "jailerID")
{
options->online.jailerID = value;
}
else if (var == "notifications.posH")
{
if (value == "pos_left")
{
options->notifications.posH = pos_left;
}
else if (value == "pos_middle")
{
options->notifications.posH = pos_middle;
}
else
{
options->notifications.posH = pos_right;
}
}
else if (var == "notifications.posV")
{
if (value == "pos_top")
{
options->notifications.posV = pos_top;
}
else
{
options->notifications.posV = pos_bottom;
}
}
else if (var == "notifications.sound")
{
options->notifications.sound = stringToBool(value);
}
else if (var == "" || var.substr(0, 1) == "#")
{ {
} }
@@ -913,10 +1208,26 @@ void Director::initInput()
input->discoverGameController(); input->discoverGameController();
// Asigna inputs a teclas // Asigna inputs a teclas
if (options->keys == ctrl_cursor)
{
input->bindKey(INPUT_UP, SDL_SCANCODE_UP); input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT); input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT); input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
}
else if (options->keys == ctrl_opqa)
{
input->bindKey(INPUT_UP, SDL_SCANCODE_Q);
input->bindKey(INPUT_LEFT, SDL_SCANCODE_O);
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_P);
}
else if (options->keys == ctrl_wasd)
{
input->bindKey(INPUT_UP, SDL_SCANCODE_W);
input->bindKey(INPUT_LEFT, SDL_SCANCODE_A);
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_D);
}
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
input->bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN); input->bindKey(INPUT_ACCEPT, SDL_SCANCODE_RETURN);
input->bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE); input->bindKey(INPUT_CANCEL, SDL_SCANCODE_ESCAPE);
input->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_SPACE); input->bindKey(INPUT_BUTTON_1, SDL_SCANCODE_SPACE);
@@ -924,14 +1235,14 @@ void Director::initInput()
input->bindKey(INPUT_BUTTON_PAUSE, SDL_SCANCODE_ESCAPE); input->bindKey(INPUT_BUTTON_PAUSE, SDL_SCANCODE_ESCAPE);
input->bindKey(INPUT_BUTTON_ESCAPE, SDL_SCANCODE_ESCAPE); input->bindKey(INPUT_BUTTON_ESCAPE, SDL_SCANCODE_ESCAPE);
input->bindGameControllerButton(INPUT_UP, SDL_CONTROLLER_BUTTON_DPAD_UP); input->bindGameControllerButton(INPUT_UP, SDL_CONTROLLER_BUTTON_B);
input->bindGameControllerButton(INPUT_DOWN, SDL_CONTROLLER_BUTTON_DPAD_DOWN); input->bindGameControllerButton(INPUT_DOWN, SDL_CONTROLLER_BUTTON_DPAD_DOWN);
input->bindGameControllerButton(INPUT_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT); input->bindGameControllerButton(INPUT_LEFT, SDL_CONTROLLER_BUTTON_DPAD_LEFT);
input->bindGameControllerButton(INPUT_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT); input->bindGameControllerButton(INPUT_RIGHT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT);
input->bindGameControllerButton(INPUT_ACCEPT, SDL_CONTROLLER_BUTTON_B); input->bindGameControllerButton(INPUT_ACCEPT, SDL_CONTROLLER_BUTTON_B);
input->bindGameControllerButton(INPUT_CANCEL, SDL_CONTROLLER_BUTTON_A); input->bindGameControllerButton(INPUT_CANCEL, SDL_CONTROLLER_BUTTON_A);
input->bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_B); input->bindGameControllerButton(INPUT_BUTTON_1, SDL_CONTROLLER_BUTTON_B);
input->bindGameControllerButton(INPUT_BUTTON_PAUSE, SDL_CONTROLLER_BUTTON_GUIDE); input->bindGameControllerButton(INPUT_BUTTON_PAUSE, SDL_CONTROLLER_BUTTON_START);
input->bindGameControllerButton(INPUT_BUTTON_ESCAPE, SDL_CONTROLLER_BUTTON_GUIDE); input->bindGameControllerButton(INPUT_BUTTON_ESCAPE, SDL_CONTROLLER_BUTTON_GUIDE);
} }
@@ -971,7 +1282,15 @@ bool Director::initSDL()
} }
// Crea la ventana // Crea la ventana
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, options->screenWidth, options->screenHeight, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); int incW = 0;
int incH = 0;
if (options->borderEnabled)
{
incW = options->borderWidth * 2;
incH = options->borderHeight * 2;
}
window = SDL_CreateWindow(WINDOW_CAPTION, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, (options->gameWidth + incW) * options->windowSize, (options->gameHeight + incH) * options->windowSize, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI);
if (window == nullptr) if (window == nullptr)
{ {
if (options->console) if (options->console)
@@ -1006,7 +1325,7 @@ bool Director::initSDL()
SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF);
// Establece el tamaño del buffer de renderizado // Establece el tamaño del buffer de renderizado
SDL_RenderSetLogicalSize(renderer, options->screenWidth, options->screenHeight); SDL_RenderSetLogicalSize(renderer, options->gameWidth, options->gameHeight);
// Establece el modo de mezcla // Establece el modo de mezcla
SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND); SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND);
@@ -1036,9 +1355,13 @@ bool Director::setFileList()
asset->add(prefix + "/data/font/debug.png", t_font); asset->add(prefix + "/data/font/debug.png", t_font);
asset->add(prefix + "/data/font/debug.txt", t_font); asset->add(prefix + "/data/font/debug.txt", t_font);
// Configuración // Datos
asset->add(prefix + "/data/input/gamecontrollerdb.txt", t_data); asset->add(prefix + "/data/input/gamecontrollerdb.txt", t_data);
asset->add(prefix + "/data/config/config.txt", t_data, false);
// Ficheros de sistema
asset->add(systemFolder + "/config.txt", t_data, false, true);
asset->add(systemFolder + "/stats_buffer.csv", t_data, false, true);
asset->add(systemFolder + "/stats.csv", t_data, false, true);
// Habitaciones // Habitaciones
asset->add(prefix + "/data/room/01.room", t_room); asset->add(prefix + "/data/room/01.room", t_room);
@@ -1175,12 +1498,12 @@ bool Director::setFileList()
asset->add(prefix + "/data/enemies/abad.png", t_bitmap); asset->add(prefix + "/data/enemies/abad.png", t_bitmap);
asset->add(prefix + "/data/enemies/amstrad_cs.ani", t_data); asset->add(prefix + "/data/enemies/amstrad_cs.ani", t_data);
asset->add(prefix + "/data/enemies/amstrad_cs.png", t_bitmap); asset->add(prefix + "/data/enemies/amstrad_cs.png", t_bitmap);
asset->add(prefix + "/data/enemies/arounder_fly.ani", t_data); asset->add(prefix + "/data/enemies/flying_arounder.ani", t_data);
asset->add(prefix + "/data/enemies/arounder_fly.png", t_bitmap); asset->add(prefix + "/data/enemies/flying_arounder.png", t_bitmap);
asset->add(prefix + "/data/enemies/arounder_stop.ani", t_data); asset->add(prefix + "/data/enemies/stopped_arounder.ani", t_data);
asset->add(prefix + "/data/enemies/arounder_stop.png", t_bitmap); asset->add(prefix + "/data/enemies/stopped_arounder.png", t_bitmap);
asset->add(prefix + "/data/enemies/arounder_walk.ani", t_data); asset->add(prefix + "/data/enemies/walking_arounder.ani", t_data);
asset->add(prefix + "/data/enemies/arounder_walk.png", t_bitmap); asset->add(prefix + "/data/enemies/walking_arounder.png", t_bitmap);
asset->add(prefix + "/data/enemies/arounders_door.ani", t_data); asset->add(prefix + "/data/enemies/arounders_door.ani", t_data);
asset->add(prefix + "/data/enemies/arounders_door.png", t_bitmap); asset->add(prefix + "/data/enemies/arounders_door.png", t_bitmap);
asset->add(prefix + "/data/enemies/arounders_machine.ani", t_data); asset->add(prefix + "/data/enemies/arounders_machine.ani", t_data);
@@ -1215,24 +1538,24 @@ bool Director::setFileList()
asset->add(prefix + "/data/enemies/demon.png", t_bitmap); asset->add(prefix + "/data/enemies/demon.png", t_bitmap);
asset->add(prefix + "/data/enemies/dimallas.ani", t_data); asset->add(prefix + "/data/enemies/dimallas.ani", t_data);
asset->add(prefix + "/data/enemies/dimallas.png", t_bitmap); asset->add(prefix + "/data/enemies/dimallas.png", t_bitmap);
asset->add(prefix + "/data/enemies/diskette.ani", t_data); asset->add(prefix + "/data/enemies/floppy.ani", t_data);
asset->add(prefix + "/data/enemies/diskette.png", t_bitmap); asset->add(prefix + "/data/enemies/floppy.png", t_bitmap);
asset->add(prefix + "/data/enemies/dong.ani", t_data); asset->add(prefix + "/data/enemies/dong.ani", t_data);
asset->add(prefix + "/data/enemies/dong.png", t_bitmap); asset->add(prefix + "/data/enemies/dong.png", t_bitmap);
asset->add(prefix + "/data/enemies/guitar.ani", t_data); asset->add(prefix + "/data/enemies/guitar.ani", t_data);
asset->add(prefix + "/data/enemies/guitar.png", t_bitmap); asset->add(prefix + "/data/enemies/guitar.png", t_bitmap);
asset->add(prefix + "/data/enemies/heavy.ani", t_data); asset->add(prefix + "/data/enemies/heavy.ani", t_data);
asset->add(prefix + "/data/enemies/heavy.png", t_bitmap); asset->add(prefix + "/data/enemies/heavy.png", t_bitmap);
asset->add(prefix + "/data/enemies/jailer.ani", t_data); asset->add(prefix + "/data/enemies/jailer_#1.ani", t_data);
asset->add(prefix + "/data/enemies/jailer.png", t_bitmap); asset->add(prefix + "/data/enemies/jailer_#1.png", t_bitmap);
asset->add(prefix + "/data/enemies/jailer2.ani", t_data); asset->add(prefix + "/data/enemies/jailer_#2.ani", t_data);
asset->add(prefix + "/data/enemies/jailer2.png", t_bitmap); asset->add(prefix + "/data/enemies/jailer_#2.png", t_bitmap);
asset->add(prefix + "/data/enemies/jailer3.ani", t_data); asset->add(prefix + "/data/enemies/jailer_#3.ani", t_data);
asset->add(prefix + "/data/enemies/jailer3.png", t_bitmap); asset->add(prefix + "/data/enemies/jailer_#3.png", t_bitmap);
asset->add(prefix + "/data/enemies/jb_alien.ani", t_data); asset->add(prefix + "/data/enemies/jailbattle_alien.ani", t_data);
asset->add(prefix + "/data/enemies/jb_alien.png", t_bitmap); asset->add(prefix + "/data/enemies/jailbattle_alien.png", t_bitmap);
asset->add(prefix + "/data/enemies/jb_human.ani", t_data); asset->add(prefix + "/data/enemies/jailbattle_human.ani", t_data);
asset->add(prefix + "/data/enemies/jb_human.png", t_bitmap); asset->add(prefix + "/data/enemies/jailbattle_human.png", t_bitmap);
asset->add(prefix + "/data/enemies/jeannine.ani", t_data); asset->add(prefix + "/data/enemies/jeannine.ani", t_data);
asset->add(prefix + "/data/enemies/jeannine.png", t_bitmap); asset->add(prefix + "/data/enemies/jeannine.png", t_bitmap);
asset->add(prefix + "/data/enemies/lamp.ani", t_data); asset->add(prefix + "/data/enemies/lamp.ani", t_data);
@@ -1245,8 +1568,8 @@ bool Director::setFileList()
asset->add(prefix + "/data/enemies/mummy.png", t_bitmap); asset->add(prefix + "/data/enemies/mummy.png", t_bitmap);
asset->add(prefix + "/data/enemies/paco.ani", t_data); asset->add(prefix + "/data/enemies/paco.ani", t_data);
asset->add(prefix + "/data/enemies/paco.png", t_bitmap); asset->add(prefix + "/data/enemies/paco.png", t_bitmap);
asset->add(prefix + "/data/enemies/printer.ani", t_data); asset->add(prefix + "/data/enemies/elsa.ani", t_data);
asset->add(prefix + "/data/enemies/printer.png", t_bitmap); asset->add(prefix + "/data/enemies/elsa.png", t_bitmap);
asset->add(prefix + "/data/enemies/qvoid.ani", t_data); asset->add(prefix + "/data/enemies/qvoid.ani", t_data);
asset->add(prefix + "/data/enemies/qvoid.png", t_bitmap); asset->add(prefix + "/data/enemies/qvoid.png", t_bitmap);
asset->add(prefix + "/data/enemies/robot.ani", t_data); asset->add(prefix + "/data/enemies/robot.ani", t_data);
@@ -1332,6 +1655,7 @@ bool Director::setFileList()
asset->add(prefix + "/data/sound/jump22.wav", t_sound); asset->add(prefix + "/data/sound/jump22.wav", t_sound);
asset->add(prefix + "/data/sound/jump23.wav", t_sound); asset->add(prefix + "/data/sound/jump23.wav", t_sound);
asset->add(prefix + "/data/sound/jump24.wav", t_sound); asset->add(prefix + "/data/sound/jump24.wav", t_sound);
asset->add(prefix + "/data/sound/notify.wav", t_sound);
// Logo // Logo
asset->add(prefix + "/data/logo/jailgames.png", t_bitmap); asset->add(prefix + "/data/logo/jailgames.png", t_bitmap);
@@ -1454,6 +1778,20 @@ void Director::runDemo()
resource->free(); resource->free();
} }
// Ejecuta la seccion en la que se solicita al usuario su ID online
void Director::runEnterID()
{
if (options->console)
{
std::cout << "\n* SECTION: ENTER_ID" << std::endl;
}
// loadResources(section);
enterID = new EnterID(renderer, screen, asset, options, section);
setSection(enterID->run());
delete enterID;
resource->free();
}
// Ejecuta la seccion del final del juego // Ejecuta la seccion del final del juego
void Director::runEnding() void Director::runEnding()
{ {
@@ -1538,6 +1876,10 @@ void Director::run()
runDemo(); runDemo();
break; break;
case SECTION_PROG_ENTER_ID:
runEnterID();
break;
case SECTION_PROG_GAME: case SECTION_PROG_GAME:
runGame(); runGame();
break; break;

View File

@@ -12,13 +12,14 @@
#include "const.h" #include "const.h"
#include "credits.h" #include "credits.h"
#include "demo.h" #include "demo.h"
#include "ending.h"
#include "ending2.h"
#include "enter_id.h"
#include "game_over.h"
#include "game.h" #include "game.h"
#include "intro.h" #include "intro.h"
#include "logo.h" #include "logo.h"
#include "title.h" #include "title.h"
#include "game_over.h"
#include "ending.h"
#include "ending2.h"
#ifndef DIRECTOR_H #ifndef DIRECTOR_H
#define DIRECTOR_H #define DIRECTOR_H
@@ -39,6 +40,7 @@ private:
Intro *intro; // Objeto para gestionar la introducción del juego Intro *intro; // Objeto para gestionar la introducción del juego
Credits *credits; // Objeto para gestionar los creditos del juego Credits *credits; // Objeto para gestionar los creditos del juego
Demo *demo; // Objeto para gestionar el modo demo, en el que se ven pantallas del juego Demo *demo; // Objeto para gestionar el modo demo, en el que se ven pantallas del juego
EnterID *enterID; // Objeto para gestionar la sección donde se solicita el ID online al usuario
Ending *ending; // Objeto para gestionar el final del juego Ending *ending; // Objeto para gestionar el final del juego
Ending2 *ending2; // Objeto para gestionar el final del juego Ending2 *ending2; // Objeto para gestionar el final del juego
GameOver *gameOver; // Objeto para gestionar el final de la partida GameOver *gameOver; // Objeto para gestionar el final de la partida
@@ -46,12 +48,16 @@ private:
struct options_t *options; // Variable con todas las opciones del programa struct options_t *options; // Variable con todas las opciones del programa
// Variables // Variables
JA_Music music; // Musica del titulo
std::string executablePath; // Path del ejecutable
section_t section; // Sección y subsección actual del programa; section_t section; // Sección y subsección actual del programa;
JA_Music_t* music; // Musica del titulo
std::string executablePath; // Path del ejecutable
std::string systemFolder; // Carpeta del sistema donde guardar datos
// Crea e inicializa las opciones del programa // Crea e inicializa las opciones del programa
void iniOptions(); void initOptions();
// Inicializa los servicios online
void initOnline();
// Comprueba los parametros del programa // Comprueba los parametros del programa
void checkProgramArguments(int argc, char *argv[]); void checkProgramArguments(int argc, char *argv[]);
@@ -62,6 +68,9 @@ private:
// Guarda el fichero de configuración // Guarda el fichero de configuración
bool saveConfig(); bool saveConfig();
// Crea la carpeta del sistema donde guardar datos
void createSystemFolder();
// Carga los recursos // Carga los recursos
void loadResources(section_t section); void loadResources(section_t section);
@@ -104,6 +113,9 @@ private:
// Ejecuta la seccion de la demo, donde se ven pantallas del juego // Ejecuta la seccion de la demo, donde se ven pantallas del juego
void runDemo(); void runDemo();
// Ejecuta la seccion en la que se solicita al usuario su ID online
void runEnterID();
// Ejecuta la seccion del final del juego // Ejecuta la seccion del final del juego
void runEnding(); void runEnding();

View File

@@ -103,6 +103,9 @@ void Ending::update()
// Actualiza el volumen de la musica // Actualiza el volumen de la musica
updateMusicVolume(); updateMusicVolume();
// Actualiza las notificaciones
screen->updateNotifier();
} }
} }
@@ -116,16 +119,16 @@ void Ending::render()
screen->clean(stringToColor(options->palette, "black")); screen->clean(stringToColor(options->palette, "black"));
// Dibuja las imagenes de la escena // Dibuja las imagenes de la escena
spritePics.at(scene).sprite->render(); spritePics[scene].sprite->render();
spritePics.at(scene).coverSprite->render(); spritePics[scene].coverSprite->render();
// Dibuja los textos de la escena // Dibuja los textos de la escena
for (auto ti : scenes.at(scene).textIndex) for (auto ti : scenes[scene].textIndex)
{ {
if (counter > ti.trigger) if (counter > ti.trigger)
{ {
spriteTexts.at(ti.index).sprite->render(); spriteTexts[ti.index].sprite->render();
spriteTexts.at(ti.index).coverSprite->render(); spriteTexts[ti.index].coverSprite->render();
} }
} }
@@ -508,7 +511,7 @@ void Ending::updateCounters()
counter++; counter++;
} }
if (counter > scenes.at(scene).counterEnd - 100) if (counter > scenes[scene].counterEnd - 100)
{ {
coverCounter++; coverCounter++;
} }
@@ -519,20 +522,20 @@ void Ending::updateSpriteCovers()
{ // Actualiza la cortinilla de los textos { // Actualiza la cortinilla de los textos
if (counter % 4 == 0) if (counter % 4 == 0)
{ {
for (auto ti : scenes.at(scene).textIndex) for (auto ti : scenes[scene].textIndex)
{ {
if (counter > ti.trigger) if (counter > ti.trigger)
{ {
if (spriteTexts.at(ti.index).clipDesp > 0) if (spriteTexts[ti.index].clipDesp > 0)
{ {
spriteTexts.at(ti.index).clipDesp -= 2; spriteTexts[ti.index].clipDesp -= 2;
} }
else if (spriteTexts.at(ti.index).clipHeight > 0) else if (spriteTexts[ti.index].clipHeight > 0)
{ {
spriteTexts.at(ti.index).clipHeight -= 2; spriteTexts[ti.index].clipHeight -= 2;
spriteTexts.at(ti.index).coverSprite->setPosY(spriteTexts.at(ti.index).coverSprite->getPosY() + 2); spriteTexts[ti.index].coverSprite->setPosY(spriteTexts[ti.index].coverSprite->getPosY() + 2);
} }
spriteTexts.at(ti.index).coverSprite->setSpriteClip(0, spriteTexts.at(ti.index).clipDesp, spriteTexts.at(ti.index).coverSprite->getWidth(), spriteTexts.at(ti.index).clipHeight); spriteTexts[ti.index].coverSprite->setSpriteClip(0, spriteTexts[ti.index].clipDesp, spriteTexts[ti.index].coverSprite->getWidth(), spriteTexts[ti.index].clipHeight);
} }
} }
} }
@@ -540,27 +543,27 @@ void Ending::updateSpriteCovers()
// Actualiza la cortinilla de las imagenes // Actualiza la cortinilla de las imagenes
if (counter % 2 == 0) if (counter % 2 == 0)
{ {
if (spritePics.at(scene).clipDesp > 0) if (spritePics[scene].clipDesp > 0)
{ {
spritePics.at(scene).clipDesp -= 2; spritePics[scene].clipDesp -= 2;
} }
else if (spritePics.at(scene).clipHeight > 0) else if (spritePics[scene].clipHeight > 0)
{ {
spritePics.at(scene).clipHeight -= 2; spritePics[scene].clipHeight -= 2;
if (spritePics.at(scene).clipHeight < 0) if (spritePics[scene].clipHeight < 0)
{ {
spritePics.at(scene).clipHeight = 0; spritePics[scene].clipHeight = 0;
} }
spritePics.at(scene).coverSprite->setPosY(spritePics.at(scene).coverSprite->getPosY() + 2); spritePics[scene].coverSprite->setPosY(spritePics[scene].coverSprite->getPosY() + 2);
} }
spritePics.at(scene).coverSprite->setSpriteClip(0, spritePics.at(scene).clipDesp, spritePics.at(scene).coverSprite->getWidth(), spritePics.at(scene).clipHeight); spritePics[scene].coverSprite->setSpriteClip(0, spritePics[scene].clipDesp, spritePics[scene].coverSprite->getWidth(), spritePics[scene].clipHeight);
} }
} }
// Comprueba si se ha de cambiar de escena // Comprueba si se ha de cambiar de escena
void Ending::checkChangeScene() void Ending::checkChangeScene()
{ {
if (counter > scenes.at(scene).counterEnd) if (counter > scenes[scene].counterEnd)
{ {
scene++; scene++;
counter = 0; counter = 0;
@@ -636,20 +639,20 @@ void Ending::switchPalette()
{ {
options->palette = p_zxarne; options->palette = p_zxarne;
spritePics.at(0).sprite->setTexture(resource->getTexture("ending1_zxarne.png")); spritePics[0].sprite->setTexture(resource->getTexture("ending1_zxarne.png"));
spritePics.at(1).sprite->setTexture(resource->getTexture("ending2_zxarne.png")); spritePics[1].sprite->setTexture(resource->getTexture("ending2_zxarne.png"));
spritePics.at(2).sprite->setTexture(resource->getTexture("ending3_zxarne.png")); spritePics[2].sprite->setTexture(resource->getTexture("ending3_zxarne.png"));
spritePics.at(3).sprite->setTexture(resource->getTexture("ending4_zxarne.png")); spritePics[3].sprite->setTexture(resource->getTexture("ending4_zxarne.png"));
spritePics.at(4).sprite->setTexture(resource->getTexture("ending5_zxarne.png")); spritePics[4].sprite->setTexture(resource->getTexture("ending5_zxarne.png"));
} }
else else
{ {
options->palette = p_zxspectrum; options->palette = p_zxspectrum;
spritePics.at(0).sprite->setTexture(resource->getTexture("ending1.png")); spritePics[0].sprite->setTexture(resource->getTexture("ending1.png"));
spritePics.at(1).sprite->setTexture(resource->getTexture("ending2.png")); spritePics[1].sprite->setTexture(resource->getTexture("ending2.png"));
spritePics.at(2).sprite->setTexture(resource->getTexture("ending3.png")); spritePics[2].sprite->setTexture(resource->getTexture("ending3.png"));
spritePics.at(3).sprite->setTexture(resource->getTexture("ending4.png")); spritePics[3].sprite->setTexture(resource->getTexture("ending4.png"));
spritePics.at(4).sprite->setTexture(resource->getTexture("ending5.png")); spritePics[4].sprite->setTexture(resource->getTexture("ending5.png"));
} }
} }

View File

@@ -70,7 +70,7 @@ private:
std::vector<endingTexture_t> spritePics; // Vector con los sprites de texto con su cortinilla std::vector<endingTexture_t> spritePics; // Vector con los sprites de texto con su cortinilla
int scene; // Escena actual int scene; // Escena actual
std::vector<scene_t> scenes; // Vector con los textos e imagenes de cada escena std::vector<scene_t> scenes; // Vector con los textos e imagenes de cada escena
JA_Music music; // Musica que suena durante el final JA_Music_t* music; // Musica que suena durante el final
// Actualiza el objeto // Actualiza el objeto
void update(); void update();

View File

@@ -102,6 +102,9 @@ void Ending2::update()
// Actualiza el volumen de la musica // Actualiza el volumen de la musica
updateMusicVolume(); updateMusicVolume();
// Actualiza las notificaciones
screen->updateNotifier();
} }
} }
@@ -285,14 +288,14 @@ void Ending2::iniSpriteList()
// Añade los valores // Añade los valores
spriteList.push_back("bin"); spriteList.push_back("bin");
spriteList.push_back("diskette"); spriteList.push_back("floppy");
spriteList.push_back("bird"); spriteList.push_back("bird");
spriteList.push_back("chip"); spriteList.push_back("chip");
spriteList.push_back("jeannine"); spriteList.push_back("jeannine");
spriteList.push_back("spark"); spriteList.push_back("spark");
spriteList.push_back("code"); spriteList.push_back("code");
spriteList.push_back("paco"); spriteList.push_back("paco");
spriteList.push_back("printer"); spriteList.push_back("elsa");
spriteList.push_back("z80"); spriteList.push_back("z80");
spriteList.push_back("bell"); spriteList.push_back("bell");
@@ -301,9 +304,9 @@ void Ending2::iniSpriteList()
spriteList.push_back("amstrad_cs"); spriteList.push_back("amstrad_cs");
spriteList.push_back("breakout"); spriteList.push_back("breakout");
spriteList.push_back("arounder_fly"); spriteList.push_back("flying_arounder");
spriteList.push_back("arounder_stop"); spriteList.push_back("stopped_arounder");
spriteList.push_back("arounder_walk"); spriteList.push_back("walking_arounder");
spriteList.push_back("arounders_door"); spriteList.push_back("arounders_door");
spriteList.push_back("arounders_machine"); spriteList.push_back("arounders_machine");
@@ -321,12 +324,12 @@ void Ending2::iniSpriteList()
spriteList.push_back("dimallas"); spriteList.push_back("dimallas");
spriteList.push_back("guitar"); spriteList.push_back("guitar");
spriteList.push_back("jb_alien"); spriteList.push_back("jailbattle_alien");
spriteList.push_back("jb_human"); spriteList.push_back("jailbattle_human");
spriteList.push_back("jailer"); spriteList.push_back("jailer_#1");
spriteList.push_back("jailer2"); spriteList.push_back("jailer_#2");
spriteList.push_back("jailer3"); spriteList.push_back("jailer_#3");
spriteList.push_back("bry"); spriteList.push_back("bry");
spriteList.push_back("upv_student"); spriteList.push_back("upv_student");
@@ -466,13 +469,13 @@ void Ending2::placeSprites()
{ {
const int x = i % 2 == 0 ? firstCol : secondCol; const int x = i % 2 == 0 ? firstCol : secondCol;
const int y = (i / 1) * (maxSpriteHeight + distSpriteText + text->getCharacterSize() + distSpriteSprite) + GAMECANVAS_HEIGHT + 40; const int y = (i / 1) * (maxSpriteHeight + distSpriteText + text->getCharacterSize() + distSpriteSprite) + GAMECANVAS_HEIGHT + 40;
const int w = sprites.at(i)->getAnimationClip(0, 0).w; const int w = sprites[i]->getAnimationClip(0, 0).w;
const int h = sprites.at(i)->getAnimationClip(0, 0).h; const int h = sprites[i]->getAnimationClip(0, 0).h;
const int dx = -(w / 2); const int dx = -(w / 2);
const int dy = i % 1 == 0 ? maxSpriteHeight - h : (int)(maxSpriteHeight * 1.5f) - h; const int dy = i % 1 == 0 ? maxSpriteHeight - h : (int)(maxSpriteHeight * 1.5f) - h;
sprites.at(i)->setRect({x + dx, y + dy, w, h}); sprites[i]->setRect({x + dx, y + dy, w, h});
sprites.at(i)->setVelY(despSpeed); sprites[i]->setVelY(despSpeed);
} }
// Recoloca el último sprite, que es el del jugador // Recoloca el último sprite, que es el del jugador
@@ -494,14 +497,14 @@ void Ending2::createSpriteTexts()
for (int i = 0; i < (int)spriteList.size(); ++i) for (int i = 0; i < (int)spriteList.size(); ++i)
{ {
// Calcula constantes // Calcula constantes
std::string txt = spriteList.at(i); std::string txt = spriteList[i];
std::replace(txt.begin(), txt.end(), '_', ' '); std::replace(txt.begin(), txt.end(), '_', ' ');
txt = txt == "player" ? "JAILDOCTOR" : txt; // Reemplaza el texto txt = txt == "player" ? "JAILDOCTOR" : txt; // Reemplaza el texto
const int w = text->lenght(txt, 1); const int w = text->lenght(txt, 1);
const int h = text->getCharacterSize(); const int h = text->getCharacterSize();
const int x = i % 2 == 0 ? firstCol : secondCol; const int x = i % 2 == 0 ? firstCol : secondCol;
const int dx = -(w / 2); const int dx = -(w / 2);
const int y = sprites.at(i)->getPosY() + sprites.at(i)->getHeight() + distSpriteText; const int y = sprites[i]->getPosY() + sprites[i]->getHeight() + distSpriteText;
// Cambia la posición del último sprite // Cambia la posición del último sprite
const int X = (i == (int)spriteList.size() - 1) ? GAMECANVAS_CENTER_X - (w / 2) : x + dx; const int X = (i == (int)spriteList.size() - 1) ? GAMECANVAS_CENTER_X - (w / 2) : x + dx;
@@ -533,7 +536,7 @@ void Ending2::createTexts()
for (int i = 0; i < (int)list.size(); ++i) for (int i = 0; i < (int)list.size(); ++i)
{ {
// Calcula constantes // Calcula constantes
const int w = text->lenght(list.at(i), 1); const int w = text->lenght(list[i], 1);
const int h = text->getCharacterSize(); const int h = text->getCharacterSize();
const int x = GAMECANVAS_CENTER_X; const int x = GAMECANVAS_CENTER_X;
const int dx = -(w / 2); const int dx = -(w / 2);
@@ -544,7 +547,7 @@ void Ending2::createTexts()
texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET); texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET);
texture->setAsRenderTarget(renderer); texture->setAsRenderTarget(renderer);
texture->setBlendMode(SDL_BLENDMODE_BLEND); texture->setBlendMode(SDL_BLENDMODE_BLEND);
text->write(0, 0, list.at(i)); text->write(0, 0, list[i]);
// Crea el sprite // Crea el sprite
MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer); MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer);
@@ -562,7 +565,7 @@ void Ending2::createTexts()
for (int i = 0; i < (int)list.size(); ++i) for (int i = 0; i < (int)list.size(); ++i)
{ {
// Calcula constantes // Calcula constantes
const int w = text->lenght(list.at(i), 1); const int w = text->lenght(list[i], 1);
const int h = text->getCharacterSize(); const int h = text->getCharacterSize();
const int x = GAMECANVAS_CENTER_X; const int x = GAMECANVAS_CENTER_X;
const int dx = -(w / 2); const int dx = -(w / 2);
@@ -573,7 +576,7 @@ void Ending2::createTexts()
texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET); texture->createBlank(renderer, w, h, SDL_TEXTUREACCESS_TARGET);
texture->setAsRenderTarget(renderer); texture->setAsRenderTarget(renderer);
texture->setBlendMode(SDL_BLENDMODE_BLEND); texture->setBlendMode(SDL_BLENDMODE_BLEND);
text->write(0, 0, list.at(i)); text->write(0, 0, list[i]);
// Crea el sprite // Crea el sprite
MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer); MovingSprite *sprite = new MovingSprite(x + dx, y, w, h, 0.0f, despSpeed, 0.0f, 0.0f, texture, renderer);
@@ -621,7 +624,7 @@ void Ending2::updateFinalFade()
for (auto t : texts) for (auto t : texts)
{ {
t->getTexture()->setColor(colors.at(index).r, colors.at(index).g, colors.at(index).b); t->getTexture()->setColor(colors[index].r, colors[index].g, colors[index].b);
} }
} }

Some files were not shown because too many files have changed in this diff Show More