Compare commits
2 Commits
719c448779
...
122d44a710
| Author | SHA1 | Date | |
|---|---|---|---|
| 122d44a710 | |||
| b4eece72dd |
|
Before Width: | Height: | Size: 1.1 KiB |
BIN
data/font/smb2.png
Normal file
|
After Width: | Height: | Size: 872 B |
BIN
data/font/smb2_grad.png
Normal file
|
After Width: | Height: | Size: 872 B |
|
Before Width: | Height: | Size: 84 B |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 173 B |
67
data/gfx/player/player1_coffee1.pal
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
64
|
||||||
|
0 0 0 0
|
||||||
|
136 66 83 255
|
||||||
|
150 66 83 255
|
||||||
|
186 97 86 255
|
||||||
|
217 148 85 255
|
||||||
|
230 157 90 255
|
||||||
|
242 166 94 255
|
||||||
|
189 189 189 255
|
||||||
|
224 224 224 255
|
||||||
|
243 108 96 255
|
||||||
|
117 117 117 255
|
||||||
|
238 238 238 255
|
||||||
|
255 255 235 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
61 156 112 255
|
||||||
|
79 163 112 255
|
||||||
|
93 222 112 255
|
||||||
|
125 242 92 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
50 64 143 255
|
||||||
|
54 70 156 255
|
||||||
|
59 75 168 255
|
||||||
|
63 81 181 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
78 52 46 255
|
||||||
|
93 64 55 255
|
||||||
|
109 76 65 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
239 224 5 255
|
||||||
|
232 247 8 255
|
||||||
|
245 247 215 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
102 50 63 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
67
data/gfx/player/player1_coffee2.pal
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
64
|
||||||
|
0 0 0 0
|
||||||
|
136 66 83 255
|
||||||
|
150 66 83 255
|
||||||
|
186 97 86 255
|
||||||
|
217 148 85 255
|
||||||
|
230 157 90 255
|
||||||
|
242 166 94 255
|
||||||
|
189 189 189 255
|
||||||
|
224 224 224 255
|
||||||
|
243 108 96 255
|
||||||
|
117 117 117 255
|
||||||
|
238 238 238 255
|
||||||
|
255 255 235 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
214 164 26 255
|
||||||
|
227 174 27 255
|
||||||
|
239 183 29 255
|
||||||
|
252 193 30 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
50 64 143 255
|
||||||
|
54 70 156 255
|
||||||
|
59 75 168 255
|
||||||
|
63 81 181 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
78 52 46 255
|
||||||
|
93 64 55 255
|
||||||
|
109 76 65 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
239 224 5 255
|
||||||
|
232 247 8 255
|
||||||
|
245 247 215 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
102 50 63 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
67
data/gfx/player/player1_invencible.pal
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
64
|
||||||
|
0 0 0 0
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
189 189 189 255
|
||||||
|
224 224 224 255
|
||||||
|
255 255 255 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 235 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
170 170 170 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
Before Width: | Height: | Size: 174 B |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 172 B |
67
data/gfx/player/player2_coffee1.pal
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
64
|
||||||
|
0 0 0 0
|
||||||
|
19 18 18 255
|
||||||
|
35 35 35 255
|
||||||
|
54 48 47 255
|
||||||
|
212 148 85 255
|
||||||
|
232 148 85 255
|
||||||
|
242 166 94 255
|
||||||
|
234 234 234 255
|
||||||
|
199 199 199 255
|
||||||
|
243 108 96 255
|
||||||
|
196 20 17 255
|
||||||
|
221 25 29 255
|
||||||
|
222 222 222 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
46 139 87 255
|
||||||
|
60 179 113 255
|
||||||
|
72 209 129 255
|
||||||
|
85 239 141 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
26 35 126 255
|
||||||
|
29 38 138 255
|
||||||
|
32 41 150 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
78 52 46 255
|
||||||
|
93 64 55 255
|
||||||
|
109 76 65 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
250 8 219 255
|
||||||
|
250 86 229 255
|
||||||
|
250 202 244 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
102 50 63 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
67
data/gfx/player/player2_coffee2.pal
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
64
|
||||||
|
0 0 0 0
|
||||||
|
19 18 18 255
|
||||||
|
35 35 35 255
|
||||||
|
54 48 47 255
|
||||||
|
212 148 85 255
|
||||||
|
232 148 85 255
|
||||||
|
242 166 94 255
|
||||||
|
234 234 234 255
|
||||||
|
199 199 199 255
|
||||||
|
243 108 96 255
|
||||||
|
196 20 17 255
|
||||||
|
221 25 29 255
|
||||||
|
222 222 222 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
224 133 0 255
|
||||||
|
250 125 0 255
|
||||||
|
250 162 0 255
|
||||||
|
250 133 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
26 35 126 255
|
||||||
|
29 38 138 255
|
||||||
|
32 41 150 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
78 52 46 255
|
||||||
|
93 64 55 255
|
||||||
|
109 76 65 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
250 8 219 255
|
||||||
|
250 86 229 255
|
||||||
|
250 202 244 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
102 50 63 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
67
data/gfx/player/player2_invencible.pal
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
JASC-PAL
|
||||||
|
0100
|
||||||
|
64
|
||||||
|
0 0 0 0
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
189 189 189 255
|
||||||
|
224 224 224 255
|
||||||
|
255 255 255 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 235 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
204 204 204 255
|
||||||
|
255 255 255 255
|
||||||
|
255 255 255 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
170 170 170 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
0 0 0 255
|
||||||
|
Before Width: | Height: | Size: 174 B |
@@ -407,16 +407,16 @@ void Director::setFileList()
|
|||||||
|
|
||||||
// Texturas - Jugador 1
|
// Texturas - Jugador 1
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player1.gif", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/player/player1.gif", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player1_1_coffee_palette.gif", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/gfx/player/player1_coffee1.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player1_2_coffee_palette.gif", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/gfx/player/player1_coffee2.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player1_invencible_palette.gif", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/gfx/player/player1_invencible.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player1_power.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/player/player1_power.png", AssetType::BITMAP);
|
||||||
|
|
||||||
// Texturas - Jugador 2
|
// Texturas - Jugador 2
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player2.gif", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/player/player2.gif", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player2_1_coffee_palette.gif", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/gfx/player/player2_coffee1.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player2_2_coffee_palette.gif", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/gfx/player/player2_coffee2.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player2_invencible_palette.gif", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/gfx/player/player2_invencible.pal", AssetType::PALETTE);
|
||||||
Asset::get()->add(prefix + "/data/gfx/player/player2_power.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/gfx/player/player2_power.png", AssetType::BITMAP);
|
||||||
|
|
||||||
// Animaciones del jugador
|
// Animaciones del jugador
|
||||||
@@ -428,8 +428,8 @@ void Director::setFileList()
|
|||||||
Asset::get()->add(prefix + "/data/font/8bithud.txt", AssetType::FONT);
|
Asset::get()->add(prefix + "/data/font/8bithud.txt", AssetType::FONT);
|
||||||
Asset::get()->add(prefix + "/data/font/aseprite.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/font/aseprite.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/font/aseprite.txt", AssetType::FONT);
|
Asset::get()->add(prefix + "/data/font/aseprite.txt", AssetType::FONT);
|
||||||
Asset::get()->add(prefix + "/data/font/smb2.gif", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/font/smb2.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/font/smb2_palette1.pal", AssetType::PALETTE);
|
Asset::get()->add(prefix + "/data/font/smb2_grad.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/font/smb2.txt", AssetType::FONT);
|
Asset::get()->add(prefix + "/data/font/smb2.txt", AssetType::FONT);
|
||||||
Asset::get()->add(prefix + "/data/font/04b_25.png", AssetType::BITMAP);
|
Asset::get()->add(prefix + "/data/font/04b_25.png", AssetType::BITMAP);
|
||||||
Asset::get()->add(prefix + "/data/font/04b_25.txt", AssetType::FONT);
|
Asset::get()->add(prefix + "/data/font/04b_25.txt", AssetType::FONT);
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ void Player::setPlayingState(PlayerState state)
|
|||||||
player_sprite_->setAccelY(0.2f);
|
player_sprite_->setAccelY(0.2f);
|
||||||
player_sprite_->setVelY(-4.0f);
|
player_sprite_->setVelY(-4.0f);
|
||||||
player_sprite_->setVelX(0.0f);
|
player_sprite_->setVelX(0.0f);
|
||||||
player_sprite_->setCurrentAnimation("dying");
|
player_sprite_->setCurrentAnimation("rolling");
|
||||||
player_sprite_->setAnimationSpeed(5);
|
player_sprite_->setAnimationSpeed(5);
|
||||||
setScoreboardMode(ScoreboardMode::GAME_OVER);
|
setScoreboardMode(ScoreboardMode::GAME_OVER);
|
||||||
playSound("voice_aw_aw_aw.wav");
|
playSound("voice_aw_aw_aw.wav");
|
||||||
|
|||||||
@@ -279,17 +279,14 @@ void Resource::addPalettes()
|
|||||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> PALETTES");
|
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "\n>> PALETTES");
|
||||||
|
|
||||||
// Paletas para el jugador 1
|
// Paletas para el jugador 1
|
||||||
getTexture("player1.gif")->addPaletteFromFile(Asset::get()->get("player1_1_coffee_palette.gif"));
|
getTexture("player1.gif")->addPaletteFromPalFile(Asset::get()->get("player1_coffee1.pal"));
|
||||||
getTexture("player1.gif")->addPaletteFromFile(Asset::get()->get("player1_2_coffee_palette.gif"));
|
getTexture("player1.gif")->addPaletteFromPalFile(Asset::get()->get("player1_coffee2.pal"));
|
||||||
getTexture("player1.gif")->addPaletteFromFile(Asset::get()->get("player1_invencible_palette.gif"));
|
getTexture("player1.gif")->addPaletteFromPalFile(Asset::get()->get("player1_invencible.pal"));
|
||||||
|
|
||||||
// Paletas para el jugador 2
|
// Paletas para el jugador 2
|
||||||
getTexture("player2.gif")->addPaletteFromFile(Asset::get()->get("player2_1_coffee_palette.gif"));
|
getTexture("player2.gif")->addPaletteFromPalFile(Asset::get()->get("player2_coffee1.pal"));
|
||||||
getTexture("player2.gif")->addPaletteFromFile(Asset::get()->get("player2_2_coffee_palette.gif"));
|
getTexture("player2.gif")->addPaletteFromPalFile(Asset::get()->get("player2_coffee2.pal"));
|
||||||
getTexture("player2.gif")->addPaletteFromFile(Asset::get()->get("player2_invencible_palette.gif"));
|
getTexture("player2.gif")->addPaletteFromPalFile(Asset::get()->get("player2_invencible.pal"));
|
||||||
|
|
||||||
// Paleta para la fuente SMB2
|
|
||||||
getTexture("smb2.gif")->addPaletteFromFile(Asset::get()->get("smb2_palette1.pal"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Crea texturas a partir de textos para mostrar puntuaciones y mensajes
|
// Crea texturas a partir de textos para mostrar puntuaciones y mensajes
|
||||||
@@ -365,7 +362,8 @@ void Resource::createText()
|
|||||||
{"04b_25_reversed_2x", "04b_25_reversed_2x.png", "04b_25_2x.txt"},
|
{"04b_25_reversed_2x", "04b_25_reversed_2x.png", "04b_25_2x.txt"},
|
||||||
{"8bithud", "8bithud.png", "8bithud.txt"},
|
{"8bithud", "8bithud.png", "8bithud.txt"},
|
||||||
{"aseprite", "aseprite.png", "aseprite.txt"},
|
{"aseprite", "aseprite.png", "aseprite.txt"},
|
||||||
{"smb2", "smb2.gif", "smb2.txt"}};
|
{"smb2", "smb2.png", "smb2.txt"},
|
||||||
|
{"smb2_grad", "smb2_grad.png", "smb2.txt"}};
|
||||||
|
|
||||||
for (const auto &resource : resources)
|
for (const auto &resource : resources)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -166,6 +166,7 @@ void Credits::checkInput()
|
|||||||
void Credits::fillTextTexture()
|
void Credits::fillTextTexture()
|
||||||
{
|
{
|
||||||
auto text = Resource::get()->getText("smb2");
|
auto text = Resource::get()->getText("smb2");
|
||||||
|
auto text_grad = Resource::get()->getText("smb2_grad");
|
||||||
SDL_SetRenderTarget(Screen::get()->getRenderer(), text_texture_);
|
SDL_SetRenderTarget(Screen::get()->getRenderer(), text_texture_);
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 0);
|
SDL_SetRenderDrawColor(Screen::get()->getRenderer(), 0, 0, 0, 0);
|
||||||
@@ -190,24 +191,18 @@ void Credits::fillTextTexture()
|
|||||||
|
|
||||||
int y = (param.game.height - TEXTS_HEIGHT) / 2;
|
int y = (param.game.height - TEXTS_HEIGHT) / 2;
|
||||||
y = 0;
|
y = 0;
|
||||||
text->setPalette(1);
|
text_grad->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(0), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(0), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
|
||||||
|
|
||||||
text->setPalette(0);
|
|
||||||
y += SPACE_POST_TITLE;
|
y += SPACE_POST_TITLE;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(4), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(4), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
|
|
||||||
y += SPACE_PRE_TITLE;
|
y += SPACE_PRE_TITLE;
|
||||||
text->setPalette(1);
|
text_grad->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(1), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(1), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
|
||||||
text->setPalette(0);
|
|
||||||
y += SPACE_POST_TITLE;
|
y += SPACE_POST_TITLE;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(4), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(4), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
|
|
||||||
y += SPACE_PRE_TITLE;
|
y += SPACE_PRE_TITLE;
|
||||||
text->setPalette(1);
|
text_grad->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(2), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(2), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
|
||||||
text->setPalette(0);
|
|
||||||
|
|
||||||
y += SPACE_POST_TITLE;
|
y += SPACE_POST_TITLE;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(5), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(5), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
@@ -215,9 +210,7 @@ void Credits::fillTextTexture()
|
|||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(6), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(6), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
|
|
||||||
y += SPACE_PRE_TITLE;
|
y += SPACE_PRE_TITLE;
|
||||||
text->setPalette(1);
|
text_grad->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(3), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(3), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
|
||||||
text->setPalette(0);
|
|
||||||
y += SPACE_POST_TITLE;
|
y += SPACE_POST_TITLE;
|
||||||
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(7), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
text->writeDX(TEXT_CENTER | TEXT_SHADOW, param.game.game_area.center_x, y, TEXTS.at(7), 1, NO_TEXT_COLOR, 1, SHADOW_TEXT_COLOR);
|
||||||
y += SPACE_POST_TITLE;
|
y += SPACE_POST_TITLE;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
Title::Title()
|
Title::Title()
|
||||||
: text_(Resource::get()->getText("smb2")),
|
: text_(Resource::get()->getText("smb2_grad")),
|
||||||
fade_(std::make_unique<Fade>()),
|
fade_(std::make_unique<Fade>()),
|
||||||
tiled_bg_(std::make_unique<TiledBG>(param.game.game_area.rect, TiledBGMode::RANDOM)),
|
tiled_bg_(std::make_unique<TiledBG>(param.game.game_area.rect, TiledBGMode::RANDOM)),
|
||||||
game_logo_(std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position)),
|
game_logo_(std::make_unique<GameLogo>(param.game.game_area.center_x, param.title.title_c_c_position)),
|
||||||
@@ -43,7 +43,6 @@ Title::Title()
|
|||||||
fade_->setColor(param.fade.color);
|
fade_->setColor(param.fade.color);
|
||||||
fade_->setType(FadeType::RANDOM_SQUARE);
|
fade_->setType(FadeType::RANDOM_SQUARE);
|
||||||
fade_->setPostDuration(param.fade.post_duration);
|
fade_->setPostDuration(param.fade.post_duration);
|
||||||
Resource::get()->getTexture("smb2.gif")->setPalette(1);
|
|
||||||
|
|
||||||
// Asigna valores a otras variables
|
// Asigna valores a otras variables
|
||||||
Section::options = Section::Options::TITLE_1;
|
Section::options = Section::Options::TITLE_1;
|
||||||
@@ -60,7 +59,6 @@ Title::Title()
|
|||||||
// Destructor
|
// Destructor
|
||||||
Title::~Title()
|
Title::~Title()
|
||||||
{
|
{
|
||||||
Resource::get()->getTexture("smb2.gif")->setPalette(0);
|
|
||||||
Audio::get()->stopAllSounds();
|
Audio::get()->stopAllSounds();
|
||||||
if (Section::name == Section::Name::LOGO)
|
if (Section::name == Section::Name::LOGO)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,8 +8,11 @@
|
|||||||
#include <fstream> // Para basic_ifstream, basic_ios, ios, operator|
|
#include <fstream> // Para basic_ifstream, basic_ios, ios, operator|
|
||||||
#include <stdexcept> // Para runtime_error
|
#include <stdexcept> // Para runtime_error
|
||||||
#include <string> // Para operator+, char_traits, string, operat...
|
#include <string> // Para operator+, char_traits, string, operat...
|
||||||
|
#include <fstream> // Para basic_ifstream, basic_ostream, basic_ist...
|
||||||
|
#include <iostream> // Para cerr
|
||||||
|
#include <sstream> // Para basic_istringstream
|
||||||
#include <vector> // Para vector
|
#include <vector> // Para vector
|
||||||
#include "external/gif.h" // Para Gif
|
#include "external/gif.h" // Para Gif
|
||||||
#include "stb_image.h" // Para stbi_image_free, stbi_load, STBI_rgb_a...
|
#include "stb_image.h" // Para stbi_image_free, stbi_load, STBI_rgb_a...
|
||||||
#include "utils.h" // Para getFileName, Color, printWithDots
|
#include "utils.h" // Para getFileName, Color, printWithDots
|
||||||
|
|
||||||
@@ -37,7 +40,7 @@ Texture::Texture(SDL_Renderer *renderer, const std::string &path)
|
|||||||
surface_ = loadSurface(path_);
|
surface_ = loadSurface(path_);
|
||||||
|
|
||||||
// Añade la propia paleta del fichero a la lista
|
// Añade la propia paleta del fichero a la lista
|
||||||
addPaletteFromFile(path_);
|
addPaletteFromGifFile(path_);
|
||||||
|
|
||||||
// Crea la textura, establece el BlendMode y copia la surface a la textura
|
// Crea la textura, establece el BlendMode y copia la surface a la textura
|
||||||
createBlank(width_, height_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING);
|
createBlank(width_, height_, SDL_PIXELFORMAT_RGBA8888, SDL_TEXTUREACCESS_STREAMING);
|
||||||
@@ -316,9 +319,9 @@ void Texture::setPaletteColor(int palette, int index, Uint32 color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Carga una paleta desde un fichero
|
// Carga una paleta desde un fichero
|
||||||
std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
Palette Texture::loadPaletteFromFile(const std::string &file_path)
|
||||||
{
|
{
|
||||||
std::vector<Uint32> palette;
|
Palette palette;
|
||||||
|
|
||||||
// Abrir el archivo GIF
|
// Abrir el archivo GIF
|
||||||
std::ifstream file(file_path, std::ios::binary | std::ios::ate);
|
std::ifstream file(file_path, std::ios::binary | std::ios::ate);
|
||||||
@@ -353,9 +356,9 @@ std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Modificar la conversión para obtener formato RGBA (0xRRGGBBAA)
|
// Modificar la conversión para obtener formato RGBA (0xRRGGBBAA)
|
||||||
for (const auto &color : pal)
|
for (size_t i = 0; i < pal.size() && i < palette.size(); ++i)
|
||||||
{
|
{
|
||||||
palette.push_back((color << 8) | 0xFF); // Resultado: 0xRRGGBBAA
|
palette[i] = (pal[i] << 8) | 0xFF; // Resultado: 0xRRGGBBAA
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "Paleta cargada correctamente desde %s", file_path.c_str());
|
SDL_LogInfo(SDL_LOG_CATEGORY_TEST, "Paleta cargada correctamente desde %s", file_path.c_str());
|
||||||
@@ -363,16 +366,23 @@ std::vector<Uint32> Texture::loadPaletteFromFile(const std::string &file_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Añade una paleta a la lista
|
// Añade una paleta a la lista
|
||||||
void Texture::addPaletteFromFile(const std::string &path)
|
void Texture::addPaletteFromGifFile(const std::string &path)
|
||||||
{
|
{
|
||||||
palettes_.emplace_back(loadPaletteFromFile(path));
|
palettes_.emplace_back(loadPaletteFromFile(path));
|
||||||
setPaletteColor((int)palettes_.size() - 1, 0, 0x00000000);
|
setPaletteColor(palettes_.size() - 1, 0, 0x00000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Añade una paleta a la lista
|
||||||
|
void Texture::addPaletteFromPalFile(const std::string &path)
|
||||||
|
{
|
||||||
|
palettes_.emplace_back(readPalFile(path));
|
||||||
|
setPaletteColor(palettes_.size() - 1, 0, 0x00000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cambia la paleta de la textura
|
// Cambia la paleta de la textura
|
||||||
void Texture::setPalette(int palette)
|
void Texture::setPalette(size_t palette)
|
||||||
{
|
{
|
||||||
if (palette < (int)palettes_.size())
|
if (palette < palettes_.size())
|
||||||
{
|
{
|
||||||
current_palette_ = palette;
|
current_palette_ = palette;
|
||||||
flipSurface();
|
flipSurface();
|
||||||
@@ -381,3 +391,50 @@ void Texture::setPalette(int palette)
|
|||||||
|
|
||||||
// Obtiene el renderizador
|
// Obtiene el renderizador
|
||||||
SDL_Renderer *Texture::getRenderer() { return renderer_; }
|
SDL_Renderer *Texture::getRenderer() { return renderer_; }
|
||||||
|
|
||||||
|
// Carga una paleta desde un archivo .pal
|
||||||
|
Palette Texture::readPalFile(const std::string &file_path)
|
||||||
|
{
|
||||||
|
Palette palette{};
|
||||||
|
palette.fill(0); // Inicializar todo con 0 (transparente por defecto)
|
||||||
|
|
||||||
|
std::ifstream file(file_path);
|
||||||
|
if (!file.is_open())
|
||||||
|
{
|
||||||
|
throw std::runtime_error("No se pudo abrir el archivo .pal");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string line;
|
||||||
|
int line_number = 0;
|
||||||
|
int color_index = 0;
|
||||||
|
|
||||||
|
while (std::getline(file, line))
|
||||||
|
{
|
||||||
|
++line_number;
|
||||||
|
|
||||||
|
// Ignorar las tres primeras líneas del archivo
|
||||||
|
if (line_number <= 3)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Procesar las líneas restantes con valores RGB
|
||||||
|
std::istringstream ss(line);
|
||||||
|
int r, g, b;
|
||||||
|
if (ss >> r >> g >> b)
|
||||||
|
{
|
||||||
|
// Construir el color RGBA (A = 255 por defecto)
|
||||||
|
Uint32 color = (r << 24) | (g << 16) | (b << 8) | 255;
|
||||||
|
palette[color_index++] = color;
|
||||||
|
|
||||||
|
// Limitar a un máximo de 256 colores (opcional)
|
||||||
|
if (color_index >= 256)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file.close();
|
||||||
|
return palette;
|
||||||
|
}
|
||||||
@@ -12,6 +12,9 @@
|
|||||||
|
|
||||||
struct Color;
|
struct Color;
|
||||||
|
|
||||||
|
// Alias
|
||||||
|
using Palette = std::array<Uint32, 256>;
|
||||||
|
|
||||||
// Definición de Surface para imágenes con paleta
|
// Definición de Surface para imágenes con paleta
|
||||||
struct Surface
|
struct Surface
|
||||||
{
|
{
|
||||||
@@ -47,9 +50,10 @@ public:
|
|||||||
void setAlpha(Uint8 alpha); // Establece el alpha para la modulación
|
void setAlpha(Uint8 alpha); // Establece el alpha para la modulación
|
||||||
|
|
||||||
// --- Paletas ---
|
// --- Paletas ---
|
||||||
void addPaletteFromFile(const std::string &path); // Añade una paleta a la lista
|
void addPaletteFromGifFile(const std::string &path); // Añade una paleta a la lista
|
||||||
|
void addPaletteFromPalFile(const std::string &path); // Añade una paleta a la lista
|
||||||
void setPaletteColor(int palette, int index, Uint32 color); // Establece un color de la paleta
|
void setPaletteColor(int palette, int index, Uint32 color); // Establece un color de la paleta
|
||||||
void setPalette(int palette); // Cambia la paleta de la textura
|
void setPalette(size_t palette); // Cambia la paleta de la textura
|
||||||
|
|
||||||
// --- Getters ---
|
// --- Getters ---
|
||||||
int getWidth(); // Obtiene el ancho de la imagen
|
int getWidth(); // Obtiene el ancho de la imagen
|
||||||
@@ -64,16 +68,17 @@ private:
|
|||||||
std::shared_ptr<Surface> surface_ = nullptr; // Surface para usar imágenes en formato gif con paleta
|
std::shared_ptr<Surface> surface_ = nullptr; // Surface para usar imágenes en formato gif con paleta
|
||||||
|
|
||||||
// --- Variables ---
|
// --- Variables ---
|
||||||
std::string path_; // Ruta de la imagen de la textura
|
std::string path_; // Ruta de la imagen de la textura
|
||||||
int width_ = 0; // Ancho de la imagen
|
int width_ = 0; // Ancho de la imagen
|
||||||
int height_ = 0; // Alto de la imagen
|
int height_ = 0; // Alto de la imagen
|
||||||
std::vector<std::vector<Uint32>> palettes_; // Vector con las diferentes paletas
|
std::vector<Palette> palettes_; // Vector con las diferentes paletas
|
||||||
int current_palette_ = 0; // Índice de la paleta en uso
|
int current_palette_ = 0; // Índice de la paleta en uso
|
||||||
|
|
||||||
// --- Métodos internos ---
|
// --- Métodos internos ---
|
||||||
std::shared_ptr<Surface> loadSurface(const std::string &file_name); // Crea una surface desde un fichero .gif
|
std::shared_ptr<Surface> loadSurface(const std::string &file_name); // Crea una surface desde un fichero .gif
|
||||||
void flipSurface(); // Vuelca la surface en la textura
|
void flipSurface(); // Vuelca la surface en la textura
|
||||||
std::vector<Uint32> loadPaletteFromFile(const std::string &file_name); // Carga una paleta desde un fichero
|
Palette loadPaletteFromFile(const std::string &file_name); // Carga una paleta desde un fichero
|
||||||
void unloadTexture(); // Libera la memoria de la textura
|
void unloadTexture(); // Libera la memoria de la textura
|
||||||
void unloadSurface(); // Libera la surface actual
|
void unloadSurface(); // Libera la surface actual
|
||||||
|
Palette readPalFile(const std::string &file_path); // Carga una paleta desde un archivo .pal
|
||||||
};
|
};
|
||||||