Mario Editor: formatting
This commit is contained in:
parent
58974f8a7e
commit
3bef592cb1
584
mario/editor.cpp
584
mario/editor.cpp
@ -98,17 +98,17 @@ enum LandType::Value g_current_world_type = LandType::OVERWORLD;
|
||||
void updateTool() {
|
||||
auto tool_index = global_vars.tool.index;
|
||||
uint64_t tool_id = 0;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
tool_id = possibleBlocks[tool_index];
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
tool_id = possibleMods[tool_index];
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
tool_id = possibleCharacters[tool_index];
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
tool_id = possibleBlocks[tool_index];
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
tool_id = possibleMods[tool_index];
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
tool_id = possibleCharacters[tool_index];
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto tool_role = getBlockRole( tool_id );
|
||||
std::shared_ptr< SDLPP::Texture > target_texture = nullptr;
|
||||
@ -126,8 +126,7 @@ void updateTool() {
|
||||
break;
|
||||
}
|
||||
global_vars.current_tool->setTexture(
|
||||
target_texture,
|
||||
getSourceRectByID( tool_id, g_current_world_type ) );
|
||||
target_texture, getSourceRectByID( tool_id, g_current_world_type ) );
|
||||
global_vars.current_tool->setId( tool_id );
|
||||
global_vars.current_tool->getCollisions()[0]->setId( tool_id );
|
||||
}
|
||||
@ -145,34 +144,34 @@ void removeMario() {
|
||||
global_vars.mario->destroy();
|
||||
}
|
||||
|
||||
void setToolColor(const std::string &color) {
|
||||
std::vector<std::shared_ptr<SDLPP::RenderObject>> *store;
|
||||
void setToolColor( const std::string &color ) {
|
||||
std::vector< std::shared_ptr< SDLPP::RenderObject > > *store;
|
||||
int multiplier = 0;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = TOOLS_WIDTH;
|
||||
store = &global_vars.tool_boxes;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = MOD_WIDTH;
|
||||
store = &global_vars.mod_boxes;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = CHARACTER_WIDTH;
|
||||
store = &global_vars.character_boxes;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = TOOLS_WIDTH;
|
||||
store = &global_vars.tool_boxes;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = MOD_WIDTH;
|
||||
store = &global_vars.mod_boxes;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = CHARACTER_WIDTH;
|
||||
store = &global_vars.character_boxes;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto index = global_vars.tool.index % (2*multiplier);
|
||||
store->at(index)->setColor(color);
|
||||
auto index = global_vars.tool.index % ( 2 * multiplier );
|
||||
store->at( index )->setColor( color );
|
||||
}
|
||||
|
||||
void setToolColor() {
|
||||
setToolColor("#FFFF8888");
|
||||
setToolColor( "#FFFF8888" );
|
||||
}
|
||||
|
||||
void unsetToolColor() {
|
||||
setToolColor("#FFFFFF00");
|
||||
setToolColor( "#FFFFFF00" );
|
||||
}
|
||||
|
||||
void updateToolSelection( int prev_index, ToolType::Value type ) {
|
||||
@ -180,196 +179,205 @@ void updateToolSelection( int prev_index, ToolType::Value type ) {
|
||||
size_t cur_page = 0;
|
||||
size_t multiplier = 0;
|
||||
std::vector< std::shared_ptr< SDLPP::RenderObject > > *tool_vec = nullptr;
|
||||
switch(type) {
|
||||
case ToolType::BLOCK:
|
||||
cur_page = global_vars.tool.cur_page_tools;
|
||||
multiplier = 2*TOOLS_WIDTH;
|
||||
tool_vec = &global_vars.tools;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
cur_page = global_vars.tool.cur_page_mods;
|
||||
multiplier = 2*MOD_WIDTH;
|
||||
tool_vec = &global_vars.mods;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
cur_page = global_vars.tool.cur_page_characters;
|
||||
multiplier = 2*CHARACTER_WIDTH;
|
||||
tool_vec = &global_vars.characters;
|
||||
default:
|
||||
break;
|
||||
switch ( type ) {
|
||||
case ToolType::BLOCK:
|
||||
cur_page = global_vars.tool.cur_page_tools;
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
tool_vec = &global_vars.tools;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
cur_page = global_vars.tool.cur_page_mods;
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
tool_vec = &global_vars.mods;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
cur_page = global_vars.tool.cur_page_characters;
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
tool_vec = &global_vars.characters;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
auto cur = cur_page * multiplier;
|
||||
size_t prev = prev_index * multiplier;
|
||||
for ( size_t i = prev;
|
||||
i < ( tool_vec->size() < prev + multiplier ? tool_vec->size() : prev + multiplier );
|
||||
i < ( tool_vec->size() < prev + multiplier ? tool_vec->size()
|
||||
: prev + multiplier );
|
||||
i++ ) {
|
||||
tool_vec->at(i)->setHidden( true );
|
||||
tool_vec->at( i )->setHidden( true );
|
||||
}
|
||||
for ( size_t i = cur;
|
||||
i < ( tool_vec->size() < cur + multiplier ? tool_vec->size()
|
||||
: cur + multiplier );
|
||||
: cur + multiplier );
|
||||
i++ ) {
|
||||
tool_vec->at(i)->setHidden( false );
|
||||
tool_vec->at( i )->setHidden( false );
|
||||
}
|
||||
if(global_vars.tool.index / multiplier == cur_page)
|
||||
if ( global_vars.tool.index / multiplier == cur_page )
|
||||
setToolColor();
|
||||
}
|
||||
|
||||
void moveToolsLeft(ToolType::Value type) {
|
||||
switch(type) {
|
||||
case ToolType::BLOCK:
|
||||
global_vars.tool.cur_page_tools--;
|
||||
updateToolSelection( global_vars.tool.cur_page_tools + 1, type );
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
global_vars.tool.cur_page_mods--;
|
||||
updateToolSelection( global_vars.tool.cur_page_mods + 1, type );
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
global_vars.tool.cur_page_characters--;
|
||||
updateToolSelection( global_vars.tool.cur_page_characters + 1, type );
|
||||
default:
|
||||
break;
|
||||
void moveToolsLeft( ToolType::Value type ) {
|
||||
switch ( type ) {
|
||||
case ToolType::BLOCK:
|
||||
global_vars.tool.cur_page_tools--;
|
||||
updateToolSelection( global_vars.tool.cur_page_tools + 1, type );
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
global_vars.tool.cur_page_mods--;
|
||||
updateToolSelection( global_vars.tool.cur_page_mods + 1, type );
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
global_vars.tool.cur_page_characters--;
|
||||
updateToolSelection( global_vars.tool.cur_page_characters + 1, type );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void moveToolsRight(ToolType::Value type) {
|
||||
switch(type) {
|
||||
case ToolType::BLOCK:
|
||||
global_vars.tool.cur_page_tools++;
|
||||
updateToolSelection( global_vars.tool.cur_page_tools - 1, type );
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
global_vars.tool.cur_page_mods++;
|
||||
updateToolSelection( global_vars.tool.cur_page_mods - 1, type );
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
global_vars.tool.cur_page_characters++;
|
||||
updateToolSelection( global_vars.tool.cur_page_characters - 1, type );
|
||||
default:
|
||||
break;
|
||||
void moveToolsRight( ToolType::Value type ) {
|
||||
switch ( type ) {
|
||||
case ToolType::BLOCK:
|
||||
global_vars.tool.cur_page_tools++;
|
||||
updateToolSelection( global_vars.tool.cur_page_tools - 1, type );
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
global_vars.tool.cur_page_mods++;
|
||||
updateToolSelection( global_vars.tool.cur_page_mods - 1, type );
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
global_vars.tool.cur_page_characters++;
|
||||
updateToolSelection( global_vars.tool.cur_page_characters - 1, type );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void updateToolIndex(uint64_t new_index) {
|
||||
void updateToolIndex( uint64_t new_index ) {
|
||||
int multiplier = 0;
|
||||
int *page = nullptr;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2*TOOLS_WIDTH;
|
||||
page = &global_vars.tool.cur_page_tools;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2*MOD_WIDTH;
|
||||
page = &global_vars.tool.cur_page_mods;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2*CHARACTER_WIDTH;
|
||||
page = &global_vars.tool.cur_page_characters;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
page = &global_vars.tool.cur_page_tools;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
page = &global_vars.tool.cur_page_mods;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
page = &global_vars.tool.cur_page_characters;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
unsetToolColor();
|
||||
global_vars.tool.index = new_index;
|
||||
setToolColor();
|
||||
updateTool();
|
||||
if(new_index / multiplier != static_cast<uint64_t>(*page)) {
|
||||
if ( new_index / multiplier != static_cast< uint64_t >( *page ) ) {
|
||||
auto prev = *page;
|
||||
*page = new_index / multiplier;
|
||||
updateToolSelection(prev, global_vars.tool.type);
|
||||
updateToolSelection( prev, global_vars.tool.type );
|
||||
}
|
||||
}
|
||||
|
||||
void selectLowerTool() {
|
||||
int multiplier = 0;
|
||||
size_t max_index = 0;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
max_index = global_vars.tools.size() - 1;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
max_index = global_vars.mods.size() - 1;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
max_index = global_vars.characters.size() - 1;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
max_index = global_vars.tools.size() - 1;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
max_index = global_vars.mods.size() - 1;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
max_index = global_vars.characters.size() - 1;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( global_vars.tool.index % multiplier >= static_cast<uint64_t>(multiplier/2) || global_vars.tool.index + multiplier/2 > max_index )
|
||||
if ( global_vars.tool.index % multiplier >=
|
||||
static_cast< uint64_t >( multiplier / 2 ) ||
|
||||
global_vars.tool.index + multiplier / 2 > max_index ) {
|
||||
return;
|
||||
updateToolIndex(global_vars.tool.index + multiplier/2);
|
||||
}
|
||||
updateToolIndex( global_vars.tool.index + multiplier / 2 );
|
||||
}
|
||||
|
||||
void selectUpperTool() {
|
||||
int multiplier = 0;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if( global_vars.tool.index % multiplier < static_cast<uint64_t>(multiplier/2) )
|
||||
if ( global_vars.tool.index % multiplier <
|
||||
static_cast< uint64_t >( multiplier / 2 ) ) {
|
||||
return;
|
||||
updateToolIndex(global_vars.tool.index - multiplier/2);
|
||||
}
|
||||
updateToolIndex( global_vars.tool.index - multiplier / 2 );
|
||||
}
|
||||
|
||||
void selectPrevTool() {
|
||||
int multiplier = 0;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = TOOLS_WIDTH;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = MOD_WIDTH;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = CHARACTER_WIDTH;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = TOOLS_WIDTH;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = MOD_WIDTH;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = CHARACTER_WIDTH;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int subtraction = 1;
|
||||
if ( global_vars.tool.index % multiplier == 0 )
|
||||
subtraction = multiplier + 1;
|
||||
if ( global_vars.tool.index == 0 || global_vars.tool.index - subtraction > static_cast<uint64_t>(-multiplier) )
|
||||
if ( global_vars.tool.index == 0 ||
|
||||
global_vars.tool.index - subtraction >
|
||||
static_cast< uint64_t >( -multiplier ) ) {
|
||||
return;
|
||||
updateToolIndex(global_vars.tool.index - subtraction);
|
||||
}
|
||||
updateToolIndex( global_vars.tool.index - subtraction );
|
||||
}
|
||||
|
||||
void selectNextTool() {
|
||||
size_t max_index = 0;
|
||||
int multiplier = 0;
|
||||
switch(global_vars.tool.type) {
|
||||
case ToolType::BLOCK:
|
||||
max_index = global_vars.tools.size() - 1;
|
||||
multiplier = TOOLS_WIDTH;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
max_index = global_vars.mods.size() - 1;
|
||||
multiplier = MOD_WIDTH;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
max_index = global_vars.characters.size() - 1;
|
||||
multiplier = CHARACTER_WIDTH;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.tool.type ) {
|
||||
case ToolType::BLOCK:
|
||||
max_index = global_vars.tools.size() - 1;
|
||||
multiplier = TOOLS_WIDTH;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
max_index = global_vars.mods.size() - 1;
|
||||
multiplier = MOD_WIDTH;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
max_index = global_vars.characters.size() - 1;
|
||||
multiplier = CHARACTER_WIDTH;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int addition = 1;
|
||||
if ( global_vars.tool.index % multiplier == (multiplier - 1) )
|
||||
if ( global_vars.tool.index % multiplier == ( multiplier - 1 ) )
|
||||
addition = multiplier + 1;
|
||||
if ( global_vars.tool.index == max_index )
|
||||
return;
|
||||
if ( global_vars.tool.index + addition > max_index )
|
||||
addition = 1;
|
||||
updateToolIndex(global_vars.tool.index + addition);
|
||||
updateToolIndex( global_vars.tool.index + addition );
|
||||
}
|
||||
|
||||
void setFlag( uint64_t flag ) {
|
||||
@ -419,7 +427,8 @@ void getMousePositionFlags( SDLPP::Scene &scene ) {
|
||||
global_vars.mouse.cur_flags = visitor.getFlags();
|
||||
global_vars.mouse.edit_box = visitor.getEditBoxIndexes();
|
||||
global_vars.mouse.tool_box = visitor.getToolBoxIndexes();
|
||||
global_vars.mouse.tool_type = static_cast<ToolType::Value>(visitor.getToolType());
|
||||
global_vars.mouse.tool_type =
|
||||
static_cast< ToolType::Value >( visitor.getToolType() );
|
||||
// if we found an edit box, move tool icon to that box
|
||||
if ( visitor.foundEditBox() ) {
|
||||
const auto &box = global_vars.mouse.edit_box;
|
||||
@ -447,32 +456,39 @@ void mouseUpAction( uint64_t flags, SDLPP::Scene &scene ) {
|
||||
if ( MouseVisitor::moveToolsLeft( flags ) &&
|
||||
global_vars.tool.cur_page_tools != 0 ) {
|
||||
global_vars.tool.cur_page_tools--;
|
||||
updateToolSelection( global_vars.tool.cur_page_tools + 1, ToolType::BLOCK );
|
||||
updateToolSelection( global_vars.tool.cur_page_tools + 1,
|
||||
ToolType::BLOCK );
|
||||
}
|
||||
if ( MouseVisitor::moveToolsRight( flags ) &&
|
||||
global_vars.tool.cur_page_tools != global_vars.tool.max_page_tools ) {
|
||||
global_vars.tool.cur_page_tools++;
|
||||
updateToolSelection( global_vars.tool.cur_page_tools - 1, ToolType::BLOCK );
|
||||
updateToolSelection( global_vars.tool.cur_page_tools - 1,
|
||||
ToolType::BLOCK );
|
||||
}
|
||||
if ( MouseVisitor::moveModsLeft( flags ) &&
|
||||
global_vars.tool.cur_page_mods != 0 ) {
|
||||
global_vars.tool.cur_page_mods--;
|
||||
updateToolSelection( global_vars.tool.cur_page_mods + 1, ToolType::MOD );
|
||||
updateToolSelection( global_vars.tool.cur_page_mods + 1,
|
||||
ToolType::MOD );
|
||||
}
|
||||
if ( MouseVisitor::moveModsRight( flags ) &&
|
||||
global_vars.tool.cur_page_mods != global_vars.tool.max_page_mods ) {
|
||||
global_vars.tool.cur_page_mods++;
|
||||
updateToolSelection( global_vars.tool.cur_page_mods - 1, ToolType::MOD );
|
||||
updateToolSelection( global_vars.tool.cur_page_mods - 1,
|
||||
ToolType::MOD );
|
||||
}
|
||||
if ( MouseVisitor::moveCharactersLeft( flags ) &&
|
||||
global_vars.tool.cur_page_characters != 0 ) {
|
||||
global_vars.tool.cur_page_characters--;
|
||||
updateToolSelection( global_vars.tool.cur_page_characters + 1, ToolType::CHARACTER );
|
||||
updateToolSelection( global_vars.tool.cur_page_characters + 1,
|
||||
ToolType::CHARACTER );
|
||||
}
|
||||
if ( MouseVisitor::moveCharactersRight( flags ) &&
|
||||
global_vars.tool.cur_page_characters != global_vars.tool.max_page_characters ) {
|
||||
global_vars.tool.cur_page_characters !=
|
||||
global_vars.tool.max_page_characters ) {
|
||||
global_vars.tool.cur_page_characters++;
|
||||
updateToolSelection( global_vars.tool.cur_page_characters - 1, ToolType::CHARACTER );
|
||||
updateToolSelection( global_vars.tool.cur_page_characters - 1,
|
||||
ToolType::CHARACTER );
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,8 +551,9 @@ void placeTool( SDLPP::Scene &scene ) {
|
||||
new_obj->getCollisions()[0]->setId( EDITOR_TERRAIN_ID );
|
||||
break;
|
||||
case VisitorType::Modifier:
|
||||
if(tool_type == BlockRole::MARIO) {
|
||||
std::get< MapObject::CHARACTER_TYPE >( obj ) = LandType::OVERWORLD;
|
||||
if ( tool_type == BlockRole::MARIO ) {
|
||||
std::get< MapObject::CHARACTER_TYPE >( obj ) =
|
||||
LandType::OVERWORLD;
|
||||
std::get< MapObject::CHARACTER_ID >( obj ) = MARIO_ID;
|
||||
std::get< MapObject::MODIFIER_TYPE >( obj ) = 0;
|
||||
std::get< MapObject::MODIFIER_DATA >( obj ) = 0;
|
||||
@ -552,15 +569,18 @@ void placeTool( SDLPP::Scene &scene ) {
|
||||
// TODO BlockRole::Character
|
||||
} else {
|
||||
// TODO data
|
||||
std::get< MapObject::MODIFIER_TYPE >( obj ) = global_vars.current_tool->getId();
|
||||
std::get< MapObject::MODIFIER_TYPE >( obj ) =
|
||||
global_vars.current_tool->getId();
|
||||
std::get< MapObject::MODIFIER_DATA >( obj ) = 0;
|
||||
new_obj = createTerrainBlock(
|
||||
global_vars.current_tool->getId(), LandType::OVERWORLD,
|
||||
renderer, 1 + global_vars.mouse.edit_box.getX(),
|
||||
global_vars.mouse.edit_box.getY(), global_vars.translucent_terrain_texture, true );
|
||||
global_vars.mouse.edit_box.getY(),
|
||||
global_vars.translucent_terrain_texture, true );
|
||||
new_obj->getCollisions()[0]->setId( EDITOR_TERRAIN_ID );
|
||||
// TODO createModifierBlock
|
||||
dynamic_cast<MarioBlock*>(new_obj.get())->setTerrain(false);
|
||||
dynamic_cast< MarioBlock * >( new_obj.get() )
|
||||
->setTerrain( false );
|
||||
z_index = scene.getObjects().size() - 1;
|
||||
}
|
||||
break;
|
||||
@ -602,28 +622,29 @@ void pollEvents( SDLPP::Scene &scene ) {
|
||||
int multiplier = 0;
|
||||
size_t max_index = 0;
|
||||
size_t cur_page = 0;
|
||||
switch(global_vars.mouse.tool_type) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2*TOOLS_WIDTH;
|
||||
max_index = global_vars.tools.size();
|
||||
cur_page = global_vars.tool.cur_page_tools;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2*MOD_WIDTH;
|
||||
max_index = global_vars.mods.size();
|
||||
cur_page = global_vars.tool.cur_page_mods;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2*CHARACTER_WIDTH;
|
||||
max_index = global_vars.characters.size();
|
||||
cur_page = global_vars.tool.cur_page_characters;
|
||||
default:
|
||||
break;
|
||||
switch ( global_vars.mouse.tool_type ) {
|
||||
case ToolType::BLOCK:
|
||||
multiplier = 2 * TOOLS_WIDTH;
|
||||
max_index = global_vars.tools.size();
|
||||
cur_page = global_vars.tool.cur_page_tools;
|
||||
break;
|
||||
case ToolType::MOD:
|
||||
multiplier = 2 * MOD_WIDTH;
|
||||
max_index = global_vars.mods.size();
|
||||
cur_page = global_vars.tool.cur_page_mods;
|
||||
break;
|
||||
case ToolType::CHARACTER:
|
||||
multiplier = 2 * CHARACTER_WIDTH;
|
||||
max_index = global_vars.characters.size();
|
||||
cur_page = global_vars.tool.cur_page_characters;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
size_t index = tool_box.getY() * (multiplier/2) + tool_box.getX();
|
||||
size_t index =
|
||||
tool_box.getY() * ( multiplier / 2 ) + tool_box.getX();
|
||||
if ( index < max_index ) {
|
||||
global_vars.tool.type = global_vars.mouse.tool_type;
|
||||
updateToolIndex(cur_page * multiplier + index);
|
||||
updateToolIndex( cur_page * multiplier + index );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -648,31 +669,35 @@ void doInput( std::shared_ptr< SDLPP::Scene > scene ) {
|
||||
}
|
||||
}
|
||||
|
||||
void createGrid(double start_x, double start_y, int count_x, int count_y, std::shared_ptr<SDLPP::Scene> &scene) {
|
||||
void createGrid( double start_x, double start_y, int count_x, int count_y,
|
||||
std::shared_ptr< SDLPP::Scene > &scene ) {
|
||||
auto renderer = scene->getRendererShared();
|
||||
auto width = count_x * BLOCK_SIZE;
|
||||
auto height = count_y * BLOCK_SIZE;
|
||||
for ( int i = 0; i < count_x + 1; i++ ) {
|
||||
auto line_vertical = std::make_shared< SDLPP::LineRenderer >(
|
||||
start_x + i * BLOCK_SIZE, start_y, start_x + i * BLOCK_SIZE, start_y + height,
|
||||
renderer, "#282828" );
|
||||
start_x + i * BLOCK_SIZE, start_y, start_x + i * BLOCK_SIZE,
|
||||
start_y + height, renderer, "#282828" );
|
||||
line_vertical->setPermanent();
|
||||
line_vertical->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||
scene->addObject( line_vertical );
|
||||
}
|
||||
for (int i = 0; i < count_y + 1; i++) {
|
||||
for ( int i = 0; i < count_y + 1; i++ ) {
|
||||
auto line_horizontal = std::make_shared< SDLPP::LineRenderer >(
|
||||
start_x, start_y + i * BLOCK_SIZE,
|
||||
start_x + width, start_y + i * BLOCK_SIZE,
|
||||
renderer, "#282828" );
|
||||
start_x, start_y + i * BLOCK_SIZE, start_x + width,
|
||||
start_y + i * BLOCK_SIZE, renderer, "#282828" );
|
||||
line_horizontal->setPermanent();
|
||||
line_horizontal->setAlignment( SDLPP::OBJ_CENTER,
|
||||
SDLPP::OBJ_CENTER );
|
||||
line_horizontal->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||
scene->addObject( line_horizontal );
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRenderer>> createArrowControls(double left_x, double right_x, double start_y, double height, uint64_t left_id, uint64_t right_id, std::shared_ptr<SDLPP::Scene> &scene, std::shared_ptr<SDLPP::FontConfiguration> &font_config) {
|
||||
std::pair< std::shared_ptr< SDLPP::TextRenderer >,
|
||||
std::shared_ptr< SDLPP::TextRenderer > >
|
||||
createArrowControls(
|
||||
double left_x, double right_x, double start_y, double height,
|
||||
uint64_t left_id, uint64_t right_id, std::shared_ptr< SDLPP::Scene > &scene,
|
||||
std::shared_ptr< SDLPP::FontConfiguration > &font_config ) {
|
||||
auto renderer = scene->getRendererShared();
|
||||
// white rectangles
|
||||
auto rectangle1 = std::make_shared< SDLPP::RectangleRender >(
|
||||
@ -692,7 +717,8 @@ std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRende
|
||||
scene->addObject( rectangle2 );
|
||||
|
||||
auto left = std::make_shared< SDLPP::TextRenderer >(
|
||||
left_x, start_y + height / 2.0 - 0.5 * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, renderer, "<", font_config );
|
||||
left_x, start_y + height / 2.0 - 0.5 * BLOCK_SIZE, BLOCK_SIZE,
|
||||
BLOCK_SIZE, renderer, "<", font_config );
|
||||
left->setId( 0 );
|
||||
left->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||
left->setPermanent();
|
||||
@ -704,25 +730,31 @@ std::pair<std::shared_ptr<SDLPP::TextRenderer>, std::shared_ptr<SDLPP::TextRende
|
||||
right->setAlignment( SDLPP::OBJ_CENTER, SDLPP::OBJ_CENTER );
|
||||
right->setPermanent();
|
||||
scene->addObject( right );
|
||||
return {left, right};
|
||||
return { left, right };
|
||||
}
|
||||
|
||||
void populateToolGrid(int count_x, int count_y, float start_x, float start_y, ToolType::Value type, const std::vector<uint64_t> &blocks, std::vector<std::shared_ptr<SDLPP::RenderObject>> &tool_store, std::vector<std::shared_ptr<SDLPP::RenderObject>> &tool_box_store, std::shared_ptr<SDLPP::Scene> &scene) {
|
||||
void populateToolGrid(
|
||||
int count_x, int count_y, float start_x, float start_y,
|
||||
ToolType::Value type, const std::vector< uint64_t > &blocks,
|
||||
std::vector< std::shared_ptr< SDLPP::RenderObject > > &tool_store,
|
||||
std::vector< std::shared_ptr< SDLPP::RenderObject > > &tool_box_store,
|
||||
std::shared_ptr< SDLPP::Scene > &scene ) {
|
||||
auto renderer = scene->getRendererShared();
|
||||
for(int j = 0; j < count_y; j++) {
|
||||
for ( int j = 0; j < count_y; j++ ) {
|
||||
for ( int i = 0; i < count_x; i++ ) {
|
||||
auto tool_box = std::make_shared< ToolBox >( i, j,
|
||||
start_x, start_y, renderer, false );
|
||||
auto tool_box = std::make_shared< ToolBox >( i, j, start_x, start_y,
|
||||
renderer, false );
|
||||
scene->addObject( tool_box );
|
||||
}
|
||||
}
|
||||
int tool_index = 0;
|
||||
for ( auto &block : blocks ) {
|
||||
switch(type) {
|
||||
case ToolType::CHARACTER:
|
||||
if(block == MARIO_ID)
|
||||
tool_store.push_back(createMario(LandType::OVERWORLD, renderer, 0, 0));
|
||||
else
|
||||
switch ( type ) {
|
||||
case ToolType::CHARACTER:
|
||||
if ( block == MARIO_ID )
|
||||
tool_store.push_back(
|
||||
createMario( LandType::OVERWORLD, renderer, 0, 0 ) );
|
||||
else
|
||||
case ToolType::BLOCK:
|
||||
case ToolType::MOD:
|
||||
tool_store.push_back( createTerrainBlock(
|
||||
@ -732,52 +764,52 @@ void populateToolGrid(int count_x, int count_y, float start_x, float start_y, To
|
||||
tool_store.back()->setPermanent();
|
||||
auto x = tool_index % count_x;
|
||||
auto y = tool_index / count_x;
|
||||
tool_store.back()->setPos( start_x +
|
||||
x * BLOCK_SIZE,
|
||||
start_y + y * BLOCK_SIZE );
|
||||
tool_store.back()->setPos( start_x + x * BLOCK_SIZE,
|
||||
start_y + y * BLOCK_SIZE );
|
||||
scene->addObject( tool_store.back() );
|
||||
tool_index = ( tool_index + 1 ) % (2*count_x);
|
||||
tool_index = ( tool_index + 1 ) % ( 2 * count_x );
|
||||
}
|
||||
for(int j = 0; j < count_y; j++) {
|
||||
for ( int j = 0; j < count_y; j++ ) {
|
||||
for ( int i = 0; i < count_x; i++ ) {
|
||||
auto tool_box = std::make_shared< ToolBox >( i, j,
|
||||
start_x, start_y, renderer );
|
||||
tool_box->setType(type);
|
||||
auto tool_box =
|
||||
std::make_shared< ToolBox >( i, j, start_x, start_y, renderer );
|
||||
tool_box->setType( type );
|
||||
scene->addObject( tool_box );
|
||||
tool_box->setColor("#00000000");
|
||||
tool_box_store.push_back(tool_box);
|
||||
tool_box->setColor( "#00000000" );
|
||||
tool_box_store.push_back( tool_box );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void checkArrowsEnabled( uint64_t cur_page, uint64_t max_page, uint64_t left_flag, uint64_t right_flag, std::shared_ptr<SDLPP::TextRenderer> &left_arrow, std::shared_ptr<SDLPP::TextRenderer> &right_arrow, std::shared_ptr<SDLPP::Font> &font, bool map = false ) {
|
||||
if ( cur_page == 0 &&
|
||||
getFlag( left_flag ) ) {
|
||||
void checkArrowsEnabled( uint64_t cur_page, uint64_t max_page,
|
||||
uint64_t left_flag, uint64_t right_flag,
|
||||
std::shared_ptr< SDLPP::TextRenderer > &left_arrow,
|
||||
std::shared_ptr< SDLPP::TextRenderer > &right_arrow,
|
||||
std::shared_ptr< SDLPP::Font > &font,
|
||||
bool map = false ) {
|
||||
if ( cur_page == 0 && getFlag( left_flag ) ) {
|
||||
setFlag( UPDATE_FLAG );
|
||||
unsetFlag( left_flag );
|
||||
left_arrow->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
|
||||
} else if ( cur_page != 0 &&
|
||||
!getFlag( left_flag ) ) {
|
||||
} else if ( cur_page != 0 && !getFlag( left_flag ) ) {
|
||||
setFlag( UPDATE_FLAG );
|
||||
setFlag( left_flag );
|
||||
left_arrow->setTextColor( font, "#000000", "#282828", 0.05 );
|
||||
}
|
||||
if ( cur_page == max_page &&
|
||||
getFlag( right_flag ) ) {
|
||||
if ( cur_page == max_page && getFlag( right_flag ) ) {
|
||||
setFlag( UPDATE_FLAG );
|
||||
unsetFlag( right_flag );
|
||||
if(map) {
|
||||
if ( map ) {
|
||||
right_arrow->setTextColor( font, "#00FF00", "#000000", 0.1 );
|
||||
right_arrow->changeText( "+" );
|
||||
} else {
|
||||
right_arrow->setTextColor( font, "#CCCCCC", "#CCCCCC", 0.05 );
|
||||
}
|
||||
} else if ( cur_page != max_page &&
|
||||
!getFlag( right_flag ) ) {
|
||||
} else if ( cur_page != max_page && !getFlag( right_flag ) ) {
|
||||
setFlag( UPDATE_FLAG );
|
||||
setFlag( right_flag );
|
||||
right_arrow->setTextColor( font, "#000000", "#282828", 0.05 );
|
||||
if(map) {
|
||||
if ( map ) {
|
||||
right_arrow->changeText( ">" );
|
||||
}
|
||||
}
|
||||
@ -789,7 +821,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
#else
|
||||
int main() {
|
||||
#endif
|
||||
//TODO the code setting up UI is terrible, terrible mess, make it cleaner
|
||||
// TODO the code setting up UI is terrible, terrible mess, make it cleaner
|
||||
SDLPP::init();
|
||||
SDLPP::Window w( "Mario editor!" );
|
||||
w.setResizable( true );
|
||||
@ -803,9 +835,8 @@ int main() {
|
||||
renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
||||
g_mario_texture = std::make_shared< SDLPP::Texture >(
|
||||
renderer, "sprites/mario.png", MARIO_OVERWORLD_COLORKEY );
|
||||
g_translucent_terrain_texture =
|
||||
std::make_shared< SDLPP::Texture >( renderer, "sprites/terrain.png",
|
||||
MARIO_OVERWORLD_COLORKEY );
|
||||
g_translucent_terrain_texture = std::make_shared< SDLPP::Texture >(
|
||||
renderer, "sprites/terrain.png", MARIO_OVERWORLD_COLORKEY );
|
||||
g_translucent_terrain_texture->setAlpha( 100 );
|
||||
|
||||
auto scene = std::make_shared< SDLPP::Scene >( renderer );
|
||||
@ -816,7 +847,8 @@ int main() {
|
||||
scene->addObject( bg );
|
||||
|
||||
// TODO file name
|
||||
loadMap( scene, global_vars.mario, "test_binary.bin", renderer, global_vars.objects );
|
||||
loadMap( scene, global_vars.mario, "test_binary.bin", renderer,
|
||||
global_vars.objects );
|
||||
|
||||
auto font = std::make_shared< SDLPP::Font >( "testfont.ttf", 36 );
|
||||
auto font_config = std::make_shared< SDLPP::FontConfiguration >(
|
||||
@ -824,10 +856,14 @@ int main() {
|
||||
|
||||
// create grids and arrow controls
|
||||
// map
|
||||
auto arrows = createArrowControls(0, (MAP_WIDTH + 1) * BLOCK_SIZE, (MAP_WIDTH + 2 - MAP_HEIGHT) * BLOCK_SIZE, MAP_HEIGHT * BLOCK_SIZE, EDITOR_LEFT_MAP_ID, EDITOR_RIGHT_MAP_ID, scene, font_config);
|
||||
auto arrows = createArrowControls(
|
||||
0, ( MAP_WIDTH + 1 ) * BLOCK_SIZE,
|
||||
( MAP_WIDTH + 2 - MAP_HEIGHT ) * BLOCK_SIZE, MAP_HEIGHT * BLOCK_SIZE,
|
||||
EDITOR_LEFT_MAP_ID, EDITOR_RIGHT_MAP_ID, scene, font_config );
|
||||
auto left_map_arrow = arrows.first;
|
||||
auto right_map_arrow = arrows.second;
|
||||
createGrid(BLOCK_SIZE, 1 - MAP_HEIGHT * BLOCK_SIZE, MAP_WIDTH, MAP_HEIGHT, scene);
|
||||
createGrid( BLOCK_SIZE, 1 - MAP_HEIGHT * BLOCK_SIZE, MAP_WIDTH, MAP_HEIGHT,
|
||||
scene );
|
||||
// edit blocks on map
|
||||
for ( int i = 0; i < MAP_WIDTH; i++ ) {
|
||||
for ( int j = 0; j < MAP_HEIGHT; j++ ) {
|
||||
@ -837,30 +873,50 @@ int main() {
|
||||
}
|
||||
|
||||
// tools
|
||||
populateToolGrid(TOOLS_WIDTH, 2, (MAP_WIDTH - TOOLS_WIDTH) * BLOCK_SIZE, BLOCK_SIZE, ToolType::BLOCK, possibleBlocks, global_vars.tools, global_vars.tool_boxes, scene);
|
||||
arrows = createArrowControls((MAP_WIDTH - TOOLS_WIDTH - 1) * BLOCK_SIZE, MAP_WIDTH * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, EDITOR_LEFT_TOOL_ID, EDITOR_RIGHT_TOOL_ID, scene, font_config);
|
||||
populateToolGrid( TOOLS_WIDTH, 2, ( MAP_WIDTH - TOOLS_WIDTH ) * BLOCK_SIZE,
|
||||
BLOCK_SIZE, ToolType::BLOCK, possibleBlocks,
|
||||
global_vars.tools, global_vars.tool_boxes, scene );
|
||||
arrows = createArrowControls( ( MAP_WIDTH - TOOLS_WIDTH - 1 ) * BLOCK_SIZE,
|
||||
MAP_WIDTH * BLOCK_SIZE, BLOCK_SIZE,
|
||||
2 * BLOCK_SIZE, EDITOR_LEFT_TOOL_ID,
|
||||
EDITOR_RIGHT_TOOL_ID, scene, font_config );
|
||||
auto left_tool_arrow = arrows.first;
|
||||
auto right_tool_arrow = arrows.second;
|
||||
createGrid(( MAP_WIDTH - TOOLS_WIDTH ) * BLOCK_SIZE, BLOCK_SIZE, TOOLS_WIDTH, 2, scene);
|
||||
createGrid( ( MAP_WIDTH - TOOLS_WIDTH ) * BLOCK_SIZE, BLOCK_SIZE,
|
||||
TOOLS_WIDTH, 2, scene );
|
||||
// mods
|
||||
populateToolGrid(MOD_WIDTH, 2, 2 * BLOCK_SIZE, BLOCK_SIZE, ToolType::MOD, possibleMods, global_vars.mods, global_vars.mod_boxes, scene);
|
||||
arrows = createArrowControls(BLOCK_SIZE, (MOD_WIDTH + 2) * BLOCK_SIZE, BLOCK_SIZE, 2*BLOCK_SIZE, EDITOR_LEFT_MOD_ID, EDITOR_RIGHT_MOD_ID, scene, font_config);
|
||||
populateToolGrid( MOD_WIDTH, 2, 2 * BLOCK_SIZE, BLOCK_SIZE, ToolType::MOD,
|
||||
possibleMods, global_vars.mods, global_vars.mod_boxes,
|
||||
scene );
|
||||
arrows = createArrowControls(
|
||||
BLOCK_SIZE, ( MOD_WIDTH + 2 ) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE,
|
||||
EDITOR_LEFT_MOD_ID, EDITOR_RIGHT_MOD_ID, scene, font_config );
|
||||
auto left_mod_arrow = arrows.first;
|
||||
auto right_mod_arrow = arrows.second;
|
||||
createGrid(2*BLOCK_SIZE, BLOCK_SIZE, MOD_WIDTH, 2, scene);
|
||||
createGrid( 2 * BLOCK_SIZE, BLOCK_SIZE, MOD_WIDTH, 2, scene );
|
||||
// characters
|
||||
populateToolGrid(CHARACTER_WIDTH, 2, (MOD_WIDTH+5) * BLOCK_SIZE, BLOCK_SIZE, ToolType::CHARACTER, possibleCharacters, global_vars.characters, global_vars.character_boxes, scene);
|
||||
arrows = createArrowControls((MOD_WIDTH + 4) * BLOCK_SIZE, (MOD_WIDTH + 5 + CHARACTER_WIDTH) * BLOCK_SIZE, BLOCK_SIZE, 2 * BLOCK_SIZE, EDITOR_LEFT_CHARACTER_ID, EDITOR_RIGHT_CHARACTER_ID, scene, font_config);
|
||||
populateToolGrid( CHARACTER_WIDTH, 2, ( MOD_WIDTH + 5 ) * BLOCK_SIZE,
|
||||
BLOCK_SIZE, ToolType::CHARACTER, possibleCharacters,
|
||||
global_vars.characters, global_vars.character_boxes,
|
||||
scene );
|
||||
arrows = createArrowControls(
|
||||
( MOD_WIDTH + 4 ) * BLOCK_SIZE,
|
||||
( MOD_WIDTH + 5 + CHARACTER_WIDTH ) * BLOCK_SIZE, BLOCK_SIZE,
|
||||
2 * BLOCK_SIZE, EDITOR_LEFT_CHARACTER_ID, EDITOR_RIGHT_CHARACTER_ID,
|
||||
scene, font_config );
|
||||
auto left_char_arrow = arrows.first;
|
||||
auto right_char_arrow = arrows.second;
|
||||
createGrid((MOD_WIDTH + 5) * BLOCK_SIZE, BLOCK_SIZE, CHARACTER_WIDTH, 2, scene);
|
||||
|
||||
createGrid( ( MOD_WIDTH + 5 ) * BLOCK_SIZE, BLOCK_SIZE, CHARACTER_WIDTH, 2,
|
||||
scene );
|
||||
|
||||
global_vars.map.max_page = global_vars.objects.size() - MAP_WIDTH;
|
||||
|
||||
global_vars.tool.max_page_tools = ( possibleBlocks.size() - 1 ) / (2*TOOLS_WIDTH);
|
||||
global_vars.tool.max_page_mods = ( possibleMods.size() - 1 ) / (2*MOD_WIDTH);
|
||||
global_vars.tool.max_page_characters = ( possibleCharacters.size() - 1 ) / (2*CHARACTER_WIDTH);
|
||||
global_vars.tool.max_page_tools =
|
||||
( possibleBlocks.size() - 1 ) / ( 2 * TOOLS_WIDTH );
|
||||
global_vars.tool.max_page_mods =
|
||||
( possibleMods.size() - 1 ) / ( 2 * MOD_WIDTH );
|
||||
global_vars.tool.max_page_characters =
|
||||
( possibleCharacters.size() - 1 ) / ( 2 * CHARACTER_WIDTH );
|
||||
|
||||
auto mouse = std::make_shared< SDLPP::RectangleRender >( 0.01, 0.01, 0, 0,
|
||||
renderer );
|
||||
@ -924,10 +980,22 @@ int main() {
|
||||
frames = 0;
|
||||
base = SDL_GetTicks();
|
||||
}
|
||||
checkArrowsEnabled(global_vars.map.cur_page, global_vars.map.max_page, MAP_LEFT_ENABLED_FLAG, MAP_RIGHT_ENABLED_FLAG, left_map_arrow, right_map_arrow, font, true);
|
||||
checkArrowsEnabled(global_vars.tool.cur_page_tools, global_vars.tool.max_page_tools, TOOL_LEFT_ENABLED_FLAG, TOOL_RIGHT_ENABLED_FLAG, left_tool_arrow, right_tool_arrow, font);
|
||||
checkArrowsEnabled(global_vars.tool.cur_page_mods, global_vars.tool.max_page_mods, MOD_LEFT_ENABLED_FLAG, MOD_RIGHT_ENABLED_FLAG, left_mod_arrow, right_mod_arrow, font);
|
||||
checkArrowsEnabled(global_vars.tool.cur_page_characters, global_vars.tool.max_page_characters, CHARACTER_LEFT_ENABLED_FLAG, CHARACTER_RIGHT_ENABLED_FLAG, left_char_arrow, right_char_arrow, font);
|
||||
checkArrowsEnabled( global_vars.map.cur_page, global_vars.map.max_page,
|
||||
MAP_LEFT_ENABLED_FLAG, MAP_RIGHT_ENABLED_FLAG,
|
||||
left_map_arrow, right_map_arrow, font, true );
|
||||
checkArrowsEnabled( global_vars.tool.cur_page_tools,
|
||||
global_vars.tool.max_page_tools,
|
||||
TOOL_LEFT_ENABLED_FLAG, TOOL_RIGHT_ENABLED_FLAG,
|
||||
left_tool_arrow, right_tool_arrow, font );
|
||||
checkArrowsEnabled( global_vars.tool.cur_page_mods,
|
||||
global_vars.tool.max_page_mods,
|
||||
MOD_LEFT_ENABLED_FLAG, MOD_RIGHT_ENABLED_FLAG,
|
||||
left_mod_arrow, right_mod_arrow, font );
|
||||
checkArrowsEnabled( global_vars.tool.cur_page_characters,
|
||||
global_vars.tool.max_page_characters,
|
||||
CHARACTER_LEFT_ENABLED_FLAG,
|
||||
CHARACTER_RIGHT_ENABLED_FLAG, left_char_arrow,
|
||||
right_char_arrow, font );
|
||||
if ( getFlag( UPDATE_FLAG ) ) {
|
||||
scene->updateSizeAndPosition();
|
||||
unsetFlag( UPDATE_FLAG );
|
||||
|
Loading…
Reference in New Issue
Block a user