Añadidas mas funciones del código viejo
This commit is contained in:
@@ -136,41 +136,6 @@ const Uint8 MENU_SECTION_ANIMATION = 2;
|
||||
const Uint8 ZONE_SURFACE = 0;
|
||||
const Uint8 ZONE_VOLCANO = 1;
|
||||
|
||||
// Recursos
|
||||
const Uint8 FILE_MAP_VOLCANO = 0;
|
||||
const Uint8 FILE_CONFIG = 1;
|
||||
|
||||
const Uint8 TOTAL_FILE = 2;
|
||||
|
||||
const Uint8 TEXTURE_ACTORS = 0;
|
||||
const Uint8 TEXTURE_BKG_SURFACE = 1;
|
||||
const Uint8 TEXTURE_FILTER = 2;
|
||||
const Uint8 TEXTURE_HUD = 3;
|
||||
const Uint8 TEXTURE_MENU = 4;
|
||||
const Uint8 TEXTURE_MENU_ANIMATION = 5;
|
||||
const Uint8 TEXTURE_PLAYER = 6;
|
||||
const Uint8 TEXTURE_TILES_SURFACE = 7;
|
||||
const Uint8 TEXTURE_TILES_VOLCANO = 8;
|
||||
|
||||
const Uint8 TOTAL_TEXTURE = 9;
|
||||
|
||||
const Uint8 SOUND_COIN = 0;
|
||||
const Uint8 SOUND_DEATH = 1;
|
||||
const Uint8 SOUND_DROP_ENEMY = 2;
|
||||
const Uint8 SOUND_DROP_SPLAT = 3;
|
||||
const Uint8 SOUND_JUMP = 4;
|
||||
const Uint8 SOUND_MENU_LOGO = 5;
|
||||
const Uint8 SOUND_MENU_START = 6;
|
||||
|
||||
const Uint8 TOTAL_SOUND = 7;
|
||||
|
||||
const Uint8 MUSIC_MENU = 0;
|
||||
const Uint8 MUSIC_SURFACE = 1;
|
||||
const Uint8 MUSIC_VOLCANO = 2;
|
||||
|
||||
const Uint8 TOTAL_MUSIC = 3;
|
||||
|
||||
|
||||
///////////////////////////////COFFEE CRISIS//////////////////////////////////////////////
|
||||
|
||||
// Tamaño de la pantalla que se muestra
|
||||
|
||||
@@ -12,10 +12,8 @@ Director::Director(std::string path)
|
||||
|
||||
// Crea todos los objetos del juego
|
||||
eventHandler = new SDL_Event();
|
||||
// text.white = new Text("", nullptr, nullptr);
|
||||
screen = new Screen(window, renderer);
|
||||
asset = new Asset(path.substr(0, path.find_last_of("\\/")));
|
||||
|
||||
setFileList();
|
||||
|
||||
// Inicializa todas las variables
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#ifndef __MIPSEL__
|
||||
#include "jail_audio.h"
|
||||
#include "stb_vorbis.c"
|
||||
|
||||
@@ -77,7 +78,7 @@ void JA_Init(const int freq, const SDL_AudioFormat format, const int channels) {
|
||||
|
||||
JA_Music JA_LoadMusic(const char* filename) {
|
||||
int chan, samplerate;
|
||||
JA_Music music = (JA_Music)SDL_malloc(sizeof(JA_Music_t));
|
||||
JA_Music music = new JA_Music_t();
|
||||
music->samples = stb_vorbis_decode_filename(filename, &chan, &samplerate, &music->output);
|
||||
|
||||
SDL_AudioCVT cvt;
|
||||
@@ -129,8 +130,8 @@ JA_Music_state JA_GetMusicState() {
|
||||
|
||||
void JA_DeleteMusic(JA_Music music) {
|
||||
if (current_music == music) current_music = NULL;
|
||||
free(music->output);
|
||||
free(music);
|
||||
SDL_free(music->output);
|
||||
delete music;
|
||||
}
|
||||
|
||||
JA_Sound JA_LoadSound(const char* filename) {
|
||||
@@ -144,7 +145,7 @@ JA_Sound JA_LoadSound(const char* filename) {
|
||||
cvt.buf = (Uint8 *) SDL_malloc(cvt.len * cvt.len_mult);
|
||||
SDL_memcpy(cvt.buf, sound->buffer, sound->length);
|
||||
SDL_ConvertAudio(&cvt);
|
||||
free(sound->buffer);
|
||||
SDL_FreeWAV(sound->buffer);
|
||||
sound->buffer = cvt.buf;
|
||||
sound->length = cvt.len_cvt;
|
||||
|
||||
@@ -167,7 +168,7 @@ void JA_DeleteSound(JA_Sound sound) {
|
||||
for (int i = 0; i < JA_MAX_SIMULTANEOUS_CHANNELS; i++) {
|
||||
if (channels[i].sound == sound) JA_StopChannel(i);
|
||||
}
|
||||
SDL_FreeWAV(sound->buffer);
|
||||
SDL_free(sound->buffer);
|
||||
delete sound;
|
||||
}
|
||||
|
||||
@@ -209,4 +210,4 @@ JA_Channel_state JA_GetChannelState(const int channel) {
|
||||
if (channel < 0 || channel >= JA_MAX_SIMULTANEOUS_CHANNELS) return JA_CHANNEL_INVALID;
|
||||
return channels[channel].state;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@ Map::Map(SDL_Renderer *renderer, std::string file, Asset *asset)
|
||||
|
||||
loadTextureFromFile(texture_tile, asset->get("tiles_volcano.png"), renderer);
|
||||
loadTextureFromFile(texture_actor, asset->get("actors.png"), renderer);
|
||||
loadTextureFromFile(texture_bg, asset->get("bkg_surface.png"), renderer);
|
||||
loadTextureFromFile(texture_bg, asset->get("bg_surface.png"), renderer);
|
||||
|
||||
sprite_tile = new AnimatedSprite(texture_tile, renderer);
|
||||
sprite_actor = new AnimatedSprite(texture_actor, renderer);
|
||||
|
||||
@@ -35,10 +35,6 @@ Player::Player(SDL_Renderer *renderer, Asset *asset)
|
||||
speed_x = 0;
|
||||
speed_y = 0;
|
||||
|
||||
sound_coin = 0;
|
||||
sound_death = 0;
|
||||
sound_jump = 0;
|
||||
|
||||
active_animation = 0;
|
||||
direction = 0;
|
||||
lifes = 0;
|
||||
|
||||
Reference in New Issue
Block a user