Preparation for different types of terrain

This commit is contained in:
zv0n 2021-04-30 09:10:58 +02:00
parent 5562ca4d82
commit 1927b71629
9 changed files with 175 additions and 134 deletions

View File

@ -2,6 +2,35 @@
#include "global_vars.hpp" #include "global_vars.hpp"
#include "objectids.hpp" #include "objectids.hpp"
#include "sprites.hpp" #include "sprites.hpp"
#include <unordered_map>
const std::vector< uint64_t > possibleBlocks = { FLOOR_ID,
HILL_INCLINE_ID,
HILL_DECLINE_ID,
HILL_DOTS_RIGHT_ID,
HILL_DOTS_LEFT_ID,
HILL_FILL_ID,
HILL_TOP_ID,
BUSH_LEFT_ID,
BUSH_MIDDLE_ID,
BUSH_RIGHT_ID,
CLOUD_LEFT_BOTTOM_ID,
CLOUD_MIDDLE_BOTTOM_ID,
CLOUD_RIGHT_BOTTOM_ID,
CLOUD_LEFT_TOP_ID,
CLOUD_MIDDLE_TOP_ID,
CLOUD_RIGHT_TOP_ID };
const std::unordered_map<uint64_t, const SDL_Rect*> block_mapping = {
{FLOOR_ID, &FLOOR_SRC}, {HILL_INCLINE_ID, &HILL_INCLINE_SRC},
{HILL_DECLINE_ID, &HILL_DECLINE_SRC}, {HILL_DOTS_RIGHT_ID, &HILL_DOTS_RIGHT_SRC},
{HILL_DOTS_LEFT_ID, &HILL_DOTS_LEFT_SRC}, {HILL_FILL_ID, &HILL_FILL_SRC},
{HILL_TOP_ID, &HILL_TOP_SRC}, {BUSH_LEFT_ID, &BUSH_LEFT_SRC}, {BUSH_MIDDLE_ID, &BUSH_MIDDLE_SRC},
{BUSH_RIGHT_ID, &BUSH_RIGHT_SRC}, {CLOUD_LEFT_BOTTOM_ID, &CLOUD_LEFT_BOTTOM_SRC},
{CLOUD_MIDDLE_BOTTOM_ID, &CLOUD_MIDDLE_BOTTOM_SRC}, {CLOUD_RIGHT_BOTTOM_ID, &CLOUD_RIGHT_BOTTOM_SRC},
{CLOUD_LEFT_TOP_ID, &CLOUD_LEFT_TOP_SRC}, {CLOUD_MIDDLE_TOP_ID, &CLOUD_MIDDLE_TOP_SRC},
{CLOUD_RIGHT_TOP_ID, &CLOUD_RIGHT_TOP_SRC}
};
std::shared_ptr< SDLPP::RectangleRender > std::shared_ptr< SDLPP::RectangleRender >
createBlock( std::shared_ptr< SDLPP::Renderer > &renderer, double x, double y, createBlock( std::shared_ptr< SDLPP::Renderer > &renderer, double x, double y,
@ -17,55 +46,43 @@ createBlock( std::shared_ptr< SDLPP::Renderer > &renderer, double x, double y,
return block; return block;
} }
SDL_Rect getSourceRectByID( uint64_t id ) { SDL_Rect getSourceRectByID( uint64_t id, BlockType type ) {
switch ( id ) { if(block_mapping.find(id) == block_mapping.end())
case FLOOR_OVERWORLD_ID:
return FLOOR_OVERWORLD_SRC;
case HILL_OVERWORLD_INCLINE_ID:
return HILL_OVERWORLD_INCLINE_SRC;
case HILL_OVERWORLD_DECLINE_ID:
return HILL_OVERWORLD_DECLINE_SRC;
case HILL_OVERWORLD_DOTS_RIGHT_ID:
return HILL_OVERWORLD_DOTS_RIGHT_SRC;
case HILL_OVERWORLD_DOTS_LEFT_ID:
return HILL_OVERWORLD_DOTS_LEFT_SRC;
case HILL_OVERWORLD_FILL_ID:
return HILL_OVERWORLD_FILL_SRC;
case HILL_OVERWORLD_TOP_ID:
return HILL_OVERWORLD_TOP_SRC;
case BUSH_OVERWORLD_LEFT_ID:
return BUSH_OVERWORLD_LEFT_SRC;
case BUSH_OVERWORLD_MIDDLE_ID:
return BUSH_OVERWORLD_MIDDLE_SRC;
case BUSH_OVERWORLD_RIGHT_ID:
return BUSH_OVERWORLD_RIGHT_SRC;
case CLOUD_OVERWORLD_LEFT_BOTTOM_ID:
return CLOUD_OVERWORLD_LEFT_BOTTOM_SRC;
case CLOUD_OVERWORLD_MIDDLE_BOTTOM_ID:
return CLOUD_OVERWORLD_MIDDLE_BOTTOM_SRC;
case CLOUD_OVERWORLD_RIGHT_BOTTOM_ID:
return CLOUD_OVERWORLD_RIGHT_BOTTOM_SRC;
case CLOUD_OVERWORLD_LEFT_TOP_ID:
return CLOUD_OVERWORLD_LEFT_TOP_SRC;
case CLOUD_OVERWORLD_MIDDLE_TOP_ID:
return CLOUD_OVERWORLD_MIDDLE_TOP_SRC;
case CLOUD_OVERWORLD_RIGHT_TOP_ID:
return CLOUD_OVERWORLD_RIGHT_TOP_SRC;
}
return {}; return {};
SDL_Rect ret_src = *block_mapping.at(id);
switch ( type ) {
case OVERWORLD:
ret_src.x += OVERWORLD_SHIFT.getX();
ret_src.y += OVERWORLD_SHIFT.getY();
break;
case UNDERWORLD:
ret_src.x += UNDERWORLD_SHIFT.getX();
ret_src.y += UNDERWORLD_SHIFT.getY();
break;
case WATER:
ret_src.x += WATER_SHIFT.getX();
ret_src.y += WATER_SHIFT.getY();
break;
case BOWSER:
ret_src.x += BOWSER_SHIFT.getX();
ret_src.y += BOWSER_SHIFT.getY();
break;
}
return ret_src;
} }
std::shared_ptr< SDLPP::RectangleRender > std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, createTerrainBlock( uint64_t block_id, BlockType type,
std::shared_ptr< SDLPP::Renderer > &renderer, double x, std::shared_ptr< SDLPP::Renderer > &renderer, double x,
double y, bool collision ) { double y, bool collision ) {
return createBlock( renderer, x, y, g_terrain_texture, return createBlock( renderer, x, y, g_terrain_texture,
getSourceRectByID( block_id ), block_id, collision ); getSourceRectByID( block_id, type ), block_id,
collision );
} }
std::shared_ptr< SDLPP::RectangleRender > std::shared_ptr< SDLPP::RectangleRender >
createTerrainBlock( uint64_t block_id, createTerrainBlock( uint64_t block_id, BlockType type,
std::shared_ptr< SDLPP::Renderer > &renderer, std::shared_ptr< SDLPP::Renderer > &renderer,
bool collision ) { bool collision ) {
return createTerrainBlock( block_id, renderer, 0, 0, collision ); return createTerrainBlock( block_id, type, renderer, 0, 0, collision );
} }

