@ -78,8 +78,8 @@ public:
const float TARGET_RATE = 1 / 60.0 ;
const float TARGET_RATE = 1 / 60.0 ;
int MAP_WIDTH = - 1 ;
int MAP_WIDTH = - 1 ;
int MAP_HEIGHT = - 1 ;
int MAP_HEIGHT = - 1 ;
Map * CURRENT_MAP ;
Map * CURRENT_MAP = nullptr ;
Map * MAP_ONETT ;
Map * MAP_ONETT = nullptr ;
int GAME_STATE = GameState : : EDITOR ;
int GAME_STATE = GameState : : EDITOR ;
vi2d SELECTED_TILE = { 0 , 0 } ;
vi2d SELECTED_TILE = { 0 , 0 } ;
vi2d HIGHLIGHTED_TILE = { 0 , 0 } ;
vi2d HIGHLIGHTED_TILE = { 0 , 0 } ;
@ -87,9 +87,9 @@ public:
int SELECTED_OBJ_ID = PLAYER ;
int SELECTED_OBJ_ID = PLAYER ;
int OBJ_DISPLAY_OFFSET = 0 ;
int OBJ_DISPLAY_OFFSET = 0 ;
bool GAME_FLAGS [ 128 ] = { } ;
bool GAME_FLAGS [ 128 ] = { } ;
std : : array < Object * , 4 > PARTY_MEMBER_OBJ ;
std : : array < Object * , 4 > PARTY_MEMBER_OBJ = { } ;
std : : array < int , 4 > PARTY_MEMBER_ID ;
std : : array < int , 4 > PARTY_MEMBER_ID = { } ;
std : : array < Entity * , 7 > PARTY_MEMBER_STATS ;
std : : array < Entity * , 7 > PARTY_MEMBER_STATS = { } ;
bool messageBoxVisible = false ;
bool messageBoxVisible = false ;
std : : string messageBoxText = " " ;
std : : string messageBoxText = " " ;
std : : string targetText = " " ;
std : : string targetText = " " ;
@ -99,18 +99,18 @@ public:
int messageBoxStopMarker = 0 ; //End of text display for current printout.
int messageBoxStopMarker = 0 ; //End of text display for current printout.
int messageBoxFrameWaitTime = 1 ;
int messageBoxFrameWaitTime = 1 ;
bool messageBoxLoad = false ; //Set to true when ready to load a message in.
bool messageBoxLoad = false ; //Set to true when ready to load a message in.
std : : map < int , vi2d > additionalChars ;
std : : map < int , vi2d > additionalChars = { } ;
Cutscene * TestCutscene ;
Cutscene * TestCutscene = nullptr ;
Cutscene * CurrentCutscene = nullptr ;
Cutscene * CurrentCutscene = nullptr ;
ActionType CurrentAction = ActionType : : NONE ;
ActionType CurrentAction = ActionType : : NONE ;
double CUTSCENE_FADE_VALUE = 0 ;
double CUTSCENE_FADE_VALUE = 0 ;
std : : vector < CutsceneAction * > CUTSCENE_QUEUE ;
std : : vector < CutsceneAction * > CUTSCENE_QUEUE = { } ;
std : : map < BattleMoveName , Battle : : Move * > MOVELIST ;
std : : map < BattleMoveName , Battle : : Move * > MOVELIST = { } ;
std : : array < vd2d , PARTY_TRAIL_LENGTH > partyTrail = { vd2d { 0 , 0 } } ;
std : : array < vd2d , PARTY_TRAIL_LENGTH > partyTrail = { vd2d { 0 , 0 } } ;
int PARTY_MEMBER_COUNT = 1 ;
int PARTY_MEMBER_COUNT = 1 ;
int ENCOUNTER_SELECTED = 0 ;
int ENCOUNTER_SELECTED = 0 ;
int ENCOUNTER_OFFSET = 0 ;
int ENCOUNTER_OFFSET = 0 ;
std : : vector < Encounter * > ENCOUNTER_LIST ;
std : : vector < Encounter * > ENCOUNTER_LIST = { } ;
Encounter * EDITING_ENCOUNTER = nullptr ;
Encounter * EDITING_ENCOUNTER = nullptr ;
Encounter * BATTLE_ENCOUNTER = nullptr ;
Encounter * BATTLE_ENCOUNTER = nullptr ;
int BATTLE_STATE = BattleState : : MOVE_CAMERA ;
int BATTLE_STATE = BattleState : : MOVE_CAMERA ;
@ -142,14 +142,14 @@ public:
int BATTLE_HIT_SCREENSHAKE = 0 ; //Amount of time the screen will rapidly shake as getting hit.
int BATTLE_HIT_SCREENSHAKE = 0 ; //Amount of time the screen will rapidly shake as getting hit.
bool ITEM_REQUIRES_EQUIPPING = false ;
bool ITEM_REQUIRES_EQUIPPING = false ;
std : : string EQUIP_ $ ITEM_DISPLAY = " " ; //Use this to change the $ITEM tag modifier for abilities.
std : : string EQUIP_ $ ITEM_DISPLAY = " " ; //Use this to change the $ITEM tag modifier for abilities.
std : : vector < CustomItemMessage > BATTLE_CUSTOM_MSGS ; //Used for displaying additional information during battles.
std : : vector < CustomItemMessage > BATTLE_CUSTOM_MSGS = { } ; //Used for displaying additional information during battles.
CustomItemMessage BATTLE_CURRENT_CUSTOM_MSG ;
CustomItemMessage BATTLE_CURRENT_CUSTOM_MSG = { } ;
int BATTLE_CUSTOM_MESSAGE_WAIT_TIME = 0 ;
int BATTLE_CUSTOM_MESSAGE_WAIT_TIME = 0 ;
Item * BATTLE_CUSTOM_ITEM ;
Item * BATTLE_CUSTOM_ITEM = nullptr ;
std : : vector < Item * > BATTLE_SPOILS_LIST ;
std : : vector < Item * > BATTLE_SPOILS_LIST = { } ;
std : : string BATTLE_SPOILS_MESSAGE ;
std : : string BATTLE_SPOILS_MESSAGE = " " ;
int OVERWORLD_MENU_SELECTION = 0 ;
int OVERWORLD_MENU_SELECTION = 0 ;
std : : vector < std : : string > INTERACTION_MESSAGES ;
std : : vector < std : : string > INTERACTION_MESSAGES = { } ;
bool CLOSE_OVERWORLD_WINDOW = false ; //When set to true, should cause the overworld menu to close as well once the dialog box is closed.
bool CLOSE_OVERWORLD_WINDOW = false ; //When set to true, should cause the overworld menu to close as well once the dialog box is closed.
int OVERWORLD_POWER_SELECTION_CURSOR [ 4 ] = { 0 , 0 , 0 , 0 } ;
int OVERWORLD_POWER_SELECTION_CURSOR [ 4 ] = { 0 , 0 , 0 , 0 } ;
int OVERWORLD_POWER_GRADE_CURSOR = 0 ;
int OVERWORLD_POWER_GRADE_CURSOR = 0 ;
@ -166,26 +166,27 @@ public:
Key KEY_LASTPRESSED = NONE ;
Key KEY_LASTPRESSED = NONE ;
int lastPress = 0 ;
int lastPress = 0 ;
int lastRepeatedFrame = 0 ;
int lastRepeatedFrame = 0 ;
EquipSlot : : Equip EQUIP_MENU_SLOT = EquipSlot : : WEAPON ;
bool MOUSE_PRESSED_DOWN = false , MOUSE_DOWN = false , MOUSE_RELEASED = false ; //TODO Implement Mouse things.
bool MOUSE_PRESSED_DOWN = false , MOUSE_DOWN = false , MOUSE_RELEASED = false ; //TODO Implement Mouse things.
std : : vector < std : : vector < TILE * > > MAP ; //The foreground layer.
std : : vector < std : : vector < TILE * > > MAP = { } ; //The foreground layer.
std : : vector < std : : vector < TILE * > > MAP2 ;
std : : vector < std : : vector < TILE * > > MAP2 = { } ;
std : : vector < std : : vector < TILE * > > MAP3 ;
std : : vector < std : : vector < TILE * > > MAP3 = { } ;
std : : vector < std : : vector < TILE * > > MAP4 ;
std : : vector < std : : vector < TILE * > > MAP4 = { } ;
std : : vector < std : : vector < TILE * > > MAP5 ; //Collision Layer
std : : vector < std : : vector < TILE * > > MAP5 = { } ; //Collision Layer
std : : map < std : : string , Decal * > SPRITES ;
std : : map < std : : string , Decal * > SPRITES ;
std : : map < std : : string , Animation * > ANIMATIONS ;
std : : map < std : : string , Animation * > ANIMATIONS = { } ;
std : : map < int , Object * > OBJ_INFO ;
std : : map < int , Object * > OBJ_INFO = { } ;
std : : vector < Particle * > PARTICLES ;
std : : vector < Particle * > PARTICLES = { } ;
std : : vector < DamageNumber * > DAMAGE_NUMBERS ;
std : : vector < DamageNumber * > DAMAGE_NUMBERS = { } ;
std : : map < std : : pair < int , int > , vd2d > MOVEMENT_GRID ;
std : : map < std : : pair < int , int > , vd2d > MOVEMENT_GRID = { } ;
std : : map < ItemName , Item * > ITEMLIST ;
std : : map < ItemName , Item * > ITEMLIST = { } ;
vi2d SELECTED_MOVE_SQUARE ;
vi2d SELECTED_MOVE_SQUARE = { } ;
FountainEffect * FOUNTAIN_EFFECT ;
FountainEffect * FOUNTAIN_EFFECT = nullptr ;
FireFountainEffect * FIREFOUNTAIN_EFFECT ;
FireFountainEffect * FIREFOUNTAIN_EFFECT = nullptr ;
@ -887,6 +888,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
BATTLE_ENCOUNTER - > objs [ i ] - > obj - > highlighted = false ;
BATTLE_ENCOUNTER - > objs [ i ] - > obj - > highlighted = false ;
}
}
PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ - CURRENT_TURN - 1 ] ] - > selectedMove = nullptr ;
PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ - CURRENT_TURN - 1 ] ] - > selectedMove = nullptr ;
PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ - CURRENT_TURN - 1 ] ] - > channelPos = DEFAULT_CHANNELPOS ;
ITEM_REQUIRES_EQUIPPING = false ;
ITEM_REQUIRES_EQUIPPING = false ;
}
}
if ( ACTIONKEYPRESSED ) {
if ( ACTIONKEYPRESSED ) {
@ -1119,7 +1121,12 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
GAME_STATE = GameState : : OVERWORLD_ITEMS_MENU ;
GAME_STATE = GameState : : OVERWORLD_ITEMS_MENU ;
} break ;
} break ;
case 3 : { //Equip is selected.
case 3 : { //Equip is selected.
OVERWORLD_POWER_SELECTION_MEMBER = 0 ;
if ( PARTY_MEMBER_COUNT = = 1 ) {
GAME_STATE = GameState : : OVERWORLD_EQUIP_MENU ;
} else {
GAME_STATE = GameState : : OVERWORLD_EQUIP_PLAYER_MENU ;
}
} break ;
} break ;
case 4 : { //Status is selected.
case 4 : { //Status is selected.
@ -1454,6 +1461,42 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
OBJ_DISPLAY_OFFSET - = WIDTH / 16 ;
OBJ_DISPLAY_OFFSET - = WIDTH / 16 ;
}
}
} break ;
} break ;
case GameState : : OVERWORLD_EQUIP_PLAYER_MENU : {
if ( LeftPressed ( ) ) {
OVERWORLD_POWER_SELECTION_MEMBER - - ;
if ( OVERWORLD_POWER_SELECTION_MEMBER < 0 ) {
OVERWORLD_POWER_SELECTION_MEMBER = PARTY_MEMBER_COUNT - 1 ;
}
}
if ( RightPressed ( ) ) {
OVERWORLD_POWER_SELECTION_MEMBER = ( OVERWORLD_POWER_SELECTION_MEMBER + 1 ) % PARTY_MEMBER_COUNT ;
}
if ( UpPressed ( ) ) {
GAME_STATE = GameState : : OVERWORLD_MENU ;
}
if ( ACTIONKEYPRESSED ) {
GAME_STATE = GameState : : OVERWORLD_EQUIP_MENU ;
EQUIP_MENU_SLOT = EquipSlot : : WEAPON ;
}
} break ;
case GameState : : OVERWORLD_EQUIP_MENU : {
if ( UpPressed ( ) ) {
EQUIP_MENU_SLOT = ( EquipSlot : : Equip ) ( EQUIP_MENU_SLOT - 1 ) ;
if ( EQUIP_MENU_SLOT < 0 ) {
EQUIP_MENU_SLOT = EquipSlot : : Equip : : ACCESSORY ;
}
}
if ( DownPressed ( ) ) {
EQUIP_MENU_SLOT = ( EquipSlot : : Equip ) ( ( EQUIP_MENU_SLOT + 1 ) % 3 ) ;
}
if ( LeftPressed ( ) ) {
if ( PARTY_MEMBER_COUNT = = 1 ) {
GAME_STATE = GameState : : OVERWORLD_MENU ;
} else {
GAME_STATE = GameState : : OVERWORLD_EQUIP_PLAYER_MENU ;
}
}
} break ;
}
}
ANYKEYPRESSED = ACTIONKEYPRESSED = false ;
ANYKEYPRESSED = ACTIONKEYPRESSED = false ;
}
}
@ -1594,6 +1637,23 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
}
DrawDecal ( { static_cast < float > ( 2 + 4 ) , static_cast < float > ( 2 + 6 + OVERWORLD_MENU_SELECTION * 16 ) } , SPRITES [ " cursor.png " ] ) ;
DrawDecal ( { static_cast < float > ( 2 + 4 ) , static_cast < float > ( 2 + 6 + OVERWORLD_MENU_SELECTION * 16 ) } , SPRITES [ " cursor.png " ] ) ;
}
}
if ( GAME_STATE = = GameState : : OVERWORLD_EQUIP_PLAYER_MENU | | GAME_STATE = = GameState : : OVERWORLD_EQUIP_MENU | | GAME_STATE = = GameState : : OVERWORLD_EQUIP_ITEM_MENU ) {
DrawDialogBox ( { 4 , 4 } , { ( int ) ( WIDTH / 1.5 ) , HEIGHT / 4 } , Pixel ( 70 , 33 , 105 , 220 ) , Pixel ( 62 , 54 , 69 , 220 ) , Pixel ( 185 , 148 , 255 , 220 ) ) ;
vi2d textSize = GetTextSizeProp ( PARTY_MEMBER_OBJ [ OVERWORLD_POWER_SELECTION_MEMBER ] - > name ) / 2 ;
DrawStringPropDecal ( { ( float ) ( WIDTH / 1.5 - textSize . x ) - 4 , 4 } , PARTY_MEMBER_OBJ [ OVERWORLD_POWER_SELECTION_MEMBER ] - > name , WHITE , { 0.5 , 1 } ) ;
if ( GAME_STATE = = GameState : : OVERWORLD_EQUIP_PLAYER_MENU ) {
DrawRotatedDecal ( { ( float ) ( WIDTH / 1.5 - textSize . x - 6 ) , 7 } , SPRITES [ " cursor.png " ] , M_PI , { ( float ) SPRITES [ " cursor.png " ] - > sprite - > width / 2 , ( float ) SPRITES [ " cursor.png " ] - > sprite - > height / 2 } , { ( sinf ( frameCount / 10.F * M_PI ) > 0 ) ? 0.5F : 0.25F , ( sinf ( frameCount / 10.F * M_PI ) > 0 ) ? 0.5F : 0.25F } ) ;
DrawRotatedDecal ( { ( float ) ( WIDTH / 1.5 - 2 ) , 7 } , SPRITES [ " cursor.png " ] , 0 , { ( float ) SPRITES [ " cursor.png " ] - > sprite - > width / 2 , ( float ) SPRITES [ " cursor.png " ] - > sprite - > height / 2 } , { ( sinf ( frameCount / 10.F * M_PI ) > 0 ) ? 0.5F : 0.25F , ( sinf ( frameCount / 10.F * M_PI ) > 0 ) ? 0.5F : 0.25F } ) ;
}
if ( GAME_STATE = = GameState : : OVERWORLD_EQUIP_MENU ) {
DrawDecal ( { 8 , ( float ) ( 19 + EQUIP_MENU_SLOT * 12 ) } , SPRITES [ " cursor.png " ] ) ;
}
std : : string labels [ 3 ] = { " WEAPON: " , " ARMOR: " , " OTHER: " } ;
for ( int i = 0 ; i < 3 ; i + + ) {
DrawStringPropDecal ( { 16 , ( float ) ( 19 + i * 12 ) } , labels [ i ] ) ;
DrawStringPropDecal ( { 12 + 64 , ( float ) ( 19 + i * 12 ) } , ( PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ OVERWORLD_POWER_SELECTION_MEMBER ] ] - > equipment [ i ] ! = nullptr ) ? PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ OVERWORLD_POWER_SELECTION_MEMBER ] ] - > equipment [ i ] - > name : " None " ) ;
}
}
if ( GAME_STATE = = GameState : : OVERWORLD_POWER_MENU | | GAME_STATE = = GameState : : OVERWORLD_POWER_PLAYER_MENU | | GAME_STATE = = GameState : : OVERWORLD_GRADE_MENU ) {
if ( GAME_STATE = = GameState : : OVERWORLD_POWER_MENU | | GAME_STATE = = GameState : : OVERWORLD_POWER_PLAYER_MENU | | GAME_STATE = = GameState : : OVERWORLD_GRADE_MENU ) {
DrawBattleMoveList ( OVERWORLD_POWER_SELECTION_MEMBER ) ;
DrawBattleMoveList ( OVERWORLD_POWER_SELECTION_MEMBER ) ;
}
}
@ -2296,7 +2356,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
ITEMLIST [ ItemName : : COOKIE ] = new Item ( " Cookie " , " A delightful little treat. Restores 40 HP. " , 2 , { hpRecovery : 40 , consumable : Consumable : : FRIENDLY } ) ;
ITEMLIST [ ItemName : : COOKIE ] = new Item ( " Cookie " , " A delightful little treat. Restores 40 HP. " , 2 , { hpRecovery : 40 , consumable : Consumable : : FRIENDLY } ) ;
ITEMLIST [ ItemName : : EGG ] = new Item ( " Egg " , " Did it come before or after the chicken? Restores 60 HP. " , 3 , { hpRecovery : 60 , consumable : Consumable : : FRIENDLY } ) ;
ITEMLIST [ ItemName : : EGG ] = new Item ( " Egg " , " Did it come before or after the chicken? Restores 60 HP. " , 3 , { hpRecovery : 60 , consumable : Consumable : : FRIENDLY } ) ;
ITEMLIST [ ItemName : : PIZZA ] = new Item ( " Pizza " , " A scrumptious meal filled with lots of cheese. Restores 200 HP. " , 4 , { hpRecovery : 200 , consumable : Consumable : : FRIENDLY } ) ;
ITEMLIST [ ItemName : : PIZZA ] = new Item ( " Pizza " , " A scrumptious meal filled with lots of cheese. Restores 200 HP. " , 4 , { hpRecovery : 200 , consumable : Consumable : : FRIENDLY } ) ;
ITEMLIST [ ItemName : : MIRACLE_FOOD_LUNCH ] = new Item ( " Miracle Food Lunch " , " It doesn't taste very good, but it's said to have miraco ulous powers when consumed. " , 16 , { hpRecovery : 30 , ppRecovery : 10 , atkIncrease : 30 , spdIncrease : 6 , hpIncrease : 150 , ppIncrease : 100 , learnAbility : MOVELIST [ BattleMoveName : : PKFIRE_O ] , consumable : Consumable : : FRIENDLY_PERMANENT } ) ;
ITEMLIST [ ItemName : : MIRACLE_FOOD_LUNCH ] = new Item ( " Miracle Food Lunch " , " It doesn't taste very good, but it's said to have miraculous powers when consumed. " , 16 , { hpRecovery : 30 , ppRecovery : 10 , atkIncrease : 30 , spdIncrease : 6 , hpIncrease : 150 , ppIncrease : 100 , learnAbility : MOVELIST [ BattleMoveName : : PKFIRE_O ] , consumable : Consumable : : FRIENDLY_PERMANENT } ) ;
ITEMLIST [ ItemName : : BOMB ] = new Item ( " Bomb " , " A small explosive device. Deals around 120 damage. " , 256 , { damage : 110 , rollDmg : 30 , consumable : Consumable : : ENEMY } ) ;
ITEMLIST [ ItemName : : BOMB ] = new Item ( " Bomb " , " A small explosive device. Deals around 120 damage. " , 256 , { damage : 110 , rollDmg : 30 , consumable : Consumable : : ENEMY } ) ;
ITEMLIST [ ItemName : : CRACKED_BAT ] = new Item ( " Cracked Bat " , " Has some dents in it, but you can probably still dent things with it yourself. " , 256 , { attack : 10 , equip : EquipSlot : : WEAPON } ) ;
ITEMLIST [ ItemName : : CRACKED_BAT ] = new Item ( " Cracked Bat " , " Has some dents in it, but you can probably still dent things with it yourself. " , 256 , { attack : 10 , equip : EquipSlot : : WEAPON } ) ;
ITEMLIST [ ItemName : : TEE_BALL_BAT ] = new Item ( " Tee Ball Bat " , " Great for playing some ball! Also great for beating your foes! " , 256 , { attack : 40 , equip : EquipSlot : : WEAPON } ) ;
ITEMLIST [ ItemName : : TEE_BALL_BAT ] = new Item ( " Tee Ball Bat " , " Great for playing some ball! Also great for beating your foes! " , 256 , { attack : 40 , equip : EquipSlot : : WEAPON } ) ;
@ -3719,7 +3779,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
}
}
}
}
int attackerDamage = ( attacker - > selectedMove - > baseDmg +
int attackerDamage = ( attacker - > selectedMove - > baseDmg +
( ( rand ( ) % attacker - > selectedMove - > randomDmg > 0 ) ? rand ( ) % attacker - > selectedMove - > randomDmg : 0 )
( ( attacker - > selectedMove - > randomDmg > 0 ) ? rand ( ) % attacker - > selectedMove - > randomDmg : 0 )
+ attacker - > baseAtk
+ attacker - > baseAtk
+ equipDamage ) ;
+ equipDamage ) ;
finalDamage + = attackerDamage ;
finalDamage + = attackerDamage ;