Files
volcano_2022/source/volcano.h

182 lines
4.0 KiB
C++

#pragma once
#ifndef VOLCANO_H
#define VOLCANO_H
#include "ifdefs.h"
#include "jail_audio.h"
#include "const.h"
#include "ltexture.h"
#include "director.h"
/*
struct Tanimation
{
bool loops; // Salta a true cuando se reinicia la animación
Uint16 timer; // Temporizador de la animación
Uint8 frame[50]; // Vector con ....
Uint8 index; // Frame actual
Uint8 num_frames; // Cantidad de frames de la animación
Uint8 speed; // Velocidad de la animación
};
struct Tprogram
{
bool debug;
bool filter;
bool music_enabled; //
LTexture *sprite;
SDL_Rect dst_rect;
SDL_Rect src_rect;
Uint8 section;
};
struct Tgame
{
bool enabled;
JA_Sound sound_drop_enemy;
JA_Sound sound_drop_splat;
JA_Music music;
Uint8 zone; // Zona en la que estamos
};
struct Tmenu
{
bool enabled;
int frame;
int timer;
LTexture *sprite_animation;
LTexture *sprite;
JA_Sound sound_logo;
JA_Sound sound_start;
JA_Music music;
SDL_Rect dst_rect_animation;
SDL_Rect dst_rect_fondo;
SDL_Rect dst_rect_logo_zoom;
SDL_Rect dst_rect_logo;
SDL_Rect dst_rect_text;
SDL_Rect dst_rect_text2;
SDL_Rect src_rect_animation;
SDL_Rect src_rect_fondo;
SDL_Rect src_rect_logo;
SDL_Rect src_rect_text;
SDL_Rect src_rect_text2;
Tanimation animation[2];
Uint8 section;
};
struct Tactor
{
bool enabled;
Uint8 frame;
int speed_x;
int speed_y; // Velocidad = cantidad de pixeles a desplazarse
int timer;
SDL_Rect dst_rect;
SDL_Rect src_rect;
Uint8 direction; // Sentido del desplazamiento
Uint8 id;
Uint8 kind; // Tipo de actor: enemigo, moneda, llave, plataforma ...
Uint8 parent; // Indice al padre del actor
};
struct Tanimated_tile
{
bool enabled;
Uint8 index;
int x;
int y;
Uint8 frame;
};
struct Thud
{
LTexture *sprite;
SDL_Rect src_rect;
SDL_Rect dst_rect;
SDL_Rect num_src_rect;
SDL_Rect num_dst_rect;
SDL_Rect bignum_src_rect;
SDL_Rect bignum_dst_rect;
};
struct Tmap
{
LTexture *sprite_tile;
LTexture *sprite_actor;
LTexture *background;
SDL_Rect src_rect;
SDL_Rect dst_rect;
Uint8 *tile;
Uint8 *actor;
Uint8 w;
Uint8 h;
Uint8 room;
};
bool fullscreen;
bool quit;
const Uint8 *keys;
SDL_Event *event;
SDL_Renderer *renderer;
SDL_Window *window;
std::string executablePath;
Tactor actor[MAX_ACTORS];
Tanimated_tile animated_tile[MAX_ANIMATED_TILES];
Tgame game;
Thud hud;
Tmap map;
Tmenu menu;
Tprogram prog;
Uint32 delta_time;
bool CheckZoneChange(int room);
bool loadTextureFromFile(LTexture *texture, std::string path, SDL_Renderer *renderer);
bool OnFloor();
Uint8 GetActor(Uint8 x, Uint8 y);
Uint8 GetTile(Uint8 x, Uint8 y);
Uint8 ReadMapTile(Uint8 x, Uint8 y);
void allocatePointers();
void Animate(Tanimation &a, SDL_Rect &s);
void AnimateIntroMenu(Tanimation &a, SDL_Rect &s);
void ApplyGravity();
void CheckPlayerCollisionWithActors();
void CheckPlayerCollisionWithActors();
void CheckPlayerCollisionWithMap();
void CloseMusic(JA_Music *music);
void ClosePicture(LTexture *picture);
void CloseSound(JA_Sound *sound);
void CreateActor(Tactor &a, Uint8 kind, Uint8 id, Sint16 dstx, Sint16 dsty, Sint16 dstw, Sint16 dsth, Sint16 srcx, Sint16 srcy, Sint16 sx, Sint16 sy, Sint16 timer, Sint16 frame, Uint8 direction, Uint8 parent);
void DrawHud();
void DrawMap();
void DrawSprite(LTexture *sprite, SDL_Rect src_rect, SDL_Rect dst_rect);
void EndGame();
void EndHud();
void EndMap();
void EndMenu();
void EndPlayer();
void EndProgram();
void IniActors();
void IniAnimatedTiles();
void IniGame(Uint8 zone);
void IniHud();
void IniMap();
void IniMenu();
void IniPlayer();
void IniProgram();
void KillPlayer();
void LoadMap();
void LoadRoom(int num);
void MoveActors();
void MovePlayer(int direction);
void SetActor(Uint8 x, Uint8 y, Uint8 valor);
void setExecutablePath(std::string path);
void SetMapGFX(Uint8 zone);
void SetMapMusic(Uint8 zone);
void SetPlayerAnimation(Uint8 anim);
void SetPlayerDirection(int direction);
void SetProgSection(Uint8 section);
void SetZone(int room);
*/
#endif