View File

@ -4,7 +4,16 @@
#include "../sdlpp/sdlpp_rectrenderer.hpp" #include "../sdlpp/sdlpp_rectrenderer.hpp"
#include <memory> #include <memory>
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, std::shared_ptr<SDLPP::Renderer> &renderer, bool collision = false ); extern const std::vector<uint64_t> possibleBlocks;
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, std::shared_ptr<SDLPP::Renderer> &renderer, double x, double y, bool collision = false );
enum BlockType {
OVERWORLD = 0,
UNDERWORLD = 1,
WATER = 2,
BOWSER = 3
};
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, bool collision = false );
std::shared_ptr<SDLPP::RectangleRender> createTerrainBlock( uint64_t block_id, BlockType type, std::shared_ptr<SDLPP::Renderer> &renderer, double x, double y, bool collision = false );
#endif #endif

View File

@ -201,8 +201,8 @@ int main() {
renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY ); renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
mario = std::make_shared< SDLPP::RectangleRender >( mario = std::make_shared< SDLPP::RectangleRender >(
0, 0, BLOCK_SIZE, BLOCK_SIZE, renderer, mario_texture, 0, 0, BLOCK_SIZE, BLOCK_SIZE, renderer, mario_texture,
MARIO_OVERWORLD_STANDING_SRC ); MARIO_STANDING_SRC );
mario->setAnimationFrames( MARIO_OVERWORLD_WALK_ANIM ); mario->setAnimationFrames( MARIO_WALK_ANIM );
mario->setId( 2 ); mario->setId( 2 );
mario->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER ); mario->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
mario->setAnimationSpeed( 12.5 ); mario->setAnimationSpeed( 12.5 );

