Mercurial > mm7
changeset 1246:975480e1ce38
spelling fix and macros optimise
author | Gloval |
---|---|
date | Tue, 11 Jun 2013 10:45:19 +0400 |
parents | e161d8a5a529 |
children | fd532497ffab |
files | Arcomage.cpp |
diffstat | 1 files changed, 57 insertions(+), 61 deletions(-) [+] |
line wrap: on
line diff
--- a/Arcomage.cpp Tue Jun 11 08:49:04 2013 +0400 +++ b/Arcomage.cpp Tue Jun 11 10:45:19 2013 +0400 @@ -54,7 +54,7 @@ bool CanCardBePlayed(int player_num, int hand_card_indx); void ApplyCardToPlayer(int player_num, unsigned int uCardID); // idb int am_40D2B4(POINT* a1, int a2); // weak -int ApplyDamadeToBuildings(int player_num, int damage); // weak +int ApplyDamageToBuildings(int player_num, int damage); // weak void GameResultsApply(); void pPrimaryWindow_draws_text(int a1, const char *pText, POINT *pXY); @@ -1983,7 +1983,7 @@ } while (v3 < 6); - pArcomageGame->event_timer_time = pEventTimer->Time(); + pArcomageGame->event_timer_time = (unsigned int )pEventTimer->Time(); if ( pArcomageGame->field_F4 ) v16 = 1; ArcomageGame::MsgLoop(0, &a2); @@ -3357,26 +3357,24 @@ #define APPLY_TO_PLAYER( PLAYER, ENEMY,FIELD, VAL, RES )\ - if ((signed int)(VAL) == 99)\ - {\ - if ( PLAYER->##FIELD < ENEMY->##FIELD )\ - {\ - PLAYER->##FIELD = ENEMY->##FIELD;\ - RES = ENEMY->##FIELD - PLAYER->##FIELD;\ - }\ + if (VAL != 0) {\ + if (VAL == 99) {\ + if ( PLAYER->##FIELD < ENEMY->##FIELD ) {\ + PLAYER->##FIELD = ENEMY->##FIELD;\ + RES = ENEMY->##FIELD - PLAYER->##FIELD;\ + }\ + } else {\ + PLAYER->##FIELD += (signed int)(VAL);\ + if ( PLAYER->##FIELD<0 ) PLAYER->##FIELD= 0;\ + RES = (signed int)(VAL);\ }\ - else if ((signed int)(VAL) != 0)\ - {\ - PLAYER->##FIELD += (signed int)(VAL);\ - if ( PLAYER->##FIELD<0 )\ - PLAYER->##FIELD= 0;\ - RES = (signed int)(VAL);\ - } + } #define APPLY_TO_ENEMY( PLAYER, ENEMY,FIELD, VAL, RES ) APPLY_TO_PLAYER(ENEMY, PLAYER, FIELD, VAL, RES) #define APPLY_TO_BOTH( PLAYER, ENEMY, FIELD, VAL, RES_P, RES_E ) \ - if ( (signed int)(VAL) == 99 ) { \ + if ( VAL != 0) {\ + if ( VAL == 99 ) { \ if ( PLAYER->##FIELD != ENEMY->##FIELD ) { \ if ( PLAYER->##FIELD <= ENEMY->##FIELD ) { \ PLAYER->##FIELD = ENEMY->##FIELD; \ @@ -3386,15 +3384,13 @@ RES_E = PLAYER->##FIELD - ENEMY->##FIELD; \ } \ }\ - } \ - else if ((signed int)VAL != 0) { \ + } else { \ PLAYER->##FIELD += (signed int)(VAL);\ ENEMY->##FIELD += (signed int)(VAL); if (PLAYER->##FIELD < 0 ) {PLAYER->##FIELD = 0;} \ if ( ENEMY->##FIELD < 0 ) {ENEMY->##FIELD = 0;} \ - RES_P = (signed int)(VAL); \ - RES_E = (signed int)(VAL); \ - } - + RES_P = (signed int)(VAL); RES_E = (signed int)(VAL); \ + }\ + } ArcomagePlayer *player; // esi@1 int v3; // eax@1 ArcomagePlayer *enemy; // edi@1 @@ -3445,26 +3441,26 @@ int magic_p; // [sp+68h] [bp-8h]@1 int quarry_e; // [sp+6Ch] [bp-4h]@1 - quarry_p = 0; - magic_p = 0; - zoo_p = 0; - bricks_p = 0; - gems_p = 0; - beasts_p = 0; - wall_p = 0; - tower_p = 0; + quarry_p = 0; + magic_p = 0; + zoo_p = 0; + bricks_p = 0; + gems_p = 0; + beasts_p = 0; + wall_p = 0; + tower_p = 0; buildings_p = 0; - dmg_p = 0; - quarry_e = 0; - magic_e = 0; - zoo_e = 0; - bricks_e = 0; - gems_e = 0; - beasts_e = 0; - wall_e = 0; - tower_e = 0; + dmg_p = 0; + quarry_e = 0; + magic_e = 0; + zoo_e = 0; + bricks_e = 0; + gems_e = 0; + beasts_e = 0; + wall_e = 0; + tower_e = 0; buildings_e = 0; - dmg_e = 0; + dmg_e = 0; player = &am_Players[player_num]; pCard = &pCards[uCardID]; @@ -3590,13 +3586,13 @@ APPLY_TO_PLAYER(player, enemy, resource_bricks, pCard->to_player_bricks, bricks_p); APPLY_TO_PLAYER(player, enemy, resource_gems, pCard->to_player_gems, gems_p); APPLY_TO_PLAYER(player, enemy, resource_beasts, pCard->to_player_beasts, beasts_p); - if ( (int)pCard->to_player_buildings ) + if ( pCard->to_player_buildings ) { - dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_player_buildings); - buildings_p = (int)pCard->to_player_buildings - dmg_p; + dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_player_buildings); + buildings_p = (signed int)pCard->to_player_buildings - dmg_p; } - APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall, wall_p); - APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower, tower_p); + APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall, wall_p); + APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower, tower_p); APPLY_TO_ENEMY(player, enemy, quarry_level, pCard->to_enemy_quarry_lvl, quarry_e); APPLY_TO_ENEMY(player, enemy, magic_level, pCard->to_enemy_magic_lvl, magic_e); @@ -3606,8 +3602,8 @@ APPLY_TO_ENEMY(player, enemy, resource_beasts, pCard->to_enemy_beasts, beasts_e); if ( pCard->to_enemy_buildings ) { - dmg_e = ApplyDamadeToBuildings(enemy_num, (int)pCard->to_enemy_buildings); - buildings_e = pCard->to_enemy_buildings - dmg_e; + dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_enemy_buildings); + buildings_e = (signed int)pCard->to_enemy_buildings - dmg_e; } APPLY_TO_ENEMY(player, enemy, wall_height, pCard->to_enemy_wall, wall_e); APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower, tower_e); @@ -3620,10 +3616,10 @@ APPLY_TO_BOTH(player, enemy, resource_beasts, pCard->to_pl_enm_beasts, beasts_p, beasts_e); if ( pCard->to_pl_enm_buildings ) { - dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_pl_enm_buildings); - dmg_e = ApplyDamadeToBuildings(enemy_num, (int)pCard->to_pl_enm_buildings); - buildings_p = pCard->to_pl_enm_buildings - dmg_p; - buildings_e = pCard->to_pl_enm_buildings - dmg_e; + dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_pl_enm_buildings); + dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_pl_enm_buildings); + buildings_p = (signed int)pCard->to_pl_enm_buildings - dmg_p; + buildings_e = (signed int)pCard->to_pl_enm_buildings - dmg_e; } APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall, wall_p, wall_e); APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower, tower_p, tower_e); @@ -3654,8 +3650,8 @@ APPLY_TO_PLAYER(player, enemy, resource_beasts, pCard->to_player_beasts2, beasts_p); if ( pCard->to_player_buildings2 ) { - dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_player_buildings2); - buildings_p = (int)pCard->to_player_buildings2 - dmg_p; + dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_player_buildings2); + buildings_p = (signed int)pCard->to_player_buildings2 - dmg_p; } APPLY_TO_PLAYER(player, enemy, wall_height, pCard->to_player_wall2, wall_p); APPLY_TO_PLAYER(player, enemy, tower_height, pCard->to_player_tower2, tower_p); @@ -3668,8 +3664,8 @@ APPLY_TO_ENEMY(player, enemy, resource_beasts, pCard->to_enemy_beasts2, beasts_e); if ( pCard->to_enemy_buildings2 ) { - dmg_e = ApplyDamadeToBuildings(enemy_num, (int)pCard->to_enemy_buildings2); - buildings_e = (int)pCard->to_enemy_buildings2 - dmg_e; + dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_enemy_buildings2); + buildings_e = (signed int)pCard->to_enemy_buildings2 - dmg_e; } APPLY_TO_ENEMY(player, enemy, wall_height, pCard->to_enemy_wall2, wall_e); APPLY_TO_ENEMY(player, enemy, tower_height, pCard->to_enemy_tower2, tower_e); @@ -3683,10 +3679,10 @@ if ( pCard->to_pl_enm_buildings2 ) { - dmg_p = ApplyDamadeToBuildings(player_num, (int)pCard->to_pl_enm_buildings2); - dmg_e = ApplyDamadeToBuildings(enemy_num, (int)pCard->to_pl_enm_buildings2); - buildings_p = (int)pCard->to_pl_enm_buildings2 - dmg_p; - buildings_e = (int)pCard->to_pl_enm_buildings2 - dmg_e; + dmg_p = ApplyDamageToBuildings(player_num, (signed int)pCard->to_pl_enm_buildings2); + dmg_e = ApplyDamageToBuildings(enemy_num, (signed int)pCard->to_pl_enm_buildings2); + buildings_p = (signed int)pCard->to_pl_enm_buildings2 - dmg_p; + buildings_e = (signed int)pCard->to_pl_enm_buildings2 - dmg_e; } APPLY_TO_BOTH(player, enemy, wall_height, pCard->to_pl_enm_wall2, wall_p, wall_e); APPLY_TO_BOTH(player, enemy, tower_height, pCard->to_pl_enm_tower2, tower_p, tower_e); @@ -4057,7 +4053,7 @@ //----- (0040D402) -------------------------------------------------------- -int ApplyDamadeToBuildings( int player_num, int damage ) +int ApplyDamageToBuildings( int player_num, int damage ) { ArcomagePlayer *v2; // ecx@1 int v3; // esi@1