20 Commits
v1.0 ... sdl3

Author SHA1 Message Date
7feabb30f7 - [FIX] Retocada paleta grayscale 2025-04-25 11:46:51 +02:00
ad4fa14ab1 - [NEW] Afegida paleta monocroma (no accesible encara) 2025-04-21 10:17:12 +02:00
53784e6fb0 Pas a SDL3 complet 2024-11-06 21:35:30 +01:00
22619cf207 Treballant en la conversió a SDL3 2024-11-06 13:49:44 +01:00
b31a578731 - [FIX] El missatge al pillar un skill era sempre el de les botes 2024-10-31 16:43:41 +01:00
6c30e6aeec - [NEW] Numero de versió en la pantalla inicial 2024-10-31 13:48:44 +01:00
dbac3eb3ee [FIX] [#7] Es pot botar damunt de les peces a arreplegar 2024-10-31 13:18:03 +01:00
3946ea749b - [FIX] [#6] En l'habitacio de baix la piscina, botant per damunt les bambolles es pot passar per damunt d'una porta
- [FIX] [#10] Avistat problema de enganzar-se en la porta YP de l'habitacio 58
2024-10-31 12:26:46 +01:00
0ab4ca06e3 - [FIX] [#2] Quan et donen una cat's life, ja no torna la música del joc
- [FIX] [#3] Quan entres a la habitació de la depuradora ...
- [FIX] [#4] ficar anbernics recopilades en el game over i altres pantalles de resum
- [FIX] [#5] que al acabar el joc la seuquencia acabe amb els stats, com el game over
2024-10-31 12:08:10 +01:00
a8892f4f8c - [FIX] Els enemics podien ser botats per damunt sense morir
- [FIX] Els precipicis podien ser evitats mantenint el bot pulsat.
2024-10-11 19:22:48 +02:00
4d1739d8e1 - [FIX] Quan te tocava una cat's life, petava el mame 2024-10-11 19:06:50 +02:00
59ec0542a1 - [NEW] Afegit icono al executable de Windows 2024-10-11 12:46:04 +02:00
2634cc1b2c - Neteja d'arxius inutils
- Afegits iconos
2024-10-11 12:23:08 +02:00
3132dc0157 - [CHG] Augmentada la duració del boost de invulnerabilitat
- [CHG] Afegits uns quants cafés estratègicament, i canviats alguns
2024-10-11 11:50:16 +02:00
9c10b6a372 Merge branch 'master' of https://gitea.sustancia.synology.me/JailDoctor/thepool 2024-10-11 09:20:28 +02:00
31f63516ca - [CHG] Ara en Linux la configuració se guarda en " ~/.config/thepool/config.txt"
- [FIX] Solventada explosió en pantalla de gameover per un dangling pointer. Aplicades medides similars en catslife i ingame.
2024-10-11 09:20:24 +02:00
b5f4425672 - [FIX] Ja no es mostra el cursor mai (excepte si estas editant) 2024-10-10 20:38:12 +02:00
51eb933383 - [FIX] Arreglats els errors de la paleta de fósforo
- [CHG] Augmentades les probabilitats de una Cat's Life
- [NEW] Informació dels renderers al arrancar
- [FIX] Quan apareix un dialeg ja no es queda el só de caminar sonant de fondo
- [NEW] Quan apareix un dialeg i sona una fanfarria, la música se pausa
2024-10-10 20:14:18 +02:00
3f127b5444 - [FIX] En pantalla completa se veïa el cursor, ara ja no 2024-10-10 17:28:46 +02:00
2055ac523d - [FIX] El mode a pantalla completa ja manté proporcions senceres, amb barres negres pels costat quan fa falta
- [NEW] Amb F4 se fa toggle entre mode NORMAL, SCANLINES, FOSFORO i SCANLINES+FOSFORO
2024-10-10 16:10:09 +02:00
63 changed files with 767 additions and 1435 deletions

View File

@@ -3,25 +3,25 @@ source = source/*.cpp
windows:
@echo off
g++ $(source) icon.res -lmingw32 -lSDL2main -lSDL2 -mwindows -o "$(executable).exe"
g++ $(source) bin/icon.res -lmingw32 -lSDL3 -mwindows -o "$(executable).exe"
strip -s -R .comment -R .gnu.version --strip-unneeded "$(executable).exe"
windows_debug:
@echo off
g++ $(source) -D DEBUG -g -Wall -fvar-tracking -lmingw32 -lSDL2main -lSDL2 -o "$(executable)_debug.exe"
g++ $(source) -D DEBUG -g -Wall -fvar-tracking -lmingw32 -lSDL3 -o "$(executable)_debug.exe"
macos:
clang++ $(source) -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL2 -o "$(executable)"
clang++ $(source) -Wall -Os -std=c++11 -ffunction-sections -fdata-sections -lSDL3 -o "$(executable)"
macos_debug:
clang++ $(source) -D DEBUG -g -Wall -std=c++11 -lSDL2 -o "$(executable)_debug"
clang++ $(source) -D DEBUG -g -Wall -std=c++11 -lSDL3 -o "$(executable)_debug"
macos_bundle:
clang++ $(source) -D MACOS_BUNDLE -Wall -Os -std=c++11 -framework SDL2 -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
clang++ $(source) -D MACOS_BUNDLE -Wall -Os -std=c++11 -framework SDL3 -F /Library/Frameworks -ffunction-sections -fdata-sections -o mini_bundle -rpath @executable_path/../Frameworks/ -target x86_64-apple-macos10.12
linux:
g++ $(source) -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL2 -o "$(executable)"
g++ $(source) -Wall -Os -ffunction-sections -fdata-sections -Wl,--gc-sections -lSDL3 -o "$(executable)"
strip -s -R .comment -R .gnu.version --strip-unneeded "$(executable)"
linux_debug:
g++ $(source) -D DEBUG -g -lSDL2 -o "$(executable)_debug"
g++ $(source) -D DEBUG -g -lSDL3 -o "$(executable)_debug"

BIN
bin/icon.icns Normal file

Binary file not shown.

BIN
bin/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
bin/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

1
bin/icon.rc Normal file
View File

@@ -0,0 +1 @@
id ICON "icon.ico"

BIN
bin/icon.res Normal file

Binary file not shown.

BIN
data/fosforo.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

View File

@@ -9,6 +9,7 @@ end2.gif
floor.gif
font.gif
font2.gif
fosforo.gif
gat.gif
gat2.gif
intro1.gif

BIN
data/grayscale.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

View File

@@ -1,57 +0,0 @@
width: 2
height: 1
door-height-xp: 1
door-height-xn: 1
color: CYAN
floor-texture: 0
wall-texture: 2
door-texture: 0
under-door-texture: 0
exit-xp: 5
exit-xn: 1
exit-zn: 2
actor{
name: PLATFORM02
bmp: test.gif
bmp-rect: 64 0 32 24
bmp-offset: 0 24
pos: 16 20 0
size: 8 8 4
}
actor{
name: PLATFORM00
bmp: test.gif
bmp-rect: 64 0 32 24
bmp-offset: 0 24
pos: 8 28 0
size: 8 8 4
}
actor{
name: PLATFORM01
bmp: test.gif
bmp-rect: 64 0 32 24
bmp-offset: 0 24
pos: 16 28 0
size: 8 8 4
}
actor{
name: PLATFORM04
bmp: test.gif
bmp-rect: 64 0 32 24
bmp-offset: 0 24
pos: 40 28 0
size: 8 8 4
}
actor{
name: PLATFORM03
bmp: test.gif
bmp-rect: 64 0 32 24
bmp-offset: 0 24
pos: 48 28 0
size: 8 8 4
}

View File

@@ -1,112 +0,0 @@
width: 2
height: 2
door-height-xp: 0
door-height-yp: 0
color: CYAN
floor-texture: 9
wall-texture: 3
door-texture: 1
under-door-texture: 0
exit-xp: 0
exit-yp: 3
actor{
name: ARMARI01
bmp: caixes.gif
bmp-rect: 64 32 24 32
bmp-offset: -8 36
pos: 8 8 0
size: 8 4 5
movement: CW
}
actor{
name: TAULETA
bmp: caixes.gif
bmp-rect: 0 64 32 32
bmp-offset: 0 32
pos: 24 8 0
size: 8 8 5
movement: CW
}
actor{
name: S-SHOES
bmp: objectes.gif
bmp-rect: 162 0 28 22
bmp-offset: -3 24
pos: 48 8 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: SPECIAL
movement: CW
}
actor{
name: TAULA01
bmp: caixes.gif
bmp-rect: 128 32 32 32
bmp-offset: 0 32
pos: 8 24 0
size: 8 8 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: TAULA02
bmp: caixes.gif
bmp-rect: 160 32 32 32
bmp-offset: 0 32
pos: 8 32 0
size: 8 8 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: ARMARI02
bmp: caixes.gif
bmp-rect: 96 32 24 32
bmp-offset: -8 36
pos: 8 8 8
size: 8 4 8
movement: CW
}
actor{
name: TV
bmp: caixes.gif
bmp-rect: 32 64 32 32
bmp-offset: 0 32
pos: 24 7 5
size: 8 5 8
orient: XP
movement: CW
}
actor{
name: NES
bmp: caixes.gif
bmp-rect: 96 0 32 32
bmp-offset: 0 32
pos: 24 16 0
size: 8 8 6
flags: PICKABLE PUSHABLE GRAVITY
movement: CW
}
actor{
name: ROOMBA
bmp: caixes.gif
bmp-rect: 160 0 32 32
bmp-offset: 0 34
pos: 40 32 0
size: 8 8 4
orient: YP
flags: MOVING DEADLY
movement: Y
}

View File

@@ -1,24 +0,0 @@
width: 2
height: 1
door-height-xn: 4
door-height-yp: 0
color: PURPLE
floor-texture: 1
wall-texture: 2
door-texture: 0
under-door-texture: 2
exit-xn: 3
exit-yp: 4
exit-zp: 0
actor{
name: G-FILTER
bmp: objectes.gif
bmp-rect: 0 0 24 32
bmp-offset: 0 32
pos: 8 16 0
size: 8 8 8
anim-wait: 4
flags: PUSHABLE ANIMATED GRAVITY SPECIAL
movement: CW
}

View File

@@ -1,67 +0,0 @@
width: 1
height: 2
door-height-xp: 0
door-height-yn: 4
color: PURPLE
floor-texture: 0
wall-texture: 0
door-texture: 0
under-door-texture: 0
exit-xp: 2
exit-yn: 1
actor{
name: CONVEYOR
bmp: caixes.gif
bmp-rect: 0 144 32 32
bmp-offset: 0 32
pos: 16 48 0
size: 8 8 4
anim-cycle: MIN
flags: REACTIVE ANIMATED
react-mask: ZN
react-push: XP
movement: CW
}
actor{
name: FINESTRA
bmp: altres.gif
bmp-rect: 0 75 20 33
bmp-offset: 0 39
pos: 15 23 4
size: 1 1 9
movement: CW
}
actor{
name: FINESTRA01
bmp: altres.gif
bmp-rect: 0 75 20 33
bmp-offset: 0 39
pos: 15 31 4
size: 1 1 9
movement: CW
}
actor{
name: BOX
bmp: test.gif
bmp-rect: 32 0 32 32
bmp-offset: 0 32
pos: 27 31 0
size: 8 8 8
flags: PUSHABLE GRAVITY
movement: CW
}
actor{
name: BOX01
bmp: test.gif
bmp-rect: 32 0 32 32
bmp-offset: 0 32
pos: 27 29 8
size: 8 8 8
flags: PICKABLE PUSHABLE GRAVITY
movement: CW
}

View File

@@ -1,250 +0,0 @@
width: 2
height: 3
door-height-yp: 2
door-height-yn: 2
color: GREEN
floor-texture: 1
wall-texture: 5
door-texture: 4
under-door-texture: 0
exit-yn: 2
actor{
name: BOX
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 0 0
size: 8 8 8
movement: CW
}
actor{
name: BOX02
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 16 0 0
size: 8 8 8
movement: CW
}
actor{
name: BOX03
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 24 0 0
size: 8 8 8
movement: CW
}
actor{
name: BOX20
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 8 0
size: 8 8 8
movement: CW
}
actor{
name: BOX01
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 16 0
size: 8 8 8
movement: CW
}
actor{
name: BOX11
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 24 0
size: 8 8 8
movement: CW
}
actor{
name: BOX12
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 32 0
size: 8 8 8
movement: CW
}
actor{
name: BOX13
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 40 0
size: 8 8 8
movement: CW
}
actor{
name: BOX14
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 48 0
size: 8 8 8
movement: CW
}
actor{
name: BOX21
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 8 56 0
size: 8 8 8
movement: CW
}
actor{
name: BOX15
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 16 56 0
size: 8 8 8
movement: CW
}
actor{
name: BOX16
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 24 56 0
size: 8 8 8
movement: CW
}
actor{
name: BOX04
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 32 0 0
size: 8 8 8
movement: CW
}
actor{
name: BOX17
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 32 56 0
size: 8 8 8
movement: CW
}
actor{
name: BOX05
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 40 0 0
size: 8 8 8
movement: CW
}
actor{
name: BOX22
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 0 0
size: 8 8 8
movement: CW
}
actor{
name: BOX06
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 8 0
size: 8 8 8
movement: CW
}
actor{
name: BOX07
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 16 0
size: 8 8 8
movement: CW
}
actor{
name: BOX08
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 24 0
size: 8 8 8
movement: CW
}
actor{
name: BOX09
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 32 0
size: 8 8 8
movement: CW
}
actor{
name: BOX10
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 40 0
size: 8 8 8
movement: CW
}
actor{
name: BOX19
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 48 0
size: 8 8 8
movement: CW
}
actor{
name: BOX18
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 40 56 0
size: 8 8 8
movement: CW
}
actor{
name: BOX23
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 48 56 0
size: 8 8 8
movement: CW
}

View File

@@ -1,11 +0,0 @@
width: 2
height: 2
door-height-xp: 0
door-height-xn: 0
color: YELLOW
floor-texture: 8
wall-texture: 8
door-texture: 5
under-door-texture: 0
exit-xp: 6
exit-xn: 0

View File

@@ -1,114 +0,0 @@
width: 3
height: 3
door-height-xn: 0
color: CYAN
floor-texture: 0
wall-texture: 0
door-texture: 0
under-door-texture: 0
exit-xn: 5
exit-zp: 7
actor{
name: SOFA
bmp: altres.gif
bmp-rect: 0 0 48 40
bmp-offset: 0 32
pos: 0 0 0
size: 16 8 6
movement: CW
}
actor{
name: LLIT
bmp: altres.gif
bmp-rect: 48 0 57 47
bmp-offset: 12 33
pos: 16 0 0
size: 16 16 6
movement: CW
}
actor{
name: LIFT
bmp: caixes.gif
bmp-rect: 32 32 32 24
bmp-offset: 0 24
pos: 56 0 0
size: 8 8 4
orient: ZP
flags: MOVING
movement: Z
}
actor{
name: B4-02
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 0 40 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: B8-00
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 0 48 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: YONKI
bmp: caixes.gif
bmp-rect: 168 64 19 32
bmp-offset: -7 37
pos: 18 56 0
size: 6 6 12
anim-cycle: SEQ
anim-wait: 1
flags: PUSHABLE GRAVITY
movement: CW
}
actor{
name: BARREL
bmp: caixes.gif
bmp-rect: 96 64 18 32
bmp-offset: -7 37
pos: 25 57 0
size: 6 6 12
anim-cycle: SEQ
anim-wait: 1
flags: PUSHABLE ANIMATED GRAVITY
movement: CW
}
actor{
name: NEVERA1
bmp: caixes.gif
bmp-rect: 0 96 32 32
bmp-offset: 0 32
pos: 32 32 0
size: 8 8 8
movement: CW
}
actor{
name: NEVERA2
bmp: caixes.gif
bmp-rect: 32 96 32 32
bmp-offset: 0 32
pos: 32 32 8
size: 8 8 8
movement: CW
}

View File

@@ -1,33 +0,0 @@
width: 3
height: 3
door-height-xp: 0
door-height-xn: 0
color: PURPLE
floor-texture: 0
wall-texture: 14
door-texture: 2
under-door-texture: 0
exit-xn: 8
exit-zn: 6
actor{
name: LIFT
bmp: caixes.gif
bmp-rect: 32 32 32 24
bmp-offset: 0 24
pos: 56 0 0
size: 8 8 4
orient: ZP
flags: MOVING
movement: Z
}
actor{
name: FINESTRA
bmp: altres.gif
bmp-rect: 48 76 18 32
bmp-offset: 0 39
pos: 0 9 6
size: 1 1 9
movement: CW
}

View File

@@ -1,105 +0,0 @@
width: 2
height: 2
door-height-xp: 0
color: CYAN
floor-texture: 0
wall-texture: 11
door-texture: 0
under-door-texture: 0
exit-xp: 7
actor{
name: P-ELBOW
bmp: objectes.gif
bmp-rect: 0 32 22 32
bmp-offset: -2 35
pos: 8 16 0
size: 4 4 4
anim-wait: 6
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: P-PIPE
bmp: objectes.gif
bmp-rect: 0 64 16 32
bmp-offset: -8 36
pos: 8 24 0
size: 4 4 4
anim-wait: 6
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: P-SALT
bmp: objectes.gif
bmp-rect: 66 32 20 32
bmp-offset: -7 35
pos: 8 32 0
size: 4 4 4
anim-wait: 6
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: EXPLOSION
bmp: caixes.gif
bmp-rect: 0 160 18 22
bmp-offset: -7 38
pos: 32 32 0
size: 8 8 4
anim-cycle: SEQ
flags: ANIMATED
movement: CW
}
actor{
name: P-FILTER
bmp: objectes.gif
bmp-rect: 0 0 24 32
bmp-offset: -4 34
pos: 8 24 8
size: 4 4 4
anim-wait: 6
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: P-PUMP
bmp: objectes.gif
bmp-rect: 48 64 22 32
bmp-offset: -5 35
pos: 8 32 11
size: 4 4 4
anim-wait: 6
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: BOX01
bmp: caixes.gif
bmp-rect: 0 160 18 22
bmp-offset: -7 38
pos: 32 32 5
size: 8 8 4
anim-cycle: SEQ
flags: ANIMATED
movement: CW
}
actor{
name: P-TIMER
bmp: objectes.gif
bmp-rect: 72 0 24 32
bmp-offset: -4 34
pos: 8 40 8
size: 4 4 4
anim-wait: 6
flags: ANIMATED SPECIAL
movement: CW
}

View File

@@ -1,210 +0,0 @@
width: 3
height: 3
door-height-yp: 0
color: CYAN
floor-texture: 0
wall-texture: 0
door-texture: 0
under-door-texture: 0
exit-yp: 10
actor{
name: KALLAX-A03
bmp: altres.gif
bmp-rect: 72 48 24 27
bmp-offset: 0 31
pos: 0 16 0
size: 4 8 8
movement: CW
}
actor{
name: KALLAX-A
bmp: altres.gif
bmp-rect: 0 48 24 27
bmp-offset: 0 31
pos: 0 32 0
size: 4 8 8
movement: CW
}
actor{
name: KALLAX-A02
bmp: altres.gif
bmp-rect: 48 48 24 27
bmp-offset: 0 31
pos: 0 16 8
size: 4 8 8
movement: CW
}
actor{
name: KALLAX-A01
bmp: altres.gif
bmp-rect: 24 48 24 27
bmp-offset: 0 31
pos: 0 32 8
size: 4 8 8
movement: CW
}
actor{
name: KALLAX-A04
bmp: altres.gif
bmp-rect: 72 48 24 27
bmp-offset: -8 31
pos: 8 0 0
size: 8 4 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: KALLAX-A05
bmp: altres.gif
bmp-rect: 96 48 24 27
bmp-offset: -8 31
pos: 8 0 8
size: 8 4 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: ARCADE
bmp: altres.gif
bmp-rect: 160 0 30 48
bmp-offset: 0 48
pos: 16 0 0
size: 8 8 16
movement: CW
}
actor{
name: KALLAX-A07
bmp: altres.gif
bmp-rect: 96 48 24 27
bmp-offset: -8 31
pos: 24 0 0
size: 8 4 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: KALLAX-A08
bmp: altres.gif
bmp-rect: 24 48 24 27
bmp-offset: -8 31
pos: 32 0 0
size: 8 4 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: KALLAX-A06
bmp: altres.gif
bmp-rect: 72 48 24 27
bmp-offset: -8 31
pos: 24 0 8
size: 8 4 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: KALLAX-A09
bmp: altres.gif
bmp-rect: 0 48 24 27
bmp-offset: -8 31
pos: 32 0 8
size: 8 4 8
orient: YP
flags: ORIENTABLE
movement: CW
}
actor{
name: TAULETA
bmp: caixes.gif
bmp-rect: 0 64 32 32
bmp-offset: 0 32
pos: 40 0 0
size: 8 8 4
movement: CW
}
actor{
name: BOX05
bmp: altres.gif
bmp-rect: 128 0 20 42
bmp-offset: -5 46
pos: 40 0 4
size: 8 8 8
movement: CW
}
actor{
name: BOX01
bmp: caixes.gif
bmp-rect: 128 32 32 32
bmp-offset: 0 32
pos: 16 24 0
size: 8 8 8
movement: CW
}
actor{
name: BOX02
bmp: caixes.gif
bmp-rect: 160 32 32 32
bmp-offset: 0 32
pos: 24 24 0
size: 8 8 8
react-push: XP
movement: CW
}
actor{
name: GAT
bmp: gat2.gif
bmp-rect: 0 0 24 28
bmp-offset: -5 30
pos: 40 32 0
size: 8 8 8
orient: XP
anim-wait: 1
flags: PUSHABLE MOVING ANIMATED ORIENTABLE INERTIA
movement: X
}
actor{
name: BOX03
bmp: caixes.gif
bmp-rect: 128 0 32 32
bmp-offset: 0 32
pos: 16 24 8
size: 8 8 2
flags: PUSHABLE
react-push: XP
movement: CW
}
actor{
name: BOX04
bmp: caixes.gif
bmp-rect: 32 64 32 32
bmp-offset: 0 32
pos: 24 24 8
size: 8 8 8
orient: YP
flags: ORIENTABLE
react-push: XP
movement: CW
}

View File

@@ -1,110 +0,0 @@
width: 0
height: 3
door-height-yp: 0
door-height-yn: 5
color: WHITE
floor-texture: 6
wall-texture: 0
door-texture: 0
under-door-texture: 0
exit-yn: 9
actor{
name: BOX01
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 24 0 12
size: 8 8 8
movement: CW
}
actor{
name: BOX
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 32 0 12
size: 8 8 8
movement: CW
}
actor{
name: BOX08
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 24 8 8
size: 8 8 8
movement: CW
}
actor{
name: BOX01
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 32 8 8
size: 8 8 8
movement: CW
}
actor{
name: BOX07
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 24 16 4
size: 8 8 8
movement: CW
}
actor{
name: BOX02
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 32 16 4
size: 8 8 8
movement: CW
}
actor{
name: BOX06
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 24 24 0
size: 8 8 8
movement: CW
}
actor{
name: BOX03
bmp: caixes.gif
bmp-rect: 64 64 32 32
bmp-offset: 0 32
pos: 32 24 0
size: 8 8 8
movement: CW
}
actor{
name: BOX05
bmp: caixes.gif
bmp-rect: 32 32 32 24
bmp-offset: 0 24
pos: 24 32 0
size: 8 10 4
movement: CW
}
actor{
name: BOX04
bmp: caixes.gif
bmp-rect: 32 32 32 24
bmp-offset: 0 24
pos: 32 32 0
size: 8 10 4
movement: CW
}

View File

@@ -52,7 +52,7 @@ actor{
}
actor{
name: B-00-LIVE
name: B-00-JUMP
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22

View File

@@ -9,6 +9,19 @@ under-door-texture: 0
exit-yp: 15
editor-done: 1
actor{
name: B-05-GOD
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 40 40 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: BOX-A-01
bmp: caixes.gif

View File

@@ -24,7 +24,7 @@ actor{
}
actor{
name: B-01-JUMP
name: B-01-RUN
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22

View File

@@ -12,11 +12,11 @@ exit-xn: 28
editor-done: 1
actor{
name: B-03-GOD
name: B-03-LIVE
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 48 -3 16
bmp-offset: -8 24
pos: 48 56 16
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
@@ -25,18 +25,7 @@ actor{
}
actor{
name: BOX-B
bmp: caixes.gif
bmp-rect: 32 0 32 32
bmp-offset: 0 32
pos: 48 8 0
size: 8 8 8
flags: PUSHABLE
movement: CW
}
actor{
name: CADIRA
name: CADIRA-00
bmp: caixes.gif
bmp-rect: 64 96 20 32
bmp-offset: -7 38
@@ -47,12 +36,24 @@ actor{
movement: CW
}
actor{
name: CADIRA-01
bmp: caixes.gif
bmp-rect: 64 96 20 32
bmp-offset: -7 38
pos: 8 7 0
size: 6 5 8
orient: YP
flags: PUSHABLE
movement: CW
}
actor{
name: CUADRO-00
bmp: altres.gif
bmp-rect: 66 75 18 32
bmp-offset: 0 39
pos: 7 8 6
pos: 7 13 6
size: 1 1 9
orient: YP
movement: CW
@@ -63,7 +64,7 @@ actor{
bmp: altres.gif
bmp-rect: 102 75 18 32
bmp-offset: 0 39
pos: 7 48 6
pos: 7 43 6
size: 1 1 9
orient: YP
movement: CW
@@ -165,6 +166,26 @@ actor{
movement: CW
}
actor{
name: LAMPARA-00
bmp: altres.gif
bmp-rect: 128 0 20 41
bmp-offset: -6 45
pos: 48 56 0
size: 6 6 16
movement: CW
}
actor{
name: LAMPARA-01
bmp: altres.gif
bmp-rect: 128 0 20 41
bmp-offset: -6 45
pos: 8 56 0
size: 6 6 16
movement: CW
}
actor{
name: MESITA
bmp: caixes.gif
@@ -182,7 +203,7 @@ actor{
bmp-offset: -2 33
pos: 32 0 0
size: 8 7 6
flags: PUSHABLE
flags: PICKABLE PUSHABLE GRAVITY
movement: CW
}
@@ -191,7 +212,7 @@ actor{
bmp: caixes.gif
bmp-rect: 160 0 32 32
bmp-offset: 0 34
pos: 8 56 0
pos: 16 56 0
size: 8 8 2
orient: XN
flags: REACTIVE MOVING DEADLY
@@ -230,6 +251,6 @@ actor{
bmp-offset: -4 34
pos: 24 0 4
size: 8 6 8
flags: PUSHABLE
flags: PUSHABLE GRAVITY
movement: CW
}

View File

@@ -11,6 +11,19 @@ exit-xn: 33
exit-yn: 28
editor-done: 1
actor{
name: B-06-LIVE
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 24 32 12
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: PLATH-00
bmp: caixes.gif
@@ -227,3 +240,15 @@ actor{
orient: ZP
movement: Z
}
actor{
name: PLATH-18
bmp: caixes.gif
bmp-rect: 160 128 32 32
bmp-offset: 0 32
pos: 24 32 8
size: 8 8 4
orient: ZP
flags: DISAPPEAR
movement: Z
}

View File

@@ -27,19 +27,6 @@ actor{
movement: CW
}
actor{
name: B-02-RUN
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 8 8 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: BATMAN
bmp: batman.gif

View File

@@ -256,9 +256,9 @@ actor{
bmp: gat.gif
bmp-rect: 0 0 24 28
bmp-offset: -4 32
pos: 16 16 0
pos: 16 24 0
size: 8 8 8
orient: XP
orient: YN
anim-wait: 1
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
react-mask: XP XN YP YN ZP ZN
@@ -270,9 +270,9 @@ actor{
bmp: gat2.gif
bmp-rect: 0 0 24 28
bmp-offset: -4 32
pos: 40 40 0
pos: 40 32 0
size: 8 8 8
orient: XN
orient: YP
anim-wait: 1
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
react-mask: XP XN YP YN ZP ZN

View File

@@ -183,9 +183,9 @@ actor{
bmp: obrer.gif
bmp-rect: 0 0 24 32
bmp-offset: -4 37
pos: 8 24 0
pos: 24 24 0
size: 8 8 8
orient: XN
orient: XP
anim-wait: 1
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
react-mask: XP XN YP YN ZP ZN
@@ -197,9 +197,9 @@ actor{
bmp: obrer.gif
bmp-rect: 0 0 24 32
bmp-offset: -4 37
pos: 48 48 0
pos: 40 48 0
size: 8 8 8
orient: XN
orient: XP
anim-wait: 1
flags: REACTIVE MOVING ANIMATED ORIENTABLE DEADLY
react-mask: XP XN YP YN ZP ZN

View File

@@ -20,6 +20,19 @@ actor{
movement: CW
}
actor{
name: B-04-LIVE
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 48 0 0
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: BLOCMATA-00
bmp: altres.gif
@@ -61,6 +74,7 @@ actor{
bmp-offset: 0 32
pos: 0 49 6
size: 8 8 8
flags: PUSHABLE GRAVITY
movement: CW
}
@@ -72,7 +86,7 @@ actor{
pos: 8 40 0
size: 8 8 8
orient: YP
flags: ORIENTABLE
flags: PUSHABLE ORIENTABLE GRAVITY
movement: CW
}
@@ -83,6 +97,7 @@ actor{
bmp-offset: 0 32
pos: 8 32 8
size: 8 8 8
flags: PUSHABLE GRAVITY
movement: CW
}
@@ -117,6 +132,7 @@ actor{
bmp-offset: 0 32
pos: 31 2 0
size: 8 8 8
flags: PUSHABLE GRAVITY
movement: CW
}
@@ -128,7 +144,7 @@ actor{
pos: 54 0 8
size: 8 8 8
orient: YP
flags: ORIENTABLE
flags: PUSHABLE ORIENTABLE GRAVITY
movement: CW
}
@@ -149,6 +165,7 @@ actor{
bmp-offset: 0 32
pos: 10 32 0
size: 8 8 8
flags: PUSHABLE GRAVITY
movement: CW
}
@@ -167,8 +184,9 @@ actor{
bmp: caixes.gif
bmp-rect: 32 0 32 32
bmp-offset: 0 32
pos: 40 0 0
pos: 40 1 0
size: 8 8 8
flags: PUSHABLE GRAVITY
movement: CW
}
@@ -180,7 +198,7 @@ actor{
pos: 46 3 10
size: 8 8 8
orient: YP
flags: ORIENTABLE
flags: PUSHABLE ORIENTABLE GRAVITY
movement: CW
}
@@ -256,3 +274,42 @@ actor{
flags: MOVING ANIMATED
movement: RANDV
}
actor{
name: EXPLOSION-03
bmp: caixes.gif
bmp-rect: 0 160 18 22
bmp-offset: -7 24
pos: 48 48 0
size: 8 8 4
orient: YN
anim-cycle: SEQ
flags: MOVING ANIMATED
movement: RANDV
}
actor{
name: EXPLOSION-04
bmp: caixes.gif
bmp-rect: 0 160 18 22
bmp-offset: -7 24
pos: 0 0 0
size: 8 8 4
orient: XP
anim-cycle: SEQ
flags: MOVING ANIMATED
movement: RANDV
}
actor{
name: EXPLOSION-05
bmp: caixes.gif
bmp-rect: 0 160 18 22
bmp-offset: -7 24
pos: 16 24 0
size: 8 8 4
orient: XN
anim-cycle: SEQ
flags: MOVING ANIMATED
movement: RANDV
}

View File

@@ -9,6 +9,19 @@ under-door-texture: 2
exit-xp: 62
editor-done: 1
actor{
name: B-02-GOD
bmp: objectes.gif
bmp-rect: 114 78 15 18
bmp-offset: -8 22
pos: 56 16 20
size: 4 4 4
anim-cycle: SEQ
anim-wait: 2
flags: ANIMATED SPECIAL
movement: CW
}
actor{
name: P-ELBOW
bmp: objectes.gif
@@ -45,6 +58,29 @@ actor{
movement: Y
}
actor{
name: PLATH-02
bmp: caixes.gif
bmp-rect: 160 128 32 32
bmp-offset: 0 32
pos: 56 16 16
size: 8 8 4
orient: ZP
movement: Z
}
actor{
name: PLATH-04
bmp: altres.gif
bmp-rect: 160 48 32 32
bmp-offset: 0 32
pos: 32 8 16
size: 8 8 4
orient: XN
flags: MOVING
movement: X
}
actor{
name: TRANSPA-00
bmp: altres.gif

View File

@@ -643,34 +643,7 @@ namespace actor
}
}
uint8_t push(actor_t *source, actor_t *act, uint8_t push)
{
uint8_t result = 0;
if ((act->flags & FLAG_PUSHABLE) && (!(source->flags & FLAG_HERO) || (hero::getSkills() & SKILL_GLOVES) || (push == PUSH_ZN)))
act->push |= push;
if ((act->flags & FLAG_REACTIVE) && (act->react_mask & push))
{
if (act->flags & FLAG_DEADLY)
source->push |= PUSH_KILL;
else
result = act->react_push;
}
if ((source->flags & FLAG_HERO) && (act->flags & FLAG_DISAPPEAR))
{
audio::playSound("snd_disappear.wav", SOUND_BASIC);
act = actor::replaceWithTemplate(act, "EXPLOSION");
act->name[0] = '_';
return PUSH_NONE;
}
if (source->flags & FLAG_DEADLY)
{
act->push |= PUSH_KILL;
}
if (source->flags & FLAG_HERO)
{
if (act->flags & FLAG_SPECIAL)
uint8_t PickSpecial(actor_t *act, uint8_t result = 0)
{
if (act->name[0] == 'B')
{ // Es un booster
@@ -739,6 +712,38 @@ namespace actor
room::cycleColor(1);
return PUSH_NONE;
}
uint8_t push(actor_t *source, actor_t *act, uint8_t push)
{
uint8_t result = 0;
if ((act->flags & FLAG_PUSHABLE) && (!(source->flags & FLAG_HERO) || (hero::getSkills() & SKILL_GLOVES) || (push == PUSH_ZN)))
act->push |= push;
if ((act->flags & FLAG_REACTIVE) && (act->react_mask & push))
{
if (act->flags & FLAG_DEADLY)
source->push |= PUSH_KILL;
else
result = act->react_push;
}
if ((source->flags & FLAG_HERO) && (act->flags & FLAG_DISAPPEAR))
{
audio::playSound("snd_disappear.wav", SOUND_BASIC);
act = actor::replaceWithTemplate(act, "EXPLOSION");
act->name[0] = '_';
return PUSH_NONE;
}
if (source->flags & FLAG_DEADLY)
{
act->push |= PUSH_KILL;
}
if (source->flags & FLAG_HERO)
{
if (act->flags & FLAG_SPECIAL)
{
return PickSpecial(act, result);
}
}
return result;
}
@@ -780,7 +785,11 @@ namespace actor
{
hero::useBoostRun();
act->orient = PUSH_XP;
if (((act->pos.x + act->size.x) < max.x && act->pos.y >= min.y && (act->pos.y + act->size.y) <= max.y) || ((room::getDoors() & DOOR_XP) && (act->pos.y >= 24) && (act->pos.y <= 32)))
if (
( ((act->pos.x + act->size.x) < max.x) && (act->pos.y >= min.y) && ((act->pos.y + act->size.y) <= max.y) )
||
( (room::getDoors() & DOOR_XP) && (act->pos.y >= 24) && (act->pos.y <= 32) )
)
{
moving = true;
// Si està en les vores d'una porta, espenta cap a centrar-lo
@@ -911,10 +920,23 @@ namespace actor
actor::actor_t *future_below = any_below_me(act);
// if ((input::keyDown(SDL_SCANCODE_SPACE) || input::keyDown(config::getKey(KEY_JUMP))) &&
if ((controller::down(KEY_JUMP)) && ((hero::getSkills() & SKILL_SHOES) || actor::hero::isPrologo())
&& (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y && (act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x && act->react_mask == 0 && ((act->pos.z == 0 && room::getFloor() != 11) || (act->below || future_below)))
&& (act->pos.y + act->size.y) <= max.y && act->pos.y >= min.y &&
(act->pos.x + act->size.x) <= max.x && act->pos.x >= min.x &&
act->react_mask == 0 &&
( (act->pos.z == 0 && room::getFloor() != 11 && room::getExit(ZN)==-1) || (act->below || future_below) )
)
{
audio::pauseChannel(walk_channel);
audio::playSound("snd_jump.wav", SOUND_BASIC);
// [RZC 31/10/2024] Hack per a que al aterrar sobre els especials els pille
if (!act->below && future_below && future_below->flags & FLAG_SPECIAL)
{
act->push |= PickSpecial(future_below);
}
// [RZC 11/10/2024] Hack per a que al aterrar sobre els que maten, te maten
if (!act->below && future_below && future_below->flags & FLAG_DEADLY)
act->push |= PUSH_KILL;
// [RZC 01/10/2024] Hack per a que al aterrar sobre els que desapareixen puga botar sobre ells, i a més ells desapareguen
if (!act->below && future_below && future_below->flags & FLAG_DISAPPEAR)
actor::push(act, future_below, PUSH_ZN);
@@ -1261,7 +1283,7 @@ namespace actor
{
act->pos.x += vel;
actor::actor_t *other = actor::get_collision(act);
if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || !(act->flags & FLAG_HERO))))
if (other || ((act->pos.x + act->size.x) > max.x && (!(room::getDoors() & DOOR_XP) || (act->pos.y != 28) || (act->pos.z != room::getDoor(XP) * 4) || !(act->flags & FLAG_HERO))))
{
if (other) {
uint8_t push_value = push(act, other, PUSH_XP);
@@ -1342,7 +1364,7 @@ namespace actor
{
act->pos.y += vel;
actor::actor_t *other = actor::get_collision(act);
if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || !(act->flags & FLAG_HERO))))
if (other || ((act->pos.y + act->size.y) > max.y && (!(room::getDoors() & DOOR_YP) || (act->pos.x != 28) || (act->pos.z != room::getDoor(YP) * 4) || !(act->flags & FLAG_HERO))))
{
if (other) {
uint8_t push_value = push(act, other, PUSH_YP);
@@ -2077,6 +2099,7 @@ namespace actor
brilli = draw::getSurface("objectes.gif");
if ((config::getSoundMode() == SOUND_ALL))
{
if (walk_channel != -1) audio::stopChannel(walk_channel);
walk_channel = audio::playSound("snd_walk.wav", SOUND_ALL, -1);
audio::pauseChannel(walk_channel);
}
@@ -2164,7 +2187,7 @@ namespace actor
switch (getBoosterFromString(booster))
{
case BOOST_GOD:
boost_god = 99 * 2;
boost_god = 99 * 4;
break;
case BOOST_RUN:
boost_steps = 99 * 2;
@@ -2222,6 +2245,8 @@ namespace actor
const int getSkillFromString(char *skill)
{
if ( (strcmp(skill, "ALL")==0) || (strcmp(skill, "SKILLS")==0) ) return SKILL_SHOES | SKILL_GLOVES | SKILL_PANTS | SKILL_BAG;
static const char *skillset_name[4] = {"SHOES", "GLOVES", "PANTS", "BAG"};
for (int i = 0; i < 4; ++i)
{
@@ -2259,10 +2284,10 @@ namespace actor
bool giveSkill(char *skill)
{
const int skill_number = getSkillFromString(skill);
if (skill_number==SKILL_SHOES) modules::game::setMissatge(" JA TENS LES SABATES!- ARA JA POTS BOTAR!");
else if (skill_number==SKILL_GLOVES) modules::game::setMissatge(" JA TENS ELS GUANTS!- ARA JA POTS ESPENTAR!");
else if (skill_number==SKILL_PANTS) modules::game::setMissatge(" JA TENS ELS PANTALONS!- JA POTS AGAFAR COSES!");
else if (skill_number==SKILL_BAG) modules::game::setMissatge(" JA TENS LA MOTXILLA!- A ARREPLEGAR PECES!");
if (skill_number & SKILL_SHOES) modules::game::setMissatge(" JA TENS LES SABATES!- ARA JA POTS BOTAR!");
else if (skill_number & SKILL_GLOVES) modules::game::setMissatge(" JA TENS ELS GUANTS!- ARA JA POTS ESPENTAR!");
else if (skill_number & SKILL_PANTS) modules::game::setMissatge(" JA TENS ELS PANTALONS!- JA POTS AGAFAR COSES!");
else if (skill_number & SKILL_BAG) modules::game::setMissatge(" JA TENS LA MOTXILLA!- A ARREPLEGAR PECES!");
return giveSkill(skill_number);
}
@@ -2289,6 +2314,8 @@ namespace actor
const int getPartFromString(char *part)
{
if ( (strcmp(part, "ALL")==0) || (strcmp(part, "PARTS")==0) ) return 0x3f;
static const char *partset_name[6] = {"FILTER", "PUMP", "TIMER", "SALT", "PIPE", "ELBOW"};
for (int i = 0; i < 6; ++i)
{
@@ -2435,13 +2462,13 @@ namespace actor
int partsCollected = 0;
bool roomVisited[MAX_ROOMS];
int livesLost = 0;
int catsLifeOdds = 5;
int catsLifeOdds = 2;
uint32_t start_time = 0;
void reset()
{
partsCollected = livesLost = 0;
catsLifeOdds = 5;
catsLifeOdds = 2;
for (int i = 0; i < MAX_ROOMS; ++i)
roomVisited[i] = false;
start_time = SDL_GetTicks();

View File

@@ -1,5 +1,5 @@
#pragma once
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "misc.h"
#include "jdraw.h"
#include <vector>

View File

@@ -1,13 +1,13 @@
#include "config.h"
#include "jfile.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace config
{
bool musicEnabled = true;
int soundMode = SOUND_ALL;
uint8_t keys[7] = {SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, SDL_SCANCODE_RIGHT, SDL_SCANCODE_SPACE, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE};
int8_t pad_btns[7] = {SDL_CONTROLLER_BUTTON_DPAD_UP, SDL_CONTROLLER_BUTTON_DPAD_DOWN, SDL_CONTROLLER_BUTTON_DPAD_LEFT, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_B, SDL_CONTROLLER_BUTTON_START};
int8_t pad_btns[7] = {SDL_GAMEPAD_BUTTON_DPAD_UP, SDL_GAMEPAD_BUTTON_DPAD_DOWN, SDL_GAMEPAD_BUTTON_DPAD_LEFT, SDL_GAMEPAD_BUTTON_DPAD_RIGHT, SDL_GAMEPAD_BUTTON_SOUTH, SDL_GAMEPAD_BUTTON_EAST, SDL_GAMEPAD_BUTTON_START};
bool prologo_desbloquejat = false;
void setMusic(const bool value)

View File

@@ -1,5 +1,5 @@
#include "console.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "jdraw.h"
#include "jinput.h"
#include "room.h"

View File

@@ -1,43 +1,51 @@
#ifndef JA_USESDLMIXER
#include "jail_audio.h"
#include "stb_vorbis.c"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include <stdio.h>
#define JA_MAX_SIMULTANEOUS_CHANNELS 5
struct JA_Sound_t {
struct JA_Sound_t
{
SDL_AudioSpec spec { SDL_AUDIO_S16, 2, 48000 };
Uint32 length { 0 };
Uint8 *buffer { NULL };
};
struct JA_Channel_t {
JA_Sound_t *sound;
struct JA_Channel_t
{
JA_Sound_t *sound { nullptr };
int pos { 0 };
int times { 0 };
SDL_AudioStream *stream { nullptr };
JA_Channel_state state { JA_CHANNEL_FREE };
};
struct JA_Music_t {
int samples {0};
struct JA_Music_t
{
SDL_AudioSpec spec { SDL_AUDIO_S16, 2, 48000 };
Uint32 length { 0 };
Uint8 *buffer { nullptr };
int pos { 0 };
int times { 0 };
short* output {NULL};
SDL_AudioStream *stream { nullptr };
JA_Music_state state { JA_MUSIC_INVALID };
};
JA_Music_t *current_music{NULL};
JA_Music_t *current_music { nullptr };
JA_Channel_t channels[JA_MAX_SIMULTANEOUS_CHANNELS];
int JA_freq {48000};
SDL_AudioFormat JA_format {AUDIO_S16};
Uint8 JA_channels {2};
int JA_musicVolume = 128;
int JA_soundVolume = 64;
bool JA_musicEnabled = true;
bool JA_soundEnabled = true;
SDL_AudioDeviceID sdlAudioDevice = 0;
SDL_AudioSpec JA_audioSpec { SDL_AUDIO_S16, 2, 48000 };
float JA_musicVolume { 1.0f };
float JA_soundVolume { 0.5f };
bool JA_musicEnabled { true };
bool JA_soundEnabled { true };
SDL_AudioDeviceID sdlAudioDevice { 0 };
SDL_TimerID JA_timerID { 0 };
/*
void audioCallback(void * userdata, uint8_t * stream, int len) {
SDL_memset(stream, 0, len);
if (current_music != NULL && current_music->state == JA_MUSIC_PLAYING) {
@@ -73,42 +81,77 @@ void audioCallback(void * userdata, uint8_t * stream, int len) {
}
}
}
*/
void JA_Init(const int freq, const SDL_AudioFormat format, const int channels) {
JA_freq = freq;
JA_format = format;
JA_channels = channels;
SDL_AudioSpec audioSpec{JA_freq, JA_format, JA_channels, 0, 1024, 0, 0, audioCallback, NULL};
if (sdlAudioDevice != 0) SDL_CloseAudioDevice(sdlAudioDevice);
sdlAudioDevice = SDL_OpenAudioDevice(NULL, 0, &audioSpec, NULL, 0);
SDL_PauseAudioDevice(sdlAudioDevice, 0);
Uint32 JA_UpdateCallback(void *userdata, SDL_TimerID timerID, Uint32 interval)
{
if (JA_musicEnabled && current_music && current_music->state == JA_MUSIC_PLAYING)
{
if (current_music->times != 0)
{
if (SDL_GetAudioStreamAvailable(current_music->stream) < (current_music->length/2))
SDL_PutAudioStreamData(current_music->stream, current_music->buffer, current_music->length);
if (current_music->times>0) current_music->times--;
}
else
{
if (SDL_GetAudioStreamAvailable(current_music->stream) == 0) JA_StopMusic();
}
}
void JA_Quit() {
SDL_PauseAudioDevice(sdlAudioDevice, 1);
if (sdlAudioDevice != 0) SDL_CloseAudioDevice(sdlAudioDevice);
if (JA_soundEnabled)
{
for (int i=0; i < JA_MAX_SIMULTANEOUS_CHANNELS; ++i)
if (channels[i].state == JA_CHANNEL_PLAYING)
{
if (channels[i].times != 0)
{
if (SDL_GetAudioStreamAvailable(channels[i].stream) < (channels[i].sound->length/2))
SDL_PutAudioStreamData(channels[i].stream, channels[i].sound->buffer, channels[i].sound->length);
if (channels[i].times>0) channels[i].times--;
}
}
else
{
if (SDL_GetAudioStreamAvailable(channels[i].stream) == 0) JA_StopChannel(i);
}
}
return 30;
}
void JA_Init(const int freq, const SDL_AudioFormat format, const int channels)
{
JA_audioSpec = {format, channels, freq };
if (!sdlAudioDevice) SDL_CloseAudioDevice(sdlAudioDevice);
sdlAudioDevice = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &JA_audioSpec);
SDL_PauseAudioDevice(sdlAudioDevice);
JA_timerID = SDL_AddTimer(30, JA_UpdateCallback, nullptr);
}
void JA_Quit()
{
if (JA_timerID) SDL_RemoveTimer(JA_timerID);
if (!sdlAudioDevice) SDL_CloseAudioDevice(sdlAudioDevice);
sdlAudioDevice = 0;
}
JA_Music_t *JA_LoadMusic(Uint8* buffer, Uint32 length)
{
int chan, samplerate;
JA_Music_t *music = new JA_Music_t();
music->samples = stb_vorbis_decode_memory(buffer, length, &chan, &samplerate, &music->output);
// [RZC 28/08/22] Abans el descomprimiem mentre el teniem obert
// music->samples = stb_vorbis_decode_filename(filename, &chan, &samplerate, &music->output);
int chan, samplerate;
short *output;
music->length = stb_vorbis_decode_memory(buffer, length, &chan, &samplerate, &output) * chan * 2;
SDL_AudioCVT cvt;
SDL_BuildAudioCVT(&cvt, AUDIO_S16, chan, samplerate, JA_format, JA_channels, JA_freq);
if (cvt.needed) {
cvt.len = music->samples * chan * 2;
cvt.buf = (Uint8 *) SDL_malloc(cvt.len * cvt.len_mult);
SDL_memcpy(cvt.buf, music->output, cvt.len);
SDL_ConvertAudio(&cvt);
free(music->output);
music->output = (short*)cvt.buf;
}
music->spec.channels = chan;
music->spec.freq = samplerate;
music->spec.format = SDL_AUDIO_S16;
music->buffer = (Uint8*)SDL_malloc(music->length);
SDL_memcpy(music->buffer, output, music->length);
SDL_free(output);
music->pos = 0;
music->state = JA_MUSIC_STOPPED;
@@ -145,55 +188,69 @@ void JA_PlayMusic(JA_Music_t *music, const int loop)
current_music->pos = 0;
current_music->state = JA_MUSIC_PLAYING;
current_music->times = loop;
current_music->stream = SDL_CreateAudioStream(&current_music->spec, &JA_audioSpec);
if (!SDL_PutAudioStreamData(current_music->stream, current_music->buffer, current_music->length)) printf("[ERROR] SDL_PutAudioStreamData failed!\n");
SDL_SetAudioStreamGain(current_music->stream, JA_musicVolume);
if (!SDL_BindAudioStream(sdlAudioDevice, current_music->stream)) printf("[ERROR] SDL_BindAudioStream failed!\n");
}
void JA_PauseMusic()
{
if (!JA_musicEnabled) return;
if (!current_music || current_music->state == JA_MUSIC_INVALID) return;
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
current_music->state = JA_MUSIC_PAUSED;
SDL_PauseAudioStreamDevice(current_music->stream);
}
void JA_ResumeMusic()
{
if (!JA_musicEnabled) return;
if (!current_music || current_music->state == JA_MUSIC_INVALID) return;
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
current_music->state = JA_MUSIC_PLAYING;
SDL_ResumeAudioStreamDevice(current_music->stream);
}
void JA_StopMusic()
{
if (!JA_musicEnabled) return;
if (!current_music || current_music->state == JA_MUSIC_INVALID) return;
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
current_music->pos = 0;
current_music->state = JA_MUSIC_STOPPED;
SDL_PauseAudioStreamDevice(current_music->stream);
SDL_DestroyAudioStream(current_music->stream);
current_music->stream = nullptr;
}
JA_Music_state JA_GetMusicState() {
JA_Music_state JA_GetMusicState()
{
if (!JA_musicEnabled) return JA_MUSIC_DISABLED;
if (!current_music) return JA_MUSIC_INVALID;
if (current_music == NULL) return JA_MUSIC_INVALID;
return current_music->state;
}
void JA_DeleteMusic(JA_Music_t *music) {
if (current_music == music) current_music = NULL;
free(music->output);
void JA_DeleteMusic(JA_Music_t *music)
{
if (current_music == music) current_music = nullptr;
SDL_free(music->buffer);
SDL_DestroyAudioStream(music->stream);
delete music;
}
int JA_SetMusicVolume(int volume)
float JA_SetMusicVolume(float volume)
{
JA_musicVolume = volume > 128 ? 128 : volume < 0 ? 0 : volume;
JA_musicVolume = SDL_clamp( volume, 0.0f, 1.0f );
if (current_music) SDL_SetAudioStreamGain(current_music->stream, JA_musicVolume);
return JA_musicVolume;
}
void JA_EnableMusic(const bool value)
{
if (!value && current_music != NULL && current_music->state==JA_MUSIC_PLAYING) JA_StopMusic();
if ( !value && current_music && (current_music->state==JA_MUSIC_PLAYING) ) JA_StopMusic();
JA_musicEnabled = value;
}
@@ -202,45 +259,26 @@ void JA_EnableMusic(const bool value)
JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length) {
JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length)
{
JA_Sound_t *sound = new JA_Sound_t();
sound->buffer = buffer;
sound->length = length;
return sound;
}
JA_Sound_t *JA_LoadSound(uint8_t* buffer, uint32_t size) {
JA_Sound_t *JA_LoadSound(uint8_t* buffer, uint32_t size)
{
JA_Sound_t *sound = new JA_Sound_t();
SDL_AudioSpec wavSpec;
SDL_LoadWAV_RW(SDL_RWFromMem(buffer, size),1, &wavSpec, &sound->buffer, &sound->length);
SDL_AudioCVT cvt;
SDL_BuildAudioCVT(&cvt, wavSpec.format, wavSpec.channels, wavSpec.freq, JA_format, JA_channels, JA_freq);
cvt.len = sound->length;
cvt.buf = (Uint8 *) SDL_malloc(cvt.len * cvt.len_mult);
SDL_memcpy(cvt.buf, sound->buffer, sound->length);
SDL_ConvertAudio(&cvt);
SDL_FreeWAV(sound->buffer);
sound->buffer = cvt.buf;
sound->length = cvt.len_cvt;
SDL_LoadWAV_IO(SDL_IOFromMem(buffer, size),1, &sound->spec, &sound->buffer, &sound->length);
return sound;
}
JA_Sound_t *JA_LoadSound(const char* filename) {
JA_Sound_t *JA_LoadSound(const char* filename)
{
JA_Sound_t *sound = new JA_Sound_t();
SDL_AudioSpec wavSpec;
SDL_LoadWAV(filename, &wavSpec, &sound->buffer, &sound->length);
SDL_AudioCVT cvt;
SDL_BuildAudioCVT(&cvt, wavSpec.format, wavSpec.channels, wavSpec.freq, JA_format, JA_channels, JA_freq);
cvt.len = sound->length;
cvt.buf = (Uint8 *) SDL_malloc(cvt.len * cvt.len_mult);
SDL_memcpy(cvt.buf, sound->buffer, sound->length);
SDL_ConvertAudio(&cvt);
SDL_FreeWAV(sound->buffer);
sound->buffer = cvt.buf;
sound->length = cvt.len_cvt;
SDL_LoadWAV(filename, &sound->spec, &sound->buffer, &sound->length);
return sound;
}
@@ -257,6 +295,11 @@ int JA_PlaySound(JA_Sound_t *sound, const int loop)
channels[channel].times = loop;
channels[channel].pos = 0;
channels[channel].state = JA_CHANNEL_PLAYING;
channels[channel].stream = SDL_CreateAudioStream(&channels[channel].sound->spec, &JA_audioSpec);
SDL_PutAudioStreamData(channels[channel].stream, channels[channel].sound->buffer, channels[channel].sound->length);
SDL_SetAudioStreamGain(channels[channel].stream, JA_soundVolume);
SDL_BindAudioStream(sdlAudioDevice, channels[channel].stream);
return channel;
}
@@ -273,12 +316,22 @@ void JA_PauseChannel(const int channel)
{
if (!JA_soundEnabled) return;
if (channel == -1) {
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
if (channels[i].state == JA_CHANNEL_PLAYING) channels[i].state = JA_CHANNEL_PAUSED;
if (channel == -1)
{
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
if (channels[i].state == JA_CHANNEL_PLAYING)
{
channels[i].state = JA_CHANNEL_PAUSED;
SDL_PauseAudioStreamDevice(channels[i].stream);
}
}
else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS)
{
if (channels[channel].state == JA_CHANNEL_PLAYING)
{
channels[channel].state = JA_CHANNEL_PAUSED;
SDL_PauseAudioStreamDevice(channels[channel].stream);
}
} else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS) {
if (channels[channel].state == JA_CHANNEL_PLAYING) channels[channel].state = JA_CHANNEL_PAUSED;
}
}
@@ -286,12 +339,22 @@ void JA_ResumeChannel(const int channel)
{
if (!JA_soundEnabled) return;
if (channel == -1) {
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
if (channels[i].state == JA_CHANNEL_PAUSED) channels[i].state = JA_CHANNEL_PLAYING;
if (channel == -1)
{
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
if (channels[i].state == JA_CHANNEL_PAUSED)
{
channels[i].state = JA_CHANNEL_PLAYING;
SDL_ResumeAudioStreamDevice(channels[i].stream);
}
}
else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS)
{
if (channels[channel].state == JA_CHANNEL_PAUSED)
{
channels[channel].state = JA_CHANNEL_PLAYING;
SDL_ResumeAudioStreamDevice(channels[channel].stream);
}
} else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS) {
if (channels[channel].state == JA_CHANNEL_PAUSED) channels[channel].state = JA_CHANNEL_PLAYING;
}
}
@@ -299,16 +362,21 @@ void JA_StopChannel(const int channel)
{
if (!JA_soundEnabled) return;
if (channel == -1) {
if (channel == -1)
{
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
channels[i].state = JA_CHANNEL_FREE;
channels[i].pos = 0;
channels[i].sound = NULL;
SDL_DestroyAudioStream(channels[i].stream);
}
} else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS) {
}
else if (channel >= 0 && channel < JA_MAX_SIMULTANEOUS_CHANNELS)
{
channels[channel].state = JA_CHANNEL_FREE;
channels[channel].pos = 0;
channels[channel].sound = NULL;
SDL_DestroyAudioStream(channels[channel].stream);
}
}
@@ -317,12 +385,18 @@ JA_Channel_state JA_GetChannelState(const int channel)
if (!JA_soundEnabled) return JA_SOUND_DISABLED;
if (channel < 0 || channel >= JA_MAX_SIMULTANEOUS_CHANNELS) return JA_CHANNEL_INVALID;
return channels[channel].state;
}
int JA_SetSoundVolume(int volume)
float JA_SetSoundVolume(float volume)
{
JA_soundVolume = volume > 128 ? 128 : volume < 0 ? 0 : volume;
JA_soundVolume = SDL_clamp( volume, 0.0f, 1.0f );
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++)
if ( (channels[i].state == JA_CHANNEL_PLAYING) || (channels[i].state == JA_CHANNEL_PAUSED) )
SDL_SetAudioStreamGain(channels[i].stream, JA_soundVolume);
return JA_soundVolume;
}
@@ -335,10 +409,10 @@ void JA_EnableSound(const bool value)
JA_soundEnabled = value;
}
int JA_SetVolume(int volume)
float JA_SetVolume(float volume)
{
JA_musicVolume = volume > 128 ? 128 : volume < 0 ? 0 : volume;
JA_soundVolume = JA_musicVolume/2;
JA_SetSoundVolume(JA_SetMusicVolume(volume) / 2.0f);
return JA_musicVolume;
}

View File

@@ -1,5 +1,5 @@
#pragma once
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
enum JA_Channel_state { JA_CHANNEL_INVALID, JA_CHANNEL_FREE, JA_CHANNEL_PLAYING, JA_CHANNEL_PAUSED, JA_SOUND_DISABLED };
enum JA_Music_state { JA_MUSIC_INVALID, JA_MUSIC_PLAYING, JA_MUSIC_PAUSED, JA_MUSIC_STOPPED, JA_MUSIC_DISABLED };
@@ -18,7 +18,7 @@ void JA_ResumeMusic();
void JA_StopMusic();
JA_Music_state JA_GetMusicState();
void JA_DeleteMusic(JA_Music_t *music);
int JA_SetMusicVolume(int volume);
float JA_SetMusicVolume(float volume);
void JA_EnableMusic(const bool value);
JA_Sound_t *JA_NewSound(Uint8* buffer, Uint32 length);
@@ -30,7 +30,7 @@ void JA_ResumeChannel(const int channel);
void JA_StopChannel(const int channel);
JA_Channel_state JA_GetChannelState(const int channel);
void JA_DeleteSound(JA_Sound_t *sound);
int JA_SetSoundVolume(int volume);
float JA_SetSoundVolume(float volume);
void JA_EnableSound(const bool value);
int JA_SetVolume(int volume);
float JA_SetVolume(float volume);

View File

@@ -1,6 +1,6 @@
#include "jaudio.h"
#include "jail_audio.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include <stdio.h>
#include "jfile.h"
#include <vector>
@@ -22,7 +22,7 @@ namespace audio
// Inicialitza el sistema de só
void init()
{
JA_Init(48000, AUDIO_S16, 2);
JA_Init(48000, SDL_AUDIO_S16LE, 2);
//Mix_Init(MIX_INIT_OGG);// | MIX_INIT_WAVPACK);
//Mix_OpenAudio(48000, AUDIO_S16, 2, 512);
}

View File

@@ -1,5 +1,5 @@
#include "jdraw.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "gif.c"
#include "jfile.h"
#include <vector>
@@ -15,11 +15,15 @@ namespace draw
SDL_Renderer *sdl_renderer = nullptr; // El renderer de SDL
SDL_Texture *sdl_texture = nullptr; // La textura de SDL a la que pintarem la nostra superficie "screen" i que despres volcarem a pantalla
SDL_FRect dest_rect = {0, 0, 320, 240};
static int fullscreen_scale = 1;
static int screen_zoom = 1;
static bool screen_fullscreen = false;
static int screen_width = 320;
static int screen_height = 240;
std::string screen_title = "";
static int screen_mode = SCREEN_MODE_NORMAL;
surface *screen = nullptr; // La superficie screen, que representa la pantalla. Se crea i destrueix internament
surface *destination = nullptr; // Punter a la actual superficie de destí
@@ -85,12 +89,42 @@ namespace draw
// [TODO] Incloure gestió de pantalla completa
// Inicialització de les estructures de SDL
sdl_window = SDL_CreateWindow(screen_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen_width * screen_zoom, screen_height * screen_zoom, screen_fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : SDL_WINDOW_SHOWN);
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
sdl_window = SDL_CreateWindow(screen_title.c_str(), screen_width * screen_zoom, screen_height * screen_zoom, screen_fullscreen ? SDL_WINDOW_FULLSCREEN : 0);
sdl_renderer = SDL_CreateRenderer(sdl_window, nullptr);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
char *driver_name;
const int num_render_drivers = SDL_GetNumRenderDrivers();
printf("Available renderers:\n");
for (int i=0; i<num_render_drivers; ++i)
{
SDL_GetRenderDriver(i);
printf(" - %i: %s\n", i, driver_name);
}
printf("\nRenderer: %s\n", SDL_GetRendererName(sdl_renderer));
SDL_HideCursor();
if (screen_fullscreen)
{
int w, h;
SDL_GetWindowSize(sdl_window, &w, &h);
fullscreen_scale = h/screen_height;
dest_rect.w = screen_width * fullscreen_scale;
dest_rect.h = screen_height * fullscreen_scale;
dest_rect.x = (w - dest_rect.w)/2;
dest_rect.y = (h - dest_rect.h)/2;
}
else
{
dest_rect.x = dest_rect.y = 0;
dest_rect.w = screen_width * zoom;
dest_rect.h = screen_height * zoom;
}
// Establim el tamany "logic", indepndent del tamany de finestra
SDL_RenderSetLogicalSize(sdl_renderer, width, height);
//SDL_RenderSetLogicalSize(sdl_renderer, width, height);
// Creem la superficie "screen" i la establim com a superficie destinació
screen = createSurface(width, height);
@@ -148,23 +182,40 @@ namespace draw
SDL_DestroyWindow(sdl_window);
const int zoom = screen_fullscreen ? 1 : screen_zoom;
sdl_window = SDL_CreateWindow(screen_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, screen_width * zoom, screen_height * zoom, screen_fullscreen?SDL_WINDOW_FULLSCREEN_DESKTOP:SDL_WINDOW_SHOWN);
sdl_renderer = SDL_CreateRenderer(sdl_window, -1, 0);
sdl_window = SDL_CreateWindow(screen_title.c_str(), screen_width * zoom, screen_height * zoom, screen_fullscreen?SDL_WINDOW_FULLSCREEN:0);
sdl_renderer = SDL_CreateRenderer(sdl_window, nullptr);
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, screen_width, screen_height);
SDL_HideCursor();
if (screen_fullscreen)
{
int w, h;
SDL_GetWindowSize(sdl_window, &w, &h);
fullscreen_scale = h/screen_height;
dest_rect.w = screen_width * fullscreen_scale;
dest_rect.h = screen_height * fullscreen_scale;
dest_rect.x = (w - dest_rect.w)/2;
dest_rect.y = (h - dest_rect.h)/2;
}
else
{
dest_rect.x = dest_rect.y = 0;
dest_rect.w = screen_width * zoom;
dest_rect.h = screen_height * zoom;
}
// Establim el tamany "logic", indepndent del tamany de finestra
SDL_RenderSetLogicalSize(sdl_renderer, screen_width, screen_height);
//SDL_RenderSetLogicalSize(sdl_renderer, screen_width, screen_height);
}
void setZoom(const int value)
{
if (value < 1) return;
const SDL_DisplayMode *dm = SDL_GetCurrentDisplayMode(SDL_GetDisplayForWindow(sdl_window));
SDL_DisplayMode dm;
SDL_GetCurrentDisplayMode(0, &dm);
if (screen_width*value > dm.w) return;
if (screen_height*value > dm.h) return;
if (screen_width*value > dm->w) return;
if (screen_height*value > dm->h) return;
screen_zoom = value;
reinit();
@@ -203,6 +254,23 @@ namespace draw
return screen_zoom;
}
void toggleScreenMode()
{
screen_mode++;
if (screen_mode == SCREEN_MODE_NUM_MODES) screen_mode = 0;
//reinit();
}
void setScreenMode(const int value)
{
screen_mode = value;
}
const int getScreenMode()
{
return screen_mode;
}
// Crea una superficie i torna un punter a ella
surface *createSurface(const uint16_t w, const uint16_t h)
{
@@ -629,9 +697,35 @@ namespace draw
// Desbloquejem la textura
SDL_UnlockTexture(sdl_texture);
// Pintem la textura a pantalla
SDL_RenderCopy(sdl_renderer, sdl_texture, NULL, NULL);
if (screen_fullscreen)
{
SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 255);
SDL_RenderClear(sdl_renderer);
}
// Pintem la textura a pantalla
SDL_RenderTexture(sdl_renderer, sdl_texture, NULL, &dest_rect);
if (screen_mode & SCREEN_MODE_SCANLINES)
{
if (screen_zoom>=3 || screen_fullscreen)
{
int zoom = screen_fullscreen ? fullscreen_scale : screen_zoom;
SDL_SetRenderDrawBlendMode(sdl_renderer, SDL_BLENDMODE_BLEND);
for (int y=0; y<screen_height; ++y)
{
SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 192);
SDL_RenderLine(sdl_renderer, dest_rect.x, dest_rect.y + y*zoom, dest_rect.x + dest_rect.w, dest_rect.y + y*zoom);
SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 96);
if (zoom>3) SDL_RenderLine(sdl_renderer, dest_rect.x, 1+dest_rect.y + y*zoom, dest_rect.x + dest_rect.w, 1+dest_rect.y + y*zoom);
}
SDL_SetRenderDrawColor(sdl_renderer, 0, 0, 0, 16);
for (int x=0; x<screen_width; ++x)
{
SDL_RenderLine(sdl_renderer, dest_rect.x + x*zoom, dest_rect.y, dest_rect.x + x*zoom, dest_rect.y + dest_rect.h);
}
}
}
// I ho presentem
SDL_RenderPresent(sdl_renderer);
}

