@ -289,6 +289,9 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
AddItemToPlayerInventory ( ItemName : : BOMB ) ;
AddItemToPlayerInventory ( ItemName : : BOMB ) ;
AddItemToPlayerInventory ( ItemName : : BOMB ) ;
AddItemToPlayerInventory ( ItemName : : SOME_STUPIDLY_LONG_FEATHER ) ;
AddItemToPlayerInventory ( ItemName : : SOME_STUPIDLY_LONG_FEATHER ) ;
AddItemToPlayerInventory ( ItemName : : SOME_STUPIDLY_LONG_FEATHER ) ;
for ( int i = 0 ; i < 20 ; i + + ) {
AddItemToPlayerInventory ( ItemName : : COOKIE ) ;
}
@ -1635,6 +1638,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
EQUIP_ITEM_MENU_OFFSET = EQUIP_ITEM_MENU_CURSOR ;
}
PopulateEquipMenuItems ( ) ;
GAME_STATE = GameState : : OVERWORLD_EQUIP_MENU ;
}
} break ;
}
@ -1794,7 +1798,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
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 " ) ;
std : : string equipName = ( 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 " ;
DrawStringPropDecal ( { 12 + 64 , ( float ) ( 19 + i * 12 ) } , equipName , WHITE , { std : : min ( 1.0F , ( float ) ( ( WIDTH / 1.5 ) - 84 ) / GetTextSizeProp ( equipName ) . x ) , 1 } ) ;
}
}
if ( GAME_STATE = = GameState : : OVERWORLD_EQUIP_ITEM_MENU ) {
@ -1802,7 +1807,8 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
DrawDecal ( { 8 , ( float ) ( 12 + ( EQUIP_ITEM_MENU_CURSOR - EQUIP_ITEM_MENU_OFFSET ) * 12 ) } , SPRITES [ " cursor.png " ] ) ;
for ( int i = 0 ; i < 8 ; i + + ) {
if ( EQUIP_ITEM_MENU_OFFSET + i < EQUIP_ITEM_MENU_CONTENTS . size ( ) ) {
DrawStringPropDecal ( { 16 , ( float ) ( 12 + i * 12 ) } , EQUIP_ITEM_MENU_CONTENTS [ i + EQUIP_ITEM_MENU_OFFSET ] = = - 1 ? " Unequip " : PARTY_INVENTORY [ EQUIP_ITEM_MENU_CONTENTS [ i + EQUIP_ITEM_MENU_OFFSET ] ] - > name ) ;
std : : string equipName = EQUIP_ITEM_MENU_CONTENTS [ i + EQUIP_ITEM_MENU_OFFSET ] = = - 1 ? " Unequip " : PARTY_INVENTORY [ EQUIP_ITEM_MENU_CONTENTS [ i + EQUIP_ITEM_MENU_OFFSET ] ] - > name ;
DrawStringPropDecal ( { 16 , ( float ) ( 12 + i * 12 ) } , equipName , WHITE , { std : : min ( 1.0F , ( float ) ( ( WIDTH / 2 ) - 12 ) / GetTextSizeProp ( equipName ) . x ) , 1 } ) ;
}
}
if ( EQUIP_ITEM_MENU_OFFSET > 0 ) {
@ -1811,6 +1817,26 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
if ( EQUIP_ITEM_MENU_OFFSET + 8 < EQUIP_ITEM_MENU_CONTENTS . size ( ) ) {
DrawRotatedDecal ( { WIDTH / 2 - 20 , 4 + HEIGHT / 2 - 4 } , SPRITES [ " cursor.png " ] , M_PI_2 , { 4 , 4 } ) ;
}
if ( EQUIP_ITEM_MENU_CONTENTS [ EQUIP_ITEM_MENU_CURSOR ] ! = - 1 ) {
DrawDialogBox ( { ( int ) ( WIDTH / 2 + 8 ) , HEIGHT / 6 + 4 } , { ( int ) ( WIDTH / 2 - 8 ) , HEIGHT / 3 } , Pixel ( 70 , 33 , 105 , 220 ) , Pixel ( 62 , 54 , 69 , 220 ) , Pixel ( 185 , 148 , 255 , 220 ) ) ;
DrawStringPropDecal ( { ( int ) ( WIDTH / 2 + 8 ) + 4 , HEIGHT / 6 + 8 } , Wrap ( PARTY_INVENTORY [ EQUIP_ITEM_MENU_CONTENTS [ EQUIP_ITEM_MENU_CURSOR ] ] - > description , ( int ) ( WIDTH / 2 - 8 ) - 8 , true , { 1 , 1 } ) ) ;
}
DrawDialogBox ( { 4 , HEIGHT / 2 + 4 } , { ( int ) ( WIDTH / 2 ) , HEIGHT / 8 } , Pixel ( 70 , 33 , 105 , 220 ) , Pixel ( 62 , 54 , 69 , 220 ) , Pixel ( 185 , 148 , 255 , 220 ) ) ;
DrawDialogBox ( { 4 , ( int ) ( HEIGHT * ( 5.F / 8 ) + 4 ) } , { ( int ) ( WIDTH / 2 ) , HEIGHT / 8 } , Pixel ( 70 , 33 , 105 , 220 ) , Pixel ( 62 , 54 , 69 , 220 ) , Pixel ( 185 , 148 , 255 , 220 ) ) ;
DrawStringPropDecal ( { 8 , HEIGHT / 2 + 12 } , " ATTACK " , WHITE , { 0.85 , 2 } ) ;
DrawStringPropDecal ( { 8 , HEIGHT * ( 5.F / 8 ) + 12 } , " DEFENSE " , WHITE , { 0.85 , 2 } ) ;
int equipAttack = 0 ;
int equipDefense = 0 ;
int newAttack = 0 ;
int newDefense = 0 ;
CalculateChangeInEquipmentStats ( OVERWORLD_POWER_SELECTION_MEMBER , EQUIP_ITEM_MENU_CONTENTS [ EQUIP_ITEM_MENU_CURSOR ] , equipAttack , equipDefense , newAttack , newDefense ) ;
std : : string atkStr = std : : to_string ( equipAttack ) + " -> " ;
DrawStringPropDecal ( { 72 , HEIGHT / 2 + 12 } , atkStr , WHITE , { 0.85 , 2 } ) ;
DrawStringPropDecal ( { 72 + GetTextSizeProp ( atkStr ) . x * 0.85F , HEIGHT / 2 + 12 } , std : : to_string ( newAttack ) , ( newAttack > equipAttack ) ? GREEN : ( newAttack < equipAttack ) ? RED : WHITE , { 0.85 , 2 } ) ;
std : : string defStr = std : : to_string ( equipDefense ) + " -> " ;
DrawStringPropDecal ( { 72 , HEIGHT * ( 5.F / 8 ) + 12 } , defStr , WHITE , { 0.85 , 2 } ) ;
DrawStringPropDecal ( { 72 + GetTextSizeProp ( defStr ) . x * 0.85F , HEIGHT * ( 5.F / 8 ) + 12 } , std : : to_string ( newDefense ) , ( newDefense > equipDefense ) ? GREEN : ( newDefense < equipDefense ) ? RED : WHITE , { 0.85 , 2 } ) ;
}
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 ) ;
@ -1958,25 +1984,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
int equipDefense = 0 ;
int newAttack = 0 ;
int newDefense = 0 ;
EquipSlot : : Equip slot = PARTY_INVENTORY [ ITEM_SELECTION_CURSOR ] - > stats . equip ;
for ( int j = 0 ; j < PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment . size ( ) ; j + + ) {
if ( PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment [ j ] ! = nullptr ) {
equipAttack + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment [ j ] - > stats . attack ;
equipDefense + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment [ j ] - > stats . defense ;
if ( PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment [ j ] - > stats . equip = = slot ) {
newAttack + = PARTY_INVENTORY [ ITEM_SELECTION_CURSOR ] - > stats . attack ;
newDefense + = PARTY_INVENTORY [ ITEM_SELECTION_CURSOR ] - > stats . defense ;
} else {
newAttack + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment [ j ] - > stats . attack ;
newDefense + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > equipment [ j ] - > stats . defense ;
}
} else {
if ( j = = slot ) {
newAttack + = PARTY_INVENTORY [ ITEM_SELECTION_CURSOR ] - > stats . attack ;
newDefense + = PARTY_INVENTORY [ ITEM_SELECTION_CURSOR ] - > stats . defense ;
}
}
}
CalculateChangeInEquipmentStats ( i , ITEM_SELECTION_CURSOR , equipAttack , equipDefense , newAttack , newDefense ) ;
DrawStringPropDecal ( { ( float ) 4 + WIDTH * ( 1.0F / 8 ) , ( float ) ( HEIGHT / 2 + 4 + 12 + i * 10 ) } , std : : to_string ( PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ i ] ] - > baseAtk + newAttack ) , ( newAttack > equipAttack ) ? GREEN : ( newAttack < equipAttack ) ? RED : WHITE , { 0.5 , 1 } ) ;
DrawStringPropDecal ( { ( float ) 4 + WIDTH * ( 1.0F / 4 ) , ( float ) ( HEIGHT / 2 + 4 + 12 + i * 10 ) } , std : : to_string ( newDefense ) , ( newDefense > equipDefense ) ? GREEN : ( newDefense < equipDefense ) ? RED : WHITE , { 0.5 , 1 } ) ;
if ( newAttack ! = equipAttack ) { DrawRotatedDecal ( { ( float ) 4 + WIDTH * ( 1.0F / 4 ) - 14 , ( float ) ( HEIGHT / 2 + 4 + 12 + i * 10 + 2 + ( ( newAttack < equipAttack ) ? 4 : 0 ) ) } , SPRITES [ " cursor.png " ] , newAttack > equipAttack ? - M_PI_2 : M_PI_2 , { 4 , 4 } , { 0.5 , 0.5 } , newAttack > equipAttack ? GREEN : RED ) ; }
@ -2523,6 +2531,7 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
ITEMLIST [ ItemName : : COPPER_BRACELET ] = new Item ( " Copper Bracelet " , " It's not quite as shiny as a diamond, but it still makes you look good. " , 256 , { defense : 5 , equip : EquipSlot : : ACCESSORY } ) ;
ITEMLIST [ ItemName : : KEY_TO_THE_PALACE ] = new Item ( " Key to the Palace " , " Lets you access a Palace. " , 256 , { important : true } ) ;
ITEMLIST [ ItemName : : FREEZE_PACKET ] = new Item ( " Freeze Packet " , " Lets out some blistering cold weather. " , 256 , { consumable : Consumable : : ENEMY } , MOVELIST [ BattleMoveName : : FREEZE_PACKET ] ) ;
ITEMLIST [ ItemName : : SOME_STUPIDLY_LONG_FEATHER ] = new Item ( " Some Stupidly Long Feather " , " Yeah, we don't know why this feather is so long either. " , 256 , { attack : 2 , defense : 3 , equip : EquipSlot : : ACCESSORY } ) ;
}
void SetupAnimations ( ) {
@ -4417,6 +4426,37 @@ This is a test message that lets us trigger straight from a cutscene! Cool!)"),
EQUIP_ITEM_MENU_CONTENTS . push_back ( - 1 ) ;
}
}
void CalculateChangeInEquipmentStats ( int partyMemberSlot , int itemSlot , int & equipAttack , int & equipDefense , int & newAttack , int & newDefense ) {
EquipSlot : : Equip slot ;
if ( itemSlot = = - 1 ) {
slot = EQUIP_MENU_SLOT ;
} else {
slot = PARTY_INVENTORY [ itemSlot ] - > stats . equip ;
}
for ( int j = 0 ; j < PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment . size ( ) ; j + + ) {
if ( PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment [ j ] ! = nullptr ) {
equipAttack + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment [ j ] - > stats . attack ;
equipDefense + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment [ j ] - > stats . defense ;
if ( PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment [ j ] - > stats . equip = = slot ) {
if ( itemSlot ! = - 1 ) {
newAttack + = PARTY_INVENTORY [ itemSlot ] - > stats . attack ;
newDefense + = PARTY_INVENTORY [ itemSlot ] - > stats . defense ;
}
} else {
newAttack + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment [ j ] - > stats . attack ;
newDefense + = PARTY_MEMBER_STATS [ PARTY_MEMBER_ID [ partyMemberSlot ] ] - > equipment [ j ] - > stats . defense ;
}
} else {
if ( j = = slot ) {
if ( itemSlot ! = - 1 ) {
newAttack + = PARTY_INVENTORY [ itemSlot ] - > stats . attack ;
newDefense + = PARTY_INVENTORY [ itemSlot ] - > stats . defense ;
}
}
}
}
}
} ;
int main ( )