View File

@ -5,45 +5,45 @@
#include "blocks.hpp" #include "blocks.hpp"
#include "objectids.hpp" #include "objectids.hpp"
std::shared_ptr<SDLPP::RectangleRender> decodeObject( char obj, double x, double y, std::shared_ptr<SDLPP::Renderer> &renderer) { std::shared_ptr<SDLPP::RectangleRender> decodeObject( char obj, BlockType type, double x, double y, std::shared_ptr<SDLPP::Renderer> &renderer) {
switch(obj) { switch(obj) {
case 'F': case 'F':
return createTerrainBlock(FLOOR_OVERWORLD_ID, renderer, x, y, true); return createTerrainBlock(FLOOR_ID, type, renderer, x, y, true);
case 'I': case 'I':
return createTerrainBlock(HILL_OVERWORLD_INCLINE_ID, renderer, x, y); return createTerrainBlock(HILL_INCLINE_ID, type, renderer, x, y);
case 'R': case 'R':
return createTerrainBlock(HILL_OVERWORLD_DOTS_RIGHT_ID, renderer, x, y); return createTerrainBlock(HILL_DOTS_RIGHT_ID, type, renderer, x, y);
case 'G': case 'G':
return createTerrainBlock(HILL_OVERWORLD_FILL_ID, renderer, x, y); return createTerrainBlock(HILL_FILL_ID, type, renderer, x, y);
case 'L': case 'L':
return createTerrainBlock(HILL_OVERWORLD_DOTS_LEFT_ID, renderer, x, y); return createTerrainBlock(HILL_DOTS_LEFT_ID, type, renderer, x, y);
case 'D': case 'D':
return createTerrainBlock(HILL_OVERWORLD_DECLINE_ID, renderer, x, y); return createTerrainBlock(HILL_DECLINE_ID, type, renderer, x, y);
case 'T': case 'T':
return createTerrainBlock(HILL_OVERWORLD_TOP_ID, renderer, x, y); return createTerrainBlock(HILL_TOP_ID, type, renderer, x, y);
case 'q': case 'q':
return createTerrainBlock(BUSH_OVERWORLD_LEFT_ID, renderer, x, y); return createTerrainBlock(BUSH_LEFT_ID, type, renderer, x, y);
case 'w': case 'w':
return createTerrainBlock(BUSH_OVERWORLD_MIDDLE_ID, renderer, x, y); return createTerrainBlock(BUSH_MIDDLE_ID, type, renderer, x, y);
case 'r': case 'r':
return createTerrainBlock(BUSH_OVERWORLD_RIGHT_ID, renderer, x, y); return createTerrainBlock(BUSH_RIGHT_ID, type, renderer, x, y);
case 'a': case 'a':
return createTerrainBlock(CLOUD_OVERWORLD_LEFT_BOTTOM_ID, renderer, x, y); return createTerrainBlock(CLOUD_LEFT_BOTTOM_ID, type, renderer, x, y);
case 's': case 's':
return createTerrainBlock(CLOUD_OVERWORLD_MIDDLE_BOTTOM_ID, renderer, x, y); return createTerrainBlock(CLOUD_MIDDLE_BOTTOM_ID, type, renderer, x, y);
case 'd': case 'd':
return createTerrainBlock(CLOUD_OVERWORLD_RIGHT_BOTTOM_ID, renderer, x, y); return createTerrainBlock(CLOUD_RIGHT_BOTTOM_ID, type, renderer, x, y);
case 'z': case 'z':
return createTerrainBlock(CLOUD_OVERWORLD_LEFT_TOP_ID, renderer, x, y); return createTerrainBlock(CLOUD_LEFT_TOP_ID, type, renderer, x, y);
case 'x': case 'x':
return createTerrainBlock(CLOUD_OVERWORLD_MIDDLE_TOP_ID, renderer, x, y); return createTerrainBlock(CLOUD_MIDDLE_TOP_ID, type, renderer, x, y);
case 'c': case 'c':
return createTerrainBlock(CLOUD_OVERWORLD_RIGHT_TOP_ID, renderer, x, y); return createTerrainBlock(CLOUD_RIGHT_TOP_ID, type, renderer, x, y);
} }
return nullptr; return nullptr;
} }
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> &mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer) { void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer) {
std::fstream mapFile; std::fstream mapFile;
mapFile.open(file, std::ios::in); mapFile.open(file, std::ios::in);
std::string buffer; std::string buffer;
@ -63,12 +63,16 @@ void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::Rectan
cur_x += BLOCK_SIZE; cur_x += BLOCK_SIZE;
if(buffer[j] == ' ') if(buffer[j] == ' ')
continue; continue;
auto obj = decodeObject(buffer[j], cur_x, cur_y, renderer); auto obj = decodeObject(buffer[j], OVERWORLD, cur_x, cur_y, renderer);
if(obj != nullptr) if(obj != nullptr)
scene->addObject(obj); scene->addObject(obj);
} }
cur_y += BLOCK_SIZE; cur_y += BLOCK_SIZE;
} }
if(mario != nullptr) {
mario->setPos(mario_x * BLOCK_SIZE, 1 - (rows - mario_y) * BLOCK_SIZE); mario->setPos(mario_x * BLOCK_SIZE, 1 - (rows - mario_y) * BLOCK_SIZE);
} else {
//createMarioBlock
}
scene->moveZTop(mario); scene->moveZTop(mario);
} }

