Mercurial > mm7
changeset 2366:a2f1c2fd23f3
OutdoorLocation::GetTravelDestination cleaned up a bit
author | Grumpy7 |
---|---|
date | Sun, 11 May 2014 23:12:36 +0200 |
parents | 65789351a537 |
children | 7942b5727708 |
files | Outdoor.cpp |
diffstat | 1 files changed, 32 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/Outdoor.cpp Sun May 11 22:55:26 2014 +0200 +++ b/Outdoor.cpp Sun May 11 23:12:36 2014 +0200 @@ -371,38 +371,32 @@ //----- (0048902E) -------------------------------------------------------- bool OutdoorLocation::GetTravelDestination(signed int sPartyX, signed int sPartyZ, char *pOut, signed int a5) { - char *v6; // eax@3 - int v7; // eax@3 - //int v8; // edx@3 - signed int v9; // esi@7 - //int v10; // esi@23 - signed int v11; // eax@23 - //int v12; // ST14_4@25 - //signed int v14; // [sp-4h] [bp-84h]@6 + char *mapNumberAsStr; // eax@3 + int mapNumberAsInt; // eax@3 + signed int direction; // esi@7 + signed int destinationMap; // eax@23 char Str[140]; // [sp+8h] [bp-78h]@3 - //int a5a; // [sp+94h] [bp+14h]@3 strcpy(Str, this->pLevelFilename);//настоящая локация _strlwr(Str); - v6 = strtok(Str, "out"); - v6[2] = 0; - v7 = atoi(v6); - if ( a5 < 10 || strlen(this->pLevelFilename) != 9 || v7 < 1 || v7 > 15 ) //длина .odm и количество локаций + mapNumberAsStr = strtok(Str, "out"); + mapNumberAsStr[2] = 0; + mapNumberAsInt = atoi(mapNumberAsStr); + if ( a5 < 10 || strlen(this->pLevelFilename) != 9 || mapNumberAsInt < 1 || mapNumberAsInt > 15 ) //длина .odm и количество локаций return 0; - v9 = 1; if ( sPartyX < -22528 )//граница карты - v9 = 4; + direction = 4; else if ( sPartyX > 22528 ) - v9 = 3; + direction = 3; else if ( sPartyZ < -22528 ) - v9 = 2; - else if ( sPartyZ <= 22528 ) - return 0; - - if ( v7 == 14 ) + direction = 2; + else if ( sPartyZ > 22528 ) + direction = 1; + else + return false; + + if ( mapNumberAsInt == MAP_AVLEE && direction == 4) // to Shoals { - if ( v9 == 4 ) // to & from Shoals - { if ( pPlayers[1]->HasUnderwaterSuitEquipped() && pPlayers[2]->HasUnderwaterSuitEquipped() && pPlayers[3]->HasUnderwaterSuitEquipped() && @@ -412,36 +406,27 @@ strcpy(pOut, "out15.odm"); uLevel_StartingPointType = MapStartPoint_East; LOWORD(pParty->uFlags) &= 0xFD7Bu; - return 1; + return true; } - //v8 = v7; - } } - else + else if ( mapNumberAsInt == MAP_SHOALS && direction == 3 ) //from Shoals { - if ( v7 == 15 && v9 == 3 ) - { - uDefaultTravelTime_ByFoot = 1; - strcpy(pOut, "out14.odm");//Авли - uLevel_StartingPointType = MapStartPoint_West; - LOWORD(pParty->uFlags) &= 0xFD7Bu; - return 1; - } + uDefaultTravelTime_ByFoot = 1; + strcpy(pOut, "out14.odm");//Авли + uLevel_StartingPointType = MapStartPoint_West; + LOWORD(pParty->uFlags) &= 0xFD7Bu; + return true; } - //v10 = v9 + 4 * v7; - //v11 = (unsigned __int8)aTiletableLoadU[v10 + 39]; - v11 = foot_travel_destinations[v7 - 1][v9 - 1]; - if (v11 == MAP_INVALID) + destinationMap = foot_travel_destinations[mapNumberAsInt - 1][direction - 1]; + if (destinationMap == MAP_INVALID) return false; - assert(v11 <= MAP_SHOALS); - - uDefaultTravelTime_ByFoot = foot_travel_times[v7 - 1][v9 - 1]; - uLevel_StartingPointType = foot_travel_arrival_points[v7 - 1][v9 - 1]; - sprintf(pOut, "out%02d.odm", v11); //локация направления - return 1; - //} - //return 0; + assert(destinationMap <= MAP_SHOALS); + + uDefaultTravelTime_ByFoot = foot_travel_times[mapNumberAsInt - 1][direction - 1]; + uLevel_StartingPointType = foot_travel_arrival_points[mapNumberAsInt - 1][direction - 1]; + sprintf(pOut, "out%02d.odm", destinationMap); //локация направления + return true; } // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; // 6BE35C: using guessed type int uLevel_StartingPointType;