@ -159,6 +159,9 @@ extern std::map<TriggerName::Trigger,std::string> TRIGGERS;
TriggerName : : Trigger SELECTED_TRIGGER ;
TriggerName : : Trigger SELECTED_TRIGGER ;
int TRIGGER_OFFSET = 0 ;
int TRIGGER_OFFSET = 0 ;
int WORLD_DISPLAY_OFFSET = 0 ;
int WORLD_DISPLAY_OFFSET = 0 ;
bool SELECTING_A_MAP_FOR_TRIGGER = false ;
Trigger * LAST_PLACED_TRIGGER = nullptr ;
Map * ORIGINATING_MAP = nullptr ;
/*
/*
[ Choice1 , Choice2 , Choice3 ]
[ Choice1 , Choice2 , Choice3 ]
@ -862,7 +865,24 @@ void SeasonI::LoadMap(Map*map) {
std : : stringstream split5 ( data . substr ( lastMarker + 1 , marker - lastMarker - 1 ) ) ;
std : : stringstream split5 ( data . substr ( lastMarker + 1 , marker - lastMarker - 1 ) ) ;
lastMarker = marker ;
lastMarker = marker ;
split5 > > size_y ;
split5 > > size_y ;
map - > triggers . push_back ( new Trigger ( { ( int ) x , ( int ) y } , { size_x , size_y } , ( TriggerName : : Trigger ) id ) ) ;
Map * mapTrigger = nullptr ;
vd2d triggerCoords ;
if ( data . find_first_of ( ' ; ' , marker + 1 ) ! = std : : string : : npos ) {
//This means there's extra data we should grab. Should be map, and two positional coordinates.
std : : stringstream split6 ( data . substr ( lastMarker + 1 , marker - lastMarker - 1 ) ) ;
lastMarker = marker ;
int mapVal ;
split6 > > mapVal ;
mapTrigger = MAPS [ ( MapName : : Map ) mapVal ] ;
std : : stringstream split7 ( data . substr ( lastMarker + 1 , marker - lastMarker - 1 ) ) ;
lastMarker = marker ;
split7 > > triggerCoords . x ;
std : : stringstream split8 ( data . substr ( lastMarker + 1 , marker - lastMarker - 1 ) ) ;
lastMarker = marker ;
split8 > > triggerCoords . y ;
printf ( " Found extra data. \n " ) ;
}
map - > triggers . push_back ( new Trigger ( { ( int ) x , ( int ) y } , { size_x , size_y } , ( TriggerName : : Trigger ) id , triggerCoords , mapTrigger ) ) ;
printf ( " Trigger %d Loaded. \n " , id ) ;
printf ( " Trigger %d Loaded. \n " , id ) ;
}
}
} else {
} else {
@ -989,7 +1009,7 @@ void SeasonI::SaveMap(Map*map) {
for ( int i = 0 ; i < map - > triggers . size ( ) ; i + + ) {
for ( int i = 0 ; i < map - > triggers . size ( ) ; i + + ) {
f . put ( ' \n ' ) ;
f . put ( ' \n ' ) ;
const std : : string trigger = " TRIGGER " + std : : to_string ( map - > triggers [ i ] - > GetPosX ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetPosY ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetID ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetSizeX ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetSizeY ( ) ) ;
const std : : string trigger = " TRIGGER " + std : : to_string ( map - > triggers [ i ] - > GetPosX ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetPosY ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetID ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetSizeX ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetSizeY ( ) ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetMapPtr ( ) - > myID ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetAdditionalCoordData ( ) . x ) + " ; " + std : : to_string ( map - > triggers [ i ] - > GetAdditionalCoordData ( ) . y ) ;
for ( int j = 0 ; j < trigger . length ( ) ; j + + ) {
for ( int j = 0 ; j < trigger . length ( ) ; j + + ) {
f . put ( trigger [ j ] ) ;
f . put ( trigger [ j ] ) ;
}
}
@ -1325,7 +1345,14 @@ void SeasonI::updateGame(){
CURRENT_MAP - > triggers . erase ( CURRENT_MAP - > triggers . begin ( ) + i - - ) ;
CURRENT_MAP - > triggers . erase ( CURRENT_MAP - > triggers . begin ( ) + i - - ) ;
}
}
}
}
CURRENT_MAP - > triggers . push_back ( new Trigger ( HIGHLIGHTED_TILE * 32 , { 32 , 32 } , SELECTED_TRIGGER ) ) ;
if ( SELECTED_TRIGGER = = TriggerName : : GOTO_MAP ) {
SELECTING_A_MAP_FOR_TRIGGER = true ;
GAME_STATE = GameState : : MAP_SELECT ;
ORIGINATING_MAP = CURRENT_MAP ;
LAST_PLACED_TRIGGER = new Trigger ( HIGHLIGHTED_TILE * 32 , { 32 , 32 } , SELECTED_TRIGGER ) ; //Don't add it to the list of map triggers yet...It'll be wiped out if we do.
} else {
CURRENT_MAP - > triggers . push_back ( new Trigger ( HIGHLIGHTED_TILE * 32 , { 32 , 32 } , SELECTED_TRIGGER ) ) ;
}
} else {
} else {
TILE * tile = MAP5 [ HIGHLIGHTED_TILE . y ] [ HIGHLIGHTED_TILE . x ] ;
TILE * tile = MAP5 [ HIGHLIGHTED_TILE . y ] [ HIGHLIGHTED_TILE . x ] ;
tile - > tileX = SELECTED_TILE . x ;
tile - > tileX = SELECTED_TILE . x ;
@ -2230,6 +2257,13 @@ void SeasonI::keyUpdates() {
GAME_STATE = GameState : : OVERWORLD_MENU ;
GAME_STATE = GameState : : OVERWORLD_MENU ;
}
}
} break ;
} break ;
case GameState : : MAP_POSITION_SELECT : {
LAST_PLACED_TRIGGER - > SetExtraCoords ( HIGHLIGHTED_TILE * 32 ) ;
CURRENT_MAP = LAST_PLACED_TRIGGER - > GetMapPtr ( ) ;
LoadMap ( ORIGINATING_MAP ) ;
CURRENT_MAP - > triggers . push_back ( LAST_PLACED_TRIGGER ) ;
LAST_PLACED_TRIGGER = nullptr ;
} break ;
case GameState : : EDITOR : {
case GameState : : EDITOR : {
if ( IsTextEntryEnabled ( ) ) {
if ( IsTextEntryEnabled ( ) ) {
return ;
return ;
@ -2315,7 +2349,14 @@ void SeasonI::keyUpdates() {
} break ;
} break ;
case GameState : : MAP_SELECT : {
case GameState : : MAP_SELECT : {
if ( GetKey ( ESCAPE ) . bPressed ) {
if ( GetKey ( ESCAPE ) . bPressed ) {
GAME_STATE = GameState : : EDITOR ;
if ( SELECTING_A_MAP_FOR_TRIGGER ) {
SELECTING_A_MAP_FOR_TRIGGER = false ;
LAST_PLACED_TRIGGER - > SetMap ( CURRENT_MAP ) ;
printf ( " Trigger Map Location set to %s " , CURRENT_MAP - > mapname . c_str ( ) ) ;
GAME_STATE = GameState : : MAP_POSITION_SELECT ;
} else {
GAME_STATE = GameState : : EDITOR ;
}
}
}
if ( ( GetMouseWheel ( ) < 0 | | GetKey ( PGDN ) . bHeld ) & & WORLD_DISPLAY_OFFSET + ( WIDTH / 16 ) < MAPS . size ( ) ) {
if ( ( GetMouseWheel ( ) < 0 | | GetKey ( PGDN ) . bHeld ) & & WORLD_DISPLAY_OFFSET + ( WIDTH / 16 ) < MAPS . size ( ) ) {
WORLD_DISPLAY_OFFSET + = WIDTH / 16 ;
WORLD_DISPLAY_OFFSET + = WIDTH / 16 ;
@ -2793,7 +2834,11 @@ void SeasonI::drawGame(){
FillRectDecal ( trigger - > GetPos ( ) - cameraPos , trigger - > GetSize ( ) , Pixel ( 255 , 0 , 0 , 64 ) ) ;
FillRectDecal ( trigger - > GetPos ( ) - cameraPos , trigger - > GetSize ( ) , Pixel ( 255 , 0 , 0 , 64 ) ) ;
DrawRectDecal ( trigger - > GetPos ( ) - cameraPos , trigger - > GetSize ( ) , YELLOW ) ;
DrawRectDecal ( trigger - > GetPos ( ) - cameraPos , trigger - > GetSize ( ) , YELLOW ) ;
vi2d textOffset = { 2 , 2 } ;
vi2d textOffset = { 2 , 2 } ;
DrawStringDecal ( trigger - > GetPos ( ) - cameraPos + textOffset , TRIGGERS [ ( TriggerName : : Trigger ) trigger - > GetID ( ) ] , WHITE , { 28.f / GetTextSize ( TRIGGERS [ ( TriggerName : : Trigger ) trigger - > GetID ( ) ] ) . x , 1.f } ) ;
std : : string triggerText = TRIGGERS [ ( TriggerName : : Trigger ) trigger - > GetID ( ) ] ;
if ( ( TriggerName : : Trigger ) trigger - > GetID ( ) = = TriggerName : : GOTO_MAP ) {
triggerText = " GOTO " + trigger - > GetMapPtr ( ) - > mapname + " \n " + std : : to_string ( trigger - > GetAdditionalCoordData ( ) . x ) + " \n " + std : : to_string ( trigger - > GetAdditionalCoordData ( ) . y ) ;
}
DrawStringDecal ( trigger - > GetPos ( ) - cameraPos + textOffset , triggerText , WHITE , { 28.f / GetTextSize ( triggerText ) . x , 1.f } ) ;
}
}
} else
} else
if ( EDITING_LAYER = = layer : : ENCOUNTER ) {
if ( EDITING_LAYER = = layer : : ENCOUNTER ) {
@ -2815,6 +2860,12 @@ void SeasonI::drawGame(){
DrawStringPropDecal ( { 2 , 2 } , " Editing Layer " + std : : to_string ( EDITING_LAYER ) ) ;
DrawStringPropDecal ( { 2 , 2 } , " Editing Layer " + std : : to_string ( EDITING_LAYER ) ) ;
}
}
} break ;
} break ;
case GameState : : MAP_POSITION_SELECT : {
DrawGameWorld ( ) ;
SetDrawTarget ( layer : : INTERFACE ) ;
DrawRectDecal ( ( HIGHLIGHTED_TILE ) * 32 - cameraPos , { 32 , 32 } , YELLOW ) ;
DrawStringPropDecal ( { 2 , 2 } , " Select target tile " ) ;
} break ;
case GameState : : TILE_SELECT : {
case GameState : : TILE_SELECT : {
//14x14 pixels per tile.
//14x14 pixels per tile.
DrawDecal ( { 0 , 0 } , SPRITES [ " terrainmap.png " ] , { TILEMAP_EDITOR_DRAW_MULT , TILEMAP_EDITOR_DRAW_MULT } ) ;
DrawDecal ( { 0 , 0 } , SPRITES [ " terrainmap.png " ] , { TILEMAP_EDITOR_DRAW_MULT , TILEMAP_EDITOR_DRAW_MULT } ) ;
@ -3760,6 +3811,13 @@ void SeasonI::HandleCutscenes() {
LoadMap ( map ) ;
LoadMap ( map ) ;
CurrentCutscene - > AdvanceAction ( ) ;
CurrentCutscene - > AdvanceAction ( ) ;
} break ;
} break ;
case ActionType : : MOVE_PLAYER_OBJS : {
MovePlayerObjects * action = ( MovePlayerObjects * ) CurrentCutscene - > GetAction ( ) ;
vd2d pos = action - > GetTargetPos ( ) ;
for ( int i = 0 ; i < PARTY_MEMBER_COUNT ; i + + ) {
PARTY_MEMBER_OBJ [ i ] - > SetPos ( pos ) ;
}
} break ;
}
}
for ( int i = 0 ; i < CUTSCENE_QUEUE . size ( ) ; i + + ) {
for ( int i = 0 ; i < CUTSCENE_QUEUE . size ( ) ; i + + ) {
@ -3939,7 +3997,8 @@ void SeasonI::AdvanceMessageBox() {
void SeasonI : : cameraUpdate ( ) {
void SeasonI : : cameraUpdate ( ) {
switch ( GAME_STATE ) {
switch ( GAME_STATE ) {
case GameState : : EDITOR : {
case GameState : : EDITOR :
case GameState : : MAP_POSITION_SELECT : {
//CAMERA MOVEMENTS MUST BE LAST!!!
//CAMERA MOVEMENTS MUST BE LAST!!!
if ( UpHeld ( ) ) {
if ( UpHeld ( ) ) {
cameraPos . y - = CAMERA_MOVESPD ;
cameraPos . y - = CAMERA_MOVESPD ;
@ -5064,8 +5123,7 @@ void SeasonI::SetupCutscenes(){
This is a test message that lets us trigger straight from a cutscene ! Cool ! ) " ),
This is a test message that lets us trigger straight from a cutscene ! Cool ! ) " ),
액 션 ModifyObject ( 0 , ANIMATIONS [ " player.png " ] , { 5 , 5 } , MAGENTA ) ,
액 션 ModifyObject ( 0 , ANIMATIONS [ " player.png " ] , { 5 , 5 } , MAGENTA ) ,
액 션 MoveCutsceneObject ( 1 , { 320 , 64 } , 1 ) , } ) } ,
액 션 MoveCutsceneObject ( 1 , { 320 , 64 } , 1 ) , } ) } ,
{ CutsceneName : : TRANSFER_MAP_TWOSON_CUTSCENE , new MapTransitionCutscene ( MAPS [ MapName : : TWOSON ] ) } ,
{ CutsceneName : : TRANSFER_MAP_CUTSCENE , new MapTransitionCutscene ( ) } ,
{ CutsceneName : : TRANSFER_MAP_ONETT_CUTSCENE , new MapTransitionCutscene ( MAPS [ MapName : : ONETT ] ) } ,
} ;
} ;
}
}