View File

@ -4,6 +4,6 @@
#include "../sdlpp/sdlpp_scene.hpp" #include "../sdlpp/sdlpp_scene.hpp"
#include "../sdlpp/sdlpp_rectrenderer.hpp" #include "../sdlpp/sdlpp_rectrenderer.hpp"
void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> &mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer); void loadMap(std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::RectangleRender> mario, const std::string &file, std::shared_ptr<SDLPP::Renderer> &renderer);
#endif #endif

View File

@ -5,7 +5,7 @@
void MarioVisitor::visit( const SDLPP::RenderObject &obj ) { void MarioVisitor::visit( const SDLPP::RenderObject &obj ) {
auto id = obj.getId(); auto id = obj.getId();
switch ( id ) { switch ( id ) {
case FLOOR_OVERWORLD_ID: case FLOOR_ID:
if ( from == MARIO_FLOOR_DETECT ) if ( from == MARIO_FLOOR_DETECT )
onGround = true; onGround = true;
else if ( from == MARIO_LEFT_SIDE_DETECT ) else if ( from == MARIO_LEFT_SIDE_DETECT )

View File

@ -1,22 +1,22 @@
#ifndef OBJECTIDS_H #ifndef OBJECTIDS_H
#define OBJECTIDS_H #define OBJECTIDS_H
#define FLOOR_OVERWORLD_ID 0x70000001 #define FLOOR_ID 0x70000001
#define HILL_OVERWORLD_INCLINE_ID 0x70000002 #define HILL_INCLINE_ID 0x70000002
#define HILL_OVERWORLD_DECLINE_ID 0x70000003 #define HILL_DECLINE_ID 0x70000003
#define HILL_OVERWORLD_DOTS_RIGHT_ID 0x70000004 #define HILL_DOTS_RIGHT_ID 0x70000004
#define HILL_OVERWORLD_DOTS_LEFT_ID 0x70000005 #define HILL_DOTS_LEFT_ID 0x70000005
#define HILL_OVERWORLD_FILL_ID 0x70000006 #define HILL_FILL_ID 0x70000006
#define HILL_OVERWORLD_TOP_ID 0x70000007 #define HILL_TOP_ID 0x70000007
#define BUSH_OVERWORLD_LEFT_ID 0x70000008 #define BUSH_LEFT_ID 0x70000008
#define BUSH_OVERWORLD_MIDDLE_ID 0x70000009 #define BUSH_MIDDLE_ID 0x70000009
#define BUSH_OVERWORLD_RIGHT_ID 0x7000000A #define BUSH_RIGHT_ID 0x7000000A
#define CLOUD_OVERWORLD_LEFT_BOTTOM_ID 0x7000000B #define CLOUD_LEFT_BOTTOM_ID 0x7000000B
#define CLOUD_OVERWORLD_MIDDLE_BOTTOM_ID 0x7000000C #define CLOUD_MIDDLE_BOTTOM_ID 0x7000000C
#define CLOUD_OVERWORLD_RIGHT_BOTTOM_ID 0x7000000D #define CLOUD_RIGHT_BOTTOM_ID 0x7000000D
#define CLOUD_OVERWORLD_LEFT_TOP_ID 0x7000000E #define CLOUD_LEFT_TOP_ID 0x7000000E
#define CLOUD_OVERWORLD_MIDDLE_TOP_ID 0x7000000F #define CLOUD_MIDDLE_TOP_ID 0x7000000F
#define CLOUD_OVERWORLD_RIGHT_TOP_ID 0x70000010 #define CLOUD_RIGHT_TOP_ID 0x70000010
#define DEATH_ID 0x10000001 #define DEATH_ID 0x10000001
#define STOP_MOVEMENT 0x2000 #define STOP_MOVEMENT 0x2000

View File

@ -4,35 +4,40 @@ extern const double BLOCK_SIZE = 0.0625;
const std::string MARIO_OVERWORLD_COLORKEY = "#93bbec"; const std::string MARIO_OVERWORLD_COLORKEY = "#93bbec";
const SDL_Rect MARIO_OVERWORLD_STANDING_SRC = { 1, 9, 16, 16 }; const SDL_Rect MARIO_STANDING_SRC = { 1, 9, 16, 16 };
const SDL_Rect MARIO_OVERWORLD_DEATH_SRC = { 22, 9, 16, 16 }; const SDL_Rect MARIO_DEATH_SRC = { 22, 9, 16, 16 };
const std::vector< SDL_Rect > MARIO_OVERWORLD_WALK_ANIM = { { 43, 9, 16, 16 }, const std::vector< SDL_Rect > MARIO_WALK_ANIM = { { 43, 9, 16, 16 },
{ 60, 9, 16, 16 }, { 60, 9, 16, 16 },
{ 77, 9, 16, 16 } }; { 77, 9, 16, 16 } };
const SDL_Rect MARIO_OVERWORLD_CHANGE_DIR_SRC = { 98, 9, 16, 16 }; const SDL_Rect MARIO_CHANGE_DIR_SRC = { 98, 9, 16, 16 };
const SDL_Rect MARIO_OVERWORLD_JUMP_SRC = { 119, 9, 16, 16 }; const SDL_Rect MARIO_JUMP_SRC = { 119, 9, 16, 16 };
const SDL_Rect MARIO_OVERWORLD_STANDING_BIG_SRC = { 1, 26, 16, 32 }; const SDL_Rect MARIO_STANDING_BIG_SRC = { 1, 26, 16, 32 };
const SDL_Rect MARIO_OVERWORLD_DEATH_BIG_SRC = { 22, 26, 16, 32 }; const SDL_Rect MARIO_DEATH_BIG_SRC = { 22, 26, 16, 32 };
const std::vector< SDL_Rect > MARIO_OVERWORLD_WALK_BIG_ANIM = { const std::vector< SDL_Rect > MARIO_WALK_BIG_ANIM = {
{ 43, 26, 16, 32 }, { 60, 9, 16, 32 }, { 77, 9, 16, 32 } { 43, 26, 16, 32 }, { 60, 9, 16, 32 }, { 77, 9, 16, 32 }
}; };
const SDL_Rect MARIO_OVERWORLD_CHANGE_DIR_BIG_SRC = { 98, 26, 16, 32 }; const SDL_Rect MARIO_CHANGE_DIR_BIG_SRC = { 98, 26, 16, 32 };
const SDL_Rect MARIO_OVERWORLD_JUMP_BIG_SRC = { 119, 26, 16, 32 }; const SDL_Rect MARIO_JUMP_BIG_SRC = { 119, 26, 16, 32 };
const SDL_Rect FLOOR_OVERWORLD_SRC = { 1, 131, 16, 16 }; const SDL_Rect FLOOR_SRC = { 1, 131, 16, 16 };
const SDL_Rect HILL_OVERWORLD_INCLINE_SRC = { 137, 97, 16, 16 }; const SDL_Rect HILL_INCLINE_SRC = { 137, 97, 16, 16 };
const SDL_Rect HILL_OVERWORLD_DECLINE_SRC = { 205, 97, 16, 16 }; const SDL_Rect HILL_DECLINE_SRC = { 205, 97, 16, 16 };
const SDL_Rect HILL_OVERWORLD_FILL_SRC = { 171, 97, 16, 16 }; const SDL_Rect HILL_FILL_SRC = { 171, 97, 16, 16 };
const SDL_Rect HILL_OVERWORLD_DOTS_RIGHT_SRC = { 154, 97, 16, 16 }; const SDL_Rect HILL_DOTS_RIGHT_SRC = { 154, 97, 16, 16 };
const SDL_Rect HILL_OVERWORLD_DOTS_LEFT_SRC = { 188, 97, 16, 16 }; const SDL_Rect HILL_DOTS_LEFT_SRC = { 188, 97, 16, 16 };
const SDL_Rect HILL_OVERWORLD_TOP_SRC = { 171, 63, 16, 16 }; const SDL_Rect HILL_TOP_SRC = { 171, 63, 16, 16 };
extern const SDL_Rect BUSH_OVERWORLD_LEFT_SRC = {222,97,16,16}; const SDL_Rect BUSH_LEFT_SRC = {222,97,16,16};
extern const SDL_Rect BUSH_OVERWORLD_MIDDLE_SRC = {239,97,16,16}; const SDL_Rect BUSH_MIDDLE_SRC = {239,97,16,16};
extern const SDL_Rect BUSH_OVERWORLD_RIGHT_SRC = {256,97,16,16}; const SDL_Rect BUSH_RIGHT_SRC = {256,97,16,16};
extern const SDL_Rect CLOUD_OVERWORLD_LEFT_BOTTOM_SRC = {222,80,16,16}; const SDL_Rect CLOUD_LEFT_BOTTOM_SRC = {222,80,16,16};
extern const SDL_Rect CLOUD_OVERWORLD_MIDDLE_BOTTOM_SRC = {239,80,16,16}; const SDL_Rect CLOUD_MIDDLE_BOTTOM_SRC = {239,80,16,16};
extern const SDL_Rect CLOUD_OVERWORLD_RIGHT_BOTTOM_SRC = {256,80,16,16}; const SDL_Rect CLOUD_RIGHT_BOTTOM_SRC = {256,80,16,16};
extern const SDL_Rect CLOUD_OVERWORLD_LEFT_TOP_SRC = {222,63,16,16}; const SDL_Rect CLOUD_LEFT_TOP_SRC = {222,63,16,16};
extern const SDL_Rect CLOUD_OVERWORLD_MIDDLE_TOP_SRC = {239,63,16,16}; const SDL_Rect CLOUD_MIDDLE_TOP_SRC = {239,63,16,16};
extern const SDL_Rect CLOUD_OVERWORLD_RIGHT_TOP_SRC = {256,63,16,16}; const SDL_Rect CLOUD_RIGHT_TOP_SRC = {256,63,16,16};
const SDLPP::Vec2D<uint64_t> OVERWORLD_SHIFT = {0, 0};
const SDLPP::Vec2D<uint64_t> UNDERWORLD_SHIFT = {274, 0};
const SDLPP::Vec2D<uint64_t> WATER_SHIFT = {548, 0};
const SDLPP::Vec2D<uint64_t> BOWSER_SHIFT = {0, 173};

View File

@ -4,40 +4,46 @@
#include <SDL2/SDL_rect.h> #include <SDL2/SDL_rect.h>
#include <string> #include <string>
#include <vector> #include <vector>
#include "../sdlpp/sdlpp_vector.hpp"
extern const double BLOCK_SIZE; extern const double BLOCK_SIZE;
//------------------ OVERWORLD ---------------------- //------------------ COLORS -------------------------
extern const std::string MARIO_OVERWORLD_COLORKEY; extern const std::string MARIO_OVERWORLD_COLORKEY;
//------------------ MARIO -------------------------- //------------------ MARIO --------------------------
extern const SDL_Rect MARIO_OVERWORLD_STANDING_SRC; extern const SDL_Rect MARIO_STANDING_SRC;
extern const SDL_Rect MARIO_OVERWORLD_DEATH_SRC; extern const SDL_Rect MARIO_DEATH_SRC;
extern const std::vector<SDL_Rect> MARIO_OVERWORLD_WALK_ANIM; extern const std::vector<SDL_Rect> MARIO_WALK_ANIM;
extern const SDL_Rect MARIO_OVERWORLD_CHANGE_DIR_SRC; extern const SDL_Rect MARIO_CHANGE_DIR_SRC;
extern const SDL_Rect MARIO_OVERWORLD_JUMP_SRC; extern const SDL_Rect MARIO_JUMP_SRC;
//------------------ BIG MARIO ---------------------- //------------------ BIG MARIO ----------------------
extern const SDL_Rect MARIO_OVERWORLD_STANDING_BIG_SRC; extern const SDL_Rect MARIO_STANDING_BIG_SRC;
extern const SDL_Rect MARIO_OVERWORLD_DEATH_BIG_SRC; extern const SDL_Rect MARIO_DEATH_BIG_SRC;
extern const std::vector<SDL_Rect> MARIO_OVERWORLD_WALK_BIG_ANIM; extern const std::vector<SDL_Rect> MARIO_WALK_BIG_ANIM;
extern const SDL_Rect MARIO_OVERWORLD_CHANGE_DIR_BIG_SRC; extern const SDL_Rect MARIO_CHANGE_DIR_BIG_SRC;
extern const SDL_Rect MARIO_OVERWORLD_JUMP_BIG_SRC; extern const SDL_Rect MARIO_JUMP_BIG_SRC;
//------------------ TERRAIN ------------------------ //------------------ TERRAIN ------------------------
extern const SDL_Rect FLOOR_OVERWORLD_SRC; extern const SDL_Rect FLOOR_SRC;
extern const SDL_Rect HILL_OVERWORLD_INCLINE_SRC; extern const SDL_Rect HILL_INCLINE_SRC;
extern const SDL_Rect HILL_OVERWORLD_DECLINE_SRC; extern const SDL_Rect HILL_DECLINE_SRC;
extern const SDL_Rect HILL_OVERWORLD_FILL_SRC; extern const SDL_Rect HILL_FILL_SRC;
extern const SDL_Rect HILL_OVERWORLD_DOTS_RIGHT_SRC; extern const SDL_Rect HILL_DOTS_RIGHT_SRC;
extern const SDL_Rect HILL_OVERWORLD_DOTS_LEFT_SRC; extern const SDL_Rect HILL_DOTS_LEFT_SRC;
extern const SDL_Rect HILL_OVERWORLD_TOP_SRC; extern const SDL_Rect HILL_TOP_SRC;
extern const SDL_Rect BUSH_OVERWORLD_LEFT_SRC; extern const SDL_Rect BUSH_LEFT_SRC;
extern const SDL_Rect BUSH_OVERWORLD_MIDDLE_SRC; extern const SDL_Rect BUSH_MIDDLE_SRC;
extern const SDL_Rect BUSH_OVERWORLD_RIGHT_SRC; extern const SDL_Rect BUSH_RIGHT_SRC;
extern const SDL_Rect CLOUD_OVERWORLD_LEFT_BOTTOM_SRC; extern const SDL_Rect CLOUD_LEFT_BOTTOM_SRC;
extern const SDL_Rect CLOUD_OVERWORLD_MIDDLE_BOTTOM_SRC; extern const SDL_Rect CLOUD_MIDDLE_BOTTOM_SRC;
extern const SDL_Rect CLOUD_OVERWORLD_RIGHT_BOTTOM_SRC; extern const SDL_Rect CLOUD_RIGHT_BOTTOM_SRC;
extern const SDL_Rect CLOUD_OVERWORLD_LEFT_TOP_SRC; extern const SDL_Rect CLOUD_LEFT_TOP_SRC;
extern const SDL_Rect CLOUD_OVERWORLD_MIDDLE_TOP_SRC; extern const SDL_Rect CLOUD_MIDDLE_TOP_SRC;
extern const SDL_Rect CLOUD_OVERWORLD_RIGHT_TOP_SRC; extern const SDL_Rect CLOUD_RIGHT_TOP_SRC;
extern const SDLPP::Vec2D<uint64_t> OVERWORLD_SHIFT;
extern const SDLPP::Vec2D<uint64_t> UNDERWORLD_SHIFT;
extern const SDLPP::Vec2D<uint64_t> WATER_SHIFT;
extern const SDLPP::Vec2D<uint64_t> BOWSER_SHIFT;
#endif #endif