View File

@@ -13,6 +13,12 @@
#define FONT_ZOOM_HORIZONTAL 2
#define FONT_ZOOM_BOTH 3
#define SCREEN_MODE_NORMAL 0
#define SCREEN_MODE_SCANLINES 1
#define SCREEN_MODE_FOSFORO 2
#define SCREEN_MODE_SCANFOS 3
#define SCREEN_MODE_NUM_MODES 4
// Unitat per a la gestió dels recursos gràfics i dibuixat en pantalla
namespace draw
{
@@ -44,6 +50,10 @@ namespace draw
const bool getFullscreen();
const int getZoom();
void toggleScreenMode();
void setScreenMode(const int value);
const int getScreenMode();
/// @brief Crea una superficie i torna un punter a ella
/// @param w ample de la superficie
/// @param h alt de la superficie

View File

@@ -341,7 +341,19 @@ namespace file
#elif __linux__
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
config_folder = std::string(homedir) + "/." + foldername;
config_folder = std::string(homedir) + "/.config/" + foldername;
{
// Intenta crear ".config", per si no existeix
std::string config_base_folder = std::string(homedir) + "/.config";
int ret = mkdir(config_base_folder.c_str(), S_IRWXU);
if (ret == -1 && errno != EEXIST)
{
printf("ERROR CREATING CONFIG BASE FOLDER.");
exit(EXIT_FAILURE);
}
}
#endif
struct stat st = {0};

View File

@@ -2,7 +2,7 @@
#include "jdraw.h"
#include "jinput.h"
#include "jaudio.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace game
{
@@ -34,7 +34,7 @@ int main(int argc, char *argv[])
game::param_count = argc;
game::params = argv;
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_GAMEPAD);
input::init();
audio::init();
@@ -47,39 +47,39 @@ int main(int argc, char *argv[])
{
while(SDL_PollEvent(&e))
{
if (e.type==SDL_QUIT) { game::should_exit = true; break; }
if (e.type==SDL_KEYDOWN)
if (e.type==SDL_EVENT_QUIT) { game::should_exit = true; break; }
if (e.type==SDL_EVENT_KEY_DOWN)
{
input::updateKey(e.key.keysym.scancode);
input::updateKey(e.key.scancode);
}
if (e.type==SDL_KEYUP)
if (e.type==SDL_EVENT_KEY_UP)
{
input::updateKeypressed(e.key.keysym.scancode);
input::updateKeypressed(e.key.scancode);
}
if (e.type==SDL_MOUSEBUTTONUP)
if (e.type==SDL_EVENT_MOUSE_BUTTON_UP)
{
input::updateClk(e.button.button);
}
if (e.type==SDL_MOUSEWHEEL)
if (e.type==SDL_EVENT_MOUSE_WHEEL)
{
input::updateWheel(e.wheel.y);
}
if (e.type==SDL_CONTROLLERBUTTONDOWN) {
input::updatePadBtn(e.cbutton.button);
input::updatePadBtnPressed(e.cbutton.button);
if (e.type==SDL_EVENT_GAMEPAD_BUTTON_DOWN) {
input::updatePadBtn(e.gbutton.button);
input::updatePadBtnPressed(e.gbutton.button);
}
}
if (SDL_GetTicks()-current_ticks >= game::ticks_per_frame)
{
current_ticks = SDL_GetTicks();
if (!game::loop()) game::should_exit = true;
input::updateKey(SDL_SCANCODE_UNKNOWN);
input::updateKeypressed(SDL_SCANCODE_UNKNOWN);
input::updateClk(0);
input::updateWheel(0);
input::updatePadBtn(SDL_CONTROLLER_BUTTON_INVALID);
input::updatePadBtnPressed(SDL_CONTROLLER_BUTTON_INVALID);
current_ticks = SDL_GetTicks();
input::updatePadBtn(SDL_GAMEPAD_BUTTON_INVALID);
input::updatePadBtnPressed(SDL_GAMEPAD_BUTTON_INVALID);
}
}

View File

@@ -1,31 +1,40 @@
#include "jinput.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "jdraw.h"
#include "jfile.h"
namespace input
{
static const uint8_t *keys = nullptr;
static const bool *keys = nullptr;
static uint8_t keypressed = 0;
static uint8_t keydown = 0;
static uint8_t btnClicked = 0;
static int wheel = 0;
static SDL_GameController *gamepad = NULL;
static int8_t pad_btn_pressed = SDL_CONTROLLER_BUTTON_INVALID;
static int8_t pad_btn_down = SDL_CONTROLLER_BUTTON_INVALID;
static SDL_Gamepad *gamepad = NULL;
static int8_t pad_btn_pressed = SDL_GAMEPAD_BUTTON_INVALID;
static int8_t pad_btn_down = SDL_GAMEPAD_BUTTON_INVALID;
void initGamePad()
{
int size;
char *buffer = file::getFileBuffer("gamecontrollerdb.txt", size);
if (SDL_GameControllerAddMappingsFromRW(SDL_RWFromMem(buffer, size), 1) < 0) printf("No s'ha pogut carregar el gamecontrollersdb.txt\n");
if (SDL_AddGamepadMappingsFromIO(SDL_IOFromMem(buffer, size), 1) < 0) printf("No s'ha pogut carregar el gamecontrollersdb.txt\n");
free(buffer);
int num_gamepads;
SDL_JoystickID *gamepads = SDL_GetGamepads(&num_gamepads);
if (num_gamepads>0)
{
gamepad = SDL_OpenGamepad(gamepads[0]);
SDL_SetGamepadEventsEnabled(true);
SDL_free(gamepads);
}
/*
const int num_joysticks = SDL_NumJoysticks();
if (num_joysticks>=1) {
for (int i=0; i<num_joysticks; ++i) {
if (SDL_IsGameController(i)) {
gamepad = SDL_GameControllerOpen(i);
gamepad = SDL_OpenGamepad() GameControllerOpen(i);
if (SDL_GameControllerGetAttached(gamepad) == SDL_TRUE) {
SDL_GameControllerEventState(SDL_ENABLE);
return;
@@ -33,6 +42,7 @@ namespace input
}
}
}
*/
}
void init()
@@ -76,7 +86,7 @@ namespace input
bool padBtnDown(const int8_t btn)
{
if (!gamepad) return false;
return SDL_GameControllerGetButton(gamepad, SDL_GameControllerButton(btn)) == 1;
return SDL_GetGamepadButton(gamepad, SDL_GamepadButton(btn)) == 1;
}
// Determina si el botó del pad especificat ha sigut polsat, pero no tornarà a ser true fins
@@ -88,7 +98,7 @@ namespace input
// Determina si hi ha algun botó del pad polsat ara mateix
bool anyPadBtn()
{
return pad_btn_down != SDL_CONTROLLER_BUTTON_INVALID;
return pad_btn_down != SDL_GAMEPAD_BUTTON_INVALID;
}
// Torna el codi del botó del pad que està sent polsat ara mateix
@@ -144,7 +154,7 @@ namespace input
// Torna la posició X actual del ratolí
const int mouseX()
{
int x;
float x;
SDL_GetMouseState(&x, NULL);
return x/draw::getZoom();
}
@@ -152,7 +162,7 @@ namespace input
// Torna la posició Y actual del ratolí
const int mouseY()
{
int y;
float y;
SDL_GetMouseState(NULL, &y);
return y/draw::getZoom();
}
@@ -160,7 +170,7 @@ namespace input
// Determina si el botó del ratolí especificat està sent polsada ara mateix
const bool mouseBtn(const int btn)
{
return (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(btn));
return (SDL_GetMouseState(NULL, NULL) & SDL_BUTTON_MASK(btn));
}
// Determina si el botó especificat ha sigut polsat, pero no tornarà a ser true fins

View File

@@ -2,7 +2,7 @@
#include "jdraw.h"
#include "jinput.h"
#include <string.h>
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace ui
{

View File

@@ -1,7 +1,7 @@
#include "jutil.h"
#include <string.h>
#include <ctype.h>
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace util
{
int stringToInt(const char *value, std::vector<const char*> strings, std::vector<int> values)

View File

@@ -6,7 +6,7 @@
#include "actor.h"
#include "room.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace modules
{
@@ -16,13 +16,17 @@ namespace modules
void init()
{
audio::playMusic("mus_gameover.ogg", 0);
if (gat == nullptr) gat = actor::createFromTemplate("GAT-NEGRE");
if (audio::getCurrentMusic() != "mus_gameover.ogg") audio::playMusic("mus_gameover.ogg", 0);
gat = actor::createFromTemplate("GAT-BATMAN");
}
bool loop()
{
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) {
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK))
{
if (gat) actor::remove(gat);
gat = nullptr;
audio::playMusic("mus_ingame.ogg");
return false;
}

View File

@@ -1,7 +1,7 @@
#include "m_editor_bitmap.h"
#include "jdraw.h"
#include "jinput.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "room.h"
#include "actor.h"
#include "m_game.h"

View File

@@ -2,7 +2,7 @@
#include "jdraw.h"
#include "jinput.h"
#include "jfile.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "room.h"
#include "actor.h"
#include "m_game.h"

View File

@@ -1,7 +1,7 @@
#include "m_editor_colors.h"
#include "jdraw.h"
#include "jinput.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "room.h"
namespace modules

View File

@@ -2,7 +2,7 @@
#include "jdraw.h"
#include "jinput.h"
#include "misc.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "room.h"
#include "actor.h"

View File

@@ -2,7 +2,7 @@
#include "jdraw.h"
#include "jinput.h"
#include "misc.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "actor.h"
#include <vector>
#include "room.h"

View File

@@ -5,7 +5,7 @@
#include "jaudio.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "actor.h"
namespace modules

View File

@@ -5,7 +5,7 @@
#include "jaudio.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "actor.h"
namespace modules
@@ -21,6 +21,7 @@ namespace modules
void init(bool go_direct_to_credits)
{
audio::stopAllChannel();
stage = go_direct_to_credits ? 2 : 0;
time = SDL_GetTicks();
if (go_direct_to_credits) time += 5000;
@@ -55,7 +56,7 @@ namespace modules
const bool shouldGoToNext()
{
if (SDL_GetTicks()-time < 1000) return false;
return (SDL_GetTicks()-time > (stage==15||stage==16?10000:5000)) ||
return ( (stage<16) && (SDL_GetTicks()-time > (stage==15?10000:5000)) ) ||
(controller::pressed(KEY_JUMP)) || (controller::pressed(KEY_PICK)) ||
(input::keyPressed(SDL_SCANCODE_SPACE)) || (input::keyPressed(SDL_SCANCODE_RETURN));
}
@@ -147,13 +148,19 @@ namespace modules
draw::print2("GRACIES PER JUGAR!", 11, 9, PURPLE, FONT_ZOOM_VERTICAL);
draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 11, 14, GREEN, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 13, 14, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 11, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 8, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 13, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 11, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 4, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 13, 18, GREEN, FONT_ZOOM_NONE);
if (actor::hero::getNumAmbernicsCollected()>0)
{
draw::print2(actor::hero::getNumAmbernicsCollected(), 2, 8, 20, TEAL, FONT_ZOOM_NONE);
draw::print2("ANBERNICS ARREPLEGADES", 13, 20, GREEN, FONT_ZOOM_NONE);
}
break;

View File

@@ -296,6 +296,7 @@ namespace modules
if ( (controller::pressed(KEY_MENU)) || (controller::pressed(KEY_PICK)) || (controller::pressed(KEY_JUMP)) )
{
missatge[0] = 0;
audio::resumeMusic();
return;
}
draw::color(BLACK);
@@ -436,7 +437,7 @@ namespace modules
draw::print2("c", 15, 26, col3, FONT_ZOOM_NONE);
draw::print2(actor::hero::getBoostJump(), 2, 8, 27, col3, FONT_ZOOM_NONE);
draw::print2(actor::hero::getBoostGod()/2, 2, 11, 27, col1, FONT_ZOOM_NONE);
draw::print2(actor::hero::getBoostGod()/4, 2, 11, 27, col1, FONT_ZOOM_NONE);
draw::print2(actor::hero::getBoostRun()/2, 2, 14, 27, col2, FONT_ZOOM_NONE);
draw::stencil::enable();
@@ -989,6 +990,8 @@ namespace modules
void setMissatge(const char *text)
{
actor::pauseWalkSound();
audio::pauseMusic();
strcpy(missatge, text);
}

View File

@@ -6,7 +6,7 @@
#include "actor.h"
#include "room.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace modules
{
@@ -19,7 +19,6 @@ namespace modules
{
if (audio::getCurrentMusic() != "mus_gameover.ogg") audio::playMusic("mus_gameover.ogg", 0);
if (heroi) actor::remove(heroi);
if (actor::hero::isPrologo()) {
heroi = actor::create("HERO", {16, 32, 0}, {6, 6, 8}, "gat.gif", {0, 0, 24, 28}, {-4, 32});
} else {
@@ -43,13 +42,18 @@ namespace modules
bool loop()
{
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK)) { return false; }
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK))
{
if (heroi) actor::remove(heroi);
heroi = nullptr;
return false;
}
draw::cls(2);
draw::color(1);
draw::swapcol(1, WHITE);
actor::update(heroi, false);
actor::drawAt(heroi, 150, 160);
actor::drawAt(heroi, 150, 176);
draw::print2("THE POOL", 16, 3, TEAL, FONT_ZOOM_VERTICAL);
@@ -59,21 +63,27 @@ namespace modules
{
int num_objectes = 0;
for (int i=0;i<4;++i) if (actor::hero::getPrologoObjectState(i)==PROLOGO_OBJECT_LEFT) num_objectes++;
draw::print2(num_objectes, 2, 11, 12, TEAL, FONT_ZOOM_NONE);
draw::print2("OBJECTES DEJATS", 14, 12, GREEN, FONT_ZOOM_NONE);
draw::print2(num_objectes, 2, 8, 12, TEAL, FONT_ZOOM_NONE);
draw::print2("OBJECTES DEJATS", 13, 12, GREEN, FONT_ZOOM_NONE);
} else {
draw::print2(actor::stats::getNumPartsCollected(), 2, 11, 12, TEAL, FONT_ZOOM_NONE);
draw::print2("PARTS TROBADES", 14, 12, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getNumPartsCollected(), 2, 8, 12, TEAL, FONT_ZOOM_NONE);
draw::print2("PARTS TROBADES", 13, 12, GREEN, FONT_ZOOM_NONE);
}
draw::print2(actor::stats::getRoomsVisited(), 2, 8, 14, TEAL, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 11, 14, GREEN, FONT_ZOOM_NONE);
draw::print2("HABITACIONS VISITADES", 13, 14, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 11, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 14, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(actor::stats::getLivesLost(), 2, 8, 16, TEAL, FONT_ZOOM_NONE);
draw::print2("VIDES PERDUDES", 13, 16, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 11, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 18, 18, GREEN, FONT_ZOOM_NONE);
draw::print2(time_text, 4, 18, TEAL, FONT_ZOOM_NONE);
draw::print2("TEMPS TOTAL", 13, 18, GREEN, FONT_ZOOM_NONE);
if (actor::hero::getNumAmbernicsCollected()>0)
{
draw::print2(actor::hero::getNumAmbernicsCollected(), 2, 8, 20, TEAL, FONT_ZOOM_NONE);
draw::print2("ANBERNICS ARREPLEGADES", 13, 20, GREEN, FONT_ZOOM_NONE);
}
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);

View File

@@ -7,7 +7,7 @@
#include "actor.h"
#include "room.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace modules
{
@@ -76,9 +76,17 @@ namespace modules
}
}
void cleanup()
{
for (int i=0; i<6; ++i) { actor::remove(parts[i]); parts[i]=nullptr;}
actor::remove(anbernic); anbernic=nullptr;
}
int loop()
{
if (controller::pressed(KEY_MENU)) {
if (controller::pressed(KEY_MENU))
{
cleanup();
return INGAME_CONTINUAR;
}
if (controller::pressed(KEY_DOWN) || input::keyPressed(SDL_SCANCODE_DOWN))
@@ -94,11 +102,7 @@ namespace modules
if (controller::pressed(KEY_JUMP) || controller::pressed(KEY_PICK) || input::keyPressed(SDL_SCANCODE_RETURN))
{
audio::playSound("snd_push.wav", SOUND_BASIC);
if (selected_option==INGAME_EIXIR)
{
for (int i=0; i<6; ++i) { actor::remove(parts[i]); parts[i]=nullptr;}
actor::remove(anbernic); anbernic=nullptr;
}
cleanup();
return selected_option;
}

View File

@@ -4,7 +4,7 @@
#include "jaudio.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "actor.h"
namespace modules

View File

@@ -4,7 +4,8 @@
#include "controller.h"
#include "jaudio.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include <math.h>
namespace modules
{
@@ -31,7 +32,7 @@ namespace modules
void init()
{
srand(SDL_GetTicks());
anys = draw::getSurface("25anys.gif");
anys = draw::getSurface("25anys.gif"); // getSurface() no crea res, així que no fa falta destruir ni fer res al eixir
num_pixels = 0;
draw::surface *surf = draw::getSurface("jailgames.gif");
for (int y=0; y<surf->h; ++y)

View File

@@ -4,7 +4,7 @@
#include "controller.h"
#include "jdraw.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "jaudio.h"
#include "actor.h"
namespace modules
@@ -24,7 +24,7 @@ namespace modules
if (audio::getCurrentMusic() != "mus_menu.ogg") audio::playMusic("mus_menu.ogg");
selected_option = OPTION_JUGAR;
::game::setUpdateTicks(64);
draw::loadPalette("test.gif");
//draw::loadPalette("test.gif");
surf = draw::getSurface("test.gif");
draw::restorecol(2);
if (config::isProgoloDesbloquejat()) min_option=0;
@@ -120,6 +120,7 @@ namespace modules
//draw::print2(input::getPadBtnPressed(), 3, 0, 24, RED, FONT_ZOOM_NONE);
draw::print2("(C) JAILDOCTOR 2024", 11, 28, TEAL, FONT_ZOOM_NONE);
draw::print("v1.5b", 299, 233, WHITE, PAPER);
draw::render();
return OPTION_NONE;

View File

@@ -4,7 +4,7 @@
#include "controller.h"
#include "jdraw.h"
#include "jaudio.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "config.h"
namespace modules

View File

@@ -4,7 +4,7 @@
#include "jaudio.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace modules
{
@@ -57,7 +57,7 @@ namespace modules
}
} else {
const int8_t btn = input::getPadBtnPressed();
if (btn != SDL_CONTROLLER_BUTTON_INVALID) {
if (btn != SDL_GAMEPAD_BUTTON_INVALID) {
config::definePadBtn(selected_option, btn);
selected_option++;
if (selected_option==6) state = STATE_SELECTING;

View File

@@ -4,7 +4,7 @@
#include "jaudio.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
namespace modules
{

View File

@@ -4,7 +4,7 @@
#include "jaudio.h"
#include "controller.h"
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "actor.h"
namespace modules

View File

@@ -7,7 +7,7 @@
#include "console.h"
#include <string.h>
#include "config.h"
#include <SDL2/SDL.h>
#include <SDL3/SDL.h>
#include "actor.h"
#include "room.h"
@@ -76,6 +76,15 @@ void loadConfig()
std::string txt_fullscreen = file::getConfigValue("fullscreen");
if (txt_fullscreen=="yes") fullscreen = true;
int screen_mode = SCREEN_MODE_NORMAL;
std::string txt_fosforo = file::getConfigValue("fosforo");
if (txt_fosforo=="yes") screen_mode |= SCREEN_MODE_FOSFORO;
std::string txt_scanlines = file::getConfigValue("scanlines");
if (txt_scanlines=="yes") screen_mode |= SCREEN_MODE_SCANLINES;
draw::setScreenMode(screen_mode);
static const char* nomtecles[6] = {"keyup", "keydown", "keyleft", "keyright", "keyjump", "keypick"};
for (int i=0; i<6; ++i)
{
@@ -95,9 +104,10 @@ void game::init()
{
if (game::getParams(1) && strcmp(game::getParams(1), "editor")==0) editor::setDevMode();
if (editor::isDevMode())
if (editor::isDevMode()) {
draw::init("The Pool", 520, 240, zoom);
else {
SDL_ShowCursor();
} else {
loadConfig();
draw::init("The Pool", 320, 240, zoom, fullscreen);
console::init();
@@ -112,7 +122,11 @@ void game::init()
audio::loadSound("snd_boost.wav");
}
if (draw::getScreenMode()&SCREEN_MODE_FOSFORO) {
draw::loadPalette("fosforo.gif");
} else {
draw::loadPalette("test.gif");
}
if (editor::isDevMode()) {
current_module = M_GAME;
@@ -139,6 +153,19 @@ bool game::loop()
fullscreen = draw::getFullscreen();
file::setConfigValue("fullscreen", fullscreen?"yes":"no");
}
if (input::keyPressed(SDL_SCANCODE_F4)) {
draw::toggleScreenMode();
const int mode = draw::getScreenMode();
if (mode&SCREEN_MODE_FOSFORO) {
draw::loadPalette("fosforo.gif");
} else {
draw::loadPalette("test.gif");
}
file::setConfigValue("fosforo", mode&SCREEN_MODE_FOSFORO?"yes":"no");
file::setConfigValue("scanlines", mode&SCREEN_MODE_SCANLINES?"yes":"no");
}
if (input::keyPressed(SDL_SCANCODE_F12)) {
draw::reloadAll();