diff --git a/.gitignore b/.gitignore index 43438c5b..4a635c3a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ thumbs.db *.dmg *.tar.gz *.zip -*.app \ No newline at end of file +*.app +*_debug \ No newline at end of file diff --git a/Makefile b/Makefile index 97bf5591..1f030507 100644 --- a/Makefile +++ b/Makefile @@ -4,11 +4,17 @@ appName = JailDoctor's Dilemma releaseFolder = jdd_release version = v1.0 +# Release names +windowsRelease = $(executable)-$(version)-win32-x64.zip +macosIntelRelease = $(executable)-$(version)-macos-intel.dmg +macosAppleSiliconRelease = $(executable)-$(version)-macos-apple-silicon.dmg +linuxRelease = $(executable)-$(version)-linux.tar.gz + windows: @echo off powershell if (Test-Path data\config) {Remove-Item data\config -Recurse -Force} powershell if (-not (Test-Path data\config)) {New-Item data\config -ItemType Directory} - g++ $(source) -std=c++11 -Wall -Os -lmingw32 -lSDL2main -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -static-libstdc++ -Wl,-subsystem,windows -o $(executable).exe + 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_release: @@ -33,12 +39,12 @@ windows_release: powershell if (Test-Path "$(releaseFolder)\data\room\standard.tsx") {Remove-Item "$(releaseFolder)\data\room\standard.tsx" -Recurse -Force} # Build - g++ $(source) -D RELEASE -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 -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 # Create ZIP - powershell if (Test-Path $(executable)_win_$(version).zip) {Remove-Item $(executable)-$(version)-win32-x64.zip} - powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(executable)-$(version)-win32-x64.zip + powershell if (Test-Path $(executable)_win_$(version).zip) {Remove-Item $(windowsRelease)} + powershell Compress-Archive -Path "$(releaseFolder)"/* -DestinationPath $(windowsRelease) # Remove folder powershell if (Test-Path $(releaseFolder)) {Remove-Item $(releaseFolder) -Recurse -Force} @@ -46,7 +52,7 @@ windows_release: macos: rm -rdf data/config mkdir -p data/config - clang++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o $(executable)_macos + clang++ $(source) -D DEBUG -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -o $(executable)_macos macos_release: # Remove data @@ -74,22 +80,22 @@ macos_release: cp release/Info.plist "$(releaseFolder)/$(appName).app/Contents" # Build INTEL - clang++ $(source) -D RELEASE -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 # Build INTEL DMG - rm -f "$(executable)_macos_intel_$(version).dmg" + rm -f "$(macosIntelRelease)" hdiutil create tmp.dmg -ov -volname "$(appName)" -fs HFS+ -srcfolder "$(releaseFolder)" - hdiutil convert tmp.dmg -format UDZO -o "$(executable)-$(version)-macos-intel.dmg" - rm tmp.dmg + hdiutil convert tmp.dmg -format UDZO -o "$(macosIntelRelease)" + rm -f tmp.dmg # Build APPLE SILICON - clang++ $(source) -D RELEASE -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 arm64-apple-macos11 + 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 arm64-apple-macos11 # Build APPLE SILICON DMG - rm -f "$(executable)_macos_apple_silicon_$(version).dmg" + rm -f "$(macosAppleSiliconRelease)" hdiutil create tmp.dmg -ov -volname "$(appName)" -fs HFS+ -srcfolder "$(releaseFolder)" - hdiutil convert tmp.dmg -format UDZO -o "$(executable)-$(version)-macos-apple-silicon.dmg" - rm tmp.dmg + hdiutil convert tmp.dmg -format UDZO -o "$(macosAppleSiliconRelease)" + rm -f tmp.dmg # Remove data rm -rdf Frameworks @@ -98,7 +104,7 @@ macos_release: linux: rm -rdf data/config mkdir -p data/config - g++ $(source) -std=c++11 -Wall -Os -lSDL2 -ffunction-sections -fdata-sections -Wl,--gc-sections -o $(executable)_linux + 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_release: @@ -120,11 +126,12 @@ linux_release: rm -f "$(releaseFolder)/data/room/standard.tsx" # Build - g++ $(source) -D RELEASE -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 # Pack files - cd $(releaseFolder) && tar -czvf ../$(executable)-$(version)-linux.tar.gz * + rm -f $(linuxRelease) + cd $(releaseFolder) && tar -czvf ../$(linuxRelease) * # Remove data rm -rdf $(releaseFolder) \ No newline at end of file diff --git a/README.md b/README.md index 97d1dcb4..77918811 100644 --- a/README.md +++ b/README.md @@ -30,8 +30,8 @@ El juego permite tanto el uso del teclado como de un mando de control. Las tecla ![JailDoctor's Dilemma - Gameplay](https://php.sustancia.synology.me/images/jdd_game2.png) ## 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 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 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* \ No newline at end of file diff --git a/data/enemies/dong.ani b/data/enemies/dong.ani index 0f762c6a..d7d8f1c1 100644 --- a/data/enemies/dong.ani +++ b/data/enemies/dong.ani @@ -5,5 +5,5 @@ frameHeight=16 name=default speed=6 loop=0 -frames=0,1,2,3,4,5,6,7,8 +frames=0,1,2,3,4,5 [/animation] \ No newline at end of file diff --git a/data/enemies/dong.png b/data/enemies/dong.png index f713ebbf..26ee88ec 100644 Binary files a/data/enemies/dong.png and b/data/enemies/dong.png differ diff --git a/data/room/15.tmx b/data/room/15.tmx index 9fdfd6f8..5f105220 100644 --- a/data/room/15.tmx +++ b/data/room/15.tmx @@ -4,12 +4,12 @@ 16,16,16,16,16,0,16,16,16,16,349,349,349,349,349,349,349,349,349,349,302,0,0,302,302,16,16,16,16,16,16,16, -16,16,0,0,0,0,0,349,16,349,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,16, -16,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16, +16,16,302,0,0,0,0,349,16,349,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,302,16,16, +16,302,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,302,16, 16,0,0,0,0,349,0,0,16,0,0,0,0,0,0,0,0,0,0,0,423,423,423,423,423,0,0,0,0,0,0,16, 16,0,0,0,16,16,16,16,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16, -16,0,0,0,0,0,0,16,16,16,16,0,0,0,423,0,0,0,423,547,0,0,0,0,0,0,0,0,0,0,0,16, -16,0,0,0,0,0,0,0,16,16,0,0,0,0,0,0,0,0,0,0,547,0,0,0,0,424,422,424,422,0,0,16, +16,0,0,0,0,0,302,16,16,16,16,0,0,0,423,0,0,0,423,547,0,0,0,0,0,0,0,0,0,0,0,16, +16,0,0,0,0,0,0,302,16,16,0,0,0,0,0,0,0,0,0,0,547,0,0,0,0,424,422,424,422,0,0,16, 16,0,0,424,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,422,0,0,0,0,0,0,0,0,0,16, 16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,422,0,0,0,0,422,0,0,0,0,0,0,0,422,16, 16,422,547,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16, diff --git a/data/room/25.room b/data/room/25.room index b0bb2b90..42602ec7 100644 --- a/data/room/25.room +++ b/data/room/25.room @@ -11,6 +11,7 @@ itemColor1=yellow itemColor2=cyan [enemy] +# Batman tocando la campana tileSetFile=batman_bell.png animation=batman_bell.ani width=16 @@ -27,6 +28,7 @@ color=cyan [/enemy] [enemy] +# Campana de Batman tileSetFile=bell.png animation=bell.ani width=16 @@ -68,7 +70,7 @@ height=16 x=6 y=4 vx=0 -vy=0.5 +vy=0.4 x1=6 y1=4 x2=6 diff --git a/source/director.cpp b/source/director.cpp index 3ce8cefa..bdd106f7 100644 --- a/source/director.cpp +++ b/source/director.cpp @@ -9,7 +9,7 @@ Director::Director(int argc, char *argv[]) section.name = SECTION_PROG_LOGO; section.subsection = SUBSECTION_LOGO_TO_INTRO; -#ifndef RELEASE +#ifdef DEBUG section.name = SECTION_PROG_GAME; #endif diff --git a/source/game.cpp b/source/game.cpp index 467b3b7e..64bd6277 100644 --- a/source/game.cpp +++ b/source/game.cpp @@ -20,8 +20,8 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as this->debug = debug; this->options = options; -#ifndef RELEASE - currentRoom = "33.room"; +#ifdef DEBUG + currentRoom = "14.room"; const int x1 = 1; const int y1 = 13; spawnPoint = {x1 * 8, y1 * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL}; @@ -96,7 +96,7 @@ void Game::checkEventHandler() case SDL_SCANCODE_ESCAPE: section.name = SECTION_PROG_TITLE; break; -#ifndef RELEASE +#ifdef DEBUG case SDL_SCANCODE_G: debug->switchEnabled(); options->cheat.invincible = debug->getEnabled(); diff --git a/source/player.cpp b/source/player.cpp index 3f8ca36d..bec807a8 100644 --- a/source/player.cpp +++ b/source/player.cpp @@ -196,10 +196,18 @@ void Player::checkInput() if (input->checkInput(INPUT_UP, REPEAT_TRUE)) { - setState(s_jumping); - vy = -maxVY; - jumpIni = y; - jumpCounter = 0; + // Solo puede saltar si ademas de estar (state == s_standing) + // Esta sobre el suelo, rampa o suelo que se mueve + // Esto es para evitar el salto desde el vacio al cambiar de pantalla verticalmente + // Ya que se coloca el estado s_standing al cambiar de pantalla + + if (isOnFloor() || isOnAutoSurface()) + { + setState(s_jumping); + vy = -maxVY; + jumpIni = y; + jumpCounter = 0; + } } } @@ -265,10 +273,19 @@ void Player::checkState() vy = 0.0f; jumpCounter = 0; fallCounter = 0; + if (!isOnFloor() && !isOnAutoSurface()) + { + setState(s_falling); + vx = 0.0f; + vy = maxVY; + fallCounter++; + playFallSound(); + } } else if (state == s_jumping) { + fallCounter = 0; jumpCounter++; playJumpSound(); } @@ -281,7 +298,6 @@ void Player::switchBorders() { y = PLAY_AREA_BOTTOM - h - 0 - BLOCK; setState(s_standing); - // jumpIni += 128; } else if (border == BORDER_BOTTOM) { diff --git a/todo.txt b/todo.txt deleted file mode 100644 index 9684a56d..00000000 --- a/todo.txt +++ /dev/null @@ -1,91 +0,0 @@ -## TAREAS -x (A) Hacer que deje de poder moverse tras el salto al alcanzar la misma posicion en altura que tenia cuando saltó {cm:2022-08-29} -x (A) Arreglar que no atraviese tiles atravaseables al caer muy rapido {cm:2022-08-29} -x (A) Leer los mapas directamente del archivo tmx {cm:2022-08-29} -x (A) Crear la clase item {cm:2022-08-29} -x (A) Colisiones con los enemigos {cm:2022-08-29} -x (A) Decidir un diseño para qué sucede en caso de morir: Recordar el punto por donde se entró al mapa y la velocidad en el eje X/Y que llevaba el personaje, crear puntos de reaparicion en las habitaciones, etc {cm:2022-08-29} - x En el Jet Set Willy el juego recuerda la posicion y el momento. En las Tres Luces de Glaurung solo la posición. Se va a optar por seguir el diseño del Jet Set Willy {cm:2022-08-29} -x (A) Crear tiles que maten {cm:2022-08-29} -x (A) Modificar el salto para que coincida con el del JSW, no ha de colisionar lateralmente -x (A) Crear tiles que arrastren, tipo cinta transportadora -x (A) Tiles animados -x (A) Tile que maten (o enemigos?) -x (A) Cuando mueres, pantalla negra entre vida y vida -x (A) Morir al caer de alto -x (A) Crear ascensores (NO SE VA A HACER POR DISEÑO) -x (A) Crear rampas -x (A) Enemigos de diferente tamaño {cm:2022-08-30} -x (A) Color de los items al estilo jet set willy de amstrad, que brillan con dos colores -x (A) Temporizador de inicio de los items, para poder hacer que brillen a distinto ritmo. Esto es incompatible con lo anterior {cm:2022-08-30} -x (A) Crear efecto de fade estilo spectrum, cambiando el color de las cosas a rojo, morado, azul, negro -x (A) Hacer que los enemigos tengan flip -x (A) Cabiar los colores del texto del marcador segun la habitación -x (A) Poner la info de debug con la tipografia adecuada {cm:2022-08-30} -x (A) El modo debug debe pintar la rejilla {cm:2022-08-30} -x (A) Tecla F para pasar a pantalla completa {cm:2022-08-30} -x (A) Tecla + y - para cambiar tamaño de ventana. O control F1 a F4 {cm:2022-08-30} -x (A) Poner en el marcador el indicador de si esta sonando la música -x (A) Poner en el marcador el numero de habitaciones visitadas -x (A) Los textos del marcador de colores -x (A) Añadir a cada habitación el color del borde -x (A) Añadir a cada habitación el color del nombre de la habitación -x (A) Crear el logo al estilo del logo de ERBE o TOPO, con lineas que lo formen -x (A) El titulo del juego hacerlo parecido al del Jet Set Willy in Paris - x - Ha de generarse como las cargas de pantalla de spectrum - x - Luego se colorea - x - Finalmente, cada elemento cambia de color como si fueran luces de neon -x (A) En el titulo del juego, por la parte inferior ha de aparecer una marquesina con texto, al estilo demoscene -x (A) La pantalla de titulo no tiene menu, solo un PRESS ENTER TO PLAY -x (A) Añadir color y efectos a los creditos -x (A) Crear la tipografia de corazon -x (A) Los Creditos se han de ir escribiendo letra a letra -x (A) Arreglar la pantalla de carga para que cargue bit a bit -x (A) La musica del titulo ha de seguir sonando en los creditos y el ¿logo? -x (A) Ha de haber un modo demo en el que se muestran las habitaciones predefinidas -(A) Menu de pausa/salir -x (A) Poner el mapa/jugador en pausa -x (A) El color del borde se pierde al morir por la pantalla negra -x (B) El fichero ani ha de calcular cuantos frames hay a partir del tamaño y ver que no hay ningun indice incorrecto -x (B) Así como no necesitar lo de frames per row -(B) Le ha de pasar el w y h al sprite -(B) Lo enemigos han de coger el ancho y alto del fichero ani (y si no hay?) -(B) Si no se passa parametro, el fichero ani se deduce del png (y si no hay?) -x (C) Que no cree la ventana y luego añada el borde -x (A) Las vidas del marcador no estan animadas. No cambian de frame -(A) Mejorar las cintas. no permitir saltar hacia atras -x (A) Cambio de paleta en caliente -x (A) Precargar todos los recursos del juego -x (A) Deshabilitar el input hasta que se suelten todas las teclas - - -## TEMAS -x marounders -x paku simbel -x jail battle -arounders race -aee gba -x matatunos -x sigmasua -calculin doom -leaper reaper -x mini ascii -mappy -x paco -x chirping -x abad y batman -x jail -counter strike -starcraft -diablo -jailparty -maniac mansion -molotov -tutorials -gavina -puzzle restorer -x qvoid -brick roll -dante's fall -x repairing computers -va en moto a la feina, ploent \ No newline at end of file