/* This file has been generated by the Hex-Rays decompiler. Copyright (c) 2009 Hex-Rays Detected compiler: Visual C++ */ #include #include "defs.h" #include "variables.h" #include "cities_points.h" #include #include #include #include #include #include "mmio.h" #include "pk.h" #include "gui.h" #include "basic.h" //#include "C:/Qt/Qt5.1.1/Tools/mingw48_32/i686-w64-mingw32/include/ddraw.h" //#include "C:/Qt/Qt5.1.1/Tools/mingw48_32/i686-w64-mingw32/include/dsound.h" #include "/usr/i686-w64-mingw32/include/ddraw.h" #include "/usr/i686-w64-mingw32/include/dsound.h" #define __SETO__(x,y) int((x)- (y)) < 0 //------------------------------------------------------------------------- // Data declarations static char (*off_40188E)[39]; // weak static char a_sav[100]; // idb static char src[100]; // idb static char aMap[100]; // idb static char aWavsCohort5_wa[100]; // idb static char aWavsCohort4_wa[100]; // idb static char aWavsCohort3_wa[100]; // idb static char aWavsCohort2_wa[100]; // idb static char aWavsCohort1_wa[100]; // idb static char a_map[0xff]; // idb static char aWavsFanfare__0[0xff]; // idb static char aWavsFanfare_nu[0xff]; // idb static char aOkLaunchingGam[0xff]; // idb static char aOkDirectSoundI[0xff]; // idb static char aErrExitedC3C_3[0xff]; // idb static char aOkC3Setup_[0xff]; // idb static char aErrExitedC3Bmp[0xff]; // idb static char aErrExitedC3C_2[0xff]; // idb static char aErrExitedC3C_1[0xff]; // idb static char aErrExitedC3Ins[0xff]; // idb static char aOkDirectDrawIn[0xff]; // idb static char aErrExitedC3C_0[0xff]; // idb static char aOkGameTextLoad[0xff]; // idb static char aErrExitedC3C3_[0xff]; // idb static char c3eng_filename[0xff]; // idb static char c3mm_filename[0xff]; // idb static char msg[0xff]; // idb static char aOkSetupLoadedD[0xff]; // idb static char aErrSetupCouldn[0xff]; // idb static char aOkCautionDatFi[0xff]; // idb static char aC3map_inf[0xff]; // idb static char aOkSetupLoadedA[0xff]; // idb static char aOkRemovedManma[0xff]; // idb static char aC3_inf[0xff]; // idb static char aErrCouldNotRea[0xff]; // idb static char aCddrive[0xff]; // idb static char needle[0xff]; // idb static char aCaesar3_ini[0xff]; // idb static char aErrReInitializ[0xff]; // idb static char aOkNotActive_[0xff]; // idb static char aOkActive_[0xff]; // idb static char aWavsCombat_sho[0xff]; // idb static char aWavsCombat_lon[0xff]; // idb static char aWavsRome5_wav[0xff]; // idb static char aWavsRome4_wav[0xff]; // idb static char aWavsRome3_wav[0xff]; // idb static char aWavsRome2_wav[0xff]; // idb static char aWavsRome1_wav[0xff]; // idb static char aOkDdKeptResolu[0xff]; // idb static char aOkDdSetResolut[0xff]; // idb static char aErrDdSetmodeFa[0xff]; // idb static char aOkDdSetcoopera[0xff]; // idb static char aErrDdNotSetcoo[0xff]; // idb static char aErrDdEnableErr[0xff]; // idb static char aOkDd256ColsSwi[0xff]; // idb static char aOkDdReleased_[0xff]; // idb static char aErrDdClearingW[0xff]; // idb static char aErrDdClearingF[0xff]; // idb static char aErrDdUnsupport[0xff]; // idb static char aOkDdSurface__2[0xff]; // idb static char aOkDdSurface__1[0xff]; // idb static char aOkDdSurface__0[0xff]; // idb static char aOkDdSurface_fo[0xff]; // idb static char aOkDdSurfacesCr[0xff]; // idb static char aErrDdCantAttac[0xff]; // idb static char aErrDdCantSetCl[0xff]; // idb static char aErrDdCantCre_0[0xff]; // idb static char aErrDdCreates_0[0xff]; // idb static char aOkDdCreating_0[0xff]; // idb static char aOkDdSurfaceCre[0xff]; // idb static char aErrDdCantCreat[0xff]; // idb static char aErrDdSurfaceLo[0xff]; // idb static char aOkDdCanLockPri[0xff]; // idb static char aErrDdCreatesur[0xff]; // idb static char aOkDdCreatingOn[0xff]; // idb static char aErrDdExtrasurf[0xff]; // idb static char postfix[0xff]; // idb static char aOkDsInstalled_[0xff]; // idb static char aErrDsFailedToC[0xff]; // idb static char aErrDsFailedS_0[0xff]; // idb static char aErrDsFailedSet[0xff]; // idb static char aErrDsFailedOpe[0xff]; // idb static char aOkDsReleased_[0xff]; // idb static char aOkDsWas_in_set[0xff]; // idb static char aOkDsWas_in_int[0xff]; // idb static char aErrLoadingWavF[0xff]; // idb static char aErrNotFoundFil[0xff]; // idb static char Str2[0xff]; // idb static char aOkDsBadStatus2[0xff]; // idb static char aOkDsBadStatus[0xff]; // idb static char aErrCannotStart[0xff]; // idb static char aErrCannotSetup[0xff]; // idb static char aErrDsStrSsSt_0[0xff]; // idb static char aErrDsStrSsStop[0xff]; // idb static char aErrDsStrTsSt_0[0xff]; // idb static char aErrDsStrTsStop[0xff]; // idb static char aC3_emp[0xff]; // idb static char FileName[0xff]; // idb static char aLast_sav[0xff]; // idb static char aWavsHorn1_wav[0xff]; // idb static char aWavsHorn2_wav[0xff]; // idb static char aWavsDrums_wav[0xff]; // idb static char aWavsBarbarian_[0xff]; // idb static char aWavsArmy_war_c[0xff]; // idb static char aDn[0xff]; // idb static char s1[0xff]; // idb static char asc_5E2D2C[0xff]; // idb static char aC[0xff]; // idb static char a555[0xff]; // idb static char aSmk[0xff]; // idb static char Str1[0xff]; // idb static char aErrChdNotReser[0xff]; // idb static char a555_0[0xff]; // idb static char aStatus_txt[11]; // weak static char aResaud[0xff]; // idb static char aBm[0xff]; // idb static char ClassName[0xff]; // idb static char aDebugAndStatus[0xff]; // idb static char aOkExitedNormal[0xff]; // idb static char aOkPaused_[0xff]; // idb static char aErrCanTResto_0[0xff]; // idb static char aErrCanTRestore[0xff]; // idb static char aErrGfxCouldTCr[0xff]; // idb static char aOkGfxDirectdra[0xff]; // idb static char aErrGfxDirectdr[0xff]; // idb static char aErrGfxbeginFai[0xff]; // idb static char aSmkCredits_smk[16]; // weak static char aSmkIntro_smk[0xff]; // idb static char aSmkLogo_smk[13]; // weak static char filename[0xff]; // idb static char aSmkWin_game_sm[17]; // weak static char aSmkVictory_sen[23]; // weak static char aSmkVictory_bal[24]; // weak static char aWavsEmpty_land[0xff]; // idb static char aWavsAmpitheatr[0xff]; // idb static char aWavsTheatre_wa[0xff]; // idb static char aWavsHippodrome[0xff]; // idb static char aWavsColloseum_[0xff]; // idb static char aWavsGlad_pit_w[0xff]; // idb static char aWavsLion_pit_w[0xff]; // idb static char aWavsArt_pit_wa[0xff]; // idb static char aWavsChar_pit_w[0xff]; // idb static char aWavsPark_wav[0xff]; // idb static char aWavsWall_wav[0xff]; // idbТекстовые ресуры/Локализация static char aWavsAquaduct_w[0xff]; // idb static char aWavsPlaza_wav[0xff]; // idb static char aWavsStatue_wav[0xff]; // idb static char aWavsClinic_wav[0xff]; // idb static char aWavsHospital_w[0xff]; // idb static char aWavsBaths_wav[0xff]; // idb static char aWavsBarber_wav[0xff]; // idb static char aWavsSchool_wav[0xff]; // idb static char aWavsAcademy_wa[0xff]; // idb static char aWavsLibrary_wa[0xff]; // idb static char aWavsPrefecture[0xff]; // idb static char aWavsFort_wav[0xff]; // idb static char aWavsGatehouse_[0xff]; // idb static char aWavsTower_wav[0xff]; // idb static char aWavsMil_acad_w[0xff]; // idb static char aWavsBarracks_w[0xff]; // idb static char aWavsTemple_far[0xff]; // idb static char aWavsTemple_shi[0xff]; // idb static char aWavsTemple_com[0xff]; // idb static char aWavsTemple_war[0xff]; // idb static char aWavsTemple_lov[0xff]; // idb static char aWavsMarket_wav[0xff]; // idb static char aWavsGranary_wa[0xff]; // idb static char aWavsWarehouse_[0xff]; // idb static char aWavsShipyard_w[0xff]; // idb static char aWavsDock_wav[0xff]; // idb static char aWavsWharf_wav[0xff]; // idb static char aWavsGov_palace[0xff]; // idb static char aWavsEng_post_w[0xff]; // idb static char aWavsMission_wa[0xff]; // idb static char aWavsSenate_wav[0xff]; // idb static char aWavsForum_wav[0xff]; // idb static char aWavsResevoir_w[0xff]; // idb static char aWavsFountain_w[0xff]; // idb static char aWavsWell_wav[0xff]; // idb static char aWavsOracle_wav[0xff]; // idb static char aWavsRuin_wav[0xff]; // idb static char aWavsWheat_farm[0xff]; // idb static char aWavsVeg_farm_w[0xff]; // idb static char aWavsFigs_farm_[0xff]; // idb static char aWavsOlives_far[0xff]; // idb static char aWavsVines_farm[0xff]; // idb static char aWavsMeat_farm_[0xff]; // idb static char aWavsQuarry_wav[0xff]; // idb static char aWavsMine_wav[0xff]; // idb static char aWavsTimber_wav[0xff]; // idb static char aWavsClay_wav[0xff]; // idb static char aWavsWine_works[0xff]; // idb static char aWavsOil_worksh[0xff]; // idb static char aWavsWeapons_wo[0xff]; // idb static char aWavsFurniture_[0xff]; // idb static char aWavsPottery_wo[0xff]; // idb static char asc_5E34F8[0xff]; // idb static char aWavsHousing_wa[0xff]; // idb static char aUnsavedData[0xff]; // idb static char aMaxProsperity[0xff]; // idb static char aHappiness[0xff]; // idb static char aMapCreationMod[0xff]; // idb static char aDn_0[0xff]; // idb static char aWavsSetup_wav[0xff]; // idb static char asc_5E3574[0xff]; // idb static char asc_5E3578[0xff]; // idb static char byte_5E357C[4]; // idb static char aBuilding_in_pr[0xff]; // idb static char aSide_panel_x1[0xff]; // idb static char aMouse_movement[0xff]; // idb static char aMouse_y[0xff]; // idb static char aMouse_x[0xff]; // idb static char aTest_value4a[0xff]; // idb static char aTest_value3a[0xff]; // idb static char aTest_value2a[0xff]; // idb static char aTest_value1a[0xff]; // idb static char aAutoRemovedMan[0xff]; // idb static char aLast_alert_mes[0xff]; // idb static char aAlert_messages[0xff]; // idb static char aWas_in_set[0xff]; // idb static char aWas_in_int[0xff]; // idb static char aMission_in_pla[0xff]; // idb static char aNatives_are_re[0xff]; // idb static char aMap_style[0xff]; // idb static char aMapRotation[0xff]; // idb static char aWineSources[0xff]; // idb static char asc_5E3724[0xff]; // idb static char aDocks_list[0xff]; // idb static char asc_5E3738[0xff]; // idb static char aNof_docks[0xff]; // idb static char aInHouses[0xff]; // idb static char aDeaths[0xff]; // idb static char aBirths[0xff]; // idb static char aSpareCap[0xff]; // idb static char aTotCap[0xff]; // idb static char aPopIs[0xff]; // idb static char aBarb[0xff]; // idb static char aRoutings[0xff]; // idb static char aEvolveError[0xff]; // idb static char aTotalConnectio[0xff]; // idb static char aNoOfConnects[0xff]; // idb static char aEver[0xff]; // idb static char aLastBuilding[0xff]; // idb static char aYear[0xff]; // idb static char aMonth[0xff]; // idb static char aWeek[0xff]; // idb static char aTick[0xff]; // idb static char aEvolveInfoF3[17]; // weak static char aGoods_0[0xff]; // idb static char asc_5E3878[0xff]; // idb static char asc_5E387C[0xff]; // idb static char asc_5E3880[0xff]; // idb static char aShows[0xff]; // idb static char aRe[0xff]; // idb static char aHe[0xff]; // idb static char aEd[0xff]; // idb static char aEn[0xff]; // idb static char aHi[0xff]; // idb static char aCo[0xff]; // idb static char aAm[0xff]; // idb static char aTh[0xff]; // idb static char aMaxPop[0xff]; // idb static char aTaxCvr[0xff]; // idb static char aEmployees[0xff]; // idb static char aNoContactWithR[0xff]; // idb static char aWaterDep[0xff]; // idb static char aNoWater[0xff]; // idb static char aWellSup[0xff]; // idb static char aWaterSup[0xff]; // idb static char aDamage[0xff]; // idb static char aSpareRoom[0xff]; // idb static char aRoadnet[0xff]; // idb static char aRome[0xff]; // idb static char aAgent[0xff]; // idb static char aSubAgent[0xff]; // idb static char aImmigrant[0xff]; // idb static char aRel[0xff]; // idb static char aAcc[0xff]; // idb static char aGoods[0xff]; // idb static char aPop[0xff]; // idb static char aRaw_materials[0xff]; // idb static char aFood[0xff]; // idb static char aAquaLinks[0xff]; // idb static char aSub_type[0xff]; // idb static char aType[0xff]; // idb static char aBuildingNo[0xff]; // idb static char aRedraw[0xff]; // idb static char asc_5E3A24[0xff]; // idb static char aAlive[0xff]; // idb static char aUndo_buildings[0xff]; // idb static char aUndo_valid[0xff]; // idb static char aUndo_ready[0xff]; // idb static char aOverPtr[0xff]; // idb static char aNotOverABuildi[20]; // weak static char aBuildingInfoF4[19]; // weak static char aDockers[0xff]; // idb static char aGhost[0xff]; // idb static char aPeople[0xff]; // idb static char aImmigrant_to[0xff]; // idb static char aAgent_for[0xff]; // idb static char aXYBits[0xff]; // idb static char aMapXY[0xff]; // idb static char aXY[0xff]; // idb static char aRuler[0xff]; // idb static char aFigureNo[0xff]; // idb static char aFreeRouteSlots[0xff]; // idb static char aFigs[0xff]; // idb static char aNotWatchingAFi[22]; // weak static char aFigureInfoF1[17]; // weak static char aNetworkInfoF2[18]; // weak static char aMemMaxAllocAft[0xff]; // idb static char aErrSmkCouldNot[0xff]; // idb static char aOkSmkStartingS[0xff]; // idb static char aOkSmkNaturalEn[0xff]; // idb static char aErrSmkReleasin[0xff]; // idb static char aOkSmkUserEnds[0xff]; // idb static char aWavs[0xff]; // idb static char aC3mm_tmp[0xff]; // idb static char aCdfs[5]; // weak static char aSgs001bw_sg1[0xff]; // idb static char aSgs006bw_sg1[0xff]; // idb static char aSgs005bw_sg1[0xff]; // idb static char aSgs004bw_sg1[0xff]; // idb static char aSgs003bw_sg1[0xff]; // idb static char aSgs002bw_sg1[0xff]; // idb static char aOkModelLoaded[0xff]; // idb static char aAllHouses[0xff]; // idb static char aErrModelHasInc[0xff]; // idb static char aAllBuildings[0xff]; // idb static char aErrNoC3_model_[0xff]; // idb static char aC3_model_txt[0xff]; // idb static char aErrNoSpareScre[0xff]; // idb static char aErrWavStartRea[0xff]; // idb static char aErrComp2OutOfB[0xff]; // idb static char aErrComp1Corrup[0xff]; // idb static char aErrCompErrorOc[0xff]; // idb static char aErrCompErrorUn[0xff]; // idb static char aS[0xff]; // idb static char aDbgheap_c[10]; // weak static char a_crtcheckmemor[0xff]; // idb static char a_crtisvalidhea[0xff]; // idb static char a_pfirstblockPh[0xff]; // idb static char a_plastblockPhe[0xff]; // idb static char aPheadNblockuse[0xff]; // idb static char aPheadNlineIgno[0xff]; // idb static char aDamageAfterHsB[0xff]; // idb static char aDamageBeforeHs[0xff]; // idb static char a_block_type_is[0xff]; // idb static char aClientHookFree[27]; // weak static char aInconsistentIo[0xff]; // idb static char byte_5E4CB8[0xff]; // weak static char aOutput_c[9]; // weak static char aCh_t0[0xff]; // idb static int help_ids_advisors[0xff]; // idb static int overlay_submenu_ids[0xff]; // idb static int dword_5E6A84[0xff]; // weak static int dword_5E6A88[0xff]; // weak static int dword_5E6A8C[0xff]; // weak static int dword_5E6A90[0xff]; // idb static char aWavsPanel1_w_0[0xff]; // idb static char aWavsPanel1_wav[0xff]; // idb static char aThe_empire_555[40]; // weak static char aC3_555[40]; // weak static char aC3_sg2_0[40]; // weak static char aGoths_555[40]; // weak static char aGoths_sg2[40]; // weak static int shortcut_legion_id; // weak static int dword_5EA654[0xff]; // idb static C3CustomButton buttons_mainMenu; static C3CustomButton buttons_editorPanel; static C3CustomButton buttons_overlayMenu; static C3CustomButton buttons_overlaySubMenu; static C3CustomButton buttons_displayOptions; static C3CustomButton buttons_speedOptions; static C3CustomButton buttons_soundOptions; static C3CustomButton buttons_fileSavedGame; static C3CustomButton buttons_cckSelection; static C3CustomButton buttons_editEmpireMap_general; static C3CustomButton buttons_editEmpireMap_expand; static C3CustomButton buttons_editor_startDate; static C3CustomButton buttons_editor_requests; static C3CustomButton buttons_editor_editRequest; static C3CustomButton buttons_editor_editInvasion; static C3CustomButton buttons_editor_editDemandChange; static C3CustomButton buttons_editor_editPriceChange; static C3CustomButton buttons_editor_invasions; static C3CustomButton buttons_editEmpireMap_addObject; static C3CustomButton buttons_editor_demandChanges; static C3CustomButton buttons_editor_priceChanges; static C3CustomButton buttons_editor_setSupplyDemand; static C3CustomButton buttons_empireMap_city; static C3CustomButton buttons_editEmpireMap_editRoute; static C3CustomButton buttons_editEmpireMap_editCity; static C3CustomButton buttons_editEmpireMap_editBattle; static C3CustomButton buttons_editEmpireMap_editOwnCity; static C3CustomButton buttons_editEmpireMap_editCityTrade; static C3CustomButton buttons_numericInput; static C3CustomButton buttons_selectList1; static C3CustomButton buttons_selectList2; static C3CustomButton buttons_messages; static C3CustomButton buttons_advisors; static C3CustomButton buttons_tradeAdvisor; static C3CustomButton buttons_resourceSettings_industry; static C3CustomButton buttons_resourceSettings_trade; static C3CustomButton buttons_resourceSettings_stockpile; static C3CustomButton buttons_laborAdvisor; static C3CustomButton buttons_setLaborPriority; static C3CustomButton buttons_militaryAdvisor; static C3CustomButton buttons_populationAdvisor; static C3CustomButton buttons_entertainmentAdvisor; static C3CustomButton buttons_holdFestival; static C3CustomButton buttons_ratingsAdvisor; static C3CustomButton buttons_imperialAdvisor; static C3CustomButton buttons_setSalary; static C3CustomButton buttons_donateToCity; static C3CustomButton buttons_giftToCaesar; static C3CustomButton buttons_debug_housingEvolveInfo; static C3CustomButton buttons_buildingInfo_granary; static C3CustomButton buttons_buildingInfo_warehouse; static C3CustomButton buttons_buildingInfo_granaryOrders; static C3CustomButton buttons_buildingInfo_warehouseOrders; static C3CustomButton buttons_walkerInfo; static C3CustomButton buttons_editor_main; static C3CustomButton buttons_editor_startCond; static C3CustomButton buttons_editor_specialEvents; static C3CustomButton buttons_editor_allowedBuildings; static C3CustomButton buttons_editor_winCriteria; static C3CustomButton buttons_victoryDialog; static C3CustomButton buttons_unknown_5EE7B8; static C3CustomButton buttons_fortInfo; static C3CustomButton buttons_fortInfo_returnToFort; static C3CustomButton buttons_resolutionConfirmDialog; static C3CustomButton buttons_buildingInfo_resources; static C3CustomButton buttons_sidepanel_problem; static C3ImageButton imagebuttons_newCampaign; static C3ImageButton imagebuttons_missionBriefing; static C3ImageButton imagebuttons_sidebar_overlayCollapse; static C3ImageButton imagebuttons_unknown_5EEB08; static C3ImageButton imagebuttons_sidebar_build[0xff]; static C3ImageButton imagebuttons_sidebar_buildCollapsed[0xff]; static C3ImageButton imagebuttons_unknown_5EEF00; static C3ImageButton imagebuttons_sidebar_advEmpOri; static C3ImageButton imagebuttons_fileSavedGame; static C3ImageButton imagebuttons_fileScenario; static C3ImageButton imagebuttons_cckSelection; static C3ImageButton imagebuttons_rightClickInfo; static C3ImageButton imagebuttons_rightClickInfo_advisor; static C3ImageButton imagebuttons_resourceSettings; static C3ImageButton imagebuttons_advisors; static C3ImageButton imagebuttons_holdFestival; static C3ImageButton imagebuttons_empireMap_help; static C3ImageButton imagebuttons_empireMap_exit; static C3ImageButton imagebuttons_empireMap_advisor; static C3ImageButton imagebuttons_tradeRouteOpened; static C3ImageButton imagebuttons_unknown_5EF620; static C3ImageButton imagebuttons_message_close; static C3ImageButton imagebuttons_unknown_5EF670; static C3ImageButton imagebuttons_unknown_5EF698; static C3ImageButton imagebuttons_message_help; static C3ImageButton imagebuttons_message_gotoArea; static C3ImageButton imagebuttons_messages_help; static C3ImageButton imagebuttons_message_labor; static C3ImageButton imagebuttons_message_trade; static C3ImageButton imagebuttons_message_population; static C3ImageButton imagebuttons_message_imperial; static C3ImageButton imagebuttons_message_military; static C3ImageButton imagebuttons_message_health; static C3ImageButton imagebuttons_message_religion; static C3ImageButton imagebuttons_messages_close; static C3ImageButton imagebuttons_messages_up; static C3ImageButton imagebuttons_messages_down; static C3ImageButton imagebuttons_confirmDialog; static C3ArrowButton arrowbuttons_editEmpireMap; // idb static C3ArrowButton arrowbuttons_editEmpire[0xff]; static C3ArrowButton arrowbuttons_laborAdvisor; static C3ArrowButton arrowbuttons_financeAdvisor; static C3ArrowButton arrowbuttons_resourceSettings; static C3ArrowButton arrowbuttons_donateToCity; static C3ArrowButton arrowbuttons_speedOptions; static C3ArrowButton arrowbuttons_soundOptions; // idb static C3ArrowButton arrowbuttons_editorSettings; static C3ArrowButton arrowbuttons_difficultyOptions; // idb static C3MenuItem menu_options; static C3MenuItem menu_help; static C3Menu topmenu_game; static C3Menu topmenu_editor; static char byte_5F1098[0xff]; // idb static char byte_5F10D0[0xff]; // idb static char byte_5F11D0[0xff]; // idb static char byte_5F12D0[0xff]; // idb static char byte_5F13D0[0xff]; // idb static char byte_5F14D0[0xff]; // idb static char byte_5F1550[0xff]; // idb static char byte_5F17D0[0xff]; // idb static char byte_5F17E8[0xff]; // weak static __int16 word_5F1816[0xff]; // weak static __int16 word_5F1818[0xff]; // weak static __int16 word_5F1822[0xff]; // weak static __int16 word_5F1824[0xff]; // weak static __int16 word_5F182E[0xff]; // weak static __int16 word_5F1830[0xff]; // weak static __int16 word_5F183A[0xff]; // weak static __int16 word_5F183C[0xff]; // weak static __int16 word_5F1846[0xff]; // weak static __int16 word_5F1848[0xff]; // weak static __int16 word_5F1852[0xff]; // weak static __int16 word_5F185E[0xff]; // weak static __int16 word_5F186A[0xff]; // weak static __int16 word_5F1876[0xff]; // weak static __int16 word_5F1882[0xff]; // weak static char byte_5F2250[0xff]; static char byte_5F2550[0xff]; static char byte_5F2850[0xff]; static char byte_5F28F0[0xff]; static char byte_5F29D0[0xff]; static char byte_5F2AE0[0xff]; static char byte_5F2BF0[0xff]; static char byte_5F2D00[0xff]; static char byte_5F3000[0xff]; static int dword_5F3100[0xff]; // weak static int dword_5F3104[0xff]; // idb static int multipleTileBuildingGridOffset[0xff][0xff]; // weak static char byte_5F324C[0xff]; // weak static char byte_5F325C; // weak static char byte_5F3284; // weak static char byte_5F329C; // weak static char byte_5F32A4; // weak static char byte_5F32AC; // weak static int tilesAroundBuildingGridOffsets[0xff]; // idb static int dword_5F34A0[0xff]; // idb static int dword_5F3538[0xff]; // idb static int dword_5F355C[0xff]; // idb static int dword_5F3580[0xff]; // weak static int dword_5F3584[0xff]; // idb static int dword_5F36A0[0xff]; // weak static int dword_5F36A4[0xff]; // idb static int dword_5F39C0[0xff]; // weak static int dword_5F39C4[0xff]; // idb static int tile_adjacentGridOffsets[0xff]; // idb static int dword_5F3C50[0xff]; // idb static int reservoir_connectorGridOffsets[0xff]; // idb static int dword_5F3CB0[0xff]; // weak static unsigned int dword_5F3CB4[256]; // idb static int dword_5F4130[0xff]; // weak static unsigned char dword_5F4134[888]; // idb static int dword_5F44B0[0xff]; // idb static int dword_5F44C0[0xff]; // weak static int dword_5F44C4[0xff]; // idb static int dword_5F44E0[0xff]; // weak static int dword_5F44F0[0xff]; // weak static int dword_5F4500[0xff]; // weak static int dword_5F4504[0xff]; // weak static int dword_5F4520[0xff]; // weak static int dword_5F4524[0xff]; // weak static BuildingType buildingMenu_buildingId[30][30]; // idb static int overlayMenuIDToOverlayID[0xff]; // idb static int overlaySubMenuIDToOverlayID[0xff]; // idb static int dword_5F5918[0xff]; // weak static int dword_5F592C; // weak static int dword_5F5930[0xff]; // weak static int dword_5F5934[0xff]; // idb static int dword_5F59F8[0xff]; // idb static int dword_5F5B88[0xff]; // weak static int dword_5F5B8C[0xff]; // weak static int dword_5F5BA8[0xff]; // weak static int dword_5F5BAC[0xff]; // weak static int dword_5F5BF0[0xff]; // weak static int dword_5F5BF4[0xff]; // idb static int dword_5F5C70[0xff]; // weak static int dword_5F5C74[0xff]; // idb static int salaryAmounts[11] = { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; // idb static int dword_5F5D64[0xff]; // idb static int dword_5F5E04[0xff]; // idb static int dword_5F5E28; // weak static int dword_5F5E54[0xff]; // weak static char byte_5F5EA4[0xff]; // idb static char byte_5F5F24[0xff]; // idb static char byte_5F5FA4[0xff]; // idb static char byte_5F6024[0xff]; // idb static int dword_5F60A4[0xff]; // idb static char byte_5F60F4[0xff]; // weak static char byte_5F60F5[0xff]; // weak static char byte_5F60F6[0xff]; // weak static char byte_5F60F7[0xff]; // weak static char byte_5F60F8[0xff]; // weak static char byte_5F60F9[0xff]; // weak static char byte_5F60FB[0xff]; // idb static int buildingSizes[0xff]; // weak static char byte_5F6418[0xff]; // weak static int dword_5F641C[0xff]; // weak static int dword_5F6420[0xff]; // idb static int dword_5F671C[22]; // weak static int dword_5F6774[12]; // weak static int dword_5F67A4[138]; // weak static int dword_5F69CC[194]; // weak static int difficulty_moneypct[0xff]; // idb static int difficulty_startingFavor[0xff]; // idb static int difficulty_happiness[5]; // weak static int difficulty_something[0xff]; // idb static int dword_5F949C[0xff]; // idb static int dword_5F94AC[0xff]; // weak static int dword_5F94D0[0xff]; // weak static int dword_5F9510[0xff]; // weak static int dword_5F9574[0xff]; // weak static int dword_5F9578[0xff]; // weak static int dword_5F9594[0xff]; // weak static int dword_5F9598[0xff]; // weak static int dword_5F95B4[0xff]; // weak static int dword_5F95C4[0xff]; // weak static int dword_5F95C8[0xff]; // weak static int dword_5F95E4[0xff]; // weak static int dword_5F95E8[0xff]; // weak static int dword_5F9604[0xff]; // weak static int dword_5F9608[0xff]; // weak static int dword_5F9624[0xff]; // weak static int dword_5F9634[0xff]; // weak static UINT uResolution; // idb static UINT uPeriod; // idb static int dword_5F96A0; // weak static int empireMapWidth; // weak static int empireMapHeight; // weak static int empireMapBorderLeftRight; // idb static int empireMapBorderTop; // idb static int empireMapBorderBottom; // weak static int editEmpire_isSaved; // weak static int tradeprices_buy[0xff]; // weak static int tradeprices_sell[0xff]; // idb static int localUprisingFromMars_numEnemies[0xff]; // idb static int dword_5F9794[0xff]; // weak static int dword_5F9798[0xff]; // weak static int dword_5F979C[0xff]; // idb static WalkerType enemy_walkerTypes[30][30]; // idb static int enemy_formationLayouts[0xff]; // idb static int dword_5F998C; // weak static int dword_5F9990[0xff]; // weak static int dword_5F9994[0xff]; // weak static int houseExpand_gridOffsetForDirection[0xff]; // idb static int dword_5F99C0[0xff]; // idb static void ( *houseEvolveCheckFuncs)(); static int laborCategoryForBuildingId[0xff]; // idb static int laberCategory_builtInPriority[0xff]; // weak static int laberCategory_workersPerBuiltInPriority[0xff]; // idb static int dword_5F9E00[0xff]; // weak static int dword_5F9E40[0xff]; // weak static int dword_5F9E60[0xff]; // weak static int dword_5F9E80[0xff]; // weak static int dword_5F9EA0[0xff]; // weak static int dword_5F9F30[0xff]; // weak static int dword_5F9F50[0xff]; // weak static int dword_5F9F68[0xff]; // weak static int dword_5FA008[0xff]; // weak static int dword_5FA00C[0xff]; // weak static char randomEvent_probability[0xff]; // idb static char byte_5FA158[0xff]; // idb static char byte_5FA159[0xff]; // idb static void ( *walker_callbacks[80])(); static int dword_5FA2A8[24]; // weak static int dword_5FA308[0xff]; // idb static unsigned short dword_5FA348[32]; // idb static unsigned short dword_5FA388[32]; // idb static int dword_5FA3C8[0xff]; // idb static unsigned short dword_5FA408[24]; // idb static unsigned short dword_5FA438[48]; // idb static int dword_5FA498[0xff]; // idb static __int16 word_5FA4F8[0xff]; // weak static __int16 word_5FA4FA[0xff]; // idb static int dword_5FA518[0xff]; // idb static int dword_5FA718[0xff]; // weak static unsigned char dword_5FA71C[168]; // idb static int dword_5FA7C8[0xff]; // weak static unsigned char dword_5FA7CC[168]; // idb static int dustcloud_dword_5FA878[0xff]; // idb static int dustcloud_dword_5FA890[0xff]; // idb static char dustcloud_x[0xff]; // idb static char dustcloud_y[0xff]; // idb static char dustcloud_byte_5FA928[0xff]; // idb static unsigned int dword_5FA968[2080]; // idb static __int16 word_5FC9E8[0xff]; // idb static __int16 word_5FCD08[0xff]; // idb static char byte_5FD6B4[0xff]; // idb static char byte_5FD6D4[0xff]; // idb static char map_printChar_to_fontGraphic[0xff]; // idb static char extension_555[4]; // idb static int video_busySwitching; // weak static int dword_5FD84C; // weak static int dword_5FD868; // weak static int savedgame_fileversion; // weak static struct C3GameFilePart savedgame_fields[0xff]; static struct C3GameFilePart scenario_fields[0xff]; static char aCitizen_sav[40]; // weak static char aMission1_pak[20]; // weak static int dword_5FECC8[0xff]; // idb static int millisecondsPerGameTickAtInvertedSpeed[0xff]; // idb static char byte_5FEE50[1632]; // idb static int c3maps_mission_x[0xff]; // weak static int c3maps_mission_y[0xff]; // idb static int scrollMap_one; // weak static struct C3MapSize mapsizes; static int warning_middleOffset[0xff]; // weak static __int16 warning_topOffset[0xff]; // idb static int birthPercentagePerAgeDecennium[0xff]; // idb static int deathPercentagePerHealthRatePerAgeDecennium[0xff]; // idb static int taxrate_happiness_factor[0xff]; // idb static int dword_5FFADC[0xff]; // idb static int dword_5FFB00[0xff]; // idb static int bigPeopleGraphicFromWalkerType[0xff]; // idb static int dword_5FFD18[0xff]; // idb static int dword_5FFD68[0xff]; // idb static int dword_5FFE4C[0xff]; // idb static int dword_5FFE6C[0xff]; // weak static int dword_5FFE70[0xff]; // idb static int dword_5FFEAC[0xff]; // idb static int dword_5FFF58[2]; // weak static int dword_5FFF60[0xff]; // weak static int dword_5FFF64[0xff]; // weak static int dword_5FFF68[0xff]; // idb static int dword_5FFFD8; // weak static int dword_5FFFDC[0xff]; // idb static int dword_600098[0xff]; // weak static unsigned int dword_60009C[2]; // idb static int dword_6000A8; // weak static int dword_6000AC[7]; // weak static char soundFilesMissionBriefing[40]; // weak static char aWavs01w_wav[40]; // weak static int dword_6007A8[0xff]; // idb static char aIntro_smk[16]; // weak static char walkerSounds[480]; // weak static int mappingWalkerTypeToSoundIndex[0xff]; // idb static int dword_6058E0[0xff]; // idb static int campaign_missionIds_peaceful[0xff]; // weak static int campaign_missionIds_military[0xff]; // idb static int dword_606780; // weak static char byte_60678C; // weak static char byte_60678D; // weak static char off_606790[0xff]; // idb static void *off_6067EC; // weak static int ( *off_607150)(__uint32_t, __uint32_t, __uint32_t, __uint32_t, __uint32_t); // weak static int currentAdvisor; // weak static int selectMission_choice; // weak static int currentClimate; // weak static int arrowbutton_lastTime; // weak static IDirectSound* ds_idirectsound; // weak static struct _TIME_ZONE_INFORMATION TimeZoneInformation; // idb static LPCVOID compress_data; // idb static DWORD compress_inputSize; // idb static __uint32_t pk_hashcode; // weak static int compress_size; static int video_nextWindowId; // weak static int dword_6084A0; // weak static int smack_video_fullscreen; // weak static int dword_6084A8; // weak static int smack_videoInHomeDir; // weak static int dword_6084B0; // weak static char video_filename[64]; // idb static DDSURFACEDESC smack_videoSurface; static int smack_videoPlaying; // weak static int smack_video_x; // weak static int smack_video_y[22]; // weak static int smack_color_flags; // weak static int dword_6085D0[19]; // weak static int victoryScreen_y; // idb static int milAdv_numForts[7]; // weak static int goodlist_indexToResourceId[0xff]; // weak static int goodlist_indexToResourceId1[0xff]; // idb static signed int populationgraph_y_maxvalue; // idb static int dialog_x; // idb static int advisor_dialog_height; // idb static int dword_60868C; // weak static int availableFoods_count; // weak static int advisor_dialog_width; // idb static int foodlist_indexToResourceId[0xff]; // weak static int foodlist_indexToResourceId1[0xff]; // idb static int dword_6086E0; // weak static int sidebarOverlayTextId; // weak static int dword_6086E8; // weak static int availableGoods_count; // weak static int topmenu_populationValue; // weak static int populationgraph_y_valueshift; // weak static int dialog_y; // idb static int topmenu_offsetDate; // weak static int topmenu_offsetPopulation; // weak static int topmenu_offsetFunds; // weak static int dword_608708; // weak static int victoryScreen_x; // idb static int button_something_0[0xff]; // weak static int button_something_2; // weak static int button_something_3; // weak static int button_something_4; // weak static int button_something_6; // weak static int button_something_7; // weak static int button_something_8; // weak static int dword_608744[0xff]; // idb static int advisor_ifSomething; // weak static int cityscreen_width_withoutControlpanel; // idb static int cityscreen_width_withControlpanel; // idb static int topmenu_monthValue; // weak static int topmenu_treasuryValue; // weak static int dword_608780[11863]; // weak static char byte_6140DD[0xff]; // weak static char byte_6140DE[0xff]; // weak static char byte_6140DF[0xff]; // idb static int destinationGridOffset; // weak static int dword_614158; // idb static char byte_61417F[0xff]; // weak static char byte_614180[0xff]; // weak static char byte_614181[0xff]; // idb static char byte_614221[0xff]; // weak static char byte_614222[0xff]; // weak static char byte_614223[0xff]; // idb static char reverseDestinationPath[0xff]; // idb static char byte_61A97E[0xff]; // idb static char byte_61AA1F[0xff]; // weak static char byte_61AA20[0xff]; // weak static char byte_61AA21[0xff]; // idb static char byte_61AAC2[0xff]; // idb static __int16 word_6210C0[0xff]; // idb static int dword_62DDC8[6]; // weak static char byte_62DDE0[0xff]; // idb static __int16 word_63433A[0xff]; // weak static __int16 word_63433C[0xff]; // weak static __int16 word_63433E[147]; // weak static int dword_634464; // weak static int dword_634468; // idb static __int16 word_63447E[0xff]; // weak static __int16 grid_pathingDistance[0xff]; // weak static __int16 word_634482[0xff]; // idb static __int16 word_6345C2[0xff]; // weak static __int16 word_6345C4[0xff]; // weak static __int16 word_6345C6[23893]; // weak static char byte_6414FE[0xff]; // idb static char byte_64159F[0xff]; // weak static char byte_6415A0[0xff]; // weak static char byte_6415A1[0xff]; // idb static char byte_641642[0xff]; // idb static char grid_groundType_162[0xff]; // idb static char grid_groundType_1[0xff]; // weak static char grid_groundType[0xff]; // weak static char grid_groundType1[0xff]; // idb static char grid_groundType162[0xff]; // idb static int dword_64E2C4[15]; // weak static int dword_64E300[0xff]; // idb static int currentFormationID; // weak static int dword_64E328; // weak static int rightclickInfoDialog_y; // idb static int rightclickInfoDialog_heightBlocks; // idb static int dword_64E334; // idb static int rightclickInfoDialog_widthBlocks; // idb static int currentMoodSoundId; // idb static int storage_specialOrdersShown; // weak static int dword_64E344; // weak static int dword_64E348; // weak static int dword_64E34C; // weak static int debug_showHousingEvolveInfo; // weak static int rightclickInfoDialog_x; // idb static int dword_64E358; // weak static int dword_64E35C; // weak static int dword_64E360; // weak static int currentlySelectedBuilding; // idb static int dword_64E368; // weak static int dialog_help_id; // idb static int dword_64E370; // weak static int currentWalkerSoundId; // idb static int rightClickInfoNumWalkers; // weak static int currentBuilding_workerPercentage; // weak static int dword_64E384; // weak static int walkerInfo_index; // weak static int dword_64E38C; // weak static int dword_64E390; // weak static int rightclickInfoDialog_advisor; // weak static int drawPopHistoryGraph_endMonth; // idb static int drawPopHistoryGraph_startMonth; // idb static int dword_650004[7]; // weak static char save_playername[40]; // idb static int drawPopHistoryGraph_endYear; // idb static int debug_drawPopInfo; // weak static int drawPopHistoryGraph_startYear; // idb static __uint32_t cityinfo_start__; // weak static char byte_658DCD; // weak static signed int dword_658DD0; // idb static int dword_659B4C; // weak static int message_usePopup; // weak static int dword_659B54; // idb static int message_helpId; // idb static int dword_659B5C; // idb static int dword_659B60; // idb static int dword_659B64; // idb static int dword_659B68; // weak static int heightBlocks; // idb static int widthBlocks; // idb static int dword_659B74; // idb static int dword_659B78; // idb static int currentMessage_id; // weak static int dword_659B80; // weak static int dword_659BA0[0xff]; // idb static int dword_659BF0; // weak static int tmp_playermessage; // idb static int warning_amount; // weak static int dword_659C14; // weak static int dword_659C18; // idb static struct C3Warning warnings; static char populationMessage_0_shown[0xff]; // weak static char populationMessage_500_shown; // weak static char populationMessage_1000_shown; // weak static char populationMessage_2000_shown; // weak static char populationMessage_3000_shown; // weak static char populationMessage_5000_shown; // weak static char populationMessage_10000_shown; // weak static char populationMessage_15000_shown; // weak static char populationMessage_20000_shown; // weak static char populationMessage_25000_shown; // weak static int playermessageId_next; // weak static char byte_659EA0[200]; // weak static int dword_659F68; // idb static int noShowWarnings; // weak static int dword_659F70; // weak static int playermessage_param1[0xff]; // weak static __int16 playermessage_year[0xff]; // weak static __int16 playermessage_param2[0xff]; // weak static __int16 playermessage_messageTypeId[0xff]; // weak static __int16 playermessage_id[0xff]; // weak static char playermessage_read[0xff]; // weak static char playermessage_month[0xff]; // idb static int message_id; // weak static int playermessageHotspot; // idb static signed int playermessageTotal; // idb static int dword_65DE0C; // weak static int dword_65DE10; // weak static int dword_65DE20[0xff]; // weak static int dword_65DE24; // weak static int dword_65DE28; // weak static int dword_65DE2C; // weak static int dword_65DE30; // weak static int messageNoWorkingDockDelay; // weak static int dword_65DE4C[13]; // weak static int dword_65DE80[0xff]; // weak static int dword_65DE84; // weak static int dword_65DE88[6]; // weak static int workersNeededMessageDelay; // weak static int dword_65DEA4[11]; // weak static int dword_65DED0; // weak static int dword_65DED4; // weak static int mapOrientation; // weak static int mapBookmarks_x[0xff]; // weak static int mapBookmarks_y[0xff]; // idb static int dword_65DF24; // weak static int c3maps_dataOffset; // weak static int dword_65DF2C; // weak static int mousecursor_x[470]; // weak static int mousecursor_y; // weak static char byte_65E6A0; // weak static int system_screen_width; // weak static char byte_65E6A8; // weak static int app_active; // weak static char mouse_isLeftClick; // weak static int app_paused; // weak static char byte_65E6C8; // weak static int unused_65E6D0; // weak static int screen_height; // weak static int dword_65E6D8; // weak static int ddraw_enabled; // weak static int mouseclick_y; // idb static char byte_65E6E8; // weak static HWND main_window; // idb static char setting_start_bpp_buffer[1000]; static int setting_start_bpp; // weak static int setting_fullscreen; // weak static char setting_game_paused; // weak static char setting_zeroByte; // weak static char setting_sound_effects_on; // weak static char setting_sound_music_on; // weak static char setting_sound_speech_on; // weak static int setting_resolution; // weak static int setting_speed_game; // idb static int setting_speed_scroll; // idb static char setting_player_name[32]; // idb static int setting_debug_grid; // idb static int setting_unused_create_empire_zero; // weak static int sidepanel_lastAdvisor; // weak static int savedgame_missionId; // weak static int setting_mouse_tooltips; // weak static int startingFavor; // weak static int setting_personalSavings_lastMission; // weak static int setting_currentMissionId; // weak static int setting_isCustomScenario; // weak static char setting_sound_city_on; // weak static char setting_warnings_on; // weak static char setting_monthy_autosave; // weak static char setting_autoclear_on; // weak static int setting_sound_effects_pct; // idb static int setting_sound_music_pct; // idb static int setting_sound_speech_pct; // idb static int setting_sound_city_pct; // idb static int setting_unused_alwaysTwo; // weak static int setting_ram; // weak static int setting_unused_always66; // weak static int setting_unused_alwaysZero; // weak static int setting_maxKnownGoodResolution; // weak static int setting_personalSavingsPerMission[0xff]; // weak static int setting_dword_65E798[0xff]; // idb static int setting_winVideoAlternate; // weak static int setting_difficulty; // weak static int setting_godsOn; // weak static int mouseclick_x; // idb static char handleClick_isRightClick; // weak static struct IDirectDraw *ddraw_funcs; static __uint32_t ddraw_scanheight; // weak static char currentScenarioFilename[65]; // idb static char mouse_isRightClick; // weak static char findfiles_filenames[0xff]; // idb static char byte_6604A4; // weak static struct _MEMORYSTATUS physMemBuffer; // idb static char current_saveFilename[68]; // idb static LPDIRECTSOUNDBUFFER ds_primaryBuffer; // weak static IDirectDrawClipper *ddraw_clipper; static struct tagRECT ddraw_rect; // idb static int dword_660554; // weak static struct tagPOINT ddraw_bottomright; // idb static int speed_time_cpu; // weak static int dword_660564; // weak static int dword_660568; // weak static int findfiles_flag_unused; // weak static int speed_time_video; // weak static int dword_660578; // weak static int dword_66057C; // weak static int mouse_moved; // idb static char byte_660584; // weak static char byte_660585; // weak static int main_instance; // weak static IDirectDrawSurface *ddraw_backSurface; static IDirectDrawSurface *ddraw_surface; static __int16 word_6E6C02; // weak static __int16 word_6E6C04; // weak static __int16 word_6E6C06; // weak static __int16 graphic_wineWorkshop; // weak static __int16 graphic_amphitheater; // weak static __int16 graphic_theater; // weak static __int16 word_6E6C0E; // weak static __int16 graphic_colosseum; // weak static __int16 graphic_gladiatorSchool; // weak static __int16 graphic_lionHouse; // weak static __int16 graphic_actorColony; // weak static __int16 graphic_chariotMaker; // weak static __int16 graphic_fountain4; // weak static __int16 graphic_fountain1; // weak static __int16 graphic_fountain2; // weak static __int16 graphic_fountain3; // weak static __int16 word_6E6C22; // weak static __int16 word_6E6C24; // weak static __int16 word_6E6C26; // weak static __int16 word_6E6C28; // weak static __int16 word_6E6C2A; // weak static __int16 word_6E6C2C; // weak static __int16 graphic_forum; // weak static __int16 word_6E6C30; // weak static __int16 graphic_timberYard; // weak static __int16 word_6E6C34; // weak static __int16 word_6E6C36; // weak static __int16 word_6E6C38; // weak static __int16 word_6E6C3A; // weak static __int16 word_6E6C3C; // weak static __int16 graphic_templeCeres; // weak static __int16 graphic_templeNeptune; // weak static __int16 graphic_templeMercury; // weak static __int16 graphic_templeMars; // weak static __int16 graphic_templeVenus; // weak static __int16 graphic_oracle; // weak static __int16 word_6E6C4A; // weak static __int16 word_6E6C4C; // weak static __int16 word_6E6C4E; // weak static __int16 word_6E6C50; // weak static __int16 graphic_engineersPost; // weak static __int16 word_6E6C54; // weak static __int16 graphic_emptyWarehouseTile; // weak static __int16 word_6E6C58; // weak static __int16 graphic_governorsHouse; // weak static __int16 graphic_governorsVilla; // weak static __int16 graphic_governorsPalace; // weak static __int16 word_6E6C60; // weak static __int16 word_6E6C64; // weak static __int16 word_6E6C66; // weak static __int16 graphic_laborPriorityLock; // weak static __int16 graphic_panelwindows; // weak static __int16 word_6E6C72; // weak static __int16 graphic_granary; // weak static __int16 graphic_nativeCrops; // weak static __int16 word_6E6C7C; // weak static __int16 word_6E6C7E; // weak static __int16 word_6E6C80; // weak static __int16 word_6E6C82; // weak static __int16 word_6E6C84; // weak static __int16 word_6E6C86; // weak static __int16 word_6E6C88; // weak static __int16 word_6E6C8C; // weak static __int16 word_6E6C8E; // weak static __int16 word_6E6C90; // weak static __int16 word_6E6C94; // weak static __int16 word_6E6C96; // weak static __int16 word_6E6C98; // weak static __int16 word_6E6C9A; // weak static __int16 graphic_homeless; // weak static __int16 word_6E6C9E; // weak static __int16 word_6E6CA0; // weak static __int16 word_6E6CA2; // weak static __int16 graphic_oilWorkshop; // weak static __int16 graphic_weaponsWorkshop; // weak static __int16 graphic_furnitureWorkshop; // weak static __int16 graphic_potteryWorkshop; // weak static __int16 word_6E6CAC; // weak static __int16 word_6E6CAE; // weak static __int16 graphic_advisorIcons; // weak static __int16 graphic_resourceIcons; // weak static __int16 word_6E6CB4; // weak static __int16 word_6E6CB6; // weak static __int16 graphic_dialogBackground; // weak static __int16 graphic_sunkenBackground; // weak static __int16 word_6E6CBC; // weak static __int16 word_6E6CBE; // weak static __int16 graphic_advisorBackground; // weak static __int16 word_6E6CC4; // weak static __int16 word_6E6CC6; // weak static __int16 word_6E6CC8; // weak static __int16 word_6E6CCA; // weak static __int16 word_6E6CCC; // weak static __int16 word_6E6CCE; // weak static __int16 word_6E6CD2; // weak static __int16 word_6E6CD4; // weak static __int16 word_6E6CD6; // weak static __int16 word_6E6CD8; // weak static __int16 word_6E6CDA; // weak static __int16 word_6E6CDC; // weak static __int16 word_6E6CDE; // weak static __int16 word_6E6CE0; // weak static __int16 word_6E6CE2; // weak static __int16 word_6E6CE4; // weak static __int16 word_6E6CE6; // weak static __int16 word_6E6CE8; // weak static __int16 graphic_graphBar; // weak static __int16 graphic_bullet; // weak static __int16 word_6E6CEE; // weak static __int16 graphic_winGame; // weak static __int16 graphic_logo; // weak static __int16 word_6E6CF6; // weak static __int16 graphic_bridge; // weak static __int16 word_6E6CFA; // weak static __int16 word_6E6CFC; // weak static __int16 word_6E6D00; // weak static __int16 word_6E6D02; // weak static __int16 word_6E6D04; // weak static __int16 word_6E6D06; // weak static __int16 graphic_empirePanels; // weak static __int16 word_6E6D0A; // weak static __int16 graphic_empireCity; // weak static __int16 graphic_empireCityTrade; // weak static __int16 graphic_empireCityDistant; // weak static __int16 graphic_empireBattleIcon; // weak static __int16 graphic_empireDistantBattleRomanArmy; // weak static __int16 word_6E6D16; // weak static __int16 graphic_empireBorderMarker; // weak static __int16 graphic_empireLandTradeRoute; // weak static __int16 graphic_empireSeaTradeRoute; // weak static __int16 graphic_nativeBuilding; // weak static __int16 graphic_missionPost; // weak static __int16 word_6E6D22; // weak static __int16 graphic_demo1; // weak static __int16 graphic_demo2; // weak static __int16 graphic_demo3; // weak static __int16 graphic_rating_column; // weak static __int16 graphic_bigpeople; // weak static __int16 word_6E6D2E; // weak static __int16 word_6E6D30; // weak static __int16 word_6E6D32; // weak static __int16 word_6E6D34; // weak static __int16 graphic_ratingsBackground; // weak static __int16 word_6E6D3A; // weak static __int16 word_6E6D3C; // weak static __int16 word_6E6D40; // weak static __int16 graphic_militaryAcademy; // weak static __int16 word_6E6D44; // weak static __int16 word_6E6D48; // weak static __int16 word_6E6D4A; // weak static __int16 word_6E6D4C; // weak static __int16 word_6E6D4E; // weak static __int16 graphic_borderedButton; // weak static __int16 word_6E6D52; // weak static __int16 word_6E6D54; // weak static __int16 word_6E6D56; // weak static __int16 word_6E6D58; // weak static __int16 word_6E6D5A; // weak static __int16 word_6E6D5C; // weak static __int16 word_6E6D5E; // weak static __int16 word_6E6D60; // weak static __int16 word_6E6D62; // weak static __int16 word_6E6D64; // weak static __int16 word_6E6D66; // weak static __int16 word_6E6D68; // weak static __int16 word_6E6D6A; // weak static __int16 word_6E6D6C; // weak static __int16 word_6E6D6E; // weak static __int16 graphic_empireDistantBattleEnemyArmy; // weak static __int16 graphic_godBolt; // weak static __int16 word_6E6D74; // weak static __int16 word_6E6D76; // weak static __int16 word_6E6D78; // weak static __int16 word_6E6D7A; // weak static __int16 word_6E6D7C; // weak static __int16 word_6E6D7E; // weak static __int16 word_6E6D80; // weak static __int16 word_6E6D82; // weak static __int16 word_6E6D84; // weak static __int16 word_6E6D86; // weak static __int16 word_6E6D88; // weak static __int16 word_6E6D8A; // weak static __int16 word_6E6D8C; // weak static __int16 word_6E6D8E; // weak static __int16 word_6E6D90; // weak static __int16 word_6E6D92; // weak static __int16 word_6E6D94; // weak static __int16 graphic_tradeAmount; // weak static __int16 word_6E6D98; // weak static __int16 word_6E6D9A; // weak static __int16 word_6E6D9C; // weak static __int16 word_6E6D9E; // weak static __int16 word_6E6DA0; // weak static __int16 word_6E6DA2; // weak static __int16 word_6E6DA4; // weak static __int16 graphic_loadingScreen; // weak static __int16 graphic_firedScreenBg; // weak static __int16 word_6E6DAA; // weak static __int16 graphic_selectMissionButton[46]; // weak static char c3sg2_bitmaps[20000]; // idb static int dword_7E2BFC; // weak static int dword_7E2C00; // weak static int dword_7E2C04; // weak static int dword_7E2C10; // weak static int dword_7E2C14; // weak static int dword_7E2C18; // weak static int dword_7E2C1C; // weak static int dword_7E2C28; // idb static int dword_7E2C2C; // idb static int message_param1; // idb static char byte_7E2C40[0xff]; // idb static int message_msgAdvisorId; // weak static int dword_7E2D0C; // weak static int dword_7E2D10; // weak static int message_paramResourceId; // idb static int helpDialog_text_height; // idb static int dword_7E2D1C; // weak static signed int helpDialog_max; // idb static int dword_7E2D40[0xff]; // weak static int dword_7E2D44[0xff]; // weak static int dword_7E2D48[0xff]; // weak static int dword_7E2D4C[0xff]; // weak static int dword_7E2D50[0xff]; // idb static int dword_7E3128; // weak static int dword_7E312C; // weak static int helpDialog_value; // idb static int helpDialog_windowId; // weak static int dword_7E313C; // weak static int message_year; // idb static int dword_7E3144; // idb static int dword_7E3148; // idb static int dword_7E314C; // weak static int dword_7E3150; // idb static int dword_7E3154; // idb static int helpDialog_text_y; // idb static int helpDialog_text_x; // idb static int helpDialog_text_width; // idb static char byte_7E3180[0xff]; // idb static int seqWalkerName_citizen; // weak static int seqWalkerName_taxCollector; // weak static int dword_7F87A8; // weak static int dword_7F87AC; // weak static int dword_7F87B0; // weak static int seqWalkerName_actor; // weak static int seqWalkerName_javelinThrower; // weak static int seqWalkerName_barbarian; // weak static int dword_7FA0E0[0xff]; // idb static int dword_7FA1A8; // weak static int dword_7FA1AC; // weak static unsigned short dword_7FA1C0[50]; // idb static int dword_7FA224; // weak static int numForts; // weak static int dword_7FA22C; // weak static int seqWalkerName_patrician; // weak static int dword_7FA234; // weak static int dword_7FA238; // weak static int dword_7FA240[0xff]; // idb static int dword_7FA2A4; // weak static int dword_7FA2C0[0xff]; // idb static char byte_7FA343[0xff]; // weak static char byte_7FA356[0xff]; // weak static char byte_7FA357[0xff]; // weak static char byte_7FA359[0xff]; // weak static __int16 walker_destinationPathLength[0xff]; // weak static char byte_7FA371[0xff]; // weak static char byte_7FA377[0xff]; // weak static char byte_7FA378[0xff]; // weak static char byte_7FA379[0xff]; // weak static __int16 word_7FA37E[0xff]; // weak static __int16 word_7FA380[0xff]; // weak static __int16 word_7FA382[0xff]; // weak static __int16 word_7FA386[0xff]; // weak static char byte_7FA388[0xff]; // weak static char byte_7FA392[0xff]; // weak static __int16 walker_name[0xff]; // weak static char byte_7FA3AA[0xff]; // weak static char byte_7FA3AC[0xff]; // weak static char byte_7FA3AD[0xff]; // weak static char byte_7FA3AE[0xff]; // weak static int seqWalkerName_lionTamer; // weak static int seqWalkerName_legionary; // weak static unsigned char dword_819760[100]; // idb static int seqWalkerName_unknown2; // weak static unsigned char dword_8197E0[100]; // idb static int seqWalkerName_female; // weak static int dword_819848; // weak static int seqWalkerName_prefect; // weak static int formationId_lastFort; // weak static int seqWalkerName_cavalry; // weak static int dword_819860[0xff]; // idb static unsigned short dword_8198E0[50]; // idb static int seqWalkerName_charioteer; // weak static char destinationpath_data[0xff]; // idb static int dword_862D40; // weak static int walkerId_lastUsed; // idb static int formationId_lastInUse; // weak static int seqWalkerName_gladiator; // weak static int seqWalkerName_arabian; // weak static int seqWalkerName_trader; // weak static int dword_862D60[0xff]; // idb static int dword_862DE0[0xff]; // idb static int seqWalkerName_unknown1; // weak static int selectedLegionId; // idb static int seqWalkerName_engineer; // weak static int seqWalkerName_greek; // weak static __int16 destinationpath_index[0xff]; // idb static int seqWalkerName_tradeShip; // weak static int seqWalkerName_egyptian; // weak static int dword_863318; // weak static int dword_86331C[29533]; // weak static int dword_8876B8; // idb static int walkerBaseGridOffset; // weak static __int16 grid_walkerIds[0xff]; // idb static int dword_8943C8; // weak static int event_earthquake_maxDamage; // weak static char grid_buildingDamage[0xff]; // idb static char byte_89A9DC[0xff]; // idb static int dword_89AA64; // weak static int dword_89AA68; // weak static int deleteConfirm_a2; // idb static int dword_89AA70; // weak static int deleteConfirm_x; // idb static int deleteConfirm_a3; // idb static char engineerMaxDamageSeen; // weak static char byte_89AA7E[0xff]; // weak static int deleteConfirm_y; // idb static int dword_89AA84; // weak static int dword_89AA88; // weak static int dword_89AA8C; // weak static int deleteFort_confirmed; // weak static __int16 word_89AAA0[0xff]; // idb static int dword_89AB08; // weak static char byte_89AB1E[0xff]; // weak static char byte_89AB1F[0xff]; // weak static char grid_animation[0xff]; // weak static char byte_89AB21[0xff]; // weak static char byte_89AB22[0xff]; // idb static char byte_89ABC2[0xff]; // idb static char byte_89AC64[0xff]; // idb static int event_gladiatorRevolt_gameYear; // weak static int dword_8A11C0[0xff]; // weak static int dword_8A11C4; // weak static int dword_8A11C8; // weak static int dword_8A11CC; // weak static int dword_8A11D0; // weak static int dword_8A11D4; // weak static int dword_8A11D8; // weak static int dword_8A11DC; // weak static int dword_8A11E0[0xff]; // weak static char undo_grid_edge[26244]; // weak static int dword_8A7884; // weak static int dword_8A7888; // weak static int dword_8A788C; // weak static int prefectMaxCrimeRiskSeen; // weak static char undo_grid_bitfields[26272]; // weak static char byte_8ADF60[0xff]; // idb static int dword_8B45E4; // weak static int amount; // idb static int multipleConstruction_itemsPlaced; // weak static int event_gladiatorRevold_endMonth; // weak static int event_emperorChange_state; // weak static int prefectMaxFireRiskSeen; // weak static int dword_8B4600; // weak static int dword_8B4604; // weak static int dword_8B4608; // weak static int dword_8B460C; // weak static __int16 grid_graphicIds[0xff]; // weak static __int16 word_8B4622[0xff]; // weak static __int16 word_8B4624[0xff]; // idb static __int16 word_8B4764[0xff]; // weak static __int16 word_8B4766[0xff]; // weak static __int16 word_8B4768[0xff]; // idb static __int16 word_8B48A8[0xff]; // weak static __int16 word_8B48AA[0xff]; // weak static __int16 word_8B48AC[0xff]; // idb static char byte_8C129E[0xff]; // idb static char byte_8C133F[0xff]; // weak static char grid_edge[0xff]; // weak static char byte_8C1341[0xff]; // weak static char byte_8C1342[0xff]; // idb static char byte_8C13E2[0xff]; // weak static char byte_8C13E4[0xff]; // idb static char byte_8C1484[0xff]; // weak static char byte_8C1485[0xff]; // weak static char byte_8C1486[0xff]; // idb static int dword_8C79C4; // weak static int setting_map_start; static int dword_8C7A0C; // weak static int dword_8C7A10; // weak static char undo_grid_animation[26244]; // weak static int dword_8CE0A4; // weak static int event_earthquake_month; // weak static char undo_grid_terrain[52350]; // weak static char byte_8DAD3E[0xff]; // idb static int deleteBridge_confirmed; // weak static char byte_8DADDF[0xff]; // weak static char grid_aqueducts[0xff]; // weak static char byte_8DADE1[0xff]; // idb static char byte_8DAE82[0xff]; // idb static char byte_8E13FD[0xff]; // weak static char byte_8E13FE[0xff]; // weak static char byte_8E13FF[0xff]; // idb static int dword_8E1464; // weak static int dword_8E1468; // weak static int dword_8E146C; // weak static int dword_8E1470; // weak static int event_earthquake_maxDuration; // weak static int dword_8E1478; // weak static int dword_8E147C; // weak static int event_earthquake_state; // weak static int dword_8E1484; // idb static int dword_8E1488; // weak static int event_earthquake_gameYear; // weak static int dword_8E1490; // weak static int event_gladiatorRevolt_state; // weak static char byte_8E149F[0xff]; // weak static char grid_bitfields[0xff]; // weak static char byte_8E14A1[0xff]; // weak static char byte_8E14A2[0xff]; // weak static char byte_8E1541[0xff]; // weak static char byte_8E1542[0xff]; // weak static char byte_8E1543[0xff]; // weak static char byte_8E1544[0xff]; // idb static char byte_8E15E4[0xff]; // weak static char byte_8E15E5[0xff]; // weak static char byte_8E15E6[0xff]; // idb static int dword_8E7B24; // weak static int dword_8E7B28; // weak static int dword_8E7B2C; // weak static int taxCollectorMaxHousingLevelSeen; // weak static char grid_random[0xff]; // idb static int event_emperorChange_gameYear; // weak static char undoBuildings[0xff]; // weak static __int16 word_8EE1E8[0xff]; // weak static __int16 word_8EE1EA[0xff]; // idb static char byte_8EFA5D[0xff]; // weak static char byte_8EFA5E[0xff]; // weak static char byte_8EFA5F[0xff]; // idb static int dword_8EFAE4; // weak static int dword_8EFAE8; // weak static char byte_8EFAFF[0xff]; // weak static char grid_elevation[0xff]; // weak static char byte_8EFB01[0xff]; // idb static char byte_8EFBA1[0xff]; // weak static char byte_8EFBA2[0xff]; // weak static char byte_8EFBA3[0xff]; // idb static __int16 word_8F605A[0xff]; // weak static __int16 word_8F605C[0xff]; // weak static __int16 word_8F605E[0xff]; // idb static int dword_8F6184; // weak static __int16 word_8F619E[0xff]; // weak static __int16 grid_buildingIds[0xff]; // weak static __int16 word_8F61A2[0xff]; // weak static __int16 word_8F61A4[0xff]; // idb static __int16 word_8F62E2[0xff]; // weak static __int16 word_8F62E4[0xff]; // weak static __int16 word_8F62E6[0xff]; // weak static __int16 word_8F62E8[0xff]; // idb static __int16 word_8F6428[0xff]; // weak static __int16 word_8F642A[0xff]; // weak static __int16 word_8F642C[0xff]; // idb static int event_gladiatorRevolt_month; // weak static int bridge_something; // weak static char byte_902EC0[0xff]; // idb static __int16 word_9092D8[0xff]; // idb static __int16 grid_terrain_xMinusOne_yMinusOne[0xff]; // weak static __int16 grid_terrain_x_yMinusOne[0xff]; // weak static __int16 grid_terrain_xPlusOne_yMinusOne[0xff]; // idb static int dword_909544; // idb static int dword_909548; // idb static __int16 grid_terrain_xMinusTwo_y[0xff]; // weak static __int16 grid_terrain_xMinusOne_y[0xff]; // weak static __int16 grid_terrain[0xff]; // idb static __int16 grid_terrain_xPlusOne_y[0xff]; // weak static __int16 grid_terrain_xPlusTwo_y[0xff]; // idb static __int16 grid_terrain_xMinusOne_yPlusOne[0xff]; // weak static __int16 grid_terrain_x_yPlusOne[0xff]; // weak static __int16 grid_terrain_xPlusOne_yPlusOne[0xff]; // weak static __int16 grid_terrain_xPlusTwo_yPlusOne[0xff]; // weak static __int16 grid_terrain_xPlusThree_yPlusOne[0xff]; // idb static __int16 word_9097E8[0xff]; // weak static __int16 word_9097EA[0xff]; // weak static __int16 word_9097EC[0xff]; // idb static __int16 grid_terrain_xPlusOne_yPlusThree[0xff]; // idb static char rubble_originalBuildingType[0xff]; // idb static char byte_91C920[0xff]; // idb static char undo_grid_aqueducts[26244]; // weak static int undo_lastBuildingCost; // weak static int event_emperorChange_month; // weak static int dword_929660[0xff]; // weak static unsigned int dword_929664[14]; // idb static __int16 undo_grid_graphicIds[0xff]; // idb static int dword_9363A8; // weak static int dword_9363AC; // weak static int dword_9363B0; // idb static int dword_9363B4; // idb static int dword_9363B8; // weak static char grid_desirability[0xff]; // idb static int width; // idb static int dword_93CA54; // weak static signed int numWorkingClinics; // idb static int buildingId_highestInUseEver; // idb static int numWorkingMarkets; // weak static signed int numWorkingAmphitheaters; // idb static int numUpgradedForums; // weak static int tutorial2_population250reached; // weak static int numFountains; // weak static int pctAcademyCoverage; // weak static signed int numWorkingHospitals; // idb static signed int numWorkingBarbers; // idb static int gametime_totalWeeks; // weak static int tutorial1_prefectureBuilt; // weak static __int16 word_949F00[0xff]; // idb static int numAcademies; // idb static int dword_94A2EC; // weak static signed int numLargeTemplesVenus; // idb static signed int numWorkingSchools; // idb static int dword_94A2F8; // weak static int dword_94A2FC; // weak static int numColosseums; // idb static int dword_94A304; // weak static int numSchools; // idb static int dword_94A30C; // weak static int dword_94A310; // weak static int tutorial2_population450reached; // weak static int dword_94A318; // weak static int numWorkingLionHouses; // weak static int dword_94A320[0xff]; // idb static __int16 gametick_tmpBuildingList[0xff]; // idb static int dword_94B3A0; // weak static int numUpgradedSenates; // weak static int numSenates; // weak static int pctColosseumCoverage; // weak static int dword_94B3B0; // weak static int numTheaters; // idb static __int16 word_94B3C0[0xff]; // idb static int numReservoirs; // weak static int numWorkingLargeTemplesVenus; // weak static __int16 word_94BBA0[0xff]; // idb static int numForums; // weak static int dword_94BC6C; // weak static int numWorkingActorColonies; // weak static unsigned short dword_94BC80[16]; // idb static int numWorkingGladiatorSchools; static int dword_94BCC0[0xff]; // weak static int gametick_tmpBuildingList_ctr; // weak static int numWorkingLargeTemplesNeptune; // weak static int numWorkingUpgradedForums; // weak static int numWorkingForums; // weak static signed int numLargeTemplesMars; // idb static int dword_94BCF0; // weak static int numClinics; // idb static int tutorial2_potteryMadeYear; // weak static signed int numSmallTemplesNeptune; // idb static int numWorkingSmallTemplesNeptune; // weak static int houseEvolve_status; // weak static int pctTheaterCoverage; // weak static int numWorkingLargeTemplesMars; // weak static int pctHippodromeCoverage; // weak static int buildingId_placedSequence; // weak static int pctLibraryCoverage; // weak static int numWorkingLargeTemplesMercury; // weak static int numWorkingLargeTemplesCeres; // weak static signed int numSmallTemplesCeres; // idb static int numHospitals; // idb static int numBathhouses; // idb static int debug_drawEvolveInfo; // weak static int numWorkingSmallTemplesCeres; // weak static int dword_94BD38; // weak static int numWorkingSmallTemplesMercury; // weak static int numAmphitheaters; // idb static int tutorial2_potteryMade; // weak static signed int numSmallTemplesMercury; // idb static int pctReligionCoverageMars; // weak static int numIndustries[0xff]; // weak static int numWheatFarms; // weak static int numVegetableFarms; // weak static int numFruitFarms; // weak static int numOliveFarms; // weak static int numVinesFarms; // weak static int numPigFarms; // weak static int numWineWorkshops; // weak static int numOilWorkshops; // weak static int numIronMines; // weak static int numTimberYards; // weak static int numClayPits; // weak static int numMarbleQuarries; // weak static int numWeaponsWorkshops; // weak static int numFurnitureWorkshops; // weak static int numPotteryWorkshops; // weak static int pctHospitalCoverage; // weak static int storage_start[0xff]; // weak static __int16 storage_buildingId[0xff]; // weak static int pctReligionCoverageOracles; // weak static int dword_98BEC4; // weak static int numBarbers; // idb static int pctReligionCoverageNeptune; // weak static int numWorkingChariotMakers; // weak static int tutorial1_senateEngineerBuilt; // weak static int dword_98BED8; // weak static int numBarracks; // weak static int numChariotMakers; // weak static int buildingId; // idb static int dword_98BEE8; // weak static int tutorial1_crime; // weak static int tutorial2_granaryBuilt; // weak static int numWorkingReservoirs; // weak static int tutorial1_fire; // weak static int dword_98BF08; // weak static int numWorkingSmallTemplesMars; // weak static int dword_98BF10; // weak static int dword_98BF14; // weak static int dword_98BF18; // weak static bool houseEvolveDevolve_hasExpanded; static int pctReligionCoverageVenus; // weak static signed int numWorkingAcademies; // idb static int tutorial2_disease; // weak static int numHippodromes; // idb static int gametime_year; // idb static int dword_98BF38; // weak static int dword_98BF3C; // idb static int dword_98BF40; // weak static signed int numOracles; // idb static int numActorColonies; // weak static signed int numWorkingHippodromes; // idb static int numWorkingBarracks; // weak static int numMarkets; // weak static int pctSchoolCoverage; // weak static int numLibraries; // idb static int buildingId_highestInUse; // idb static int game_weeks; // idb static int numMilitaryAcademies; // weak static int dword_98BF6C; // weak static signed int numWorkingColosseums; // idb static int dword_98BF74; // weak static signed int numWorkingTheaters; // idb static int pctReligionCoverageCeres; // weak static int dword_98BF80[0xff]; // weak static int dword_98BF84; // weak static int dword_98BF88; // weak static int dword_98BF8C; // weak static int dword_98BF98; // weak static int numWorkingIndustries[0xff]; // weak static int numWorkingWheatFarms; // weak static int numWorkingVegetableFarms; // weak static int numWorkingFruitFarms; // weak static int numWorkingOliveFarms; // weak static int numWorkingVinesFarms; // weak static int numWorkingPigFarms; // weak static int numWorkingWineWorkshops; // weak static int numWorkingOilWorkshops; // weak static int numWorkingIronMines; // weak static int numWorkingTimberYards; // weak static int numWorkingClayPits; // weak static int numWorkingMarbleQuarries; // weak static int numWorkingWeaponsWorkshops; // weak static int numWorkingFurnitureWorkshops; // weak static int numWorkingPotteryWorkshops; // weak static int pctAmphitheaterCoverage; // weak static int debug_drawBuildingInfo; // weak static int pctReligionCoverageMercury; // weak static int dword_98C00C; // weak static signed int numWorkingBathhouses; // idb static signed int numSmallTemplesMars; // idb static int gametick_tmpBuildingList_size; // weak static int dword_98C020; // weak static int dword_98C024; // weak static int dword_98C028; // idb static int numWorkingFountains; // weak static int dword_98C040[0xff]; // weak static int dword_98C05C; // weak static int game_ticks; // idb static int dword_98C064; // weak static __int16 word_98C080[0xff]; // idb static int dword_98C468; // weak static int numWorkingUpgradedSenates; // weak static int numWorkingSenates; // weak static int numLionHouses; // weak static int numWorkingMilitaryAcademies; // weak static signed int numLargeTemplesNeptune; // idb static int dword_98C480; // weak static int timeLimit_maxGameYear; // weak static int dword_98C48C; // weak static int dword_98C490; // weak static signed int numLargeTemplesMercury; // idb static int debug_drawFigureInfo; // weak static signed int numLargeTemplesCeres; // idb static signed int numWorkingLibraries; // idb static int gametime_month; // idb static int numGladiatorSchools; // weak static int dword_98C4C0[0xff]; // idb static signed int numSmallTemplesVenus; // idb static int dword_98C58C; // weak static int numWorkingSmallTemplesVenus; // weak static __int16 lastInvasionInternalId; // weak static int currentEmpireEntryId; // idb static __int16 scn_settings_startYear; // weak static __int16 scn_empire; // weak static __int16 scn_requests_year[0xff]; // idb static __int16 scn_requests_good[0xff]; // idb static __int16 scn_requests_amount[0xff]; // idb static __int16 scn_requests_time[0xff]; // idb static __int16 scn_invasions_year[0xff]; // idb static __int16 scn_invasions_type[0xff]; // idb static unsigned char scn_invasions_amount[40]; // idb static __int16 scn_invasions_point[0xff]; // idb static __int16 scn_invasions_attack[0xff]; // idb static int scn_startFunds; // idb static __int16 scn_enemy; // weak static int scn_sizeX; // weak static int scn_sizeY; // weak static int scn_gridFirstElement; // weak static int scn_gridBorderSize; // weak static char scn_briefDescription[586]; // weak static char scn_requests_canComplyShown[0xff]; // idb static __int16 scn_image; // weak static __int16 scn_isOpenPlay; // weak static __int16 scn_playerRank; // weak static __int16 scn_herd_x[0xff]; // idb static __int16 scn_herd_y[0xff]; // idb static __int16 scn_demandChanges_year[0xff]; // idb static char scn_demandChanges_month[0xff]; // idb static char scn_demandChanges_good[0xff]; // idb static char scn_demandChanges_tradeRoute[0xff]; // idb static char scn_demandChanges_isRise[0xff]; // idb static __int16 scn_priceChanges_year[0xff]; // idb static char scn_priceChanges_month[0xff]; // idb static char scn_priceChanges_good[0xff]; // idb static char scn_priceChanges_amount[0xff]; // idb static char scn_priceChanges_isRise[0xff]; // idb static int scn_event_gladiatorRevolt_on; // weak static int scn_event_gladiatorRevolt_year; // weak static int scn_event_emperorChange_on; // weak static int scn_event_emperorChange_year; // weak static int scn_event_seaTradeProblem; // weak static int scn_event_landTradeProblem; // weak static int scn_event_raiseWages; // weak static int scn_event_lowerWages; // weak static int scn_event_contaminatedWater; // weak static int scn_event_ironMineCollapse; // weak static int scn_event_clayPitFlooded; // weak static __int16 scn_fish_x[8]; // weak static __int16 scn_fish_y[8]; // weak static char scn_requests_favor[0xff]; // idb static char scn_invasions_month[0xff]; // idb static char scn_requests_month[0xff]; // idb static char scn_requests_state[0xff]; // idb static char scn_requests_isVisible[0xff]; // idb static char scn_requests_monthsToComply[0xff]; // idb static int scn_romeSuppliesWheat; // weak static __int16 scn_allow_farms; // weak static __int16 scn_allow_rawMaterials; // weak static __int16 scn_allow_workshops; // weak static __int16 scn_allow_road; // weak static __int16 scn_allow_wall; // weak static __int16 scn_allow_aqueduct; // weak static __int16 scn_allow_amphitheater; // weak static __int16 scn_allow_theater; // weak static __int16 scn_allow_hippodrome; // weak static __int16 scn_allow_colosseum; // weak static __int16 scn_allow_gladiatorSchool; // weak static __int16 scn_allow_lionHouse; // weak static __int16 scn_allow_actorColony; // weak static __int16 scn_allow_chariotMaker; // weak static __int16 scn_allow_gardens; // weak static __int16 scn_allow_plaza; // weak static __int16 scn_allow_statues; // weak static __int16 scn_allow_doctor; // weak static __int16 scn_allow_hospital; // weak static __int16 scn_allow_bathhouse; // weak static __int16 scn_allow_barber; // weak static __int16 scn_allow_school; // weak static __int16 scn_allow_academy; // weak static __int16 scn_allow_library; // weak static __int16 scn_allow_prefecture; // weak static __int16 scn_allow_fort; // weak static __int16 scn_allow_gatehouse; // weak static __int16 scn_allow_tower; // weak static __int16 scn_allow_smallTemples; // weak static __int16 scn_allow_largeTemples; // weak static __int16 scn_allow_market; // weak static __int16 scn_allow_granary; // weak static __int16 scn_allow_warehouse; // weak static __int16 scn_allow_dock; // weak static __int16 scn_allow_wharves; // weak static __int16 scn_allow_governorHome; // weak static __int16 scn_allow_engineersPost; // weak static __int16 scn_allow_senate; // weak static __int16 scn_allow_forum; // weak static __int16 scn_allow_well; // weak static __int16 scn_allow_oracle; // weak static __int16 scn_allow_missionPost; // weak static __int16 scn_allow_bridges; // weak static __int16 scn_allow_barracks; // weak static __int16 scn_allow_militaryAcademy; // weak static __int16 scn_allow_distributionCenter; // weak static int scn_win_culture; // idb static int scn_win_prosperity; // idb static int scn_win_peace; // idb static int scn_win_favor; // idb static char scn_win_culture_on; // weak static char scn_win_prosperity_on; // weak static char scn_win_peace_on; // weak static char scn_win_favor_on; // weak static int scn_win_timeLimit_on; // weak static int scn_win_timeLimit; // idb static int scn_win_survivalTime_on; // weak static int scn_win_survivalTime; // idb static int scn_event_earthquake_severity; // weak static int scn_event_earthquake_year; // weak static int scn_win_population_on; // weak static int scn_win_population; // idb static __int16 scn_earthquake_x; // weak static __int16 scn_earthquake_y; // weak static __int16 scn_entryPoint_x; // weak static __int16 scn_entryPoint_y; // weak static __int16 scn_exitPoint_x; // weak static __int16 scn_exitPoint_y; // weak static __int16 scn_invasionPoint_x[0xff]; // idb static __int16 scn_invasionPoint_y[0xff]; // idb static __int16 scn_riverEntry_x; // weak static __int16 scn_riverEntry_y; // weak static __int16 scn_riverExit_x; // weak static __int16 scn_riverExit_y; // weak static int scn_rescueLoan; // idb static int scn_milestone_25; // weak static int scn_milestone_50; // weak static int scn_milestone_75; // weak static char scn_climate; // weak static char scn_flotsam; // weak static int scn_empireExpanded_flag; // weak static int scn_empireExpansion_year; // weak static char scn_distantBattle_romanTravelTime; // weak static char scn_distantBattle_enemyTravelTime; // weak static char scn_openPlayScenarioId; // weak static char byte_98EF40[0xff]; // weak static char byte_98EF41[0xff]; // weak static char byte_98EF42[0xff]; // weak static char byte_98EF43[0xff]; // weak static __int16 word_98EF44[0xff]; // weak static __int16 word_98EF46[0xff]; // weak static __int16 word_98EF48[0xff]; // weak static __int16 word_98EF4A[0xff]; // weak static __int16 word_98EF4C[0xff]; // weak static __int16 word_98EF4E[0xff]; // weak static int dword_98EF50[0xff]; // weak static char byte_98EF54[0xff]; // idb static int empire_scroll_x; // weak static int empire_scroll_y; // weak static int edit_empire_max_inUse; // idb static __int16 empireindex_xOffset[0xff]; // weak static __int16 empireindex_yOffset[0xff]; // weak static __int16 empireindex_inUse[0xff]; // idb static int currentEnemyId; // weak static int dword_990604; // weak static int scenario_map_empire; // weak static __int16 map_settings_startYear; // weak static __int16 map_empire; // weak static __int16 map_unknown_0a; // weak static __int16 map_unknown_0c; static __int16 map_requests_year[0xff]; // idb static __int16 map_requests_good[0xff]; // idb static __int16 map_requests_amount[0xff]; // idb static __int16 map_requests_deadline[0xff]; // idb static __int16 map_invasions_year[0xff]; // idb static __int16 map_invasions_type[0xff]; // idb static __int16 map_invasions_amount[0xff]; // idb static __int16 map_invasions_from[0xff]; // idb static __int16 map_invasions_attack[0xff]; // idb static signed int map_startFunds; // idb static __int16 map_enemy; // weak static int map_sizeX; // weak static int map_sizeY; // weak static int map_gridFirstElement; // weak static int map_gridBorderSize; // weak static char map_briefDescription[64]; // idb static char map_briefing[504]; // idb static char byte_9909EC[0xff]; // weak static char byte_9909F4[0xff]; // weak static __int16 map_image; // weak static __int16 map_isOpenPlay; // weak static __int16 map_playerRank[0xff]; // weak static __int16 map_herd_x[0xff]; // idb static __int16 map_herd_y[0xff]; // idb static __int16 map_demandChanges_year[0xff]; // idb static char byte_990A63[0xff]; // weak static char map_demandChanges_good[0xff]; // idb static char map_demandChanges_route[0xff]; // idb static char map_demandChanges_isRise[0xff]; // idb static __int16 map_priceChanges_year[0xff]; // idb static char byte_990ADB[0xff]; // weak static char map_priceChanges_good[0xff]; // idb static char map_priceChanges_amount[0xff]; // idb static char map_priceChanges_isRise[0xff]; // idb static int map_event_gladiatorRevolt_on; // idb static int map_event_gladiatorRevolt_year; // idb static int map_event_emperorChange_on; // idb static int map_event_emperorChange_year; // idb static int map_event_seaTradeProblem; // idb static int map_event_landTradeProblem; // idb static int map_event_raiseWages; // idb static int map_event_lowerWages; // idb static int map_event_contaminatedWater; // idb static int map_event_ironMineCollapse; // idb static int map_event_clayPitFlooded; // idb static __int16 map_fish_x[0xff]; // idb static __int16 map_fish_y[0xff]; // idb static char map_requests_favor[0xff]; // idb static int map_romeSuppliesWheat; // idb static __int16 map_allowedBuildings[0xff]; // idb static int map_win_culture[0xff]; // weak static signed int map_win_prosperity; // idb static signed int map_win_peace; // idb static signed int map_win_favor; // idb static char map_win_culture_on[0xff]; // weak static char map_win_prosperity_on; // weak static char map_win_peace_on; // weak static char map_win_favor_on; // weak static int map_win_timeLimitYears_on; // idb static int map_win_timeLimitYears; // idb static int map_win_survivalYears_on; // idb static int map_win_survivalYears; // idb static int map_event_earthquake_severity; // idb static int map_event_earthquake_year; // idb static int map_win_population_flag; // idb static signed int map_win_population; // idb static __int16 map_earthquake_x; // weak static __int16 map_earthquake_y; // weak static __int16 map_entry_x[0xff]; // weak static __int16 map_entry_y; // weak static __int16 map_exit_x; // weak static __int16 map_exit_y[0xff]; // weak static __int16 map_invasionPoints_x[0xff]; // idb static __int16 map_invasionPoints_y[0xff]; // idb static __int16 map_riverEntry_x; // weak static __int16 map_riverEntry_y; // weak static __int16 map_riverExit_x; // weak static __int16 map_riverExit_y; // weak static signed int map_rescueLoan; // idb static int map_milestone25[0xff]; // weak static int map_milestone50; // idb static int map_milestone75; // idb static int map_graphic_nativeHut; // weak static int map_graphic_nativeMeeting; // weak static int map_graphic_nativeCrops; // weak static char map_climate; // weak static char map_flotsam; // weak static int map_empireExpanded; // idb static int map_empireExpansionYear; // idb static char map_distantBattle_romanTravelTime; // weak static char map_distantBattle_enemyTravelTime; // weak static char map_openPlayScenId; // weak static int dword_990CD8; // weak static int dword_990CDC; // weak static int editEmpire_addObjectGraphicID; // weak static int empireScreen_selectedRouteId; // weak static int dword_993F04; // weak static int editEmpire_selectedObjectButton; // weak static int dword_993F20[0xff]; // weak static int dword_993F60[0xff]; // weak static int dword_993F64[0xff]; // weak static char byte_993F68[0xff]; // weak static char byte_993F78[0xff]; // weak static int dword_993F88[0xff]; // weak static int dword_993F8C[0xff]; // idb static int goodCanImportFromCity[16]; // idb static int tradedSoFar[0xff]; // idb static int sound_effectsChannels[0xff]; // weak LPDIRECTSOUNDBUFFER lpDirectSoundBuffer[10]; // idb static UINT uTimerID; // idb static int ds_dword_995AC8[0xff]; // weak static HRESULT ds_hresult; // weak LPDIRECTSOUNDBUFFER sound_musicChannels[20]; // idb static __int16 ds_lPan; // weak static __int16 ds_995B82; // weak static int ds_hertz; // weak static int ds_995B88; // weak static int ds_995B8C; // weak HGLOBAL global_handles[400]; // weak HMMIO sound_handles[400]; // weak static unsigned int unk_995BA8; // weak static unsigned int unk_995BBC; // weak LPDIRECTSOUNDBUFFER ds_sound_buffer_ptr[400]; // weak DWORD ds_sound_buffer_lenght[400]; // weak static int ds_dword_995BD8[0xff]; // weak DWORD ds_sound_buffer_offset[400]; // weak static struct tagPALETTEENTRY pPalEntries; // idb static __int16 word_9D5CA0[0xff]; // idb static __int16 word_9D6320[0xff]; // idb static int buildingMenu_enabled[30][30]; // idb static __int16 word_9D7360[0xff]; // idb static __int16 word_9D74C0[0xff]; // idb static __int16 word_9D7640[0xff]; // idb static int mouseover_imagebutton_id[202]; // weak static int confirmDialog_x; // idb static int selectedOverlaySubMenu; // idb static int confirmDialog_y; // idb static int confirmDialog_numButtons; // idb static int mouseover_button_id; // weak static int mouseover_button_id_main; // weak static int dword_9D7B34; // weak static int dword_9D7B38; // weak static int buildmenu_Y; // weak static int buildmenu_X; // weak static void (*confirmDialog_okFunc)(void); static int topmenu_fundsPopDateHit; // weak static struct C3MenuItem *openMainMenuSubItems; static struct C3Menu *openMainMenuItem; static int selectedSubMenuItemId; // weak static int selectedMainMenuItemId; // weak static int menuClickedItem; // weak static int dword_9D7B70; // weak static int dword_9D7B74; // idb static int dword_9D7B7C; // weak static int minimap_clicked; // weak static int dword_9D7B88; // weak static int keepSubMenuOpen; // weak static int dword_9D7B90; // weak static int dword_9D7B94; // weak static int dword_9D7B98; // idb static int confirmDialog_windowId; // weak static int selectedOverlaySubMenuNumItems; // weak static int arrowbutton_id; // weak static int confirmDialog_msg; // idb static int dword_9D7BB0[452]; // weak static int dword_9D82C0; // weak static int dword_9D82E0[0xff]; // weak static int dword_9D82E4[0xff]; // weak static int dword_9D82E8[0xff]; // weak static int dword_9D82EC[0xff]; // weak static int dword_9D82F4[0xff]; // weak static int dword_9D82FC[0xff]; // weak static int dword_9D8300[0xff]; // weak static int dword_9D8304[0xff]; // weak static int dword_9D8308[0xff]; // weak static int dword_9D8328; // weak static int dword_9D832C[0xff]; // weak static int dword_9D8330[0xff]; // weak static int dword_9D8334[0xff]; // weak static int dword_9D8338[0xff]; // idb static int music_currentlyPlayingBackground; // weak static int music_nextBackgroundChangeCheck; // weak static int getpixel_result[22]; // weak static char byte_9DA640[0xff]; // weak static char byte_9DA645; // weak static int dword_9DA680[0xff]; // idb static int soundOptions_cityPct_undoCopy; // weak static int *selectList_valueInt; static int dword_9DA7B0; // weak static int laborPriority_maxPriorities; // weak static int filelist_selectedIndex; // weak static signed int numericInput_value; // idb static int selectList_valueType; // weak static int dword_9DA7C4; // weak static int dword_9DA7C8; // weak static int selectList_group; // idb static int numericInput_y; // weak static int soundOptions_speechPct_undoCopy; // weak static int numericInput_x; // weak static int selectedGoodId; // idb static int editPriceChanges_current; // weak static int soundOptions_cityOn_undoCopy; // weak static int editInvasions_current; // weak static int mapsize; // idb static int numericInput_extraParam; // weak static int editDemandChanges_current; // weak static int dword_9DA800; // weak static int dword_9DA804; // idb static int dword_9DA808; // weak static int soundOptions_speechOn_undoCopy; // weak static int dword_9DA810; // weak static int editRequests_current; // weak static int resolutionConfirm_startTime; // weak static int toPlace_invasionPointId; // weak static int numericInput_numDigits; // weak static int request_dispatchGoods_requestId; // idb static int dword_9DA828; // weak static int numericInput_fromWindow; // weak static int setLaborPriorityTmp1[0xff]; // weak static int setLaborPriorityTmp2[0xff]; // weak static int soundOptions_effectsPct_undoCopy; // weak static int scrollbar_file_isLarge; // weak static char *selectList_valueByte; static int numericInput_valueType; // weak static int loadFromBmp_input; // weak static int dword_9DA87C; // idb static int dword_9DA880; // idb static int dword_9DA884; // idb static int soundOptions_effectsOn_undoCopy; // weak static int imagebuttonunknown_flag; // weak static int selectList_fromWindow; // weak static int mode_editor; // weak static BuildingType toPlace_buildingType; // idb static __int16 *numericInput_valueShort; static int speedOptions_game_undoCopy; // weak static int dword_9DA8B4; // weak static int dword_9DA8B8; // weak static int selectList_numItems; // weak static int filelist_numFiles; // weak static int *numericInput_valueInt; static int toPlace_yPos; // idb static int toPlace_xPos; // idb static int populationAdvisor_graphOrder; // weak static int laborPriority_selectedCategory; // weak static int selectList_x; // weak static int selectList_y; // weak static int selectList_extraParameter; // weak static int soundOptions_musicOn_undoCopy; // weak static int editEmpire_resourceSlotId; // weak static int speedOptions_scroll_undoCopy; // weak static int soundOptions_musicPct_undoCopy; // weak static int editEmpire_copyDataValue; // weak static int filelist_scrollPosition; // idb static int dword_9DA904; // weak static int dword_9DA908; // weak static char *numericInput_valueByte; static int dword_9DA910; // weak static __int16 *selectList_valueShort; static int dword_9DA918; // idb static int (*dword_9DC0A0)(void); // weak //------------------------------------------------------------------------- // Function declarations int fun_divideAndRoundUp(signed int value, signed int divisor); // idb void fun_editor_editInvasion_year(); void fun_drawDebugInfoNetwork(void); // weak signed int j_unused_4D4590(const CHAR *a1); void fun_editor_startCond_rank(); void fun_drawFinancialAdvisor(); void fun_debugToggleHouseEvolution(); void fun_editor_main_allowedBuildings(); void fun_sidePanel_rotate(); void fun_generateRandomnessPool(); void fun_drawBuildingGhostAqueduct(); void fun_clearWarnings(); void fun_showBuildingInfoVinesFarm(); int fun_getWordWidth(char *str, int fontId); // idb int fun_walkerProvideBarberAccess(int x, int y); // idb signed int unused_rectangleIsNotWhite(char *buffer, int width, int height, int xMin, int yMin, int xMax, int yMax); // idb unsigned int fun_getFormationIdOfLegion(unsigned int); // weak void fun_walker_mapFlag(); void fun_setMapAreaRangeTerrain(int x, int y, int size, int range, __int16 terrain); // idb void fun_setFavorRatingMax(int max); void fun_drawDialogConfirm(); signed int fun_getButtonTooltipText(); signed int fun_houseHasGoodsAndServicesForLevel(int buildingId, int forUpgrade); // idb void fun_showBuildingInfoTimberYard(); void fun_inputRightPressed(); void fun_dialogDisplayOptions_setResolution(); void fun_dialogDisplayOptions_toggleFullScreen(); void fun_showBuildingInfoTheater(); void fun_messages_select(); void fun_editor_priceChanges_select(); void fun_drawScrollableText(char *text, int x, int y, int width, int a5); void fun_copyFinanceConstructionToLastYear(); void fun_handleConfirmDialogClick(); char fun_pathing_getDirection16(int a1, int a2, int a3, int a4); void fun_drawPopulationAdvisor(); void fun_showBuildingInfoGatehouse(); void fun_dialogResourceSettings_stockpile(); void j_unused_4C9D00(); void fun_refreshVideoBuffer(int forceRedraw); // idb void fun_drawImperialAdvisor(); void fun_drawDebugInfoEvolve(); signed int j_unused_writeBufferToFile_Dialog(const char *a1, LPCVOID lpBuffer, char *filename, char *a4, DWORD nNumberOfBytesToWrite); // idb int fun_countOverlaySubmenuItems(int submenuId); // idb void fun_showBuildingInfoHospital(); void fun_drawGranarySpecialOrdersButton(); void fun_editor_empire_fixOwnCity(); void fun_updateProsperityRating(); void fun_pk_outputFunc(char *Src, int *a2, struct PKToken *a3); void fun_sortRequests(); void fun_drawDebugInfoBox(int a1, int a2, int a3, int a4, int a5, int a6); void fun_editor_winCriteria_ratingValue(); signed int j_unused_4D5AE0(int a3); void fun_updateFinanceInterest(); void fun_tradeAdvisor_prices(); void fun_windowEmpireMap_help(); void fun_drawDialogHoldFestival(); void fun_drawImage_16x16(int *img); void fun_andPixel(int x, int y, __int16 color); signed int fun_determineOpenWaterTiles(int entryX, int entryY); // idb void fun_gameTick22_updatePopulationInHouses(); void fun_drawGraphicUncompressedClipY(char *data); void fun_drawEmpireInfoPanelBackground(); void fun_laborAdvisor_priority(); void fun_cycleThroughLegions(); int j_unused_52C9D0(int a1, int a2, int a3); void fun_setEmpireTradeAmountId(int empireEntryId, __int16 goodId, int amountId); void fun_editor_main_startCond(); void fun_clearBuildingFootprintTile_10px(); signed int isAdjacentToWater(int x, int y, int size); // idb void fun_gametick_requestBirthsDeaths_calculateHousingTypes(); void fun_showSelectListDialog(int x, int y, int numItems, int group, char *valueByte, __int16 *valueShort, int *valueInt, int extraParam, int valueType); void fun_drawBuilding(signed int graphicId, int a2, int a3); void fun_editor_winCriteria_timeLimitYears(); void fun_editor_editInvasion_type(); void fun_editor_empire_fixBuySell(int a1); void fun_setCityViewport_withPanel(); void fun_editor_editInvasion_from(); void fun_collectMonthlyTaxes(); void fun_writeMissionSavedGame(); void fun_drawDialogSendGift(); signed int sub_40129E(int ciid, int resourceId); void fun_editor_main_specialEvents(); void fun_drawEditorEditInvasion(); void fun_menuHelp_cycleMouseHelp(); signed int fun_writeScenarioFile(const char *filename); // idb void fun_editor_editDemandChange_riseFall(); void fun_drawEditEmpireObjectPanel(); void deleteWalker(int walkerId); void showWarningNoWorkers(int buildingType); // idb void fun_drawBuildingOnWaterOverlayPipes(int xOffset, int yOffset); void j_unused_memcpy64(void *src, void *dst, int length); void fun_setFavorRatingExplanation(); void fun_changeGameSpeed(int goSlower); // idb void fun_drawBuildingOnBathhouseOverlay(int a1, int a2, int a3); void fun_loadTerrainFromC3maps(int a1); void fun_drawBuildingGhostDock(); void fun_drawSenateTooltip(); signed int fun_canTravelToDestinationOverRoadGarden(int curX, int curY, int destX, int destY); // idb signed int fun_createPlayerMessage(); void fun_handleGladiatorRevoltEvent(); _DWORD fun_isAdjacentToWall(_DWORD, _DWORD, _DWORD); // weak void fun_putBuildingOnTerrainAndGraphicGrids(__int16 buildingId, int x, int y, int width, int height, __int16 graphicId, __int16 terrain); signed int fun_smackDoFrame(); void fun_setDemandChangesMonths(); void fun_dialogSpeedOptions_cancel(); void fun_advisors_bottomButton_click(); void fun_initRandomGrid(); void fun_initTerrainGridEdge(); void fun_drawExtraBuildingImages(int a1); void fun_ratingsAdvisor_select(); void fun_editor_editDemandChange_unschedule(); void fun_editor_drawDemandChangesDialog(); int fun_getStringWidth(const char *str, int fontId); // idb int fun_getPopulationAtMonth(int maxMonths, int month); // idb void fun_drawWindow(int force); // idb void fun_showBuildingInfoBarracks(); bool fun_canExportGoodToCity(int ciid, int cityId, int resourceId); // idb void fun_editor_requests_select(); int houseCanExpand(int buildingId, int numTiles); // idb void fun_updateAdvisorData(); signed int fun_writeBufferToFile(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite); // idb void fun_clearCityInfoGods(); void fun_setAqueductGraphicIdsToNoWater(); void fun_drawBuildingGhostFountain(); void fun_editor_specialEvents_raiseWages(); void fun_copyFinanceTaxesToLastYear(); signed int fun_addGoodToWarehouse(int ciid, int buildingId, int resourceId); // idb void fun_drawBuildingOnBarberOverlay(int a1, int a2, int a3); int fun_walkerProvideEngineerCoverage(int x, int y); // idb void fun_calculateGodHappiness(int includeBlessingsAndCurses); // idb void fun_moveLegionTo(int x, int y, int legionId); // idb signed int fun_isAdjacentToOpenWater(int x, int y, int size); // idb void fun_dialogSoundOptions_ok(); void fun_drawDialogTradePrices(); void fun_drawMinimapPixelGraphic(signed int a1, int x, int y); // idb int fun_handleArrowButtonClick(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons); // idb int fun_pk_inputFunc(char *buffer, int *length, struct PKToken *token); void ceresWitherCrops(int bigCurse); void fun_drawBuildingOnWorkersOverlay(int a1, int a2, int a3); void fun_clearBuildingFootprintTile_26px(); signed int fun_chdirToCdBasedOnExtension(const char *filename); // idb void fun_drawTradeAdvisor(); void fun_setIsometricViewport(int gridwidth, int gridheight, int xoffset, int yoffset, int numtiles_width, int numtiles_height, signed int tilewidth, signed int tileheight); void fun_editor_specialEvents_clayPitFlooded(); void fun_editor_drawNumericInputDialog(int x, int y); void fun_updateAdvisorFoodAndSupplyRomeWheat(); void fun_drawBuildingOnTheaterOverlay(int a1, int a2, int a3); void fun_editor_drawControlPanelSubmenuButtons(); void fun_showWarningNoChariots(int buildingId); // idb void fun_drawSelectedBuildingGhost(); void fun_editor_winCriteria_survivalTimeToggle(); void fun_handleMouseClickRightClickInfo(); void j_empty_drawMainMenuBackground(); void fun_garbageCollectDestinationPaths(); void fun_drawBuildingOnLibraryOverlay(int a1, int a2, int a3); void j_unused_andRect(int x, int y, int width, int height, __int16 color); void fun_menuHelp_about(); void fun_menuFile_newGame(); void fun_showWarningNoVines(int buildingId); // idb void handleFireCollapseEvent(); void fun_drawBuildingOnCrimeOverlay(int a1, int a2, int a3); int fun_walkerProvideMarketGoods(int buildingId, int x, int y); // idb signed int sound_playChannel(int channel); // idb void fun_changeBackgroundMusic(); void fun_placeBuilding(int a1, int a2, int a3, int a4, int a5, int a6, signed int buildingId); // idb void fun_drawSmallGreyButton(int a1, int x, int y, int width, int widthIsPixels, int mouseOver); void fun_setBookmark(signed int bookmark); void fun_jumpToBookmark(signed int bookmark); // idb void fun_editor_editPriceChange_year(); void fun_showWarningNoWaterAccess(int buildingId, int a2, int a3); // idb void fun_editor_main_invasions(); void fun_handleMouseClick(); void playWalkerSound(int walkerSoundId, int soundId); void j_unused_createEmptyEmpireStatesFile(); signed int fun_exportOneGoodToCity(int buildingId, int resourceId, int cityId); // idb void fun_walkerAdvanceTile(int walkerId); // idb void fun_editor_setSupplyDemand_click(); void fun_prepareEnemyGraphics(); int fun_walkerProvidePrefectCrimeCoverage(int x, int y); // idb int fun_strnpos(const char *haystack, const char *needle, int haystackSize); // idb void fun_drawBuildingOnHippodromeOverlay(int a1, int a2, int a3); void fun_editor_startDate_toggleEra(); signed int fun_shouldScrollMap(); void fun_dialogCckSelection_select(); void removeDestinationPathForWalker(int walkerId); void removeWalkerFromTileList(int walkerId); void j_unused_menuSettings_toggleAutoClear(); int fun_addBirthsToHouses(int ciid, int numBirths); // idb void fun_writeToC3mapsBmp(int missionId); int fun_isCustomButtonClick(int a1, int a2, struct C3CustomButton *buttons, int numButtons); // idb void fun_drawChiefAdvisor(); void fun_drawGameTextCentered(int group, int number, int x, int y, int boxWidth, int fontId, __int16 a7); // idb void fun_drawDot(int x, int y, int color); void fun_showBuildingInfoWeaponsWorkshop(); void fun_walker_creature(); void fun_empireObjectsCorrectOwnerCity(int a1); void fun_emigratePeople(int emigrates); void fun_editor_saveToEmpireEntry(); void fun_drawBuildingWithOverlay(int buildingId, int xOffset, int yOffset, int a4); void fun_clearScreen(); void fun_drawEditEmpireObjectButtons(); signed int fun_getResourceGraphicIdOffset(int resourceId, int type); // idb void fun_drawDialogResourceSettings(); signed int canEmpireCitySellsGood(int empireId, int goodId); // idb int fun_writeToFilenameAppend(const char *filename, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite); // idb void fun_showBuildingInfoTempleMars(); int strToInt(char *str); // idb void fun_showResolutionConfirmDialog(); void fun_adjustSoundVolumeForChannel(int percentage, int channel); // idb void fun_resetClipRegionOptionsDialog(); void j_unused_4D4A20(); void fun_drawTooltip(); void fun_inputReturnPressed(); void fun_editor_empire_clearEmpireEntry(int a1); signed int fun_directDrawCreateSurface(); void fun_editor_specialEvents_emperorChangeYear(); int fun_editor_editEmpire_something2(); int destroyFirstBuildingOfType(int buildingType); // idb void fun_drawEntertainmentAdvisor(); signed int fun_enableDirectDraw(); void fun_setPeaceRatingExplanation(); int fun_handleClickMessages(); void fun_copyFinanceInterestToLastYear(); void fun_fillExpandedEmpireFields(); char j_unused_getIndexOfFileExtension(char *filename); // idb void fun_menuFile_exitGame(); void fun_copyEmpireData(signed int empireMapId); void fun_drawEditorInvasions(); _DWORD fun_devolveHouse3x3ToMediumInsula(_DWORD); // weak void fun_buildingInfo_storage_toggleGood(); signed int fun_tradeCanSellGoodNow(int goodId); // idb void fun_clearCityInfo(); void fun_sendGiftDialog_send(); void fun_drawCitySidepanelBuildingGraphic(int forceRedraw, int xOffset); int fun_getIsometricViewportWidth(); void fun_drawGraphicCompressedColorMaskClipLeft(char *a1, __int16 colorMask); void fun_editor_winCriteria_openPlayScenarioId(); int fun_sidePanel_submenuGetNextIndex(int submenuId, int start); // idb void j_unused_nothing3Times(int times); void fun_formationIncreaseMorale(int formationId, __int16 moraleToAdd); void fun_sortAndCompactPlayerMessages(); void fun_memAndWithShort(__int16 *buffer, signed int length, unsigned __int16 value); int fun_readUncompressedImageData(const char *filename, void *buffer, DWORD nNumberOfBytesToRead, int a4, LONG lDistanceToMove); // idb void fun_copyFinanceSalaryToLastYear(); void fun_showBuildingInfoPotteryWorkshop(); void j_unused_setLineTransparencyOutline(int xOffset, int yOffset, int width); // idb void fun_calculateNumberOfWorkers(); void fun_editor_editDemandChange_ok(); void fun_inputBackspacePressed(); void fun_empireObjectsCorrectTradeStatus(); void fun_decreaseCrimeRisk(char a1); void fun_editor_drawPriceChangesDialog(); int fun_walkerProvideSchoolAccess(int x, int y); // idb signed int fun_buildingHasWalkerOfType(int buildingId, int walkerType1, int walkerType2); // idb void fun_immigratePeopleToHouse(int buildingId, char numPeople); void fun_windowEmpireMap_city_openTrade(); void fun_pauseApp(); void showWarning(int warningId); void decayService_culture(); int fun_strNumDigitChars(char *str); // idb void fun_editor_startCond_startFunds(); void fun_strRemoveDoubleSpaces(char *str); void fun_addPeopleToCityAndCensus(int ciid, int numPeople); // idb signed int isSeaTradeRoute(int tradeRouteId); // idb int fun_adjustWithPercentage(int value, int percentage); // idb void fun_buildingInfo_granary_specialOrders(); void fun_drawBuildingOnProblemsOverlay(int a1, int a2, int a3); void fun_editor_editPriceChange_good(); void fun_drawGraphicUncompressedColorMaskFull(char *data, __int16 colorMask); void fun_clearWalkers(); void fun_dialogResourceSettings_ok(); signed int fun_getEmpireTradeAmountId(int empireEntryId, __int16 goodId); // idb void fun_showBuildingInfoStatue(); int marketDetermineDestinationGranaryWarehouse(int marketBuildingId); // idb void fun_drawBuildingFootprint_xFull_colored(int *data, int clipYcode); void fun_drawWalkerRightClickInfoText(int walkerId); void fun_setPopulationGraphYAxisMax(signed int a1); void fun_clearBookmarks(); int fun_readDataFromFilename(const char *filename, void *buffer, DWORD nNumberOfBytesToRead, LONG lDistanceToMove); void fun_calculateBuildingDesirability(); void fun_editor_specialEvents_earthquakeYear(); void unused_fillGreenGraphicRectWithBorder(int x, int y, int widthBlocks, int heightBlocks); signed int j_unused_420960(); void fun_entertainmentAdvisor_festival(); void fun_updateAvailableGoodsAndFoods(); void fun_drawBuildingOnEducationOverlay(int a1, int a2, int a3); void fun_showBuildingInfoTower(); void fun_resetBackgroundMusic(); void fun_drawCckFileList(); void fun_redrawScreen_doNothing(); int fun_handleCustomButtonClick(int xOffset, int yOffset, struct C3CustomButton *buttons, int numButtons); signed int fun_wndprocRefresh(); void fun_strMoveRight(char *start, char *end); void fun_showWarningMoreFoodNeeded(int buildingId); // idb void fun_editor_empire_determineMaxEntryInUse(); void fun_drawBuildingOnAmphitheaterOverlay(int a1, int a2, int a3); void fun_editor_winCriteria_populationToggle(); void fun_showBuildingInfoMilitaryAcademy(); void fun_showAdvisor(int advisor); // idb void fun_sortDemandChanges(); void fun_dialogRightClickInfo_help(); void fun_editor_drawEmpireUnsavedDataWarning(); void fun_drawWindowButtons(); void fun_drawGameYearWithBcAd(int resolution, int value, int x, int y, int fontId, __int16 color); // idb void fun_buildConstructWall(int a1, int a2, int a3, int a4, int a5); void fun_drawBuildingGhostHippodrome(); void fun_calculateGiftCosts(); void fun_drawImperialAdvisorButtons(); void fun_drawDialogSetSalary(); void fun_drawEmpireInfoPanelRomanArmy(); void fun_showWarehouseInstructionsDialog(); void fun_showGameFinishedScreen(); void fun_sound_init(); void fun_drawSoundOptionsDialog(); void fun_drawTopMenu(signed int a1); int fun_getCharWidth(unsigned __int8 c, int fontId); // idb int fun_getCityScreenWidth(); signed int fun_walkerProvideServiceCoverage(int walkerId); // idb int fun_getNumPeopleOfWorkingAge(); int fun_handleImageButtonClick(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons); // idb void fun_showOverlay(int a1); bool fun_pixelWithinClipBounds(int xOffset, int yOffset); // idb void fun_drawEmpireInfoPanelForeground(); void fun_rotateMapClockwise(); int fun_walkerProvideColosseumAccess(int x, int y, int numShows); // idb void fun_updateFinanceTaxes(); void fun_reallocateWorkersPerCategory(); void showWarningNoActors(int buildingId); // idb void fun_drawLoadingText(char *lpString); void fun_dialogVictory_accept(); void fun_editor_winCriteria_populationValue(); int fun_drawEnemyGraphic(signed int enemyGraphicId, int x, int y); // idb void fun_tradeAdvisor_resource(); void fun_setDistantBattleCityAsForeign(); void fun_editor_startCond_startDate(); signed int fun_writeCompressedChunk(int fd, void *buffer, DWORD nNumberOfBytesToWrite); int fun_dockIsConnectedToOpenWater(int x, int y); // idb void fun_editor_winCriteria_ratingToggle(); void fun_drawRatingsAdvisorButtons(); void fun_drawImage_32x32(int *img); void fun_imperialAdvisor_salary(); void fun_measureComputerSpeed(); void fun_showNumericInputDialog(int x, int y, int valueType, char *valueByte, __int16 *valueShort, int *valueInt, int a7); void fun_editor_startDate_year(); void fun_writeTraceMessage(); int fun_strFirstDifferenceIndex(const char *s1, const char *s2, int len); // idb void fun_drawGraphicUncompressedClipRight(char *data); void fun_drawEducationAdvisor(); int j_unused_copyGameTextString(char *dst, int group, int number, signed int maxlen); // idb void fun_decreaseMonthsLeftToGovernAfterWin(); void fun_grabBuildingFootprintTileFromBuffer_10px(); int j_unused_412AB0(int a1, void *a2); void fun_message_help(); void fun_generateWalkerName(int walkerId); void fun_drawEmpireInfoPanel(); void fun_drawDemoExitScreen1(); void fun_drawDemoExitScreen2(); void fun_increaseMoraleOfAllForts(__int16 a1); signed int fun_getTradeCityFromEmpireObject(int empireObjectId); // idb void fun_drawCitySidepanelButtons(); void fun_drawWinGameScreen(); void fun_drawBuildingOnSchoolOverlay(int a1, int a2, int a3); void fun_updateWageCostsAndEstimate(); void fun_editor_winCriteria_survivalTimeYears(); void fun_drawLine_something(int a1); void fun_drawOverlay(); void fun_showBuildingInfoWharf(); signed int fun_isTradeRouteOpen(int tradeRouteId); // idb signed int fun_minimapGetWalkerColor(int walkerId); // idb void fun_editor_allowedBuildings_toggle(); void fun_editor_editDemandChange_good(); void fun_calculateHealthRate(); void fun_resumeApp(); void fun_dialogResourceSettings_help(); int fun_adjustWithPromille(int value, int promille); // idb signed int canEmpireCityBuysGood(int empireId, int goodId); // idb void fun_drawBuildingFootprint_26px_xFull(); void fun_menuOptions_speed(); int fun_walkerProvideLibraryAccess(int x, int y); // idb void fun_drawCitySidepanelBorder_800(); int fun_walkerProvideAmphitheaterAccess(int x, int y, int numShows); // idb DWORD fun_getBmpDataOffset(struct WindowsBitmap *src); _DWORD fun_generateTowerSentryFromBarracks(_DWORD); // weak void fun_doGameTick_0_noop(); void fun_unused_writeToC4mapsBmp(); void fun_strTrimSpacesLeft(char *a1); void fun_clearGroundTypeGrid(); void fun_drawMessageListButtons(); _DWORD fun_playInterfaceButtonSound(_DWORD); // weak void fun_closeSubMenu(); void unused_fillGreenGraphicRect(int x, int y, int widthBlocks, int heightBlocks); void fun_removeGoodsFromWarehouseForMercury(int buildingId, signed int amount); void fun_drawMinimap(int a1, int a2, signed int a3, int a4); void fun_dialogResourceSettings_trade(); void fun_sortInvasions(); void fun_drawGameText(int group, int number, int x, int y, int fontId, __int16 color); // idb void fun_menuFile_replayMap(); int fun_getIsometricViewportHeight2(); void fun_setRequestsMonths(); void fun_editor_editDemandChange_year(); void showWarningNoMarkets(int buildingType); // idb signed int fun_importOneGoodFromCity(int buildingId, int resourceId, int cityId); // idb void fun_drawLogoScreen(); void fun_dialogMessages_help(); _DWORD fun_addPeopleToCensus(_DWORD, _DWORD); // weak void fun_updateHighestInUseBuildingId(); void fun_copyFinanceWagesToLastYear(); _DWORD fun_sound_43FA80(_DWORD, _DWORD); // weak void fun_prepareClimateGraphics(); void fun_initMapEdges(); void fun_editor_specialEvents_gladiatorRevoltToggle(); void fun_determineHousingServicesForEvolve(); void fun_showBuildingInfoOilWorkshop(); void fun_imperialAdvisor_donate(); void fun_editor_main_enemy(); void fun_drawScrollbarDot(); void fun_drawEditorRequests(); void fun_strTrimSpacesRight(char *a1); void fun_drawGraphicUncompressedColorMaskClipLeft(char *data, __int16 colorMask); void fun_editor_drawEditDemandChangeDialog(); int fun_walkerProvideLaborSeekerAccess(int x, int y); // idb void fun_drawBuildingOnDamageOverlay(int a1, int a2, int a3); void fun_dialogDifficultyOptions_difficultyUpDown(); void fun_handleExpandEmpireEvent(); void fun_killEnemiesSpiritOfMars(); void fun_showVictoryScreen(void); // weak int fun_getDistanceMinimum(int x1, int y1, int x2, int y2); // idb void fun_editor_winCriteria_timeLimitToggle(); void fun_editor_editEmpire_moveEmpireCity(int direction, __int16 amount); void fun_drawSpeedOptionsDialog(); signed int fun_walkerProvideMissionaryAccess(int x, int y); // idb void fun_drawColoredRectangle(int x, int y, int a3); // idb void fun_showWarningNoWeapons(int buildingId); _DWORD fun_sound_440330(_DWORD, _DWORD); // weak void fun_confirmdialog_openTrade(); void fun_drawRatingAdvisorColumn(int x, int y, signed int value, int hasReached); void fun_drawBuildingFootprint_xClipLeft_colored(int *data, int clipYcode); // idb void fun_populationBirths(); void fun_drawHelpDialogButtons(); void fun_dialogHoldFestival_holdFestival(); void fun_convertGraphicToSurfaceFormat(__int16 *a1, int a2); // idb void fun_editor_editPriceChange_riseFall(); void fun_handleHelpDialogClick(); void fun_generateTraders(); void fun_resetTradeAmounts(); void fun_showBuildingInfoWineWorkshop(); signed int fun_createFortFormation(int buildingId); // idb void fun_showWarningNoGladiators(int buildingId); // idb signed int fun_initDirectDraw(); void fun_calculateMaxProsperity(); void fun_countBuildingTypes(); void fun_sendGiftDialog_gift(); void fun_editor_specialEvents_seaTradeProblem(); int fun_strlen(const char *str); signed int fun_getTradeRouteCityIndex(int tradeRouteId); // idb void unused_nothing3(); void fun_editor_drawSelectListDialog(int xOffset, int yOffset); void fun_showBuildingInfoBathhouse(); void fun_showBuildingInfoSchool(); void fun_drawBuildingFootprint_26px_xClipLeft(); void fun_drawDebugInfoBuildings(); void fun_drawDebugInfoFigures(); signed int fun_flipBitmap(struct WindowsBitmap *bmp); // idb signed int fun_getElapsedGameTicks(); void fun_drawDialogDonateToCity(); void fun_drawOpenSubMenu(void); // weak void fun_showRightClickInfo(); void fun_evolveHouseTo(int a1, BuildingType type); // idb void fun_setCityScreenWidths(); void fun_drawPopulationAdvisorButtons(); void fun_showBuildingInfoPrefecture(); void fun_drawReligionAdvisor(); void fun_minimap_handleClick(); void fun_drawStartNewCareerBackground(); void walkerAdvanceTick(int walkerId); void fun_drawImage_24x24(int *a1); void fun_drawConfirmResolutionDialogButtons(); SIZE_T fun_getAvailablePhysicalMem(); void fun_showBuildingInfoVegetableFarm(); void fun_drawMinimapPixel(int a1); void fun_showBuildingInfoShipyard(); signed int fun_getButtonTooltipText_TradePrices(); void fun_inputLeftPressed(); void fun_editorPanel_buttonClick(); signed int fun_startInvasion(int enemyType, int numEnemies, int invasionPoint, __int16 attack, char invasionId); // idb void fun_showBuildingInfoNativeMeeting(); void fun_drawWarnings(void); // weak void fun_editor_editPriceChange_ok(); void fun_editor_editRequest_ok(); signed int fun_sound_playTestSound(const char *filename, int channel); // idb void fun_drawPopulationCensusGraph(int isBig, int x, int y); // idb void fun_calculateTribute(); void fun_windowMainMenu_button(); void fun_calculateCultureDemandLevel(); int fun_drawEmpireInfoPanelBattleIcon(); void fun_drawMainMenu(int overwrite); // idb void fun_showBuildingInfoNativeCrops(); void unused_nothing2(); void fun_redrawScreen(); void fun_editor_editRequest_deadline(); int fun_readFileIntoBuffer(const CHAR *filename, void *buffer); void fun_orPixel(int x, int y, __int16 value); void fun_showBuildingInfoColosseum(); void fun_immigratePeople(signed int numPeople); void fun_calculateCultureCoverage(); void fun_drawSunkenTextBoxBottomBorder(int a1, int a2, int a3); void fun_setupFromSavedGame(); void fun_payMonthlySalary(); void fun_editor_editRequest_good(); void fun_houseConsumeGoods(int buildingId); signed int fun_loadEnemyGraphics(int enemyId); // idb void fun_drawCitySidepanelNumMessages(signed int forceRedraw); // idb void fun_dialogFileScenario_okCancel(); void fun_showBuildingInfoPigFarm(); void fun_menuResets_saveToBmp(); void fun_resolutionConfirm_ok(); int j_unused_4129D0(int a1, int a2, int a3); int fun_createBuilding(int a1, BuildingType type, int x, int y); // idb void fun_loadScenario(const char *filename); signed int fun_createStorage(); void fun_showBuildingInfoFruitFarm(); void fun_dialogFileSavedGame_okCancel(); void fun_confirmdialog_doNothing(); void fun_showBuildingInfoClayPit(); void fun_drawBuildingGhostReservoirSimon(); void fun_drawGraphicUncompressedFull(char *data); // idb void fun_drawEditorEditRequest(); void fun_drawConfirmResolutionDialog(); void fun_generateRandomness(); void fun_drawDialogConfirmButtons(); void fun_editor_editEmpire_expansionYear(); void fun_getMouseCursorStatus(); void fun_showBuildingInfoFurnitureWorkshop(); void fun_showBuildingInfoForum(); void fun_clearMissionSettings(); void fun_dialogDifficultyOptions_godsToggle(); int fun_handleMenubarClick(struct C3Menu *menu, int numItems); // idb void fun_drawGraphicType2(char *data); int fun_getWalkerFormationIdAtOffset(int gridOffset); // idb void fun_showTerrainInfo(); void fun_drawDialogSendGiftButtons(); void fun_initGraphicIdGrid(); void fun_drawCityScreen_PausedAndTime(); void fun_drawDialogFileScenario(); void fun_fillRect(int x, int y, int width, int height, int color); LRESULT __stdcall fun_wndproc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void fun_sound_440B40(int a1, int a2); void fun_showBuildingInfoSenate(); void fun_scrollMap(int scrollDirection); void fun_drawInsetRect(int x, int y, int width, int height); // idb void fun_initializeTradeRoutes(); void fun_confirmdialog_requestDispatchGoods(); int unused_4D5960(void); // weak void fun_windowAdvisors_help(); void fun_editor_invasions_select(); void fun_readEmpireFile(int isCustomScenario); void fun_showHelpDialog(int helpId, int a2); signed int unused_4D3E10(const char *a1, int a2, signed int a3); // idb signed int fun_fileExistsHome(const char *filename); // idb signed int fun_loadScenarioFile(const char *filename); // idb void fun_drawHelpDialogNoVideo(); void sub_472C90(int a1, int a2, int x, int y, int buildingType); int sub_402FD6(); void fun_smackStopVideo(); char j_unused_findResaudVersionNumberInFile(const CHAR *filename, char *buffer); // idb void fun_dialogDisplayOptions_cancel(); void fun_drawEmpireInfoPanelCity(); void fun_drawEmpireInfoPanelEnemyArmy(); void fun_drawEntertainmentAdvisorHoldFestivalButton(); void fun_devolveHouse2x2ToMediumInsula(int buildingId); void fun_generateProtester(int buildingId); void fun_coUninitializeOnNormalExit(); void fun_showWarningNoTimber(int buildingId); // idb void unused_setIsometricPixel_safe(int x, int y, int color); void fun_soundStopChannel(int channel); // idb void fun_drawGreyButton(int a1, int x, int y, int width, int mouseOver); int fun_getIsometricViewportWidth2(); int fun_isTerrainFree(int size, int x, int y, unsigned __int16 mask); // idb void fun_editor_specialEvents_ironMineCollapse(); void fun_drawBuildingOnWaterOverlay(int a2, int a3); signed int fun_loadSavedGame(const char *filename); // idb void fun_editor_editRequest_year(); void fun_editor_main_winCriteria(); signed int fun_playVideo(char *filename, int x, int y, int fullscreen); // idb void fun_determineWalkerSoundPhrase(int walkerId); // idb void fun_calculateTributeThisYear(); void fun_setMaxSoldiersPerFort(); void fun_drawSelectionAnts(int xOffset, int yOffset, int width, int height); void fun_drawGraphicCompressedClipLeft(char *data); void fun_refundGoods(int ciid, int resourceId, int amount); void fun_editor_startCond_flotsam(); int j_unused_traceEnabled(); void fun_determineGroundType(); void fun_greyRectangle(int xOffset, int yOffset, int width, int height, char blackness); void fun_showWarningNoBarracks(int buildingId); // idb signed int fun_directSound_init(); void fun_debug_toggleHousingEvolveInfo(); void fun_drawLine_setHelperVars(int x1, int y1, int x2, int y2); void fun_destroyBuildingByEnemyAt(int x, int y, int mapOffset); // idb signed int fun_loadClimateGraphics(int climate); // idb void fun_dialogMessages_close(); void fun_setCultureRatingExplanation(); void fun_setCrimeRiskForAllHouses(signed int targetCrimeRisk); int fun_getIsometricViewportHeight(); void fun_advisorPrepareSomeButton(); void fun_drawCityScreenForeground(); signed int fun_directDrawRestoreSurfaces(); void fun_drawMilitaryAdvisorButtons(); void fun_topmenu_rightClick(); void fun_showWarningNoLions(int buildingId); // idb void fun_showBuildingInfoDoctor(); void fun_drawGraphicLetterColoredClipLeft(char *data); signed int fun_dialogCckSelection_scrollbarClick(); signed int cityCanProduceGoodNow(signed int goodId); // idb void fun_showFortInfo(int fortId); void fun_showBuildingInfoGovernorsHome(); void fun_showBuildingInfoOracle(); void fun_editor_specialEvents_contaminatedWater(); void fun_resetPopulationMax(); void fun_walkerGetNextTileDirection(int walkerId); // idb signed int fun_fileExistsOnCdWithMinimumLength(const char *filename, int length); // idb void fun_menuFile_newMap(); void fun_showBuildingInfoMarket(); void fun_editor_winCriteria_openPlayToggle(); void sub_4032DD(); void fun_handleRandomEvents(); void fun_editor_drawEditPriceChangeDialog(); signed int fun_tradeCanBuyGoodNow(int goodId); // idb void fun_evolveDevolveHouses(); void fun_updateRatings(int yearlyUpdate); // idb signed int fun_drawBuildingFootprintSize3(); void fun_drawLoadingScreen(int number); // idb void fun_showBuildingInfoGladiatorSchool(); void fun_changeFileExtension(char *filename); void fun_editor_drawSupplyDemandDialog(); void fun_initWalkerNameSequences(); signed int fun_startLocalUprisingFromMars(); unsigned __int8 fun_tolower(unsigned __int8 c); // idb void fun_drawImageButtonCollection(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons); // idb void fun_showBuildingInfoChariotMaker(); void fun_setDistantBattleCityAsVulnerable(); int fun_walkerProvideHippodromeAccess(int x, int y); // idb void j_unused_52CFC0(); void deleteBuildingEvent(int buildingId); void fun_toggleEmpireMap(); void fun_findFiles_sort(); int j_unused_4D12E0(int a1); void fun_determineDistantBattleCity(); void fun_menuHelp_help(); void fun_editor_drawMainDialog(); void fun_enemyHitBuilding(int mapIndex, signed int a2); // idb void fun_removePeopleFromCensusInDecennium(int ciid, int a2, int peopleRemoved); // idb int fun_calculateNumForts(void); // weak void fun_overlaySubMenu_click(); void fun_editor_demandChanges_select(); void fun_showBuildingInfoNativeHut(); signed int fun_editor_editEmpire_something3(); void fun_updatePopulationAfterBirthsDeaths(int ciid); void fun_drawEditEmpireObjectPanel_Add(); void fun_drawBuildingOnReligionOverlay(int a1, int a2, int a3); void fun_sendGiftToCaesar(); void fun_editor_editEmpire_nextPrevEmpireArrowButtons(); signed int fun_terrainIsClear(int x, int y, int width, int height, unsigned __int16 terrainMask, int a6); // idb void fun_drawCitySidepanelMinimap(int forceRedraw); // idb signed int j_unused_4A5050(int a1, int a2); void fun_topmenu_isFundsPopDateHit(); signed int determineAccessRoad(int x, int y, int size); // idb void fun_removePeopleFromCensus(int ciid, int numPeople); void fun_editor_editRequest_favor(); void fun_revertHouseToVacantLot(int buildingId); void j_unused_drawNumberCenteredColored(signed int value, int showZero, char a3, const char *postfix, int x, int y, int boxWidth, int fontId, __int16 positiveColor, __int16 negativeColor); // idb void fun_setDistantBattleCity(); void fun_showBuildingInfoBarber(); void fun_increaseFavorRating(int amount); void fun_clickDoNothing(); void fun_confirmdialog_doNothing(); void fun_confirmdialog_deleteFort(); void fun_confirmdialog_deleteBridge(); void fun_confirmdialog_openTrade(); void fun_confirmdialog_requestDispatchTroops(); void fun_confirmdialog_requestDispatchGoods(); void fun_menuFile_newGame(); void fun_menuFile_replayMap(); void fun_menuFile_loadGame(); void fun_menuFile_saveGame(); void fun_menuFile_deleteGame(); void fun_dialogFileSavedGame_okCancel(); void fun_dialogFile_scrollUpDown(); signed int fun_dialogFile_handleScrollbarClick(); void fun_dialogFileSavedGame_select(); void fun_menuFile_exitGame(); void fun_menuOptions_display(); void fun_dialogDisplayOptions_toggleFullScreen(); void fun_dialogDisplayOptions_setResolution(); void fun_showResolutionConfirmDialog(); void fun_changeBackToLastResolution(); void fun_resolutionConfirm_ok(); void fun_menuOptions_difficulty(); void fun_dialogDifficultyOptions_difficultyUpDown(); void fun_dialogDifficultyOptions_godsToggle(); void fun_dialogDisplayOptions_cancel(); void fun_menuOptions_sound(); void fun_dialogSoundOptions_ok(); void fun_dialogSoundOptions_cancel(); void fun_dialogSoundOptions_toggle(); void fun_dialogSoundOptions_musicUpDown(); void fun_dialogSoundOptions_speechUpDown(); void fun_dialogSoundOptions_effectsUpDown(); void fun_dialogSoundOptions_cityUpDown(); void fun_menuOptions_speed(); void fun_dialogSpeedOptions_ok(); void fun_dialogSpeedOptions_cancel(); void fun_dialogSpeedOptions_gameUpDown(); void fun_dialogSpeedOptions_scrollUpDown(); void fun_menuHelp_help(); void fun_menuHelp_about(); void fun_menuHelp_cycleMouseHelp(); void fun_menuHelp_toggleWarnings(); void unused_menuSettings_toggleAutoClear(); void unused_4070A0(); void unused_4070E0(); void unused_407100(); void fun_dialogCckSelection_scrollUpDown(); signed int fun_dialogCckSelection_scrollbarClick(); void fun_dialogCckSelection_select(); void fun_numericInput_number(); void fun_numericInput_ok(); void fun_numericInput_cancel(); void fun_showNumericInputDialog(int x, int y, int valueType, char *valueByte, __int16 *valueShort, int *valueInt, int a7); void fun_selectList_select(); void fun_showSelectListDialog(int x, int y, int numItems, int group, char *valueByte, __int16 *valueShort, int *valueInt, int extraParam, int a9); void fun_sidePanel_build(); int fun_sidePanel_submenuClick(); int fun_sidePanel_submenuGetNextIndex(int submenuId, int start); // idb int fun_countBuildingSubMenuItems(); void fun_enableAllBuildingMenuItems(); void fun_enableBuildingMenuItems(); int fun_countOverlaySubmenuItems(int submenuId); // idb void fun_enableSidebarButtons(); void fun_editorPanel_buttonClick(); signed int sub_40A700(); void sub_40A7B0(); void sub_40A930(); void sub_40AB00(); void sub_40AC20(); void fun_sidePanel_undo(); void fun_sidePanel_messages(); void fun_sidePanel_gotoProblem(); void fun_menuResets_clearHerds(); void fun_menuResets_clearFish(); void fun_menuResets_clearInvasions(); void fun_minimap_hasBeenClicked(); void fun_minimap_handleClick(); void fun_topmenu_isFundsPopDateHit(); void fun_debug_toggleHousingEvolveInfo(); void fun_buildingInfo_granary_specialOrders(); void fun_buildingInfo_storage_toggleGood(); void fun_buildingInfo_warehouse_specialOrders(); void fun_buildingInfo_granaryOrders_click(); void fun_buildingInfo_warehouseOrders_click(); void fun_walkerInfo_selectWalker(); void fun_fortInfo_formation(); void fun_fortInfo_returnToFort(); void fun_dialogRightClickInfo_help(); void fun_dialogRightClickInfo_ok(); void fun_dialogResourceSettings_help(); void fun_dialogResourceSettings_ok(); void fun_windowAdvisors_help(); void fun_topmenu_rightClick(); void fun_sidePanel_help(); void fun_debugToggleHouseEvolution(); void fun_debugToggleRoadEvolution(); void fun_debugToggleShowPeople(); void fun_editor_editEmpire_general_click(); void fun_editor_editEmpire_copyData(); void fun_editor_editEmpire_expansionYear(); void fun_editor_editEmpire_toggleExpanded(); void fun_editor_editEmpire_graphicArrowButtons(); void fun_editor_editEmpire_nextPrevEmpireArrowButtons(); void fun_editor_editEmpire_something(int a1, int a2); int fun_editor_editEmpire_something2(); signed int fun_editor_editEmpire_something3(); void fun_editor_editEmpire_moveEmpireCity(int direction, __int16 amount); void fun_editor_editEmpire_addObjectType(); void fun_editor_demandChanges_select(); void fun_editor_priceChanges_select(); void fun_editor_editDemandChange_year(); void fun_editor_editDemandChange_good(); void fun_editor_editDemandChange_route(); void fun_editor_editDemandChange_riseFall(); void fun_editor_editDemandChange_unschedule(); void fun_editor_editDemandChange_ok(); void fun_editor_editPriceChange_year(); void fun_editor_editPriceChange_good(); void fun_editor_editPriceChange_riseFall(); void fun_editor_editPriceChange_amount(); void fun_editor_editPriceChange_unschedule(); void fun_editor_editPriceChange_ok(); void fun_editor_setSupplyDemand_click(); void fun_editor_editEmpire_editRoute_tradeRouteId(); void fun_editor_editEmpire_editCity_type(); void fun_editor_editEmpire_editCity_name(); void fun_editor_editEmpire_editCity_tradeRouteId(); void fun_editor_editEmpire_editCity_demand(); void fun_editor_editEmpire_editCity_costToOpen(); void fun_editor_editEmpire_editOwnCity_produces(); void fun_editor_editEmpire_editCity_sells(); void fun_editor_editEmpire_editCity_buys(); void fun_editor_editEmpire_editBattle_path(); void fun_editor_editEmpire_editBattle_order(); void fun_editor_startCond_startFunds(); void fun_editor_startCond_rescueLoan(); void fun_editor_main_enemy(); void fun_editor_main_terrain(); void fun_editor_startCond_flotsam(); void fun_editor_startCond_romeSuppliesWheat(); void fun_editor_main_allowedBuildings(); void fun_editor_allowedBuildings_toggle(); void fun_editor_main_winCriteria(); void fun_editor_winCriteria_openPlayToggle(); void fun_editor_winCriteria_openPlayScenarioId(); void fun_editor_winCriteria_ratingToggle(); void fun_editor_winCriteria_ratingValue(); void fun_editor_winCriteria_timeLimitToggle(); void fun_editor_winCriteria_timeLimitYears(); void fun_editor_winCriteria_survivalTimeToggle(); void fun_editor_winCriteria_survivalTimeYears(); void fun_editor_winCriteria_populationToggle(); void fun_editor_winCriteria_populationValue(); void fun_editor_main_specialEvents(); void fun_editor_startCond_rank(); void fun_editor_main_startCond(); void fun_editor_main_demandChanges(); void fun_editor_main_priceChanges(); void fun_editor_specialEvents_gladiatorRevoltToggle(); void fun_editor_specialEvents_gladiatorRevoltYear(); void fun_editor_specialEvents_emperorChangeToggle(); void fun_editor_specialEvents_emperorChangeYear(); void fun_editor_specialEvents_seaTradeProblem(); void fun_editor_specialEvents_landTradeProblem(); void fun_editor_specialEvents_raiseWages(); void fun_editor_specialEvents_lowerWages(); void fun_editor_specialEvents_contaminatedWater(); void fun_editor_specialEvents_ironMineCollapse(); void fun_editor_specialEvents_clayPitFlooded(); void fun_editor_specialEvents_earthquakeSeverity(); void fun_editor_specialEvents_earthquakeYear(); void fun_editor_startCond_milestone(); void fun_editor_startCond_startDate(); void fun_editor_startDate_year(); void fun_editor_startDate_toggleEra(); void fun_editor_startDate_cancel(); void fun_windowEditorSettings_imageUpDown(); void fun_editor_main_requests(); void fun_editor_requests_select(); void fun_editor_editRequest_year(); void fun_editor_editRequest_amount(); void fun_editor_editRequest_good(); void fun_editor_editRequest_deadline(); void fun_editor_editRequest_favor(); void fun_editor_editRequest_unschedule(); void fun_editor_editRequest_ok(); void fun_editor_main_invasions(); void fun_editor_invasions_select(); void fun_editor_editInvasion_year(); void fun_editor_editInvasion_amount(); void fun_editor_editInvasion_type(); void fun_editor_editInvasion_from(); void fun_editor_editInvasion_attack(); void fun_editor_editInvasion_unschedule(); void fun_editor_editInvasion_ok(); void fun_windowEditEmpire_empireUpDown(); void fun_windowEmpireMap_city_openTrade(); void fun_windowEmpireMap_help(); void fun_windowEmpireMap_exit(); void fun_dialogTradeOpened_ok(); void fun_menuFile_newMap(); void fun_menuFile_loadMap(); void fun_menuFile_saveMap(); void fun_dialogFileScenario_okCancel(); void fun_menuResets_loadFromBmp(); void fun_menuResets_saveToBmp(); void fun_imageButtonUnknown_doNothingRedraw(); void fun_imageButtonUnknown_setFlag(); int sub_40F120(); void fun_sidePanel_overlay(); void fun_overlayMainMenu_click(); void fun_overlaySubMenu_click(); int sub_40F330(); void sub_40F3F0(); void unused_40F450(); void fun_unused_writeToC4mapsBmp(); void fun_sidePanel_rotate(); void fun_sidePanel_north(); void fun_showEmpireMap(); void fun_editor_saveToEmpireEntry(); void fun_gotoAdvisorFromButton(); void fun_updateAdvisorData(); void fun_laborAdvisor_wagesUpDown(); void fun_financeAdvisor_taxesUpDown(); void fun_tradeAdvisor_resource(); void fun_tradeAdvisor_prices(); void fun_tradeAdvisor_empire(); void fun_dialogResourceSettings_industryToggle(); void fun_dialogResourceSettings_trade(); void fun_dialogResourceSettings_exportUpDown(); void fun_dialogResourceSettings_stockpile(); void fun_militaryAdvisor_gotoLegion(); void fun_militaryAdvisor_returnToFort(); void fun_militaryAdvisor_empireService(); void fun_laborAdvisor_priority(); void fun_setLaborPriorityDialog_priority(); void fun_populationAdvisor_graph(); void fun_entertainmentAdvisor_festival(); void fun_dialogHoldFestival_help(); void fun_dialogHoldFestival_close(); void fun_dialogHoldFestival_holdFestival(); void fun_dialogHoldFestival_selectGod(); void fun_dialogHoldFestival_selectSize(); void fun_ratingsAdvisor_select(); void fun_imperialAdvisor_donate(); void fun_imperialAdvisor_salary(); void fun_imperialAdvisor_gift(); void fun_imperialAdvisor_request(); void fun_setSalaryDialog_cancel(); void fun_setSalaryDialog_salary(); void fun_donateToCityDialog_cancel(); void fun_donateToCityDialog_ok(); void fun_donateToCityDialog_amount(); void fun_donateToCityDialog_amountUpDown(); void fun_sendGiftDialog_gift(); void fun_sendGiftDialog_send(); void fun_sendGiftDialog_cancel(); void fun_windowMainMenu_button(); void sub_4117C0(); void unused_411890(); void unused_4118B0(); void fun_newCampaignOrCck_start(); void sub_4119E0(); void fun_selectMission_type(); int sub_411BA0(); void fun_advisors_bottomButton_click(); void fun_sidePanel_advisors(); void fun_toggleEmpireMap(); void fun_editor_editEmpire_general_save(); void fun_sidePanel_missionBriefing(); signed int sub_4120D0(); void sub_412180(); void sub_4122A0(); void sub_412320(); int fun_getBuildingAnimationIndex(int a1, int a2); int unused_4129D0(int a1, int a2, int a3); int unused_412AB0(int a1, void *a2); void unused_memxordst(char *input1, char *input2, char *dst, int length); void unused_memxor(char *dst, char *src, int length); void fun_memcpy8(int *a1, int *a2, signed int length); void unused_memcpy64(void *src, void *dst, int length); int fun_memset(void *buffer, signed int length, int fillChar); // idb void fun_memAndWithByte(char *buffer, signed int length, unsigned __int8 andByte); void fun_memAndWithShort(__int16 *buffer, signed int length, unsigned __int16 value); void unused_412F90(int a1, int a2, int a3); void sub_412FF0(const void *buffer, int a2, int a3); void sub_413060(void *buffer, int a2, int a3); void fun_setPixel(int x, int y, __int16 color); void unused_setIsometricPixel(int x, int y, __int16 color); void fun_andPixel(int x, int y, __int16 color); int fun_getPixelMasked(int x, int y, int mask); void fun_orPixel(int x, int y, __int16 value); void unused_413240(int xOffset, int yOffset, __int16 color); __int64 unused_4132A0(int a1, int a2); void unused_4132E0(int x, int y, __int16 a3); void fun_drawSelectionAntsPixel(int xOffset, int yOffset); void fun_setPixelTransparencyOutline(int x, int y); void unused_413440(); void unused_413460(); void unused_413480(); void fun_drawColoredRectangle(int x, int y, int color); void unused_413540(int a1); int unused_4135F0(int a1); int unused_413670(int a1); void fun_drawGraphicUncompressedFull(char *data); void fun_drawMinimapPixel(int pixelData); void fun_drawTwoPixels(int colors); void fun_drawGraphicUncompressedClipY(char *data); void fun_drawGraphicUncompressedClipLeft(char *data); void fun_drawGraphicUncompressedClipRight(char *data); void fun_drawGraphicUncompressedColorMaskFull(char *data, __int16 colorMask); void fun_drawGraphicUncompressedColorMaskClipLeft(char *data, __int16 colorMask); void fun_drawGraphicUncompressedColorMaskClipRight(char *data, __int16 colorMask); void fun_drawGraphicCompressedFull(char *data); void fun_drawGraphicCompressedClipLeft(char *data); int fun_drawGraphicCompressedClipRight(char *data); // idb void fun_drawGraphicCompressedColorMaskFull(char *data, __int16 colorMask); void fun_drawGraphicCompressedColorMaskClipLeft(char *a1, __int16 colorMask); void fun_drawGraphicCompressedColorMaskClipRight(char *data, __int16 colorMask); void fun_drawGraphicLetterColoredFull(char *data); void fun_drawGraphicLetterColoredClipLeft(char *data); void fun_drawGraphicLetterColoredClipRight(char *data); char * fun_drawGraphicGetOffsetClipTop(char *a1); void fun_drawGraphicType2(char *data); void fun_drawImage_16x16(int *img); void fun_drawImage_24x24(int *img); void fun_drawImage_32x32(int *img); int unused_417A60(int a1, int a2, int a3, int a4, int a5, int a6, int a7); int unused_417AE0(char *buffer, int a2, int width, int xMin, int yMin, int xMax, int yMax); signed int unused_grabBuildingFootprintFromBuffer(char *buffer, char *dst, int scanline, int xOffset, int yOffset, int width, signed int height); // idb int unused_clearBuildingFootprint(int a1, int a2, int a3, int a4, int a5, int width, int height); signed int fun_wndprocRefresh(); signed int fun_loadGraphics(); signed int fun_loadClimateGraphics(int climate); // idb signed int fun_loadEnemyGraphics(int enemyId); // idb void fun_saveSettingsAndFreeMemory(); signed int fun_loadSettings(); void fun_loadDefaultNames(); signed int fun_readCaesar3IniFile(); void fun_reallocateScreenBuffer(); LRESULT __stdcall fun_wndproc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); void fun_showOverlay(int overlay); void fun_showAdvisor(int advisor); void fun_cycleThroughLegions(); void fun_jumpToBookmark(signed int bookmark); void fun_setBookmark(signed int bookmark); void fun_changeGameSpeed(int goSlower); // idb void sub_41C000(int buildingId, int a2); void sub_41C210(); void sub_41C5D0(); signed int sub_41C670(); void fun_changeBackgroundMusic(); void fun_resetBackgroundMusic(); void fun_drawMenuBar(struct C3Menu *menu, signed int numItems); void fun_drawDialogConfirm(); void fun_drawDialogConfirmButtons(); void fun_drawArrowButtonCollection(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons); int unused_41EB50(int xOffset, int yOffset, int a3); // idb int unused_41EBD0(int a1, int a2); int unused_41EDC0(int a1, int a2); signed int unused_41EFA0(int a1, int a2); signed int unused_41F0B0(int a1); signed int unused_41F1C0(int a1); void fun_drawImageButtonCollection(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons); int fun_handleImageButtonClick(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons); void unused_41F760(int a1, int a2); void sub_41F7A0(struct C3ImageButton *buttons, int numButtons); void sub_41F820(struct C3ImageButton *buttons, int numButtons); void fun_isImageButtonClick(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons, int start); int fun_handleArrowButtonClick(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons); // idb int fun_isArrowButtonClick(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons, int offset); // idb signed int sub_41FEC0(struct C3Menu *a1, int a2); int fun_handleMenubarClick(struct C3Menu *menu, int numItems); void sub_420130(); void fun_closeSubMenu(); signed int fun_isMenubarClick(struct C3Menu *menu, signed int numItems); // idb signed int fun_isSubMenuClick(struct C3MenuItem *item, signed int numItems, int xOffset, int yOffset); // idb int fun_handleCustomButtonClick(int xOffset, int yOffset, struct C3CustomButton *buttons, int numButtons); int fun_isCustomButtonClick(int xOffset, int yOffset, struct C3CustomButton *buttons, int numButtons); // idb void fun_showConfirmDialog(int msgId, void (*okFunc)(void), int numButtons); void fun_handleConfirmDialogClick(); void fun_confirmdialog_ok(); void fun_confirmdialog_cancel(); signed int unused_420960(); signed int unused_4209C0(int a1, int a2); signed int fun_enableDirectDraw(); signed int fun_disableDirectDraw(int release); // idb signed int fun_directDrawClearFill(); signed int fun_directDrawCreateSurface(); LPDIRECTDRAWSURFACE fun_directDrawCreateExtraSurface(DWORD width, DWORD height, int a3); signed int fun_translateDDrawSurfaceLockError(int a1); void fun_drawBuildingFootprint_xFull(int *data, int clipYcode); void fun_drawBuildingFootprint_xFull_colored(int *data, int clipYcode); void fun_drawBuildingFootprint_xClipRight(int *data, int clipYcode); void fun_drawBuildingFootprint_xClipRight_colored(int *data, int clipYcode); void fun_drawBuildingFootprint_xClipLeft(int *data, int clipYcode); void fun_drawBuildingFootprint_xClipLeft_colored(int *data, int clipYcode); void unused_grabBuildingFootprintTileFromBuffer(char *buffer, int *data, int scanline); void unused_clearBuildingFootprintTile(char *buffer, int scanline); // idb void fun_clearBuildingFootprintTile_26px(); void fun_drawBuildingFootprint_26px_xFull(); void fun_drawBuildingFootprint_26px_xClipRight(); void fun_drawBuildingFootprint_26px_xClipLeft(); void fun_grabBuildingFootprintTileFromBuffer_26px(); void fun_drawBuildingFootprint_10px_xFull(); void fun_drawBuildingFootprint_10px_xClipRight(); void fun_drawBuildingFootprint_10px_xClipLeft(); void fun_grabBuildingFootprintTileFromBuffer_10px(); void fun_clearBuildingFootprintTile_10px(); signed int fun_drawBuildingFootprintSize2(); signed int fun_drawBuildingFootprintSize3(); signed int fun_drawBuildingFootprintSize4(); signed int fun_drawBuildingFootprintSize5(); void fun_setIsometricViewport(int gridwidth, int gridheight, int xoffset, int yoffset, int numtiles_width, int numtiles_height, signed int tilewidth, signed int tileheight); void sub_42DA10(); void sub_42DAA0(int gridOffset); void sub_42DB70(int a1); int sub_42DE10(); void fun_rotateMapCounterClockwise(); void fun_rotateMapClockwise(); int fun_getIsometricViewportWidth(); int fun_getIsometricViewportHeight(); int fun_getCityScreenWidth(); int unused_42E480(); void fun_gotoGridOffset(__int16 gridOffset); void sub_42E560(int x, int y, int gridOffset); void sub_42E6D0(int x, int y, int gridOffset, int a4); void sub_42E7A0(); void fun_drawOverlay(); void fun_drawBuildingOnWaterOverlayPipes(int a1, int a2); void fun_drawBuildingOnWaterOverlay(int x, int y); // idb void fun_drawBuildingOnNativeOverlayRed(int a1, int a2); void fun_drawBuildingOnNativeOverlay(int a1, int a2); void fun_drawBuildingWithOverlay(int buildingId, int xOffset, int yOffset, int graphicOffset); void fun_drawBuildingOnDesirabilityOverlay(int x, int y); void fun_drawBuildingOnDesirabilityOverlayColored(int a1, int a2); void fun_drawBuildingOnFireOverlay(int buildingId, int a2, int a3); void fun_drawBuildingOnDamageOverlay(int a1, int a2, int a3); void fun_drawBuildingOnCrimeOverlay(int a1, int a2, int a3); void fun_drawBuildingOnEntertainmentOverlay(int a1, int a2, int a3); void fun_drawBuildingOnEducationOverlay(int a1, int a2, int a3); void fun_drawBuildingOnTheaterOverlay(int a1, int a2, int a3); void fun_drawBuildingOnAmphitheaterOverlay(int a1, int a2, int a3); void fun_drawBuildingOnColosseumOverlay(int a1, int a2, int a3); void fun_drawBuildingOnHippodromeOverlay(int a1, int a2, int a3); void fun_drawBuildingOnFoodStocksOverlay(int a1, int a2, int a3); void fun_drawBuildingOnBathhouseOverlay(int a1, int a2, int a3); void fun_drawBuildingOnReligionOverlay(int a1, int a2, int a3); void fun_drawBuildingOnSchoolOverlay(int a1, int a2, int a3); void fun_drawBuildingOnLibraryOverlay(int a1, int a2, int a3); void fun_drawBuildingOnAcademyOverlay(int a1, int a2, int a3); void fun_drawBuildingOnBarberOverlay(int a1, int a2, int a3); void drawBuildingOnClinicOverlay(int a1, int a2, int a3); void fun_drawBuildingOnHospitalOverlay(int a1, int a2, int a3); void fun_drawBuildingOnTaxIncomeOverlay(int a1, int a2, int a3); void fun_drawBuildingOnProblemsOverlay(int a1, int a2, int a3); void fun_drawBuildingOnWorkersOverlay(int buildingId, int a2, int a3); void fun_drawOverlayColumn(signed int height, int a2, int a3, int isRed); void fun_drawExtraBuildingImages(int a1); void fun_drawBridge(int x, int y); void drawWalker(int walkerId, int a2, int a3, int a4); // idb void sub_437E20(int a1); void sub_4384F0(); void fun_drawSelectedBuildingGhost(); void fun_drawBuildingGhostDefault(); void fun_drawBuildingGhostRoad(); void fun_drawBuildingGhostReservoirSimon(); void fun_drawBuildingGhostAqueduct(); void fun_drawBuildingGhostFountain(); void fun_drawBuildingGhostBathhouse(); void fun_drawBuildingGhostBridge(); void fun_drawBuildingGhostFort(); void fun_drawBuildingGhostHippodrome(); void fun_drawBuildingGhostShipyardWharf(); void fun_drawBuildingGhostDock(); void fun_drawBuildingGhostType81(); void fun_drawSelectedCost(); void sub_43E600(); void sub_43E7A0(int a1, int a2); void fun_drawMinimap(int in_x, int in_y, signed int a3, int a4); signed int fun_minimapGetWalkerColor(int walkerId); // idb int sub_43F750(int a1, int a2, signed int a3, int a4); signed int fun_sound_43FA80(int a1, int a2); signed int fun_directSound_init(); signed int fun_deinitDirectSound(); void fun_sound_init(); signed int fun_sound_playTestSound(const char *filename, int channel); // idb signed int fun_sound_440330(int a1, int a2); signed int sound_playChannel(int channel); // idb signed int fun_sound_isEffectsChannelInUse(int a1); signed int fun_playInterfaceButtonSound(int a1); void fun_soundStopEffectsChannel(int channel); int unused_440760(int a1); signed int fun_playSound(const char *filename, int isSpeech, int isBackgroundMusic); signed int unused_440920(const char *a2, DWORD_PTR arg4, int a3); signed int unused_440AA0(int a1); void unused_440B20(); void fun_sound_440B40(int a1, int a2); int fun_sound_441190(DWORD_PTR dwUser); // idb void fun_soundStopChannel(int channel); // idb LONG __stdcall fptc_0(int a1, int a2, int a3, int a4, int a5); signed int fun_directSoundTranslateError(int error); // idb void fun_adjustSoundVolumeForChannel(int percentage, int channel); // idb void fun_adjustSoundVolumeForEffectsChannels(int percentage, int channelFrom, int channelTo); // idb void fun_editor_empire_determineMaxEntryInUse(); void fun_editor_empire_clearEmpireEntry(int entryId); int unused_4425B0(); void fun_initEmpire(); void fun_editor_empire_determineGraphicSize(); void fun_scrollEmpireMap(int direction); // idb void fun_checkEmpireMapScrollBoundaries(); void fun_sortRequests(); void fun_sortInvasions(); void fun_sortDemandChanges(); void fun_sortPriceChanges(); void fun_empireCityClearBuysSells(int empireItemId); void fun_editor_empire_fixBuySell(int a1); void fun_editor_empire_fixOwnCity(); void fun_empireObjectsCorrectOwnerCity(int cityId); void fun_empireObjectsCorrectTradeStatus(); signed int canEmpireCitySellsGood(int empireId, int goodId); signed int canEmpireCityBuysGood(int empireId, int goodId); // idb bool fun_canExportGoodToCity(int ciid, int cityId, int resourceId); bool canImportGoodFromCity(int ciid, int cityId, signed int resourceId); signed int fun_tradeCanBuyGoodNow(int goodId); // idb signed int fun_tradeCanBuyGoodPotentially(int goodId); // idb signed int fun_tradeCanSellGoodNow(int goodId); // idb signed int cityCanProduceGoodNow(signed int goodId); signed int fun_cityCanProduceGood(signed int goodId); void fun_readEmpireFile(int isCustomScenario); void fun_copyEmpireData(signed int empireMapId); int fun_writeCurrentEmpireToFileCustom(); void unused_createEmptyEmpireStatesFile(); void fun_fillExpandedEmpireFields(); void fun_initializeTradeRoutes(); void fun_determineDistantBattleCity(); void fun_resetTradeAmounts(); signed int fun_getTradeCityFromEmpireObject(int empireObjectId); // idb signed int isSeaTradeRoute(int tradeRouteId); // idb signed int fun_isTradeRouteOpen(int tradeRouteId); // idb signed int fun_getTradeRouteCityIndex(int tradeRouteId); // idb void fun_handleExpandEmpireEvent(); signed int fun_getEmpireTradeAmountId(int empireEntryId, __int16 goodId); // idb void fun_setEmpireTradeAmountId(int empireEntryId, __int16 goodId, int amountId); void sub_445880(); void sub_4459F0(); void sub_445A30(int a1); void sub_445AB0(int a1, int a2); void sub_445B60(int a1, int a2); void fun_generateTraders(); signed int sub_446550(int a1, int a2, int a3, int a4, int a5); signed int sub_446B50(int a1, int a2, int tradeCtId, int a4, int a5); signed int fun_importOneGoodFromCity(int buildingId, int resourceId, int cityId); // idb signed int sub_447210(int a1, int a2, int a3, int a4, int a5); signed int fun_exportOneGoodToCity(int buildingId, int resourceId, int cityId); // idb void sub_4479A0(); void sub_4482C0(); void sub_448340(); void fun_handleDistantBattleEvent(); signed int sub_448D50(); void fun_calculateDistantBattleRomanTravelTime(int isGame); void fun_calculateDistantBattleEnemyTravelTime(int isGame); void fun_setDistantBattleCity(); void fun_setDistantBattleCityAsVulnerable(); void fun_setDistantBattleCityAsForeign(); void fun_setInvasionMonthsAndPaths(); signed int sub_449570(int a1); void fun_handleInvasionEvent(); signed int fun_startLocalUprisingFromMars(); void fun_startInvasionFromCheat(); signed int sub_449C60(); signed int fun_startInvasion(int enemyType, int numEnemies, int invasionPoint, __int16 attack, char invasionId); // idb void fun_setRequestsMonths(); int sub_44AA30(int a1); void fun_dispatchRequestedGoods(int requestId); void fun_setDemandChangesMonths(); void fun_checkDemandChangesEvent(); void fun_setPriceChangesMonths(); void fun_checkPriceChangesEvent(); void sub_44B340(); void fun_doGameTick_0_noop(); void sub_44B8B0(); void fun_doGameWeekTick(); void sub_44BE70(); void fun_evolveDevolveHouses(); void fun_checkEvolveSmallTent(); void fun_checkEvolveLargeTent(); void fun_checkEvolveSmallShack(); void fun_checkEvolveLargeShack(); void fun_checkEvolveSmallHovel(); void fun_checkEvolveLargeHovel(); void fun_checkEvolveSmallCasa(); void fun_checkEvolveLargeCasa(); void fun_checkEvolveSmallInsula(); void fun_checkEvolveMediumInsula(); void fun_checkEvolveLargeInsula(); void fun_checkEvolveGrandInsula(); void fun_checkEvolveSmallVilla(); void fun_checkEvolveMediumVilla(); void fun_checkEvolveLargeVilla(); void fun_checkEvolveGrandVilla(); void fun_checkEvolveSmallPalace(); void fun_checkEvolveMediumPalace(); void fun_checkEvolveLargePalace(); void fun_checkEvolveLuxuryPalace(); signed int fun_preventHouseEvolution(); void fun_calculateBuildingDesirability(); bool fun_checkEvolveDesirability(int buildingId); // idb signed int fun_houseHasGoodsAndServicesForLevel(int buildingId, int forUpgrade); // idb void fun_determineHouseEvolveText(int buildingId); void fun_houseConsumeGoods(int buildingId); void fun_resetServiceRequiredCounters(); void decayService_culture(); void fun_determineHousingServicesForEvolve(); void gatherEntertainmentInfo(); void sub_450F10(); void sub_4510E0(); void fun_recalculateReservoirAndFountainAccess(); void decreaserWalkerServiceAccessForAll(); void sub_451770(); void sub_451AB0(); void ceresWitherCrops(int bigCurse); void ceresBlessingCrops(); bool gStockCapacity(int a1); void sub_4520A0(int a1); int marketDetermineDestinationGranaryWarehouse(int buildingId); signed int sub_452DD0(int buildingId); signed int sub_452ED0(int buildingId); void sub_452FD0(); signed int fun_dockIsConnectedToOpenWater(int x, int y); // idb void sub_453140(); void sub_453AA0(); void fun_getListOfAllHouses(); void fun_gameTick22_updatePopulationInHouses(); void fun_gametick_population(); void fun_calculateNumberOfWorkers(); void fun_immigratePeople(signed int immigrantsToGo); void fun_emigratePeople(int emigrantsToGo); signed int sub_454D40(int a1, int a2); void fun_immigratePeopleToHouse(int buildingId, char numPeople); void emigratePeopleFromHouse(int buildingId, signed int numEmigrants); int fun_addBirthsToHouses(int ciid, int a2); // idb int fun_removePeopleFromCity(int ciid, int amount); // idb int fun_calculatePeopleInHousingTypes(int ciid); void fun_spawnWalker_homeless(int ciid, __int16 x, __int16 y, int numPeople); // idb void sub_455650(); void fun_calculateWorkersNeededPerCategory(); signed int fun_isIndustryForBuildingEnabled(int buildingId); void fun_calculateUnemployment(); void fun_reallocateWorkersPerCategory(); void sub_456230(); void sub_4563A0(); void sub_456910(); void empty_456B60(); void fun_decayService_taxCollector(); void fun_collectMonthlyTaxes(); void fun_updateFinanceTaxes(); void fun_copyFinanceTaxesToLastYear(); void fun_payMonthlyWages(); void fun_payMonthlyInterest(); void fun_payMonthlySalary(); void fun_copyFinanceWagesToLastYear(); void fun_copyFinanceImportExportToLastYear(); void fun_copyFinanceConstructionToLastYear(); void fun_copyFinanceInterestToLastYear(); void fun_copyFinanceSundriesToLastYear(); void fun_calculateTribute(); void fun_calculateTributeThisYear(); void fun_updateWageCostsAndEstimate(); void fun_updateFinanceInterest(); void fun_updateFinanceSalary(); void fun_calculateFinanceTotals(); void fun_updateHighestInUseBuildingId(); void unused_458A40(); int unused_458A60(); void sub_458A80(); signed int sub_458AE0(int ciid, int resourceId); // idb void sub_458B40(int ciid); // idb signed int sub_458E80(int a1, int a2, int a3, int a4, int a5, int a6); signed int fun_addGoodToWarehouse(int ciid, int buildingId, int resourceId); // idb void fun_refundGoods(int ciid, int resourceId, int amount); int fun_removeGoodsFromCityStorage(int ciid, int goodId, int amount); signed int fun_removeGoodFromWarehouse(int ciid, int buildingId, int resourceId, signed int amount); // idb void fun_removeGoodsFromWarehouseForMercury(int buildingId, signed int amount); signed int sub_459DD0(int a1, int a2); signed int sub_45A040(int a1); signed int sub_45A8D0(int a1); signed int sub_45AA70(int a1, int a2, int a3, int a4); int sub_45AB50(int a1, int a2, int a3); signed int sub_45AEB0(int a1, int a2, int a3, int a4); int sub_45B220(int a1, int a2, int a3); void fun_importGoodAndAddToWarehouse(int ciid, int buildingId, int resourceId); int fun_getGoodAmountStoredInWarehouse(int buildingId, int good); // idb signed int sub_45B920(int a1); signed int fun_getResourceGraphicIdOffset(int resourceId, int type); // idb void fun_updateAdvisorFoodAndSupplyRomeWheat(); void fun_gatherFoodInformation(int ciid); signed int sub_45C100(int a1, int a2, int a3, signed int a4, int a5, int a6); int sub_45C3E0(int a1, int a2, int a3, int a4, int a5, int a6); signed int sub_45C460(int a1, int a2, signed int a3, int a4, int a5); int sub_45C720(int buildingId); // idb __int16 sub_45CAF0(); int sub_45CDC0(int a1, int a2); signed int sub_45D000(); signed int sub_45D1F0(); signed int sub_45D3D0(int a1, signed int a2, int a3); int sub_45D620(int a1, signed int a2); int sub_45D6A0(int a1, int a2, int a3); int sub_45D7B0(int a1, int a2, int a3, signed int a4); int fun_removeFoodFromGranaryForMercury(int buildingId, int resourceId, signed int amount); // idb void sub_45DAE0(); void sub_45DE60(); void sub_45DEC0(int a1); signed int sub_45E100(int a1, int a2, int a3, int a4, int a5); signed int sub_45E390(int a1, int a2, int a3, int a4, int a5); int sub_45E600(int a1, int a2, int a3, int a4); signed int sub_45E740(int a1); signed int sub_45E7D0(int a1); void fun_generateWalkersForBuildings(); signed int fun_buildingHasWalkerOfType(int buildingId, int walkerType1, int walkerType2); // idb void fun_generateLaborSeeker(int buildingId); void sub_4639D0(int a1); void sub_463C80(int a1); void sub_463DB0(int a1); int fun_determineEntertainerDestination(int x, int y, int buildingType1, int buildingType2); // idb void fun_countBuildingTypes(); void fun_calculateCultureCoverage(); void fun_distributeTreasuryOverForumsAndSenates(); void sub_466330(int a1); void fun_setAqueductGraphicIdsToWaterFromOffset(int gridOffset); void fun_setAqueductGraphicIdsToNoWater(); void sub_466880(); char sub_466B70(signed int a1, char a2); void unused_466DF0(); void unused_466E10(); void handleFireCollapseEvent(); void fun_enemyHitBuilding(int gridOffset, signed int maxDamage); // idb void fun_destroyBuildingByEnemyAt(int x, int y, int mapOffset); void sub_467A70(int a1, int a2); void checkBurningRuins(); int sub_4680A0(int a1, int a2); void checkCrimeAndGenerateCriminal(); void fun_generateRioter(int buildingId); // idb void generateMugger(int buildingId); void fun_generateProtester(int buildingId); void fun_removeGoodsFromStorageForMercury(int bigCurse); // idb void sub_468F00(); int destroyFirstBuildingOfType(int buildingType); // idb void sub_4691F0(); void sub_469280(); int sub_469320(); int sub_469470(); void fun_clearBuildings(); signed int fun_createBuilding(int ciid, BuildingType type, int x, int y); void fun_deleteBuilding(int buildingId); void deleteBuildingEvent(int buildingId); void fun_clearStorages(); signed int fun_createStorage(); void fun_setStorageBuildingIds(); signed int houseCanExpand(int buildingId, int numTiles); void sub_46A900(int a1); signed int sub_46AAC0(int buildingId); // idb void updateHouseToXArea(int a1, int a2); int calculatePopulation4HouseMerging(int buildingId, int a2); // idb void sub_46AFA0(int a1, __int16 a2); void sub_46B1F0(int a1, __int16 a2); void sub_46B410(int a1, __int16 a2); void merge4aloneHouses(int curBlfId, __int16 a2); void fun_splitHouse2x2(int buildingId); // idb void fun_devolveHouse2x2ToMediumInsula(int a1); void fun_devolveHouse3x3ToMediumInsula(int a1); void fun_devolveHouse3x3To2x2(int a1); void fun_devolveHouse4x4To3x3(int a1); void fun_revertHouseToVacantLot(int buildingId); // idb void sub_46E3D0(int buildingId, char a2); void sub_46E9E0(); void sub_46F030(); void sub_46F260(); void fun_updateRatings(int yearlyUpdate); // idb void fun_updateCultureRating(); void fun_setCultureRatingExplanation(); void fun_updateProsperityRating(); void fun_setProsperityRatingExplanation(); void fun_calculateMaxProsperity(); void fun_reduceProsperityRatingBecauseOfBailout(); void fun_updatePeaceRating(); void fun_setPeaceRatingExplanation(); void fun_updateFavorRating(int isYearlyUpdate); // idb void fun_setFavorRatingExplanation(); void fun_sendGiftToCaesar(); void fun_initNewScenarioMap(); void fun_initTerrainGridEdge(); void fun_initRandomGrid(); void fun_initMapEdges(); void fun_placeBuilding(int ciid_, int orientation, signed int xMin, signed int yMin, signed int xPos, signed int yPos, BuildingType buildingId); void sub_476BA0(int a1, int a2, int a3, int a4, int a5); void sub_476EB0(int a1, int a2, int a3, int x, int y); // idb void sub_4771D0(int a2, int a3, int a4, int a5, int a6); void sub_4779D0(int a1, int a2, int a3, int a4, int a5); void fun_buildConstructWall(int a1, int a2, int a3, int a4, int a5); int sub_477DD0(int a1, int a2, int a3, int a4, int a5); bool sub_4780E0(int a1); int sub_478310(int a1, int a2, int a3, int a4, int a5); void sub_4787A0(int a1, int a2, int a3, int a4, int a5); int sub_4789E0(int a1); void fun_initGraphicIdGrid(); int sub_478B80(int a1, int a2, int a3, int a4); void sub_478CE0(int xStart, int yStart, int xEnd, int yEnd); int sub_478E40(); void sub_479240(); int sub_479600(); void sub_479720(int x, int y, int width, int height); void sub_479C80(int a1, int a2, int a3, int a4); void sub_479DE0(int a1, int a2, int a3, int a4); int sub_479F40(int a1, int a2, int a3, int a4); int sub_47A140(int a1, int a2, int a3, int a4); int sub_47A320(int a1, int a2); void sub_47A4C0(int a1, int a2); int sub_47A660(int a1, int a2); int sub_47A800(int a1, int a2); int sub_47A9A0(int a1, int a2); int sub_47AB40(int a1, int a2); int unused_47AD00(int a1, int a2); int sub_47AD60(int a1, int a2); void fun_placeEditorBuilding(int x, int y); // idb void sub_47B8D0(int xStart, int yStart, int xEnd, int yEnd); // idb int sub_47B970(int a1, int a2, int a3, int a4); void sub_47BA10(int a1, int a2, int a3, int a4); void unused_47BA90(int a1, int a2, int a3, int a4); void sub_47BB10(int a1, int a2, int a3, int a4); int sub_47BBB0(int a1, int a2, int a3, int a4); int sub_47BC30(int a1, int a2, int a3, int a4); void sub_47BCD0(int a1, int a2, int a3, int a4); int sub_47BD60(int a1, int a2); char sub_47BEF0(int a1, int a2); void sub_47C0A0(int a1, int a2); void sub_47C2A0(int a1, int a2, int a3, int a4); int sub_47C3D0(); int sub_47C480(int a1, int a2, int a3, int a4); int sub_47CA20(); void unused_47CBF0(); void unused_47CCD0(); int sub_47CDB0(int a1, int a2, int a3); void sub_47D180(int a1, int a2, int a3); void sub_47D4B0(int a1, int a2, int a3); void sub_47D5B0(int a1, int a2, int a3); int sub_47D9D0(int a1, int a2); void sub_47DA90(int x, int y, int isWater); int sub_47DF20(int a1, int a2, int a3); void sub_47E2B0(int x, int y, int size); int sub_47E590(); void sub_47E7A0(int a1); int sub_47EDE0(int a1, int a2, int a3); int sub_47F200(int a1, int a2, int a3); void sub_47F400(); int sub_47F530(); signed int sub_47F7B0(); int sub_47F830(int a1, int a2); void sub_47F8C0(int x, int y, int a3); void sub_47FAF0(int a1, int a2, int a3, int a4, int a5); void unused_47FEA0(); void unused_47FEC0(int a1, int a2, __int16 a3, __int16 a4); void fun_putBuildingOnTerrainAndGraphicGrids(__int16 buildingId, int x, int y, int width, int height, __int16 graphicId, __int16 terrain); int sub_480260(__int16 a1, int a2, int a3, int a4, int a5, __int16 a6, __int16 a7); int sub_480460(__int16 a1, int a2, int a3, int a4, signed int a5); int sub_480C60(int a1); void collapseBuildingToRubble(int buildingId, int x, int y, int width, int height); void sub_480FC0(int a1, int a2, int a3); int sub_481370(int a1, int a2); signed int fun_terrainIsClear(int x, int y, int width, int height, unsigned __int16 terrainMask, int a6); // idb int unused_4816D0(int a1, int a2, int a3, int a4); int sub_4817E0(int a1, int a2, int a3, int a4, int a5); signed int sub_4818F0(int a1, int a2, int a3, int a4, int a5, int a6); signed int sub_481A50(int a1, int a2, int a3); int sub_481E70(__int16 a1, int a2, int a3, __int16 a4); signed int sub_482140(int a1, int a2, int a3); int sub_4824E0(__int16 a1, int a2, int a3, __int16 a4); signed int sub_4827B0(int a1, int a2, int a3); int sub_482BD0(int size, int x, int y, __int16 a4, int a5); // idb int sub_482DE0(); signed int fun_isTerrainFree(int size, int x, int y, unsigned __int16 mask); int unused_483090(int a1, int a2, int a3); void sub_4831E0(); int sub_4833A0(); void sub_4837C0(int a1); void sub_483BF0(__int16 a1); void sub_483D00(); bool sub_483FB0(); signed int sub_4840B0(int a1); signed int sub_484470(int a1); int sub_4847A0(int a1); void sub_484900(); int sub_484AD0(int gridOffset); // idb signed int sub_484B20(int a1, int a2); int sub_485390(); signed int sub_485450(signed int a1); int unused_485600(__int16 a1); int unused_4859A0(); int sub_485A80(); signed int unused_485F70(int a1, int a2); signed int unused_486010(int a1, int a2); signed int unused_4860B0(int a1, int a2); signed int sub_486150(int a1, int a2); signed int sub_486200(int a1, int a2); signed int sub_4862B0(int a1, int a2); signed int sub_486310(int a1, int a2); bool unused_486370(int a1, int a2); signed int unused_486400(int a1); signed int sub_4864B0(int a1); signed int sub_486540(int a1, int a2, int a3, int a4, int a5); signed int sub_486AF0(int a1); signed int sub_486BC0(int a1, int a2, int a3, int a4, int a5); int sub_486DF0(int a1, int a2); void sub_4870D0(int a1, int a2, int a3); int sub_487650(int a1, int a2); signed int sub_4879A0(int a1); int sub_487CD0(); void sub_4880A0(int a1, int a2); signed int sub_488240(int a1, int a2); bool sub_488430(int a1, int a2); signed int sub_488860(int a1, int a2); void sub_488B70(int x, int y, int a3); char sub_488E00(int a1, int a2, int a3); signed int sub_489070(int x, int y, int size, signed int radius); // idb signed int sub_4890E0(int a1, int a2, int a3, signed int a4); signed int sub_489150(int a1, int a2, int a3, signed int a4, int a5); signed int sub_4891C0(int x, int y, int size, int ring, int a5); // idb signed int sub_489350(int a1, int a2, int a3, int a4, int a5); signed int sub_489500(int a1, int a2, int a3, signed int a4); signed int sub_489570(int a1, int a2, int a3, int a4); signed int determineAccessRoad(int x, int y, int size); // idb signed int sub_4898D0(int a1, int a2); signed int fun_granaryHasRoadAccess(int x, int y); // idb signed int sub_489E70(int a1, int a2, int a3); signed int fun_isAdjacentToWall(int x, int y, int size); // idb signed int sub_48A050(int a1, int a2, int a3); int sub_48A180(int a1); signed int sub_48A390(int a1); signed int sub_48A590(int a1); signed int sub_48A6F0(int a1); signed int sub_48A900(int a1); int sub_48ABC0(); signed int isAdjacentToWater(int x, int y, int size); // idb int sub_48B030(int a1, int a2, int a3); int sub_48B2F0(int a1, int a2, int a3); signed int fun_isAdjacentToOpenWater(int x, int y, int size); // idb signed int sub_48B700(int a1, int a2, int a3); signed int sub_48B840(int a1, int a2, int a3); signed int fun_mapAreaContainsTerrain(int x, int y, int size, int terrain); // idb signed int sub_48BAC0(int a1, int a2, int a3); int sub_48BCD0(int a1, int a2, int a3, int a4, int a5, int a6, signed int a7); int sub_48BD80(int a1, int a2, int a3, int a4, char a5); bool sub_48C110(int a1, int a2, int buildingSize, int distance, int a5); // idb __int16 sub_48C740(); void fun_setMapAreaRangeTerrain(int x, int y, int size, int range, __int16 terrain); void sub_48D170(int a1, int a2, int a3, int a4, __int16 a5); signed int sub_48D300(int x, int y, int a3, int a4, int a5); // idb signed int sub_48D480(int a1, int a2, int a3, int a4, int a5); signed int sub_48D600(int a1, int a2, int a3, int a4, int a5); void sub_48D780(int a1, int a2, int a3, int a4); int sub_48D910(int a1, int a2, int a3, int a4); signed int sub_48DAA0(int x, int y, int size, int range); // idb int fun_walkerProvideEngineerCoverage(int x, int y); // idb int fun_walkerProvidePrefectFireCoverage(int x, int y); // idb int fun_walkerProvidePrefectCrimeCoverage(int x, int y); // idb int fun_walkerProvideTheaterAccess(int x, int y); // idb int fun_walkerProvideAmphitheaterAccess(int x, int y, int numShows); // idb int fun_walkerProvideColosseumAccess(int x, int y, int numShows); // idb int fun_walkerProvideHippodromeAccess(int x, int y); // idb int fun_walkerProvideMarketGoods(int buildingId, int x, int y); // idb int fun_walkerProvideBathhouseAccess(int x, int y); // idb int walkerProvideReligionAccess(int x, int y, int god); // idb int fun_walkerProvideSchoolAccess(int x, int y); // idb int fun_walkerProvideAcademyAccess(int x, int y); // idb int fun_walkerProvideLibraryAccess(int x, int y); // idb int fun_walkerProvideBarberAccess(int x, int y); // idb int walkerProvideClinicAccess(int x, int y); // idb int fun_walkerProvideHospitalAccess(int x, int y); // idb signed int fun_walkerProvideMissionaryAccess(int x, int y); int fun_walkerProvideLaborSeekerAccess(int x, int y); // idb int fun_walkerProvideTaxCollectorAccess(int x, int y); // idb void sub_490850(char *buffer, int numItems); void fun_setByte14Zero(char *buffer, int items); int sub_490A00(); void sub_490A70(); int sub_490AE0(); int sub_490B40(); int sub_490D00(); int sub_490DE0(int a1); signed int sub_490F30(int a1); void sub_490FD0(); void fun_performUndo(); void sub_4914E0(); void sub_4915A0(int a1); void sub_4918A0(); void fun_handleEarthquakeEvent(); int sub_492110(int a1, int a2); signed int sub_492240(int a1, int a2); void fun_handleGladiatorRevoltEvent(); void fun_handleEmperorChangeEvent(); void fun_handleRandomEvents(); void sub_492870(); void fun_walker_nobody(); void walker_immigrant(); void fun_walker_emigrant(); void fun_walker_homeless(); void fun_walker_cartpusher(); void walker_laborSeeker(); void walker_explosion(); void walker_taxCollector(); void fun_walker_engineer(); void fun_walker_warehouseman(); void fun_walker_prefect(); signed int sub_499FE0(int a1); signed int sub_49A250(int a1); signed int sub_49A510(int a1, int a2); void fun_walker_soldier(); void fun_walker_militaryStandard(); void fun_walker_entertainer(); void fun_walker_tradecaravan(); void walker_tradeship(); void fun_walker_tradecaravanDonkey(); void fun_walker_protestor(); void fun_walker_criminal(); void fun_walker_rioter(); signed int sub_49FDE0(int walkerId); int sub_49FFE0(int a1); void fun_walker_fishingBoat(); void fun_walker_marketTrader(); void fun_walker_priest(); void fun_walker_schoolChild(); void fun_walker_teacher(); void fun_walker_librarian(); void fun_walker_barber(); void fun_walker_bathhouseWorker(); void fun_walker_doctor(); void fun_walker_surgeon(); void fun_walker_worker(); void fun_walker_mapFlag(); void fun_walker_flotsam(); void walker_docker(); signed int sub_4A46D0(int a1); signed int sub_4A4910(int a1); signed int sub_4A4B50(int a1); bool sub_4A4CC0(int a1); signed int sub_4A4D70(int a1); int sub_4A4F80(int a1); signed int unused_4A5050(int a1, int a2); void fun_walker_marketBuyer(); signed int createCaravanForMarketTrader(int marketTraderId, int a2, int a3); signed int sub_4A5EB0(int a1, int a2, int a3); void fun_walker_patrician(); void fun_walker_indigenousNative(); void fun_walker_towerSentry(); signed int sub_4A7760(int a1); void sub_4A7A70(); signed int sub_4A7DC0(int a1); void sub_4A7F30(); void sub_4A8A30(); void sub_4A9140(); int sub_4A9850(); int sub_4A9BC0(); int sub_4A9EA0(); int sub_4AA1A0(); int sub_4AA8C0(); int sub_4AADF0(); int sub_4AB200(); int sub_4AB570(); int sub_4AB8D0(); void empty_4ABEF0(); void empty_4ABF10(); void sub_4ABF30(); void sub_4AC350(); signed int sub_4AD320(int a1, int a2); signed int sub_4AD500(int a1, int a2, int a3); signed int sub_4AD800(int a1, int a2, int a3); signed int sub_4ADB30(int a1, int a2); signed int sub_4ADE90(int a1, int a2, int a3); void walker_nativeTrader(); void fun_walker_arrow(); int fun_walker_javelin(); void fun_walker_bolt(); void fun_walker_ballista(); void fun_walker_creature(); void fun_walker_missionary(); void fun_walker_seagulls(); void fun_walker_deliveryBoy(); void fun_walker_shipwreck(); void fun_walker_sheep(); void fun_walker_wolf(); void fun_walker_zebra(); void fun_walker_spear(); void fun_walker_hippodromeHorse(); void sub_4B2740(int a1, int a2); void sub_4B2CA0(); void sub_4B2D50(int a1, int a2); void sub_4B32F0(int a1); void sub_4B3390(int walkerId); bool sub_4B3A40(int a1, int a2); bool sub_4B3AD0(int a1, int a2); int sub_4B3B80(int a1); void clearAndRemoveDestPathForWalker(int wlkId); char fun_roamWalker(int walkerId); // idb void sub_4B3F00(int a1, int a2); int sub_4B4630(int a1); void sub_4B4880(int a1, int a2, int a3); void walkerWalkTicks(int walkerId, int numTicks); // idb void sub_4B4BC0(int a1, int a2); void fun_determineDestinationPathForWalker(int walkerId); void removeDestinationPathForWalker(int walkerId); void fun_clearDestinationPaths(); void fun_garbageCollectDestinationPaths(); int fun_getNumFreeDestinationPaths(); void fun_walkerGetNextTileDirection(int walkerId); // idb void fun_walkerAdvanceTile(int walkerId); // idb char sub_4B5BE0(int a1); void walkerAdvanceTick(int walkerId); int sub_4B66E0(int a1, int a2); int sub_4B69C0(int a1); int turnWalkerToTile(int walkerIndex, int startX, int startY, int stopX, int stopY, int a6); __int16 sub_4B6F50(int a1); __int16 sub_4B7000(int a1); signed int sub_4B70B0(int a1, int a2, int a3, int a4); int fun_createDustCloud(__int16 x, __int16 y, int size); int spawnWalkerWithParent(short parentId, short startx, short starty, short stopx, short stopy, WalkerType walkerType); bool sub_4B76D0(int a1); void fun_neptuneSinkAllShips(); void fun_clearWalkers(); int spawnWalker(char a1, WalkerType type, __int16 x, __int16 y, char a5); // idb void deleteWalker(int walkerId); void sub_4B8080(signed int a1); int sub_4B84E0(int a1); void sub_4B8A40(int a1); int sub_4B8B80(int a1); void removeWalkerFromTileList(int walkerId); int sub_4B8D50(int a1); int fun_getWalkerFormationIdAtOffset(int gridOffset); // idb int getFormationFromGridBldId(int a1); int sub_4B8F30(int walkerId); // idb int sub_4B9080(int walkerId); // idb signed int fun_hasEnemyNear(signed int xMin, signed int yMin, signed int xMax, signed int yMax); // idb void fun_initWalkerNameSequences(); void fun_generateWalkerName(int walkerId); void fun_moveLegionTo(int x, int y, int legionId); // idb void sub_4BA850(int formationId); int unused_4BAA80(int a1); signed int fun_createFortFormation(int buildingId); // idb signed int fun_createFormation(WalkerType walkerType, int layout, int orientation, char x, char y); // idb signed int fun_generateSoldierFromBarracks(int buildingId); // idb signed int fun_generateTowerSentryFromBarracks(int buildingId); // idb void fun_removeTowerSentry(int x, int y); signed int sub_4BB5B0(); signed int sub_4BB640(int a1); void sub_4BB790(int a1); int sub_4BB990(int a1); void fun_calculateFortTotals(); signed int fun_getFormationIdOfLegion(int legionId); // idb int fun_calculateNumForts(); void sub_4BBC90(); void sub_4BBD90(); void sub_4BBF50(); void fun_formationDecreaseMoraleAfterComradeDeath(int a2); void fun_formationIncreaseMorale(int formationId, __int16 moraleToAdd); void fun_increaseMoraleOfAllForts(__int16 a1); void fun_increaseMoraleOfAllEnemies(__int16 a1); void sub_4BC600(); void fun_setMaxSoldiersPerFort(); int fun_getInvasionGridOffset(int invasionId); // idb int sub_4BCF70(); void fun_clearFormations(); void deleteFormation(int formationId); void sub_4BD5C0(); int sub_4BD8D0(); void sub_4BDA20(int a1); int sub_4BDC50(); char unused_4BE060(int a1); void sub_4BE0F0(); void sub_4BE200(); void sub_4BF390(int a1); void sub_4BF500(); void sub_4BFCC0(int a1, int a2); signed int sub_4BFE10(int a1, signed int a2, int a3, int a4, int a5, int a6); void fun_killEnemiesSpiritOfMars(); void killAllWalkersExcludeEnemies(); signed int sub_4C02C0(); void sub_4C0410(int a1); void sub_4C04D0(); void sub_4C0730(int a1, int a2, int a3, char a4); signed int sub_4C0910(int a1, int a2, int a3); void sub_4C0AF0(int a1); void sub_4C0F10(int a1); void sub_4C1100(); signed int sub_4C1280(int a1, int a2, int a3); signed int fun_walkerProvideServiceCoverage(int walkerId); // idb void fun_generateMapFlagWalkers(); void fun_createFishHerdFlotsamWalkers(__int16 riverEntryX, __int16 riverEntryY, int createFlotsam); // idb void fun_showHelpDialog(int helpId, int a2); void sub_4C4CC0(); void fun_drawHelpDialogButtons(); void fun_handleHelpDialogClick(); void sub_4C5E40(); void sub_4C5EE0(); signed int sub_4C5FE0(); void sub_4C6170(); void sub_4C6200(); void fun_message_close(); int sub_4C62F0(); void sub_4C63D0(int a1, int a2, int a3, int a4); void sub_4C64A0(); void fun_drawScrollableText(char *text, int x, int y, int width, int a5); int fun_getRichTextWordWidth(char *str); // idb int sub_4C6DE0(unsigned __int8 *a1, int a2, int a3, int a4); int sub_4C6FA0(int a1, unsigned __int8 a2, int a3, int a4, int a5); signed int fun_getButtonTooltipText(); signed int fun_getButtonTooltipText_TradePrices(); signed int fun_getButtonTooltipText_EmpireMap(); signed int fun_getOverlayTooltipText(); signed int sub_4C9710(); signed int unused_4C9790(); void fun_drawTooltip(); void unused_4C9D00(); void unused_4C9E30(); void sub_4C9FE0(); void fun_drawSenateTooltip(); int fun_strnpos(const char *haystack, const char *needle, int haystackSize); // idb int fun_strnchr(const char *s, unsigned __int8 c, int len); // idb int fun_strFirstDifferenceIndex(const char *s1, const char *s2, int len); // idb unsigned __int8 unused_toupper(unsigned __int8 c); unsigned __int8 unused_tolower(unsigned __int8 c); // idb unsigned __int8 * unused_strtolower(unsigned __int8 *a1); void unused_strCutAtFirstNonCharacter(char *a1); void fun_strMoveRight(char *start, char *end); void unused_strTrimSpacesLeft(char *a1); void unused_strTrimSpacesRight(char *a1); void unused_strRemoveDoubleSpaces(char *str); int fun_getStringWidth(const char *str, int fontId); // idb int fun_strlen(const char *str); int fun_getCharWidth(unsigned __int8 c, int fontId); // idb int strToInt(char *str); // idb int fun_strNumDigitChars(char *str); // idb void unused_addToGameTextString(char *str, int group, int number, signed int len); int unused_copyGameTextString(char *dst, int group, int number, signed int maxlen); void fun_getGameTextString_forMessagebox(int group, int number); void fun_inputDetermineCursorPosition(); void fun_inputKeyPressed(unsigned __int8 keyValue); void unused_inputAddCharacter(char value); void fun_inputReturnPressed(); void fun_inputBackspacePressed(); void fun_inputDeletePressed(); void fun_inputInsertPressed(); void fun_inputLeftPressed(); void fun_inputRightPressed(); void fun_inputHomePressed(); void fun_inputEndPressed(); void fun_inputAddCharacter(char value); void fun_inputRemoveCurrentChar(); void fun_inputInit(int id); void sub_4CBDD0(); void fun_initInputTextbox(int inputId, char *text, int maxlength, int textboxwidth, char allowPunctuation, int font); int fun_intToString(signed int number, int offset, int addPlusSign); // idb int fun_getGameTextStringWidth(int group, int number, int fontId); void fun_drawTextCentered(const char *str, int x, int y, int boxWidth, int fontId, __int16 color); // idb void fun_drawText(const char *str, int x, int y, int fontId, __int16 color); int fun_drawCharacter(int fontId, unsigned __int8 printableChar, int x, int y); // idb char unused_drawText_hashCharAndWrap(); void fun_drawGameTextCentered(int group, int number, int x, int y, int boxWidth, int fontId, __int16 color); // idb void fun_drawGameText(int group, int number, int x, int y, int fontId, __int16 color); // idb void fun_drawNumberSingularPlural(int group, int number, int amount, int x, int y, int fontId, __int16 color); // idb void fun_drawGameYearWithBcAd(int resolution, int value, int x, int y, int fontId, __int16 color); // idb void unused_drawNumberWithPrefixPostfix(int value, int showZero, const char *prefix, const char *postfix, int x, int y, int fontId, __int16 colorPositive, __int16 colorNegative); // idb void drawNumber(signed int value, char prefix, const char *postfix, int x, int y, int fontId, __int16 color); void fun_drawNumberCentered(signed int value, char a2, const char *postfix, int x, int y, int boxWidth, int fontId, __int16 color); // idb void unused_drawNumberCenteredColored(signed int value, int showZero, char a3, const char *postfix, int x, int y, int boxWidth, int fontId, __int16 positiveColor, __int16 negativeColor); // idb void unused_drawGameTextWrappedTwoBoxes(int group, int number, int xOffset, int yOffset, int boxWidth, int maxLines, int box2_xOffset, int box2_boxWidth, int fontId, __int16 a10); void fun_drawGameTextWrapped(int group, int number, int x, int y, int boxWidth, int fontId, __int16 a7); // idb void fun_drawTextWrapped(char *str, int xOffset, int yOffset, int boxWidth, int fontId, __int16 color); int fun_getWordWidth(char *str, int fontId); // idb void fun_drawLine_setHelperVars(int x1, int y1, int x2, int y2); void fun_drawLine_something(int a1); void fun_drawDot(int x, int y, int color); void unused_setIsometricPixel_safe(int x, int y, int color); void fun_drawLine(int x1, int y1, int x2, int y2, int color); void unused_drawDottedLine(int x1, int y1, int x2, int y2, int a5); // idb void fun_drawRect(int x, int y, int width, int height, int color); // idb void unused_setLineTransparencyOutline(int xOffset, int yOffset, int width); void fun_drawSelectionAnts(int xOffset, int yOffset, int width, int height); void fun_nextSelectAntsColorLong(); void fun_nextSelectAntsColor(); void fun_drawInsetRect(int x, int y, int width, int height); // idb void unused_drawDarkRect(int x, int y, int width, int height); void fun_drawOutsetRect(int x, int y, int width, int height); void unused_setIsometricTileOutlineColor(int xOffset, int yOffset, int width, signed int height, int color); int unused_4CE9D0(int a1, int a2, int a3, signed int a4, int a5); int unused_4CEAF0(int a1, int a2, int a3, signed int a4, int a5); int unused_4CEB90(int a1, int a2, int a3, int a4, int a5); void fun_fillRect(int x, int y, int width, int height, int color); void unused_andRect(int x, int y, int width, int height, __int16 color); void unused_fillGreenGraphicRectWithBorder(int x, int y, int widthBlocks, int heightBlocks); void unused_fillGreenGraphicRect(int x, int y, int widthBlocks, int heightBlocks); void unused_4CEFD0(int a1, int a2, int a3, int a4); int drawGraphic(signed int graphicId, int xOffset, int yOffset); // idb int fun_drawEnemyGraphic(signed int a1, int x, int y); // idb void unused_4D0240(signed int graphicId, int a2, int a3); void fun_drawBuilding(signed int graphicId, int a2, int a3); void fun_drawMinimapPixelGraphic(signed int graphicId, int x, int y); // idb void unused_4D0800(); void fun_setGraphicXClipCode(); void fun_setGraphicYClipCode(); bool fun_pixelWithinClipBounds(int xOffset, int yOffset); // idb int sub_4D0B70(signed int graphicId, int xOffset, int yOffset, __int16 a4); // idb void fun_increaseSomeRandomCounters(); void unused_4D0F60(); void fun_generateRandomness(); void fun_generateRandomnessPool(); void unused_4D1240(); int unused_4D12E0(int a1); int fun_adjustWithPercentage(int value, int percentage); // idb int unused_adjustWithPromille(int value, int promille); // idb int getPercentage(int value, signed int max); // idb int unused_divideAndRoundUp(signed int value, signed int divisor); // idb int unused_4D15D0(int a1, int *a2, int a3, int a4); int fun_getDistanceXplusY(int x1, int y1, int x2, int y2); // idb int fun_getDistanceMaximum(int x1, int y1, int x2, int y2); // idb int fun_getDistanceMinimum(int x1, int y1, int x2, int y2); // idb void unused_clearSg2Records(); void fun_prepareClimateGraphics(); void fun_prepareEnemyGraphics(); void unused_prepareUnknownGraphics(); void fun_convertCompressedGraphicToSurfaceFormat(__int16 *graphicData, int dataLength); void fun_convertGraphicToSurfaceFormat(__int16 *graphicData, int dataLength); // idb signed int unused_4D1DF0(const CHAR *filename, int a2); // idb signed int unused_rectangleIsWhite(char *buffer, int width, int height, int xMin, int yMin, int xMax, int yMax); // idb void fun_findFiles(const char *mask); void fun_findFiles_sort(); void fun_changeFileExtensionTo(char *filename, char *extension); // idb void fun_changeFileExtension(char *a1); void fun_removeFileExtension(char *filename); void fun_appendFileExtension(char *filename); char unused_getIndexOfFileExtension(char *filename); signed int fun_fileExists(const char *filename); signed int fun_fileExistsHome(const char *filename); signed int fun_fileExistsOnCdWithMinimumLength(const char *filename, int length); // idb int fun_readDataFromFilename(const char *filename, void *buffer, DWORD nNumberOfBytesToRead, LONG lDistanceToMove); int fun_readUncompressedImageData(const char *Source, void *buffer, DWORD nNumberOfBytesToRead, int times, LONG lDistanceToMove); // idb int unused_writeToFilename(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite); int unused_traceEnabled(); void fun_writeTraceMessage(); int fun_writeToFilenameAtOffset(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite, LONG offset); // idb int fun_writeToFilenameAppend(const char *filename, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite); char unused_findResaudVersionNumberInFile(const CHAR *filename, char *buffer); // idb signed int unused_readFileIntoBufferFromFileDialog(char *filter, void *buffer, char *filename, char *title); // idb signed int fun_readFileIntoBuffer(const CHAR *filename, void *buffer); signed int fun_readLanguageTextFiles(const CHAR *c3eng_filename, const CHAR *c3mm_filename); // idb int fun_getFilesize(const CHAR *filename); // idb signed int unused_writeBufferToFile_Dialog(const char *a1, LPCVOID lpBuffer, char *filename, char *a4, DWORD nNumberOfBytesToWrite); // idb signed int fun_writeBufferToFile(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite); signed int unused_4D3E10(const char *a1, int a2, signed int a3); DWORD fun_getBmpDataOffset(struct WindowsBitmap *a1); signed int fun_flipBitmap(struct WindowsBitmap *bmp); signed int unused_4D4590(const CHAR *a1); void unused_4D4900(); void unused_4D4920(); void unused_4D4940(); void unused_4D4960(); void unused_4D4980(); void unused_4D49A0(); void unused_4D49C0(); void unused_4D49E0(); void unused_4D4A00(); void unused_4D4A20(); void unused_4D4A40(); void unused_4D4A60(); void unused_4D4A80(); void unused_4D4AA0(); void unused_4D4AC0(); signed int unused_4D4AE0(); signed int unused_4D4BC0(); signed int unused_4D4C10(); void unused_4D4C30(); void fun_greyRectangle(int xOffset, int yOffset, int width, int height, char blackness); void unused_4D4F00(); void fun_clearScreen(); void unused_4D4F70(); signed int unused_4D4F90(HINSTANCE hInstance, unsigned __int16 a2, LPVOID lpvBits); signed int unused_4D50F0(); void unused_4D5110(); void unused_4D5130(); void unused_4D5150(); void unused_4D5170(); void fun_redrawScreen_doNothing(); BOOL unused_4D51D0(__int16 a1, __int16 a2); void fun_getMouseCursorStatus(); void fun_setCursor(int cursorId); bool fun_isMouseHit(int x, int y, int width, int height); // idb signed int fun_getMapScrollDirection(); char unused_4D58E0(); int unused_4D5930(); int unused_4D5960(); int unused_4D59A0(int a1, int a2, int a3, int a4); void unused_4D5A20(int a3); signed int unused_4D5AE0(int a3); void fun_measureCpuSpeed(int times); signed int unused_4D5C10(int a1, int a2); void fun_drawLoadingText(char *lpString); void fun_measureComputerSpeed(); void unused_nothing1(); void unused_nothing2(); void unused_nothing3(); void unused_nothing2Times(int times); void unused_nothing3Times(int times); void unused_5nothing(); int fun_setupMainWindow(HINSTANCE hInstance); // idb void fun_setResolution(int resolutionId); // idb SIZE_T fun_getAvailablePhysicalMem(); void fun_coUninitializeOnNormalExit(); void fun_pauseApp(); void fun_resumeApp(); signed int fun_directDrawRestoreSurfaces(); int fun_timeVideo(); signed int fun_enableGfxDirectDraw(); void fun_deinitDirectDraw(int release); signed int fun_initDirectDraw(); void fun_refreshVideoBuffer(int forceRefresh); // idb signed int fun_deleteSavedGame(const char *Filename); signed int fun_writeSavedGame(const char *filename); signed int fun_loadSavedGame(const char *filename); // idb void fun_setupFromSavedGame(); void fun_writeMissionSavedGame(); signed int fun_writeScenarioFile(const char *filename); // idb signed int fun_loadScenarioFile(const char *filename); signed int fun_loadSavedGameFromMissionPack(int a1); void fun_redrawScreen(); void sub_4D76B0(); void fun_drawWindow(int force); // idb void fun_drawWindowButtons(); void fun_handleMouseClick(); signed int fun_getElapsedGameTicks(); signed int fun_shouldScrollMap(); void sub_4DC1B0(); void fun_scrollMap(int scrollDirection); int unused_4DC380(); int unused_4DC3A0(); int fun_getIsometricViewportWidth2(); int fun_getIsometricViewportHeight2(); void fun_setCityViewport_withoutPanel(); void fun_setCityViewport_withPanel(); void sub_4DC5C0(); void sub_4DC600(); void fun_clearBookmarks(); void fun_loadFromC3mapsBmp(int a1); void fun_loadTerrainFromC3maps(int a1); void fun_writeToC3mapsBmp(int missionId); void fun_createNewScenario(int mapsize); // idb void sub_4DD2A0(); void fun_loadScenario(const char *filename); void fun_postMessageToPlayer(signed int messageId, int param1, __int16 param2); // idb void sub_4DDF20(); void fun_determineAdvisorForMessage(int messageTypeId); // idb int fun_getHelpTextIdFromMessageId(signed int messageId); // idb void sub_4DE430(); void fun_sortAndCompactPlayerMessages(); signed int fun_createPlayerMessage(); void sub_4DE6E0(); void sub_4DE8B0(); void sub_4DE900(); void fun_drawDialogMessages(); void fun_drawMessageListButtons(); int fun_handleClickMessages(); signed int sub_4DF2E0(); void fun_dialogMessages_scrollUpDown(); void fun_dialogMessages_help(); void fun_dialogMessages_close(); void fun_messages_select(); void fun_messages_delete(); void sub_4DF720(); void fun_message_help(); void fun_message_gotoProblemArea(); void sub_4DF8B0(); void showWarning(int warningId); void fun_clearWarnings(); void fun_showWarningBuildingRoadAccess(int buildingId, int a2, int a3, int a4); void fun_showWarningNoWaterInReservoir(int buildingId); // idb void showWarningNoWorkers(int buildingId); // idb void showWarningNoMarkets(int buildingId); // idb void showWarningNoActors(int buildingId); // idb void fun_showWarningNoGladiators(int buildingId); void fun_showWarningNoLions(int buildingId); // idb void fun_showWarningNoChariots(int buildingId); // idb void fun_showWarningNoBarracks(int buildingId); void fun_showWarningNoWeapons(int buildingId); // idb void fun_showWarningNoWall(int buildingId, int x, int y, int a4); // idb void fun_showWarningNoWaterAccess(int buildingId, int x, int y); // idb void fun_showWarningMoreFoodNeeded(int buildingId); // idb void fun_showWarningNoIron(int a1); void fun_showWarningNoVines(int buildingId); void fun_showWarningNoOlives(int buildingId); void fun_showWarningNoTimber(int buildingId); void fun_showWarningNoClay(int buildingId); void fun_calculateGiftCosts(); void fun_clearMissionSettings(); void sub_4E1200(); void sub_4E1250(); //void unused_4E12C0(int ciid); // idb void sub_4E1300(); void fun_calculateHealthRate(); void fun_changeHealthRate(int amount); void fun_resetPopulationMax(); void fun_gametick_requestBirthsDeaths_calculateHousingTypes(); void fun_populationAdvanceAgesOneYear(); void fun_populationBirths(); void fun_dispatchRequestedTroops(int amount); void fun_updatePopulationAfterBirthsDeaths(int ciid); void unused_4E2380(int numPeopleToRemove); int fun_calculateCityHappinessAndCrime(); void fun_decreaseCrimeRisk(char amount); void fun_setCrimeRiskForAllHouses(signed int targetCrimeRisk); signed int sub_4E3140(); void fun_determineHappinessEmigrationImmigration(int ciid); void fun_addPeopleToCityAndCensus(int ciid, int numPeople); void sub_4E3800(int ciid, int a2); void sub_4E3920(int ciid, int a2); void sub_4E3A40(int ciid, int numPeople); int fun_getPeopleInAgeDecennium(int ciid, int decennium); // idb void unused_4E3BD0(int a1, int a2, int a3); void fun_removePeopleFromCensusInDecennium(int ciid, int ageDecennium, int peopleRemoved); void fun_removePeopleFromCensus(int ciid, int numPeople); int fun_addPeopleToCensus(int ciid, int numPeople); // idb int fun_getNumPeopleOfWorkingAge(); int fun_getNumberOfSchoolAgeChildren(int ciid); int fun_getNumberOfAcademyAgeChildren(int ciid); void fun_calculateCultureDemandLevel(); void fun_setTreasuryAmount(int ciid, int amount); void fun_spendMoneyConstruction(int ciid, int amount); void fun_increaseFavorRating(int amount); void fun_setFavorRatingMax(int max); void fun_recordMonthlyPopulation(); int fun_getPopulationAtMonth(int maxMonths, int month); // idb void fun_drawPopulationHistoryGraph_determineMinMaxMonthYear(signed int maxMonths); void fun_calculateGodHappiness(int includeBlessingsAndCurses); void fun_clearCityInfoGods(); void fun_determineAngriestGod(); void fun_holdFestival(); void fun_handleScenarioWinLoseEvent(); void fun_decreaseMonthsLeftToGovernAfterWin(); void fun_dialogVictory_accept(); void sub_4E6B40(); void fun_dialogVictory_continueGoverning(); void sub_4E6E20(); signed int sub_4E6EC0(); signed int sub_4E7D40(); void fun_showRightClickInfo(); void sub_4E92D0(); void fun_handleMouseClickRightClickInfo(); void sub_4E9AE0(int a1, int a2); void sub_4E9BA0(); void fun_showInfoNoPeople(); void fun_showTerrainInfo(); void sub_4EA150(); void fun_drawWalkerRightClickInfoText(int walkerId); // idb GoodType fun_convertCollectIdToResourceId(int collectId); void sub_4EBF50(int a1); void sub_4EC1B0(int a1); void sub_4EC350(int a1); void fun_drawRightClickWorkerInfo(int a1); void showBuildingInfoAmphitheater(); void fun_showBuildingInfoTheater(); void fun_showBuildingInfoHippodrome(); void fun_showBuildingInfoColosseum(); void fun_showBuildingInfoLionHouse(); void fun_showBuildingInfoActorColony(); void fun_showBuildingInfoChariotMaker(); void fun_showBuildingInfoGarden(); void fun_showBuildingInfoWall(); void fun_showBuildingInfoAqueduct(); void fun_showBuildingInfoPlaza(); void fun_showBuildingInfoStatue(); void fun_showBuildingInfoTriumphalArch(); void fun_showBuildingInfoDoctor(); void fun_showBuildingInfoHospital(); void fun_showBuildingInfoBathhouse(); void fun_showBuildingInfoBarber(); void fun_showBuildingInfoSchool(); void fun_showBuildingInfoAcademy(); void fun_showBuildingInfoLibrary(); void fun_showBuildingInfoPrefecture(); void fun_showBuildingInfoFortGround(); void fun_showBuildingInfoGatehouse(); void fun_showBuildingInfoTower(); void fun_showBuildingInfoMilitaryAcademy(); void fun_showBuildingInfoBarracks(); void fun_showBuildingInfoTempleCeres(); void fun_showBuildingInfoTempleNeptune(); void fun_showBuildingInfoTempleMercury(); void fun_showBuildingInfoTempleMars(); void fun_showBuildingInfoTempleVenus(); void fun_showBuildingInfoMarket(); void fun_showBuildingInfoGranary(); void fun_drawGranarySpecialOrdersButton(); void fun_showGranaryInstructionsDialog(); void sub_4F29B0(); void fun_showBuildingInfoWarehouse(); void fun_drawWarehouseSpecialOrdersButton(); void fun_showWarehouseInstructionsDialog(); void sub_4F3640(); void fun_showBuildingInfoShipyard(); void fun_showBuildingInfoDock(); void fun_showBuildingInfoWharf(); void fun_showBuildingInfoGovernorsHome(); void fun_showBuildingInfoEngineersPost(); void fun_showBuildingInfoMissionPost(); void fun_showBuildingInfoNativeHut(); void fun_showBuildingInfoNativeMeeting(); void fun_showBuildingInfoNativeCrops(); void fun_showBuildingInfoSenate(); void fun_showBuildingInfoForum(); void fun_showBuildingInfoReservoir(); void fun_showBuildingInfoFountain(); void fun_showBuildingInfoWell(); void fun_showBuildingInfoOracle(); void fun_showBuildingInfoBurningRuin(); void fun_showBuildingInfoRubble(); void fun_showBuildingInfoWheatFarm(); void fun_showBuildingInfoVegetableFarm(); void fun_showBuildingInfoFruitFarm(); void fun_showBuildingInfoOliveFarm(); void fun_showBuildingInfoVinesFarm(); void fun_showBuildingInfoPigFarm(); void fun_showBuildingInfoMarbleQuarry(); void fun_showBuildingInfoIronMine(); void fun_showBuildingInfoTimberYard(); void fun_showBuildingInfoClayPit(); void fun_showBuildingInfoWineWorkshop(); void fun_showBuildingInfoOilWorkshop(); void fun_showBuildingInfoWeaponsWorkshop(); void fun_showBuildingInfoFurnitureWorkshop(); void fun_showBuildingInfoPotteryWorkshop(); void showBuildingInfoHousing(); void fun_showBuildingInfoVacantLot(); void sub_4FE3E0(); void fun_showFortInfo(int fortId); // idb void sub_4FF0B0(int a1); void fun_determineGroundType(); void sub_4FFDF0(); void sub_5001A0(); void sub_500420(); void fun_clearGroundTypeGrid(); signed int sub_5007F0(int x, int y, int a3, int a4); // idb signed int sub_500B60(int a1, int a2, int a3, int a4); signed int sub_501000(int x1, int y1, int x2, int y2); // idb signed int fun_canTravelToDestinationOverRoadGarden(int curX, int curY, int destX, int destY); // idb signed int sub_5017A0(int a1, int a2, int a3, int a4); signed int sub_501B60(int a1, int a2, int a3, int a4, int a5, int a6); signed int sub_5023D0(int gridOffset); // idb signed int sub_502470(int gridOffset); // idb signed int sub_502510(int a1, int a2, int a3, int a4); signed int fun_determineShortestPathFromDistanceGraph(int a1, int destinationPathId, int curX, int curY, int destX, int destY); // idb signed int sub_502C50(int a1, int a2, int a3, int a4, int a5, signed int a6); signed int sub_503000(int a1, int a2, int a3, int a4); signed int sub_503A40(int a1); signed int sub_503C20(int a1); signed int sub_503D30(int a1); int unused_503E80(); signed int sub_503EA0(int a1, int a2, int a3); signed int sub_5041C0(int a1, int a2, int a3, int a4, int a5, int a6); char fun_walkerGetSimpleDestinationDirection(int x1, int y1, int x2, int y2); // idb char fun_pathing_getDirection16(int xFrom, int yFrom, int xTo, int yTo); // idb signed int unused_pathing_getDirection4(int x1, int y1, int x2, int y2, int min); // idb char fun_pathing_getDirection8(int xFrom, int yFrom, int xTo, int yTo); // idb signed int fun_determineOpenWaterTiles(int riverEntryX, int riverEntryY); // idb signed int sub_505060(int a1, int a2); signed int fun_determineShortestPathOnWater(int destinationPathId, int curX, int curY, int destX, int destY, int isFlotsam); // idb void fun_setCityScreenWidths(); void fun_drawCityScreenForeground(); void fun_drawCitySidepanelButtons(); void fun_drawCitySidepanelOverlayButtonText(signed int forceRedraw, int xOffset); // idb void fun_drawCitySidepanelBuildingGraphic(int forceRedraw, int xOffset); void fun_drawCitySidepanelMinimap(int forceRedraw); // idb void fun_drawTopMenu(signed int a1); void fun_drawCitySidepanelNumMessages(signed int forceRedraw); // idb void empty_drawMainMenuBackground(); void fun_editor_drawEmpireUnsavedDataWarning(); void fun_drawCityScreen_PausedAndTime(); void fun_drawCitySidepanel(); void sub_507750(); void fun_editor_drawControlPanelSubmenuButtons(); void sub_507EF0(); void fun_drawOverlayMenuButtons(); void fun_drawMainMenu(int overwrite); void fun_drawLoadingScreen(int number); // idb void fun_drawMainMenuForeground(); void fun_showGameFinishedScreen(); void fun_drawWinLoseScreenButtons(); void sub_5091E0(); void sub_5093B0(int a1, int a2, int a3); void sub_509410(); void fun_drawMissionBriefingForeground(); void sub_50A290(); void fun_drawCckSelectionScreen(); void fun_drawCckFileList(); void fun_drawStartNewCareerBackground(); void fun_drawStartNewCareerDialog(); void fun_drawLogoScreen(); void fun_drawDemoExitScreen1(); void fun_drawDemoExitScreen2(); void fun_drawDemoExitScreen3(); void fun_drawWinGameScreen(); void fun_drawAdvisorScreen(); void fun_drawAdvisorBackgroundAndButtons(); void fun_advisorPrepareSomeButton(); void fun_drawLaborAdvisor(); void fun_drawLaborAdvisorCategories(); void fun_drawLaborPriorityDialog(); void fun_drawLaborPriorityDialogButtons(); void fun_drawMilitaryAdvisor(); void fun_drawMilitaryAdvisorButtons(); void fun_drawImperialAdvisor(); void fun_drawImperialAdvisorButtons(); void fun_drawDialogSetSalary(); void fun_drawDialogDonateToCity(); void fun_drawDialogDonateToCityButtons(); void fun_drawDialogSendGift(); void fun_drawDialogSendGiftButtons(); void fun_drawRatingsAdvisor(); void fun_drawRatingsAdvisorButtons(); void fun_drawRatingAdvisorColumn(int x, int y, signed int value, int hasReached); void fun_drawTradeAdvisor(); void fun_drawTradeAdvisorButtons(); void fun_drawDialogResourceSettings(); void fun_drawDialogTradePrices(); void fun_updateAvailableGoodsAndFoods(); void fun_drawDialogTradeRouteOpened(); void fun_drawPopulationAdvisor(); void fun_drawPopulationAdvisorButtons(); void fun_drawPopulationHistoryGraph(int isBig, int x, int y); // idb void fun_drawPopulationCensusGraph(int isBig, int x, int y); // idb void fun_drawPopulationSocietyGraph(int isBig, int x, int y); // idb void fun_setPopulationGraphYAxisMax(signed int maxValue); // idb void fun_drawHealthAdvisor(); void fun_drawEducationAdvisor(); void fun_drawEntertainmentAdvisor(); void fun_drawEntertainmentAdvisorFestivals(); void fun_drawEntertainmentAdvisorHoldFestivalButton(); void fun_drawDialogHoldFestival(); void fun_drawDialogHoldFestivalButtons(); void fun_drawReligionAdvisor(); void fun_drawFinancialAdvisor(); void fun_drawChiefAdvisor(); void fun_drawEmpireInfoPanel(); void empty_51C8D0(); void fun_drawEmpireInfoPanelBackground(); void fun_drawEmpireInfoPanelCityName(); void fun_drawEmpireInfoPanelForeground(); void fun_drawEmpireInfoPanelCity(); int fun_drawEmpireInfoPanelBattleIcon(); void fun_drawEmpireInfoPanelRomanArmy(); void fun_drawEmpireInfoPanelEnemyArmy(); void fun_drawEditEmpireObjectButtons(); void fun_drawEditEmpireObjectPanel(); void fun_drawEditEmpireObjectPanel_Add(); void fun_drawEditEmpireObjectPanel_Edit(); int sub_51F950(int a1, int a2); void fun_drawEditEmpireObjectPanel_General(); void fun_drawEmpire(); void fun_drawEditorEditStartDate(); void fun_drawEditorRequests(); void fun_drawEditorEditRequest(); void fun_drawEditorInvasions(); void fun_drawEditorEditInvasion(); void fun_editor_drawNumericInputDialog(int a1, int a2); void fun_editor_drawSelectListDialog(int a1, int a2); void fun_drawDisplayOptionsDialog(); void fun_drawDifficultyOptionsDialog(); void fun_drawSpeedOptionsDialog(); void fun_drawSoundOptionsDialog(); void fun_drawDialogFileSavedGame(); void fun_drawScrollbarDot(); void fun_editor_drawMainDialog(); void fun_editor_drawStartingConditionsDialog(); void fun_editor_drawAllowedBuildingsDialog(); void fun_editor_drawWinCriteriaDialog(); void fun_drawCitySidepanelEditorConsole(); void fun_editor_drawSpecialEventsDialog(); void fun_editor_drawDemandChangesDialog(); void fun_editor_drawEditDemandChangeDialog(); void fun_editor_drawPriceChangesDialog(); void fun_editor_drawEditPriceChangeDialog(); void fun_editor_drawSupplyDemandDialog(); void fun_drawConfirmResolutionDialog(); void fun_drawConfirmResolutionDialogButtons(); void fun_drawDebugInfoPopulation(); void fun_drawDebugInfoEvolve(); void fun_drawDebugInfoBuildings(); void fun_drawDebugInfoFigures(); void fun_drawTopMenuBackground(); void fun_drawGreyButton(int a1, int x, int y, int width, int mouseOver); void unused_drawGildedCorners(int a1, int x, int y, signed int a4, int a5, int a6); void fun_drawDialogBackground(int xOffset, int yOffset, int widthBlocks, int heightBlocks); void fun_drawSubMenuBackground(int xOffset, int yOffset, int widthBlocks, int heightBlocks); void fun_drawSunkenTextBox(int x, int y, int width, int height); void fun_drawSunkenTextBoxBottomBorder(int xOffset, int yOffset, int widthInBlocks); void fun_drawBorderedButton(int a1, int x, int y, signed int width, signed int height, int mouseOver); void fun_drawDebugInfoBox(int greyButtonId, int a2, int a3, int a4, int a5, int a6); signed int sub_52C7A0(int a1); signed int unused_52C810(int a1); void fun_drawSmallGreyButton(int a1, int x, int y, int width, int widthIsFixed, int mouseOver); int unused_52C9D0(int a1, int a2, int a3); int unused_52CA90(int a1, int a2, int a3, int a4, int a5); void fun_resetClipRegionOptionsDialog(); int unused_52CC30(int a1); void fun_drawCitySidepanelBorder_800(); void fun_drawCitySidepanelBorder_1024(); void fun_drawTextCursor(int a1, int a2, int a3); void unused_52CFC0(); void unused_52D0B0(const char *str, int a2); void unused_52D180(); signed int fun_startVideo(const char* filename, int x, int y, int fullscreen, int nextWindowId); // idb signed int fun_checkVideo(const char *videoFilename, int xOffset, int yOffset); // idb signed int fun_playVideo(const char *filename, int x, int y, int fullscreen); // idb signed int fun_smackDoFrame(); void fun_smackCancelVideo(); void fun_smackStopVideo(); void fun_smackCleanupAfterVideo(); signed int unused_52D950(); void unused_52D980(); void unused_52D9A0(); int unused_52D9C0(); void unused_52DA10(HWND hWnd); int unused_52DAE0(int a1, int a2, int a3, int a4); void playWalkerSound(int walkerSoundId, int soundId); void fun_determineWalkerSoundPhrase(int walkerId); // idb void fun_playWalkerInfoSound(); void fun_initScenario(char *mapFilename); signed int fun_file_mapExists(char *mapFilename); void fun_initCustomScenario(const char *scnFilename); signed int fun_cdDrive_FileExistsOnDriveWithLength(LPCSTR drive, const char *filename, int a3); // idb int sub_52FF00(char *Dest); // idb bool sub_530020(); void sub_530190(); signed int loadC3ModelTxt(); MMRESULT mmio_530A90(HMMIO *a1, LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent); int mmio_530D80(const char *a1, int *a2, HGLOBAL *a3, HGLOBAL *a4); signed int fun_writeCompressedChunk(int fd, void *buffer, signed int nNumberOfBytesToWrite); signed int fun_readCompressedChunk(int fd, void *buffer, DWORD nNumberOfBytesToRead); signed int unused_compressFile(const char *inputFile, const char *outputFile); signed int unused_decompressFile(char *inputFile, const char *outputFile); int fun_pk_inputFunc(char *buffer, int *length, struct PKToken *token); void fun_pk_outputFunc(char *Src, int *a2, struct PKToken *a3); int fun_pk_hashBuffer(char *a1, int a2, int *a3); signed int fun_pk_implode(int ( *inputFunc)(char *, int *, struct PKToken *), void ( *outputFunc)(char *, int *, struct PKToken *), struct PKCompBuffer *buffer, struct PKToken *token, int *hasLiteralEncoding, int *dictionarySize); void fun_pk_implodeData(struct PKCompBuffer *buffer); signed int fun_pk_implodeDetermineCopy(struct PKCompBuffer *buffer, _BYTE *inputPtr); void fun_pk_writeBits(struct PKCompBuffer *buffer, unsigned int numBits, unsigned int value); void fun_pk_implodeCopyMem(char *dst, const char *src, unsigned int length); void fun_pk_implode_memset(void *buffer, unsigned __int8 fillChar, unsigned int length); void fun_pk_implode_flushFullBuffer(struct PKCompBuffer *buffer); void fun_pk_implode_analyzeInput(struct PKCompBuffer *buffer, unsigned __int8 *inputStartPtr, unsigned __int8 *inputEndPtr); int fun_pk_explode(int ( *inputFunc)(char *, int *, struct PKToken *), void ( *outputFunc)(char *, int *, struct PKToken *), struct PKDecompBuffer *buf, struct PKToken *token); int fun_pk_explodeData(struct PKDecompBuffer *buf); // idb int fun_pk_decodeNextToken(struct PKDecompBuffer *buf); // idb int fun_pk_getCopyOffset(struct PKDecompBuffer *buf, int copylength); // idb signed int fun_pk_setBitsUsed(struct PKDecompBuffer *buf, unsigned int numBits); // idb void fun_pk_constructTable(int size, char *a2, char *table, char *a4); // idb void fun_pk_constructLiteralDecoder(struct PKDecompBuffer *buf); void fun_pk_explodeCopyMem(char *dst, char *src, unsigned int length); int j_freeMemory(void *a1); int freeMemory(void *a1, signed int a2); bool sub_538D90(int a1); void fun_clickDoNothing() { ; } void fun_confirmdialog_doNothing() { ; } void fun_confirmdialog_deleteFort() { if ( confirmdialog_okClicked == 1 ) deleteFort_confirmed = 1; else deleteFort_confirmed = -1; sub_4771D0(0, deleteConfirm_a2, deleteConfirm_a3, deleteConfirm_x, deleteConfirm_y); } void fun_confirmdialog_deleteBridge() { if ( confirmdialog_okClicked == 1 ) deleteBridge_confirmed = 1; else deleteBridge_confirmed = -1; sub_4771D0(0, deleteConfirm_a2, deleteConfirm_a3, deleteConfirm_x, deleteConfirm_y); } void fun_confirmdialog_openTrade() { if ( confirmdialog_okClicked == 1 ) { fun_spendMoneyConstruction(ciid, tradeRoutes[trade_selectedCity].costToOpen); tradeRoutes[trade_selectedCity].isOpen = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); confirmDialog_windowId = 38; window_redrawRequest = 1; } } void fun_confirmdialog_requestDispatchTroops() { if ( confirmdialog_okClicked == 1 ) { sub_4BD5C0(); fun_showEmpireMap(); confirmDialog_windowId = 20; } } void fun_confirmdialog_requestDispatchGoods() { if ( confirmdialog_okClicked == 1 ) fun_dispatchRequestedGoods(request_dispatchGoods_requestId); } void fun_menuFile_newGame() { toPlace_buildingType = B_none_building; dword_8E1484 = 0; currentOverlay = Overlay_None; previousOverlay = Overlay_None; window_id = W_MainMenu; window_redrawRequest = 1; } void fun_menuFile_replayMap() { toPlace_buildingType = B_none_building; if ( setting_isCustomScenario ) { fun_initScenario(currentScenarioFilename); window_id = 1; window_redrawRequest = 1; } else { window_id = 52; sub_4117C0(); } } void fun_menuFile_loadGame() { toPlace_buildingType = B_none_building; fun_findFiles("*.sav"); filelist_numFiles = findfiles_numFiles; filelist_scrollPosition = 0; filelist_selectedIndex = 0; byte_6ADD0C = 0; scrollbar_file_isLarge = 0; input_accepted = 0; window_id = W_SavedGame_LoadSaveDeleteDialog; fileDialogSave_from_window = 1; byte_7E1EF9 = 1; fun_memset(current_saveFilename, 64, 0); strcpy(current_saveFilename, fileDialogSave_filename); fun_inputInit(2); fun_inputHomePressed(); fun_inputEndPressed(); window_redrawRequest = 1; } void fun_menuFile_saveGame() { fun_findFiles("*.sav"); filelist_numFiles = findfiles_numFiles; filelist_scrollPosition = 0; filelist_selectedIndex = 0; byte_6ADD0C = 0; scrollbar_file_isLarge = 0; input_accepted = 0; window_id = W_SavedGame_LoadSaveDeleteDialog; fileDialogSave_from_window = 1; byte_7E1EF9 = 0; fun_memset(current_saveFilename, 64, 0); strcpy(current_saveFilename, fileDialogSave_filename); fun_inputInit(2); fun_inputHomePressed(); fun_inputEndPressed(); window_redrawRequest = 1; } void fun_menuFile_deleteGame() { fun_findFiles("*.sav"); filelist_numFiles = findfiles_numFiles; filelist_selectedIndex = 0; byte_6ADD0C = 0; scrollbar_file_isLarge = 0; input_accepted = 0; window_id = W_SavedGame_LoadSaveDeleteDialog; fileDialogSave_from_window = 1; byte_7E1EF9 = 2; fun_memset(current_saveFilename, 64, 0); strcpy(current_saveFilename, fileDialogSave_filename); fun_inputInit(2); fun_inputHomePressed(); fun_inputEndPressed(); window_redrawRequest = 1; } void fun_dialogFileSavedGame_okCancel() { mouseover_button_id_main = 0; mouseover_button_id = 0; mouseover_imagebutton_id[0] = 0; dword_9D7B90 = 0; if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) { fun_removeFileExtension(current_saveFilename); fun_strncpy("sav", current_fileExtension, 3); fun_appendFileExtension(current_saveFilename); if ( byte_7E1EF9 < 1 || fun_fileExists(current_saveFilename) ) { if ( byte_7E1EF9 == 1 ) { fun_loadSavedGame(current_saveFilename); } else { if ( byte_7E1EF9 == 2 ) fun_deleteSavedGame(current_saveFilename); else fun_writeSavedGame(current_saveFilename); } fun_removeFileExtension(current_saveFilename); strcpy(fileDialogSave_filename, current_saveFilename); if ( byte_7E1EF9 < 2 ) window_id = 1; window_redrawRequest = 1; } else { fun_removeFileExtension(current_saveFilename); byte_6ADD0C = 100; } } } else // cancel { window_id = fileDialogSave_from_window; window_redrawRequest = 1; } } void fun_dialogFile_scrollUpDown() { if ( filelist_numFiles > 12 ) { if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) { if ( filelist_scrollPosition + 12 >= filelist_numFiles ) return; ++filelist_scrollPosition; } } else { if ( filelist_scrollPosition <= 0 ) return; --filelist_scrollPosition; } byte_6ADD0C = 0; } } signed int fun_dialogFile_handleScrollbarClick() { signed int result; // eax@2 int v1; // ST60_4@15 int v2; // [sp+4Ch] [bp-10h]@5 int v3; // [sp+50h] [bp-Ch]@13 if ( filelist_numFiles > 12 ) { if ( mouse_isLeftClick ) { v2 = filelist_numFiles - 12; if ( mouseclick_x >= screen_640x480_x + 464 ) { if ( mouseclick_x <= screen_640x480_x + 496 ) { if ( mouseclick_y >= screen_640x480_y + 145 ) { if ( mouseclick_y <= screen_640x480_y + 300 ) { v3 = mouseclick_y - (screen_640x480_y + 145); if ( mouseclick_y - (screen_640x480_y + 145) > 130 ) v3 = 130; v1 = getPercentage(v3, 130); filelist_scrollPosition = fun_adjustWithPercentage(v2, v1); window_redrawRequest = 1; result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void fun_dialogFileSavedGame_select() { if ( currentButton_parameter < filelist_numFiles ) { filelist_selectedIndex = currentButton_parameter; if ( window_id == 13 ) // saved game { fun_memset(current_saveFilename, 64, 0); strcpy(current_saveFilename, &findfiles_filenames[65 * (filelist_selectedIndex + filelist_scrollPosition)]); fun_inputInit(2); } else // scenario { fun_memset(currentScenarioFilename, 64, 0); strcpy(currentScenarioFilename, &findfiles_filenames[65 * (filelist_selectedIndex + filelist_scrollPosition)]); fun_inputInit(4); } fun_inputHomePressed(); fun_inputEndPressed(); byte_6ADD0C = 0; } } void fun_menuFile_exitGame() { PostMessageA(main_window, 0x100u, 0x1Bu, 0); } void fun_menuOptions_display() { window_id = W_DisplayOptionsDialog; button_something_2 = 0; window_redrawRequest = 1; } void fun_dialogDisplayOptions_toggleFullScreen() { PostMessageA(main_window, 0x100u, 0x75u, 0); window_id = 1; window_redrawRequest = 1; } void fun_dialogDisplayOptions_setResolution() { switch ( currentButton_parameter ) { case 1: PostMessageA(main_window, 0x100u, 0x76u, 0); break; case 2: PostMessageA(main_window, 0x100u, 0x77u, 0); break; case 3: PostMessageA(main_window, 0x100u, 0x78u, 0); break; } window_id = 1; } void fun_showResolutionConfirmDialog() { if ( setting_resolution > setting_maxKnownGoodResolution ) { if ( setting_resolution > 1 ) { resolutionConfirm_startTime = timeGetTime(); window_id = W_ResolutionConfirmDialog; window_redrawRequest = 1; } } } void fun_changeBackToLastResolution() { PostMessageA(main_window, 0x100u, 0x76u, 0); window_id = 1; window_redrawRequest = 1; } void fun_resolutionConfirm_ok() { setting_maxKnownGoodResolution = setting_resolution; window_id = 1; window_redrawRequest = 1; } void fun_menuOptions_difficulty() { window_id = W_DifficultyOptionsDialog; button_something_2 = 0; window_redrawRequest = 1; } void fun_dialogDifficultyOptions_difficultyUpDown() { if ( currentButton_parameter ) --setting_difficulty; else ++setting_difficulty; if ( setting_difficulty < 0 ) setting_difficulty = 0; if ( setting_difficulty > 4 ) setting_difficulty = 4; window_redrawRequest = 1; } void fun_dialogDifficultyOptions_godsToggle() { if ( setting_godsOn ) setting_godsOn = 0; else setting_godsOn = 1; window_redrawRequest = 1; } void fun_dialogDisplayOptions_cancel() { window_id = 1; window_redrawRequest = 1; } void fun_menuOptions_sound() { soundOptions_musicOn_undoCopy = setting_sound_music_on; soundOptions_musicPct_undoCopy = setting_sound_music_pct; soundOptions_speechOn_undoCopy = setting_sound_speech_on; soundOptions_speechPct_undoCopy = setting_sound_speech_pct; soundOptions_effectsOn_undoCopy = setting_sound_effects_on; soundOptions_effectsPct_undoCopy = setting_sound_effects_pct; soundOptions_cityOn_undoCopy = setting_sound_city_on; soundOptions_cityPct_undoCopy = setting_sound_city_pct; window_id = W_SoundOptionsDialog; button_something_3 = 0; window_redrawRequest = 1; } void fun_dialogSoundOptions_ok() { window_id = 1; window_redrawRequest = 1; } void fun_dialogSoundOptions_cancel() { setting_sound_music_on = soundOptions_musicOn_undoCopy; setting_sound_music_pct = soundOptions_musicPct_undoCopy; setting_sound_speech_on = soundOptions_speechOn_undoCopy; setting_sound_speech_pct = soundOptions_speechPct_undoCopy; setting_sound_effects_on = soundOptions_effectsOn_undoCopy; setting_sound_effects_pct = soundOptions_effectsPct_undoCopy; setting_sound_city_on = soundOptions_cityOn_undoCopy; setting_sound_city_pct = soundOptions_cityPct_undoCopy; if ( setting_sound_music_on ) { fun_resetBackgroundMusic(); fun_changeBackgroundMusic(); } else { fun_soundStopChannel(0); } fun_adjustSoundVolumeForChannel(setting_sound_music_pct, 0); fun_adjustSoundVolumeForChannel(setting_sound_speech_pct, 1); fun_adjustSoundVolumeForEffectsChannels(setting_sound_effects_pct, 1, 30); fun_adjustSoundVolumeForEffectsChannels(setting_sound_city_pct, 31, 150); window_id = 1; window_redrawRequest = 1; } void fun_dialogSoundOptions_toggle() { if ( currentButton_parameter == 1 ) { if ( setting_sound_music_on ) setting_sound_music_on = 0; else setting_sound_music_on = 1; if ( setting_sound_music_on ) { fun_resetBackgroundMusic(); fun_changeBackgroundMusic(); } else { fun_soundStopChannel(0); } } if ( currentButton_parameter == 2 ) { if ( setting_sound_speech_on ) setting_sound_speech_on = 0; else setting_sound_speech_on = 1; if ( !setting_sound_speech_on ) fun_soundStopChannel(1); } if ( currentButton_parameter == 3 ) { if ( setting_sound_effects_on ) setting_sound_effects_on = 0; else setting_sound_effects_on = 1; } if ( currentButton_parameter == 4 ) { if ( setting_sound_city_on ) setting_sound_city_on = 0; else setting_sound_city_on = 1; } window_redrawRequest = 1; } void fun_dialogSoundOptions_musicUpDown() { if ( currentButton_parameter == 1 ) --setting_sound_music_pct; if ( !currentButton_parameter ) ++setting_sound_music_pct; if ( setting_sound_music_pct < 0 ) setting_sound_music_pct = 0; if ( setting_sound_music_pct > 100 ) setting_sound_music_pct = 100; fun_adjustSoundVolumeForChannel(setting_sound_music_pct, 0); window_redrawRequest = 1; } void fun_dialogSoundOptions_speechUpDown() { if ( currentButton_parameter == 1 ) --setting_sound_speech_pct; if ( !currentButton_parameter ) ++setting_sound_speech_pct; if ( setting_sound_speech_pct < 0 ) setting_sound_speech_pct = 0; if ( setting_sound_speech_pct > 100 ) setting_sound_speech_pct = 100; fun_adjustSoundVolumeForChannel(setting_sound_speech_pct, 1); window_redrawRequest = 1; } void fun_dialogSoundOptions_effectsUpDown() { if ( currentButton_parameter == 1 ) --setting_sound_effects_pct; if ( !currentButton_parameter ) ++setting_sound_effects_pct; if ( setting_sound_effects_pct < 0 ) setting_sound_effects_pct = 0; if ( setting_sound_effects_pct > 100 ) setting_sound_effects_pct = 100; fun_adjustSoundVolumeForEffectsChannels(setting_sound_effects_pct, 1, 30); window_redrawRequest = 1; } void fun_dialogSoundOptions_cityUpDown() { if ( currentButton_parameter == 1 ) --setting_sound_city_pct; if ( !currentButton_parameter ) ++setting_sound_city_pct; if ( setting_sound_city_pct < 0 ) setting_sound_city_pct = 0; if ( setting_sound_city_pct > 100 ) setting_sound_city_pct = 100; fun_adjustSoundVolumeForEffectsChannels(setting_sound_city_pct, 31, 150); window_redrawRequest = 1; } void fun_menuOptions_speed() { speedOptions_game_undoCopy = setting_speed_game; speedOptions_scroll_undoCopy = setting_speed_scroll; window_id = W_SpeedOptionsDialog; button_something_4 = 0; window_redrawRequest = 1; } void fun_dialogSpeedOptions_ok() { window_id = 1; window_redrawRequest = 1; } void fun_dialogSpeedOptions_cancel() { setting_speed_game = speedOptions_game_undoCopy; setting_speed_scroll = speedOptions_scroll_undoCopy; window_id = 1; window_redrawRequest = 1; } void fun_dialogSpeedOptions_gameUpDown() { if ( mode_editor != 1 ) { if ( currentButton_parameter == 1 ) setting_speed_game -= 10; if ( !currentButton_parameter ) setting_speed_game += 10; if ( setting_speed_game < 10 ) setting_speed_game = 10; if ( setting_speed_game > 100 ) setting_speed_game = 100; window_redrawRequest = 1; } } void fun_dialogSpeedOptions_scrollUpDown() { if ( currentButton_parameter == 1 ) setting_speed_scroll -= 10; if ( !currentButton_parameter ) setting_speed_scroll += 10; if ( setting_speed_scroll < 0 ) setting_speed_scroll = 0; if ( setting_speed_scroll > 100 ) setting_speed_scroll = 100; window_redrawRequest = 1; } void fun_menuHelp_help() { fun_showHelpDialog(10, 0); } void fun_menuHelp_about() { fun_showHelpDialog(0, 0); } void fun_menuHelp_cycleMouseHelp() { if ( setting_mouse_tooltips == 2 ) { setting_mouse_tooltips = 0; menu_help.cycleMouseHelp = 0x1; } else { if ( setting_mouse_tooltips ) { setting_mouse_tooltips = 2; menu_help.cycleMouseHelp = 4; } else { setting_mouse_tooltips = 1; menu_help.cycleMouseHelp = 3; } } keepSubMenuOpen = 1; } void fun_menuHelp_toggleWarnings() { if ( setting_warnings_on ) { setting_warnings_on = 0; menu_help.toggleWarnings = 5; } else { setting_warnings_on = 1; menu_help.toggleWarnings = 6; } keepSubMenuOpen = 1; } void unused_menuSettings_toggleAutoClear() { if ( setting_autoclear_on ) { setting_autoclear_on = 0; *((_WORD *)&menu_options + 25) = 4; } else { setting_autoclear_on = 1; *((_WORD *)&menu_options + 25) = 5; } keepSubMenuOpen = 1; } void unused_4070A0() { fun_writeToC3mapsBmp(setting_map_start); unused_40F450(); window_redrawRequest = 1; } void unused_4070E0() { ; } void unused_407100() { ; } void fun_dialogCckSelection_scrollUpDown() { if ( filelist_numFiles > 15 ) { if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) { if ( filelist_scrollPosition + 15 >= filelist_numFiles ) return; ++filelist_scrollPosition; } } else { if ( filelist_scrollPosition <= 0 ) return; --filelist_scrollPosition; } window_redrawRequest = 2; } } signed int fun_dialogCckSelection_scrollbarClick() { signed int result; // eax@2 int v1; // ST60_4@15 int v2; // [sp+4Ch] [bp-10h]@5 int v3; // [sp+50h] [bp-Ch]@13 if ( filelist_numFiles > 15 ) { if ( mouse_isLeftClick ) { v2 = filelist_numFiles - 15; if ( mouseclick_x >= screen_640x480_x + 280 ) { if ( mouseclick_x <= screen_640x480_x + 312 ) { if ( mouseclick_y >= screen_640x480_y + 245 ) { if ( mouseclick_y <= screen_640x480_y + 434 ) { v3 = mouseclick_y - (screen_640x480_y + 245); if ( mouseclick_y - (screen_640x480_y + 245) > 164 ) v3 = 164; v1 = getPercentage(v3, 164); filelist_scrollPosition = fun_adjustWithPercentage(v2, v1); window_redrawRequest = 2; result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void fun_dialogCckSelection_select() { if ( currentButton_parameter < filelist_numFiles ) { dword_9DA8B8 = currentButton_parameter + filelist_scrollPosition; fun_memset(currentScenarioFilename, 64, 0); strcpy(currentScenarioFilename, &findfiles_filenames[65 * dword_9DA8B8]); fun_removeFileExtension(currentScenarioFilename); fun_strncpy("map", current_fileExtension, 3); fun_appendFileExtension(currentScenarioFilename); fun_loadScenarioFile(currentScenarioFilename); memcpy(&map_settings_startYear, &scn_settings_startYear, 1720); fun_removeFileExtension(currentScenarioFilename); window_redrawRequest = 1; } } void fun_numericInput_number() { signed int maxLength; // [sp+4Ch] [bp-4h]@2 if ( numericInput_valueType == 1 ) // byte maxLength = 3; else maxLength = 5; if ( numericInput_numDigits < maxLength ) { numericInput_value *= 10; numericInput_value += currentButton_parameter; ++numericInput_numDigits; window_redrawRequest = 1; fun_playInterfaceButtonSound(4); } } void fun_numericInput_ok() { signed int v0; // [sp+4Ch] [bp-4h]@3 if ( numericInput_valueType != 1 || *numericInput_valueByte >= 0 ) { if ( numericInput_valueType != 2 || *numericInput_valueShort >= 0 ) { if ( numericInput_valueType != 4 || *numericInput_valueInt >= 0 ) v0 = 1; else v0 = -1; } else { v0 = -1; } } else { v0 = -1; } switch ( numericInput_valueType ) { case 1: *numericInput_valueByte = numericInput_value; break; case 2: *numericInput_valueShort = numericInput_value; break; case 4: *numericInput_valueInt = numericInput_value; break; } if ( numericInput_valueType == 1 ) { if ( *numericInput_valueByte >= 0 || v0 != 1 ) { if ( *numericInput_valueByte > 0 ) { if ( v0 == -1 ) *numericInput_valueByte = -*numericInput_valueByte; } } else { *numericInput_valueByte = -*numericInput_valueByte; } } if ( numericInput_valueType == 2 ) { if ( *numericInput_valueShort >= 0 || v0 != 1 ) { if ( *numericInput_valueShort > 0 ) { if ( v0 == -1 ) *numericInput_valueShort = -*numericInput_valueShort; } } else { *numericInput_valueShort = -*numericInput_valueShort; } } if ( numericInput_valueType == 4 ) { if ( *numericInput_valueInt >= 0 || v0 != 1 ) { if ( *numericInput_valueInt > 0 ) { if ( v0 == -1 ) *numericInput_valueInt = -*numericInput_valueInt; } } else { *numericInput_valueInt = -*numericInput_valueInt; } } if ( numericInput_extraParam == 1 ) { --loadFromBmp_input; if ( loadFromBmp_input >= 0 ) { if ( loadFromBmp_input <= 33 ) { setting_map_start = loadFromBmp_input; fun_loadFromC3mapsBmp(setting_map_start); setting_map_camera_x = 76; setting_map_camera_y = 152; } } } if ( numericInput_extraParam == 2 ) fun_copyEmpireData(editEmpire_copyDataValue - 1); window_id = numericInput_fromWindow; window_redrawRequest = 1; } void fun_numericInput_cancel() { window_id = numericInput_fromWindow; window_redrawRequest = 1; } void fun_showNumericInputDialog(int x, int y, int valueType, char *valueByte, __int16 *valueShort, int *valueInt, int a7) { numericInput_x = x; numericInput_y = y; numericInput_valueType = valueType; numericInput_extraParam = a7; numericInput_valueByte = valueByte; numericInput_valueShort = valueShort; numericInput_valueInt = valueInt; numericInput_fromWindow = window_id; numericInput_value = 0; numericInput_numDigits = 0; window_id = W_NumericInputDialog; } void fun_selectList_select() { switch ( selectList_valueType ) { case 1: *selectList_valueByte = currentButton_parameter; break; case 2: *selectList_valueShort = currentButton_parameter; break; case 4: *selectList_valueInt = currentButton_parameter; break; } if ( selectList_extraParameter == 2 ) { if ( mapsize <= 5 ) fun_createNewScenario(mapsize); } window_id = selectList_fromWindow; dword_660B90 = 20; window_redrawRequest = 1; } void fun_showSelectListDialog(int x, int y, int numItems, int group, char *valueByte, __int16 *valueShort, int *valueInt, int extraParam, int a9) { selectList_x = x; selectList_y = y; selectList_valueInt = valueInt; selectList_valueShort = valueShort; selectList_valueByte = valueByte; selectList_valueType = a9; selectList_numItems = numItems; selectList_group = group; selectList_extraParameter = extraParam; dword_660B90 = 20; selectList_fromWindow = window_id; window_id = W_SelectListDialog; } void fun_sidePanel_build() { window_id = 6; buildmenu.selectedSubMenu = currentButton_parameter; if ( buildmenu.selectedSubMenu == 1 ) { if ( debug_houseEvolution == 1 ) buildmenu.selectedSubMenu = 13; } buildmenu.submenuNumItems = fun_countBuildingSubMenuItems(); buildmenu_X = buildmenu.xOffsets[buildmenu.submenuNumItems]; buildmenu_Y = buildmenu.yOffsets[buildmenu.submenuNumItems]; if ( buildmenu.selectedSubMenu == 2 || buildmenu.selectedSubMenu == 3 || buildmenu.selectedSubMenu == 1 ) { currentButton_parameter = 1; fun_editorPanel_buttonClick(); } window_redrawRequest = 1; } int fun_sidePanel_submenuClick() { int submenu_yOffset; // [sp+4Ch] [bp-10h]@5 int submenu_xOffset; // [sp+50h] [bp-Ch]@1 int submenuParam; // [sp+54h] [bp-8h]@5 int i; // [sp+58h] [bp-4h]@5 submenu_xOffset = cityscreen_width_withControlpanel - 258; if ( sidepanel_collapsed == 1 ) submenu_xOffset = cityscreen_width_withoutControlpanel - 258; if ( mode_editor == 1 ) submenu_xOffset = cityscreen_width_withControlpanel - 258; submenu_yOffset = buildmenu_X + 110; mouseover_button_id = fun_isCustomButtonClick( submenu_xOffset, buildmenu_X + 110, &buttons_editorPanel, buildmenu.submenuNumItems); submenuParam = -1; for ( i = 0; ; ++i ) { if ( i >= buildmenu.submenuNumItems ) return 0; submenuParam = fun_sidePanel_submenuGetNextIndex(buildmenu.selectedSubMenu - 1, submenuParam); if ( submenu_xOffset + *(&buttons_editorPanel.xStart + 14 * i) <= mouseclick_x ) { if ( submenu_xOffset + *(&buttons_editorPanel.xEnd + 14 * i) > mouseclick_x && submenu_yOffset + *(&buttons_editorPanel.yStart + 14 * i) <= mouseclick_y && submenu_yOffset + *(&buttons_editorPanel.yEnd + 14 * i) > mouseclick_y && byte_660B94[0] ) break; } } currentButton_parameter = submenuParam + 1; if ( byte_660B94[0] ) fun_editorPanel_buttonClick(); return submenuParam + 1; } int fun_sidePanel_submenuGetNextIndex(int submenuId, int start) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = start + 1; i < 30; ++i ) { if ( *(int *)((char *)&buildingMenu_buildingId[30 * submenuId] + 4 * i) <= 0 ) return 0; if ( *(int *)((char *)&buildingMenu_enabled[30 * submenuId] + 4 * i) ) return i; } return 0; } int fun_countBuildingSubMenuItems() { int v1; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 v1 = 0; for ( i = 0; i < 30 && *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * i) > 0; ++i ) { if ( *(int *)((char *)&buildingMenu_enabled[30 * (buildmenu.selectedSubMenu - 1)] + 4 * i) ) ++v1; } return v1; } void fun_enableAllBuildingMenuItems() { signed int j; // [sp+4Ch] [bp-8h]@3 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 30; ++i ) { for ( j = 0; j < 30; ++j ) buildingMenu_enabled[i][j] = 1; } } void fun_enableBuildingMenuItems() { BuildingType buildingId; // [sp+4Ch] [bp-Ch]@5 signed int j; // [sp+50h] [bp-8h]@3 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < 30; ++i ) { for ( j = 0; j < 30; ++j ) { buildingId = buildingMenu_buildingId[i][j]; buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ReservoirSimon ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Aqueduct ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Fountain ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Barber ) { if ( scn_allow_barber ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Bathhouse ) { if ( scn_allow_bathhouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Doctor ) { if ( scn_allow_doctor ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Hospital ) { if ( scn_allow_hospital ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_SmallTemples ) { if ( scn_allow_smallTemples ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_LargeTemples ) { if ( scn_allow_largeTemples ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Oracle ) { if ( scn_allow_oracle ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_School ) { if ( scn_allow_school ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Academy ) { if ( scn_allow_academy ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Library ) { if ( scn_allow_library ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Theater ) { if ( scn_allow_theater ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Amphitheater ) { if ( scn_allow_amphitheater ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Colosseum ) { if ( scn_allow_colosseum ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Hippodrome ) { if ( scn_allow_hippodrome ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_GladiatorSchool ) { if ( scn_allow_gladiatorSchool ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_LionHouse ) { if ( scn_allow_lionHouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ActorColony ) { if ( scn_allow_actorColony ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ChariotMaker ) { if ( scn_allow_chariotMaker ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Forum ) { if ( scn_allow_forum ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SenateUpgraded ) { if ( scn_allow_senate ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_GovernorsHouse ) { if ( scn_allow_governorHome ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_GovernorsVilla ) { if ( scn_allow_governorHome ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_GovernorsPalace ) { if ( scn_allow_governorHome ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SmallStatue ) { if ( scn_allow_statues ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_MediumStatue ) { if ( scn_allow_statues ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_LargeStatue ) { if ( scn_allow_statues ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Gardens ) { if ( scn_allow_gardens ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Plaza ) { if ( scn_allow_plaza ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_EngineersPost ) { if ( scn_allow_engineersPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_MissionPost ) { if ( scn_allow_missionPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Shipyard ) { if ( scn_allow_wharves ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Dock ) { if ( scn_allow_dock ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Wharf ) { if ( scn_allow_wharves ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Wall ) { if ( scn_allow_wall ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Tower ) { if ( scn_allow_tower ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Gatehouse ) { if ( scn_allow_gatehouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_FortGround__ ) { if ( scn_allow_fort ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_MilitaryAcademy ) { if ( scn_allow_militaryAcademy ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Barracks ) { if ( scn_allow_barracks ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_DistributionCenter_Unused ) { if ( scn_allow_distributionCenter ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Farms ) { if ( scn_allow_farms ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_RawMaterials ) { if ( scn_allow_rawMaterials ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Workshops ) { if ( scn_allow_workshops ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Granary ) { if ( scn_allow_granary ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Warehouse ) { if ( scn_allow_warehouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_LowBridge ) { if ( scn_allow_bridges ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ShipBridge ) { if ( scn_allow_bridges ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_TriumphalArch ) { if ( city_inform[ciid].availableTriumphalArches > city_inform[ciid].placedTriumphalArches ) buildingMenu_enabled[i][j] = 1; } if ( setting_currentMissionId ) { if ( setting_currentMissionId == 1 ) { if ( tutorial2_granaryBuilt ) { if ( tutorial2_population250reached ) { if ( tutorial2_population450reached ) { if ( !tutorial2_potteryMade ) { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ReservoirSimon ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Aqueduct ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Fountain ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_EngineersPost ) { if ( scn_allow_engineersPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Farms ) { if ( scn_allow_farms ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_RawMaterials ) { if ( scn_allow_rawMaterials ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Workshops ) { if ( scn_allow_workshops ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Warehouse ) { if ( scn_allow_warehouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Granary ) { if ( scn_allow_granary ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Gardens ) { if ( scn_allow_gardens ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Forum ) { if ( scn_allow_forum ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SenateUpgraded ) { if ( scn_allow_senate ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ActorColony ) { if ( scn_allow_actorColony ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Theater ) { if ( scn_allow_theater ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_SmallTemples ) { if ( scn_allow_smallTemples ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Bathhouse ) { if ( scn_allow_bathhouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_School ) { if ( scn_allow_school ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Amphitheater ) { if ( scn_allow_amphitheater ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_GladiatorSchool ) { if ( scn_allow_gladiatorSchool ) buildingMenu_enabled[i][j] = 1; } } } else { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ReservoirSimon ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Aqueduct ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Fountain ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_EngineersPost ) { if ( scn_allow_engineersPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Farms ) { if ( scn_allow_farms ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Granary ) { if ( scn_allow_granary ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Gardens ) { if ( scn_allow_gardens ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SenateUpgraded ) { if ( scn_allow_senate ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ActorColony ) { if ( scn_allow_actorColony ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Theater ) { if ( scn_allow_theater ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_SmallTemples ) { if ( scn_allow_smallTemples ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Bathhouse ) { if ( scn_allow_bathhouse ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_School ) { if ( scn_allow_school ) buildingMenu_enabled[i][j] = 1; } } } else { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ReservoirSimon ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Aqueduct ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Fountain ) { if ( scn_allow_aqueduct ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_EngineersPost ) { if ( scn_allow_engineersPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Farms ) { if ( scn_allow_farms ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Granary ) { if ( scn_allow_granary ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SenateUpgraded ) { if ( scn_allow_senate ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_SmallTemples ) { if ( scn_allow_smallTemples ) buildingMenu_enabled[i][j] = 1; } } } else { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_EngineersPost ) { if ( scn_allow_engineersPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Granary ) { if ( scn_allow_granary ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_Farms ) { if ( scn_allow_farms ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SenateUpgraded ) { if ( scn_allow_senate ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Menu_SmallTemples ) { if ( scn_allow_smallTemples ) buildingMenu_enabled[i][j] = 1; } } } } else { if ( tutorial1_fire || tutorial1_crime ) { if ( tutorial1_prefectureBuilt ) { if ( !tutorial1_senateEngineerBuilt ) { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_EngineersPost ) { if ( scn_allow_engineersPost ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_SenateUpgraded ) { if ( scn_allow_senate ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } } } else { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Prefecture ) { if ( scn_allow_prefecture ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Market ) { if ( scn_allow_market ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } } } else { buildingMenu_enabled[i][j] = i >= 12; if ( buildingId >= B_HouseVacantLot ) { if ( buildingId <= B_HouseLuxuryPalace ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_Well ) { if ( scn_allow_well ) buildingMenu_enabled[i][j] = 1; } if ( buildingId == B_ClearLand ) buildingMenu_enabled[i][j] = 1; if ( buildingId == B_Road ) { if ( scn_allow_road ) buildingMenu_enabled[i][j] = 1; } } } if ( buildingId == B_WheatFarm ) { if ( !cityCanProduceGoodNow(G_Wheat) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_VegetableFarm ) { if ( !cityCanProduceGoodNow(G_Vegetables) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_FruitFarm ) { if ( !cityCanProduceGoodNow(G_Fruit) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_OliveFarm ) { if ( !cityCanProduceGoodNow(G_Olives) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_VinesFarm ) { if ( !cityCanProduceGoodNow(G_Vines) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_PigFarm ) { if ( !cityCanProduceGoodNow(G_MeatFish) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_ClayPit ) { if ( !cityCanProduceGoodNow(G_Clay) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_MarbleQuarry ) { if ( !cityCanProduceGoodNow(G_Marble) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_IronMine ) { if ( !cityCanProduceGoodNow(G_Iron) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_TimberYard ) { if ( !cityCanProduceGoodNow(G_Timber) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_WineWorkshop ) { if ( !fun_cityCanProduceGood(G_Wine) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_OilWorkshop ) { if ( !fun_cityCanProduceGood(G_Oil) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_WeaponsWorkshop ) { if ( !fun_cityCanProduceGood(G_Weapons) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_FurnitureWorkshop ) { if ( !fun_cityCanProduceGood(G_Furniture) ) buildingMenu_enabled[i][j] = 0; } if ( buildingId == B_PotteryWorkshop ) { if ( !fun_cityCanProduceGood(G_Pottery) ) buildingMenu_enabled[i][j] = 0; } } } } int fun_countOverlaySubmenuItems(int submenuId) { int amount; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 amount = 0; for ( i = 0; i < 30 && *(int *)((char *)&overlaySubMenuIDToOverlayID[30 * submenuId] + 4 * i) > 0; ++i ) ++amount; return amount; } void fun_enableSidebarButtons() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 12; ++i ) { imagebuttons_sidebar_build[i].state_enabled = 1; buildmenu.selectedSubMenu = imagebuttons_sidebar_build[i].parameter1; if ( fun_countBuildingSubMenuItems() <= 0 ) imagebuttons_sidebar_build[i].state_enabled = 0; imagebuttons_sidebar_buildCollapsed[i].state_enabled = 1; buildmenu.selectedSubMenu = imagebuttons_sidebar_buildCollapsed[i].parameter1; if ( fun_countBuildingSubMenuItems() <= 0 ) imagebuttons_sidebar_buildCollapsed[i].state_enabled = 0; } } void fun_editorPanel_buttonClick() { dword_9DA908 = 0; dword_9DA828 = dword_9DA908; dword_9DA7C4 = dword_9DA828; dword_9DA8B4 = dword_9DA7C4; dword_9DA800 = dword_9DA8B4; dword_8B460C = time_current; dword_9363AC = 0; dword_8C79EC = 0; if ( buildmenu.selectedSubMenu != 14 ) { if ( buildmenu.selectedSubMenu != 15 ) { switch ( buildmenu.selectedSubMenu ) { case 18: // river entry/exit point window_id = 1; if ( currentButton_parameter == 1 ) { dword_9DA804 = 18; toPlace_buildingType = (BuildingType)130; } else { if ( currentButton_parameter == 2 ) { dword_9DA804 = 19; toPlace_buildingType = (BuildingType)131; } } window_redrawRequest = 1; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; break; case 19: // native window_id = 1; switch ( currentButton_parameter ) { case 1: dword_9DA804 = 21; toPlace_buildingType = B_NativeHut; break; case 2: dword_9DA804 = 22; toPlace_buildingType = B_NativeMeeting; break; case 3: dword_9DA804 = 23; toPlace_buildingType = B_NativeCrops; break; } window_redrawRequest = 1; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; break; case 26: if ( currentButton_parameter > 8 ) // herd point { dword_9DA804 = 25; toPlace_buildingType = (BuildingType)133; dword_9DA910 = currentButton_parameter - 8; } else { // fishing point dword_9DA804 = 24; toPlace_buildingType = (BuildingType)132; dword_9DA810 = currentButton_parameter; } window_id = 1; window_redrawRequest = 1; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; break; case 17: // invasion point dword_9DA804 = 13; toPlace_buildingType = B_invasion_type; toPlace_invasionPointId = currentButton_parameter; window_id = 1; window_redrawRequest = 1; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; break; case 16: window_id = 1; // raise/lower land, access ramp? switch ( currentButton_parameter ) { case 1: dword_9DA804 = 11; toPlace_buildingType = (BuildingType)123; break; case 2: dword_9DA804 = 12; toPlace_buildingType = (BuildingType)124; break; case 3: dword_9DA804 = 9; toPlace_buildingType = (BuildingType)129; break; } window_redrawRequest = 1; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; break; default: toPlace_buildingType = buildmenu.dword_5F453C[buildmenu.selectedSubMenu - 1][currentButton_parameter]; if ( toPlace_buildingType != B_Menu_Farms && toPlace_buildingType != B_Menu_RawMaterials && toPlace_buildingType != B_Menu_Workshops ) { if ( toPlace_buildingType != B_Menu_SmallTemples && toPlace_buildingType != B_Menu_LargeTemples && toPlace_buildingType != B_FortGround__ ) { switch ( toPlace_buildingType ) { case B_WheatFarm: dword_9DA800 = 1; break; case B_VegetableFarm: dword_9DA800 = 1; break; case B_FruitFarm: dword_9DA800 = 1; break; case B_OliveFarm: dword_9DA800 = 1; break; case B_VinesFarm: dword_9DA800 = 1; break; case B_PigFarm: dword_9DA800 = 1; break; case B_MarbleQuarry: dword_9DA8B4 = 1; break; case B_IronMine: dword_9DA8B4 = 1; break; case B_TimberYard: dword_9DA7C4 = 1; break; case B_ClayPit: dword_9DA828 = 1; break; case B_Gatehouse: dword_9363AC = 1; break; case B_TriumphalArch: dword_9363AC = 1; break; case B_Tower: dword_9DA908 = 1; break; } window_id = 1; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; window_redrawRequest = 1; } else { switch ( toPlace_buildingType ) { case B_Menu_SmallTemples: buildmenu.selectedSubMenu = 23; break; case B_Menu_LargeTemples: buildmenu.selectedSubMenu = 24; break; case B_FortGround__: buildmenu.selectedSubMenu = 25; break; } buildmenu.submenuNumItems = fun_countBuildingSubMenuItems(); buildmenu_X = buildmenu.xOffsets[buildmenu.submenuNumItems]; buildmenu_Y = buildmenu.yOffsets[buildmenu.submenuNumItems]; toPlace_buildingType = B_none_building; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; window_redrawRequest = 1; } } else { switch ( toPlace_buildingType ) { case B_Menu_Farms: buildmenu.selectedSubMenu = 20; break; case B_Menu_RawMaterials: buildmenu.selectedSubMenu = 21; break; case B_Menu_Workshops: buildmenu.selectedSubMenu = 22; break; } buildmenu.submenuNumItems = fun_countBuildingSubMenuItems(); buildmenu_X = buildmenu.xOffsets[buildmenu.submenuNumItems]; buildmenu_Y = buildmenu.yOffsets[buildmenu.submenuNumItems]; toPlace_buildingType = B_none_building; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; window_redrawRequest = 1; } break; } } } } signed int sub_40A700() { signed int res; // [sp+4Ch] [bp-4h]@1 res = 0; if ( window_id != 1 ) res = 1; if ( toPlace_buildingType ) res = 1; window_id = 1; toPlace_buildingType = B_none_building; dword_9DA918 = 0; toPlace_xPos = 0; dword_9DA884 = toPlace_xPos; toPlace_yPos = 0; dword_9DA880 = toPlace_yPos; window_redrawRequest = 1; return res; } void sub_40A7B0() { if ( dword_8C79EC ) { if ( !setting_game_paused ) { dword_9DA884 = setting_map_x; toPlace_xPos = dword_9DA884; dword_9DA880 = setting_map_y; toPlace_yPos = dword_9DA880; dword_9DA808 = 162 * setting_map_y + setting_map_x + setting_map_startGridOffset; dword_8EFAE8 = grid_elevation[dword_9DA808]; if ( sub_490B40() ) { dword_9DA918 = 1; if ( toPlace_buildingType == B_Road ) sub_503000(1, dword_9DA884, dword_9DA880, 0); if ( toPlace_buildingType == B_Wall ) sub_503EA0(1, dword_9DA884, dword_9DA880); if ( toPlace_buildingType == B_Aqueduct ) sub_503000(1, dword_9DA884, dword_9DA880, 1); if ( toPlace_buildingType == B_ReservoirSimon ) sub_503000(1, dword_9DA884, dword_9DA880, 1); } } } } void sub_40A930() { if ( dword_9DA918 ) { if ( dword_8C79EC ) { dword_8C7A0C = dword_8C79EC; toPlace_xPos = setting_map_x; toPlace_yPos = setting_map_y; if ( mode_editor ) { switch ( toPlace_buildingType ) { case B_Road: sub_472C90(dword_9DA884, dword_9DA880, toPlace_xPos, toPlace_yPos, toPlace_buildingType); break; case B_NativeHut: sub_472C90(dword_9DA884, dword_9DA880, toPlace_xPos, toPlace_yPos, toPlace_buildingType); break; case B_NativeMeeting: sub_472C90(dword_9DA884, dword_9DA880, toPlace_xPos, toPlace_yPos, toPlace_buildingType); break; case B_NativeCrops: sub_472C90(dword_9DA884, dword_9DA880, toPlace_xPos, toPlace_yPos, toPlace_buildingType); break; default: fun_placeEditorBuilding(toPlace_xPos, toPlace_yPos); break; } } else { sub_472C90(dword_9DA884, dword_9DA880, toPlace_xPos, toPlace_yPos, toPlace_buildingType); } } } } void sub_40AB00() { if ( mode_editor == 1 ) sub_5001A0(); switch ( toPlace_buildingType ) { case 123: sub_47C3D0(); dword_9DA918 = 0; break; case 124: sub_47C3D0(); dword_9DA918 = 0; break; case 129: sub_47C3D0(); dword_9DA918 = 0; break; default: if ( dword_9DA918 ) { dword_9DA918 = 0; if ( !dword_8C79EC ) dword_8C79EC = dword_8C7A0C; if ( toPlace_buildingType > 0 ) fun_playInterfaceButtonSound(4); fun_placeBuilding( ciid, setting_map_orientation, dword_9DA884, dword_9DA880, toPlace_xPos, toPlace_yPos, toPlace_buildingType); } break; } } void sub_40AC20() { setting_map_y = 0; setting_map_x = setting_map_y; dword_8C79EC = sub_42DE10(); if ( dword_8C79EC ) { setting_map_x = (dword_8C79EC - setting_map_startGridOffset) % 162; setting_map_y = (dword_8C79EC - setting_map_startGridOffset) / 162; } } void fun_sidePanel_undo() { fun_performUndo(); window_redrawRequest = 1; } void fun_sidePanel_messages() { sub_4DE430(); } void fun_sidePanel_gotoProblem() { DWORD v0; // [sp+50h] [bp-4h]@3 if ( currentButton_parameter ) { v0 = timeGetTime(); if ( (v0 - dword_65DE0C) > 3000 ) dword_659F68 = 0; dword_65DE0C = v0; sub_4DF8B0(); window_redrawRequest = 1; } } void fun_menuResets_clearHerds() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 for ( i = 0; i < 4; ++i ) map_herd_x[i] = -1; for ( j = 0; j < 4; ++j ) map_herd_y[j] = -1; } void fun_menuResets_clearFish() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 for ( i = 0; i < 8; ++i ) map_fish_x[i] = -1; for ( j = 0; j < 8; ++j ) map_fish_y[j] = -1; } void fun_menuResets_clearInvasions() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 for ( i = 0; i < 8; ++i ) map_invasionPoints_x[i] = -1; for ( j = 0; j < 8; ++j ) map_invasionPoints_y[j] = -1; } void fun_minimap_hasBeenClicked() { minimap_clicked = 0; if ( mouseclick_x >= minimap_left ) { if ( mouseclick_x < minimap_right ) { if ( mouseclick_y >= minimap_top ) { if ( mouseclick_y < minimap_bottom ) minimap_clicked = 1; } } } } void fun_minimap_handleClick() { int v0; // [sp+54h] [bp-8h]@7 if ( minimap_clicked == 1 ) { if ( byte_660B94[0] || is_right_click ) { if ( mode_editor ) v0 = sub_43F750(cityscreen_width_withControlpanel + 8, 30, 73, 111); else v0 = sub_43F750(cityscreen_width_withControlpanel + 8, 59, 73, 111); if ( v0 > 0 ) fun_gotoGridOffset(v0); } } } void fun_topmenu_isFundsPopDateHit() { topmenu_fundsPopDateHit = 0; if ( mouseclick_y >= 4 ) { if ( mouseclick_y < 18 ) { if ( mouseclick_x > topmenu_offsetFunds ) { if ( mouseclick_x < topmenu_offsetFunds + 128 ) topmenu_fundsPopDateHit = 1; } if ( mouseclick_x > topmenu_offsetPopulation ) { if ( mouseclick_x < topmenu_offsetPopulation + 128 ) topmenu_fundsPopDateHit = 2; } if ( mouseclick_x > topmenu_offsetDate ) { if ( mouseclick_x < topmenu_offsetDate + 128 ) topmenu_fundsPopDateHit = 3; } } } } void fun_debug_toggleHousingEvolveInfo() { debug_showHousingEvolveInfo = debug_showHousingEvolveInfo != 1; window_redrawRequest = 1; } void fun_buildingInfo_granary_specialOrders() { storage_specialOrdersShown = 1; window_redrawRequest = 1; } void fun_buildingInfo_storage_toggleGood() { int storageId; // [sp+4Ch] [bp-Ch]@1 int index; // [sp+54h] [bp-4h]@2 storageId = buildings[currentlySelectedBuilding].storageId; if ( buildings[currentlySelectedBuilding].type == B_Warehouse ) index = goodlist_indexToResourceId[currentButton_parameter]; else index = foodlist_indexToResourceId[currentButton_parameter]; if ( storages[storageId].resourceState[index] ) { if ( storages[storageId].resourceState[ index] == 1 ) storages[storageId].resourceState[ index] = 2; else storages[storageId].resourceState[ index] = 0; } else { storages[storageId].resourceState[ index] = 1; } window_redrawRequest = 1; } void fun_buildingInfo_warehouse_specialOrders() { storage_specialOrdersShown = 1; window_redrawRequest = 1; } void fun_buildingInfo_granaryOrders_click() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = buildings[currentlySelectedBuilding].storageId; if ( storages[v0].emptyAll ) storages[v0].emptyAll = 0; else storages[v0].emptyAll = 1; window_redrawRequest = 1; } void fun_buildingInfo_warehouseOrders_click() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = buildings[currentlySelectedBuilding].storageId; if ( currentButton_parameter == 1 ) { city_inform[ciid].tradeCenterId = currentlySelectedBuilding; } else { if ( storages[v0].emptyAll ) storages[v0].emptyAll = 0; else storages[v0].emptyAll = 1; } window_redrawRequest = 1; } void fun_walkerInfo_selectWalker() { walkerInfo_index = currentButton_parameter; fun_playWalkerInfoSound(); window_redrawRequest = 1; } void fun_fortInfo_formation() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentFormationID; if ( !formations[currentFormationID].formation_60) { if ( currentButton_parameter || dword_64E360 >= 5 ) { if ( currentButton_parameter != 1 || dword_64E360 >= 4 ) { if ( currentButton_parameter == 4 ) { if ( formations[currentFormationID].layout != 6 ) formations[currentFormationID].formation_5a = formations[currentFormationID].layout; } if ( formations[v0].walkerType == 13 ) { if ( currentButton_parameter ) { switch ( currentButton_parameter ) { case 1: formations[v0].layout = 0; break; case 2: formations[v0].layout = 1; break; case 3: formations[v0].layout = 2; break; case 4: formations[v0].layout = 6; break; } } else { formations[v0].layout = 5; } } else { if ( currentButton_parameter ) { switch ( currentButton_parameter ) { case 1: formations[v0].layout = 4; break; case 2: formations[v0].layout = 1; break; case 3: formations[v0].layout = 2; break; case 4: formations[v0].layout = 6; break; } } else { formations[v0].layout = 3; } } if ( currentButton_parameter ) { switch ( currentButton_parameter ) { case 1: fun_playSound("wavs\\cohort2.wav", 1, 0); break; case 2: fun_playSound("wavs\\cohort3.wav", 1, 0); break; case 3: fun_playSound("wavs\\cohort4.wav", 1, 0); break; case 4: fun_playSound("wavs\\cohort5.wav", 1, 0); break; } } else { fun_playSound("wavs\\cohort1.wav", 1, 0); } selectedLegionId = v0; window_id = 30; window_redrawRequest = 1; } } } } void fun_fortInfo_returnToFort() { if ( !formations[currentFormationID].formation_60 ) { if ( formations[currentFormationID].f03_flag != 1 ) { sub_4BA850(currentFormationID); fun_playSound("wavs\\cohort5.wav", 1, 0); window_id = 1; window_redrawRequest = 1; } } } void fun_dialogRightClickInfo_help() { if ( dialog_help_id > 0 ) fun_showHelpDialog(dialog_help_id, 0); else fun_showHelpDialog(10, 0); window_redrawRequest = 1; } void fun_dialogRightClickInfo_ok() { if ( storage_specialOrdersShown ) storage_specialOrdersShown = 0; else window_id = 1; window_redrawRequest = 1; } void fun_dialogResourceSettings_help() { fun_showHelpDialog(46, 1); window_redrawRequest = 1; } void fun_dialogResourceSettings_ok() { window_id = W_Advisors; window_redrawRequest = 1; } void fun_windowAdvisors_help() { if ( currentAdvisor > 0 ) { if ( currentAdvisor < 13 ) { fun_showHelpDialog(help_ids_advisors[currentAdvisor], 1); window_redrawRequest = 1; } } } void fun_topmenu_rightClick() { switch ( topmenu_fundsPopDateHit ) { case 1: // funds fun_showHelpDialog(15, 0); break; case 2: // population fun_showHelpDialog(16, 0); break; case 3: // date fun_showHelpDialog(17, 0); break; } window_redrawRequest = 1; } void fun_sidePanel_help() { fun_showHelpDialog(currentButton_parameter2, 0); window_redrawRequest = 1; } void fun_debugToggleHouseEvolution() { if ( debug_houseEvolution ) { debug_houseEvolution = 0; showWarning(6); } else { debug_houseEvolution = 1; showWarning(5); } } void fun_debugToggleRoadEvolution() { if ( debug_roadEvolution ) { debug_roadEvolution = 0; showWarning(8); } else { debug_roadEvolution = 1; showWarning(7); } } void fun_debugToggleShowPeople() { if ( debug_showPeople ) { debug_showPeople = 0; showWarning(10); } else { debug_showPeople = 1; showWarning(9); } } void fun_editor_editEmpire_general_click() { if ( currentButton_parameter == 8 ) // "OK" { fun_toggleEmpireMap(); } else { if ( currentButton_parameter != 2 || edit_empire_max_inUse > 0 ) { if ( currentButton_parameter == 3 ) { fun_editor_empire_clearEmpireEntry(currentEmpireEntryId); fun_calculateDistantBattleRomanTravelTime(0); fun_calculateDistantBattleEnemyTravelTime(0); fun_editor_empire_determineMaxEntryInUse(); currentButton_parameter = 0; fun_editor_editEmpire_nextPrevEmpireArrowButtons(); } else { editEmpire_selectedObjectButton = currentButton_parameter; if ( editEmpire_selectedObjectButton == 2 ) { if ( empire[currentEmpireEntryId].inUse ) { if ( map_empireExpanded ) editEmpire_addObjectGraphicID = empire[currentEmpireEntryId].graphicID_exp; else editEmpire_addObjectGraphicID = empire[currentEmpireEntryId].graphicID; } } window_redrawRequest = 1; } } } } void fun_editor_editEmpire_copyData() { fun_showNumericInputDialog(200, 200, 4, 0, 0, &editEmpire_copyDataValue, 2); window_redrawRequest = 1; } void fun_editor_editEmpire_expansionYear() { fun_showNumericInputDialog(200, 200, 4, 0, 0, &map_empireExpansionYear, 0); window_redrawRequest = 1; } void fun_editor_editEmpire_toggleExpanded() { if ( map_empireExpanded ) { map_empireExpanded = 0; } else { map_empireExpanded = 1; fun_fillExpandedEmpireFields(); } if ( empire[currentEmpireEntryId].inUse ) { if ( map_empireExpanded ) editEmpire_addObjectGraphicID = empire[currentEmpireEntryId].graphicID_exp; else editEmpire_addObjectGraphicID = empire[currentEmpireEntryId].graphicID; } window_redrawRequest = 1; } void fun_editor_editEmpire_graphicArrowButtons() { signed int v0; // [sp+4Ch] [bp-1Ch]@1 int v1; // [sp+50h] [bp-18h]@11 signed int v2; // [sp+54h] [bp-14h]@11 int v3; // [sp+5Ch] [bp-Ch]@1 signed int v4; // [sp+60h] [bp-8h]@13 v0 = 0; v3 = editEmpire_addObjectGraphicID; if ( currentButton_parameter == 1 ) { v4 = -1; } else { if ( currentButton_parameter ) { switch ( currentButton_parameter ) { case 2: v4 = -10000; break; case 3: v4 = 1; editEmpire_addObjectGraphicID = 0; v0 = 3; break; case 4: v4 = 1; editEmpire_addObjectGraphicID = 0; v0 = 10000; break; } } else { v4 = 1; } } v1 = 0; v2 = 0; while ( 1 ) { ++v2; if ( v2 > 200 ) break; editEmpire_addObjectGraphicID += v4; if ( v0 ) { if ( !c3_sg2[editEmpire_addObjectGraphicID].unknown_3D ) { if ( !c3_sg2[editEmpire_addObjectGraphicID].data_length || (v1 = editEmpire_addObjectGraphicID, --v0, v0 == 1) ) break; } } else { if ( editEmpire_addObjectGraphicID < 0 ) { editEmpire_addObjectGraphicID = 0; break; } if ( !c3_sg2[editEmpire_addObjectGraphicID].data_length ) { editEmpire_addObjectGraphicID = v3; break; } if ( !c3_sg2[editEmpire_addObjectGraphicID].unknown_3D ) break; } } if ( v0 ) editEmpire_addObjectGraphicID = v1; if ( editEmpire_selectedObjectButton == 2 ) { if ( empire[currentEmpireEntryId].inUse ) { if ( map_empireExpanded ) empire[currentEmpireEntryId].graphicID_exp = editEmpire_addObjectGraphicID; else empire[currentEmpireEntryId].graphicID = editEmpire_addObjectGraphicID; } } window_redrawRequest = 1; } void fun_editor_editEmpire_nextPrevEmpireArrowButtons() { if ( window_id == 21 ) { if ( currentButton_parameter == 1 ) { --currentEmpireEntryId; } else { if ( !currentButton_parameter ) ++currentEmpireEntryId; } if ( currentEmpireEntryId < 0 ) currentEmpireEntryId = 0; if ( currentEmpireEntryId >= edit_empire_max_inUse ) currentEmpireEntryId = edit_empire_max_inUse - 1; if ( empire[currentEmpireEntryId].inUse ) { if ( map_empireExpanded ) editEmpire_addObjectGraphicID = empire[currentEmpireEntryId].graphicID_exp; else editEmpire_addObjectGraphicID = empire[currentEmpireEntryId].graphicID; } window_redrawRequest = 1; } } void fun_editor_editEmpire_something(int a1, int a2) { int v2; // [sp+4Ch] [bp-Ch]@25 signed int height; // [sp+50h] [bp-8h]@27 signed int width; // [sp+54h] [bp-4h]@27 if ( mouse_isLeftClick || byte_65E6C8 ) { if ( mouseclick_x >= empireMapBorderLeftRight ) { if ( mouseclick_x < ddraw_width - 2 * empireMapBorderLeftRight ) { if ( mouseclick_y >= empireMapBorderTop ) { if ( mouseclick_y < ddraw_height - empireMapBorderTop - empireMapBorderBottom ) { if ( !empire[a1].inUse ) { empire[a1].graphicID = editEmpire_addObjectGraphicID; if ( map_empireExpanded ) empire[a1].graphicID_exp = editEmpire_addObjectGraphicID; empire[a1].type = dword_993F04; if ( empire[a1].type == 4 || empire[a1].type == 5 ) empire[a1].tradeRouteId = empireScreen_selectedRouteId; } currentEmpireEntryId = a1; empire[a1].inUse = 1; if ( byte_65E6C8 ) empire[a1].inUse = 2; if ( empire[a1].type == 6 ) fun_calculateDistantBattleRomanTravelTime(0); if ( empire[a1].type == 7 ) fun_calculateDistantBattleEnemyTravelTime(0); if ( map_empireExpanded ) v2 = empire[a1].graphicID_exp; else v2 = empire[a1].graphicID; width = c3_sg2[v2].width; height = c3_sg2[v2].height; if ( map_empireExpanded ) { empire[a1].xCoord_exp = mouseclick_x + (_WORD)empire_scroll_x - (_WORD)empireMapBorderLeftRight - c3_sg2[v2].width / 2; empire[a1].yCoord_exp = mouseclick_y + (_WORD)empire_scroll_y - (_WORD)empireMapBorderTop - height / 2; if ( !a2 ) { empire[a1].xCoord = mouseclick_x + (_WORD)empire_scroll_x - (_WORD)empireMapBorderLeftRight - width / 2; empire[a1].yCoord = mouseclick_y + (_WORD)empire_scroll_y - (_WORD)empireMapBorderTop - height / 2; } } else { empire[a1].xCoord = mouseclick_x + (_WORD)empire_scroll_x - (_WORD)empireMapBorderLeftRight - c3_sg2[v2].width / 2; empire[a1].yCoord = mouseclick_y + (_WORD)empire_scroll_y - (_WORD)empireMapBorderTop - height / 2; } empire[a1].width = width; empire[a1].height = height; editEmpire_isSaved = 0; window_redrawRequest = 1; } } } } } } int fun_editor_editEmpire_something2() { int result; // eax@2 int v1; // [sp+4Ch] [bp-28h]@11 signed int v2; // [sp+50h] [bp-24h]@11 int v3; // [sp+54h] [bp-20h]@22 signed int i; // [sp+58h] [bp-1Ch]@11 int v5; // [sp+5Ch] [bp-18h]@16 int v6; // [sp+60h] [bp-14h]@16 int v7; // [sp+6Ch] [bp-8h]@11 int v8; // [sp+70h] [bp-4h]@11 if ( is_right_click ) { if ( mouseclick_x >= empireMapBorderLeftRight ) { if ( mouseclick_x < ddraw_width - 2 * empireMapBorderLeftRight ) { if ( mouseclick_y >= empireMapBorderTop ) { if ( mouseclick_y < ddraw_height - empireMapBorderTop - empireMapBorderBottom ) { v8 = mouseclick_x + empire_scroll_x - empireMapBorderLeftRight; v7 = mouseclick_y + empire_scroll_y - empireMapBorderTop; v2 = 10000; v1 = 0; for ( i = 0; i < 200 && empire[i].inUse; ++i ) { if ( map_empireExpanded ) { v6 = empire[i].xCoord_exp; v5 = empire[i].yCoord_exp; } else { v6 = empire[i].xCoord; v5 = empire[i].yCoord; } if ( v6 - 8 <= v8 ) { if ( v6 + empire[i].width + 8 > v8 ) { if ( v5 - 8 <= v7 ) { if ( v5 + empire[i].height + 8 > v7 ) { v3 = fun_getDistanceMaximum( v8, v7, empire[i].width / 2 + v6, empire[i].height / 2 + v5); if ( v3 < v2 ) { v2 = v3; v1 = i + 1; } } } } } } window_redrawRequest = 1; result = v1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int fun_editor_editEmpire_something3() { signed int result; // eax@2 int v1; // [sp+4Ch] [bp-28h]@11 signed int v2; // [sp+50h] [bp-24h]@11 int v3; // [sp+54h] [bp-20h]@22 signed int i; // [sp+58h] [bp-1Ch]@11 int v5; // [sp+5Ch] [bp-18h]@16 int v6; // [sp+60h] [bp-14h]@16 int v7; // [sp+6Ch] [bp-8h]@11 int v8; // [sp+70h] [bp-4h]@11 if ( byte_660B94[0] ) { if ( mouseclick_x >= empireMapBorderLeftRight ) { if ( mouseclick_x < ddraw_width - 2 * empireMapBorderLeftRight ) { if ( mouseclick_y >= empireMapBorderTop ) { if ( mouseclick_y < ddraw_height - empireMapBorderTop - empireMapBorderBottom ) { v8 = mouseclick_x + empire_scroll_x - empireMapBorderLeftRight; v7 = mouseclick_y + empire_scroll_y - empireMapBorderTop; v2 = 10000; v1 = 0; for ( i = 0; i < 200 && empire[i].inUse; ++i ) { if ( scn_empireExpanded_flag ) { v6 = empire[i].xCoord_exp; v5 = empire[i].yCoord_exp; } else { v6 = empire[i].xCoord; v5 = empire[i].yCoord; } if ( v6 - 8 <= v8 ) { if ( v6 + empire[i].width + 8 > v8 ) { if ( v5 - 8 <= v7 ) { if ( v5 + empire[i].height + 8 > v7 ) { v3 = fun_getDistanceMaximum( v8, v7, empire[i].width / 2 + v6, empire[i].height / 2 + v5); if ( v3 < v2 ) { v2 = v3; v1 = i + 1; } } } } } } window_redrawRequest = 1; result = v1; } else { result = -1; } } else { result = -1; } } else { result = -1; } } else { result = -1; } } else { result = -1; } return result; } void fun_editor_editEmpire_moveEmpireCity(int direction, __int16 amount) { if ( window_id == 21 ) { if ( editEmpire_selectedObjectButton == 2 ) { if ( empire[currentEmpireEntryId].inUse ) { if ( map_empireExpanded ) { if ( direction ) { switch ( direction ) { case Direction_East: empire[currentEmpireEntryId].xCoord_exp += amount; break; case Direction_South: empire[currentEmpireEntryId].yCoord_exp += amount; break; case Direction_West: empire[currentEmpireEntryId].xCoord_exp -= amount; break; } } else { empire[currentEmpireEntryId].yCoord_exp -= amount; } } else { if ( direction ) { switch ( direction ) { case Direction_East: empire[currentEmpireEntryId].xCoord += amount; break; case Direction_South: empire[currentEmpireEntryId].yCoord += amount; break; case Direction_West: empire[currentEmpireEntryId].xCoord -= amount; break; } } else { empire[currentEmpireEntryId].yCoord -= amount; } } editEmpire_isSaved = 0; } } } } void fun_editor_editEmpire_addObjectType() { dword_993F04 = currentButton_parameter; window_redrawRequest = 1; if ( currentButton_parameter ) { switch ( currentButton_parameter ) { case Emp_City: editEmpire_addObjectGraphicID = graphic_empireCity; break; case Emp_UnusedValue2: editEmpire_addObjectGraphicID = graphic_empireBorderMarker; break; case Emp_BattleIcon: editEmpire_addObjectGraphicID = graphic_empireBattleIcon; break; case Emp_LandTradeRoute: editEmpire_addObjectGraphicID = graphic_empireLandTradeRoute; break; case Emp_SeaTradeRoute: editEmpire_addObjectGraphicID = graphic_empireSeaTradeRoute; break; case Emp_DistantBattleRomanArmy: editEmpire_addObjectGraphicID = graphic_empireDistantBattleRomanArmy; break; case Emp_DistantBattleEnemyArmy: editEmpire_addObjectGraphicID = graphic_empireDistantBattleEnemyArmy; break; } } else { editEmpire_addObjectGraphicID = word_6E6D16; } editEmpire_isSaved = 0; } void fun_editor_demandChanges_select() { editDemandChanges_current = currentButton_parameter; window_id = W_EditorEditDemandChange; window_redrawRequest = 1; } void fun_editor_priceChanges_select() { editPriceChanges_current = currentButton_parameter; window_id = W_EditorEditPriceChange; window_redrawRequest = 1; } void fun_editor_editDemandChange_year() { fun_showNumericInputDialog(200, 50, 2, 0, &map_demandChanges_year[editDemandChanges_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editDemandChange_good() { fun_showSelectListDialog(50, 40, 16, 23, &map_demandChanges_good[editDemandChanges_current], 0, 0, 0, 1); window_redrawRequest = 1; } void fun_editor_editDemandChange_route() { fun_showNumericInputDialog(400, 50, 1, &map_demandChanges_route[editDemandChanges_current], 0, 0, 0); window_redrawRequest = 1; } void fun_editor_editDemandChange_riseFall() { if ( map_demandChanges_isRise[editDemandChanges_current] ) map_demandChanges_isRise[editDemandChanges_current] = 0; else map_demandChanges_isRise[editDemandChanges_current] = 1; window_redrawRequest = 1; } void fun_editor_editDemandChange_unschedule() { map_demandChanges_year[editDemandChanges_current] = 0; map_demandChanges_good[editDemandChanges_current] = 0; map_demandChanges_route[editDemandChanges_current] = 0; map_demandChanges_isRise[editDemandChanges_current] = 0; fun_sortDemandChanges(); window_id = W_EditorDemandChanges; window_redrawRequest = 1; } void fun_editor_editDemandChange_ok() { fun_sortDemandChanges(); window_id = W_EditorDemandChanges; window_redrawRequest = 1; } void fun_editor_editPriceChange_year() { fun_showNumericInputDialog(200, 50, 2, 0, &map_priceChanges_year[editPriceChanges_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editPriceChange_good() { fun_showSelectListDialog(50, 40, 16, 23, &map_priceChanges_good[editPriceChanges_current], 0, 0, 0, 1); window_redrawRequest = 1; } void fun_editor_editPriceChange_riseFall() { if ( map_priceChanges_isRise[editPriceChanges_current] ) map_priceChanges_isRise[editPriceChanges_current] = 0; else map_priceChanges_isRise[editPriceChanges_current] = 1; window_redrawRequest = 1; } void fun_editor_editPriceChange_amount() { fun_showNumericInputDialog(500, 50, 1, &map_priceChanges_amount[editPriceChanges_current], 0, 0, 0); window_redrawRequest = 1; } void fun_editor_editPriceChange_unschedule() { map_priceChanges_year[editPriceChanges_current] = 0; map_priceChanges_good[editPriceChanges_current] = 0; map_priceChanges_amount[editPriceChanges_current] = 0; map_priceChanges_isRise[editPriceChanges_current] = 0; fun_sortPriceChanges(); window_id = W_EditorPriceChanges; window_redrawRequest = 1; } void fun_editor_editPriceChange_ok() { fun_sortPriceChanges(); window_id = W_EditorPriceChanges; window_redrawRequest = 1; } void fun_editor_setSupplyDemand_click() { int resource; // [sp+4Ch] [bp-4h]@1 resource = fun_getEmpireTradeAmountId(currentEmpireEntryId, currentButton_parameter) + 1; if ( resource > 3 ) resource = 0; fun_setEmpireTradeAmountId(currentEmpireEntryId, currentButton_parameter, resource); window_redrawRequest = 1; } void fun_editor_editEmpire_editRoute_tradeRouteId() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showNumericInputDialog(453, screen_height - 314, 1, &empire[v0].tradeRouteId, 0, 0, 0); window_redrawRequest = 1; } } void fun_editor_editEmpire_editCity_type() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { fun_empireCityClearBuysSells(currentEmpireEntryId); empire[v0].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showSelectListDialog(443, screen_height - 314, 7, 39, &empire[v0].cityType, 0, 0, 0, 1); window_redrawRequest = 1; } } void fun_editor_editEmpire_editCity_name() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showSelectListDialog(373, screen_height - 534, 40, 21, &empire[v0].cityNameId, 0, 0, 0, 1); window_redrawRequest = 1; } } void fun_editor_editEmpire_editCity_tradeRouteId() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showNumericInputDialog(453, screen_height - 314, 1, &empire[v0].tradeRouteId, 0, 0, 0); window_redrawRequest = 1; } } void fun_editor_editEmpire_editCity_demand() { window_id = 36; sub_445880(); window_redrawRequest = 1; } void fun_editor_editEmpire_editCity_costToOpen() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showNumericInputDialog(653, screen_height - 314, 2, 0, &empire[v0].tradeCostToOpen[0], 0, 0); window_redrawRequest = 1; } } void fun_editor_editEmpire_editOwnCity_produces() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { editEmpire_resourceSlotId = currentButton_parameter; empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showSelectListDialog(400, 220, 11, 27, &empire[v0].citySells[editEmpire_resourceSlotId], 0, 0, 1, 1); } } void fun_editor_editEmpire_editCity_sells() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { editEmpire_resourceSlotId = currentButton_parameter; empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showSelectListDialog(400, 220, 16, 23, &empire[v0].citySells[editEmpire_resourceSlotId], 0, 0, 0, 1); } } void fun_editor_editEmpire_editCity_buys() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { editEmpire_resourceSlotId = currentButton_parameter; empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showSelectListDialog(400, 220, 16, 23, &empire[v0].cityBuys[editEmpire_resourceSlotId], 0, 0, 0, 1); } } void fun_editor_editEmpire_editBattle_path() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showNumericInputDialog(453, screen_height - 314, 1, &empire[v0].invasionPathId, 0, 0, 0); window_redrawRequest = 1; } } void fun_editor_editEmpire_editBattle_order() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentEmpireEntryId; if ( empire[currentEmpireEntryId].inUse ) { empire[currentEmpireEntryId].f990D29[0] = 10; editEmpire_isSaved = 0; fun_showNumericInputDialog(453, screen_height - 314, 1, &empire[v0].invasionYears, 0, 0, 0); window_redrawRequest = 1; } } void fun_editor_startCond_startFunds() { fun_showNumericInputDialog(screen_640x480_x + 140, screen_640x480_y + 56, 4, 0, 0, &map_startFunds, 0); window_redrawRequest = 1; } void fun_editor_startCond_rescueLoan() { fun_showNumericInputDialog(screen_640x480_x + 140, screen_640x480_y + 56, 4, 0, 0, &map_rescueLoan, 0); window_redrawRequest = 1; } void fun_editor_main_enemy() { fun_showSelectListDialog(20, 40, 20, 37, 0, &map_enemy, 0, 0, 2); window_redrawRequest = 1; } void fun_editor_main_terrain() { ++map_climate; if ( map_climate >= 3 ) map_climate = 0; fun_loadClimateGraphics(map_climate); window_redrawRequest = 1; } void fun_editor_startCond_flotsam() { map_flotsam = map_flotsam != 1; window_redrawRequest = 1; } void fun_editor_startCond_romeSuppliesWheat() { map_romeSuppliesWheat = map_romeSuppliesWheat != 1; window_redrawRequest = 1; } void fun_editor_main_allowedBuildings() { window_id = W_EditorAllowedBuildings; window_redrawRequest = 1; } void fun_editor_allowedBuildings_toggle() { if ( map_allowedBuildings[currentButton_parameter] ) map_allowedBuildings[currentButton_parameter] = 0; else map_allowedBuildings[currentButton_parameter] = 1; window_redrawRequest = 1; } void fun_editor_main_winCriteria() { window_id = W_EditorWinCriteria; window_redrawRequest = 1; } void fun_editor_winCriteria_openPlayToggle() { if ( map_isOpenPlay ) map_isOpenPlay = 0; else map_isOpenPlay = 1; window_redrawRequest = 1; } void fun_editor_winCriteria_openPlayScenarioId() { fun_showNumericInputDialog(300, 200, 1, &map_openPlayScenId, 0, 0, 0); window_redrawRequest = 1; } void fun_editor_winCriteria_ratingToggle() { if ( map_win_culture_on[currentButton_parameter] ) map_win_culture_on[currentButton_parameter] = 0; else map_win_culture_on[currentButton_parameter] = 1; window_redrawRequest = 1; } void fun_editor_winCriteria_ratingValue() { fun_showNumericInputDialog(300, 200, 4, 0, 0, &map_win_culture[currentButton_parameter], 0); window_redrawRequest = 1; } void fun_editor_winCriteria_timeLimitToggle() { if ( map_win_timeLimitYears_on ) map_win_timeLimitYears_on = 0; else map_win_timeLimitYears_on = 1; if ( map_win_timeLimitYears_on ) map_win_survivalYears_on = 0; window_redrawRequest = 1; } void fun_editor_winCriteria_timeLimitYears() { fun_showNumericInputDialog(300, 200, 4, 0, 0, &map_win_timeLimitYears, 0); window_redrawRequest = 1; } void fun_editor_winCriteria_survivalTimeToggle() { if ( map_win_survivalYears_on ) map_win_survivalYears_on = 0; else map_win_survivalYears_on = 1; if ( map_win_survivalYears_on ) map_win_timeLimitYears_on = 0; window_redrawRequest = 1; } void fun_editor_winCriteria_survivalTimeYears() { fun_showNumericInputDialog(300, 200, 4, 0, 0, &map_win_survivalYears, 0); window_redrawRequest = 1; } void fun_editor_winCriteria_populationToggle() { if ( map_win_population_flag ) map_win_population_flag = 0; else map_win_population_flag = 1; window_redrawRequest = 1; } void fun_editor_winCriteria_populationValue() { fun_showNumericInputDialog(300, 200, 4, 0, 0, &map_win_population, 0); window_redrawRequest = 1; } void fun_editor_main_specialEvents() { window_id = W_EditorSpecialEvents; window_redrawRequest = 1; } void fun_editor_startCond_rank() { ++map_playerRank[0]; if ( map_playerRank[0] >= 10 ) map_playerRank[0] = 0; window_redrawRequest = 1; } void fun_editor_main_startCond() { window_id = W_EditorStartingConditions; window_redrawRequest = 1; } void fun_editor_main_demandChanges() { window_id = W_EditorDemandChanges; window_redrawRequest = 1; } void fun_editor_main_priceChanges() { window_id = W_EditorPriceChanges; window_redrawRequest = 1; } void fun_editor_specialEvents_gladiatorRevoltToggle() { ++map_event_gladiatorRevolt_on; if ( map_event_gladiatorRevolt_on >= 2 ) map_event_gladiatorRevolt_on = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_gladiatorRevoltYear() { fun_showNumericInputDialog(300, 100, 4, 0, 0, &map_event_gladiatorRevolt_year, 0); window_redrawRequest = 1; } void fun_editor_specialEvents_emperorChangeToggle() { ++map_event_emperorChange_on; if ( map_event_emperorChange_on >= 2 ) map_event_emperorChange_on = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_emperorChangeYear() { fun_showNumericInputDialog(300, 100, 4, 0, 0, &map_event_emperorChange_year, 0); window_redrawRequest = 1; } void fun_editor_specialEvents_seaTradeProblem() { ++map_event_seaTradeProblem; if ( map_event_seaTradeProblem >= 2 ) map_event_seaTradeProblem = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_landTradeProblem() { ++map_event_landTradeProblem; if ( map_event_landTradeProblem >= 2 ) map_event_landTradeProblem = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_raiseWages() { ++map_event_raiseWages; if ( map_event_raiseWages >= 2 ) map_event_raiseWages = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_lowerWages() { ++map_event_lowerWages; if ( map_event_lowerWages >= 2 ) map_event_lowerWages = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_contaminatedWater() { ++map_event_contaminatedWater; if ( map_event_contaminatedWater >= 2 ) map_event_contaminatedWater = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_ironMineCollapse() { ++map_event_ironMineCollapse; if ( map_event_ironMineCollapse >= 2 ) map_event_ironMineCollapse = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_clayPitFlooded() { ++map_event_clayPitFlooded; if ( map_event_clayPitFlooded >= 2 ) map_event_clayPitFlooded = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_earthquakeSeverity() { ++map_event_earthquake_severity; if ( map_event_earthquake_severity >= 4 ) map_event_earthquake_severity = 0; window_redrawRequest = 1; } void fun_editor_specialEvents_earthquakeYear() { fun_showNumericInputDialog(300, 100, 4, 0, 0, &map_event_earthquake_year, 0); window_redrawRequest = 1; } void fun_editor_startCond_milestone() { fun_showNumericInputDialog(300, 100, 4, 0, 0, &map_milestone25[currentButton_parameter], 0); window_redrawRequest = 1; } void fun_editor_startCond_startDate() { window_id = W_EditorEditStartDate; window_redrawRequest = 1; } void fun_editor_startDate_year() { fun_showNumericInputDialog(240, 180, 2, 0, &map_settings_startYear, 0, 0); window_redrawRequest = 1; } void fun_editor_startDate_toggleEra() { map_settings_startYear = -map_settings_startYear; window_redrawRequest = 1; } void fun_editor_startDate_cancel() { window_id = 1; window_redrawRequest = 1; } void fun_windowEditorSettings_imageUpDown() { if ( currentButton_parameter == 1 ) --map_image; if ( !currentButton_parameter ) ++map_image; if ( map_image < 0 ) map_image = 15; if ( map_image > 15 ) map_image = 0; window_redrawRequest = 1; } void fun_editor_main_requests() { window_id = W_EditorRequests; window_redrawRequest = 1; } void fun_editor_requests_select() { editRequests_current = currentButton_parameter; window_id = W_EditorEditRequest; window_redrawRequest = 1; } void fun_editor_editRequest_year() { fun_showNumericInputDialog(250, 50, 2, 0, &map_requests_year[editRequests_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editRequest_amount() { fun_showNumericInputDialog(250, 100, 2, 0, &map_requests_amount[editRequests_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editRequest_good() { fun_showSelectListDialog(200, 40, 16, 23, 0, &map_requests_good[editRequests_current], 0, 0, 2); window_redrawRequest = 1; } void fun_editor_editRequest_deadline() { fun_showNumericInputDialog(400, 100, 2, 0, &map_requests_deadline[editRequests_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editRequest_favor() { fun_showNumericInputDialog(300, 100, 1, &map_requests_favor[editRequests_current], 0, 0, 0); window_redrawRequest = 1; } void fun_editor_editRequest_unschedule() { map_requests_year[editRequests_current] = 0; map_requests_amount[editRequests_current] = 0; map_requests_good[editRequests_current] = 0; map_requests_deadline[editRequests_current] = 5; fun_sortRequests(); window_id = W_EditorRequests; window_redrawRequest = 1; } void fun_editor_editRequest_ok() { fun_sortRequests(); window_id = W_EditorRequests; window_redrawRequest = 1; } void fun_editor_main_invasions() { window_id = W_EditorInvasions; window_redrawRequest = 1; } void fun_editor_invasions_select() { editInvasions_current = currentButton_parameter; if ( !map_invasions_type[editInvasions_current] ) { map_invasions_year[editInvasions_current] = 0; map_invasions_amount[editInvasions_current] = 0; } window_id = W_EditorEditInvasion; window_redrawRequest = 1; } void fun_editor_editInvasion_year() { fun_showNumericInputDialog(300, 100, 2, 0, &map_invasions_year[editInvasions_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editInvasion_amount() { fun_showNumericInputDialog(100, 100, 2, 0, &map_invasions_amount[editInvasions_current], 0, 0); window_redrawRequest = 1; } void fun_editor_editInvasion_type() { fun_showSelectListDialog(150, 50, 5, 34, 0, &map_invasions_type[editInvasions_current], 0, 0, 2); window_redrawRequest = 1; } void fun_editor_editInvasion_from() { if ( map_invasions_type[editInvasions_current] != 4 ) { fun_showSelectListDialog(500, 100, 9, 35, 0, &map_invasions_from[editInvasions_current], 0, 0, 2); window_redrawRequest = 1; } } void fun_editor_editInvasion_attack() { if ( map_invasions_type[editInvasions_current] != 4 ) { fun_showSelectListDialog(200, 150, 5, 36, 0, &map_invasions_attack[editInvasions_current], 0, 0, 2); window_redrawRequest = 1; } } void fun_editor_editInvasion_unschedule() { map_invasions_year[editInvasions_current] = 0; map_invasions_amount[editInvasions_current] = 0; map_invasions_type[editInvasions_current] = 0; map_invasions_from[editInvasions_current] = 8; map_invasions_attack[editInvasions_current] = 0; fun_sortInvasions(); window_id = W_EditorInvasions; window_redrawRequest = 1; } void fun_editor_editInvasion_ok() { if ( !map_invasions_type[editInvasions_current] ) { map_invasions_year[editInvasions_current] = 0; map_invasions_amount[editInvasions_current] = 0; } fun_sortInvasions(); window_id = W_EditorInvasions; window_redrawRequest = 1; } void fun_windowEditEmpire_empireUpDown() { empireindex_xOffset[16 * scenario_map_empire] = empire_scroll_x; empireindex_yOffset[16 * scenario_map_empire] = empire_scroll_y; fun_checkEmpireMapScrollBoundaries(); if ( currentButton_parameter == 1 ) { --scenario_map_empire; } else { if ( !currentButton_parameter ) ++scenario_map_empire; } if ( scenario_map_empire < 0 ) scenario_map_empire = 0; if ( scenario_map_empire >= 40 ) scenario_map_empire = 39; fun_readEmpireFile(1); fun_initializeTradeRoutes(); sub_4459F0(); fun_setInvasionMonthsAndPaths(); fun_setDistantBattleCity(); empire_scroll_x = empireindex_xOffset[16 * scenario_map_empire]; empire_scroll_y = empireindex_yOffset[16 * scenario_map_empire]; fun_checkEmpireMapScrollBoundaries(); window_redrawRequest = 1; } void fun_windowEmpireMap_city_openTrade() { fun_showConfirmDialog(2, fun_confirmdialog_openTrade, 2); } void fun_windowEmpireMap_help() { fun_showHelpDialog(32, 1); } void fun_windowEmpireMap_exit() { fun_editor_saveToEmpireEntry(); } void fun_dialogTradeOpened_ok() { window_id = W_EmpireMap; window_redrawRequest = 1; } void fun_menuFile_newMap() { fun_showSelectListDialog(50, 50, 7, 33, 0, 0, &mapsize, 2, 4); window_redrawRequest = 1; } void fun_menuFile_loadMap() { fun_findFiles("*.map"); filelist_numFiles = findfiles_numFiles; filelist_scrollPosition = 0; filelist_selectedIndex = 0; byte_6ADD0C = 0; scrollbar_file_isLarge = 0; window_id = 16; byte_7E1EF9 = 1; button_something_7 = 0; window_redrawRequest = 1; } void fun_menuFile_saveMap() { fun_findFiles("*.map"); filelist_numFiles = findfiles_numFiles; filelist_scrollPosition = 0; filelist_selectedIndex = 0; byte_6ADD0C = 0; scrollbar_file_isLarge = 0; window_id = 16; byte_7E1EF9 = 0; button_something_7 = 0; window_redrawRequest = 1; } void fun_dialogFileScenario_okCancel() { if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) { fun_removeFileExtension(currentScenarioFilename); fun_strncpy("map", current_fileExtension, 3); fun_appendFileExtension(currentScenarioFilename); if ( byte_7E1EF9 != 1 || fun_fileExists(currentScenarioFilename) ) { if ( byte_7E1EF9 == 1 ) sub_4DD2A0(); else fun_writeScenarioFile(currentScenarioFilename); fun_removeFileExtension(currentScenarioFilename); window_id = 1; window_redrawRequest = 1; } else { fun_removeFileExtension(currentScenarioFilename); byte_6ADD0C = 100; } } } else { window_id = 1; window_redrawRequest = 1; } } void fun_menuResets_loadFromBmp() { fun_showNumericInputDialog(200, 100, 4, 0, 0, &loadFromBmp_input, 1); window_redrawRequest = 1; } void fun_menuResets_saveToBmp() { fun_writeToC3mapsBmp(setting_map_start); window_redrawRequest = 1; } void fun_imageButtonUnknown_doNothingRedraw() { window_redrawRequest = 1; } void fun_imageButtonUnknown_setFlag() { imagebuttonunknown_flag = currentButton_parameter; toPlace_buildingType = B_none_building; window_redrawRequest = 1; } signed int sub_40F120() { sidepanel_slide_progress[0] = 0; window_id = 2; fun_setCityViewport_withoutPanel(); sub_4DC600(); return sound_playChannel(2); } void fun_sidePanel_overlay() { window_id = W_OverlaySelectionMenu; buildmenu.submenuNumItems = 20; buildmenu_X = 40; buildmenu_Y = 12; dword_9D7B7C = 0; selectedOverlaySubMenu = 0; selectedOverlaySubMenuNumItems = 0; dword_9D7B70 = 0; dword_9D7B34 = 40; dword_9D7B38 = 12; window_redrawRequest = 1; } void fun_overlayMainMenu_click() { int overlay; // [sp+4Ch] [bp-4h]@1 overlay = overlayMenuIDToOverlayID[currentButton_parameter]; if ( overlay ) { if ( overlay == 2 ) { previousOverlay = 0; currentOverlay = 2; } else { if ( overlay == 4 ) { previousOverlay = 0; currentOverlay = 4; } } } else { previousOverlay = currentOverlay; currentOverlay = 0; } window_id = 1; window_redrawRequest = 1; } void fun_overlaySubMenu_click() { int overlay; // [sp+4Ch] [bp-4h]@1 overlay = *(int *)((char *)&overlaySubMenuIDToOverlayID[30 * selectedOverlaySubMenu] + 4 * currentButton_parameter); if ( overlay ) { if ( currentOverlay ) previousOverlay = 0; else previousOverlay = currentOverlay; currentOverlay = overlay; } window_id = 1; window_redrawRequest = 1; } int sub_40F330() { int result; // eax@5 if ( mouseover_button_id || mouseover_button_id_main ) { dword_9DA904 = time_current; if ( mouseover_button_id ) { dword_9D7B34 = mouseover_button_id - 1; selectedOverlaySubMenu = overlay_submenu_ids[mouseover_button_id]; selectedOverlaySubMenuNumItems = fun_countOverlaySubmenuItems(selectedOverlaySubMenu); } result = 0; } else { if ( time_current - dword_9DA904 > 500 ) { selectedOverlaySubMenu = 0; selectedOverlaySubMenuNumItems = 0; } result = 0; } return result; } void sub_40F3F0() { if ( sidepanel_collapsed == 2 ) { fun_setCityViewport_withPanel(); sidepanel_collapsed = 0; window_id = 1; } else { fun_setCityViewport_withoutPanel(); sidepanel_collapsed = 2; } sub_4DC600(); window_redrawRequest = 1; } void unused_40F450() { ; } void fun_unused_writeToC4mapsBmp() { fun_writeToC3mapsBmp(setting_map_start); } void fun_sidePanel_rotate() { if ( currentButton_parameter ) fun_rotateMapClockwise(); else fun_rotateMapCounterClockwise(); dword_8A788C = currentButton_parameter; setting_map_orientation = mapOrientation; sub_4831E0(); sub_4DC600(); showWarning(1); window_redrawRequest = 1; } void fun_sidePanel_north() { if ( setting_map_orientation ) { if ( setting_map_orientation == 2 ) { dword_8A788C = 1; fun_rotateMapClockwise(); setting_map_orientation = mapOrientation; sub_4831E0(); } else { if ( setting_map_orientation == 6 ) { dword_8A788C = 0; fun_rotateMapCounterClockwise(); setting_map_orientation = mapOrientation; sub_4831E0(); } else { dword_8A788C = 0; fun_rotateMapCounterClockwise(); fun_rotateMapCounterClockwise(); setting_map_orientation = mapOrientation; sub_4831E0(); sub_4831E0(); } } sub_4DC600(); showWarning(1); window_redrawRequest = 1; } } void fun_showEmpireMap() { if ( mode_editor == 1 ) { window_id = 21; editEmpire_selectedObjectButton = 4; dword_993F04 = 0; fun_checkEmpireMapScrollBoundaries(); } else { window_id = 20; } window_redrawRequest = 1; } void fun_editor_saveToEmpireEntry() { if ( mode_editor == 1 ) { map_empire = scenario_map_empire; empireindex_xOffset[16 * scenario_map_empire] = empire_scroll_x; empireindex_yOffset[16 * scenario_map_empire] = empire_scroll_y; fun_checkEmpireMapScrollBoundaries(); } window_id = 1; window_redrawRequest = 1; } void fun_gotoAdvisorFromButton() { if ( setting_isCustomScenario ) goto LABEL_14; if ( !setting_currentMissionId ) { if ( window_id == 5 ) { fun_message_close(); window_id = 1; } showWarning(13); // not available return; } if ( setting_currentMissionId != 1 || tutorial2_population250reached ) { LABEL_14: window_id = W_Advisors; currentAdvisor = currentButton_parameter; sidepanel_lastAdvisor = currentButton_parameter; fun_updateAdvisorData(); window_redrawRequest = 1; advisor_ifSomething = 6; return; } if ( window_id == 5 ) { fun_message_close(); window_id = 1; } showWarning(14); // not available yet } void fun_updateAdvisorData() { fun_reallocateWorkersPerCategory(); sub_456230(); sub_456910(); sub_4563A0(); fun_updateFinanceTaxes(); fun_updateWageCostsAndEstimate(); fun_updateFinanceInterest(); fun_updateFinanceSalary(); fun_calculateFinanceTotals(); fun_calculateTributeThisYear(); fun_calculateCultureDemandLevel(); fun_calculateCultureCoverage(); fun_updateAdvisorFoodAndSupplyRomeWheat(); sub_4BC600(); fun_setCultureRatingExplanation(); fun_setProsperityRatingExplanation(); fun_setPeaceRatingExplanation(); fun_setFavorRatingExplanation(); } void fun_laborAdvisor_wagesUpDown() { if ( currentButton_parameter == 1 ) { --city_inform[ciid].wages; } else { if ( !currentButton_parameter ) ++city_inform[ciid].wages; } if ( city_inform[ciid].wages >= 0 ) { if ( city_inform[ciid].wages > 100 ) city_inform[ciid].wages = 100; } else { city_inform[ciid].wages = 0; } fun_updateWageCostsAndEstimate(); fun_calculateFinanceTotals(); fun_calculateTributeThisYear(); window_redrawRequest = 1; } void fun_financeAdvisor_taxesUpDown() { if ( currentButton_parameter == 1 ) { --city_inform[ciid].taxrate; } else { if ( !currentButton_parameter ) ++city_inform[ciid].taxrate; } if ( city_inform[ciid].taxrate >= 0 ) { if ( city_inform[ciid].taxrate > 25 ) city_inform[ciid].taxrate = 25; } else { city_inform[ciid].taxrate = 0; } fun_updateFinanceTaxes(); fun_calculateFinanceTotals(); fun_calculateTributeThisYear(); window_redrawRequest = 1; } void fun_tradeAdvisor_resource() { selectedGoodId = goodlist_indexToResourceId1[currentButton_parameter]; window_id = W_ResourceSettingsDialog; window_redrawRequest = 1; } void fun_tradeAdvisor_prices() { window_id = W_TradePricesDialog; window_redrawRequest = 1; } void fun_tradeAdvisor_empire() { fun_showEmpireMap(); window_redrawRequest = 1; } void fun_dialogResourceSettings_industryToggle() { if ( numIndustries[selectedGoodId] > 0 ) { if ( city_inform[ciid].industryMothballed[selectedGoodId] ) city_inform[ciid].industryMothballed[selectedGoodId] = 0; else city_inform[ciid].industryMothballed[selectedGoodId] = 1; } } void fun_dialogResourceSettings_trade() { ++city_inform[ciid].resourceTradeStatus[ selectedGoodId ]; if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId ] >= 3 ) city_inform[ciid].resourceTradeStatus[ selectedGoodId ] = Trade_None; if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId ]== Trade_Import ) { if ( !fun_tradeCanBuyGoodNow(selectedGoodId) ) city_inform[ciid].resourceTradeStatus[ selectedGoodId ] = Trade_Export; } if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId ] == Trade_Export ) { if ( !fun_tradeCanSellGoodNow(selectedGoodId) ) city_inform[ciid].resourceTradeStatus[ selectedGoodId ] = Trade_None; city_inform[ciid].resourceStockpile[ selectedGoodId ] = Trade_None; } } void fun_dialogResourceSettings_exportUpDown() { if ( currentButton_parameter == 1 ) { --city_inform[ciid].exportOver[selectedGoodId]; } else { if ( !currentButton_parameter ) ++city_inform[ciid].exportOver[selectedGoodId]; } if ( city_inform[ciid].exportOver[selectedGoodId] >= 0 ) { if ( city_inform[ciid].exportOver[selectedGoodId] > 100 ) city_inform[ciid].exportOver[selectedGoodId] = 100; } else { city_inform[ciid].exportOver[selectedGoodId] = 0; } } void fun_dialogResourceSettings_stockpile() { if ( city_inform[ciid].resourceStockpile[ selectedGoodId ] ) { city_inform[ciid].resourceStockpile[ selectedGoodId ] = 0; } else { city_inform[ciid].resourceStockpile[ selectedGoodId ] = 1; if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId] == Trade_Export ) city_inform[ciid].resourceTradeStatus[ selectedGoodId] = Trade_None; } window_redrawRequest = 1; } void fun_militaryAdvisor_gotoLegion() { int formationId; // eax@1 formationId = fun_getFormationIdOfLegion(currentButton_parameter); fun_gotoGridOffset( 162 * formations[formationId].fortY + formations[formationId].fortX + (_WORD)setting_map_startGridOffset); window_id = 1; window_redrawRequest = 1; } void fun_militaryAdvisor_returnToFort() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = fun_getFormationIdOfLegion(currentButton_parameter); if ( !formations[v0].formation_60 ) { sub_4BA850(v0); window_redrawRequest = 1; } } void fun_militaryAdvisor_empireService() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = fun_getFormationIdOfLegion(currentButton_parameter); if ( formations[v0].fortEmpireServiceFlag ) formations[v0].fortEmpireServiceFlag = 0; else formations[v0].fortEmpireServiceFlag = 1; sub_4BC600(); window_redrawRequest = 1; } void fun_laborAdvisor_priority() { signed int i; // [sp+4Ch] [bp-4h]@1 laborPriority_selectedCategory = currentButton_parameter; laborPriority_maxPriorities = 0; for ( i = 0; i < 9; ++i ) { if ( city_inform[ciid].labor_category_priority[ i ].priority > 0 ) ++laborPriority_maxPriorities; } if ( laborPriority_maxPriorities < 9 ) { ++laborPriority_maxPriorities; if ( city_inform[ciid].labor_category_priority[ laborPriority_selectedCategory ].priority ) --laborPriority_maxPriorities; } window_id = W_LaborPriorityDialog; window_redrawRequest = 1; } void fun_setLaborPriorityDialog_priority() { int v0; // [sp+4Ch] [bp-1Ch]@1 int v1; // [sp+50h] [bp-18h]@25 int v2; // [sp+54h] [bp-14h]@25 int v3; // [sp+54h] [bp-14h]@44 signed int v4; // [sp+58h] [bp-10h]@5 signed int v5; // [sp+5Ch] [bp-Ch]@25 signed int l; // [sp+60h] [bp-8h]@22 signed int i; // [sp+64h] [bp-4h]@12 int j; // [sp+64h] [bp-4h]@17 signed int k; // [sp+64h] [bp-4h]@20 signed int m; // [sp+64h] [bp-4h]@42 v0 = 0; window_id = 7; window_redrawRequest = 1; if ( city_inform[ciid].labor_category_priority[ laborPriority_selectedCategory ].priority != currentButton_parameter ) { if ( city_inform[ciid].labor_category_priority[ laborPriority_selectedCategory ].priority || !currentButton_parameter ) { if ( city_inform[ciid].labor_category_priority[ laborPriority_selectedCategory ].priority || currentButton_parameter ) { if( city_inform[ciid].labor_category_priority[ laborPriority_selectedCategory ].priority >= currentButton_parameter ) v4 = 1; else v4 = -1; } else { v4 = -1; } } else { v4 = 1; } city_inform[ciid].labor_category_priority[ laborPriority_selectedCategory ].priority = currentButton_parameter; for ( i = 0; i < 9; ++i ) { if ( city_inform[ciid].labor_category_priority[ i ].priority > 0 ) ++v0; } for ( j = 0; j < 9; ++j ) setLaborPriorityTmp1[j] = j; for ( k = 0; k < 9; ++k ) { for ( l = 0; l < 8; ++l ) { v5 = 0; v2 = setLaborPriorityTmp1[l]; v1 = setLaborPriorityTmp2[l]; if( city_inform[ciid].labor_category_priority[ v1 ].priority ) { if( !city_inform[ciid].labor_category_priority[ v2 ].priority ) v5 = 1; if ( city_inform[ciid].labor_category_priority[ v2 ].priority > city_inform[ciid].labor_category_priority[ v1 ].priority ) v5 = 1; if ( city_inform[ciid].labor_category_priority[ v2 ].priority == city_inform[ciid].labor_category_priority[ v1 ].priority ) { if ( laborPriority_selectedCategory != v1 || v4 != 1 ) { if ( laborPriority_selectedCategory == v2 ) { if ( v4 == -1 ) v5 = 1; } } else { v5 = 1; } } if ( v5 ) { setLaborPriorityTmp1[l] = v1; setLaborPriorityTmp2[l] = v2; } } } } for ( m = 0; m < 9; ++m ) { v3 = setLaborPriorityTmp1[m]; if( city_inform[ciid].labor_category_priority[ v3 ].priority ) city_inform[ciid].labor_category_priority[ v3 ].priority = m + 1; } fun_reallocateWorkersPerCategory(); sub_456230(); sub_456910(); sub_4563A0(); } } void fun_populationAdvisor_graph() { if ( populationAdvisor_graphOrder ) { switch ( populationAdvisor_graphOrder ) { case 1: if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) populationAdvisor_graphOrder = 3; } else { populationAdvisor_graphOrder = 4; } break; case 2: if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) populationAdvisor_graphOrder = 4; } else { populationAdvisor_graphOrder = 0; } break; case 3: if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) populationAdvisor_graphOrder = 1; } else { populationAdvisor_graphOrder = 5; } break; case 4: if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) populationAdvisor_graphOrder = 2; } else { populationAdvisor_graphOrder = 1; } break; case 5: if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) populationAdvisor_graphOrder = 0; } else { populationAdvisor_graphOrder = 3; } break; } } else { if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) populationAdvisor_graphOrder = 5; } else { populationAdvisor_graphOrder = 2; } } dword_5FFFD8 = -1; window_redrawRequest = 1; } void fun_entertainmentAdvisor_festival() { if ( !city_inform[ciid].plannedFestival_size ) { window_id = W_HoldFestivalDialog; window_redrawRequest = 1; } } void fun_dialogHoldFestival_help() { fun_showHelpDialog(28, 1); window_redrawRequest = 1; } void fun_dialogHoldFestival_close() { window_id = 7; window_redrawRequest = 1; } void fun_dialogHoldFestival_holdFestival() { if ( city_inform[ciid].treasury > -5000 ) { city_inform[ciid].plannedFestival_god = city_inform[ciid].festivalGod; city_inform[ciid].plannedFestival_size = city_inform[ciid].festivalSize; if ( city_inform[ciid].festivalSize == 1 ) { city_inform[ciid].plannedFestival_monthsToGo = 2; } else { if ( city_inform[ciid].festivalSize == 2 ) city_inform[ciid].plannedFestival_monthsToGo = 3; else city_inform[ciid].plannedFestival_monthsToGo = 4; } if ( city_inform[ciid].festivalSize == 1 ) { city_inform[ciid].treasury -= city_inform[ciid].smallFestivalCost; city_inform[ciid].finance_sundries_thisyear += city_inform[ciid].smallFestivalCost; } else { if ( city_inform[ciid].festivalSize == 2 ) { city_inform[ciid].treasury -= city_inform[ciid].largeFestivalCost; city_inform[ciid].finance_sundries_thisyear += city_inform[ciid].largeFestivalCost; } else { city_inform[ciid].treasury -= city_inform[ciid].grandFestivalCost; city_inform[ciid].finance_sundries_thisyear += city_inform[ciid].grandFestivalCost; } } if ( city_inform[ciid].festivalSize == 3 ) fun_removeGoodsFromCityStorage(ciid, G_Wine, city_inform[ciid].grandFestivalWine); window_id = W_Advisors; window_redrawRequest = 1; } } void fun_dialogHoldFestival_selectGod() { city_inform[ciid].festivalGod = currentButton_parameter; window_redrawRequest = 1; } void fun_dialogHoldFestival_selectSize() { if ( city_inform[ciid].treasury > -5000 ) { if ( !city_inform[ciid].grandFestivalWineUnavailable || currentButton_parameter != 3 ) { city_inform[ciid].festivalSize = currentButton_parameter; window_redrawRequest = 1; } } } void fun_ratingsAdvisor_select() { city_inform[ciid].ratingAdvisorSelectedRating = currentButton_parameter; window_redrawRequest = 1; } void fun_imperialAdvisor_donate() { window_id = W_DonateToCityDialog; if ( city_inform[ciid].donateAmount > city_inform[ciid].personalSavings ) city_inform[ciid].donateAmount = city_inform[ciid].personalSavings; window_redrawRequest = 1; } void fun_imperialAdvisor_salary() { window_id = W_SetSalaryDialog; window_redrawRequest = 1; } void fun_imperialAdvisor_gift() { window_id = W_SendGiftDialog; if ( city_inform[ciid].giftToCaesarSize == 2 ) { if ( city_inform[ciid].lavishGiftCost > city_inform[ciid].personalSavings ) city_inform[ciid].giftToCaesarSize = 1; } if ( city_inform[ciid].giftToCaesarSize == 1 ) { if ( city_inform[ciid].generousGiftCost > city_inform[ciid].personalSavings ) city_inform[ciid].giftToCaesarSize = 0; } window_redrawRequest = 1; } void fun_imperialAdvisor_request() { int v0; // [sp+4Ch] [bp-8h]@1 v0 = sub_44AA30(currentButton_parameter); if ( v0 ) { city_inform[ciid].byte_65458D = 0; switch ( v0 ) { case -4: fun_showConfirmDialog(8, fun_confirmdialog_doNothing, 0);// no legions available break; case -3: fun_showConfirmDialog(10, fun_confirmdialog_doNothing, 0);// no legions assigned break; case -2: fun_showConfirmDialog(12, (void (*)(void))&off_40188E, 2);// dispatch relief force break; case -1: fun_showConfirmDialog(6, fun_confirmdialog_doNothing, 0);// not enough goods break; default: request_dispatchGoods_requestId = v0 - 1; fun_showConfirmDialog(4, fun_confirmdialog_requestDispatchGoods, 2);// dispatch goods? window_redrawRequest = 1; break; } } } void fun_setSalaryDialog_cancel() { window_id = W_Advisors; window_redrawRequest = 1; } void fun_setSalaryDialog_salary() { if ( city_inform[ciid].victoryContinueMonths <= 0 ) { city_inform[ciid].salary_rank = currentButton_parameter; city_inform[ciid].salary_amount = salaryAmounts[currentButton_parameter]; fun_updateFinanceSalary(); fun_setFavorRatingExplanation(); window_id = W_Advisors; window_redrawRequest = 1; } } void fun_donateToCityDialog_cancel() { window_id = W_Advisors; window_redrawRequest = 1; } void fun_donateToCityDialog_ok() { city_inform[ciid].treasury += city_inform[ciid].donateAmount; city_inform[ciid].finance_donated_thisyear += city_inform[ciid].donateAmount; city_inform[ciid].personalSavings -= city_inform[ciid].donateAmount; fun_calculateFinanceTotals(); fun_calculateTributeThisYear(); window_id = W_Advisors; window_redrawRequest = 1; } void fun_donateToCityDialog_amount() { if ( currentButton_parameter ) { switch ( currentButton_parameter ) { case 1: city_inform[ciid].donateAmount = 500; break; case 2: city_inform[ciid].donateAmount = 2000; break; case 3: city_inform[ciid].donateAmount = 5000; break; case 4: city_inform[ciid].donateAmount = 1000000; break; } } else { city_inform[ciid].donateAmount = 0; } if ( city_inform[ciid].donateAmount > city_inform[ciid].personalSavings ) city_inform[ciid].donateAmount = city_inform[ciid].personalSavings; if ( city_inform[ciid].donateAmount < 0 ) city_inform[ciid].donateAmount = 0; window_redrawRequest = 1; } void fun_donateToCityDialog_amountUpDown() { if ( currentButton_parameter == 1 ) { city_inform[ciid].donateAmount -= 10; } else { if ( !currentButton_parameter ) city_inform[ciid].donateAmount += 10; } if ( city_inform[ciid].donateAmount > city_inform[ciid].personalSavings ) city_inform[ciid].donateAmount = city_inform[ciid].personalSavings; if ( city_inform[ciid].donateAmount < 0 ) city_inform[ciid].donateAmount = 0; window_redrawRequest = 1; } void fun_sendGiftDialog_gift() { if ( currentButton_parameter != 1 || city_inform[ciid].modestGiftCost <= city_inform[ciid].personalSavings ) { if ( currentButton_parameter != 2 || city_inform[ciid].generousGiftCost <= city_inform[ciid].personalSavings ) { if ( currentButton_parameter != 3 || city_inform[ciid].lavishGiftCost <= city_inform[ciid].personalSavings ) { city_inform[ciid].giftToCaesarSize = currentButton_parameter - 1; window_redrawRequest = 1; } } } } void fun_sendGiftDialog_send() { if ( city_inform[ciid].modestGiftCost <= city_inform[ciid].personalSavings ) { fun_sendGiftToCaesar(); window_id = W_Advisors; window_redrawRequest = 1; } } void fun_sendGiftDialog_cancel() { window_id = W_Advisors; window_redrawRequest = 1; } void fun_windowMainMenu_button() { savedgame_missionId = campaign_missionIds_peaceful[2 * setting_currentMissionId]; editEmpire_isSaved = 1; switch ( currentButton_parameter ) { case 4: // quit PostMessageA(main_window, 0x100u, 0x1Bu, 0); break; case 1: // new campaign mode_editor = 0; fun_clearMissionSettings(); window_id = 54; input_accepted = 0; setting_isCustomScenario = 0; window_redrawRequest = 1; break; case 3: // cck window_id = 61; fun_findFiles("*.map"); filelist_numFiles = findfiles_numFiles; byte_6ADD0C = 0; filelist_scrollPosition = byte_6ADD0C; scrollbar_file_isLarge = 1; byte_7E1EF9 = 1; currentButton_parameter = dword_9DA8B8; fun_dialogCckSelection_select(); setting_isCustomScenario = 2; window_redrawRequest = 1; break; case 2: // load game fun_findFiles("*.sav"); filelist_numFiles = findfiles_numFiles; byte_6ADD0C = 0; filelist_selectedIndex = byte_6ADD0C; filelist_scrollPosition = filelist_selectedIndex; scrollbar_file_isLarge = 0; fileDialogSave_from_window = window_id; input_accepted = 0; window_id = 13; byte_7E1EF9 = 1; fun_memset(current_saveFilename, 64, 0); strcpy(current_saveFilename, fileDialogSave_filename); fun_inputInit(2); fun_inputHomePressed(); fun_inputEndPressed(); window_redrawRequest = 1; break; } } void sub_4117C0() { signed int v0; // [sp+4Ch] [bp-4h]@1 v0 = 1; if ( window_id == 52 ) v0 = 0; if ( !dword_6058E0[setting_currentMissionId] ) v0 = 0; if ( v0 ) { window_id = 52; selectMission_choice = 0; } else { sub_5093B0(0, 53, 1000); dword_9DA7B0 = 0; helpDialog_value = 0; dword_7E2C10 = 0; currentHelpId = savedgame_missionId + 200; } } void unused_411890() { ; } void unused_4118B0() { ; } void fun_newCampaignOrCck_start() { mouseover_button_id_main = 0; mouseover_button_id = 0; mouseover_imagebutton_id[0] = 0; dword_9D7B90 = 0; previousOverlay = 0; switch ( window_id ) { case 54u: // new campaign sub_4117C0(); break; case 52u: sub_4117C0(); break; case 61u: // cck selection screen fun_soundStopChannel(1); fun_initScenario(currentScenarioFilename); window_id = 1; byte_6606BC = 2; break; default: fun_soundStopChannel(1); fun_resetBackgroundMusic(); window_id = 1; byte_6606BC = 2; city_inform[ciid].missionSavedGameWritten = 0; break; } window_redrawRequest = 1; } void sub_4119E0() { if ( window_id == W_MissionBriefing ) { window_id = 52; fun_soundStopChannel(1); } window_redrawRequest = 1; } void fun_selectMission_type() { int v0; // [sp+4Ch] [bp-10h]@3 int v1; // [sp+50h] [bp-Ch]@3 if ( byte_65E6C8 ) { v1 = dword_7E2C28 + dword_5E6A8C[4 * setting_currentMissionId] - 4; v0 = dword_7E2C2C + dword_5E6A90[4 * setting_currentMissionId] - 4; if ( fun_isMouseHit( dword_7E2C28 + dword_5E6A84[4 * setting_currentMissionId] - 4, dword_7E2C2C + dword_5E6A88[4 * setting_currentMissionId] - 4, 44, 44) ) { savedgame_missionId = campaign_missionIds_peaceful[2 * setting_currentMissionId]; selectMission_choice = 1; window_redrawRequest = 1; fun_playSound("wavs\\Fanfare_Nu1.wav", 1, 0); } if ( fun_isMouseHit(v1, v0, 44, 44) ) { savedgame_missionId = campaign_missionIds_military[2 * setting_currentMissionId]; selectMission_choice = 2; window_redrawRequest = 1; fun_playSound("wavs\\Fanfare_Nu5.wav", 1, 0); } } } int sub_411BA0() { int result; // eax@10 signed int v1; // [sp+4Ch] [bp-14h]@1 int v2; // [sp+50h] [bp-10h]@1 int v3; // [sp+54h] [bp-Ch]@1 int v4; // [sp+58h] [bp-8h]@1 int v5; // [sp+5Ch] [bp-4h]@1 v5 = dword_7E2C28 + dword_5E6A84[4 * setting_currentMissionId] - 4; v4 = dword_7E2C2C + dword_5E6A88[4 * setting_currentMissionId] - 4; v3 = dword_7E2C28 + dword_5E6A8C[4 * setting_currentMissionId] - 4; v2 = dword_7E2C2C + dword_5E6A90[4 * setting_currentMissionId] - 4; v1 = 0; if ( fun_isMouseHit(v5, v4, 44, 44) ) v1 = 1; if ( fun_isMouseHit(v3, v2, 44, 44) ) v1 = 2; if ( selectMission_choice ) { if ( selectMission_choice == 1 ) { if ( v1 == 1 ) drawGraphic(graphic_selectMissionButton[0] + 1, v5, v4); else drawGraphic(graphic_selectMissionButton[0] + 2, v5, v4); if ( v1 == 2 ) result = drawGraphic(graphic_selectMissionButton[0] + 1, v3, v2); else result = drawGraphic(graphic_selectMissionButton[0], v3, v2); } else { if ( v1 == 1 ) drawGraphic(graphic_selectMissionButton[0] + 1, v5, v4); else drawGraphic(graphic_selectMissionButton[0], v5, v4); if ( v1 == 2 ) result = drawGraphic(graphic_selectMissionButton[0] + 1, v3, v2); else result = drawGraphic(graphic_selectMissionButton[0] + 2, v3, v2); } } else { if ( v1 == 1 ) drawGraphic(graphic_selectMissionButton[0] + 1, v5, v4); else drawGraphic(graphic_selectMissionButton[0], v5, v4); if ( v1 == 2 ) result = drawGraphic(graphic_selectMissionButton[0] + 1, v3, v2); else result = drawGraphic(graphic_selectMissionButton[0], v3, v2); } return result; } void fun_advisors_bottomButton_click() { if ( currentButton_parameter ) { currentAdvisor = currentButton_parameter; sidepanel_lastAdvisor = currentButton_parameter; window_redrawRequest = 1; } else { window_id = 1; window_redrawRequest = 1; } } void fun_sidePanel_advisors() { if ( setting_isCustomScenario ) goto LABEL_10; if ( !setting_currentMissionId ) { showWarning(13); return; } if ( setting_currentMissionId != 1 || tutorial2_population250reached ) { LABEL_10: window_id = 7; currentAdvisor = sidepanel_lastAdvisor; fun_updateAdvisorData(); window_redrawRequest = 1; advisor_ifSomething = 6; } else { showWarning(14); } } void fun_toggleEmpireMap() { if ( mode_editor == 1 || setting_isCustomScenario ) goto LABEL_14; if ( !setting_currentMissionId ) { showWarning(13); return; } if ( setting_currentMissionId != 1 || tutorial2_population250reached ) { LABEL_14: if ( window_id == 1 ) fun_showEmpireMap(); else fun_editor_saveToEmpireEntry(); } else { showWarning(14); } } void fun_editor_editEmpire_general_save() { fun_writeCurrentEmpireToFileCustom(); editEmpire_isSaved = 1; window_redrawRequest = 1; } void fun_sidePanel_missionBriefing() { if ( !setting_isCustomScenario ) { sub_5093B0(0, 59, 1000); helpDialog_value = 0; dword_7E2C10 = 0; mouseover_info_id = 0; dword_7E2D0C = 0; window_redrawRequest = 1; } } signed int sub_4120D0() { signed int result; // eax@2 int formationId; // [sp+4Ch] [bp-8h]@3 if ( dword_8C79EC ) { formationId = fun_getWalkerFormationIdAtOffset(162 * setting_map_y + setting_map_x + setting_map_startGridOffset); if ( formationId > 0 ) { if ( formations[formationId].formation_60 ) { result = 0; } else { selectedLegionId = formationId; window_id = 30; window_redrawRequest = 1; result = 1; } } else { result = 0; } } else { result = 0; } return result; } void sub_412180() { int v0; // [sp+50h] [bp-4h]@7 if ( dword_8C79EC ) { if ( !formations[selectedLegionId].formation_60 ) { if ( !formations[selectedLegionId].cursedByMars ) { v0 = getFormationFromGridBldId(162 * setting_map_y + setting_map_x + setting_map_startGridOffset); if ( v0 && v0 == selectedLegionId ) { sub_4BA850(selectedLegionId); } else { fun_moveLegionTo(setting_map_x, setting_map_y, selectedLegionId); fun_playSound("wavs\\cohort5.wav", 1, 0); } window_id = 1; window_redrawRequest = 1; } } } else { window_id = 1; window_redrawRequest = 1; } } void sub_4122A0() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 for ( i = 0; i < 51; ++i ) dword_9DA680[i] = 0; for ( j = 0; j < 51; ++j ) byte_9DA640[j] = 0; } void sub_412320() { int v0; // [sp+4Ch] [bp-8h]@4 signed int i; // [sp+50h] [bp-4h]@1 signed int v2; // [sp+50h] [bp-4h]@4 for ( i = 0; i < 51; ++i ) byte_9DA640[i] = 0; v2 = 0; v0 = 0; while ( v2 < 51 ) { if ( time_current >= v0 + dword_9DA680[v2] ) { byte_9DA640[v2] = 1; dword_9DA680[v2] = time_current; } ++v2; v0 += 20; } } int fun_getBuildingAnimationIndex(int a1, int a2) { int result; // eax@3 int foodStockFullPercent; // [sp+4Ch] [bp-10h]@52 int v4; // [sp+50h] [bp-Ch]@1 signed int v5; // [sp+54h] [bp-8h]@1 int v6; // [sp+54h] [bp-8h]@53 int v7; // [sp+54h] [bp-8h]@74 signed int v8; // [sp+58h] [bp-4h]@1 v8 = 0; v5 = grid_animation[a2]; v4 = grid_buildingIds[a2]; if ( buildings[v4].type == B_Fountain ) { if ( buildings[v4].num_workers <= 0 ) return 0; if ( !buildings[v4].hasFountain ) return 0; } if ( buildings[v4].type == B_Reservoir && !buildings[v4].hasFountain ) return 0; if ( buildings[v4].type >= B_WineWorkshop && buildings[v4].type <= B_PotteryWorkshop ) { if ( buildings[v4].industry_unitsStored <= 0 ) return 0; if ( buildings[v4].num_workers <= 0 ) return 0; } if ( (buildings[v4].type == B_Prefecture || buildings[v4].type == B_EngineersPost) && buildings[v4].num_workers <= 0 ) return 0; if ( buildings[v4].type == B_Market && buildings[v4].num_workers <= 0 ) return 0; if ( buildings[v4].type == B_Warehouse && buildings[v4].num_workers < model_buildings[buildings[v4].type].laborers ) return 0; if ( buildings[v4].type == B_Dock && buildings[v4].house_bathhouse_dock_numships_entert_days <= 0 ) { grid_animation[a2] = 1; return 1; } if ( buildings[v4].type == B_MarbleQuarry ) { if ( buildings[v4].num_workers <= 0 ) { grid_animation[a2] = 1; return 1; } } else { if ( buildings[v4].type >= 107 && buildings[v4].type <= 109 && buildings[v4].num_workers <= 0 ) return 0; } if ( buildings[v4].type == 34 ) { if ( buildings[v4].num_workers <= 0 ) { grid_animation[a2] = 1; return 1; } } else { if ( buildings[v4].type != 32 && buildings[v4].type >= 30 && buildings[v4].type <= 37 && buildings[v4].num_workers <= 0 ) return 0; } if ( buildings[v4].type != 71 || buildings[v4].num_workers >= model_buildings[buildings[v4].type].laborers ) { if ( byte_9DA640[c3_sg2[a1].unknown_3A] ) { if ( buildings[v4].type == B_WineWorkshop ) { foodStockFullPercent = getPercentage(buildings[v4].grow_value_house_foodstocks[0], 400); if ( foodStockFullPercent > 0 ) { if ( foodStockFullPercent >= 4 ) { if ( foodStockFullPercent >= 8 ) { if ( foodStockFullPercent >= 12 ) { if ( foodStockFullPercent >= 96 ) { if ( v5 >= 9 ) { v6 = v5 + 1; if ( v6 > 12 ) v6 = 12; } else { v6 = 9; } } else { if ( v5 >= 4 ) { v6 = v5 + 1; if ( v6 > 8 ) v6 = 4; } else { v6 = 4; } } } else { v6 = 3; } } else { v6 = 2; } } else { v6 = 1; } } else { v6 = 0; } } else { if ( LOBYTE(c3_sg2[0].animation[a1 + 5]) ) { if ( v5 & 0x80 ) v8 = 1; v7 = v5 & 0x7F; if ( v8 ) { v6 = v7 - 1; if ( v6 < 1 ) { v6 = 1; v8 = 0; } } else { v6 = v7 + 1; if ( v6 > c3_sg2[a1].unknown_1E ) { v6 = c3_sg2[a1].unknown_1E; v8 = 1; } } } else { v6 = v5 + 1; if ( v6 > c3_sg2[a1].unknown_1E ) v6 = 1; } } grid_animation[a2] = v6; if ( v8 ) grid_animation[a2] |= 0x80u; result = v6; } else { result = v5 & 0x7F; } } else { result = 0; } return result; } int unused_4129D0(int a1, int a2, int a3) { int v3; // edx@1 int v4; // ebx@1 int v5; // edi@1 int v6; // esi@1 signed int v7; // ecx@5 unsigned int v8; // ecx@6 void *v9; // edi@12 const void *v11; // [sp-8h] [bp-54h]@6 v6 = a1; v4 = a3; *(_DWORD *)(a2 + 4) = a3; v5 = a2 + 8; v3 = 8; while ( v4 > 0 ) { if ( *(_BYTE *)v6 || *(_BYTE *)(v6 + 1) ) { v8 = 0; ++v3; v11 = (const void *)v6; do { if ( !*(_BYTE *)v6 && !*(_BYTE *)(v6 + 1) ) break; ++v6; ++v8; ++v3; --v4; if ( v4 <= 0 ) break; } while ( v8 < 128 ); *(_BYTE *)v5 = (v8 - 1) | 0x80; v9 = (void *)(v5 + 1); memcpy(v9, v11, v8); v6 = (int)((char *)v11 + v8); v5 = (int)((char *)v9 + v8); } else { v7 = 0; ++v3; do { if ( *(_BYTE *)v6 ) break; ++v6; ++v7; --v4; if ( v4 <= 0 ) break; } while ( v7 < 128 ); *(_BYTE *)v5++ = v7 - 1; } } *(_DWORD *)a2 = v3; getpixel_result[0] = v3; return getpixel_result[0]; } int unused_412AB0(int a1, void *a2) { int v2; // edx@1 int v3; // ebx@1 void *v4; // edi@1 int v5; // esi@1 unsigned int v6; // ecx@4 const void *v7; // esi@4 int v8; // ecx@5 v4 = a2; v2 = 0; v3 = *(_DWORD *)(a1 + 4); getpixel_result[0] = *(_DWORD *)(a1 + 4); v5 = a1 + 8; while ( v3 > 0 ) { if ( *(_BYTE *)v5 & 0x80 ) { v6 = (*(_BYTE *)v5 & 0x7F) + 1; v2 += v6; v7 = (const void *)(v5 + 1); v3 -= v6; memcpy(v4, v7, v6); v5 = (int)((char *)v7 + v6); v4 = (char *)v4 + v6; } else { v8 = (*(_BYTE *)v5 & 0x7F) + 1; v2 += v8; ++v5; v3 -= v8; while ( v8 ) { *(_BYTE *)v4 = 0; v4 = (char *)v4 + 1; --v8; } } } return getpixel_result[0]; } void unused_memxordst(char *input1, char *input2, char *dst, int length) { char *d; // eax@1 int len; // ecx@1 char *two; // edi@1 char *one; // esi@1 char tmp; // dl@3 one = input1; two = input2; d = dst; len = length; while ( len > 0 ) { tmp = *two; if ( *one == *two ) { *d = 0; ++one; ++two; ++d; --len; } else { *d = *one; *d ^= tmp; ++one; ++two; ++d; --len; } } } void unused_memxor(char *dst, char *src, int length) { int len; // ecx@1 char *d; // edi@1 char *s; // esi@1 char tmp; // al@4 d = dst; s = src; len = length; while ( len > 0 ) { tmp = *s; if ( *s ) { *d ^= tmp; ++s; ++d; ++*(_DWORD *)&tmp; --len; } else { ++s; ++d; --len; } } } void fun_memcpy8(int *a1, int *a2, signed int length) { signed int i; // ecx@1 int *v4; // edi@1 int *v5; // esi@1 v5 = a1; v4 = a2; for ( i = length; i >= 8; i -= 8 ) { *v4 = *v5; v4[1] = v5[1]; v5 += 2; v4 += 2; } while ( i > 0 ) { *(_BYTE *)v4 = *(_BYTE *)v5; v5 = (int *)((char *)v5 + 1); v4 = (int *)((char *)v4 + 1); --i; } } void unused_memcpy64(void *src, void *dst, int length) { int len; // ecx@1 int *d; // edi@1 int *s; // esi@1 s = (int *)src; d = (int *)dst; len = length; do { *d = *s; d[1] = s[1]; d[2] = s[2]; d[3] = s[3]; d[4] = s[4]; d[5] = s[5]; d[6] = s[6]; d[7] = s[7]; d[8] = s[8]; d[9] = s[9]; d[10] = s[10]; d[11] = s[11]; d[12] = s[12]; d[13] = s[13]; d[14] = s[14]; d[15] = s[15]; s += 16; d += 16; len -= 64; } while ( len > 0 ); } int fun_memset(void *buffer, signed int length, int fillChar) { int result; // eax@1 signed int len; // ecx@1 int *buf; // edi@1 buf = (int *)buffer; len = length; result = fillChar; while ( len >= 64 ) { *buf = fillChar; buf[1] = fillChar; buf[2] = fillChar; buf[3] = fillChar; buf[4] = fillChar; buf[5] = fillChar; buf[6] = fillChar; buf[7] = fillChar; buf[8] = fillChar; buf[9] = fillChar; buf[10] = fillChar; buf[11] = fillChar; buf[12] = fillChar; buf[13] = fillChar; buf[14] = fillChar; buf[15] = fillChar; buf += 16; len -= 64; } while ( len > 0 ) { *(_BYTE *)buf = fillChar; buf = (int *)((char *)buf + 1); --len; } return result; } void fun_memAndWithByte(char *buffer, signed int length, unsigned __int8 andByte) { int value; // eax@1 signed int v4; // ecx@1 char *v5; // edi@1 int v6; // eax@1 v5 = buffer; v4 = length; v6 = (andByte << 24) + (andByte << 16) + (andByte<<8) + andByte; while ( v4 >= 64 ) { *(_DWORD *)v5 &= value; *((_DWORD *)v5 + 1) &= value; *((_DWORD *)v5 + 2) &= value; *((_DWORD *)v5 + 3) &= value; *((_DWORD *)v5 + 4) &= value; *((_DWORD *)v5 + 5) &= value; *((_DWORD *)v5 + 6) &= value; *((_DWORD *)v5 + 7) &= value; *((_DWORD *)v5 + 8) &= value; *((_DWORD *)v5 + 9) &= value; *((_DWORD *)v5 + 10) &= value; *((_DWORD *)v5 + 11) &= value; *((_DWORD *)v5 + 12) &= value; *((_DWORD *)v5 + 13) &= value; *((_DWORD *)v5 + 14) &= value; *((_DWORD *)v5 + 15) &= value; v5 += 64; v4 -= 64; } while ( v4 > 0 ) { *v5 &= andByte; ++v5; --v4; } } void fun_memAndWithShort(__int16 *buffer, signed int length, unsigned __int16 value) { int v3 = 0; // eax@1 signed int v4; // ecx@1 __int16 *v5; // edi@1 v5 = buffer; v4 = length; v3 = (value << 16) + value; while ( v4 >= 64 ) { *(_DWORD *)v5 &= v3; *((_DWORD *)v5 + 1) &= v3; *((_DWORD *)v5 + 2) &= v3; *((_DWORD *)v5 + 3) &= v3; *((_DWORD *)v5 + 4) &= v3; *((_DWORD *)v5 + 5) &= v3; *((_DWORD *)v5 + 6) &= v3; *((_DWORD *)v5 + 7) &= v3; *((_DWORD *)v5 + 8) &= v3; *((_DWORD *)v5 + 9) &= v3; *((_DWORD *)v5 + 10) &= v3; *((_DWORD *)v5 + 11) &= v3; *((_DWORD *)v5 + 12) &= v3; *((_DWORD *)v5 + 13) &= v3; *((_DWORD *)v5 + 14) &= v3; *((_DWORD *)v5 + 15) &= v3; *((_DWORD *)v5 + 16) &= v3; *((_DWORD *)v5 + 17) &= v3; *((_DWORD *)v5 + 18) &= v3; *((_DWORD *)v5 + 19) &= v3; *((_DWORD *)v5 + 20) &= v3; *((_DWORD *)v5 + 21) &= v3; *((_DWORD *)v5 + 22) &= v3; *((_DWORD *)v5 + 23) &= v3; *((_DWORD *)v5 + 24) &= v3; *((_DWORD *)v5 + 25) &= v3; *((_DWORD *)v5 + 26) &= v3; *((_DWORD *)v5 + 27) &= v3; *((_DWORD *)v5 + 28) &= v3; *((_DWORD *)v5 + 29) &= v3; *((_DWORD *)v5 + 30) &= v3; *((_DWORD *)v5 + 31) &= v3; v5 += 64; v4 -= 64; } while ( v4 > 0 ) { *v5 &= value; v5 = (__int16 *)((char *)v5 + 1); --v4; } } void unused_412F90(int a1, int a2, int a3) { int v3; // edx@1 int v4; // edi@1 int v5; // esi@1 int v6; // ecx@2 v5 = a1; v4 = a2; v3 = (signed __int16)drawGraphic_height; do { v6 = (signed __int16)drawGraphic_width; do { *(_WORD *)v4 = *(_WORD *)v5; v4 += 2; v5 += 2; --v6; } while ( v6 > 0 ); v5 += 2 * a3; --v3; } while ( v3 > 0 ); } void sub_412FF0(const void *buffer, int a2, int a3) { int v3; // edx@1 void *v4; // edi@1 const void *v5; // esi@1 int v6; // ecx@2 v5 = buffer; v4 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v3 = (signed __int16)drawGraphic_height; do { v6 = 2 * (signed __int16)drawGraphic_width; memcpy(v4, v5, 8 * (signed __int16)drawGraphic_width); v4 = (char *)v4 + 4 * v6 + a2; v5 = (char *)v5 + 4 * v6 + a3; --v3; } while ( v3 > 0 ); } void sub_413060(void *buffer, int a2, int a3) { int y; // edx@1 void *to; // edi@1 const void *from; // esi@1 int x; // ecx@2 to = buffer; from = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; y = (signed __int16)drawGraphic_height; do { x = 2 * (signed __int16)drawGraphic_width; memcpy(to, from, 8 * (signed __int16)drawGraphic_width); from = (char *)from + 4 * x + a2; to = (char *)to + 4 * x + a3; --y; } while ( y > 0 ); } void fun_setPixel(int x, int y, __int16 color) { *(__int16 *)((char *)&ddraw_buffer[x] + ddraw_scanline * y) = color; } void unused_setIsometricPixel(int x, int y, __int16 color) { char *pixel; // edi@1 pixel = (char *)&ddraw_buffer[x] + ddraw_scanline * y; *(_WORD *)pixel = color; *((_WORD *)pixel + 1) = color; } void fun_andPixel(int x, int y, __int16 color) { *(__int16 *)((char *)&ddraw_buffer[x] + ddraw_scanline * y) &= color; } int fun_getPixelMasked(int x, int y, int mask) { int v4; // eax@1 v4 = ddraw_scanline * y; v4 &= *(__int16 *)((char *)&ddraw_buffer[x] + ddraw_scanline * y); getpixel_result[0] = mask & v4; return getpixel_result[0]; } void fun_orPixel(int x, int y, __int16 value) { *(__int16 *)((char *)&ddraw_buffer[x] + ddraw_scanline * y) |= value; } void unused_413240(int xOffset, int yOffset, __int16 color) { __int16 *ptr; // edi@1 __int16 *ptr2; // edi@3 ptr = (__int16 *)((char *)&ddraw_buffer[xOffset] + ddraw_scanline * yOffset); if ( !*ptr ) *ptr = color; ptr2 = ptr + 1; if ( !*ptr2 ) *ptr2 = color; } __int64 unused_4132A0(int a1, int a2) { return (unsigned int)ddraw_scanline * a2; } void unused_4132E0(int x, int y, __int16 a3) { char *ptr; // edi@1 ptr = (char *)&ddraw_buffer[x] + ddraw_scanline * y; *(_WORD *)ptr = a3; *((_WORD *)ptr + 1) = a3; *((_WORD *)ptr + 2) = a3; *((_WORD *)ptr + 4) = a3; } void fun_drawSelectionAntsPixel(int xOffset, int yOffset) { if ( xOffset >= 0 ) { if ( xOffset < ddraw_width ) { if ( yOffset >= 0 ) { if ( yOffset < ddraw_height - 32 ) *(__int16 *)((char *)&ddraw_buffer[xOffset] + ddraw_scanline * yOffset) = selectAnts_color; } } } } void fun_setPixelTransparencyOutline(int x, int y) { __int16 *v2; // edi@9 if ( x >= 0 ) { if ( x < ddraw_width ) { if ( y >= 0 ) { if ( y < ddraw_height - 32 ) { v2 = (__int16 *)((char *)&ddraw_buffer[x] + ddraw_scanline * y); if ( *v2 == 0xF81Fu ) // transparent *v2 = 0; // black else *v2 = 0xFFFFu; // white } } } } } void unused_413440() { ; } void unused_413460() { ; } void unused_413480() { ; } void fun_drawColoredRectangle(int x, int y, int color) { int v3; // edx@1 int v4; // ebx@1 int pixelPtr; // edi@1 int v6; // ecx@2 int v7; // edi@3 unsigned __int8 v8; // of@3 unsigned __int8 v9; // of@4 int v10; // [sp-4h] [bp-50h]@2 pixelPtr = (int)((char *)&ddraw_buffer[x] + ddraw_scanline * y); v4 = 65537 * color; v3 = (signed __int16)drawGraphic_height; do { v10 = pixelPtr; v6 = (signed __int16)drawGraphic_width; do { *(_DWORD *)pixelPtr = v4; v7 = pixelPtr + 4; *(_DWORD *)v7 = v4; v7 += 4; *(_DWORD *)v7 = v4; v7 += 4; *(_DWORD *)v7 = v4; v7 += 4; *(_DWORD *)v7 = v4; v7 += 4; *(_DWORD *)v7 = v4; v7 += 4; *(_DWORD *)v7 = v4; v7 += 4; *(_DWORD *)v7 = v4; pixelPtr = v7 + 4; v8 = __SETO__(v6--, 1); } while ( !((v6 < 0 ^ v8) | v6 == 0) ); pixelPtr = ddraw_scanline + v10; v9 = __SETO__(v3--, 1); } while ( !((v3 < 0 ^ v9) | v3 == 0) ); } void unused_413540(int a1) { char *v1; // edi@1 int v2; // esi@1 int v3; // edx@2 char v4; // bl@2 int v5; // ecx@3 unsigned __int8 v6; // of@6 unsigned __int8 v7; // of@7 int v8; // edx@9 int v9; // ecx@10 unsigned __int8 v10; // of@13 unsigned __int8 v11; // of@14 v2 = a1; v1 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; if ( dword_7E2730 == 1 ) { v8 = drawGraphic_visiblePixelsClipY; do { v9 = (signed __int16)drawGraphic_width; do { if ( *(_BYTE *)v2 ) *v1 = *(_BYTE *)v2; ++v2; ++v1; v10 = __SETO__(v9--, 1); } while ( !((v9 < 0 ^ v10) | v9 == 0) ); v1 += drawGraphic_skipBytesInBufferForClipX; v11 = __SETO__(v8--, 1); } while ( !((v8 < 0 ^ v11) | v8 == 0) ); } else { v4 = dword_6A10FC; v3 = drawGraphic_visiblePixelsClipY; do { v5 = (signed __int16)drawGraphic_width; do { if ( *(_BYTE *)v2 ) *v1 = v4; ++v2; ++v1; v6 = __SETO__(v5--, 1); } while ( !((v5 < 0 ^ v6) | v5 == 0) ); v1 += drawGraphic_skipBytesInBufferForClipX; v7 = __SETO__(v3--, 1); } while ( !((v3 < 0 ^ v7) | v3 == 0) ); } } int unused_4135F0(int a1) { int result; // eax@1 int v2; // edx@1 char v3; // bl@1 char *v4; // edi@1 int v5; // esi@1 int v6; // ecx@2 unsigned __int8 v7; // of@5 unsigned __int8 v8; // of@6 v5 = a1; result = ddraw_scanline * graphic_yOffset; v4 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = drawGraphic_visiblePixelsClipY; v3 = dword_6A10FC; do { v6 = drawGraphic_visiblePixelsClipX; do { result = (result & 0xffffff00) + *(_BYTE *)v5; if ( *(_BYTE *)v5 ) *v4 = v3; ++v5; ++v4; v7 = __SETO__(v6--, 1); } while ( !((v6 < 0 ^ v7) | v6 == 0) ); v5 += drawGraphic_copyBytesInBufferForClipX; v4 += drawGraphic_skipBytesInBufferForClipX; v8 = __SETO__(v2--, 1); } while ( !((v2 < 0 ^ v8) | v2 == 0) ); return result; } int unused_413670(int a1) { int result; // eax@1 int v2; // edx@1 char v3; // bl@1 char *v4; // edi@1 int v5; // esi@1 int v6; // ecx@2 unsigned __int8 v7; // of@5 unsigned __int8 v8; // of@6 v5 = a1; result = ddraw_scanline * graphic_yOffset; v4 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = drawGraphic_visiblePixelsClipY; v3 = dword_6A10FC; do { v6 = drawGraphic_visiblePixelsClipX; do { result = (result & 0xffffff00) + *(_BYTE *)v5; if ( *(_BYTE *)v5 ) *v4 = v3; ++v5; ++v4; v7 = __SETO__(v6--, 1); } while ( !((v6 < 0 ^ v7) | v6 == 0) ); v5 += drawGraphic_copyBytesInBufferForClipX; v4 += drawGraphic_skipBytesInBufferForClipX; v8 = __SETO__(v2--, 1); } while ( !((v2 < 0 ^ v8) | v2 == 0) ); return result; } void fun_drawGraphicUncompressedFull(char *data) { void *v1; // edi@1 char *v2; // esi@1 int v3; // edx@2 int v4; // ecx@3 unsigned __int8 v5; // of@3 int v6; // edx@5 unsigned int v7; // ecx@6 unsigned __int8 v8; // of@6 v2 = data; v1 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; if ( drawGraphic_visiblePixelsClipX & 3 ) { v3 = drawGraphic_visiblePixelsClipY; do { v4 = 2 * drawGraphic_visiblePixelsClipX; memcpy(v1, v2, 2 * drawGraphic_visiblePixelsClipX); v2 += drawGraphic_copyBytesInBufferForClipX + v4; v1 = (char *)v1 + drawGraphic_skipBytesInBufferForClipX + v4; v5 = __SETO__(v3--, 1); } while ( !((v3 < 0 ^ v5) | v3 == 0) ); } else { v6 = drawGraphic_visiblePixelsClipY; do { v7 = (unsigned int)drawGraphic_visiblePixelsClipX >> 1; memcpy(v1, v2, 4 * ((unsigned int)drawGraphic_visiblePixelsClipX >> 1)); v2 += 4 * v7 + drawGraphic_copyBytesInBufferForClipX; v1 = (char *)v1 + 4 * v7 + drawGraphic_skipBytesInBufferForClipX; v8 = __SETO__(v6--, 1); } while ( !((v6 < 0 ^ v8) | v6 == 0) ); } } void fun_drawMinimapPixel(int pixelData) { *(_DWORD *)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset) = *(_DWORD *)pixelData; } void fun_drawTwoPixels(int colors) { *(_DWORD *)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset) = colors; } void fun_drawGraphicUncompressedClipY(char *data) { int v1; // edx@1 int v2; // edi@1 char *v3; // esi@1 int v4; // ecx@2 unsigned __int8 v5; // of@5 unsigned __int8 v6; // of@6 int v7; // edi@10 int v8; // esi@10 int v9; // edi@12 int v10; // esi@12 int v11; // edi@14 unsigned __int16 v12; // si@14 unsigned __int8 v13; // of@16 unsigned __int8 v14; // of@17 v3 = data; v2 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; do { while ( 1 ) { v4 = (signed __int16)drawGraphic_width; if ( drawGraphic_width & 3 ) break; if ( *(_WORD *)v3 != 0xF81Fu ) *(_WORD *)v2 = *(_WORD *)v3; v8 = (int)(v3 + 2); v7 = v2 + 2; if ( *(_WORD *)v8 != 0xF81Fu ) *(_WORD *)v7 = *(_WORD *)v8; v10 = v8 + 2; v9 = v7 + 2; if ( *(_WORD *)v10 != 0xF81Fu ) *(_WORD *)v9 = *(_WORD *)v10; *(_DWORD *)&v12 = v10 + 2; v11 = v9 + 2; if ( **(_WORD **)&v12 != 0xF81Fu ) *(_WORD *)v11 = **(_WORD **)&v12; v3 = (char *)(*(_DWORD *)&v12 + 2); v2 = v11 + 2; v13 = __SETO__(v4, 4); v4 -= 4; if ( !((v4 < 0 ^ v13) | v4 == 0) ) break; v2 += drawGraphic_skipBytesInBufferForClipX; v14 = __SETO__(v1--, 1); if ( (v1 < 0 ^ v14) | v1 == 0 ) return; } do { if ( *(_WORD *)v3 != 0xF81Fu ) *(_WORD *)v2 = *(_WORD *)v3; v3 += 2; v2 += 2; v5 = __SETO__(v4--, 1); } while ( !((v4 < 0 ^ v5) | v4 == 0) ); v2 += drawGraphic_skipBytesInBufferForClipX; v6 = __SETO__(v1--, 1); } while ( !((v1 < 0 ^ v6) | v1 == 0) ); } void fun_drawGraphicUncompressedClipLeft(char *data) { int v1; // edx@1 int v2; // ebx@1 __int16 *v3; // edi@1 __int16 *v4; // esi@1 int v5; // ecx@2 unsigned __int8 v6; // of@5 unsigned __int8 v7; // of@6 v4 = (__int16 *)data; v3 = (__int16 *)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; v2 = drawGraphic_copyBytesInBufferForClipX; do { v5 = drawGraphic_visiblePixelsClipX; do { if ( *v4 != 0xF81Fu ) *v3 = *v4; ++v4; ++v3; v6 = __SETO__(v5--, 1); } while ( !((v5 < 0 ^ v6) | v5 == 0) ); v4 = (__int16 *)((char *)v4 + v2); v3 = (__int16 *)((char *)v3 + drawGraphic_skipBytesInBufferForClipX); v7 = __SETO__(v1--, 1); } while ( !((v1 < 0 ^ v7) | v1 == 0) ); } void fun_drawGraphicUncompressedClipRight(char *data) { int v1; // edx@1 int v2; // ebx@1 __int16 *v3; // edi@1 __int16 *v4; // esi@1 int v5; // ecx@2 unsigned __int8 v6; // of@5 unsigned __int8 v7; // of@6 v4 = (__int16 *)data; v3 = (__int16 *)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; v2 = drawGraphic_copyBytesInBufferForClipX; do { v5 = drawGraphic_visiblePixelsClipX; do { if ( *v4 != 0xF81Fu ) *v3 = *v4; ++v4; ++v3; v6 = __SETO__(v5--, 1); } while ( !((v5 < 0 ^ v6) | v5 == 0) ); v4 = (__int16 *)((char *)v4 + v2); v3 = (__int16 *)((char *)v3 + drawGraphic_skipBytesInBufferForClipX); v7 = __SETO__(v1--, 1); } while ( !((v1 < 0 ^ v7) | v1 == 0) ); } void fun_drawGraphicUncompressedColorMaskFull(char *data, __int16 colorMask) { int v2; // edx@1 int v3; // edi@1 char *v4; // esi@1 int v5; // ecx@2 unsigned __int8 v6; // of@5 unsigned __int8 v7; // of@6 int v8; // edi@10 int v9; // esi@10 int v10; // edi@12 int v11; // esi@12 int v12; // edi@14 int v13; // esi@14 unsigned __int8 v14; // of@16 unsigned __int8 v15; // of@17 v4 = data; v3 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v2 = drawGraphic_visiblePixelsClipY; do { while ( 1 ) { v5 = (signed __int16)drawGraphic_width; if ( drawGraphic_width & 3 ) break; if ( *(_WORD *)v4 != 0xF81Fu ) *(_WORD *)v3 &= colorMask; v9 = (int)(v4 + 2); v8 = v3 + 2; if ( *(_WORD *)v9 != 0xF81Fu ) *(_WORD *)v8 &= colorMask; v11 = v9 + 2; v10 = v8 + 2; if ( *(_WORD *)v11 != 0xF81Fu ) *(_WORD *)v10 &= colorMask; v13 = v11 + 2; v12 = v10 + 2; if ( *(_WORD *)v13 != 0xF81Fu ) *(_WORD *)v12 &= colorMask; v4 = (char *)(v13 + 2); v3 = v12 + 2; v14 = __SETO__(v5, 4); v5 -= 4; if ( !((v5 < 0 ^ v14) | v5 == 0) ) break; v3 += drawGraphic_skipBytesInBufferForClipX; v15 = __SETO__(v2--, 1); if ( (v2 < 0 ^ v15) | v2 == 0 ) return; } do { if ( *(_WORD *)v4 != 0xF81Fu ) *(_WORD *)v3 &= colorMask; v4 += 2; v3 += 2; v6 = __SETO__(v5--, 1); } while ( !((v5 < 0 ^ v6) | v5 == 0) ); v3 += drawGraphic_skipBytesInBufferForClipX; v7 = __SETO__(v2--, 1); } while ( !((v2 < 0 ^ v7) | v2 == 0) ); } void fun_drawGraphicUncompressedColorMaskClipLeft(char *data, __int16 colorMask) { int v2; // edx@1 char *v3; // edi@1 char *v4; // esi@1 int v5; // ecx@2 unsigned __int8 v6; // of@5 unsigned __int8 v7; // of@6 v4 = data; v3 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = drawGraphic_visiblePixelsClipY; do { v5 = drawGraphic_visiblePixelsClipX; do { if ( *(_WORD *)v4 != -2017 ) *(_WORD *)v3 &= colorMask; v4 += 2; v3 += 2; v6 = __SETO__(v5--, 1); } while ( !((v5 < 0 ^ v6) | v5 == 0) ); v4 += drawGraphic_copyBytesInBufferForClipX; v3 += drawGraphic_skipBytesInBufferForClipX; v7 = __SETO__(v2--, 1); } while ( !((v2 < 0 ^ v7) | v2 == 0) ); } void fun_drawGraphicUncompressedColorMaskClipRight(char *data, __int16 colorMask) { int v2; // edx@1 char *v3; // edi@1 char *v4; // esi@1 int v5; // ecx@2 unsigned __int8 v6; // of@5 unsigned __int8 v7; // of@6 v4 = data; v3 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = drawGraphic_visiblePixelsClipY; do { v5 = drawGraphic_visiblePixelsClipX; do { if ( *(_WORD *)v4 != -2017 ) *(_WORD *)v3 &= colorMask; v4 += 2; v3 += 2; v6 = __SETO__(v5--, 1); } while ( !((v5 < 0 ^ v6) | v5 == 0) ); v4 += drawGraphic_copyBytesInBufferForClipX; v3 += drawGraphic_skipBytesInBufferForClipX; v7 = __SETO__(v2--, 1); } while ( !((v2 < 0 ^ v7) | v2 == 0) ); } void fun_drawGraphicCompressedFull(char *data) { int v1; // edx@1 char *v2; // edi@1 char *v3; // esi@1 int v4; // ecx@2 char v5; // al@4 int v6; // eax@36 unsigned __int8 v7; // of@37 v3 = fun_drawGraphicGetOffsetClipTop(data); v2 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v1 = drawGraphic_visiblePixelsClipY; do { v4 = (signed __int16)drawGraphic_width; while ( v4 > 0 ) { v5 = *v3; if ( *v3 == -1 ) { v6 = v3[1]; v2 += v6 + v6; v3 += 2; v4 -= v6; } else { switch ( v5 ) { case 1: *(_WORD *)v2 = *(_WORD *)(v3 + 1); v3 += 3; v2 += 2; --v4; break; case 2: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); v3 += 5; v2 += 4; v4 -= 2; break; case 3: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_WORD *)v2 + 2) = *(_WORD *)(v3 + 5); v3 += 7; v2 += 6; v4 -= 3; break; case 4: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); v3 += 9; v2 += 8; v4 -= 4; break; case 16: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); *((_DWORD *)v2 + 5) = *(_DWORD *)(v3 + 21); *((_DWORD *)v2 + 6) = *(_DWORD *)(v3 + 25); *((_DWORD *)v2 + 7) = *(_DWORD *)(v3 + 29); v3 += 33; v2 += 32; v4 -= 16; break; case 5: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_WORD *)v2 + 4) = *(_WORD *)(v3 + 9); v3 += 11; v2 += 10; v4 -= 5; break; case 6: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); v3 += 13; v2 += 12; v4 -= 6; break; case 7: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_WORD *)v2 + 6) = *(_WORD *)(v3 + 13); v3 += 15; v2 += 14; v4 -= 7; break; case 8: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); v3 += 17; v2 += 16; v4 -= 8; break; case 9: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_WORD *)v2 + 8) = *(_WORD *)(v3 + 17); v3 += 19; v2 += 18; v4 -= 9; break; case 10: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); v3 += 21; v2 += 20; v4 -= 10; break; case 11: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); *((_WORD *)v2 + 10) = *(_WORD *)(v3 + 21); v3 += 23; v2 += 22; v4 -= 11; break; case 12: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); *((_DWORD *)v2 + 5) = *(_DWORD *)(v3 + 21); v3 += 25; v2 += 24; v4 -= 12; break; case 13: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); *((_DWORD *)v2 + 5) = *(_DWORD *)(v3 + 21); *((_WORD *)v2 + 12) = *(_WORD *)(v3 + 25); v3 += 27; v2 += 26; v4 -= 13; break; case 14: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); *((_DWORD *)v2 + 5) = *(_DWORD *)(v3 + 21); *((_DWORD *)v2 + 6) = *(_DWORD *)(v3 + 25); v3 += 29; v2 += 28; v4 -= 14; break; default: *(_DWORD *)v2 = *(_DWORD *)(v3 + 1); *((_DWORD *)v2 + 1) = *(_DWORD *)(v3 + 5); *((_DWORD *)v2 + 2) = *(_DWORD *)(v3 + 9); *((_DWORD *)v2 + 3) = *(_DWORD *)(v3 + 13); *((_DWORD *)v2 + 4) = *(_DWORD *)(v3 + 17); *((_DWORD *)v2 + 5) = *(_DWORD *)(v3 + 21); *((_DWORD *)v2 + 6) = *(_DWORD *)(v3 + 25); *((_WORD *)v2 + 14) = *(_WORD *)(v3 + 29); v3 += 31; v2 += 30; v4 -= 15; break; } } } v2 += drawGraphic_skipBytesInBufferForClipX; v7 = __SETO__(v1--, 1); } while ( !((v1 < 0 ^ v7) | v1 == 0) ); } void fun_drawGraphicCompressedClipLeft(char *data) { int v1; // edx@1 int v2; // edi@1 char *v3; // esi@1 unsigned int v4; // ecx@2 int v5; // ebx@2 unsigned int v6; // edi@2 int v7; // eax@3 unsigned __int8 v8; // of@8 signed int v9; // [sp-8h] [bp-54h]@2 int v10; // [sp-4h] [bp-50h]@2 v3 = fun_drawGraphicGetOffsetClipTop(data); v2 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; do { v5 = (signed __int16)drawGraphic_width; v4 = (unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1; v10 = v2; v9 = v1; v6 = v2 - ((unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1) - ((unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1); while ( 1 ) { v7 = 0; if ( v5 <= 0 ) break; v7 = (v7 & 0xffffff00) + *v3; if ( *v3 == -1 ) { v7 = (v7 & 0xffffff00) + v3[1]; v6 += v7 + v7; v3 += 2; v4 -= v7; v5 -= v7; } else { ++v3; do { if ( v4 <= 0 ) *(_WORD *)v6 = *(_WORD *)v3; v3 += 2; v6 += 2; --v5; --v4; v8 = __SETO__(v7--, 1); } while ( !((v7 < 0 ^ v8) | v7 == 0) ); } } v2 = ddraw_scanline + v10; --v1; } while ( v9 > 1 ); } int fun_drawGraphicCompressedClipRight(char *data) { int v1; // edx@1 int v2; // edi@1 char *v3; // esi@1 int v4; // ecx@2 int v5; // ebx@2 int result; // eax@3 unsigned __int8 v7; // of@8 signed int v8; // [sp-8h] [bp-54h]@2 int v9; // [sp-4h] [bp-50h]@2 v3 = fun_drawGraphicGetOffsetClipTop(data); v2 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; do { v5 = (signed __int16)drawGraphic_width; v4 = drawGraphic_visiblePixelsClipX; v9 = v2; v8 = v1; while ( 1 ) { result = 0; if ( v5 <= 0 ) break; result = (result & 0xffffff00) +*v3; if ( *v3 == -1 ) { result = (result & 0xffffff00) + v3[1]; v2 += result + result; v3 += 2; v4 -= result; v5 -= result; } else { ++v3; do { if ( v4 > 0 ) *(_WORD *)v2 = *(_WORD *)v3; v3 += 2; v2 += 2; --v4; --v5; v7 = __SETO__(result--, 1); } while ( !((result < 0 ^ v7) | result == 0) ); } } v2 = ddraw_scanline + v9; --v1; } while ( v8 > 1 ); return result; } void fun_drawGraphicCompressedColorMaskFull(char *data, __int16 colorMask) { int v2; // eax@1 int v3; // edx@1 int *v4; // edi@1 char *v5; // esi@1 int v6; // eax@1 int v7; // ecx@2 char v8; // dl@4 int v9; // edx@36 signed int v10; // [sp-4h] [bp-50h]@2 v5 = fun_drawGraphicGetOffsetClipTop(data); v6 = ddraw_scanline * graphic_yOffset; v4 = (int *)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v6 = (v6 & 0xffff0000) + colorMask; v2 = v6 << 16; v2 = (v2 & 0xffff0000) + colorMask; v3 = drawGraphic_visiblePixelsClipY; do { v10 = v3; v7 = (signed __int16)drawGraphic_width; while ( v7 > 0 ) { v8 = *v5; if ( *v5 == -1 ) { v9 = v5[1]; v4 = (int *)((char *)v4 + v9 + v9); v5 += 2; v7 -= v9; } else { switch ( v8 ) { case 1: *(_WORD *)v4 &= colorMask; v5 += 3; v4 = (int *)((char *)v4 + 2); --v7; break; case 2: *v4 &= v2; v5 += 5; ++v4; v7 -= 2; break; case 3: *v4 &= v2; *((_WORD *)v4 + 2) &= colorMask; v5 += 7; v4 = (int *)((char *)v4 + 6); v7 -= 3; break; case 4: *v4 &= v2; v4[1] &= v2; v5 += 9; v4 += 2; v7 -= 4; break; case 16: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; v4[5] &= v2; v4[6] &= v2; v4[7] &= v2; v5 += 33; v4 += 8; v7 -= 16; break; case 5: *v4 &= v2; v4[1] &= v2; *((_WORD *)v4 + 4) &= colorMask; v5 += 11; v4 = (int *)((char *)v4 + 10); v7 -= 5; break; case 6: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v5 += 13; v4 += 3; v7 -= 6; break; case 7: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; *((_WORD *)v4 + 6) &= colorMask; v5 += 15; v4 = (int *)((char *)v4 + 14); v7 -= 7; break; case 8: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v5 += 17; v4 += 4; v7 -= 8; break; case 9: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; *((_WORD *)v4 + 8) &= colorMask; v5 += 19; v4 = (int *)((char *)v4 + 18); v7 -= 9; break; case 10: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; v5 += 21; v4 += 5; v7 -= 10; break; case 11: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; *((_WORD *)v4 + 10) &= colorMask; v5 += 23; v4 = (int *)((char *)v4 + 22); v7 -= 11; break; case 12: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; v4[5] &= v2; v5 += 25; v4 += 6; v7 -= 12; break; case 13: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; v4[5] &= v2; *((_WORD *)v4 + 12) &= colorMask; v5 += 27; v4 = (int *)((char *)v4 + 26); v7 -= 13; break; case 14: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; v4[5] &= v2; v4[6] &= v2; v5 += 29; v4 += 7; v7 -= 14; break; default: *v4 &= v2; v4[1] &= v2; v4[2] &= v2; v4[3] &= v2; v4[4] &= v2; v4[5] &= v2; v4[6] &= v2; *((_WORD *)v4 + 14) &= colorMask; v5 += 31; v4 = (int *)((char *)v4 + 30); v7 -= 15; break; } } } v4 = (int *)((char *)v4 + drawGraphic_skipBytesInBufferForClipX); v3 = v10 - 1; } while ( v10 > 1 ); } void fun_drawGraphicCompressedColorMaskClipLeft(char *a1, __int16 colorMask) { int v2; // edx@1 char *v3; // edi@1 char *v4; // esi@1 signed int v5; // ecx@2 int v6; // ebx@2 __int16 *v7; // edi@2 int v8; // edx@3 unsigned __int8 v9; // of@8 signed int v10; // [sp-8h] [bp-54h]@2 char *v11; // [sp-4h] [bp-50h]@2 v4 = fun_drawGraphicGetOffsetClipTop(a1); v3 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = drawGraphic_visiblePixelsClipY; do { v6 = (signed __int16)drawGraphic_width; v5 = (unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1; v11 = v3; v10 = v2; v7 = (__int16 *)(&v3[-((unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1)] - ((unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1)); while ( 1 ) { v8 = 0; if ( v6 <= 0 ) break; v8 = (v8 & 0xffffff00) + *v4; if ( *v4 == -1 ) { v8 = (v8 & 0xffffff00) + v4[1]; v7 = (__int16 *)((char *)v7 + v8 + v8); v4 += 2; v5 -= v8; v6 -= v8; } else { ++v4; do { if ( v5 <= 0 ) *v7 &= colorMask; v4 += 2; ++v7; --v6; --v5; v9 = __SETO__(v8--, 1); } while ( !((v8 < 0 ^ v9) | v8 == 0) ); } } v3 = &v11[ddraw_scanline]; v2 = v10 - 1; } while ( v10 > 1 ); } void fun_drawGraphicCompressedColorMaskClipRight(char *data, __int16 colorMask) { int v2; // edx@1 int v3; // edi@1 char *v4; // esi@1 int v5; // ecx@2 int v6; // ebx@2 int v7; // edx@3 unsigned __int8 v8; // of@8 signed int v9; // [sp-8h] [bp-54h]@2 int v10; // [sp-4h] [bp-50h]@2 v4 = fun_drawGraphicGetOffsetClipTop(data); v3 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v2 = drawGraphic_visiblePixelsClipY; do { v6 = (signed __int16)drawGraphic_width; v5 = drawGraphic_visiblePixelsClipX; v10 = v3; v9 = v2; while ( 1 ) { v7 = 0; if ( v6 <= 0 ) break; v7 = (v7 & 0xffffff00) + *v4; if ( *v4 == -1 ) { v7 = (v7 & 0xffffff00) + v4[1]; v3 += v7 + v7; v4 += 2; v5 -= v7; v6 -= v7; } else { ++v4; do { if ( v5 > 0 ) *(_WORD *)v3 &= colorMask; v4 += 2; v3 += 2; --v5; --v6; v8 = __SETO__(v7--, 1); } while ( !((v7 < 0 ^ v8) | v7 == 0) ); } } v3 = ddraw_scanline + v10; v2 = v9 - 1; } while ( v9 > 1 ); } void fun_drawGraphicLetterColoredFull(char *data) { int v1; // eax@1 int v2; // edx@1 char *v3; // edi@1 char *v4; // esi@1 int v5; // eax@1 int v6; // ecx@2 char v7; // bl@4 int v8; // ebx@36 unsigned __int8 v9; // of@37 v4 = fun_drawGraphicGetOffsetClipTop(data); v5 = ddraw_scanline * graphic_yOffset; v3 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v5 = (v5 & 0xffff0000) + drawtext_color; v1 = v5 << 16; v1 = (v1 & 0xffff0000) + drawtext_color; v2 = drawGraphic_visiblePixelsClipY; do { v6 = (signed __int16)drawGraphic_width; while ( v6 > 0 ) { v7 = *v4; if ( *v4 == -1 ) { v8 = v4[1]; v3 += v8 + v8; v4 += 2; v6 -= v8; } else { switch ( v7 ) { case 1: *(_WORD *)v3 = v1; v4 += 3; v3 += 2; --v6; break; case 2: *(_DWORD *)v3 = v1; v4 += 5; v3 += 4; v6 -= 2; break; case 3: *(_DWORD *)v3 = v1; *((_WORD *)v3 + 2) = v1; v4 += 7; v3 += 6; v6 -= 3; break; case 4: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; v4 += 9; v3 += 8; v6 -= 4; break; case 16: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; *((_DWORD *)v3 + 5) = v1; *((_DWORD *)v3 + 6) = v1; *((_DWORD *)v3 + 7) = v1; v4 += 33; v3 += 32; v6 -= 16; break; case 5: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_WORD *)v3 + 4) = v1; v4 += 11; v3 += 10; v6 -= 5; break; case 6: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; v4 += 13; v3 += 12; v6 -= 6; break; case 7: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_WORD *)v3 + 6) = v1; v4 += 15; v3 += 14; v6 -= 7; break; case 8: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; v4 += 17; v3 += 16; v6 -= 8; break; case 9: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_WORD *)v3 + 8) = v1; v4 += 19; v3 += 18; v6 -= 9; break; case 10: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; v4 += 21; v3 += 20; v6 -= 10; break; case 11: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; *((_WORD *)v3 + 10) = v1; v4 += 23; v3 += 22; v6 -= 11; break; case 12: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; *((_DWORD *)v3 + 5) = v1; v4 += 25; v3 += 24; v6 -= 12; break; case 13: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; *((_DWORD *)v3 + 5) = v1; *((_WORD *)v3 + 12) = v1; v4 += 27; v3 += 26; v6 -= 13; break; case 14: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; *((_DWORD *)v3 + 5) = v1; *((_DWORD *)v3 + 6) = v1; v4 += 29; v3 += 28; v6 -= 14; break; default: *(_DWORD *)v3 = v1; *((_DWORD *)v3 + 1) = v1; *((_DWORD *)v3 + 2) = v1; *((_DWORD *)v3 + 3) = v1; *((_DWORD *)v3 + 4) = v1; *((_DWORD *)v3 + 5) = v1; *((_DWORD *)v3 + 6) = v1; *((_WORD *)v3 + 14) = v1; v4 += 31; v3 += 30; v6 -= 15; break; } } } v3 += drawGraphic_skipBytesInBufferForClipX; v9 = __SETO__(v2--, 1); } while ( !((v2 < 0 ^ v9) | v2 == 0) ); } void fun_drawGraphicLetterColoredClipLeft(char *data) { int v1; // edx@1 int v2; // edi@1 char *v3; // esi@1 unsigned int v4; // ecx@2 int v5; // ebx@2 unsigned int v6; // edi@2 int v7; // eax@3 unsigned __int8 v8; // of@8 signed int v9; // [sp-8h] [bp-54h]@2 int v10; // [sp-4h] [bp-50h]@2 v3 = fun_drawGraphicGetOffsetClipTop(data); v2 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; do { v5 = (signed __int16)drawGraphic_width; v4 = (unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1; v10 = v2; v9 = v1; v6 = v2 - ((unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1) - ((unsigned int)drawGraphic_copyBytesInBufferForClipX >> 1); while ( 1 ) { v7 = 0; if ( v5 <= 0 ) break; v7 = (v7 & 0xffffff00) + *v3; if ( *v3 == -1 ) { v7 = (v7 & 0xffffff00) + v3[1]; v6 += v7 + v7; v3 += 2; v4 -= v7; v5 -= v7; } else { ++v3; do { if ( v4 <= 0 ) *(_WORD *)v6 = drawtext_color; v3 += 2; v6 += 2; --v5; --v4; v8 = __SETO__(v7--, 1); } while ( !((v7 < 0 ^ v8) | v7 == 0) ); } } v2 = ddraw_scanline + v10; --v1; } while ( v9 > 1 ); } void fun_drawGraphicLetterColoredClipRight(char *data) { int v1; // edx@1 int v2; // edi@1 char *v3; // esi@1 int v4; // ecx@2 int v5; // ebx@2 int v6; // eax@3 unsigned __int8 v7; // of@8 signed int v8; // [sp-8h] [bp-54h]@2 int v9; // [sp-4h] [bp-50h]@2 v3 = fun_drawGraphicGetOffsetClipTop(data); v2 = (int)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v1 = drawGraphic_visiblePixelsClipY; do { v5 = (signed __int16)drawGraphic_width; v4 = drawGraphic_visiblePixelsClipX; v9 = v2; v8 = v1; while ( 1 ) { v6 = 0; if ( v5 <= 0 ) break; v6 = (v6 & 0xffffff00) + *v3; if ( *v3 == -1 ) { v6 = (v6 & 0xffffff00) + v3[1]; v2 += v6 + v6; v3 += 2; v4 -= v6; v5 -= v6; } else { ++v3; do { if ( v4 > 0 ) *(_WORD *)v2 = drawtext_color; v3 += 2; v2 += 2; --v4; --v5; v7 = __SETO__(v6--, 1); } while ( !((v6 < 0 ^ v7) | v6 == 0) ); } } v2 = ddraw_scanline + v9; --v1; } while ( v8 > 1 ); } char * fun_drawGraphicGetOffsetClipTop(char *a1) { int v1; // edx@1 char *v2; // esi@1 int v3; // eax@3 int v4; // ecx@3 v2 = a1; v1 = drawGraphic_invisibleHeightClipTop; while ( v1 > 0 ) { --v1; v4 = (signed __int16)drawGraphic_width; v3 = 0; while ( v4 > 0 ) { v3 = (v3 & 0xffffff00) + *v2; if ( *v2 == -1 ) { v3 = (v3 & 0xffffff00) + v2[1]; v4 -= v3; v2 += 2; } else { v4 -= v3; v3 = 2 * v3 + 1; v2 += v3; } } } return v2; } void fun_drawGraphicType2(char *data) { char *v1; // edi@1 int v2; // ecx@1 v1 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = ddraw_scanline; *(_DWORD *)v1 = *(_DWORD *)data; *(_WORD *)&v1[v2] = *((_WORD *)data + 1); } void fun_drawImage_16x16(int *img) { char *v1; // edi@1 int v2; // ecx@1 v1 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = ddraw_scanline; *(_DWORD *)v1 = *img; *((_DWORD *)v1 + 1) = img[1]; *((_DWORD *)v1 + 2) = img[2]; *((_DWORD *)v1 + 3) = img[3]; *((_DWORD *)v1 + 4) = img[4]; *((_DWORD *)v1 + 5) = img[5]; *((_DWORD *)v1 + 6) = img[6]; *((_DWORD *)v1 + 7) = img[7]; *(_DWORD *)&v1[v2] = img[8]; *(_DWORD *)&v1[v2 + 4] = img[9]; *(_DWORD *)&v1[v2 + 8] = img[10]; *(_DWORD *)&v1[v2 + 12] = img[11]; *(_DWORD *)&v1[v2 + 16] = img[12]; *(_DWORD *)&v1[v2 + 20] = img[13]; *(_DWORD *)&v1[v2 + 24] = img[14]; *(_DWORD *)&v1[v2 + 28] = img[15]; *(_DWORD *)&v1[2 * v2] = img[16]; *(_DWORD *)&v1[2 * v2 + 4] = img[17]; *(_DWORD *)&v1[2 * v2 + 8] = img[18]; *(_DWORD *)&v1[2 * v2 + 12] = img[19]; *(_DWORD *)&v1[2 * v2 + 16] = img[20]; *(_DWORD *)&v1[2 * v2 + 20] = img[21]; *(_DWORD *)&v1[2 * v2 + 24] = img[22]; *(_DWORD *)&v1[2 * v2 + 28] = img[23]; *(_DWORD *)&v1[3 * v2] = img[24]; *(_DWORD *)&v1[3 * v2 + 4] = img[25]; *(_DWORD *)&v1[3 * v2 + 8] = img[26]; *(_DWORD *)&v1[3 * v2 + 12] = img[27]; *(_DWORD *)&v1[3 * v2 + 16] = img[28]; *(_DWORD *)&v1[3 * v2 + 20] = img[29]; *(_DWORD *)&v1[3 * v2 + 24] = img[30]; *(_DWORD *)&v1[3 * v2 + 28] = img[31]; *(_DWORD *)&v1[4 * v2] = img[32]; *(_DWORD *)&v1[4 * v2 + 4] = img[33]; *(_DWORD *)&v1[4 * v2 + 8] = img[34]; *(_DWORD *)&v1[4 * v2 + 12] = img[35]; *(_DWORD *)&v1[4 * v2 + 16] = img[36]; *(_DWORD *)&v1[4 * v2 + 20] = img[37]; *(_DWORD *)&v1[4 * v2 + 24] = img[38]; *(_DWORD *)&v1[4 * v2 + 28] = img[39]; *(_DWORD *)&v1[5 * v2] = img[40]; *(_DWORD *)&v1[5 * v2 + 4] = img[41]; *(_DWORD *)&v1[5 * v2 + 8] = img[42]; *(_DWORD *)&v1[5 * v2 + 12] = img[43]; *(_DWORD *)&v1[5 * v2 + 16] = img[44]; *(_DWORD *)&v1[5 * v2 + 20] = img[45]; *(_DWORD *)&v1[5 * v2 + 24] = img[46]; *(_DWORD *)&v1[5 * v2 + 28] = img[47]; *(_DWORD *)&v1[6 * v2] = img[48]; *(_DWORD *)&v1[6 * v2 + 4] = img[49]; *(_DWORD *)&v1[6 * v2 + 8] = img[50]; *(_DWORD *)&v1[6 * v2 + 12] = img[51]; *(_DWORD *)&v1[6 * v2 + 16] = img[52]; *(_DWORD *)&v1[6 * v2 + 20] = img[53]; *(_DWORD *)&v1[6 * v2 + 24] = img[54]; *(_DWORD *)&v1[6 * v2 + 28] = img[55]; *(_DWORD *)&v1[7 * v2] = img[56]; *(_DWORD *)&v1[7 * v2 + 4] = img[57]; *(_DWORD *)&v1[7 * v2 + 8] = img[58]; *(_DWORD *)&v1[7 * v2 + 12] = img[59]; *(_DWORD *)&v1[7 * v2 + 16] = img[60]; *(_DWORD *)&v1[7 * v2 + 20] = img[61]; *(_DWORD *)&v1[7 * v2 + 24] = img[62]; *(_DWORD *)&v1[7 * v2 + 28] = img[63]; *(_DWORD *)&v1[8 * v2] = img[64]; *(_DWORD *)&v1[8 * v2 + 4] = img[65]; *(_DWORD *)&v1[8 * v2 + 8] = img[66]; *(_DWORD *)&v1[8 * v2 + 12] = img[67]; *(_DWORD *)&v1[8 * v2 + 16] = img[68]; *(_DWORD *)&v1[8 * v2 + 20] = img[69]; *(_DWORD *)&v1[8 * v2 + 24] = img[70]; *(_DWORD *)&v1[8 * v2 + 28] = img[71]; *(_DWORD *)&v1[9 * v2] = img[72]; *(_DWORD *)&v1[9 * v2 + 4] = img[73]; *(_DWORD *)&v1[9 * v2 + 8] = img[74]; *(_DWORD *)&v1[9 * v2 + 12] = img[75]; *(_DWORD *)&v1[9 * v2 + 16] = img[76]; *(_DWORD *)&v1[9 * v2 + 20] = img[77]; *(_DWORD *)&v1[9 * v2 + 24] = img[78]; *(_DWORD *)&v1[9 * v2 + 28] = img[79]; *(_DWORD *)&v1[10 * v2] = img[80]; *(_DWORD *)&v1[10 * v2 + 4] = img[81]; *(_DWORD *)&v1[10 * v2 + 8] = img[82]; *(_DWORD *)&v1[10 * v2 + 12] = img[83]; *(_DWORD *)&v1[10 * v2 + 16] = img[84]; *(_DWORD *)&v1[10 * v2 + 20] = img[85]; *(_DWORD *)&v1[10 * v2 + 24] = img[86]; *(_DWORD *)&v1[10 * v2 + 28] = img[87]; *(_DWORD *)&v1[11 * v2] = img[88]; *(_DWORD *)&v1[11 * v2 + 4] = img[89]; *(_DWORD *)&v1[11 * v2 + 8] = img[90]; *(_DWORD *)&v1[11 * v2 + 12] = img[91]; *(_DWORD *)&v1[11 * v2 + 16] = img[92]; *(_DWORD *)&v1[11 * v2 + 20] = img[93]; *(_DWORD *)&v1[11 * v2 + 24] = img[94]; *(_DWORD *)&v1[11 * v2 + 28] = img[95]; *(_DWORD *)&v1[12 * v2] = img[96]; *(_DWORD *)&v1[12 * v2 + 4] = img[97]; *(_DWORD *)&v1[12 * v2 + 8] = img[98]; *(_DWORD *)&v1[12 * v2 + 12] = img[99]; *(_DWORD *)&v1[12 * v2 + 16] = img[100]; *(_DWORD *)&v1[12 * v2 + 20] = img[101]; *(_DWORD *)&v1[12 * v2 + 24] = img[102]; *(_DWORD *)&v1[12 * v2 + 28] = img[103]; *(_DWORD *)&v1[13 * v2] = img[104]; *(_DWORD *)&v1[13 * v2 + 4] = img[105]; *(_DWORD *)&v1[13 * v2 + 8] = img[106]; *(_DWORD *)&v1[13 * v2 + 12] = img[107]; *(_DWORD *)&v1[13 * v2 + 16] = img[108]; *(_DWORD *)&v1[13 * v2 + 20] = img[109]; *(_DWORD *)&v1[13 * v2 + 24] = img[110]; *(_DWORD *)&v1[13 * v2 + 28] = img[111]; *(_DWORD *)&v1[14 * v2] = img[112]; *(_DWORD *)&v1[14 * v2 + 4] = img[113]; *(_DWORD *)&v1[14 * v2 + 8] = img[114]; *(_DWORD *)&v1[14 * v2 + 12] = img[115]; *(_DWORD *)&v1[14 * v2 + 16] = img[116]; *(_DWORD *)&v1[14 * v2 + 20] = img[117]; *(_DWORD *)&v1[14 * v2 + 24] = img[118]; *(_DWORD *)&v1[14 * v2 + 28] = img[119]; *(_DWORD *)&v1[15 * v2] = img[120]; *(_DWORD *)&v1[15 * v2 + 4] = img[121]; *(_DWORD *)&v1[15 * v2 + 8] = img[122]; *(_DWORD *)&v1[15 * v2 + 12] = img[123]; *(_DWORD *)&v1[15 * v2 + 16] = img[124]; *(_DWORD *)&v1[15 * v2 + 20] = img[125]; *(_DWORD *)&v1[15 * v2 + 24] = img[126]; *(_DWORD *)&v1[15 * v2 + 28] = img[127]; } void fun_drawImage_24x24(int *img) { char *v1; // edi@1 int v2; // ecx@1 v1 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = ddraw_scanline; *(_DWORD *)v1 = *img; *((_DWORD *)v1 + 1) = img[1]; *((_DWORD *)v1 + 2) = img[2]; *((_DWORD *)v1 + 3) = img[3]; *((_DWORD *)v1 + 4) = img[4]; *((_DWORD *)v1 + 5) = img[5]; *((_DWORD *)v1 + 6) = img[6]; *((_DWORD *)v1 + 7) = img[7]; *((_DWORD *)v1 + 8) = img[8]; *((_DWORD *)v1 + 9) = img[9]; *((_DWORD *)v1 + 10) = img[10]; *((_DWORD *)v1 + 11) = img[11]; *(_DWORD *)&v1[v2] = img[12]; *(_DWORD *)&v1[v2 + 4] = img[13]; *(_DWORD *)&v1[v2 + 8] = img[14]; *(_DWORD *)&v1[v2 + 12] = img[15]; *(_DWORD *)&v1[v2 + 16] = img[16]; *(_DWORD *)&v1[v2 + 20] = img[17]; *(_DWORD *)&v1[v2 + 24] = img[18]; *(_DWORD *)&v1[v2 + 28] = img[19]; *(_DWORD *)&v1[v2 + 32] = img[20]; *(_DWORD *)&v1[v2 + 36] = img[21]; *(_DWORD *)&v1[v2 + 40] = img[22]; *(_DWORD *)&v1[v2 + 44] = img[23]; *(_DWORD *)&v1[2 * v2] = img[24]; *(_DWORD *)&v1[2 * v2 + 4] = img[25]; *(_DWORD *)&v1[2 * v2 + 8] = img[26]; *(_DWORD *)&v1[2 * v2 + 12] = img[27]; *(_DWORD *)&v1[2 * v2 + 16] = img[28]; *(_DWORD *)&v1[2 * v2 + 20] = img[29]; *(_DWORD *)&v1[2 * v2 + 24] = img[30]; *(_DWORD *)&v1[2 * v2 + 28] = img[31]; *(_DWORD *)&v1[2 * v2 + 32] = img[32]; *(_DWORD *)&v1[2 * v2 + 36] = img[33]; *(_DWORD *)&v1[2 * v2 + 40] = img[34]; *(_DWORD *)&v1[2 * v2 + 44] = img[35]; *(_DWORD *)&v1[3 * v2] = img[36]; *(_DWORD *)&v1[3 * v2 + 4] = img[37]; *(_DWORD *)&v1[3 * v2 + 8] = img[38]; *(_DWORD *)&v1[3 * v2 + 12] = img[39]; *(_DWORD *)&v1[3 * v2 + 16] = img[40]; *(_DWORD *)&v1[3 * v2 + 20] = img[41]; *(_DWORD *)&v1[3 * v2 + 24] = img[42]; *(_DWORD *)&v1[3 * v2 + 28] = img[43]; *(_DWORD *)&v1[3 * v2 + 32] = img[44]; *(_DWORD *)&v1[3 * v2 + 36] = img[45]; *(_DWORD *)&v1[3 * v2 + 40] = img[46]; *(_DWORD *)&v1[3 * v2 + 44] = img[47]; *(_DWORD *)&v1[4 * v2] = img[48]; *(_DWORD *)&v1[4 * v2 + 4] = img[49]; *(_DWORD *)&v1[4 * v2 + 8] = img[50]; *(_DWORD *)&v1[4 * v2 + 12] = img[51]; *(_DWORD *)&v1[4 * v2 + 16] = img[52]; *(_DWORD *)&v1[4 * v2 + 20] = img[53]; *(_DWORD *)&v1[4 * v2 + 24] = img[54]; *(_DWORD *)&v1[4 * v2 + 28] = img[55]; *(_DWORD *)&v1[4 * v2 + 32] = img[56]; *(_DWORD *)&v1[4 * v2 + 36] = img[57]; *(_DWORD *)&v1[4 * v2 + 40] = img[58]; *(_DWORD *)&v1[4 * v2 + 44] = img[59]; *(_DWORD *)&v1[5 * v2] = img[60]; *(_DWORD *)&v1[5 * v2 + 4] = img[61]; *(_DWORD *)&v1[5 * v2 + 8] = img[62]; *(_DWORD *)&v1[5 * v2 + 12] = img[63]; *(_DWORD *)&v1[5 * v2 + 16] = img[64]; *(_DWORD *)&v1[5 * v2 + 20] = img[65]; *(_DWORD *)&v1[5 * v2 + 24] = img[66]; *(_DWORD *)&v1[5 * v2 + 28] = img[67]; *(_DWORD *)&v1[5 * v2 + 32] = img[68]; *(_DWORD *)&v1[5 * v2 + 36] = img[69]; *(_DWORD *)&v1[5 * v2 + 40] = img[70]; *(_DWORD *)&v1[5 * v2 + 44] = img[71]; *(_DWORD *)&v1[6 * v2] = img[72]; *(_DWORD *)&v1[6 * v2 + 4] = img[73]; *(_DWORD *)&v1[6 * v2 + 8] = img[74]; *(_DWORD *)&v1[6 * v2 + 12] = img[75]; *(_DWORD *)&v1[6 * v2 + 16] = img[76]; *(_DWORD *)&v1[6 * v2 + 20] = img[77]; *(_DWORD *)&v1[6 * v2 + 24] = img[78]; *(_DWORD *)&v1[6 * v2 + 28] = img[79]; *(_DWORD *)&v1[6 * v2 + 32] = img[80]; *(_DWORD *)&v1[6 * v2 + 36] = img[81]; *(_DWORD *)&v1[6 * v2 + 40] = img[82]; *(_DWORD *)&v1[6 * v2 + 44] = img[83]; *(_DWORD *)&v1[7 * v2] = img[84]; *(_DWORD *)&v1[7 * v2 + 4] = img[85]; *(_DWORD *)&v1[7 * v2 + 8] = img[86]; *(_DWORD *)&v1[7 * v2 + 12] = img[87]; *(_DWORD *)&v1[7 * v2 + 16] = img[88]; *(_DWORD *)&v1[7 * v2 + 20] = img[89]; *(_DWORD *)&v1[7 * v2 + 24] = img[90]; *(_DWORD *)&v1[7 * v2 + 28] = img[91]; *(_DWORD *)&v1[7 * v2 + 32] = img[92]; *(_DWORD *)&v1[7 * v2 + 36] = img[93]; *(_DWORD *)&v1[7 * v2 + 40] = img[94]; *(_DWORD *)&v1[7 * v2 + 44] = img[95]; *(_DWORD *)&v1[8 * v2] = img[96]; *(_DWORD *)&v1[8 * v2 + 4] = img[97]; *(_DWORD *)&v1[8 * v2 + 8] = img[98]; *(_DWORD *)&v1[8 * v2 + 12] = img[99]; *(_DWORD *)&v1[8 * v2 + 16] = img[100]; *(_DWORD *)&v1[8 * v2 + 20] = img[101]; *(_DWORD *)&v1[8 * v2 + 24] = img[102]; *(_DWORD *)&v1[8 * v2 + 28] = img[103]; *(_DWORD *)&v1[8 * v2 + 32] = img[104]; *(_DWORD *)&v1[8 * v2 + 36] = img[105]; *(_DWORD *)&v1[8 * v2 + 40] = img[106]; *(_DWORD *)&v1[8 * v2 + 44] = img[107]; *(_DWORD *)&v1[9 * v2] = img[108]; *(_DWORD *)&v1[9 * v2 + 4] = img[109]; *(_DWORD *)&v1[9 * v2 + 8] = img[110]; *(_DWORD *)&v1[9 * v2 + 12] = img[111]; *(_DWORD *)&v1[9 * v2 + 16] = img[112]; *(_DWORD *)&v1[9 * v2 + 20] = img[113]; *(_DWORD *)&v1[9 * v2 + 24] = img[114]; *(_DWORD *)&v1[9 * v2 + 28] = img[115]; *(_DWORD *)&v1[9 * v2 + 32] = img[116]; *(_DWORD *)&v1[9 * v2 + 36] = img[117]; *(_DWORD *)&v1[9 * v2 + 40] = img[118]; *(_DWORD *)&v1[9 * v2 + 44] = img[119]; *(_DWORD *)&v1[10 * v2] = img[120]; *(_DWORD *)&v1[10 * v2 + 4] = img[121]; *(_DWORD *)&v1[10 * v2 + 8] = img[122]; *(_DWORD *)&v1[10 * v2 + 12] = img[123]; *(_DWORD *)&v1[10 * v2 + 16] = img[124]; *(_DWORD *)&v1[10 * v2 + 20] = img[125]; *(_DWORD *)&v1[10 * v2 + 24] = img[126]; *(_DWORD *)&v1[10 * v2 + 28] = img[127]; *(_DWORD *)&v1[10 * v2 + 32] = img[128]; *(_DWORD *)&v1[10 * v2 + 36] = img[129]; *(_DWORD *)&v1[10 * v2 + 40] = img[130]; *(_DWORD *)&v1[10 * v2 + 44] = img[131]; *(_DWORD *)&v1[11 * v2] = img[132]; *(_DWORD *)&v1[11 * v2 + 4] = img[133]; *(_DWORD *)&v1[11 * v2 + 8] = img[134]; *(_DWORD *)&v1[11 * v2 + 12] = img[135]; *(_DWORD *)&v1[11 * v2 + 16] = img[136]; *(_DWORD *)&v1[11 * v2 + 20] = img[137]; *(_DWORD *)&v1[11 * v2 + 24] = img[138]; *(_DWORD *)&v1[11 * v2 + 28] = img[139]; *(_DWORD *)&v1[11 * v2 + 32] = img[140]; *(_DWORD *)&v1[11 * v2 + 36] = img[141]; *(_DWORD *)&v1[11 * v2 + 40] = img[142]; *(_DWORD *)&v1[11 * v2 + 44] = img[143]; *(_DWORD *)&v1[12 * v2] = img[144]; *(_DWORD *)&v1[12 * v2 + 4] = img[145]; *(_DWORD *)&v1[12 * v2 + 8] = img[146]; *(_DWORD *)&v1[12 * v2 + 12] = img[147]; *(_DWORD *)&v1[12 * v2 + 16] = img[148]; *(_DWORD *)&v1[12 * v2 + 20] = img[149]; *(_DWORD *)&v1[12 * v2 + 24] = img[150]; *(_DWORD *)&v1[12 * v2 + 28] = img[151]; *(_DWORD *)&v1[12 * v2 + 32] = img[152]; *(_DWORD *)&v1[12 * v2 + 36] = img[153]; *(_DWORD *)&v1[12 * v2 + 40] = img[154]; *(_DWORD *)&v1[12 * v2 + 44] = img[155]; *(_DWORD *)&v1[13 * v2] = img[156]; *(_DWORD *)&v1[13 * v2 + 4] = img[157]; *(_DWORD *)&v1[13 * v2 + 8] = img[158]; *(_DWORD *)&v1[13 * v2 + 12] = img[159]; *(_DWORD *)&v1[13 * v2 + 16] = img[160]; *(_DWORD *)&v1[13 * v2 + 20] = img[161]; *(_DWORD *)&v1[13 * v2 + 24] = img[162]; *(_DWORD *)&v1[13 * v2 + 28] = img[163]; *(_DWORD *)&v1[13 * v2 + 32] = img[164]; *(_DWORD *)&v1[13 * v2 + 36] = img[165]; *(_DWORD *)&v1[13 * v2 + 40] = img[166]; *(_DWORD *)&v1[13 * v2 + 44] = img[167]; *(_DWORD *)&v1[14 * v2] = img[168]; *(_DWORD *)&v1[14 * v2 + 4] = img[169]; *(_DWORD *)&v1[14 * v2 + 8] = img[170]; *(_DWORD *)&v1[14 * v2 + 12] = img[171]; *(_DWORD *)&v1[14 * v2 + 16] = img[172]; *(_DWORD *)&v1[14 * v2 + 20] = img[173]; *(_DWORD *)&v1[14 * v2 + 24] = img[174]; *(_DWORD *)&v1[14 * v2 + 28] = img[175]; *(_DWORD *)&v1[14 * v2 + 32] = img[176]; *(_DWORD *)&v1[14 * v2 + 36] = img[177]; *(_DWORD *)&v1[14 * v2 + 40] = img[178]; *(_DWORD *)&v1[14 * v2 + 44] = img[179]; *(_DWORD *)&v1[15 * v2] = img[180]; *(_DWORD *)&v1[15 * v2 + 4] = img[181]; *(_DWORD *)&v1[15 * v2 + 8] = img[182]; *(_DWORD *)&v1[15 * v2 + 12] = img[183]; *(_DWORD *)&v1[15 * v2 + 16] = img[184]; *(_DWORD *)&v1[15 * v2 + 20] = img[185]; *(_DWORD *)&v1[15 * v2 + 24] = img[186]; *(_DWORD *)&v1[15 * v2 + 28] = img[187]; *(_DWORD *)&v1[15 * v2 + 32] = img[188]; *(_DWORD *)&v1[15 * v2 + 36] = img[189]; *(_DWORD *)&v1[15 * v2 + 40] = img[190]; *(_DWORD *)&v1[15 * v2 + 44] = img[191]; *(_DWORD *)&v1[16 * v2] = img[192]; *(_DWORD *)&v1[16 * v2 + 4] = img[193]; *(_DWORD *)&v1[16 * v2 + 8] = img[194]; *(_DWORD *)&v1[16 * v2 + 12] = img[195]; *(_DWORD *)&v1[16 * v2 + 16] = img[196]; *(_DWORD *)&v1[16 * v2 + 20] = img[197]; *(_DWORD *)&v1[16 * v2 + 24] = img[198]; *(_DWORD *)&v1[16 * v2 + 28] = img[199]; *(_DWORD *)&v1[16 * v2 + 32] = img[200]; *(_DWORD *)&v1[16 * v2 + 36] = img[201]; *(_DWORD *)&v1[16 * v2 + 40] = img[202]; *(_DWORD *)&v1[16 * v2 + 44] = img[203]; *(_DWORD *)&v1[17 * v2] = img[204]; *(_DWORD *)&v1[17 * v2 + 4] = img[205]; *(_DWORD *)&v1[17 * v2 + 8] = img[206]; *(_DWORD *)&v1[17 * v2 + 12] = img[207]; *(_DWORD *)&v1[17 * v2 + 16] = img[208]; *(_DWORD *)&v1[17 * v2 + 20] = img[209]; *(_DWORD *)&v1[17 * v2 + 24] = img[210]; *(_DWORD *)&v1[17 * v2 + 28] = img[211]; *(_DWORD *)&v1[17 * v2 + 32] = img[212]; *(_DWORD *)&v1[17 * v2 + 36] = img[213]; *(_DWORD *)&v1[17 * v2 + 40] = img[214]; *(_DWORD *)&v1[17 * v2 + 44] = img[215]; *(_DWORD *)&v1[18 * v2] = img[216]; *(_DWORD *)&v1[18 * v2 + 4] = img[217]; *(_DWORD *)&v1[18 * v2 + 8] = img[218]; *(_DWORD *)&v1[18 * v2 + 12] = img[219]; *(_DWORD *)&v1[18 * v2 + 16] = img[220]; *(_DWORD *)&v1[18 * v2 + 20] = img[221]; *(_DWORD *)&v1[18 * v2 + 24] = img[222]; *(_DWORD *)&v1[18 * v2 + 28] = img[223]; *(_DWORD *)&v1[18 * v2 + 32] = img[224]; *(_DWORD *)&v1[18 * v2 + 36] = img[225]; *(_DWORD *)&v1[18 * v2 + 40] = img[226]; *(_DWORD *)&v1[18 * v2 + 44] = img[227]; *(_DWORD *)&v1[19 * v2] = img[228]; *(_DWORD *)&v1[19 * v2 + 4] = img[229]; *(_DWORD *)&v1[19 * v2 + 8] = img[230]; *(_DWORD *)&v1[19 * v2 + 12] = img[231]; *(_DWORD *)&v1[19 * v2 + 16] = img[232]; *(_DWORD *)&v1[19 * v2 + 20] = img[233]; *(_DWORD *)&v1[19 * v2 + 24] = img[234]; *(_DWORD *)&v1[19 * v2 + 28] = img[235]; *(_DWORD *)&v1[19 * v2 + 32] = img[236]; *(_DWORD *)&v1[19 * v2 + 36] = img[237]; *(_DWORD *)&v1[19 * v2 + 40] = img[238]; *(_DWORD *)&v1[19 * v2 + 44] = img[239]; *(_DWORD *)&v1[20 * v2] = img[240]; *(_DWORD *)&v1[20 * v2 + 4] = img[241]; *(_DWORD *)&v1[20 * v2 + 8] = img[242]; *(_DWORD *)&v1[20 * v2 + 12] = img[243]; *(_DWORD *)&v1[20 * v2 + 16] = img[244]; *(_DWORD *)&v1[20 * v2 + 20] = img[245]; *(_DWORD *)&v1[20 * v2 + 24] = img[246]; *(_DWORD *)&v1[20 * v2 + 28] = img[247]; *(_DWORD *)&v1[20 * v2 + 32] = img[248]; *(_DWORD *)&v1[20 * v2 + 36] = img[249]; *(_DWORD *)&v1[20 * v2 + 40] = img[250]; *(_DWORD *)&v1[20 * v2 + 44] = img[251]; *(_DWORD *)&v1[21 * v2] = img[252]; *(_DWORD *)&v1[21 * v2 + 4] = img[253]; *(_DWORD *)&v1[21 * v2 + 8] = img[254]; *(_DWORD *)&v1[21 * v2 + 12] = img[255]; *(_DWORD *)&v1[21 * v2 + 16] = img[256]; *(_DWORD *)&v1[21 * v2 + 20] = img[257]; *(_DWORD *)&v1[21 * v2 + 24] = img[258]; *(_DWORD *)&v1[21 * v2 + 28] = img[259]; *(_DWORD *)&v1[21 * v2 + 32] = img[260]; *(_DWORD *)&v1[21 * v2 + 36] = img[261]; *(_DWORD *)&v1[21 * v2 + 40] = img[262]; *(_DWORD *)&v1[21 * v2 + 44] = img[263]; *(_DWORD *)&v1[22 * v2] = img[264]; *(_DWORD *)&v1[22 * v2 + 4] = img[265]; *(_DWORD *)&v1[22 * v2 + 8] = img[266]; *(_DWORD *)&v1[22 * v2 + 12] = img[267]; *(_DWORD *)&v1[22 * v2 + 16] = img[268]; *(_DWORD *)&v1[22 * v2 + 20] = img[269]; *(_DWORD *)&v1[22 * v2 + 24] = img[270]; *(_DWORD *)&v1[22 * v2 + 28] = img[271]; *(_DWORD *)&v1[22 * v2 + 32] = img[272]; *(_DWORD *)&v1[22 * v2 + 36] = img[273]; *(_DWORD *)&v1[22 * v2 + 40] = img[274]; *(_DWORD *)&v1[22 * v2 + 44] = img[275]; *(_DWORD *)&v1[23 * v2] = img[276]; *(_DWORD *)&v1[23 * v2 + 4] = img[277]; *(_DWORD *)&v1[23 * v2 + 8] = img[278]; *(_DWORD *)&v1[23 * v2 + 12] = img[279]; *(_DWORD *)&v1[23 * v2 + 16] = img[280]; *(_DWORD *)&v1[23 * v2 + 20] = img[281]; *(_DWORD *)&v1[23 * v2 + 24] = img[282]; *(_DWORD *)&v1[23 * v2 + 28] = img[283]; *(_DWORD *)&v1[23 * v2 + 32] = img[284]; *(_DWORD *)&v1[23 * v2 + 36] = img[285]; *(_DWORD *)&v1[23 * v2 + 40] = img[286]; *(_DWORD *)&v1[23 * v2 + 44] = img[287]; } void fun_drawImage_32x32(int *img) { int *v1; // edi@1 int v2; // ecx@1 v1 = (int *)((char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset); v2 = ddraw_scanline; *v1 = *img; v1[1] = img[1]; v1[2] = img[2]; v1[3] = img[3]; v1[4] = img[4]; v1[5] = img[5]; v1[6] = img[6]; v1[7] = img[7]; v1[8] = img[8]; v1[9] = img[9]; v1[10] = img[10]; v1[11] = img[11]; v1[12] = img[12]; v1[13] = img[13]; v1[14] = img[14]; v1[15] = img[15]; *(int *)((char *)v1 + v2) = img[16]; *(int *)((char *)v1 + v2 + 4) = img[17]; *(int *)((char *)v1 + v2 + 8) = img[18]; *(int *)((char *)v1 + v2 + 12) = img[19]; *(int *)((char *)v1 + v2 + 16) = img[20]; *(int *)((char *)v1 + v2 + 20) = img[21]; *(int *)((char *)v1 + v2 + 24) = img[22]; *(int *)((char *)v1 + v2 + 28) = img[23]; *(int *)((char *)v1 + v2 + 32) = img[24]; *(int *)((char *)v1 + v2 + 36) = img[25]; *(int *)((char *)v1 + v2 + 40) = img[26]; *(int *)((char *)v1 + v2 + 44) = img[27]; *(int *)((char *)v1 + v2 + 48) = img[28]; *(int *)((char *)v1 + v2 + 52) = img[29]; *(int *)((char *)v1 + v2 + 56) = img[30]; *(int *)((char *)v1 + v2 + 60) = img[31]; *(int *)((char *)v1 + 2 * v2) = img[32]; *(int *)((char *)v1 + 2 * v2 + 4) = img[33]; *(int *)((char *)v1 + 2 * v2 + 8) = img[34]; *(int *)((char *)v1 + 2 * v2 + 12) = img[35]; *(int *)((char *)v1 + 2 * v2 + 16) = img[36]; *(int *)((char *)v1 + 2 * v2 + 20) = img[37]; *(int *)((char *)v1 + 2 * v2 + 24) = img[38]; *(int *)((char *)v1 + 2 * v2 + 28) = img[39]; *(int *)((char *)v1 + 2 * v2 + 32) = img[40]; *(int *)((char *)v1 + 2 * v2 + 36) = img[41]; *(int *)((char *)v1 + 2 * v2 + 40) = img[42]; *(int *)((char *)v1 + 2 * v2 + 44) = img[43]; *(int *)((char *)v1 + 2 * v2 + 48) = img[44]; *(int *)((char *)v1 + 2 * v2 + 52) = img[45]; *(int *)((char *)v1 + 2 * v2 + 56) = img[46]; *(int *)((char *)v1 + 2 * v2 + 60) = img[47]; *(int *)((char *)v1 + 3 * v2) = img[48]; *(int *)((char *)v1 + 3 * v2 + 4) = img[49]; *(int *)((char *)v1 + 3 * v2 + 8) = img[50]; *(int *)((char *)v1 + 3 * v2 + 12) = img[51]; *(int *)((char *)v1 + 3 * v2 + 16) = img[52]; *(int *)((char *)v1 + 3 * v2 + 20) = img[53]; *(int *)((char *)v1 + 3 * v2 + 24) = img[54]; *(int *)((char *)v1 + 3 * v2 + 28) = img[55]; *(int *)((char *)v1 + 3 * v2 + 32) = img[56]; *(int *)((char *)v1 + 3 * v2 + 36) = img[57]; *(int *)((char *)v1 + 3 * v2 + 40) = img[58]; *(int *)((char *)v1 + 3 * v2 + 44) = img[59]; *(int *)((char *)v1 + 3 * v2 + 48) = img[60]; *(int *)((char *)v1 + 3 * v2 + 52) = img[61]; *(int *)((char *)v1 + 3 * v2 + 56) = img[62]; *(int *)((char *)v1 + 3 * v2 + 60) = img[63]; v1[v2] = img[64]; v1[v2 + 1] = img[65]; v1[v2 + 2] = img[66]; v1[v2 + 3] = img[67]; v1[v2 + 4] = img[68]; v1[v2 + 5] = img[69]; v1[v2 + 6] = img[70]; v1[v2 + 7] = img[71]; v1[v2 + 8] = img[72]; v1[v2 + 9] = img[73]; v1[v2 + 10] = img[74]; v1[v2 + 11] = img[75]; v1[v2 + 12] = img[76]; v1[v2 + 13] = img[77]; v1[v2 + 14] = img[78]; v1[v2 + 15] = img[79]; *(int *)((char *)v1 + 5 * v2) = img[80]; *(int *)((char *)v1 + 5 * v2 + 4) = img[81]; *(int *)((char *)v1 + 5 * v2 + 8) = img[82]; *(int *)((char *)v1 + 5 * v2 + 12) = img[83]; *(int *)((char *)v1 + 5 * v2 + 16) = img[84]; *(int *)((char *)v1 + 5 * v2 + 20) = img[85]; *(int *)((char *)v1 + 5 * v2 + 24) = img[86]; *(int *)((char *)v1 + 5 * v2 + 28) = img[87]; *(int *)((char *)v1 + 5 * v2 + 32) = img[88]; *(int *)((char *)v1 + 5 * v2 + 36) = img[89]; *(int *)((char *)v1 + 5 * v2 + 40) = img[90]; *(int *)((char *)v1 + 5 * v2 + 44) = img[91]; *(int *)((char *)v1 + 5 * v2 + 48) = img[92]; *(int *)((char *)v1 + 5 * v2 + 52) = img[93]; *(int *)((char *)v1 + 5 * v2 + 56) = img[94]; *(int *)((char *)v1 + 5 * v2 + 60) = img[95]; *(int *)((char *)v1 + 6 * v2) = img[96]; *(int *)((char *)v1 + 6 * v2 + 4) = img[97]; *(int *)((char *)v1 + 6 * v2 + 8) = img[98]; *(int *)((char *)v1 + 6 * v2 + 12) = img[99]; *(int *)((char *)v1 + 6 * v2 + 16) = img[100]; *(int *)((char *)v1 + 6 * v2 + 20) = img[101]; *(int *)((char *)v1 + 6 * v2 + 24) = img[102]; *(int *)((char *)v1 + 6 * v2 + 28) = img[103]; *(int *)((char *)v1 + 6 * v2 + 32) = img[104]; *(int *)((char *)v1 + 6 * v2 + 36) = img[105]; *(int *)((char *)v1 + 6 * v2 + 40) = img[106]; *(int *)((char *)v1 + 6 * v2 + 44) = img[107]; *(int *)((char *)v1 + 6 * v2 + 48) = img[108]; *(int *)((char *)v1 + 6 * v2 + 52) = img[109]; *(int *)((char *)v1 + 6 * v2 + 56) = img[110]; *(int *)((char *)v1 + 6 * v2 + 60) = img[111]; *(int *)((char *)v1 + 7 * v2) = img[112]; *(int *)((char *)v1 + 7 * v2 + 4) = img[113]; *(int *)((char *)v1 + 7 * v2 + 8) = img[114]; *(int *)((char *)v1 + 7 * v2 + 12) = img[115]; *(int *)((char *)v1 + 7 * v2 + 16) = img[116]; *(int *)((char *)v1 + 7 * v2 + 20) = img[117]; *(int *)((char *)v1 + 7 * v2 + 24) = img[118]; *(int *)((char *)v1 + 7 * v2 + 28) = img[119]; *(int *)((char *)v1 + 7 * v2 + 32) = img[120]; *(int *)((char *)v1 + 7 * v2 + 36) = img[121]; *(int *)((char *)v1 + 7 * v2 + 40) = img[122]; *(int *)((char *)v1 + 7 * v2 + 44) = img[123]; *(int *)((char *)v1 + 7 * v2 + 48) = img[124]; *(int *)((char *)v1 + 7 * v2 + 52) = img[125]; *(int *)((char *)v1 + 7 * v2 + 56) = img[126]; *(int *)((char *)v1 + 7 * v2 + 60) = img[127]; v1[2 * v2] = img[128]; v1[2 * v2 + 1] = img[129]; v1[2 * v2 + 2] = img[130]; v1[2 * v2 + 3] = img[131]; v1[2 * v2 + 4] = img[132]; v1[2 * v2 + 5] = img[133]; v1[2 * v2 + 6] = img[134]; v1[2 * v2 + 7] = img[135]; v1[2 * v2 + 8] = img[136]; v1[2 * v2 + 9] = img[137]; v1[2 * v2 + 10] = img[138]; v1[2 * v2 + 11] = img[139]; v1[2 * v2 + 12] = img[140]; v1[2 * v2 + 13] = img[141]; v1[2 * v2 + 14] = img[142]; v1[2 * v2 + 15] = img[143]; *(int *)((char *)v1 + 9 * v2) = img[144]; *(int *)((char *)v1 + 9 * v2 + 4) = img[145]; *(int *)((char *)v1 + 9 * v2 + 8) = img[146]; *(int *)((char *)v1 + 9 * v2 + 12) = img[147]; *(int *)((char *)v1 + 9 * v2 + 16) = img[148]; *(int *)((char *)v1 + 9 * v2 + 20) = img[149]; *(int *)((char *)v1 + 9 * v2 + 24) = img[150]; *(int *)((char *)v1 + 9 * v2 + 28) = img[151]; *(int *)((char *)v1 + 9 * v2 + 32) = img[152]; *(int *)((char *)v1 + 9 * v2 + 36) = img[153]; *(int *)((char *)v1 + 9 * v2 + 40) = img[154]; *(int *)((char *)v1 + 9 * v2 + 44) = img[155]; *(int *)((char *)v1 + 9 * v2 + 48) = img[156]; *(int *)((char *)v1 + 9 * v2 + 52) = img[157]; *(int *)((char *)v1 + 9 * v2 + 56) = img[158]; *(int *)((char *)v1 + 9 * v2 + 60) = img[159]; *(int *)((char *)v1 + 10 * v2) = img[160]; *(int *)((char *)v1 + 10 * v2 + 4) = img[161]; *(int *)((char *)v1 + 10 * v2 + 8) = img[162]; *(int *)((char *)v1 + 10 * v2 + 12) = img[163]; *(int *)((char *)v1 + 10 * v2 + 16) = img[164]; *(int *)((char *)v1 + 10 * v2 + 20) = img[165]; *(int *)((char *)v1 + 10 * v2 + 24) = img[166]; *(int *)((char *)v1 + 10 * v2 + 28) = img[167]; *(int *)((char *)v1 + 10 * v2 + 32) = img[168]; *(int *)((char *)v1 + 10 * v2 + 36) = img[169]; *(int *)((char *)v1 + 10 * v2 + 40) = img[170]; *(int *)((char *)v1 + 10 * v2 + 44) = img[171]; *(int *)((char *)v1 + 10 * v2 + 48) = img[172]; *(int *)((char *)v1 + 10 * v2 + 52) = img[173]; *(int *)((char *)v1 + 10 * v2 + 56) = img[174]; *(int *)((char *)v1 + 10 * v2 + 60) = img[175]; *(int *)((char *)v1 + 11 * v2) = img[176]; *(int *)((char *)v1 + 11 * v2 + 4) = img[177]; *(int *)((char *)v1 + 11 * v2 + 8) = img[178]; *(int *)((char *)v1 + 11 * v2 + 12) = img[179]; *(int *)((char *)v1 + 11 * v2 + 16) = img[180]; *(int *)((char *)v1 + 11 * v2 + 20) = img[181]; *(int *)((char *)v1 + 11 * v2 + 24) = img[182]; *(int *)((char *)v1 + 11 * v2 + 28) = img[183]; *(int *)((char *)v1 + 11 * v2 + 32) = img[184]; *(int *)((char *)v1 + 11 * v2 + 36) = img[185]; *(int *)((char *)v1 + 11 * v2 + 40) = img[186]; *(int *)((char *)v1 + 11 * v2 + 44) = img[187]; *(int *)((char *)v1 + 11 * v2 + 48) = img[188]; *(int *)((char *)v1 + 11 * v2 + 52) = img[189]; *(int *)((char *)v1 + 11 * v2 + 56) = img[190]; *(int *)((char *)v1 + 11 * v2 + 60) = img[191]; v1[3 * v2] = img[192]; v1[3 * v2 + 1] = img[193]; v1[3 * v2 + 2] = img[194]; v1[3 * v2 + 3] = img[195]; v1[3 * v2 + 4] = img[196]; v1[3 * v2 + 5] = img[197]; v1[3 * v2 + 6] = img[198]; v1[3 * v2 + 7] = img[199]; v1[3 * v2 + 8] = img[200]; v1[3 * v2 + 9] = img[201]; v1[3 * v2 + 10] = img[202]; v1[3 * v2 + 11] = img[203]; v1[3 * v2 + 12] = img[204]; v1[3 * v2 + 13] = img[205]; v1[3 * v2 + 14] = img[206]; v1[3 * v2 + 15] = img[207]; *(int *)((char *)v1 + 13 * v2) = img[208]; *(int *)((char *)v1 + 13 * v2 + 4) = img[209]; *(int *)((char *)v1 + 13 * v2 + 8) = img[210]; *(int *)((char *)v1 + 13 * v2 + 12) = img[211]; *(int *)((char *)v1 + 13 * v2 + 16) = img[212]; *(int *)((char *)v1 + 13 * v2 + 20) = img[213]; *(int *)((char *)v1 + 13 * v2 + 24) = img[214]; *(int *)((char *)v1 + 13 * v2 + 28) = img[215]; *(int *)((char *)v1 + 13 * v2 + 32) = img[216]; *(int *)((char *)v1 + 13 * v2 + 36) = img[217]; *(int *)((char *)v1 + 13 * v2 + 40) = img[218]; *(int *)((char *)v1 + 13 * v2 + 44) = img[219]; *(int *)((char *)v1 + 13 * v2 + 48) = img[220]; *(int *)((char *)v1 + 13 * v2 + 52) = img[221]; *(int *)((char *)v1 + 13 * v2 + 56) = img[222]; *(int *)((char *)v1 + 13 * v2 + 60) = img[223]; *(int *)((char *)v1 + 14 * v2) = img[224]; *(int *)((char *)v1 + 14 * v2 + 4) = img[225]; *(int *)((char *)v1 + 14 * v2 + 8) = img[226]; *(int *)((char *)v1 + 14 * v2 + 12) = img[227]; *(int *)((char *)v1 + 14 * v2 + 16) = img[228]; *(int *)((char *)v1 + 14 * v2 + 20) = img[229]; *(int *)((char *)v1 + 14 * v2 + 24) = img[230]; *(int *)((char *)v1 + 14 * v2 + 28) = img[231]; *(int *)((char *)v1 + 14 * v2 + 32) = img[232]; *(int *)((char *)v1 + 14 * v2 + 36) = img[233]; *(int *)((char *)v1 + 14 * v2 + 40) = img[234]; *(int *)((char *)v1 + 14 * v2 + 44) = img[235]; *(int *)((char *)v1 + 14 * v2 + 48) = img[236]; *(int *)((char *)v1 + 14 * v2 + 52) = img[237]; *(int *)((char *)v1 + 14 * v2 + 56) = img[238]; *(int *)((char *)v1 + 14 * v2 + 60) = img[239]; *(int *)((char *)v1 + 15 * v2) = img[240]; *(int *)((char *)v1 + 15 * v2 + 4) = img[241]; *(int *)((char *)v1 + 15 * v2 + 8) = img[242]; *(int *)((char *)v1 + 15 * v2 + 12) = img[243]; *(int *)((char *)v1 + 15 * v2 + 16) = img[244]; *(int *)((char *)v1 + 15 * v2 + 20) = img[245]; *(int *)((char *)v1 + 15 * v2 + 24) = img[246]; *(int *)((char *)v1 + 15 * v2 + 28) = img[247]; *(int *)((char *)v1 + 15 * v2 + 32) = img[248]; *(int *)((char *)v1 + 15 * v2 + 36) = img[249]; *(int *)((char *)v1 + 15 * v2 + 40) = img[250]; *(int *)((char *)v1 + 15 * v2 + 44) = img[251]; *(int *)((char *)v1 + 15 * v2 + 48) = img[252]; *(int *)((char *)v1 + 15 * v2 + 52) = img[253]; *(int *)((char *)v1 + 15 * v2 + 56) = img[254]; *(int *)((char *)v1 + 15 * v2 + 60) = img[255]; v1[4 * v2] = img[256]; v1[4 * v2 + 1] = img[257]; v1[4 * v2 + 2] = img[258]; v1[4 * v2 + 3] = img[259]; v1[4 * v2 + 4] = img[260]; v1[4 * v2 + 5] = img[261]; v1[4 * v2 + 6] = img[262]; v1[4 * v2 + 7] = img[263]; v1[4 * v2 + 8] = img[264]; v1[4 * v2 + 9] = img[265]; v1[4 * v2 + 10] = img[266]; v1[4 * v2 + 11] = img[267]; v1[4 * v2 + 12] = img[268]; v1[4 * v2 + 13] = img[269]; v1[4 * v2 + 14] = img[270]; v1[4 * v2 + 15] = img[271]; *(int *)((char *)v1 + 17 * v2) = img[272]; *(int *)((char *)v1 + 17 * v2 + 4) = img[273]; *(int *)((char *)v1 + 17 * v2 + 8) = img[274]; *(int *)((char *)v1 + 17 * v2 + 12) = img[275]; *(int *)((char *)v1 + 17 * v2 + 16) = img[276]; *(int *)((char *)v1 + 17 * v2 + 20) = img[277]; *(int *)((char *)v1 + 17 * v2 + 24) = img[278]; *(int *)((char *)v1 + 17 * v2 + 28) = img[279]; *(int *)((char *)v1 + 17 * v2 + 32) = img[280]; *(int *)((char *)v1 + 17 * v2 + 36) = img[281]; *(int *)((char *)v1 + 17 * v2 + 40) = img[282]; *(int *)((char *)v1 + 17 * v2 + 44) = img[283]; *(int *)((char *)v1 + 17 * v2 + 48) = img[284]; *(int *)((char *)v1 + 17 * v2 + 52) = img[285]; *(int *)((char *)v1 + 17 * v2 + 56) = img[286]; *(int *)((char *)v1 + 17 * v2 + 60) = img[287]; *(int *)((char *)v1 + 18 * v2) = img[288]; *(int *)((char *)v1 + 18 * v2 + 4) = img[289]; *(int *)((char *)v1 + 18 * v2 + 8) = img[290]; *(int *)((char *)v1 + 18 * v2 + 12) = img[291]; *(int *)((char *)v1 + 18 * v2 + 16) = img[292]; *(int *)((char *)v1 + 18 * v2 + 20) = img[293]; *(int *)((char *)v1 + 18 * v2 + 24) = img[294]; *(int *)((char *)v1 + 18 * v2 + 28) = img[295]; *(int *)((char *)v1 + 18 * v2 + 32) = img[296]; *(int *)((char *)v1 + 18 * v2 + 36) = img[297]; *(int *)((char *)v1 + 18 * v2 + 40) = img[298]; *(int *)((char *)v1 + 18 * v2 + 44) = img[299]; *(int *)((char *)v1 + 18 * v2 + 48) = img[300]; *(int *)((char *)v1 + 18 * v2 + 52) = img[301]; *(int *)((char *)v1 + 18 * v2 + 56) = img[302]; *(int *)((char *)v1 + 18 * v2 + 60) = img[303]; *(int *)((char *)v1 + 19 * v2) = img[304]; *(int *)((char *)v1 + 19 * v2 + 4) = img[305]; *(int *)((char *)v1 + 19 * v2 + 8) = img[306]; *(int *)((char *)v1 + 19 * v2 + 12) = img[307]; *(int *)((char *)v1 + 19 * v2 + 16) = img[308]; *(int *)((char *)v1 + 19 * v2 + 20) = img[309]; *(int *)((char *)v1 + 19 * v2 + 24) = img[310]; *(int *)((char *)v1 + 19 * v2 + 28) = img[311]; *(int *)((char *)v1 + 19 * v2 + 32) = img[312]; *(int *)((char *)v1 + 19 * v2 + 36) = img[313]; *(int *)((char *)v1 + 19 * v2 + 40) = img[314]; *(int *)((char *)v1 + 19 * v2 + 44) = img[315]; *(int *)((char *)v1 + 19 * v2 + 48) = img[316]; *(int *)((char *)v1 + 19 * v2 + 52) = img[317]; *(int *)((char *)v1 + 19 * v2 + 56) = img[318]; *(int *)((char *)v1 + 19 * v2 + 60) = img[319]; v1[5 * v2] = img[320]; v1[5 * v2 + 1] = img[321]; v1[5 * v2 + 2] = img[322]; v1[5 * v2 + 3] = img[323]; v1[5 * v2 + 4] = img[324]; v1[5 * v2 + 5] = img[325]; v1[5 * v2 + 6] = img[326]; v1[5 * v2 + 7] = img[327]; v1[5 * v2 + 8] = img[328]; v1[5 * v2 + 9] = img[329]; v1[5 * v2 + 10] = img[330]; v1[5 * v2 + 11] = img[331]; v1[5 * v2 + 12] = img[332]; v1[5 * v2 + 13] = img[333]; v1[5 * v2 + 14] = img[334]; v1[5 * v2 + 15] = img[335]; *(int *)((char *)v1 + 21 * v2) = img[336]; *(int *)((char *)v1 + 21 * v2 + 4) = img[337]; *(int *)((char *)v1 + 21 * v2 + 8) = img[338]; *(int *)((char *)v1 + 21 * v2 + 12) = img[339]; *(int *)((char *)v1 + 21 * v2 + 16) = img[340]; *(int *)((char *)v1 + 21 * v2 + 20) = img[341]; *(int *)((char *)v1 + 21 * v2 + 24) = img[342]; *(int *)((char *)v1 + 21 * v2 + 28) = img[343]; *(int *)((char *)v1 + 21 * v2 + 32) = img[344]; *(int *)((char *)v1 + 21 * v2 + 36) = img[345]; *(int *)((char *)v1 + 21 * v2 + 40) = img[346]; *(int *)((char *)v1 + 21 * v2 + 44) = img[347]; *(int *)((char *)v1 + 21 * v2 + 48) = img[348]; *(int *)((char *)v1 + 21 * v2 + 52) = img[349]; *(int *)((char *)v1 + 21 * v2 + 56) = img[350]; *(int *)((char *)v1 + 21 * v2 + 60) = img[351]; *(int *)((char *)v1 + 22 * v2) = img[352]; *(int *)((char *)v1 + 22 * v2 + 4) = img[353]; *(int *)((char *)v1 + 22 * v2 + 8) = img[354]; *(int *)((char *)v1 + 22 * v2 + 12) = img[355]; *(int *)((char *)v1 + 22 * v2 + 16) = img[356]; *(int *)((char *)v1 + 22 * v2 + 20) = img[357]; *(int *)((char *)v1 + 22 * v2 + 24) = img[358]; *(int *)((char *)v1 + 22 * v2 + 28) = img[359]; *(int *)((char *)v1 + 22 * v2 + 32) = img[360]; *(int *)((char *)v1 + 22 * v2 + 36) = img[361]; *(int *)((char *)v1 + 22 * v2 + 40) = img[362]; *(int *)((char *)v1 + 22 * v2 + 44) = img[363]; *(int *)((char *)v1 + 22 * v2 + 48) = img[364]; *(int *)((char *)v1 + 22 * v2 + 52) = img[365]; *(int *)((char *)v1 + 22 * v2 + 56) = img[366]; *(int *)((char *)v1 + 22 * v2 + 60) = img[367]; *(int *)((char *)v1 + 23 * v2) = img[368]; *(int *)((char *)v1 + 23 * v2 + 4) = img[369]; *(int *)((char *)v1 + 23 * v2 + 8) = img[370]; *(int *)((char *)v1 + 23 * v2 + 12) = img[371]; *(int *)((char *)v1 + 23 * v2 + 16) = img[372]; *(int *)((char *)v1 + 23 * v2 + 20) = img[373]; *(int *)((char *)v1 + 23 * v2 + 24) = img[374]; *(int *)((char *)v1 + 23 * v2 + 28) = img[375]; *(int *)((char *)v1 + 23 * v2 + 32) = img[376]; *(int *)((char *)v1 + 23 * v2 + 36) = img[377]; *(int *)((char *)v1 + 23 * v2 + 40) = img[378]; *(int *)((char *)v1 + 23 * v2 + 44) = img[379]; *(int *)((char *)v1 + 23 * v2 + 48) = img[380]; *(int *)((char *)v1 + 23 * v2 + 52) = img[381]; *(int *)((char *)v1 + 23 * v2 + 56) = img[382]; *(int *)((char *)v1 + 23 * v2 + 60) = img[383]; v1[6 * v2] = img[384]; v1[6 * v2 + 1] = img[385]; v1[6 * v2 + 2] = img[386]; v1[6 * v2 + 3] = img[387]; v1[6 * v2 + 4] = img[388]; v1[6 * v2 + 5] = img[389]; v1[6 * v2 + 6] = img[390]; v1[6 * v2 + 7] = img[391]; v1[6 * v2 + 8] = img[392]; v1[6 * v2 + 9] = img[393]; v1[6 * v2 + 10] = img[394]; v1[6 * v2 + 11] = img[395]; v1[6 * v2 + 12] = img[396]; v1[6 * v2 + 13] = img[397]; v1[6 * v2 + 14] = img[398]; v1[6 * v2 + 15] = img[399]; *(int *)((char *)v1 + 25 * v2) = img[400]; *(int *)((char *)v1 + 25 * v2 + 4) = img[401]; *(int *)((char *)v1 + 25 * v2 + 8) = img[402]; *(int *)((char *)v1 + 25 * v2 + 12) = img[403]; *(int *)((char *)v1 + 25 * v2 + 16) = img[404]; *(int *)((char *)v1 + 25 * v2 + 20) = img[405]; *(int *)((char *)v1 + 25 * v2 + 24) = img[406]; *(int *)((char *)v1 + 25 * v2 + 28) = img[407]; *(int *)((char *)v1 + 25 * v2 + 32) = img[408]; *(int *)((char *)v1 + 25 * v2 + 36) = img[409]; *(int *)((char *)v1 + 25 * v2 + 40) = img[410]; *(int *)((char *)v1 + 25 * v2 + 44) = img[411]; *(int *)((char *)v1 + 25 * v2 + 48) = img[412]; *(int *)((char *)v1 + 25 * v2 + 52) = img[413]; *(int *)((char *)v1 + 25 * v2 + 56) = img[414]; *(int *)((char *)v1 + 25 * v2 + 60) = img[415]; *(int *)((char *)v1 + 26 * v2) = img[416]; *(int *)((char *)v1 + 26 * v2 + 4) = img[417]; *(int *)((char *)v1 + 26 * v2 + 8) = img[418]; *(int *)((char *)v1 + 26 * v2 + 12) = img[419]; *(int *)((char *)v1 + 26 * v2 + 16) = img[420]; *(int *)((char *)v1 + 26 * v2 + 20) = img[421]; *(int *)((char *)v1 + 26 * v2 + 24) = img[422]; *(int *)((char *)v1 + 26 * v2 + 28) = img[423]; *(int *)((char *)v1 + 26 * v2 + 32) = img[424]; *(int *)((char *)v1 + 26 * v2 + 36) = img[425]; *(int *)((char *)v1 + 26 * v2 + 40) = img[426]; *(int *)((char *)v1 + 26 * v2 + 44) = img[427]; *(int *)((char *)v1 + 26 * v2 + 48) = img[428]; *(int *)((char *)v1 + 26 * v2 + 52) = img[429]; *(int *)((char *)v1 + 26 * v2 + 56) = img[430]; *(int *)((char *)v1 + 26 * v2 + 60) = img[431]; *(int *)((char *)v1 + 27 * v2) = img[432]; *(int *)((char *)v1 + 27 * v2 + 4) = img[433]; *(int *)((char *)v1 + 27 * v2 + 8) = img[434]; *(int *)((char *)v1 + 27 * v2 + 12) = img[435]; *(int *)((char *)v1 + 27 * v2 + 16) = img[436]; *(int *)((char *)v1 + 27 * v2 + 20) = img[437]; *(int *)((char *)v1 + 27 * v2 + 24) = img[438]; *(int *)((char *)v1 + 27 * v2 + 28) = img[439]; *(int *)((char *)v1 + 27 * v2 + 32) = img[440]; *(int *)((char *)v1 + 27 * v2 + 36) = img[441]; *(int *)((char *)v1 + 27 * v2 + 40) = img[442]; *(int *)((char *)v1 + 27 * v2 + 44) = img[443]; *(int *)((char *)v1 + 27 * v2 + 48) = img[444]; *(int *)((char *)v1 + 27 * v2 + 52) = img[445]; *(int *)((char *)v1 + 27 * v2 + 56) = img[446]; *(int *)((char *)v1 + 27 * v2 + 60) = img[447]; v1[7 * v2] = img[448]; v1[7 * v2 + 1] = img[449]; v1[7 * v2 + 2] = img[450]; v1[7 * v2 + 3] = img[451]; v1[7 * v2 + 4] = img[452]; v1[7 * v2 + 5] = img[453]; v1[7 * v2 + 6] = img[454]; v1[7 * v2 + 7] = img[455]; v1[7 * v2 + 8] = img[456]; v1[7 * v2 + 9] = img[457]; v1[7 * v2 + 10] = img[458]; v1[7 * v2 + 11] = img[459]; v1[7 * v2 + 12] = img[460]; v1[7 * v2 + 13] = img[461]; v1[7 * v2 + 14] = img[462]; v1[7 * v2 + 15] = img[463]; *(int *)((char *)v1 + 29 * v2) = img[464]; *(int *)((char *)v1 + 29 * v2 + 4) = img[465]; *(int *)((char *)v1 + 29 * v2 + 8) = img[466]; *(int *)((char *)v1 + 29 * v2 + 12) = img[467]; *(int *)((char *)v1 + 29 * v2 + 16) = img[468]; *(int *)((char *)v1 + 29 * v2 + 20) = img[469]; *(int *)((char *)v1 + 29 * v2 + 24) = img[470]; *(int *)((char *)v1 + 29 * v2 + 28) = img[471]; *(int *)((char *)v1 + 29 * v2 + 32) = img[472]; *(int *)((char *)v1 + 29 * v2 + 36) = img[473]; *(int *)((char *)v1 + 29 * v2 + 40) = img[474]; *(int *)((char *)v1 + 29 * v2 + 44) = img[475]; *(int *)((char *)v1 + 29 * v2 + 48) = img[476]; *(int *)((char *)v1 + 29 * v2 + 52) = img[477]; *(int *)((char *)v1 + 29 * v2 + 56) = img[478]; *(int *)((char *)v1 + 29 * v2 + 60) = img[479]; *(int *)((char *)v1 + 30 * v2) = img[480]; *(int *)((char *)v1 + 30 * v2 + 4) = img[481]; *(int *)((char *)v1 + 30 * v2 + 8) = img[482]; *(int *)((char *)v1 + 30 * v2 + 12) = img[483]; *(int *)((char *)v1 + 30 * v2 + 16) = img[484]; *(int *)((char *)v1 + 30 * v2 + 20) = img[485]; *(int *)((char *)v1 + 30 * v2 + 24) = img[486]; *(int *)((char *)v1 + 30 * v2 + 28) = img[487]; *(int *)((char *)v1 + 30 * v2 + 32) = img[488]; *(int *)((char *)v1 + 30 * v2 + 36) = img[489]; *(int *)((char *)v1 + 30 * v2 + 40) = img[490]; *(int *)((char *)v1 + 30 * v2 + 44) = img[491]; *(int *)((char *)v1 + 30 * v2 + 48) = img[492]; *(int *)((char *)v1 + 30 * v2 + 52) = img[493]; *(int *)((char *)v1 + 30 * v2 + 56) = img[494]; *(int *)((char *)v1 + 30 * v2 + 60) = img[495]; *(int *)((char *)v1 + 31 * v2) = img[496]; *(int *)((char *)v1 + 31 * v2 + 4) = img[497]; *(int *)((char *)v1 + 31 * v2 + 8) = img[498]; *(int *)((char *)v1 + 31 * v2 + 12) = img[499]; *(int *)((char *)v1 + 31 * v2 + 16) = img[500]; *(int *)((char *)v1 + 31 * v2 + 20) = img[501]; *(int *)((char *)v1 + 31 * v2 + 24) = img[502]; *(int *)((char *)v1 + 31 * v2 + 28) = img[503]; *(int *)((char *)v1 + 31 * v2 + 32) = img[504]; *(int *)((char *)v1 + 31 * v2 + 36) = img[505]; *(int *)((char *)v1 + 31 * v2 + 40) = img[506]; *(int *)((char *)v1 + 31 * v2 + 44) = img[507]; *(int *)((char *)v1 + 31 * v2 + 48) = img[508]; *(int *)((char *)v1 + 31 * v2 + 52) = img[509]; *(int *)((char *)v1 + 31 * v2 + 56) = img[510]; *(int *)((char *)v1 + 31 * v2 + 60) = img[511]; } int unused_417A60(int a1, int a2, int a3, int a4, int a5, int a6, int a7) { int v7; // edx@1 int v8; // edi@1 int v9; // esi@1 int v10; // ecx@2 v8 = a2; v9 = 2 * a3 * a5 + 2 * a4 + a1; v7 = a7; do { v10 = a6; do { *(_WORD *)v8 = *(_WORD *)v9; v9 += 2; v8 += 2; --v10; } while ( v10 > 0 ); v9 += 2 * (a3 - a6); --v7; } while ( v7 > 0 ); return 2 * a6 * a7; } int unused_417AE0(char *buffer, int a2, int width, int xMin, int yMin, int xMax, int yMax) { int yToGo; // edx@1 int v8; // edi@1 __int16 *ptr; // esi@1 int xToGo; // ecx@2 int v11; // edi@4 signed int v12; // ebx@11 int v14; // [sp+4Ch] [bp-Ch]@1 signed int v15; // [sp+54h] [bp-4h]@4 signed int v16; // [sp+54h] [bp-4h]@11 v8 = a2; ptr = (__int16 *)(&buffer[2 * xMin] + 2 * width * yMin); v14 = 0; yToGo = yMax; do { xToGo = xMax; LABEL_3: if ( *ptr == 0xF81Fu ) { *(_BYTE *)v8 = -1; v11 = v8 + 1; *(_BYTE *)v11 = 1; --xToGo; v15 = 1; ++ptr; while ( xToGo > 0 ) { if ( v15 >= 255 || *ptr != 0xF81Fu ) { v8 = v11 + 1; v14 += 2; goto LABEL_3; } ++*(_BYTE *)v11; --xToGo; ++v15; ++ptr; } v8 = v11 + 1; v14 += 2; } else { *(_WORD *)(v8 + 1) = *ptr; *(_BYTE *)v8 = 1; v12 = 3; --xToGo; v16 = 1; ++ptr; while ( xToGo > 0 ) { if ( v16 >= 16 || *ptr == 0xF81Fu ) { v8 += v12; v14 += v12; goto LABEL_3; } *(_WORD *)(v8 + v12) = *ptr; v12 += 2; ++*(_BYTE *)v8; --xToGo; ++v16; ++ptr; } v8 += v12; v14 += v12; } ptr += width - xMax; --yToGo; } while ( yToGo > 0 ); return v14; } signed int unused_grabBuildingFootprintFromBuffer(char *buffer, char *dst, int scanline, int xOffset, int yOffset, int width, signed int height) { signed int result; // eax@3 int base_y; // [sp+4Ch] [bp-8h]@42 int base_x; // [sp+50h] [bp-4h]@42 graphic_xOffset = xOffset; graphic_yOffset = yOffset; switch ( width ) { case 298: if ( height < 150 ) return 0; break; case 238: if ( height < 120 ) return 0; break; case 178: if ( height < 90 ) return 0; break; case 118: if ( height < 60 ) return 0; break; case 58: if ( height < 30 ) return 0; break; case 26: if ( height < 16 ) return 0; break; default: if ( width == 10 && height < 6 ) return 0; break; } switch ( width ) { case 298: graphic_yOffset = graphic_yOffset + height - 150; break; case 238: graphic_yOffset = graphic_yOffset + height - 120; break; case 178: graphic_yOffset = graphic_yOffset + height - 90; break; case 118: graphic_yOffset = graphic_yOffset + height - 60; break; case 58: graphic_yOffset = graphic_yOffset + height - 30; break; case 26: graphic_yOffset = graphic_yOffset + height - 14; break; case 10: graphic_yOffset = graphic_yOffset + height - 6; break; } base_x = graphic_xOffset; base_y = graphic_yOffset; switch ( width ) { case 58: unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)dst, scanline); result = 1800; break; case 118: graphic_xOffset += 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)dst, scanline); graphic_xOffset = base_x; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 1800), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 3600), scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 5400), scanline); result = 7200; break; case 178: graphic_xOffset += 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)dst, scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 1800), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 3600), scanline); graphic_xOffset = base_x; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 5400), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 7200), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 9000), scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 10800), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 12600), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 14400), scanline); result = 16200; break; case 238: graphic_xOffset += 90; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)dst, scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 1800), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 3600), scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 5400), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 7200), scanline); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 9000), scanline); graphic_xOffset = base_x; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 10800), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 12600), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 14400), scanline); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 16200), scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 18000), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 19800), scanline); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 21600), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 75; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 23400), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 75; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 25200), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 90; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 27000), scanline); result = 28800; break; case 298: graphic_xOffset += 120; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)dst, scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 1800), scanline); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 15; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 3600), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 5400), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 7200), scanline); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 30; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 9000), scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 10800), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer,(int*) (dst + 12600), scanline); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 14400), scanline); graphic_xOffset = base_x + 210; graphic_yOffset = base_y + 45; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 16200), scanline); graphic_xOffset = base_x; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 18000), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer,(int*)( dst + 19800), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 21600), scanline); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 23400), scanline); graphic_xOffset = base_x + 240; graphic_yOffset = base_y + 60; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 25200), scanline); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 75; unused_grabBuildingFootprintTileFromBuffer(buffer,(int*) (dst + 27000), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 75; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 28800), scanline); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 75; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 30600), scanline); graphic_xOffset = base_x + 210; graphic_yOffset = base_y + 75; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 32400), scanline); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 90; unused_grabBuildingFootprintTileFromBuffer(buffer,(int*) (dst + 34200), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 90; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 36000), scanline); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 90; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 37800), scanline); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 105; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 39600), scanline); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 105; unused_grabBuildingFootprintTileFromBuffer(buffer,(int*)( dst + 41400), scanline); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 120; unused_grabBuildingFootprintTileFromBuffer(buffer, (int*)(dst + 43200), scanline); result = 45000; break; case 26: fun_grabBuildingFootprintTileFromBuffer_26px(); result = 392; break; case 10: fun_grabBuildingFootprintTileFromBuffer_10px(); result = 72; break; default: result = 0; break; } return result; } int unused_clearBuildingFootprint(int a1, int a2, int a3, int a4, int a5, int width, int height) { int result; // eax@2 int base_y; // [sp+4Ch] [bp-Ch]@44 int base_x; // [sp+50h] [bp-8h]@44 if ( !screen_buffer ) return 0; switch ( width ) { case 298: if ( height < 150 ) return 0; break; case 238: if ( height < 120 ) return 0; break; case 178: if ( height < 90 ) return 0; break; case 118: if ( height < 60 ) return 0; break; case 58: if ( height < 30 ) return 0; break; case 26: if ( height < 16 ) return 0; break; default: if ( width == 10 && height < 6 ) return 0; break; } drawGraphic_width = (drawGraphic_width & 0xffff0000) + width; drawGraphic_height = (drawGraphic_height & 0xffff0000) + height; unused_412F90(a3 * 2 * a5 + a1 + 2 * a4, (int)screen_buffer, a3 - width); graphic_xOffset = 0; switch ( width ) { case 298: graphic_yOffset = height - 150; break; case 238: graphic_yOffset = height - 120; break; case 178: graphic_yOffset = height - 90; break; case 118: graphic_yOffset = height - 60; break; case 58: graphic_yOffset = height - 30; break; case 26: graphic_yOffset = height - 14; break; case 10: graphic_yOffset = height - 6; break; } base_x = graphic_xOffset; base_y = graphic_yOffset; switch ( width ) { case 298: graphic_xOffset += 120; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 210; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 210; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 75; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 75; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 75; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 210; graphic_yOffset = base_y + 75; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 90; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 90; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 90; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 105; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 105; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 120; unused_clearBuildingFootprintTile((char *)screen_buffer, 298); break; case 238: graphic_xOffset += 90; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 180; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 150; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 75; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 75; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 90; unused_clearBuildingFootprintTile((char *)screen_buffer, 238); break; case 178: graphic_xOffset += 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 120; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 90; graphic_yOffset = base_y + 45; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 60; unused_clearBuildingFootprintTile((char *)screen_buffer, 178); break; case 118: graphic_xOffset += 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 118); graphic_xOffset = base_x; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 118); graphic_xOffset = base_x + 60; graphic_yOffset = base_y + 15; unused_clearBuildingFootprintTile((char *)screen_buffer, 118); graphic_xOffset = base_x + 30; graphic_yOffset = base_y + 30; unused_clearBuildingFootprintTile((char *)screen_buffer, 118); break; case 58: unused_clearBuildingFootprintTile((char *)screen_buffer, 58); break; case 26: fun_clearBuildingFootprintTile_26px(); break; case 10: fun_clearBuildingFootprintTile_10px(); break; } if ( unused_rectangleIsNotWhite((char *)screen_buffer, width, height, 0, 0, width, height) ) { switch ( width ) { case 298: height -= 76; break; case 238: height -= 61; break; case 178: height -= 46; break; case 118: height -= 31; break; case 58: height -= 16; break; case 26: height -= 8; break; case 10: height -= 4; break; } result = unused_417AE0((char *)screen_buffer, a2, width, 0, 0, width, height); } else { result = 0; } return result; } int main(int argc, char* argv[] ) { int result; // eax@2 signed int v5; // [sp+4Ch] [bp-20h]@7 struct tagMSG Msg; // [sp+50h] [bp-1Ch]@21 HINSTANCE hInstance = GetModuleHandle(0); byte_6606BC = 0; if ( fun_loadSettings() ) { if ( fun_readLanguageTextFiles("c3.eng", "c3_mm.eng") ) { fun_loadDefaultNames(); fun_logDebugMessage("OK :Game text loaded.", 0, 0); if ( fun_setupMainWindow(hInstance) ) { fun_logDebugMessage("OK :Direct draw initialised.", 0, 0); v5 = fun_loadGraphics(); switch ( v5 ) { case 1: fun_logDebugMessage("ERR:Exited C3, insufficient memory to run.", 0, 0); break; case 2: fun_logDebugMessage("ERR:Exited C3, Could not find main 'dat' file.", 0, 0); break; case 3: fun_logDebugMessage("ERR:Exited C3, Could not find 'the_empire.dat' file.", 0, 0); break; case 4294967294: fun_logDebugMessage( "ERR:Exited C3, bmp files have changed since sg2 was last run. Need to rerun sg2 abd get new project size", 0, 0); break; default: fun_logDebugMessage("OK :C3 setup.", 0, 0); if ( loadC3ModelTxt() ) { fun_directSound_init(); if ( setting_ram > 23 ) fun_sound_playTestSound("wavs\\panel1.wav", 158); else fun_sound_playTestSound("wavs\\panel1.wav", 158); fun_logDebugMessage("OK :Direct sound initialised.", 0, 0); mode_editor = 0; imagebuttonunknown_flag = 0; dword_9DA87C = 2; dword_9DA804 = 0; dword_9DA8B8 = 0; sub_530190(); fun_setCityScreenWidths(); window_id = 68; window_redrawRequest = 1; fun_measureComputerSpeed(); byte_6606BC = 1; fun_logDebugMessage("OK :Launching game loop.", 0, 0); while ( 1 ) { if ( PeekMessageA(&Msg, 0, 0, 0, 0) ) { if ( !GetMessageA(&Msg, 0, 0, 0) ) goto LABEL_32; TranslateMessage(&Msg); DispatchMessageA(&Msg); } else { if ( app_paused || !app_active ) WaitMessage(); else fun_wndprocRefresh(); } if ( wndproc_closeStatus == 1 ) { PostMessageA(main_window, WM_CLOSE, 0, 0); wndproc_closeStatus = 0; } } } fun_logDebugMessage("ERR:Exited C3, could not load model.", 0, 0); break; } LABEL_32: fun_saveSettingsAndFreeMemory(); fun_coUninitializeOnNormalExit(); result = Msg.wParam; } else { fun_logDebugMessage("ERR:Exited C3, couldn't start direct draw.", 0, 0); CoUninitialize(); result = 0; } } else { fun_logDebugMessage("ERR:Exited C3, 'c3.eng' or 'c3_mm.eng' files not found or too large.", 0, 0); result = 0; } } else { fun_logDebugMessage("ERR:Exited C3, could not find CD drive information.", 0, 0); result = 0; } return result; } signed int fun_wndprocRefresh() { signed int result; // eax@6 if ( (ddraw_surface && ddraw_surface->IsLost() == -2005532222 || ddraw_backSurface && ddraw_backSurface->IsLost() == -2005532222) && !fun_directDrawRestoreSurfaces() ) { fun_pauseApp(); result = 0; } else { if ( wndproc_closeStatus == 1 ) { result = 0; } else { fun_redrawScreen(); result = 1; } } return result; } signed int fun_loadGraphics() { signed int result; // eax@2 const CHAR *filenameEmpire; // [sp+4Ch] [bp-8h]@1 const CHAR *filenameC3; // [sp+50h] [bp-4h]@1 filenameC3 = &aC3_555[160 * graphics_format_id]; filenameEmpire = &aThe_empire_555[160 * graphics_format_id]; if ( fun_readFileIntoBuffer("c3.sg2", climate_sg2) ) { fun_readFileIntoBuffer("c3map.inf", &setting_map_start); setting_debug_grid = 16; dword_5FD868 = 1; screen_buffer = (__int16 *)malloc(2 * screen_height * screen_width); fun_drawLoadingScreen(0); fun_getGameTextString(GAMETEXT_LOADING, 0); fun_drawLoadingText(gametext_result); fun_refreshVideoBuffer(1); fun_drawLoadingText(gametext_result); c3_555 = (char *)malloc(17000000u); if ( screen_buffer ) { if ( c3_555 ) { fun_drawLoadingScreen(1); fun_getGameTextString(GAMETEXT_LOADING, 2); fun_drawLoadingText(gametext_result); fun_refreshVideoBuffer(1); fun_drawLoadingText(gametext_result); if ( fun_fileExistsHome(filenameC3) ) { if ( fun_fileExistsHome(filenameEmpire) ) { if ( fun_getFilesize(filenameC3) != climate_dataSize[0] ) fun_logDebugMessage("OK :CAUTION DAT file length does not match sg2 description.", 0, 0); fun_readFileIntoBuffer(filenameC3, c3_555); fun_prepareClimateGraphics(); currentClimate = 0; fun_drawLoadingScreen(2); fun_getGameTextString(GAMETEXT_LOADING, 3); fun_drawLoadingText(gametext_result); fun_refreshVideoBuffer(1); fun_drawLoadingText(gametext_result); fun_readFileIntoBuffer(filenameEmpire, c3_555 + 13000000); fun_convertGraphicToSurfaceFormat((__int16 *)c3_555 + 6500000, 4000000); if ( fun_loadEnemyGraphics(0) ) { fun_logDebugMessage("ERR:Setup couldnt load default army set.", 0, 0); result = 2; } else { fun_drawLoadingScreen(3); fun_getGameTextString(GAMETEXT_LOADING, 4); fun_drawLoadingText(gametext_result); fun_refreshVideoBuffer(1); fun_drawLoadingText(gametext_result); fun_logDebugMessage("OK :Setup loaded DAT files.", 0, 0); result = 0; } } else { result = 3; } } else { result = 2; } } else { result = 1; } } else { result = 1; } } else { result = 2; } return result; } signed int fun_loadClimateGraphics(int climate) { signed int result; // eax@2 const CHAR *filename; // [sp+50h] [bp-4h]@1 filename = &aThe_empire_555[160 * graphics_format_id] + climate + 1; if ( climate == currentClimate ) { result = 0; } else { if ( fun_fileExistsHome(filename) ) { if ( fun_readFileIntoBuffer(&aC3_sg2_0[40 * (climate + 1)], climate_sg2) ) { fun_readFileIntoBuffer(filename, c3_555); fun_prepareClimateGraphics(); currentClimate = climate; result = 0; } else { result = 2; } } else { result = 2; } } return result; } signed int fun_loadEnemyGraphics(int enemyId) { signed int result; // eax@2 const char *sg2file; // [sp+4Ch] [bp-Ch]@1 sg2file = &aGoths_sg2[40 * enemyId]; if ( fun_fileExistsHome(&aGoths_555[40 * enemyId]) ) { if ( fun_fileExistsHome(sg2file) ) { fun_readFileIntoBuffer(&aGoths_555[40 * enemyId], c3_555 + 12100000); fun_readDataFromFilename(sg2file, enemy_sg2, 51264u, 20680); fun_prepareEnemyGraphics(); fun_logDebugMessage("OK :Setup loaded army files.", 0, 0); currentEnemyId = enemyId; result = 0; } else { result = 3; } } else { result = 2; } return result; } void fun_saveSettingsAndFreeMemory() { fun_writeBufferToFile("c3.inf", &setting_start_bpp, 0x230u); fun_writeBufferToFile("c3map.inf", &setting_map_start, 0x30u); fun_logDebugMessage("OK :removed manmades=", 0, dword_608094 + 1); if ( screen_buffer ) j_freeMemory(screen_buffer); if ( c3_555 ) j_freeMemory(c3_555); } signed int fun_loadSettings() { int screenWidth; // [sp+4Ch] [bp-4h]@3 setting_start_bpp = 16; setting_fullscreen = 1; setting_game_paused = 0; setting_zeroByte = 0; setting_unused_alwaysTwo = 2; setting_ram = 15; setting_unused_always66 = 66; setting_unused_alwaysZero = 0; setting_cddrive = 'D'; setting_sound_effects_on = 1; setting_sound_music_on = 1; setting_sound_speech_on = 1; setting_sound_city_on = 1; setting_warnings_on = 1; setting_mouse_tooltips = 2; setting_speed_game = 90; setting_speed_scroll = 70; setting_difficulty = 3; setting_godsOn = 1; setting_sound_effects_pct = 100; setting_sound_music_pct = 80; setting_sound_speech_pct = 100; setting_sound_city_pct = 100; setting_resolution = 2; fun_readCaesar3IniFile(); if ( setting_ram <= 23 ) { setting_speed_game = 100; setting_speed_scroll = 100; setting_resolution = 1; } screenWidth = GetSystemMetrics(0); if ( screenWidth >= 800 ) { if ( screenWidth < 1024 ) setting_resolution = 2; } else { setting_resolution = 1; } setting_maxKnownGoodResolution = setting_resolution; fun_clearMissionSettings(); sidepanel_lastAdvisor = 1; fun_readFileIntoBuffer("c3.inf", setting_start_bpp_buffer); fun_readCaesar3IniFile(); dword_7E26F4 = 1; setting_game_paused = 0; if ( setting_mouse_tooltips == 2 ) { menu_help.cycleMouseHelp = 4; } else { if ( setting_mouse_tooltips == 1 ) menu_help.cycleMouseHelp = 3; } if ( (unsigned char)setting_warnings_on == 1 ) menu_help.toggleWarnings = 6; if ( (unsigned char)setting_autoclear_on == 1 ) *((_WORD *)&menu_options + 25) = 5; return 1; } void fun_loadDefaultNames() { fun_getGameTextString(9, 5); // The new governor strcpy(setting_player_name, gametext_result); fun_getGameTextString(9, 6); // My Rome strcpy(current_saveFilename, gametext_result); strcpy(fileDialogSave_filename, gametext_result); fun_getGameTextString(9, 7); // Scenario1 strcpy(currentScenarioFilename, gametext_result); } signed int fun_readCaesar3IniFile() { signed int result; // eax@2 int ramKeyPos; // eax@5 int cdKeyPos; // eax@7 int ramValuePos; // [sp+4Ch] [bp-8h]@5 int cdValuePos; // [sp+4Ch] [bp-8h]@7 char *iniBuffer; // [sp+50h] [bp-4h]@1 iniBuffer = (char *)malloc(20000u); if ( iniBuffer ) { if ( fun_readDataFromFilename("Caesar3.ini", iniBuffer, 20000u, 0) ) { ramKeyPos = fun_strnpos(iniBuffer, "RAM", 20000); ramValuePos = fun_strnchr(&iniBuffer[ramKeyPos], '=', 20000) + ramKeyPos; if ( ramValuePos > 0 ) setting_ram = atoi(&iniBuffer[ramValuePos]); cdKeyPos = fun_strnpos(iniBuffer, "CDDrive", 20000); cdValuePos = fun_strnchr(&iniBuffer[cdKeyPos], '=', 20000) + cdKeyPos; if ( cdValuePos > 0 ) setting_cddrive = iniBuffer[cdValuePos]; if ( iniBuffer ) j_freeMemory(iniBuffer); result = 1; } else { fun_logDebugMessage("Err:Could not read sierra.ini", 0, 0); if ( iniBuffer ) j_freeMemory(iniBuffer); result = 0; } } else { result = 0; } return result; } void fun_reallocateScreenBuffer() { fun_setCityScreenWidths(); if ( screen_buffer ) j_freeMemory(screen_buffer); screen_buffer = (__int16 *)malloc(2 * screen_height * screen_width); if ( sidepanel_collapsed == 1 ) fun_setCityViewport_withoutPanel(); else fun_setCityViewport_withPanel(); sub_4DC600(); } LRESULT __stdcall fun_wndproc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { int screenHeight; // ST18_4@20 int screenWidth; // eax@20 int v6; // ST7C_4@73 LONG v7; // ST18_4@173 bool v8; // ST14_4@173 LONG v9; // eax@173 int v10; // ST80_4@178 bool v12; // [sp+58h] [bp-6Ch]@26 struct tagRECT Rect; // [sp+70h] [bp-54h]@173 HDC v14; // [sp+80h] [bp-44h]@189 struct tagPAINTSTRUCT Paint; // [sp+84h] [bp-40h]@189 if ( Msg > WM_KEYUP ) { if ( Msg > WM_LBUTTONUP ) { if ( Msg == WM_RBUTTONDOWN ) { mouseInfo_type |= 2u; mouseInfo_x = lParam; mouseInfo_y = (unsigned int)lParam >> 16; } else { if ( Msg == WM_RBUTTONUP ) { mouseInfo_type &= 0xFDu; mouseInfo_x = lParam; mouseInfo_y = (unsigned int)lParam >> 16; } } } else { if ( Msg == WM_LBUTTONUP ) { mouseInfo_type &= 0xFEu; mouseInfo_x = lParam; mouseInfo_y = (unsigned int)lParam >> 16; } else { if ( Msg > WM_MOUSEMOVE ) { if ( Msg == WM_LBUTTONDOWN ) { mouseInfo_type |= 1u; mouseInfo_buttonIsDown = 1; mouseInfo_x = lParam; mouseInfo_y = (unsigned int)lParam >> 16; } } else { switch ( Msg ) { case WM_MOUSEFIRST: mouseInfo_x = lParam; mouseInfo_y = (unsigned int)lParam >> 16; break; case WM_CHAR: fun_inputKeyPressed(wParam); if ( wParam == '[' ) fun_changeGameSpeed(1); if ( wParam == ']' ) fun_changeGameSpeed(0); if ( wParam == ' ' ) // toggle overlay { if ( window_id == 30 ) window_id = 1; if ( window_id == 1 ) { v6 = previousOverlay; previousOverlay = currentOverlay; currentOverlay = v6; window_redrawRequest = 1; } } if ( wParam == 'P' || wParam == 'p' ) { if ( window_id == 30 ) window_id = 1; if ( window_id == 1 ) { if ( setting_game_paused ) setting_game_paused = 0; else setting_game_paused = 1; fun_clearWarnings(); } } if ( wParam == 'F' || wParam == 'f' )// fire overlay fun_showOverlay(Overlay_Fire); if ( wParam == 'D' || wParam == 'd' )// damage overlay fun_showOverlay(Overlay_Damage); if ( wParam == 'C' || wParam == 'c' )// crime overlay fun_showOverlay(Overlay_Crime); if ( wParam == 'T' || wParam == 't' )// problems overlay fun_showOverlay(Overlay_Problems); if ( wParam == 'W' || wParam == 'w' )// water overlay fun_showOverlay(Overlay_Water); if ( wParam == '1' ) fun_showAdvisor(Adv_Labor); if ( wParam == '2' ) fun_showAdvisor(Adv_Military); if ( wParam == '3' ) fun_showAdvisor(Adv_Imperial); if ( wParam == '4' ) fun_showAdvisor(Adv_Ratings); if ( wParam == '5' ) fun_showAdvisor(Adv_Trade); if ( wParam == '6' ) fun_showAdvisor(Adv_Population); if ( wParam == '7' ) fun_showAdvisor(Adv_Health); if ( wParam == '8' ) fun_showAdvisor(Adv_Education); if ( wParam == '9' ) fun_showAdvisor(Adv_Entertainment); if ( wParam == '0' ) fun_showAdvisor(Adv_Religion); if ( wParam == '-' ) fun_showAdvisor(Adv_Financial); if ( wParam == '=' ) fun_showAdvisor(Adv_Chief); if ( wParam == 'L' || wParam == 'l' ) fun_cycleThroughLegions(); break; case WM_SYSKEYDOWN: switch ( wParam ) { case 0x58u: PostMessageA(hWnd, 0x100u, 0x1Bu, 0); break; case 0x4Bu: case 0x6Bu: if ( window_id == 9 ) { dword_607F8C = currentlySelectedBuilding && buildings[currentlySelectedBuilding].type == B_Well; } else { if ( window_id != 5 || dword_607F8C < 1 ) { dword_607F8C = 0; } else { dword_607F8C = 2; fun_startInvasionFromCheat(); } } break; case 0x43u: if ( dword_607F8C ) { if ( city_inform[ciid].treasury < 5000 ) { city_inform[ciid].treasury += 1000; city_inform[ciid].dword_6543C8 += 1000; } } break; case 0x56u: case 0x76u: if ( dword_607F8C ) byte_65E6A0 = 1; break; default: return DefWindowProcA(hWnd, Msg, wParam, lParam); } break; } } } } } else { if ( Msg == WM_KEYUP ) { if ( wParam == VK_SHIFT ) { key_shift_down = 0; } else { if ( wParam == VK_CONTROL ) key_ctrl_down = 0; } } else { switch ( Msg ) { case WM_MOVE: case WM_SIZE: if ( IsIconic(hWnd) ) { fun_pauseApp(); } else { fun_resumeApp(); app_active = 1; } if ( setting_fullscreen ) { screenHeight = GetSystemMetrics(1); screenWidth = GetSystemMetrics(0); SetRect(&ddraw_rect, 0, 0, screenWidth, screenHeight); } else { GetClientRect(hWnd, &ddraw_rect); ClientToScreen(hWnd, (LPPOINT)&ddraw_rect); ClientToScreen(hWnd, &ddraw_bottomright); } fun_refreshVideoBuffer(1); window_redrawRequest = 1; video_refreshRequested = 1; break; case WM_ACTIVATEAPP: v12 = wParam && GetForegroundWindow() == hWnd && !IsIconic(hWnd); app_active = v12; if ( app_active ) fun_logDebugMessage("OK :Active. ", 0, 0); else fun_logDebugMessage("OK :Not active. ", 0, 0); if ( app_paused ) { if ( app_active ) { if ( fun_directDrawRestoreSurfaces() ) { fun_resumeApp(); } else { if ( GetForegroundWindow() == hWnd ) { fun_logDebugMessage("ERR:Re-initializing direct draw. ", 0, 0); if ( fun_initDirectDraw() ) fun_resumeApp(); } } } } window_redrawRequest = 1; video_refreshRequested = 1; break; case WM_DISPLAYCHANGE: dword_660798 = wParam; system_screen_width = (unsigned __int16)lParam; system_screen_height = (unsigned int)lParam >> 16; break; case WM_KEYFIRST: byte_660728 = 1; switch ( wParam ) { case 0x11u: key_ctrl_down = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x10u: key_shift_down = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x24u: fun_inputHomePressed(); if ( window_id == 1 ) { currentButton_parameter = 0; fun_sidePanel_rotate(); } return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x23u: fun_inputEndPressed(); if ( window_id == 1 ) { currentButton_parameter = 1; fun_sidePanel_rotate(); } return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x27u: fun_inputRightPressed(); if ( key_ctrl_down ) fun_editor_editEmpire_moveEmpireCity(2, 8); else fun_editor_editEmpire_moveEmpireCity(2, 1); arrowkey_right_pressed = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x25u: fun_inputLeftPressed(); if ( key_ctrl_down ) fun_editor_editEmpire_moveEmpireCity(6, 8); else fun_editor_editEmpire_moveEmpireCity(6, 1); arrowkey_left_pressed = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x28u: fun_inputRightPressed(); if ( key_ctrl_down ) fun_editor_editEmpire_moveEmpireCity(4, 8); else fun_editor_editEmpire_moveEmpireCity(4, 1); arrowkey_down_pressed = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x26u: fun_inputLeftPressed(); if ( key_ctrl_down ) fun_editor_editEmpire_moveEmpireCity(0, 8); else fun_editor_editEmpire_moveEmpireCity(0, 1); arrowkey_up_pressed = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x2Du: fun_inputInsertPressed(); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x2Eu: fun_inputDeletePressed(); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 8u: fun_inputBackspacePressed(); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0xDu: // return fun_inputReturnPressed(); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x70u: // F1 if ( key_ctrl_down ) fun_setBookmark(0); else fun_jumpToBookmark(0); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x71u: // F2 if ( key_ctrl_down ) fun_setBookmark(1); else fun_jumpToBookmark(1); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x72u: // F3 if ( key_ctrl_down ) fun_setBookmark(2); else fun_jumpToBookmark(2); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x73u: // F4 if ( key_ctrl_down ) fun_setBookmark(3); else fun_jumpToBookmark(3); return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x74u: // F5: center window (window mode) if ( !setting_fullscreen ) { GetClientRect(hWnd, &Rect); SetRect(&Rect, 0, 0, ddraw_width, ddraw_height); v7 = GetWindowLongA(hWnd, -20); v8 = GetMenu(hWnd) != 0; v9 = GetWindowLongA(hWnd, -16); AdjustWindowRectEx(&Rect, v9, v8, v7); SetWindowPos( hWnd, 0, (system_screen_width - screen_width) / 2, (system_screen_height - screen_height) / 2, Rect.right - Rect.left, Rect.bottom - Rect.top, 0x14u); } return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x75u: // F6: toggle fullscreen video_busySwitching = 1; setting_fullscreen = setting_fullscreen == 0; fun_deinitDirectDraw(1); fun_initDirectDraw(); video_busySwitching = 0; window_redrawRequest = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x76u: // F7: set 640x480 video_busySwitching = 1; fun_deinitDirectDraw(1); fun_setResolution(1); fun_reallocateScreenBuffer(); fun_clearWarnings(); fun_initDirectDraw(); video_busySwitching = 0; fun_showResolutionConfirmDialog(); window_redrawRequest = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x77u: // F8: set 800x600 video_busySwitching = 1; fun_deinitDirectDraw(1); fun_setResolution(2); fun_reallocateScreenBuffer(); fun_clearWarnings(); fun_initDirectDraw(); video_busySwitching = 0; fun_showResolutionConfirmDialog(); window_redrawRequest = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x78u: // F9: set 1024x768 video_busySwitching = 1; fun_deinitDirectDraw(1); fun_setResolution(3); fun_reallocateScreenBuffer(); fun_clearWarnings(); fun_initDirectDraw(); video_busySwitching = 0; fun_showResolutionConfirmDialog(); window_redrawRequest = 1; return DefWindowProcA(hWnd, Msg, wParam, lParam); case 0x1Bu: // ESC fun_smackCancelVideo(); fun_getGameTextString(GAMETEXT_DIALOGS, 0);// Quit fun_getGameTextString_forMessagebox(GAMETEXT_DIALOGS, 1); v10 = MessageBoxA(hWnd, c3eng_textstring_forMessagebox, gametext_result, 4u); mouseInfo_type = 0; if ( v10 == 6 ) { wndproc_closeStatus = 1; window_redrawRequest = 1; } return 0; default: return DefWindowProcA(hWnd, Msg, wParam, lParam); } case WM_CLOSE: wndproc_closeStatus = 3; break; case WM_PAINT: v14 = BeginPaint(hWnd, &Paint); EndPaint(hWnd, &Paint); fun_refreshVideoBuffer(1); video_refreshRequested = 1; break; case WM_DESTROY: fun_smackStopVideo(); main_window = 0; fun_deinitDirectDraw(1); fun_deinitDirectSound(); PostQuitMessage(0); break; default: return DefWindowProcA(hWnd, Msg, wParam, lParam); } } } return DefWindowProcA(hWnd, Msg, wParam, lParam); } void fun_showOverlay(int overlay) { if ( window_id == 30 ) window_id = 1; if ( window_id != 18 && window_id != 35 ) { if ( window_id != 1 ) return; } else { if ( dword_7E2D10 != 1 ) return; } if ( currentOverlay == overlay ) { previousOverlay = overlay; currentOverlay = 0; window_redrawRequest = 1; } else { previousOverlay = 0; currentOverlay = overlay; window_redrawRequest = 1; } } void fun_showAdvisor(int advisor) { if ( window_id == 30 ) window_id = 1; if ( window_id == W_Advisors ) { if ( currentAdvisor == advisor ) { window_id = 1; window_redrawRequest = 1; } else { currentButton_parameter = advisor; fun_gotoAdvisorFromButton(); } } else { if ( window_id == 1 ) { currentButton_parameter = advisor; fun_gotoAdvisorFromButton(); } } } void fun_cycleThroughLegions() { signed int id; // [sp+50h] [bp-8h]@5 signed int i; // [sp+54h] [bp-4h]@5 if ( window_id == 1 ) { if ( window_id == 30 ) window_id = 1; id = shortcut_legion_id; shortcut_legion_id = 0; for ( i = 1; i <= 6; ++i ) { ++id; if ( id > 6 ) id = 1; if ( formations[id].inUse == 1 ) { if ( !formations[id].formation_61 ) { if ( formations[id].isFort ) { if ( !shortcut_legion_id ) shortcut_legion_id = id; } } } } if ( shortcut_legion_id > 0 ) { fun_gotoGridOffset(162 * formations[shortcut_legion_id].fortY + formations[shortcut_legion_id].fortX + (_WORD)setting_map_startGridOffset); window_redrawRequest = 1; } } } void fun_jumpToBookmark(signed int bookmark) { if ( window_id == 30 ) window_id = 1; if ( window_id == 1 ) { if ( bookmark >= 0 ) { if ( bookmark <= 4 ) { if ( mapBookmarks_x[2 * bookmark] > -1 ) { if ( 162 * mapBookmarks_y[2 * bookmark] + mapBookmarks_x[2 * bookmark] + setting_map_startGridOffset > -1 ) { setting_map_camera_x = mapBookmarks_x[2 * bookmark]; setting_map_camera_y = mapBookmarks_y[2 * bookmark]; sub_4DC600(); window_redrawRequest = 1; } } } } } } void fun_setBookmark(signed int bookmark) { if ( window_id == 30 ) window_id = 1; if ( window_id == 1 ) { if ( bookmark >= 0 ) { if ( bookmark <= 4 ) { mapBookmarks_x[2 * bookmark] = setting_map_camera_x; mapBookmarks_y[2 * bookmark] = setting_map_camera_y; } } } } void fun_changeGameSpeed(int goSlower) { if ( window_id == 1 ) { currentButton_parameter = goSlower; fun_dialogSpeedOptions_gameUpDown(); } } void sub_41C000(int buildingId, int a2) { int v2; // [sp+4Ch] [bp-4h]@3 if ( buildings[buildingId].inUse == 1 ) { v2 = dword_5EA654[buildings[buildingId].type]; if ( v2 > 0 ) { switch ( buildings[buildingId].type ) { case B_Theater: if ( city_inform[ciid].imperialArmyComing > 0 || buildings[buildingId].num_workers <= 0 ) return; break; case B_Amphitheater: if ( city_inform[ciid].imperialArmyComing > 0 || buildings[buildingId].num_workers <= 0 ) return; break; case B_Colosseum: if ( city_inform[ciid].imperialArmyComing > 0 || buildings[buildingId].num_workers <= 0 ) return; break; default: if ( buildings[buildingId].type == B_Hippodrome && (city_inform[ciid].imperialArmyComing > 0 || buildings[buildingId].num_workers <= 0) ) return; break; } dword_9D82E0[32 * v2] = 1; ++dword_9D82E4[32 * v2]; ++*(int *)((char *)&dword_9D82EC[32 * v2] + 4 * a2); return; } } } void sub_41C210() { signed int v0; // [sp+4Ch] [bp-18h]@34 int v1; // [sp+50h] [bp-14h]@16 signed int v2; // [sp+54h] [bp-10h]@16 signed int j; // [sp+5Ch] [bp-8h]@5 signed int l; // [sp+5Ch] [bp-8h]@26 signed int m; // [sp+5Ch] [bp-8h]@40 signed int i; // [sp+60h] [bp-4h]@1 signed int k; // [sp+60h] [bp-4h]@16 for ( i = 1; i < 70; ++i ) { dword_9D8338[32 * i] = 0; if ( dword_9D82E0[32 * i] > 0 ) { dword_9D82E0[32 * i] = 0; if ( dword_9D82E4[32 * i] >= dword_9D82E8[32 * i] ) { if ( time_current - dword_9D8330[32 * i] >= dword_9D8334[32 * i] ) dword_9D8338[32 * i] = 1; } } else { dword_9D82E4[32 * i] = 0; for ( j = 0; j < 5; ++j ) *(int *)((char *)&dword_9D82EC[32 * i] + 4 * j) = 0; } } if ( time_current - dword_9D7BB0[0] >= 2000 ) { v1 = 0; v2 = 0; for ( k = 1; k < 70; ++k ) { if ( dword_9D8338[32 * k] > 0 ) { if ( time_current - dword_9D8330[32 * k] > v1 ) { v1 = time_current - dword_9D8330[32 * k]; v2 = k; } } } if ( v2 > 0 ) { for ( l = 0; ; ++l ) { if ( l < 8 ) { ++dword_9D8300[32 * v2]; if ( dword_9D8300[32 * v2] >= dword_9D8304[32 * v2] ) dword_9D8300[32 * v2] = 0; dword_9D82C0 = *(int *)((char *)&dword_9D8308[32 * v2] + 4 * dword_9D8300[32 * v2]); if ( !fun_sound_isEffectsChannelInUse(dword_9D82C0) ) continue; } break; } if ( dword_9D82F4[32 * v2] <= 10 ) { if ( dword_9D82EC[32 * v2] <= 10 ) { if ( dword_9D82FC[32 * v2] <= 10 ) v0 = 2; else v0 = 4; } else { v0 = 0; } } else { v0 = 2; } fun_sound_440330(dword_9D82C0, v0); dword_9D7BB0[0] = time_current; dword_9D8330[32 * v2] = time_current; dword_9D82E4[32 * v2] = 0; for ( m = 0; m < 5; ++m ) *(int *)((char *)&dword_9D82EC[32 * v2] + 4 * m) = 0; ++dword_9D832C[32 * v2]; } } } void sub_41C5D0() { signed int j; // [sp+4Ch] [bp-8h]@3 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 70; ++i ) { for ( j = 0; j < 5; ++j ) *(int *)((char *)&dword_9D82EC[32 * i] + 4 * j) = 0; dword_9D82E4[32 * i] /= 2; } } signed int sub_41C670() { signed int result; // eax@4 signed int i; // [sp+50h] [bp-4h]@1 dword_9D7BB0[0] = timeGetTime(); fun_memset(dword_9D82E0, 8960, 0); for ( i = 1; i < 70; ++i ) dword_9D8330[32 * i] = dword_9D7BB0[0]; dword_9D82E8[32] = 200; dword_9D8304[32] = 1; dword_9D8308[32] = 30; *(&dword_9D8328 + 32) = 1; dword_9D8334[32] = 30000; dword_9D82E8[64] = 200; dword_9D8304[64] = 1; dword_9D8308[64] = 34; *(&dword_9D8328 + 64) = 1; dword_9D8334[64] = 30000; dword_9D82E8[96] = 200; dword_9D8304[96] = 1; dword_9D8308[96] = 38; *(&dword_9D8328 + 96) = 1; dword_9D8334[96] = 30000; dword_9D82E8[128] = 200; dword_9D8304[128] = 1; dword_9D8308[128] = 42; *(&dword_9D8328 + 128) = 1; dword_9D8334[128] = 30000; dword_9D82E8[160] = 200; dword_9D8304[160] = 1; dword_9D8308[160] = 46; *(&dword_9D8328 + 160) = 1; dword_9D8334[160] = 30000; dword_9D82E8[192] = 200; dword_9D8304[192] = 1; dword_9D8308[192] = 50; *(&dword_9D8328 + 192) = 1; dword_9D8334[192] = 30000; dword_9D82E8[224] = 200; dword_9D8304[224] = 1; dword_9D8308[224] = 51; *(&dword_9D8328 + 224) = 1; dword_9D8334[224] = 30000; dword_9D82E8[256] = 200; dword_9D8304[256] = 1; dword_9D8308[256] = 52; *(&dword_9D8328 + 256) = 1; dword_9D8334[256] = 30000; dword_9D82E8[288] = 200; dword_9D8304[288] = 1; dword_9D8308[288] = 53; *(&dword_9D8328 + 288) = 1; dword_9D8334[288] = 30000; dword_9D82E8[320] = 200; dword_9D8304[320] = 1; dword_9D8308[320] = 54; *(&dword_9D8328 + 320) = 1; dword_9D8334[320] = 30000; dword_9D82E8[352] = 200; dword_9D8304[352] = 1; dword_9D8308[352] = 55; *(&dword_9D8328 + 352) = 1; dword_9D8334[352] = 30000; dword_9D82E8[384] = 200; dword_9D8304[384] = 1; dword_9D8308[384] = 56; *(&dword_9D8328 + 384) = 1; dword_9D8334[384] = 30000; dword_9D82E8[416] = 200; dword_9D8304[416] = 1; dword_9D8308[416] = 57; *(&dword_9D8328 + 416) = 1; dword_9D8334[416] = 30000; dword_9D82E8[448] = 200; dword_9D8304[448] = 1; dword_9D8308[448] = 58; *(&dword_9D8328 + 448) = 1; dword_9D8334[448] = 30000; dword_9D82E8[480] = 200; dword_9D8304[480] = 1; dword_9D8308[480] = 62; *(&dword_9D8328 + 480) = 1; dword_9D8334[480] = 30000; dword_9D82E8[512] = 200; dword_9D8304[512] = 1; dword_9D8308[512] = 63; *(&dword_9D8328 + 512) = 1; dword_9D8334[512] = 30000; dword_9D82E8[544] = 200; dword_9D8304[544] = 1; dword_9D8308[544] = 64; *(&dword_9D8328 + 544) = 1; dword_9D8334[544] = 30000; dword_9D82E8[576] = 200; dword_9D8304[576] = 1; dword_9D8308[576] = 65; *(&dword_9D8328 + 576) = 1; dword_9D8334[576] = 30000; dword_9D82E8[608] = 200; dword_9D8304[608] = 1; dword_9D8308[608] = 66; *(&dword_9D8328 + 608) = 1; dword_9D8334[608] = 30000; dword_9D82E8[640] = 200; dword_9D8304[640] = 1; dword_9D8308[640] = 67; *(&dword_9D8328 + 640) = 1; dword_9D8334[640] = 30000; dword_9D82E8[672] = 200; dword_9D8304[672] = 1; dword_9D8308[672] = 68; *(&dword_9D8328 + 672) = 1; dword_9D8334[672] = 30000; dword_9D82E8[704] = 200; dword_9D8304[704] = 1; dword_9D8308[704] = 69; *(&dword_9D8328 + 704) = 1; dword_9D8334[704] = 30000; dword_9D82E8[736] = 200; dword_9D8304[736] = 1; dword_9D8308[736] = 70; *(&dword_9D8328 + 736) = 1; dword_9D8334[736] = 30000; dword_9D82E8[768] = 200; dword_9D8304[768] = 1; dword_9D8308[768] = 74; *(&dword_9D8328 + 768) = 1; dword_9D8334[768] = 30000; dword_9D82E8[800] = 200; dword_9D8304[800] = 1; dword_9D8308[800] = 78; *(&dword_9D8328 + 800) = 1; dword_9D8334[800] = 30000; dword_9D82E8[832] = 200; dword_9D8304[832] = 1; dword_9D8308[832] = 79; *(&dword_9D8328 + 832) = 1; dword_9D8334[832] = 30000; dword_9D82E8[864] = 200; dword_9D8304[864] = 1; dword_9D8308[864] = 80; *(&dword_9D8328 + 864) = 1; dword_9D8334[864] = 30000; dword_9D82E8[896] = 200; dword_9D8304[896] = 1; dword_9D8308[896] = 81; *(&dword_9D8328 + 896) = 1; dword_9D8334[896] = 30000; dword_9D82E8[928] = 200; dword_9D8304[928] = 1; dword_9D8308[928] = 82; *(&dword_9D8328 + 928) = 1; dword_9D8334[928] = 30000; dword_9D82E8[960] = 200; dword_9D8304[960] = 1; dword_9D8308[960] = 83; *(&dword_9D8328 + 960) = 1; dword_9D8334[960] = 30000; dword_9D82E8[992] = 200; dword_9D8304[992] = 1; dword_9D8308[992] = 87; *(&dword_9D8328 + 992) = 1; dword_9D8334[992] = 30000; dword_9D82E8[1024] = 200; dword_9D8304[1024] = 1; dword_9D8308[1024] = 89; *(&dword_9D8328 + 1024) = 1; dword_9D8334[1024] = 30000; dword_9D82E8[1056] = 200; dword_9D8304[1056] = 1; dword_9D8308[1056] = 91; *(&dword_9D8328 + 1056) = 1; dword_9D8334[1056] = 30000; dword_9D82E8[1088] = 200; dword_9D8304[1088] = 1; dword_9D8308[1088] = 93; *(&dword_9D8328 + 1088) = 1; dword_9D8334[1088] = 30000; dword_9D82E8[1120] = 200; dword_9D8304[1120] = 1; dword_9D8308[1120] = 95; *(&dword_9D8328 + 1120) = 1; dword_9D8334[1120] = 30000; dword_9D82E8[1152] = 200; dword_9D8304[1152] = 1; dword_9D8308[1152] = 97; *(&dword_9D8328 + 1152) = 1; dword_9D8334[1152] = 30000; dword_9D82E8[1184] = 200; dword_9D8304[1184] = 1; dword_9D8308[1184] = 98; *(&dword_9D8328 + 1184) = 1; dword_9D8334[1184] = 30000; dword_9D82E8[1216] = 200; dword_9D8304[1216] = 1; dword_9D8308[1216] = 99; *(&dword_9D8328 + 1216) = 1; dword_9D8334[1216] = 30000; dword_9D82E8[1248] = 200; dword_9D8304[1248] = 1; dword_9D8308[1248] = 100; *(&dword_9D8328 + 1248) = 1; dword_9D8334[1248] = 30000; dword_9D82E8[1280] = 200; dword_9D8304[1280] = 1; dword_9D8308[1280] = 101; *(&dword_9D8328 + 1280) = 1; dword_9D8334[1280] = 30000; dword_9D82E8[1312] = 200; dword_9D8304[1312] = 1; dword_9D8308[1312] = 102; *(&dword_9D8328 + 1312) = 1; dword_9D8334[1312] = 30000; dword_9D82E8[1344] = 200; dword_9D8304[1344] = 1; dword_9D8308[1344] = 106; *(&dword_9D8328 + 1344) = 1; dword_9D8334[1344] = 30000; dword_9D82E8[1376] = 200; dword_9D8304[1376] = 1; dword_9D8308[1376] = 110; *(&dword_9D8328 + 1376) = 1; dword_9D8334[1376] = 30000; dword_9D82E8[1408] = 200; dword_9D8304[1408] = 1; dword_9D8308[1408] = 111; *(&dword_9D8328 + 1408) = 1; dword_9D8334[1408] = 30000; dword_9D82E8[1440] = 200; dword_9D8304[1440] = 1; dword_9D8308[1440] = 112; *(&dword_9D8328 + 1440) = 1; dword_9D8334[1440] = 30000; dword_9D82E8[1472] = 200; dword_9D8304[1472] = 1; dword_9D8308[1472] = 113; *(&dword_9D8328 + 1472) = 1; dword_9D8334[1472] = 30000; dword_9D82E8[1504] = 200; dword_9D8304[1504] = 1; dword_9D8308[1504] = 114; *(&dword_9D8328 + 1504) = 1; dword_9D8334[1504] = 30000; dword_9D82E8[1536] = 200; dword_9D8304[1536] = 1; dword_9D8308[1536] = 115; *(&dword_9D8328 + 1536) = 1; dword_9D8334[1536] = 30000; dword_9D82E8[1568] = 200; dword_9D8304[1568] = 1; dword_9D8308[1568] = 116; *(&dword_9D8328 + 1568) = 1; dword_9D8334[1568] = 30000; dword_9D82E8[1600] = 200; dword_9D8304[1600] = 1; dword_9D8308[1600] = 117; *(&dword_9D8328 + 1600) = 1; dword_9D8334[1600] = 30000; dword_9D82E8[1632] = 200; dword_9D8304[1632] = 1; dword_9D8308[1632] = 118; *(&dword_9D8328 + 1632) = 1; dword_9D8334[1632] = 30000; dword_9D82E8[1664] = 200; dword_9D8304[1664] = 1; dword_9D8308[1664] = 119; *(&dword_9D8328 + 1664) = 1; dword_9D8334[1664] = 30000; dword_9D82E8[1696] = 200; dword_9D8304[1696] = 1; dword_9D8308[1696] = 120; *(&dword_9D8328 + 1696) = 1; dword_9D8334[1696] = 30000; dword_9D82E8[1728] = 200; dword_9D8304[1728] = 1; dword_9D8308[1728] = 121; *(&dword_9D8328 + 1728) = 1; dword_9D8334[1728] = 30000; dword_9D82E8[1760] = 200; dword_9D8304[1760] = 1; dword_9D8308[1760] = 122; *(&dword_9D8328 + 1760) = 1; dword_9D8334[1760] = 30000; dword_9D82E8[1792] = 200; dword_9D8304[1792] = 1; dword_9D8308[1792] = 123; *(&dword_9D8328 + 1792) = 1; dword_9D8334[1792] = 30000; dword_9D82E8[1824] = 200; dword_9D8304[1824] = 1; dword_9D8308[1824] = 124; *(&dword_9D8328 + 1824) = 1; dword_9D8334[1824] = 30000; dword_9D82E8[1856] = 200; dword_9D8304[1856] = 1; dword_9D8308[1856] = 125; *(&dword_9D8328 + 1856) = 1; dword_9D8334[1856] = 30000; dword_9D82E8[1888] = 200; dword_9D8304[1888] = 1; dword_9D8308[1888] = 126; *(&dword_9D8328 + 1888) = 1; dword_9D8334[1888] = 30000; dword_9D82E8[1920] = 200; dword_9D8304[1920] = 1; dword_9D8308[1920] = 127; *(&dword_9D8328 + 1920) = 1; dword_9D8334[1920] = 30000; dword_9D82E8[1952] = 200; dword_9D8304[1952] = 1; dword_9D8308[1952] = 128; *(&dword_9D8328 + 1952) = 1; dword_9D8334[1952] = 30000; dword_9D82E8[1984] = 200; dword_9D8304[1984] = 1; dword_9D8308[1984] = 132; *(&dword_9D8328 + 1984) = 1; dword_9D8334[1984] = 30000; dword_9D82E8[2016] = 200; dword_9D8304[2016] = 1; result = 8064; dword_9D8308[2016] = 133; *(&dword_9D8328 + 2016) = 1; dword_9D8334[2016] = 30000; return result; } void fun_changeBackgroundMusic() { signed int track; // [sp+4Ch] [bp-4h]@6 if ( music_nextBackgroundChangeCheck ) { --music_nextBackgroundChangeCheck; } else { if ( setting_sound_music_on > 0 ) { if ( city_inform[ciid].enemyDestroyedBuildings + city_inform[ciid].imperialArmyComing < 32 ) { if ( city_inform[ciid].enemyDestroyedBuildings + city_inform[ciid].imperialArmyComing ) { track = 7; } else { if ( city_inform[ciid].population >= 1000 ) { if ( city_inform[ciid].population >= 2000 ) { if ( city_inform[ciid].population >= 5000 ) { if ( city_inform[ciid].population >= 7000 ) track = 5; else track = 4; } else { track = 3; } } else { track = 2; } } else { track = 1; } } } else { track = 6; } if ( music_currentlyPlayingBackground != track ) { fun_soundStopChannel(0); switch ( track ) { case 1: fun_playSound("wavs\\rome1.wav", 0, 1); break; case 2: fun_playSound("wavs\\rome2.wav", 0, 1); break; case 3: fun_playSound("wavs\\rome3.wav", 0, 1); break; case 4: fun_playSound("wavs\\rome4.wav", 0, 1); break; case 5: fun_playSound("wavs\\rome5.wav", 0, 1); break; case 6: fun_playSound("wavs\\Combat_Long.wav", 0, 1); break; case 7: fun_playSound("wavs\\Combat_short.wav", 0, 1); break; } music_currentlyPlayingBackground = track; music_nextBackgroundChangeCheck = 10; } } } } void fun_resetBackgroundMusic() { music_currentlyPlayingBackground = 0; music_nextBackgroundChangeCheck = 0; } void fun_drawMenuBar(struct C3Menu *menu, signed int numItems) { int y; // [sp+54h] [bp-10h]@3 int x; // [sp+58h] [bp-Ch]@3 int group; // [sp+5Ch] [bp-8h]@3 signed int i; // [sp+60h] [bp-4h]@1 byte_660BFC[0] = 1; byte_65E6E8 = 1; text_xoffset = 0; text_xoffset = menu->xOffset; for ( i = 1; i <= numItems; ++i ) { group = menu->textGroup; menu->xOffset = text_xoffset; x = (signed __int16)text_xoffset; y = menu->yOffset; fun_getGameTextString(group, 0); if ( i == selectedMainMenuItemId ) { drawtext_forceColor = 1; fun_getStringWidth(gametext_result, graphic_font); fun_drawGameText(group, 0, x, y, graphic_font + F_SmallBrown, 0xFAC1u); drawtext_forceColor = 0; } else { fun_drawGameText(group, 0, x, y, graphic_font + F_SmallBrown, 0); } menu->xEnd = text_xoffset; text_xoffset += 32; // spacing ++menu; } } void fun_drawOpenSubMenu() { signed int numItems; // [sp+4Ch] [bp-1Ch]@5 int textGroup; // [sp+50h] [bp-18h]@5 int yOffset; // [sp+54h] [bp-14h]@5 int xOffset; // [sp+58h] [bp-10h]@5 signed int i; // [sp+5Ch] [bp-Ch]@5 int subYOffset; // [sp+60h] [bp-8h]@7 int textNumber; // [sp+64h] [bp-4h]@7 if ( window_id == 3 ) { if ( selectedMainMenuItemId ) { openMainMenuSubItems = openMainMenuItem->items; xOffset = openMainMenuItem->xOffset; yOffset = openMainMenuItem->yOffset; textGroup = openMainMenuItem->textGroup; numItems = LOWORD(openMainMenuItem->numItems); drawGraphic_width = (drawGraphic_width & 0xffff0000) + 10; drawGraphic_height = (drawGraphic_height & 0xffff0000) + 20 * numItems + 20; fun_drawSubMenuBackground( xOffset, yOffset + 18, (signed __int16)drawGraphic_width, (signed __int16)drawGraphic_height / 16); for ( i = 1; i <= numItems; ++i ) { textNumber = openMainMenuSubItems->textNumber; subYOffset = yOffset + openMainMenuSubItems->yOffset + 30; if ( i == selectedSubMenuItemId ) { drawtext_forceColor = 1; drawGraphic_width = (drawGraphic_width & 0xffff0000) + 10; drawGraphic_height = (drawGraphic_height & 0xffff0000) + 16; fun_drawColoredRectangle(xOffset, subYOffset - 2, 0); fun_drawGameText(textGroup, textNumber, xOffset + 8, subYOffset, graphic_font, 0xFAC1u); drawtext_forceColor = 0; } else { fun_drawGameText(textGroup, textNumber, xOffset + 8, subYOffset, graphic_font + 134, 0); } ++openMainMenuSubItems; } } } } void fun_drawDialogConfirm() { fun_drawDialogBackground(confirmDialog_x, confirmDialog_y, 30, 10); fun_drawGameTextCentered( GAMETEXT_DIALOGS, confirmDialog_msg, confirmDialog_x, confirmDialog_y + 20, 480, graphic_font + F_LargeBlack, 0); if ( fun_getGameTextStringWidth(GAMETEXT_DIALOGS, confirmDialog_msg + 1, graphic_font + F_NormalBlack) >= 420 ) fun_drawGameTextWrapped( GAMETEXT_DIALOGS, confirmDialog_msg + 1, confirmDialog_x + 30, confirmDialog_y + 60, 420, graphic_font + F_NormalBlack, 0); else fun_drawGameTextCentered( GAMETEXT_DIALOGS, confirmDialog_msg + 1, confirmDialog_x, confirmDialog_y + 60, 480, graphic_font + F_NormalBlack, 0); } void fun_drawDialogConfirmButtons() { if ( confirmDialog_numButtons ) fun_drawImageButtonCollection( confirmDialog_x, confirmDialog_y, &imagebuttons_confirmDialog, confirmDialog_numButtons); else fun_drawGameTextCentered(13, 1, confirmDialog_x, confirmDialog_y + 128, 480, graphic_font + 134, 0); } void fun_drawArrowButtonCollection(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons) { int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < numButtons; ++i ) { graphic_xOffset = buttons->xOffset + xOffset; graphic_yOffset = buttons->yOffset + yOffset; if ( buttons->field_F != 4 && buttons->field_F != 5 ) { if ( buttons->field_C ) graphic_currentGraphicId = buttons->graphicId + 1; else graphic_currentGraphicId = buttons->graphicId; } else { graphic_currentGraphicId = buttons->graphicId; if ( buttons->field_D ) graphic_currentGraphicId = buttons->graphicId + 1; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); if ( buttons->field_D ) video_refreshRequested = 1; ++buttons; } } int unused_41EB50(int xOffset, int yOffset, int a3) { dword_9D7B74 = xOffset; dword_9D7B98 = yOffset; dword_9D7B88 = a3; graphic_currentGraphicId = 0; return drawGraphic(graphic_currentGraphicId, xOffset, yOffset); } int unused_41EBD0(int a1, int a2) { int result; // eax@3 int v3; // ST7C_4@3 int v4; // ST78_4@3 int v5; // ST74_4@3 signed int v6; // ST70_4@3 signed int v7; // ST64_4@3 int i; // [sp+6Ch] [bp-4h]@1 for ( i = 0; i < a2; ++i ) { v3 = *(_WORD *)a1; v4 = *(_WORD *)(a1 + 2); v5 = *(_BYTE *)(a1 + 4); v6 = *(_BYTE *)(a1 + 5); v7 = v5 * (*(_WORD *)(a1 + 18) + 1 - *(_WORD *)(a1 + 16)) / v6; unused_fillGreenGraphicRect(v3 + 20, v4 - 4, v7 / 16 + 2, 2); drawGraphic(74, v3, v4); drawGraphic(75, v3 + v7 + 24, v4); fun_drawLine(v3 + 24, v4 + 9, v3 + v7 + 23, v4 + 9, 16904); fun_fillRect(v3 + 24, v4 + 10, v7, 4, 0); fun_drawLine(v3 + 24, v4 + 14, v3 + v7 + 23, v4 + 14, 50712); drawGraphic(76, v3 + v5 * **(_DWORD **)(a1 + 8) / v6 + 20, v4 - 4); a1 += 28; result = i + 1; } return result; } int unused_41EDC0(int a1, int a2) { int result; // eax@8 int v3; // [sp+4Ch] [bp-18h]@3 int i; // [sp+60h] [bp-4h]@1 for ( i = 0; ; ++i ) { if ( i >= a2 ) return 0; v3 = *(_BYTE *)(a1 + 4) * (*(_WORD *)(a1 + 18) - *(_WORD *)(a1 + 16)) / *(_BYTE *)(a1 + 5); if ( *(_WORD *)(a1 + 2) <= mouseclick_y ) { if ( *(_WORD *)(a1 + 2) + 24 > mouseclick_y ) { if ( *(_WORD *)a1 <= mouseclick_x && *(_WORD *)a1 + 24 > mouseclick_x ) { if ( unused_41F0B0(a1) ) result = i + 1; else result = 0; return result; } if ( *(_WORD *)a1 + 24 <= mouseclick_x && *(_WORD *)a1 + v3 + 26 > mouseclick_x ) { if ( unused_41EFA0(a1, mouseclick_x - 24 - *(_WORD *)a1) ) result = i + 1; else result = 0; return result; } if ( *(_WORD *)a1 + v3 + 26 <= mouseclick_x && *(_WORD *)a1 + v3 + 48 > mouseclick_x ) break; } } a1 += 28; } if ( unused_41F1C0(a1) ) result = i + 1; else result = 0; return result; } signed int unused_41EFA0(int a1, int a2) { signed int result; // eax@2 signed int v3; // ST5C_4@3 int v4; // ST58_4@3 int v5; // [sp+60h] [bp-10h]@3 int v6; // [sp+64h] [bp-Ch]@3 if ( mouse_isLeftClick ) { v6 = *(_WORD *)(a1 + 22); v5 = *(_WORD *)(a1 + 20); v3 = *(_BYTE *)(a1 + 4); v4 = *(_BYTE *)(a1 + 5); *(_WORD *)(a1 + 26) = 2; **(_DWORD **)(a1 + 8) = v4 * a2 / v3; if ( **(_DWORD **)(a1 + 8) >= v6 ) **(_DWORD **)(a1 + 8) = v6; if ( **(_DWORD **)(a1 + 8) < v5 ) **(_DWORD **)(a1 + 8) = v5; result = 1; } else { result = 0; } return result; } signed int unused_41F0B0(int a1) { signed int result; // eax@3 int v2; // ST60_4@4 int v3; // [sp+64h] [bp-Ch]@4 if ( byte_660B94[0] || mouseInfo_buttonIsDown ) { v3 = *(_WORD *)(a1 + 20); v2 = *(_BYTE *)(a1 + 6); *(_WORD *)(a1 + 26) = 2; *(_BYTE *)(a1 + 24) = 4; video_refreshRequested = 1; **(_DWORD **)(a1 + 8) -= v2; if ( **(_DWORD **)(a1 + 8) < v3 ) **(_DWORD **)(a1 + 8) = v3; result = 1; } else { result = 0; } return result; } signed int unused_41F1C0(int a1) { signed int result; // eax@3 int v2; // ST60_4@4 int v3; // [sp+68h] [bp-8h]@4 if ( byte_660B94[0] || mouseInfo_buttonIsDown ) { v3 = *(_WORD *)(a1 + 22); v2 = *(_BYTE *)(a1 + 6); *(_WORD *)(a1 + 26) = 2; *(_BYTE *)(a1 + 25) = 4; video_refreshRequested = 1; **(_DWORD **)(a1 + 8) += v2; if ( **(_DWORD **)(a1 + 8) > v3 ) **(_DWORD **)(a1 + 8) = v3; result = 1; } else { result = 0; } return result; } void fun_drawImageButtonCollection(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons) { int index; // [sp+4Ch] [bp-4h]@4 if ( imagebuttons_redraw || window_redrawRequest ) { index = 0; while ( index < numButtons ) { graphic_xOffset = buttons->xOffset + parentX; graphic_yOffset = buttons->yOffset + parentY; graphic_currentGraphicId = buttons->graphicIdOffsetInCollection + graphic_id_start[buttons->graphicCollectionId]; if ( buttons->state_enabled ) { if ( buttons->field_19 ) { if ( buttons->field_19 == 20 ) video_refreshRequested = 1; graphic_currentGraphicId += 2; } else { if ( buttons->field_1A ) ++graphic_currentGraphicId; } } else { graphic_currentGraphicId += 3; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); ++index; ++buttons; } } } int fun_handleImageButtonClick(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons) { int v5; // edx@41 struct C3ImageButton *buttons2; // [sp+4Ch] [bp-18h]@1 signed int v7; // [sp+54h] [bp-10h]@1 int index; // [sp+58h] [bp-Ch]@1 int v9; // [sp+58h] [bp-Ch]@27 int yOffset; // [sp+5Ch] [bp-8h]@9 int xOffset; // [sp+60h] [bp-4h]@9 struct C3ImageButton *v12; // [sp+74h] [bp+10h]@27 sub_41F820(buttons, numButtons); v7 = 0; buttons2 = buttons; index = 0; while ( index < numButtons ) { if ( buttons->field_1A ) { --buttons->field_1A; if ( !buttons->field_1A ) v7 = 1; } if ( buttons->state_enabled ) { xOffset = buttons->xOffset + parentX; yOffset = buttons->yOffset + parentY; if ( xOffset <= mouseclick_x ) { if ( buttons->width + xOffset > mouseclick_x ) { if ( yOffset <= mouseclick_y ) { if ( buttons->height + yOffset > mouseclick_y ) { button_x = mouseclick_x; button_y = mouseclick_y; if ( !buttons->field_1A ) v7 = 1; buttons->field_1A = 2; } } } } } ++index; ++buttons; } if ( buttons->field_8 != 2 && buttons->field_8 != 4 ) { if ( buttons->field_8 == 6 && !byte_660B94[0] && !mouse_isLeftClick ) return v7; } else { if ( !byte_660B94[0] && !handleClick_isRightClick ) return v7; } v12 = buttons2; v9 = 0; while ( 1 ) { if ( v9 >= numButtons ) return v7; if ( v12->state_enabled && v12->field_1A ) break; ++v9; ++v12; } if ( v12->field_8 == 2 ) sub_41F7A0(buttons2, numButtons); currentButton_parameter = v12->parameter1; currentButton_parameter2 = v12->parameter2; if ( byte_660B94[0] ) { sound_playChannel(3); v12->field_19 = 20; ((void (*)(void))v12->mouseClickHandler)(); } else { if ( handleClick_isRightClick ) { v12->field_19 = 20; ((void (*)(void))v12->rightClickHandler)(); } else { if ( v12->field_8 == 6 ) { v5 = mouse_isLeftClick; if ( mouse_isLeftClick ) { v12->field_19 = 20; ((void (__fastcall *)(struct C3ImageButton *, int))v12->mouseClickHandler)(v12, v5); } } } } return v9 + 1; } void unused_41F760(int a1, int a2) { sub_41F7A0((struct C3ImageButton *)a1, a2); sub_41F820((struct C3ImageButton *)a1, a2); } void sub_41F7A0(struct C3ImageButton *buttons, int numButtons) { int index; // [sp+4Ch] [bp-4h]@1 index = 0; while ( index < numButtons ) { if ( buttons->field_19 ) { if ( buttons->field_8 == 2 ) { buttons->field_19 = 0; imagebuttons_redraw = 1; } } ++index; ++buttons; } } void sub_41F820(struct C3ImageButton *buttons, int numButtons) { int index; // [sp+4Ch] [bp-4h]@1 index = 0; while ( index < numButtons ) { if ( buttons->field_19 ) { if ( buttons->field_8 == 4 || buttons->field_8 == 6 ) { --buttons->field_19; if ( buttons->field_19 <= 0 ) { buttons->field_19 = 0; imagebuttons_redraw = 1; } } } ++index; ++buttons; } } void fun_isImageButtonClick(int parentX, int parentY, struct C3ImageButton *buttons, int numButtons, int start) { int index; // [sp+4Ch] [bp-Ch]@1 int yOffset; // [sp+50h] [bp-8h]@3 int xOffset; // [sp+54h] [bp-4h]@3 index = 0; while ( index < numButtons ) { xOffset = buttons->xOffset + parentX; yOffset = buttons->yOffset + parentY; if ( xOffset <= mouseclick_x && buttons->width + xOffset > mouseclick_x && yOffset <= mouseclick_y && buttons->height + yOffset > mouseclick_y ) { button_x = mouseclick_x; button_y = mouseclick_y; mouseover_imagebutton_id[0] = start + index; return; } ++index; ++buttons; } } int fun_handleArrowButtonClick(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons) { int result; // eax@24 int height; // [sp+4Ch] [bp-18h]@17 int i; // [sp+50h] [bp-14h]@4 int j; // [sp+50h] [bp-14h]@15 signed int shouldRepeat; // [sp+54h] [bp-10h]@2 DWORD timeDiff; // [sp+5Ch] [bp-8h]@1 struct C3ArrowButton *button; // [sp+60h] [bp-4h]@4 timeDiff = timeGetTime(); if ( (timeDiff - arrowbutton_lastTime) >= 30 ) { shouldRepeat = 1; arrowbutton_lastTime = timeDiff; } else { shouldRepeat = 0; } button = buttons; for ( i = 0; i < numButtons; ++i ) { if ( button->field_D ) { --button->field_D; if ( !button->field_D ) { button->field_C = 1; button->field_E = 0; if ( button->field_F == 5 ) { currentButton_parameter = button->parameter; currentButton_parameter2 = button->parameter2; button->mouseClickHandler(); } } } else { button->field_E = 0; } if ( button->field_F == 3 ) button->field_C = 0; ++button; } for ( j = 0; ; ++j ) { if ( j >= numButtons ) return 0; height = buttons->size; if ( xOffset + buttons->xOffset > mouseclick_x || xOffset + height + buttons->xOffset <= mouseclick_x || yOffset + buttons->yOffset > mouseclick_y || yOffset + height + buttons->yOffset <= mouseclick_y ) goto LABEL_45; if ( buttons->field_F == 4 ) break; if ( buttons->field_F == 2 ) { buttons->field_D = 1; if ( !buttons->field_E ) { buttons->field_C ^= 1u; currentButton_parameter = buttons->parameter; currentButton_parameter2 = buttons->parameter2; buttons->mouseClickHandler(); } return j + 1; } if ( buttons->field_F == 5 ) { if ( byte_660B94[0] || mouseInfo_buttonIsDown ) { buttons->field_D = 10; buttons->field_C = 1; result = j + 1; } else { result = 0; } return result; } LABEL_45: ++buttons; } if ( byte_660B94[0] || mouseInfo_buttonIsDown ) { buttons->field_D = 3; buttons->field_E = 0; buttons->field_C = 1; currentButton_parameter = buttons->parameter; currentButton_parameter2 = buttons->parameter2; dword_6ADD18 = 0; buttons->mouseClickHandler(); return j + 1; } if ( !mouse_isLeftClick ) return 0; buttons->field_D = 3; if ( shouldRepeat ) { ++buttons->field_E; if ( buttons->field_E < 48 ) { if ( buttons->field_E < 8 ) return 0; if ( !byte_5F1098[buttons->field_E] ) return 0; } else { buttons->field_E = 47; } currentButton_parameter = buttons->parameter; currentButton_parameter2 = buttons->parameter2; dword_6ADD18 = buttons->field_E; buttons->mouseClickHandler(); result = j + 1; } else { result = 0; } return result; } int fun_isArrowButtonClick(int xOffset, int yOffset, struct C3ArrowButton *buttons, int numButtons, int offset) { int result; // eax@7 int size; // [sp+4Ch] [bp-8h]@3 int index; // [sp+50h] [bp-4h]@1 index = 0; while ( index < numButtons ) { size = buttons->size; if ( xOffset + buttons->xOffset <= mouseclick_x && xOffset + size + buttons->xOffset > mouseclick_x && yOffset + buttons->yOffset <= mouseclick_y && yOffset + size + buttons->yOffset > mouseclick_y ) { button_x = mouseclick_x; button_y = mouseclick_y; result = offset + index; arrowbutton_id = offset + index; return result; } result = index++ + 1; ++buttons; } return result; } signed int sub_41FEC0(struct C3Menu *a1, int a2) { signed int result; // eax@8 signed int v3; // [sp+4Ch] [bp-4h]@9 keepSubMenuOpen = 0; if ( byte_660B94[0] ) { if ( selectedSubMenuItemId ) { byte_660BFC[0] = 1; byte_65E6E8 = 1; window_id = dword_9D7B94; openMainMenuSubItems = openMainMenuItem->items; openMainMenuSubItems += selectedSubMenuItemId - 1; currentButton_parameter = openMainMenuSubItems->parameter; openMainMenuSubItems->handler(); if ( keepSubMenuOpen == 1 ) { window_redrawRequest = 1; dword_5FFF58[0] = 1; window_id = 3; } else { fun_closeSubMenu(); } } else { sub_420130(); } result = 1; } else { v3 = fun_isMenubarClick(a1, a2); if ( v3 != selectedMainMenuItemId ) { if ( v3 ) { byte_660BFC[0] = 1; byte_65E6E8 = 1; selectedMainMenuItemId = v3; openMainMenuItem = &a1[selectedMainMenuItemId - 1]; selectedSubMenuItemId = 0; dword_5FFF58[0] = 1; window_redrawRequest = 1; } } selectedSubMenuItemId = fun_isSubMenuClick( openMainMenuItem->items, LOWORD(openMainMenuItem->numItems), openMainMenuItem->xOffset, openMainMenuItem->yOffset); result = 0; } return result; } int fun_handleMenubarClick(struct C3Menu *menu, int numItems) { int result; // eax@2 if ( byte_660B94[0] ) { if ( menuClickedItem > 0 ) { dword_9D7B94 = window_id; window_id = 3; selectedSubMenuItemId = 0; openMainMenuItem = &menu[selectedMainMenuItemId - 1]; dword_5FFF58[0] = 1; window_redrawRequest = 1; result = 1; } else { result = 0; } } else { result = 0; } return result; } void sub_420130() { byte_660BFC[0] = 2; byte_65E6E8 = 1; window_id = dword_9D7B94; selectedSubMenuItemId = 0; selectedMainMenuItemId = 0; openMainMenuItem = 0; dword_5FFF58[0] = 1; window_redrawRequest = 1; } void fun_closeSubMenu() { selectedSubMenuItemId = 0; selectedMainMenuItemId = 0; openMainMenuItem = 0; dword_5FFF58[0] = 1; window_redrawRequest = 1; } signed int fun_isMenubarClick(struct C3Menu *menu, signed int numItems) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= numItems; ++i ) { if ( menu->xOffset <= mouseclick_x && menu->xEnd > mouseclick_x && menu->yOffset <= mouseclick_y && menu->yOffset + 12 > mouseclick_y ) return i; ++menu; } return 0; } signed int fun_isSubMenuClick(struct C3MenuItem *item, signed int numItems, int xOffset, int yOffset) { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i <= numItems; ++i ) { if ( xOffset <= mouseclick_x && xOffset + 160 > mouseclick_x && yOffset + item->yOffset + 30 <= mouseclick_y && yOffset + item->yOffset + 45 > mouseclick_y ) return i; ++item; } return 0; } int fun_handleCustomButtonClick(int xOffset, int yOffset, struct C3CustomButton *buttons, int numButtons) { int v4; // ecx@12 int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; ; ++i ) { if ( i >= numButtons ) return 0; if ( xOffset + buttons->xStart > mouseclick_x || xOffset + buttons->xEnd <= mouseclick_x || yOffset + buttons->yStart > mouseclick_y || yOffset + buttons->yEnd <= mouseclick_y ) goto LABEL_52; if ( buttons->type == 1 ) { if ( byte_660B94[0] || is_right_click || mouseInfo_buttonIsDown ) { buttons->field_11 = 1; currentButton_parameter = buttons->parameter; v4 = buttons->parameter2; currentButton_parameter2 = buttons->parameter2; if ( byte_660B94[0] || mouseInfo_buttonIsDown ) { buttons->mouseClickHandler(buttons, byte_660B94[0]); } else { if ( is_right_click ) buttons->rightClickHandler(v4, is_right_click); } return i + 1; } goto LABEL_52; } if ( buttons->type == 3 ) { if ( byte_65E6C8 || handleClick_isRightClick ) { buttons->field_11 = 1; currentButton_parameter = buttons->parameter; currentButton_parameter2 = buttons->parameter2; if ( byte_65E6C8 ) { ((void (__thiscall *)(_DWORD))buttons->mouseClickHandler)(byte_65E6C8); } else { //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! if ( handleClick_isRightClick ) // buttons->rightClickHandler(); buttons->rightClickHandler(0, 0); } return i + 1; } goto LABEL_52; } if ( buttons->type != 2 ) { if ( buttons->type == 4 && (byte_660B94[0] || mouseInfo_buttonIsDown) ) { buttons->field_11 = 1; currentButton_parameter = buttons->parameter; currentButton_parameter2 = buttons->parameter2; //buttons->mouseClickHandler(); buttons->mouseClickHandler(0, 0); return i + 1; } LABEL_52: ++buttons; continue; } if ( !mouse_isLeftClick && !byte_660B94[0] && !mouseInfo_buttonIsDown && !mouse_isRightClick && !is_right_click && !byte_660584 ) goto LABEL_52; if ( byte_660B94[0] || mouseInfo_buttonIsDown || is_right_click || byte_660584 ) break; if ( dword_6A1108 ) goto LABEL_42; } dword_6ADBEC = 0; LABEL_42: buttons->field_11 = 1; currentButton_parameter = buttons->parameter; currentButton_parameter2 = buttons->parameter2; if ( mouse_isLeftClick ) { ((void (__thiscall *)(_DWORD))buttons->mouseClickHandler)(mouse_isLeftClick); } else { if ( mouse_isRightClick ) //buttons->rightClickHandler(); buttons->rightClickHandler(0, 0); } return i + 1; } int fun_isCustomButtonClick(int xOffset, int yOffset, struct C3CustomButton *buttons, int numButtons) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < numButtons; ++i ) { if ( xOffset + buttons->xStart <= mouseclick_x && xOffset + buttons->xEnd > mouseclick_x && yOffset + buttons->yStart <= mouseclick_y && yOffset + buttons->yEnd > mouseclick_y ) { button_x = mouseclick_x; button_y = mouseclick_y; return i + 1; } ++buttons; } return 0; } void fun_showConfirmDialog(int msgId, void (*okFunc)(void), int numButtons) { confirmDialog_windowId = window_id; window_id = 63; confirmdialog_okClicked = 0; confirmDialog_x = screen_640x480_x + 80; confirmDialog_y = screen_640x480_y + 80; confirmDialog_okFunc = okFunc; confirmDialog_msg = msgId; confirmDialog_numButtons = numButtons; window_redrawRequest = 1; } void fun_handleConfirmDialogClick() { imagebuttons_redraw = 1; if ( !fun_handleImageButtonClick( confirmDialog_x, confirmDialog_y, &imagebuttons_confirmDialog, confirmDialog_numButtons) ) { if ( !confirmDialog_numButtons ) { if ( handleClick_isRightClick ) { confirmDialog_okFunc(); window_id = confirmDialog_windowId; window_redrawRequest = 1; } } } } void fun_confirmdialog_ok() { confirmdialog_okClicked = 1; confirmDialog_okFunc(); window_id = confirmDialog_windowId; window_redrawRequest = 1; } void fun_confirmdialog_cancel() { confirmdialog_okClicked = 0; confirmDialog_okFunc(); window_id = confirmDialog_windowId; window_redrawRequest = 1; } signed int unused_420960() { signed int result; // eax@2 if ( byte_65E6C8 ) { if ( fun_isMouseHit(dword_9D7B74, dword_9D7B98, 24, 24) ) { fun_redrawScreen_doNothing(); result = 1; } else { result = 0; } } else { result = 0; } return result; } signed int unused_4209C0(int a1, int a2) { signed int result; // eax@2 if ( byte_65E6C8 ) { if ( fun_isMouseHit(a1, a2, 24, 24) ) { fun_redrawScreen_doNothing(); result = 1; } else { result = 0; } } else { result = 0; } return result; } signed int fun_enableDirectDraw() { int v0; // esi@1 LONG v1; // eax@25 __int32 v2; // ST68_4@30 LONG v3; // ST18_4@30 bool v4; // ST14_4@30 LONG v5; // eax@30 HDC v7; // [sp+50h] [bp-38h]@1 struct tagRECT rc; // [sp+54h] [bp-34h]@30 RECT pvParam; // [sp+64h] [bp-24h]@30 int err; // [sp+74h] [bp-14h]@13 struct IDirectDraw *lpDD; // [sp+78h] [bp-10h]@13 int v12; // [sp+7Ch] [bp-Ch]@1 int Y; // [sp+80h] [bp-8h]@30 int X; // [sp+84h] [bp-4h]@30 v7 = GetDC(0); v12 = GetDeviceCaps(v7, 24); v0 = GetDeviceCaps(v7, 14); setting_start_bpp = GetDeviceCaps(v7, 12) * v0; if ( v12 == -1 ) setting_start_bpp = 16; ReleaseDC(0, v7); system_screen_width = GetSystemMetrics(0); system_screen_height = GetSystemMetrics(1); if ( screen_width >= system_screen_width ) { if ( !setting_fullscreen ) showWarning(57); // cannot set windows mode setting_fullscreen = 1; } if ( !setting_fullscreen ) { if ( setting_start_bpp != 16 ) { showWarning(57); fun_logDebugMessage("OK :DD 256 cols switching to full screen.", 0, 0); setting_fullscreen = 1; } } if ( setting_fullscreen ) GetPaletteEntries(0, 0, 0x100u, &pPalEntries); if ( ddraw_funcs ) { lpDD = ddraw_funcs; err = 0; } else { err = DirectDrawCreate(0, &lpDD, 0); } if ( !err ) { if ( !ddraw_funcs ) { if ( setting_fullscreen ) err = lpDD->SetCooperativeLevel( main_window, 0x13u); else err = lpDD->SetCooperativeLevel( main_window, 8); if ( err ) { fun_logDebugMessage("ERR:DD Not setCooperative Level :", 0, err); return 0; } fun_logDebugMessage("OK :DD SetCooperative Level.", 0, 0); } if ( setting_fullscreen ) { v1 = GetWindowLongA(main_window, -16); SetWindowLongA(main_window, -16, (v1 | 0x90000000) & 0xFF3BFFFF); err = lpDD->SetDisplayMode( ddraw_width, ddraw_height, 16); if ( err ) { fun_setResolution(2); fun_reallocateScreenBuffer(); fun_clearWarnings(); err = lpDD->SetDisplayMode( ddraw_width, ddraw_height, 16); if ( err ) { fun_setResolution(1); fun_reallocateScreenBuffer(); fun_clearWarnings(); err = lpDD->SetDisplayMode( ddraw_width, ddraw_height, 16); if ( err ) { fun_logDebugMessage("ERR:DD SetMode failed err :", 0, err); return 0; } } } fun_logDebugMessage("OK :DD Set resolution.", 0, 0); } else { v2 = (GetWindowLongA(main_window, -16) | 0xC70000) & 0x7FFFFFFF | 0x80000; SetWindowLongA(main_window, -16, v2); SetRect(&rc, 0, 0, ddraw_width, ddraw_height); v3 = GetWindowLongA(main_window, -20); v4 = GetMenu(main_window) != 0; v5 = GetWindowLongA(main_window, -16); AdjustWindowRectEx(&rc, v5, v4, v3); windowedMode_xOffset = (system_screen_width - screen_width) / 2; X = windowedMode_xOffset; windowedMode_yOffset = (system_screen_height - screen_height) / 2; Y = windowedMode_yOffset; SetWindowPos(main_window, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top, 0x16u); SetWindowPos(main_window, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x13u); SystemParametersInfoA(0x30u, 0, &pvParam, 0); GetWindowRect(main_window, &rc); if ( rc.left < pvParam.left ) rc.left = pvParam.left; if ( rc.top < pvParam.top ) rc.top = pvParam.top; SetWindowPos(main_window, 0, X, Y, 0, 0, 0x15u); fun_logDebugMessage("OK :DD Kept resolution.", 0, 0); } ddraw_funcs = lpDD; return 1; } fun_logDebugMessage("ERR:DD Enable error level:", 0, err); return 0; } signed int fun_disableDirectDraw(int release) { if ( ddraw_clipper ) { ddraw_clipper->Release(); ddraw_clipper = 0; } if ( ddraw_backSurface ) { ddraw_backSurface->Release(); ddraw_backSurface = 0; } if ( ddraw_surface ) { ddraw_surface->Release(); ddraw_surface = 0; } ddraw_buffer = 0; if ( release ) { if ( ddraw_funcs ) { ddraw_funcs->Release(); ddraw_funcs = 0; fun_logDebugMessage("OK :DD Released.", 0, 0); } } return 1; } signed int fun_directDrawClearFill() { int v1; // [sp+4Ch] [bp-68h]@7 DDBLTFX v2; // [sp+50h] [bp-64h]@1 UpdateWindow(main_window); v2.dwSize = 100; v2.dwFillColor = 0; if ( setting_fullscreen ) { if( ddraw_backSurface->Blt( 0, 0, 0, 0x1000400u, &v2) ) { fun_logDebugMessage("ERR:DD Clearing Fill failed no:", 0, 1); return 0; } if ( ddraw_surface->Blt( 0, 0, 0, 0x1000400u, &v2) ) { fun_logDebugMessage("ERR:DD Clearing Fill failed no:", 0, 2); return 0; } } else { v1 = ddraw_surface->Blt( &ddraw_rect, 0, 0, 0x1000400u, &v2); if ( v1 ) { fun_logDebugMessage("ERR:DD Clearing(W) Fill failed ddrval:", 0, v1); return 0; } } return 1; } signed int fun_directDrawCreateSurface() { int v1; // eax@6 int v2; // eax@16 int v3; // [sp+4Ch] [bp-74h]@4 int v4; // [sp+4Ch] [bp-74h]@14 int v5; // [sp+50h] [bp-70h]@2 int v6; // [sp+50h] [bp-70h]@12 DDSURFACEDESC Dst; // [sp+54h] [bp-6Ch]@1 memset(&Dst, 0, 0x6Cu); Dst.dwSize = 108; if ( setting_fullscreen ) { fun_logDebugMessage("OK :DD Creating one Vram only.", 0, 0); Dst.dwFlags = 1; Dst.ddsCaps.dwCaps = 512; v5 = ddraw_funcs->CreateSurface( &Dst, &ddraw_surface, 0); if ( v5 ) { fun_logDebugMessage("ERR:DD CreateSurface failed2:", 0, v5); return 0; } ddraw_busy = 0; memset(&Dst, 0, 0x6Cu); Dst.dwSize = 108; v3 = ddraw_surface->Lock( 0, &Dst, 1, 0); if ( v3 ) { v1 = fun_translateDDrawSurfaceLockError(v3); fun_logDebugMessage("ERR:DD surface lock error:", 0, v1 + 1); } else { fun_logDebugMessage("OK :DD can lock primary surface ", 0, 0); ddraw_busy = 0; ddraw_surface->Unlock(0); } ddraw_backSurface = fun_directDrawCreateExtraSurface(ddraw_width, ddraw_height, 1); if ( !ddraw_backSurface ) { fun_logDebugMessage("ERR:DD Cant create(W) backbuffer1.", 0, 0); return 0; } if ( !ddraw_backSurface->Lock( 0, &Dst, 1, 0) ) { ddraw_buffer = (__int16 *)Dst.lpSurface; ddraw_backSurface->Unlock(0); } fun_logDebugMessage("OK :DD Surface created.", 0, 0); } else { fun_logDebugMessage("OK :DD Creating one Vram and one system surface.", 0, 0); Dst.dwFlags = 1; Dst.ddsCaps.dwCaps = 512; v6 = ddraw_funcs->CreateSurface( &Dst, &ddraw_surface, 0); if ( v6 ) { fun_logDebugMessage("ERR:DD CreateSurface failed3:", 0, v6); return 0; } ddraw_busy = 0; memset(&Dst, 0, 0x6Cu); Dst.dwSize = 108; v4 = ddraw_surface->Lock( 0, &Dst, 1, 0); if ( v4 ) { v2 = fun_translateDDrawSurfaceLockError(v4); fun_logDebugMessage("ERR:DD surface lock error:", 0, v2 + 1); } else { fun_logDebugMessage("OK :DD can lock primary surface ", 0, 0); ddraw_busy = 0; ddraw_surface->Unlock(0); } ddraw_backSurface = fun_directDrawCreateExtraSurface(ddraw_width, ddraw_height, 1); if ( !ddraw_backSurface ) { fun_logDebugMessage("ERR:DD Cant create(W) backbuffer1.", 0, 0); return 0; } if ( !ddraw_backSurface->Lock( 0, &Dst, 1, 0) ) { ddraw_buffer = (__int16 *)Dst.lpSurface; ddraw_backSurface->Unlock(0); } if ( ddraw_funcs->CreateClipper( 0, &ddraw_clipper, 0) ) { fun_logDebugMessage("ERR:DD Cant create clipper.", 0, 0); return 0; } if ( ddraw_clipper->SetHWnd( 0, main_window) ) { fun_logDebugMessage("ERR:DD Cant set clipper window handle.", 0, 0); return 0; } if ( ddraw_surface->SetClipper( ddraw_clipper) ) { fun_logDebugMessage("ERR:DD Cant attach clipper to front buffer.", 0, 0); return 0; } fun_logDebugMessage("OK :DD Surfaces created and clipper attached.", 0, 0); } Dst.dwSize = 108; Dst.ddpfPixelFormat.dwSize = 32; Dst.dwFlags = 4096; ddraw_surface->GetSurfaceDesc( &Dst); if ( Dst.ddpfPixelFormat.dwRBitMask == 0xFC00 ) { graphics_format_hex = 0x655u; graphics_format_id = 3; } else { if ( Dst.ddpfPixelFormat.dwGBitMask == 0x7E0 ) { graphics_format_hex = 0x565u; graphics_format_id = 2; } else { if ( Dst.ddpfPixelFormat.dwBBitMask == 0x3F ) { graphics_format_hex = 0x556u; graphics_format_id = 1; } else { graphics_format_hex = 0x555u; graphics_format_id = 0; } } } if ( graphics_format_hex == 0x655 ) fun_logDebugMessage("OK :DD surface_format is RGB 655.", 0, 0); if ( graphics_format_hex == 0x565 ) fun_logDebugMessage("OK :DD surface_format is RGB 565.", 0, 0); if ( graphics_format_hex == 0x556 ) fun_logDebugMessage("OK :DD surface_format is RGB 556.", 0, 0); if ( graphics_format_hex == 0x555 ) fun_logDebugMessage("OK :DD surface_format is RGB 555.", 0, 0); if ( graphics_format_id == 1 || graphics_format_id == 3 ) { fun_logDebugMessage("ERR:DD unsupported RGB format, trying RGB565 format", 0, 0); graphics_format_hex = 0x565u; graphics_format_id = 2; } return 1; } LPDIRECTDRAWSURFACE fun_directDrawCreateExtraSurface(DWORD width, DWORD height, int a3) { DWORD v3; // ecx@2 LPDIRECTDRAWSURFACE surface; // [sp+4Ch] [bp-74h]@3 int v6; // [sp+50h] [bp-70h]@3 DDSURFACEDESC Dst; // [sp+54h] [bp-6Ch]@1 memset(&Dst, 0, 0x6Cu); Dst.dwSize = 108; Dst.dwFlags = 7; Dst.ddsCaps.dwCaps = 64; if ( a3 ) { v3 = Dst.ddsCaps.dwCaps; v3 |= 8u; Dst.ddsCaps.dwCaps = v3; } Dst.dwHeight = height; Dst.dwWidth = width; v6 = ddraw_funcs->CreateSurface( &Dst, &surface, 0); if ( v6 ) { fun_logDebugMessage("ERR:DD ExtraSurface failed.", 0, 0); surface = 0; } return surface; } signed int fun_translateDDrawSurfaceLockError(int a1) { signed int result; // eax@2 switch ( a1 ) { case 0x88760005: result = 1; break; case 0x8876000A: result = 2; break; case 0x88760014: result = 3; break; case 0x88760028: result = 4; break; case 0x88760037: result = 5; break; case 0x80004005: result = 6; break; case 0x8876005A: result = 7; break; case 0x8876005F: result = 8; break; case 0x88760064: result = 9; break; case 0x8876006E: result = 10; break; case 0x88760078: result = 11; break; case 0x88760082: result = 12; break; case 0x80070057: result = 13; break; case 0x88760091: result = 14; break; case 0x88760096: result = 15; break; case 0x887600A0: result = 16; break; case 0x887600AA: result = 17; break; case 0x887600B4: result = 18; break; case 0x887600CD: result = 19; break; case 0x887600D2: result = 20; break; case 0x887600D4: result = 21; break; case 0x887600D7: result = 22; break; case 0x887600DC: result = 23; break; case 0x887600DE: result = 24; break; case 0x887600E1: result = 25; break; case 0x887600E6: result = 26; break; case 0x887600F0: result = 27; break; case 0x887600FA: result = 28; break; case 0x887600FF: result = 29; break; case 0x88760104: result = 30; break; case 0x88760118: result = 31; break; case 0x88760122: result = 32; break; case 0x88760136: result = 33; break; case 0x8876013C: result = 34; break; case 0x8876013D: result = 35; break; case 0x88760140: result = 36; break; case 0x8876014A: result = 37; break; case 0x8876014F: result = 38; break; case 0x88760154: result = 39; break; case 0x8876015E: result = 40; break; case 0x88760168: result = 41; break; case 0x8007000E: result = 42; break; case 0x8876017C: result = 43; break; case 0x8876017E: result = 44; break; case 0x88760180: result = 45; break; case 0x88760183: result = 46; break; case 0x88760190: result = 47; break; case 0x8876019A: result = 48; break; case 0x887601A4: result = 49; break; case 0x887601AE: result = 50; break; case 0x887601B3: result = 51; break; case 0x887601B8: result = 52; break; case 0x887601C2: result = 53; break; case 0x887601CC: result = 54; break; case 0x887601D6: result = 55; break; case 0x887601E0: result = 56; break; case 0x887601EA: result = 57; break; case 0x80004001: result = 58; break; case 0x887601FE: result = 59; break; case 0x88760208: result = 60; break; case 0x88760219: result = 61; break; case 0x8876021C: result = 62; break; case 0x88760230: result = 63; break; case 0x88760231: result = 64; break; case 0x88760232: result = 65; break; case 0x88760233: result = 66; break; case 0x88760234: result = 67; break; case 0x88760235: result = 68; break; case 0x88760236: result = 69; break; case 0x88760237: result = 70; break; case 0x88760238: result = 71; break; case 0x88760239: result = 72; break; case 0x8876023A: result = 73; break; case 0x8876023B: result = 74; break; case 0x8876023C: result = 75; break; case 0x8876023D: result = 76; break; case 0x8876023E: result = 77; break; case 0x8876023F: result = 78; break; case 0x88760240: result = 79; break; case 0x88760241: result = 80; break; case 0x88760242: result = 81; break; case 0x88760243: result = 82; break; case 0x88760244: result = 83; break; case 0x88760245: result = 84; break; case 0x88760246: result = 85; break; case 0x88760247: result = 86; break; case 0x88760248: result = 87; break; case 0x88760249: result = 88; break; case 0x8876024A: result = 89; break; case 0x8876024B: result = 90; break; case 0x8876024C: result = 91; break; case 0x8876024D: result = 92; break; case 0x8876024E: result = 93; break; case 0x8876024F: result = 94; break; case 0x88760250: result = 95; break; case 0x8876026C: result = 96; break; case 0x88760280: result = 97; break; case 0x88760294: result = 98; break; case 0x887602A8: result = 99; break; default: result = 100; break; } return result; } void fun_drawBuildingFootprint_xFull(int *data, int clipYcode) { int v2; // edx@3 int scanline; // ecx@3 char *v4; // edi@3 int v5; // edx@6 int v6; // edx@6 int v7; // edx@6 int v8; // edx@6 int v9; // edx@6 int v10; // edx@6 int v11; // edx@6 int v12; // edx@6 int v13; // edx@6 int v14; // edx@6 int v15; // edx@6 int v16; // edx@6 int v17; // edx@6 if ( drawGraphic_colorMask ) { fun_drawBuildingFootprint_xFull_colored(data, clipYcode); } else { v4 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = 0; scanline = ddraw_scanline; if ( clipYcode == 3 || (*((_DWORD *)v4 + 14) = *data, *(_DWORD *)&v4[scanline + 52] = data[1], *(_DWORD *)&v4[scanline + 56] = data[2], *(_DWORD *)&v4[scanline + 60] = data[3], *(_DWORD *)&v4[2 * scanline + 48] = data[4], *(_DWORD *)&v4[2 * scanline + 52] = data[5], *(_DWORD *)&v4[2 * scanline + 56] = data[6], *(_DWORD *)&v4[2 * scanline + 60] = data[7], *(_DWORD *)&v4[2 * scanline + 64] = data[8], *(_DWORD *)&v4[3 * scanline + 44] = data[9], *(_DWORD *)&v4[3 * scanline + 48] = data[10], *(_DWORD *)&v4[3 * scanline + 52] = data[11], *(_DWORD *)&v4[3 * scanline + 56] = data[12], *(_DWORD *)&v4[3 * scanline + 60] = data[13], *(_DWORD *)&v4[3 * scanline + 64] = data[14], *(_DWORD *)&v4[3 * scanline + 68] = data[15], *(_DWORD *)&v4[4 * scanline + 40] = data[16], *(_DWORD *)&v4[4 * scanline + 44] = data[17], *(_DWORD *)&v4[4 * scanline + 48] = data[18], *(_DWORD *)&v4[4 * scanline + 52] = data[19], *(_DWORD *)&v4[4 * scanline + 56] = data[20], *(_DWORD *)&v4[4 * scanline + 60] = data[21], *(_DWORD *)&v4[4 * scanline + 64] = data[22], *(_DWORD *)&v4[4 * scanline + 68] = data[23], *(_DWORD *)&v4[4 * scanline + 72] = data[24], *(_DWORD *)&v4[5 * scanline + 36] = data[25], *(_DWORD *)&v4[5 * scanline + 40] = data[26], *(_DWORD *)&v4[5 * scanline + 44] = data[27], *(_DWORD *)&v4[5 * scanline + 48] = data[28], *(_DWORD *)&v4[5 * scanline + 52] = data[29], *(_DWORD *)&v4[5 * scanline + 56] = data[30], *(_DWORD *)&v4[5 * scanline + 60] = data[31], *(_DWORD *)&v4[5 * scanline + 64] = data[32], *(_DWORD *)&v4[5 * scanline + 68] = data[33], *(_DWORD *)&v4[5 * scanline + 72] = data[34], *(_DWORD *)&v4[5 * scanline + 76] = data[35], *(_DWORD *)&v4[6 * scanline + 32] = data[36], *(_DWORD *)&v4[6 * scanline + 36] = data[37], *(_DWORD *)&v4[6 * scanline + 40] = data[38], *(_DWORD *)&v4[6 * scanline + 44] = data[39], *(_DWORD *)&v4[6 * scanline + 48] = data[40], *(_DWORD *)&v4[6 * scanline + 52] = data[41], *(_DWORD *)&v4[6 * scanline + 56] = data[42], *(_DWORD *)&v4[6 * scanline + 60] = data[43], *(_DWORD *)&v4[6 * scanline + 64] = data[44], *(_DWORD *)&v4[6 * scanline + 68] = data[45], *(_DWORD *)&v4[6 * scanline + 72] = data[46], *(_DWORD *)&v4[6 * scanline + 76] = data[47], *(_DWORD *)&v4[6 * scanline + 80] = data[48], *(_DWORD *)&v4[7 * scanline + 28] = data[49], *(_DWORD *)&v4[7 * scanline + 32] = data[50], *(_DWORD *)&v4[7 * scanline + 36] = data[51], *(_DWORD *)&v4[7 * scanline + 40] = data[52], *(_DWORD *)&v4[7 * scanline + 44] = data[53], *(_DWORD *)&v4[7 * scanline + 48] = data[54], *(_DWORD *)&v4[7 * scanline + 52] = data[55], *(_DWORD *)&v4[7 * scanline + 56] = data[56], *(_DWORD *)&v4[7 * scanline + 60] = data[57], *(_DWORD *)&v4[7 * scanline + 64] = data[58], *(_DWORD *)&v4[7 * scanline + 68] = data[59], *(_DWORD *)&v4[7 * scanline + 72] = data[60], *(_DWORD *)&v4[7 * scanline + 76] = data[61], *(_DWORD *)&v4[7 * scanline + 80] = data[62], *(_DWORD *)&v4[7 * scanline + 84] = data[63], *(_DWORD *)&v4[8 * scanline + 24] = data[64], *(_DWORD *)&v4[8 * scanline + 28] = data[65], *(_DWORD *)&v4[8 * scanline + 32] = data[66], *(_DWORD *)&v4[8 * scanline + 36] = data[67], *(_DWORD *)&v4[8 * scanline + 40] = data[68], *(_DWORD *)&v4[8 * scanline + 44] = data[69], *(_DWORD *)&v4[8 * scanline + 48] = data[70], *(_DWORD *)&v4[8 * scanline + 52] = data[71], *(_DWORD *)&v4[8 * scanline + 56] = data[72], *(_DWORD *)&v4[8 * scanline + 60] = data[73], *(_DWORD *)&v4[8 * scanline + 64] = data[74], *(_DWORD *)&v4[8 * scanline + 68] = data[75], *(_DWORD *)&v4[8 * scanline + 72] = data[76], *(_DWORD *)&v4[8 * scanline + 76] = data[77], *(_DWORD *)&v4[8 * scanline + 80] = data[78], *(_DWORD *)&v4[8 * scanline + 84] = data[79], *(_DWORD *)&v4[8 * scanline + 88] = data[80], *(_DWORD *)&v4[9 * scanline + 20] = data[81], *(_DWORD *)&v4[9 * scanline + 24] = data[82], *(_DWORD *)&v4[9 * scanline + 28] = data[83], *(_DWORD *)&v4[9 * scanline + 32] = data[84], *(_DWORD *)&v4[9 * scanline + 36] = data[85], *(_DWORD *)&v4[9 * scanline + 40] = data[86], *(_DWORD *)&v4[9 * scanline + 44] = data[87], *(_DWORD *)&v4[9 * scanline + 48] = data[88], *(_DWORD *)&v4[9 * scanline + 52] = data[89], *(_DWORD *)&v4[9 * scanline + 56] = data[90], *(_DWORD *)&v4[9 * scanline + 60] = data[91], *(_DWORD *)&v4[9 * scanline + 64] = data[92], *(_DWORD *)&v4[9 * scanline + 68] = data[93], *(_DWORD *)&v4[9 * scanline + 72] = data[94], *(_DWORD *)&v4[9 * scanline + 76] = data[95], *(_DWORD *)&v4[9 * scanline + 80] = data[96], *(_DWORD *)&v4[9 * scanline + 84] = data[97], *(_DWORD *)&v4[9 * scanline + 88] = data[98], *(_DWORD *)&v4[9 * scanline + 92] = data[99], *(_DWORD *)&v4[10 * scanline + 16] = data[100], *(_DWORD *)&v4[10 * scanline + 20] = data[101], *(_DWORD *)&v4[10 * scanline + 24] = data[102], *(_DWORD *)&v4[10 * scanline + 28] = data[103], *(_DWORD *)&v4[10 * scanline + 32] = data[104], *(_DWORD *)&v4[10 * scanline + 36] = data[105], *(_DWORD *)&v4[10 * scanline + 40] = data[106], *(_DWORD *)&v4[10 * scanline + 44] = data[107], *(_DWORD *)&v4[10 * scanline + 48] = data[108], *(_DWORD *)&v4[10 * scanline + 52] = data[109], *(_DWORD *)&v4[10 * scanline + 56] = data[110], *(_DWORD *)&v4[10 * scanline + 60] = data[111], *(_DWORD *)&v4[10 * scanline + 64] = data[112], *(_DWORD *)&v4[10 * scanline + 68] = data[113], *(_DWORD *)&v4[10 * scanline + 72] = data[114], *(_DWORD *)&v4[10 * scanline + 76] = data[115], *(_DWORD *)&v4[10 * scanline + 80] = data[116], *(_DWORD *)&v4[10 * scanline + 84] = data[117], *(_DWORD *)&v4[10 * scanline + 88] = data[118], *(_DWORD *)&v4[10 * scanline + 92] = data[119], *(_DWORD *)&v4[10 * scanline + 96] = data[120], *(_DWORD *)&v4[11 * scanline + 12] = data[121], *(_DWORD *)&v4[11 * scanline + 16] = data[122], *(_DWORD *)&v4[11 * scanline + 20] = data[123], *(_DWORD *)&v4[11 * scanline + 24] = data[124], *(_DWORD *)&v4[11 * scanline + 28] = data[125], *(_DWORD *)&v4[11 * scanline + 32] = data[126], *(_DWORD *)&v4[11 * scanline + 36] = data[127], *(_DWORD *)&v4[11 * scanline + 40] = data[128], *(_DWORD *)&v4[11 * scanline + 44] = data[129], *(_DWORD *)&v4[11 * scanline + 48] = data[130], *(_DWORD *)&v4[11 * scanline + 52] = data[131], *(_DWORD *)&v4[11 * scanline + 56] = data[132], *(_DWORD *)&v4[11 * scanline + 60] = data[133], *(_DWORD *)&v4[11 * scanline + 64] = data[134], *(_DWORD *)&v4[11 * scanline + 68] = data[135], *(_DWORD *)&v4[11 * scanline + 72] = data[136], *(_DWORD *)&v4[11 * scanline + 76] = data[137], *(_DWORD *)&v4[11 * scanline + 80] = data[138], *(_DWORD *)&v4[11 * scanline + 84] = data[139], *(_DWORD *)&v4[11 * scanline + 88] = data[140], *(_DWORD *)&v4[11 * scanline + 92] = data[141], *(_DWORD *)&v4[11 * scanline + 96] = data[142], *(_DWORD *)&v4[11 * scanline + 100] = data[143], *(_DWORD *)&v4[12 * scanline + 8] = data[144], *(_DWORD *)&v4[12 * scanline + 12] = data[145], *(_DWORD *)&v4[12 * scanline + 16] = data[146], *(_DWORD *)&v4[12 * scanline + 20] = data[147], *(_DWORD *)&v4[12 * scanline + 24] = data[148], *(_DWORD *)&v4[12 * scanline + 28] = data[149], *(_DWORD *)&v4[12 * scanline + 32] = data[150], *(_DWORD *)&v4[12 * scanline + 36] = data[151], *(_DWORD *)&v4[12 * scanline + 40] = data[152], *(_DWORD *)&v4[12 * scanline + 44] = data[153], *(_DWORD *)&v4[12 * scanline + 48] = data[154], *(_DWORD *)&v4[12 * scanline + 52] = data[155], *(_DWORD *)&v4[12 * scanline + 56] = data[156], *(_DWORD *)&v4[12 * scanline + 60] = data[157], *(_DWORD *)&v4[12 * scanline + 64] = data[158], *(_DWORD *)&v4[12 * scanline + 68] = data[159], *(_DWORD *)&v4[12 * scanline + 72] = data[160], *(_DWORD *)&v4[12 * scanline + 76] = data[161], *(_DWORD *)&v4[12 * scanline + 80] = data[162], *(_DWORD *)&v4[12 * scanline + 84] = data[163], *(_DWORD *)&v4[12 * scanline + 88] = data[164], *(_DWORD *)&v4[12 * scanline + 92] = data[165], *(_DWORD *)&v4[12 * scanline + 96] = data[166], *(_DWORD *)&v4[12 * scanline + 100] = data[167], *(_DWORD *)&v4[12 * scanline + 104] = data[168], *(_DWORD *)&v4[13 * scanline + 4] = data[169], *(_DWORD *)&v4[13 * scanline + 8] = data[170], *(_DWORD *)&v4[13 * scanline + 12] = data[171], *(_DWORD *)&v4[13 * scanline + 16] = data[172], *(_DWORD *)&v4[13 * scanline + 20] = data[173], *(_DWORD *)&v4[13 * scanline + 24] = data[174], *(_DWORD *)&v4[13 * scanline + 28] = data[175], *(_DWORD *)&v4[13 * scanline + 32] = data[176], *(_DWORD *)&v4[13 * scanline + 36] = data[177], *(_DWORD *)&v4[13 * scanline + 40] = data[178], *(_DWORD *)&v4[13 * scanline + 44] = data[179], *(_DWORD *)&v4[13 * scanline + 48] = data[180], *(_DWORD *)&v4[13 * scanline + 52] = data[181], *(_DWORD *)&v4[13 * scanline + 56] = data[182], *(_DWORD *)&v4[13 * scanline + 60] = data[183], *(_DWORD *)&v4[13 * scanline + 64] = data[184], *(_DWORD *)&v4[13 * scanline + 68] = data[185], *(_DWORD *)&v4[13 * scanline + 72] = data[186], *(_DWORD *)&v4[13 * scanline + 76] = data[187], *(_DWORD *)&v4[13 * scanline + 80] = data[188], *(_DWORD *)&v4[13 * scanline + 84] = data[189], *(_DWORD *)&v4[13 * scanline + 88] = data[190], *(_DWORD *)&v4[13 * scanline + 92] = data[191], *(_DWORD *)&v4[13 * scanline + 96] = data[192], *(_DWORD *)&v4[13 * scanline + 100] = data[193], *(_DWORD *)&v4[13 * scanline + 104] = data[194], *(_DWORD *)&v4[13 * scanline + 108] = data[195], *(_DWORD *)&v4[14 * scanline] = data[196], *(_DWORD *)&v4[14 * scanline + 4] = data[197], *(_DWORD *)&v4[14 * scanline + 8] = data[198], *(_DWORD *)&v4[14 * scanline + 12] = data[199], *(_DWORD *)&v4[14 * scanline + 16] = data[200], *(_DWORD *)&v4[14 * scanline + 20] = data[201], *(_DWORD *)&v4[14 * scanline + 24] = data[202], *(_DWORD *)&v4[14 * scanline + 28] = data[203], *(_DWORD *)&v4[14 * scanline + 32] = data[204], *(_DWORD *)&v4[14 * scanline + 36] = data[205], *(_DWORD *)&v4[14 * scanline + 40] = data[206], *(_DWORD *)&v4[14 * scanline + 44] = data[207], *(_DWORD *)&v4[14 * scanline + 48] = data[208], *(_DWORD *)&v4[14 * scanline + 52] = data[209], *(_DWORD *)&v4[14 * scanline + 56] = data[210], *(_DWORD *)&v4[14 * scanline + 60] = data[211], *(_DWORD *)&v4[14 * scanline + 64] = data[212], *(_DWORD *)&v4[14 * scanline + 68] = data[213], *(_DWORD *)&v4[14 * scanline + 72] = data[214], *(_DWORD *)&v4[14 * scanline + 76] = data[215], *(_DWORD *)&v4[14 * scanline + 80] = data[216], *(_DWORD *)&v4[14 * scanline + 84] = data[217], *(_DWORD *)&v4[14 * scanline + 88] = data[218], *(_DWORD *)&v4[14 * scanline + 92] = data[219], *(_DWORD *)&v4[14 * scanline + 96] = data[220], *(_DWORD *)&v4[14 * scanline + 100] = data[221], *(_DWORD *)&v4[14 * scanline + 104] = data[222], *(_DWORD *)&v4[14 * scanline + 108] = data[223], *(_DWORD *)&v4[14 * scanline + 112] = data[224], v2 = 15 * scanline, clipYcode != 4) ) { *(_DWORD *)&v4[v2] = data[225]; *(_DWORD *)&v4[v2 + 4] = data[226]; *(_DWORD *)&v4[v2 + 8] = data[227]; *(_DWORD *)&v4[v2 + 12] = data[228]; *(_DWORD *)&v4[v2 + 16] = data[229]; *(_DWORD *)&v4[v2 + 20] = data[230]; *(_DWORD *)&v4[v2 + 24] = data[231]; *(_DWORD *)&v4[v2 + 28] = data[232]; *(_DWORD *)&v4[v2 + 32] = data[233]; *(_DWORD *)&v4[v2 + 36] = data[234]; *(_DWORD *)&v4[v2 + 40] = data[235]; *(_DWORD *)&v4[v2 + 44] = data[236]; *(_DWORD *)&v4[v2 + 48] = data[237]; *(_DWORD *)&v4[v2 + 52] = data[238]; *(_DWORD *)&v4[v2 + 56] = data[239]; *(_DWORD *)&v4[v2 + 60] = data[240]; *(_DWORD *)&v4[v2 + 64] = data[241]; *(_DWORD *)&v4[v2 + 68] = data[242]; *(_DWORD *)&v4[v2 + 72] = data[243]; *(_DWORD *)&v4[v2 + 76] = data[244]; *(_DWORD *)&v4[v2 + 80] = data[245]; *(_DWORD *)&v4[v2 + 84] = data[246]; *(_DWORD *)&v4[v2 + 88] = data[247]; *(_DWORD *)&v4[v2 + 92] = data[248]; *(_DWORD *)&v4[v2 + 96] = data[249]; *(_DWORD *)&v4[v2 + 100] = data[250]; *(_DWORD *)&v4[v2 + 104] = data[251]; *(_DWORD *)&v4[v2 + 108] = data[252]; *(_DWORD *)&v4[v2 + 112] = data[253]; v5 = scanline + v2; *(_DWORD *)&v4[v5 + 4] = data[254]; *(_DWORD *)&v4[v5 + 8] = data[255]; *(_DWORD *)&v4[v5 + 12] = data[256]; *(_DWORD *)&v4[v5 + 16] = data[257]; *(_DWORD *)&v4[v5 + 20] = data[258]; *(_DWORD *)&v4[v5 + 24] = data[259]; *(_DWORD *)&v4[v5 + 28] = data[260]; *(_DWORD *)&v4[v5 + 32] = data[261]; *(_DWORD *)&v4[v5 + 36] = data[262]; *(_DWORD *)&v4[v5 + 40] = data[263]; *(_DWORD *)&v4[v5 + 44] = data[264]; *(_DWORD *)&v4[v5 + 48] = data[265]; *(_DWORD *)&v4[v5 + 52] = data[266]; *(_DWORD *)&v4[v5 + 56] = data[267]; *(_DWORD *)&v4[v5 + 60] = data[268]; *(_DWORD *)&v4[v5 + 64] = data[269]; *(_DWORD *)&v4[v5 + 68] = data[270]; *(_DWORD *)&v4[v5 + 72] = data[271]; *(_DWORD *)&v4[v5 + 76] = data[272]; *(_DWORD *)&v4[v5 + 80] = data[273]; *(_DWORD *)&v4[v5 + 84] = data[274]; *(_DWORD *)&v4[v5 + 88] = data[275]; *(_DWORD *)&v4[v5 + 92] = data[276]; *(_DWORD *)&v4[v5 + 96] = data[277]; *(_DWORD *)&v4[v5 + 100] = data[278]; *(_DWORD *)&v4[v5 + 104] = data[279]; *(_DWORD *)&v4[v5 + 108] = data[280]; v6 = scanline + v5; *(_DWORD *)&v4[v6 + 8] = data[281]; *(_DWORD *)&v4[v6 + 12] = data[282]; *(_DWORD *)&v4[v6 + 16] = data[283]; *(_DWORD *)&v4[v6 + 20] = data[284]; *(_DWORD *)&v4[v6 + 24] = data[285]; *(_DWORD *)&v4[v6 + 28] = data[286]; *(_DWORD *)&v4[v6 + 32] = data[287]; *(_DWORD *)&v4[v6 + 36] = data[288]; *(_DWORD *)&v4[v6 + 40] = data[289]; *(_DWORD *)&v4[v6 + 44] = data[290]; *(_DWORD *)&v4[v6 + 48] = data[291]; *(_DWORD *)&v4[v6 + 52] = data[292]; *(_DWORD *)&v4[v6 + 56] = data[293]; *(_DWORD *)&v4[v6 + 60] = data[294]; *(_DWORD *)&v4[v6 + 64] = data[295]; *(_DWORD *)&v4[v6 + 68] = data[296]; *(_DWORD *)&v4[v6 + 72] = data[297]; *(_DWORD *)&v4[v6 + 76] = data[298]; *(_DWORD *)&v4[v6 + 80] = data[299]; *(_DWORD *)&v4[v6 + 84] = data[300]; *(_DWORD *)&v4[v6 + 88] = data[301]; *(_DWORD *)&v4[v6 + 92] = data[302]; *(_DWORD *)&v4[v6 + 96] = data[303]; *(_DWORD *)&v4[v6 + 100] = data[304]; *(_DWORD *)&v4[v6 + 104] = data[305]; v7 = scanline + v6; *(_DWORD *)&v4[v7 + 12] = data[306]; *(_DWORD *)&v4[v7 + 16] = data[307]; *(_DWORD *)&v4[v7 + 20] = data[308]; *(_DWORD *)&v4[v7 + 24] = data[309]; *(_DWORD *)&v4[v7 + 28] = data[310]; *(_DWORD *)&v4[v7 + 32] = data[311]; *(_DWORD *)&v4[v7 + 36] = data[312]; *(_DWORD *)&v4[v7 + 40] = data[313]; *(_DWORD *)&v4[v7 + 44] = data[314]; *(_DWORD *)&v4[v7 + 48] = data[315]; *(_DWORD *)&v4[v7 + 52] = data[316]; *(_DWORD *)&v4[v7 + 56] = data[317]; *(_DWORD *)&v4[v7 + 60] = data[318]; *(_DWORD *)&v4[v7 + 64] = data[319]; *(_DWORD *)&v4[v7 + 68] = data[320]; *(_DWORD *)&v4[v7 + 72] = data[321]; *(_DWORD *)&v4[v7 + 76] = data[322]; *(_DWORD *)&v4[v7 + 80] = data[323]; *(_DWORD *)&v4[v7 + 84] = data[324]; *(_DWORD *)&v4[v7 + 88] = data[325]; *(_DWORD *)&v4[v7 + 92] = data[326]; *(_DWORD *)&v4[v7 + 96] = data[327]; *(_DWORD *)&v4[v7 + 100] = data[328]; v8 = scanline + v7; *(_DWORD *)&v4[v8 + 16] = data[329]; *(_DWORD *)&v4[v8 + 20] = data[330]; *(_DWORD *)&v4[v8 + 24] = data[331]; *(_DWORD *)&v4[v8 + 28] = data[332]; *(_DWORD *)&v4[v8 + 32] = data[333]; *(_DWORD *)&v4[v8 + 36] = data[334]; *(_DWORD *)&v4[v8 + 40] = data[335]; *(_DWORD *)&v4[v8 + 44] = data[336]; *(_DWORD *)&v4[v8 + 48] = data[337]; *(_DWORD *)&v4[v8 + 52] = data[338]; *(_DWORD *)&v4[v8 + 56] = data[339]; *(_DWORD *)&v4[v8 + 60] = data[340]; *(_DWORD *)&v4[v8 + 64] = data[341]; *(_DWORD *)&v4[v8 + 68] = data[342]; *(_DWORD *)&v4[v8 + 72] = data[343]; *(_DWORD *)&v4[v8 + 76] = data[344]; *(_DWORD *)&v4[v8 + 80] = data[345]; *(_DWORD *)&v4[v8 + 84] = data[346]; *(_DWORD *)&v4[v8 + 88] = data[347]; *(_DWORD *)&v4[v8 + 92] = data[348]; *(_DWORD *)&v4[v8 + 96] = data[349]; v9 = scanline + v8; *(_DWORD *)&v4[v9 + 20] = data[350]; *(_DWORD *)&v4[v9 + 24] = data[351]; *(_DWORD *)&v4[v9 + 28] = data[352]; *(_DWORD *)&v4[v9 + 32] = data[353]; *(_DWORD *)&v4[v9 + 36] = data[354]; *(_DWORD *)&v4[v9 + 40] = data[355]; *(_DWORD *)&v4[v9 + 44] = data[356]; *(_DWORD *)&v4[v9 + 48] = data[357]; *(_DWORD *)&v4[v9 + 52] = data[358]; *(_DWORD *)&v4[v9 + 56] = data[359]; *(_DWORD *)&v4[v9 + 60] = data[360]; *(_DWORD *)&v4[v9 + 64] = data[361]; *(_DWORD *)&v4[v9 + 68] = data[362]; *(_DWORD *)&v4[v9 + 72] = data[363]; *(_DWORD *)&v4[v9 + 76] = data[364]; *(_DWORD *)&v4[v9 + 80] = data[365]; *(_DWORD *)&v4[v9 + 84] = data[366]; *(_DWORD *)&v4[v9 + 88] = data[367]; *(_DWORD *)&v4[v9 + 92] = data[368]; v10 = scanline + v9; *(_DWORD *)&v4[v10 + 24] = data[369]; *(_DWORD *)&v4[v10 + 28] = data[370]; *(_DWORD *)&v4[v10 + 32] = data[371]; *(_DWORD *)&v4[v10 + 36] = data[372]; *(_DWORD *)&v4[v10 + 40] = data[373]; *(_DWORD *)&v4[v10 + 44] = data[374]; *(_DWORD *)&v4[v10 + 48] = data[375]; *(_DWORD *)&v4[v10 + 52] = data[376]; *(_DWORD *)&v4[v10 + 56] = data[377]; *(_DWORD *)&v4[v10 + 60] = data[378]; *(_DWORD *)&v4[v10 + 64] = data[379]; *(_DWORD *)&v4[v10 + 68] = data[380]; *(_DWORD *)&v4[v10 + 72] = data[381]; *(_DWORD *)&v4[v10 + 76] = data[382]; *(_DWORD *)&v4[v10 + 80] = data[383]; *(_DWORD *)&v4[v10 + 84] = data[384]; *(_DWORD *)&v4[v10 + 88] = data[385]; v11 = scanline + v10; *(_DWORD *)&v4[v11 + 28] = data[386]; *(_DWORD *)&v4[v11 + 32] = data[387]; *(_DWORD *)&v4[v11 + 36] = data[388]; *(_DWORD *)&v4[v11 + 40] = data[389]; *(_DWORD *)&v4[v11 + 44] = data[390]; *(_DWORD *)&v4[v11 + 48] = data[391]; *(_DWORD *)&v4[v11 + 52] = data[392]; *(_DWORD *)&v4[v11 + 56] = data[393]; *(_DWORD *)&v4[v11 + 60] = data[394]; *(_DWORD *)&v4[v11 + 64] = data[395]; *(_DWORD *)&v4[v11 + 68] = data[396]; *(_DWORD *)&v4[v11 + 72] = data[397]; *(_DWORD *)&v4[v11 + 76] = data[398]; *(_DWORD *)&v4[v11 + 80] = data[399]; *(_DWORD *)&v4[v11 + 84] = data[400]; v12 = scanline + v11; *(_DWORD *)&v4[v12 + 32] = data[401]; *(_DWORD *)&v4[v12 + 36] = data[402]; *(_DWORD *)&v4[v12 + 40] = data[403]; *(_DWORD *)&v4[v12 + 44] = data[404]; *(_DWORD *)&v4[v12 + 48] = data[405]; *(_DWORD *)&v4[v12 + 52] = data[406]; *(_DWORD *)&v4[v12 + 56] = data[407]; *(_DWORD *)&v4[v12 + 60] = data[408]; *(_DWORD *)&v4[v12 + 64] = data[409]; *(_DWORD *)&v4[v12 + 68] = data[410]; *(_DWORD *)&v4[v12 + 72] = data[411]; *(_DWORD *)&v4[v12 + 76] = data[412]; *(_DWORD *)&v4[v12 + 80] = data[413]; v13 = scanline + v12; *(_DWORD *)&v4[v13 + 36] = data[414]; *(_DWORD *)&v4[v13 + 40] = data[415]; *(_DWORD *)&v4[v13 + 44] = data[416]; *(_DWORD *)&v4[v13 + 48] = data[417]; *(_DWORD *)&v4[v13 + 52] = data[418]; *(_DWORD *)&v4[v13 + 56] = data[419]; *(_DWORD *)&v4[v13 + 60] = data[420]; *(_DWORD *)&v4[v13 + 64] = data[421]; *(_DWORD *)&v4[v13 + 68] = data[422]; *(_DWORD *)&v4[v13 + 72] = data[423]; *(_DWORD *)&v4[v13 + 76] = data[424]; v14 = scanline + v13; *(_DWORD *)&v4[v14 + 40] = data[425]; *(_DWORD *)&v4[v14 + 44] = data[426]; *(_DWORD *)&v4[v14 + 48] = data[427]; *(_DWORD *)&v4[v14 + 52] = data[428]; *(_DWORD *)&v4[v14 + 56] = data[429]; *(_DWORD *)&v4[v14 + 60] = data[430]; *(_DWORD *)&v4[v14 + 64] = data[431]; *(_DWORD *)&v4[v14 + 68] = data[432]; *(_DWORD *)&v4[v14 + 72] = data[433]; v15 = scanline + v14; *(_DWORD *)&v4[v15 + 44] = data[434]; *(_DWORD *)&v4[v15 + 48] = data[435]; *(_DWORD *)&v4[v15 + 52] = data[436]; *(_DWORD *)&v4[v15 + 56] = data[437]; *(_DWORD *)&v4[v15 + 60] = data[438]; *(_DWORD *)&v4[v15 + 64] = data[439]; *(_DWORD *)&v4[v15 + 68] = data[440]; v16 = scanline + v15; *(_DWORD *)&v4[v16 + 48] = data[441]; *(_DWORD *)&v4[v16 + 52] = data[442]; *(_DWORD *)&v4[v16 + 56] = data[443]; *(_DWORD *)&v4[v16 + 60] = data[444]; *(_DWORD *)&v4[v16 + 64] = data[445]; v17 = scanline + v16; *(_DWORD *)&v4[v17 + 52] = data[446]; *(_DWORD *)&v4[v17 + 56] = data[447]; *(_DWORD *)&v4[v17 + 60] = data[448]; *(_DWORD *)(&v4[v17 + 56] + scanline) = data[449]; } } } void fun_drawBuildingFootprint_xFull_colored(int *data, int clipYcode) { int v2; // edx@1 int v3; // ecx@1 int v4; // ebx@1 char *v5; // edi@1 int v6; // edx@4 int v7; // edx@4 int v8; // edx@4 int v9; // edx@4 int v10; // edx@4 int v11; // edx@4 int v12; // edx@4 int v13; // edx@4 int v14; // edx@4 int v15; // edx@4 int v16; // edx@4 int v17; // edx@4 int v18; // edx@4 v5 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v4 = (unsigned __int16)drawGraphic_colorMask << 16; v4 = (v4 & 0xffff0000 ) + drawGraphic_colorMask; v2 = 0; v3 = ddraw_scanline; if ( clipYcode == 3 || (*((_DWORD *)v5 + 14) = v4 & *data, *(_DWORD *)&v5[v3 + 52] = v4 & data[1], *(_DWORD *)&v5[v3 + 56] = v4 & data[2], *(_DWORD *)&v5[v3 + 60] = v4 & data[3], *(_DWORD *)&v5[2 * v3 + 48] = v4 & data[4], *(_DWORD *)&v5[2 * v3 + 52] = v4 & data[5], *(_DWORD *)&v5[2 * v3 + 56] = v4 & data[6], *(_DWORD *)&v5[2 * v3 + 60] = v4 & data[7], *(_DWORD *)&v5[2 * v3 + 64] = v4 & data[8], *(_DWORD *)&v5[3 * v3 + 44] = v4 & data[9], *(_DWORD *)&v5[3 * v3 + 48] = v4 & data[10], *(_DWORD *)&v5[3 * v3 + 52] = v4 & data[11], *(_DWORD *)&v5[3 * v3 + 56] = v4 & data[12], *(_DWORD *)&v5[3 * v3 + 60] = v4 & data[13], *(_DWORD *)&v5[3 * v3 + 64] = v4 & data[14], *(_DWORD *)&v5[3 * v3 + 68] = v4 & data[15], *(_DWORD *)&v5[4 * v3 + 40] = v4 & data[16], *(_DWORD *)&v5[4 * v3 + 44] = v4 & data[17], *(_DWORD *)&v5[4 * v3 + 48] = v4 & data[18], *(_DWORD *)&v5[4 * v3 + 52] = v4 & data[19], *(_DWORD *)&v5[4 * v3 + 56] = v4 & data[20], *(_DWORD *)&v5[4 * v3 + 60] = v4 & data[21], *(_DWORD *)&v5[4 * v3 + 64] = v4 & data[22], *(_DWORD *)&v5[4 * v3 + 68] = v4 & data[23], *(_DWORD *)&v5[4 * v3 + 72] = v4 & data[24], *(_DWORD *)&v5[5 * v3 + 36] = v4 & data[25], *(_DWORD *)&v5[5 * v3 + 40] = v4 & data[26], *(_DWORD *)&v5[5 * v3 + 44] = v4 & data[27], *(_DWORD *)&v5[5 * v3 + 48] = v4 & data[28], *(_DWORD *)&v5[5 * v3 + 52] = v4 & data[29], *(_DWORD *)&v5[5 * v3 + 56] = v4 & data[30], *(_DWORD *)&v5[5 * v3 + 60] = v4 & data[31], *(_DWORD *)&v5[5 * v3 + 64] = v4 & data[32], *(_DWORD *)&v5[5 * v3 + 68] = v4 & data[33], *(_DWORD *)&v5[5 * v3 + 72] = v4 & data[34], *(_DWORD *)&v5[5 * v3 + 76] = v4 & data[35], *(_DWORD *)&v5[6 * v3 + 32] = v4 & data[36], *(_DWORD *)&v5[6 * v3 + 36] = v4 & data[37], *(_DWORD *)&v5[6 * v3 + 40] = v4 & data[38], *(_DWORD *)&v5[6 * v3 + 44] = v4 & data[39], *(_DWORD *)&v5[6 * v3 + 48] = v4 & data[40], *(_DWORD *)&v5[6 * v3 + 52] = v4 & data[41], *(_DWORD *)&v5[6 * v3 + 56] = v4 & data[42], *(_DWORD *)&v5[6 * v3 + 60] = v4 & data[43], *(_DWORD *)&v5[6 * v3 + 64] = v4 & data[44], *(_DWORD *)&v5[6 * v3 + 68] = v4 & data[45], *(_DWORD *)&v5[6 * v3 + 72] = v4 & data[46], *(_DWORD *)&v5[6 * v3 + 76] = v4 & data[47], *(_DWORD *)&v5[6 * v3 + 80] = v4 & data[48], *(_DWORD *)&v5[7 * v3 + 28] = v4 & data[49], *(_DWORD *)&v5[7 * v3 + 32] = v4 & data[50], *(_DWORD *)&v5[7 * v3 + 36] = v4 & data[51], *(_DWORD *)&v5[7 * v3 + 40] = v4 & data[52], *(_DWORD *)&v5[7 * v3 + 44] = v4 & data[53], *(_DWORD *)&v5[7 * v3 + 48] = v4 & data[54], *(_DWORD *)&v5[7 * v3 + 52] = v4 & data[55], *(_DWORD *)&v5[7 * v3 + 56] = v4 & data[56], *(_DWORD *)&v5[7 * v3 + 60] = v4 & data[57], *(_DWORD *)&v5[7 * v3 + 64] = v4 & data[58], *(_DWORD *)&v5[7 * v3 + 68] = v4 & data[59], *(_DWORD *)&v5[7 * v3 + 72] = v4 & data[60], *(_DWORD *)&v5[7 * v3 + 76] = v4 & data[61], *(_DWORD *)&v5[7 * v3 + 80] = v4 & data[62], *(_DWORD *)&v5[7 * v3 + 84] = v4 & data[63], *(_DWORD *)&v5[8 * v3 + 24] = v4 & data[64], *(_DWORD *)&v5[8 * v3 + 28] = v4 & data[65], *(_DWORD *)&v5[8 * v3 + 32] = v4 & data[66], *(_DWORD *)&v5[8 * v3 + 36] = v4 & data[67], *(_DWORD *)&v5[8 * v3 + 40] = v4 & data[68], *(_DWORD *)&v5[8 * v3 + 44] = v4 & data[69], *(_DWORD *)&v5[8 * v3 + 48] = v4 & data[70], *(_DWORD *)&v5[8 * v3 + 52] = v4 & data[71], *(_DWORD *)&v5[8 * v3 + 56] = v4 & data[72], *(_DWORD *)&v5[8 * v3 + 60] = v4 & data[73], *(_DWORD *)&v5[8 * v3 + 64] = v4 & data[74], *(_DWORD *)&v5[8 * v3 + 68] = v4 & data[75], *(_DWORD *)&v5[8 * v3 + 72] = v4 & data[76], *(_DWORD *)&v5[8 * v3 + 76] = v4 & data[77], *(_DWORD *)&v5[8 * v3 + 80] = v4 & data[78], *(_DWORD *)&v5[8 * v3 + 84] = v4 & data[79], *(_DWORD *)&v5[8 * v3 + 88] = v4 & data[80], *(_DWORD *)&v5[9 * v3 + 20] = v4 & data[81], *(_DWORD *)&v5[9 * v3 + 24] = v4 & data[82], *(_DWORD *)&v5[9 * v3 + 28] = v4 & data[83], *(_DWORD *)&v5[9 * v3 + 32] = v4 & data[84], *(_DWORD *)&v5[9 * v3 + 36] = v4 & data[85], *(_DWORD *)&v5[9 * v3 + 40] = v4 & data[86], *(_DWORD *)&v5[9 * v3 + 44] = v4 & data[87], *(_DWORD *)&v5[9 * v3 + 48] = v4 & data[88], *(_DWORD *)&v5[9 * v3 + 52] = v4 & data[89], *(_DWORD *)&v5[9 * v3 + 56] = v4 & data[90], *(_DWORD *)&v5[9 * v3 + 60] = v4 & data[91], *(_DWORD *)&v5[9 * v3 + 64] = v4 & data[92], *(_DWORD *)&v5[9 * v3 + 68] = v4 & data[93], *(_DWORD *)&v5[9 * v3 + 72] = v4 & data[94], *(_DWORD *)&v5[9 * v3 + 76] = v4 & data[95], *(_DWORD *)&v5[9 * v3 + 80] = v4 & data[96], *(_DWORD *)&v5[9 * v3 + 84] = v4 & data[97], *(_DWORD *)&v5[9 * v3 + 88] = v4 & data[98], *(_DWORD *)&v5[9 * v3 + 92] = v4 & data[99], *(_DWORD *)&v5[10 * v3 + 16] = v4 & data[100], *(_DWORD *)&v5[10 * v3 + 20] = v4 & data[101], *(_DWORD *)&v5[10 * v3 + 24] = v4 & data[102], *(_DWORD *)&v5[10 * v3 + 28] = v4 & data[103], *(_DWORD *)&v5[10 * v3 + 32] = v4 & data[104], *(_DWORD *)&v5[10 * v3 + 36] = v4 & data[105], *(_DWORD *)&v5[10 * v3 + 40] = v4 & data[106], *(_DWORD *)&v5[10 * v3 + 44] = v4 & data[107], *(_DWORD *)&v5[10 * v3 + 48] = v4 & data[108], *(_DWORD *)&v5[10 * v3 + 52] = v4 & data[109], *(_DWORD *)&v5[10 * v3 + 56] = v4 & data[110], *(_DWORD *)&v5[10 * v3 + 60] = v4 & data[111], *(_DWORD *)&v5[10 * v3 + 64] = v4 & data[112], *(_DWORD *)&v5[10 * v3 + 68] = v4 & data[113], *(_DWORD *)&v5[10 * v3 + 72] = v4 & data[114], *(_DWORD *)&v5[10 * v3 + 76] = v4 & data[115], *(_DWORD *)&v5[10 * v3 + 80] = v4 & data[116], *(_DWORD *)&v5[10 * v3 + 84] = v4 & data[117], *(_DWORD *)&v5[10 * v3 + 88] = v4 & data[118], *(_DWORD *)&v5[10 * v3 + 92] = v4 & data[119], *(_DWORD *)&v5[10 * v3 + 96] = v4 & data[120], *(_DWORD *)&v5[11 * v3 + 12] = v4 & data[121], *(_DWORD *)&v5[11 * v3 + 16] = v4 & data[122], *(_DWORD *)&v5[11 * v3 + 20] = v4 & data[123], *(_DWORD *)&v5[11 * v3 + 24] = v4 & data[124], *(_DWORD *)&v5[11 * v3 + 28] = v4 & data[125], *(_DWORD *)&v5[11 * v3 + 32] = v4 & data[126], *(_DWORD *)&v5[11 * v3 + 36] = v4 & data[127], *(_DWORD *)&v5[11 * v3 + 40] = v4 & data[128], *(_DWORD *)&v5[11 * v3 + 44] = v4 & data[129], *(_DWORD *)&v5[11 * v3 + 48] = v4 & data[130], *(_DWORD *)&v5[11 * v3 + 52] = v4 & data[131], *(_DWORD *)&v5[11 * v3 + 56] = v4 & data[132], *(_DWORD *)&v5[11 * v3 + 60] = v4 & data[133], *(_DWORD *)&v5[11 * v3 + 64] = v4 & data[134], *(_DWORD *)&v5[11 * v3 + 68] = v4 & data[135], *(_DWORD *)&v5[11 * v3 + 72] = v4 & data[136], *(_DWORD *)&v5[11 * v3 + 76] = v4 & data[137], *(_DWORD *)&v5[11 * v3 + 80] = v4 & data[138], *(_DWORD *)&v5[11 * v3 + 84] = v4 & data[139], *(_DWORD *)&v5[11 * v3 + 88] = v4 & data[140], *(_DWORD *)&v5[11 * v3 + 92] = v4 & data[141], *(_DWORD *)&v5[11 * v3 + 96] = v4 & data[142], *(_DWORD *)&v5[11 * v3 + 100] = v4 & data[143], *(_DWORD *)&v5[12 * v3 + 8] = v4 & data[144], *(_DWORD *)&v5[12 * v3 + 12] = v4 & data[145], *(_DWORD *)&v5[12 * v3 + 16] = v4 & data[146], *(_DWORD *)&v5[12 * v3 + 20] = v4 & data[147], *(_DWORD *)&v5[12 * v3 + 24] = v4 & data[148], *(_DWORD *)&v5[12 * v3 + 28] = v4 & data[149], *(_DWORD *)&v5[12 * v3 + 32] = v4 & data[150], *(_DWORD *)&v5[12 * v3 + 36] = v4 & data[151], *(_DWORD *)&v5[12 * v3 + 40] = v4 & data[152], *(_DWORD *)&v5[12 * v3 + 44] = v4 & data[153], *(_DWORD *)&v5[12 * v3 + 48] = v4 & data[154], *(_DWORD *)&v5[12 * v3 + 52] = v4 & data[155], *(_DWORD *)&v5[12 * v3 + 56] = v4 & data[156], *(_DWORD *)&v5[12 * v3 + 60] = v4 & data[157], *(_DWORD *)&v5[12 * v3 + 64] = v4 & data[158], *(_DWORD *)&v5[12 * v3 + 68] = v4 & data[159], *(_DWORD *)&v5[12 * v3 + 72] = v4 & data[160], *(_DWORD *)&v5[12 * v3 + 76] = v4 & data[161], *(_DWORD *)&v5[12 * v3 + 80] = v4 & data[162], *(_DWORD *)&v5[12 * v3 + 84] = v4 & data[163], *(_DWORD *)&v5[12 * v3 + 88] = v4 & data[164], *(_DWORD *)&v5[12 * v3 + 92] = v4 & data[165], *(_DWORD *)&v5[12 * v3 + 96] = v4 & data[166], *(_DWORD *)&v5[12 * v3 + 100] = v4 & data[167], *(_DWORD *)&v5[12 * v3 + 104] = v4 & data[168], *(_DWORD *)&v5[13 * v3 + 4] = v4 & data[169], *(_DWORD *)&v5[13 * v3 + 8] = v4 & data[170], *(_DWORD *)&v5[13 * v3 + 12] = v4 & data[171], *(_DWORD *)&v5[13 * v3 + 16] = v4 & data[172], *(_DWORD *)&v5[13 * v3 + 20] = v4 & data[173], *(_DWORD *)&v5[13 * v3 + 24] = v4 & data[174], *(_DWORD *)&v5[13 * v3 + 28] = v4 & data[175], *(_DWORD *)&v5[13 * v3 + 32] = v4 & data[176], *(_DWORD *)&v5[13 * v3 + 36] = v4 & data[177], *(_DWORD *)&v5[13 * v3 + 40] = v4 & data[178], *(_DWORD *)&v5[13 * v3 + 44] = v4 & data[179], *(_DWORD *)&v5[13 * v3 + 48] = v4 & data[180], *(_DWORD *)&v5[13 * v3 + 52] = v4 & data[181], *(_DWORD *)&v5[13 * v3 + 56] = v4 & data[182], *(_DWORD *)&v5[13 * v3 + 60] = v4 & data[183], *(_DWORD *)&v5[13 * v3 + 64] = v4 & data[184], *(_DWORD *)&v5[13 * v3 + 68] = v4 & data[185], *(_DWORD *)&v5[13 * v3 + 72] = v4 & data[186], *(_DWORD *)&v5[13 * v3 + 76] = v4 & data[187], *(_DWORD *)&v5[13 * v3 + 80] = v4 & data[188], *(_DWORD *)&v5[13 * v3 + 84] = v4 & data[189], *(_DWORD *)&v5[13 * v3 + 88] = v4 & data[190], *(_DWORD *)&v5[13 * v3 + 92] = v4 & data[191], *(_DWORD *)&v5[13 * v3 + 96] = v4 & data[192], *(_DWORD *)&v5[13 * v3 + 100] = v4 & data[193], *(_DWORD *)&v5[13 * v3 + 104] = v4 & data[194], *(_DWORD *)&v5[13 * v3 + 108] = v4 & data[195], *(_DWORD *)&v5[14 * v3] = v4 & data[196], *(_DWORD *)&v5[14 * v3 + 4] = v4 & data[197], *(_DWORD *)&v5[14 * v3 + 8] = v4 & data[198], *(_DWORD *)&v5[14 * v3 + 12] = v4 & data[199], *(_DWORD *)&v5[14 * v3 + 16] = v4 & data[200], *(_DWORD *)&v5[14 * v3 + 20] = v4 & data[201], *(_DWORD *)&v5[14 * v3 + 24] = v4 & data[202], *(_DWORD *)&v5[14 * v3 + 28] = v4 & data[203], *(_DWORD *)&v5[14 * v3 + 32] = v4 & data[204], *(_DWORD *)&v5[14 * v3 + 36] = v4 & data[205], *(_DWORD *)&v5[14 * v3 + 40] = v4 & data[206], *(_DWORD *)&v5[14 * v3 + 44] = v4 & data[207], *(_DWORD *)&v5[14 * v3 + 48] = v4 & data[208], *(_DWORD *)&v5[14 * v3 + 52] = v4 & data[209], *(_DWORD *)&v5[14 * v3 + 56] = v4 & data[210], *(_DWORD *)&v5[14 * v3 + 60] = v4 & data[211], *(_DWORD *)&v5[14 * v3 + 64] = v4 & data[212], *(_DWORD *)&v5[14 * v3 + 68] = v4 & data[213], *(_DWORD *)&v5[14 * v3 + 72] = v4 & data[214], *(_DWORD *)&v5[14 * v3 + 76] = v4 & data[215], *(_DWORD *)&v5[14 * v3 + 80] = v4 & data[216], *(_DWORD *)&v5[14 * v3 + 84] = v4 & data[217], *(_DWORD *)&v5[14 * v3 + 88] = v4 & data[218], *(_DWORD *)&v5[14 * v3 + 92] = v4 & data[219], *(_DWORD *)&v5[14 * v3 + 96] = v4 & data[220], *(_DWORD *)&v5[14 * v3 + 100] = v4 & data[221], *(_DWORD *)&v5[14 * v3 + 104] = v4 & data[222], *(_DWORD *)&v5[14 * v3 + 108] = v4 & data[223], *(_DWORD *)&v5[14 * v3 + 112] = v4 & data[224], v2 = 15 * v3, clipYcode != 4) ) { *(_DWORD *)&v5[v2] = v4 & data[225]; *(_DWORD *)&v5[v2 + 4] = v4 & data[226]; *(_DWORD *)&v5[v2 + 8] = v4 & data[227]; *(_DWORD *)&v5[v2 + 12] = v4 & data[228]; *(_DWORD *)&v5[v2 + 16] = v4 & data[229]; *(_DWORD *)&v5[v2 + 20] = v4 & data[230]; *(_DWORD *)&v5[v2 + 24] = v4 & data[231]; *(_DWORD *)&v5[v2 + 28] = v4 & data[232]; *(_DWORD *)&v5[v2 + 32] = v4 & data[233]; *(_DWORD *)&v5[v2 + 36] = v4 & data[234]; *(_DWORD *)&v5[v2 + 40] = v4 & data[235]; *(_DWORD *)&v5[v2 + 44] = v4 & data[236]; *(_DWORD *)&v5[v2 + 48] = v4 & data[237]; *(_DWORD *)&v5[v2 + 52] = v4 & data[238]; *(_DWORD *)&v5[v2 + 56] = v4 & data[239]; *(_DWORD *)&v5[v2 + 60] = v4 & data[240]; *(_DWORD *)&v5[v2 + 64] = v4 & data[241]; *(_DWORD *)&v5[v2 + 68] = v4 & data[242]; *(_DWORD *)&v5[v2 + 72] = v4 & data[243]; *(_DWORD *)&v5[v2 + 76] = v4 & data[244]; *(_DWORD *)&v5[v2 + 80] = v4 & data[245]; *(_DWORD *)&v5[v2 + 84] = v4 & data[246]; *(_DWORD *)&v5[v2 + 88] = v4 & data[247]; *(_DWORD *)&v5[v2 + 92] = v4 & data[248]; *(_DWORD *)&v5[v2 + 96] = v4 & data[249]; *(_DWORD *)&v5[v2 + 100] = v4 & data[250]; *(_DWORD *)&v5[v2 + 104] = v4 & data[251]; *(_DWORD *)&v5[v2 + 108] = v4 & data[252]; *(_DWORD *)&v5[v2 + 112] = v4 & data[253]; v6 = v3 + v2; *(_DWORD *)&v5[v6 + 4] = v4 & data[254]; *(_DWORD *)&v5[v6 + 8] = v4 & data[255]; *(_DWORD *)&v5[v6 + 12] = v4 & data[256]; *(_DWORD *)&v5[v6 + 16] = v4 & data[257]; *(_DWORD *)&v5[v6 + 20] = v4 & data[258]; *(_DWORD *)&v5[v6 + 24] = v4 & data[259]; *(_DWORD *)&v5[v6 + 28] = v4 & data[260]; *(_DWORD *)&v5[v6 + 32] = v4 & data[261]; *(_DWORD *)&v5[v6 + 36] = v4 & data[262]; *(_DWORD *)&v5[v6 + 40] = v4 & data[263]; *(_DWORD *)&v5[v6 + 44] = v4 & data[264]; *(_DWORD *)&v5[v6 + 48] = v4 & data[265]; *(_DWORD *)&v5[v6 + 52] = v4 & data[266]; *(_DWORD *)&v5[v6 + 56] = v4 & data[267]; *(_DWORD *)&v5[v6 + 60] = v4 & data[268]; *(_DWORD *)&v5[v6 + 64] = v4 & data[269]; *(_DWORD *)&v5[v6 + 68] = v4 & data[270]; *(_DWORD *)&v5[v6 + 72] = v4 & data[271]; *(_DWORD *)&v5[v6 + 76] = v4 & data[272]; *(_DWORD *)&v5[v6 + 80] = v4 & data[273]; *(_DWORD *)&v5[v6 + 84] = v4 & data[274]; *(_DWORD *)&v5[v6 + 88] = v4 & data[275]; *(_DWORD *)&v5[v6 + 92] = v4 & data[276]; *(_DWORD *)&v5[v6 + 96] = v4 & data[277]; *(_DWORD *)&v5[v6 + 100] = v4 & data[278]; *(_DWORD *)&v5[v6 + 104] = v4 & data[279]; *(_DWORD *)&v5[v6 + 108] = v4 & data[280]; v7 = v3 + v6; *(_DWORD *)&v5[v7 + 8] = v4 & data[281]; *(_DWORD *)&v5[v7 + 12] = v4 & data[282]; *(_DWORD *)&v5[v7 + 16] = v4 & data[283]; *(_DWORD *)&v5[v7 + 20] = v4 & data[284]; *(_DWORD *)&v5[v7 + 24] = v4 & data[285]; *(_DWORD *)&v5[v7 + 28] = v4 & data[286]; *(_DWORD *)&v5[v7 + 32] = v4 & data[287]; *(_DWORD *)&v5[v7 + 36] = v4 & data[288]; *(_DWORD *)&v5[v7 + 40] = v4 & data[289]; *(_DWORD *)&v5[v7 + 44] = v4 & data[290]; *(_DWORD *)&v5[v7 + 48] = v4 & data[291]; *(_DWORD *)&v5[v7 + 52] = v4 & data[292]; *(_DWORD *)&v5[v7 + 56] = v4 & data[293]; *(_DWORD *)&v5[v7 + 60] = v4 & data[294]; *(_DWORD *)&v5[v7 + 64] = v4 & data[295]; *(_DWORD *)&v5[v7 + 68] = v4 & data[296]; *(_DWORD *)&v5[v7 + 72] = v4 & data[297]; *(_DWORD *)&v5[v7 + 76] = v4 & data[298]; *(_DWORD *)&v5[v7 + 80] = v4 & data[299]; *(_DWORD *)&v5[v7 + 84] = v4 & data[300]; *(_DWORD *)&v5[v7 + 88] = v4 & data[301]; *(_DWORD *)&v5[v7 + 92] = v4 & data[302]; *(_DWORD *)&v5[v7 + 96] = v4 & data[303]; *(_DWORD *)&v5[v7 + 100] = v4 & data[304]; *(_DWORD *)&v5[v7 + 104] = v4 & data[305]; v8 = v3 + v7; *(_DWORD *)&v5[v8 + 12] = v4 & data[306]; *(_DWORD *)&v5[v8 + 16] = v4 & data[307]; *(_DWORD *)&v5[v8 + 20] = v4 & data[308]; *(_DWORD *)&v5[v8 + 24] = v4 & data[309]; *(_DWORD *)&v5[v8 + 28] = v4 & data[310]; *(_DWORD *)&v5[v8 + 32] = v4 & data[311]; *(_DWORD *)&v5[v8 + 36] = v4 & data[312]; *(_DWORD *)&v5[v8 + 40] = v4 & data[313]; *(_DWORD *)&v5[v8 + 44] = v4 & data[314]; *(_DWORD *)&v5[v8 + 48] = v4 & data[315]; *(_DWORD *)&v5[v8 + 52] = v4 & data[316]; *(_DWORD *)&v5[v8 + 56] = v4 & data[317]; *(_DWORD *)&v5[v8 + 60] = v4 & data[318]; *(_DWORD *)&v5[v8 + 64] = v4 & data[319]; *(_DWORD *)&v5[v8 + 68] = v4 & data[320]; *(_DWORD *)&v5[v8 + 72] = v4 & data[321]; *(_DWORD *)&v5[v8 + 76] = v4 & data[322]; *(_DWORD *)&v5[v8 + 80] = v4 & data[323]; *(_DWORD *)&v5[v8 + 84] = v4 & data[324]; *(_DWORD *)&v5[v8 + 88] = v4 & data[325]; *(_DWORD *)&v5[v8 + 92] = v4 & data[326]; *(_DWORD *)&v5[v8 + 96] = v4 & data[327]; *(_DWORD *)&v5[v8 + 100] = v4 & data[328]; v9 = v3 + v8; *(_DWORD *)&v5[v9 + 16] = v4 & data[329]; *(_DWORD *)&v5[v9 + 20] = v4 & data[330]; *(_DWORD *)&v5[v9 + 24] = v4 & data[331]; *(_DWORD *)&v5[v9 + 28] = v4 & data[332]; *(_DWORD *)&v5[v9 + 32] = v4 & data[333]; *(_DWORD *)&v5[v9 + 36] = v4 & data[334]; *(_DWORD *)&v5[v9 + 40] = v4 & data[335]; *(_DWORD *)&v5[v9 + 44] = v4 & data[336]; *(_DWORD *)&v5[v9 + 48] = v4 & data[337]; *(_DWORD *)&v5[v9 + 52] = v4 & data[338]; *(_DWORD *)&v5[v9 + 56] = v4 & data[339]; *(_DWORD *)&v5[v9 + 60] = v4 & data[340]; *(_DWORD *)&v5[v9 + 64] = v4 & data[341]; *(_DWORD *)&v5[v9 + 68] = v4 & data[342]; *(_DWORD *)&v5[v9 + 72] = v4 & data[343]; *(_DWORD *)&v5[v9 + 76] = v4 & data[344]; *(_DWORD *)&v5[v9 + 80] = v4 & data[345]; *(_DWORD *)&v5[v9 + 84] = v4 & data[346]; *(_DWORD *)&v5[v9 + 88] = v4 & data[347]; *(_DWORD *)&v5[v9 + 92] = v4 & data[348]; *(_DWORD *)&v5[v9 + 96] = v4 & data[349]; v10 = v3 + v9; *(_DWORD *)&v5[v10 + 20] = v4 & data[350]; *(_DWORD *)&v5[v10 + 24] = v4 & data[351]; *(_DWORD *)&v5[v10 + 28] = v4 & data[352]; *(_DWORD *)&v5[v10 + 32] = v4 & data[353]; *(_DWORD *)&v5[v10 + 36] = v4 & data[354]; *(_DWORD *)&v5[v10 + 40] = v4 & data[355]; *(_DWORD *)&v5[v10 + 44] = v4 & data[356]; *(_DWORD *)&v5[v10 + 48] = v4 & data[357]; *(_DWORD *)&v5[v10 + 52] = v4 & data[358]; *(_DWORD *)&v5[v10 + 56] = v4 & data[359]; *(_DWORD *)&v5[v10 + 60] = v4 & data[360]; *(_DWORD *)&v5[v10 + 64] = v4 & data[361]; *(_DWORD *)&v5[v10 + 68] = v4 & data[362]; *(_DWORD *)&v5[v10 + 72] = v4 & data[363]; *(_DWORD *)&v5[v10 + 76] = v4 & data[364]; *(_DWORD *)&v5[v10 + 80] = v4 & data[365]; *(_DWORD *)&v5[v10 + 84] = v4 & data[366]; *(_DWORD *)&v5[v10 + 88] = v4 & data[367]; *(_DWORD *)&v5[v10 + 92] = v4 & data[368]; v11 = v3 + v10; *(_DWORD *)&v5[v11 + 24] = v4 & data[369]; *(_DWORD *)&v5[v11 + 28] = v4 & data[370]; *(_DWORD *)&v5[v11 + 32] = v4 & data[371]; *(_DWORD *)&v5[v11 + 36] = v4 & data[372]; *(_DWORD *)&v5[v11 + 40] = v4 & data[373]; *(_DWORD *)&v5[v11 + 44] = v4 & data[374]; *(_DWORD *)&v5[v11 + 48] = v4 & data[375]; *(_DWORD *)&v5[v11 + 52] = v4 & data[376]; *(_DWORD *)&v5[v11 + 56] = v4 & data[377]; *(_DWORD *)&v5[v11 + 60] = v4 & data[378]; *(_DWORD *)&v5[v11 + 64] = v4 & data[379]; *(_DWORD *)&v5[v11 + 68] = v4 & data[380]; *(_DWORD *)&v5[v11 + 72] = v4 & data[381]; *(_DWORD *)&v5[v11 + 76] = v4 & data[382]; *(_DWORD *)&v5[v11 + 80] = v4 & data[383]; *(_DWORD *)&v5[v11 + 84] = v4 & data[384]; *(_DWORD *)&v5[v11 + 88] = v4 & data[385]; v12 = v3 + v11; *(_DWORD *)&v5[v12 + 28] = v4 & data[386]; *(_DWORD *)&v5[v12 + 32] = v4 & data[387]; *(_DWORD *)&v5[v12 + 36] = v4 & data[388]; *(_DWORD *)&v5[v12 + 40] = v4 & data[389]; *(_DWORD *)&v5[v12 + 44] = v4 & data[390]; *(_DWORD *)&v5[v12 + 48] = v4 & data[391]; *(_DWORD *)&v5[v12 + 52] = v4 & data[392]; *(_DWORD *)&v5[v12 + 56] = v4 & data[393]; *(_DWORD *)&v5[v12 + 60] = v4 & data[394]; *(_DWORD *)&v5[v12 + 64] = v4 & data[395]; *(_DWORD *)&v5[v12 + 68] = v4 & data[396]; *(_DWORD *)&v5[v12 + 72] = v4 & data[397]; *(_DWORD *)&v5[v12 + 76] = v4 & data[398]; *(_DWORD *)&v5[v12 + 80] = v4 & data[399]; *(_DWORD *)&v5[v12 + 84] = v4 & data[400]; v13 = v3 + v12; *(_DWORD *)&v5[v13 + 32] = v4 & data[401]; *(_DWORD *)&v5[v13 + 36] = v4 & data[402]; *(_DWORD *)&v5[v13 + 40] = v4 & data[403]; *(_DWORD *)&v5[v13 + 44] = v4 & data[404]; *(_DWORD *)&v5[v13 + 48] = v4 & data[405]; *(_DWORD *)&v5[v13 + 52] = v4 & data[406]; *(_DWORD *)&v5[v13 + 56] = v4 & data[407]; *(_DWORD *)&v5[v13 + 60] = v4 & data[408]; *(_DWORD *)&v5[v13 + 64] = v4 & data[409]; *(_DWORD *)&v5[v13 + 68] = v4 & data[410]; *(_DWORD *)&v5[v13 + 72] = v4 & data[411]; *(_DWORD *)&v5[v13 + 76] = v4 & data[412]; *(_DWORD *)&v5[v13 + 80] = v4 & data[413]; v14 = v3 + v13; *(_DWORD *)&v5[v14 + 36] = v4 & data[414]; *(_DWORD *)&v5[v14 + 40] = v4 & data[415]; *(_DWORD *)&v5[v14 + 44] = v4 & data[416]; *(_DWORD *)&v5[v14 + 48] = v4 & data[417]; *(_DWORD *)&v5[v14 + 52] = v4 & data[418]; *(_DWORD *)&v5[v14 + 56] = v4 & data[419]; *(_DWORD *)&v5[v14 + 60] = v4 & data[420]; *(_DWORD *)&v5[v14 + 64] = v4 & data[421]; *(_DWORD *)&v5[v14 + 68] = v4 & data[422]; *(_DWORD *)&v5[v14 + 72] = v4 & data[423]; *(_DWORD *)&v5[v14 + 76] = v4 & data[424]; v15 = v3 + v14; *(_DWORD *)&v5[v15 + 40] = v4 & data[425]; *(_DWORD *)&v5[v15 + 44] = v4 & data[426]; *(_DWORD *)&v5[v15 + 48] = v4 & data[427]; *(_DWORD *)&v5[v15 + 52] = v4 & data[428]; *(_DWORD *)&v5[v15 + 56] = v4 & data[429]; *(_DWORD *)&v5[v15 + 60] = v4 & data[430]; *(_DWORD *)&v5[v15 + 64] = v4 & data[431]; *(_DWORD *)&v5[v15 + 68] = v4 & data[432]; *(_DWORD *)&v5[v15 + 72] = v4 & data[433]; v16 = v3 + v15; *(_DWORD *)&v5[v16 + 44] = v4 & data[434]; *(_DWORD *)&v5[v16 + 48] = v4 & data[435]; *(_DWORD *)&v5[v16 + 52] = v4 & data[436]; *(_DWORD *)&v5[v16 + 56] = v4 & data[437]; *(_DWORD *)&v5[v16 + 60] = v4 & data[438]; *(_DWORD *)&v5[v16 + 64] = v4 & data[439]; *(_DWORD *)&v5[v16 + 68] = v4 & data[440]; v17 = v3 + v16; *(_DWORD *)&v5[v17 + 48] = v4 & data[441]; *(_DWORD *)&v5[v17 + 52] = v4 & data[442]; *(_DWORD *)&v5[v17 + 56] = v4 & data[443]; *(_DWORD *)&v5[v17 + 60] = v4 & data[444]; *(_DWORD *)&v5[v17 + 64] = v4 & data[445]; v18 = v3 + v17; *(_DWORD *)&v5[v18 + 52] = v4 & data[446]; *(_DWORD *)&v5[v18 + 56] = v4 & data[447]; *(_DWORD *)&v5[v18 + 60] = v4 & data[448]; *(_DWORD *)(&v5[v18 + 56] + v3) = v4 & data[449]; } } void fun_drawBuildingFootprint_xClipRight(int *data, int clipYcode) { int v2; // edx@3 int v3; // ecx@3 char *v4; // edi@3 int v5; // edx@4 int v6; // edx@4 int v7; // edx@4 int v8; // edx@4 int v9; // edx@4 int v10; // edx@4 int v11; // edx@4 int v12; // edx@4 int v13; // edx@4 int v14; // edx@4 int v15; // edx@4 int v16; // edx@4 int v17; // edx@4 int v18; // edx@4 int v19; // edx@6 int v20; // edx@6 int v21; // edx@6 int v22; // edx@6 int v23; // edx@6 int v24; // edx@6 int v25; // edx@6 int v26; // edx@6 int v27; // edx@6 int v28; // edx@6 int v29; // eax@6 int v30; // edx@6 int v31; // edx@6 if ( drawGraphic_colorMask ) { fun_drawBuildingFootprint_xClipRight_colored(data, clipYcode); } else { v4 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = 0; v3 = ddraw_scanline; if ( clipYcode == 3 || (v5 = ddraw_scanline, *(_DWORD *)&v4[ddraw_scanline] = data[3], v6 = v3 + v5, *(_DWORD *)&v4[v6] = data[7], *(_DWORD *)&v4[v6 + 4] = data[8], v7 = v3 + v6, *(_DWORD *)&v4[v7] = data[13], *(_DWORD *)&v4[v7 + 4] = data[14], *(_DWORD *)&v4[v7 + 8] = data[15], v8 = v3 + v7, *(_DWORD *)&v4[v8] = data[21], *(_DWORD *)&v4[v8 + 4] = data[22], *(_DWORD *)&v4[v8 + 8] = data[23], *(_DWORD *)&v4[v8 + 12] = data[24], v9 = v3 + v8, *(_DWORD *)&v4[v9] = data[31], *(_DWORD *)&v4[v9 + 4] = data[32], *(_DWORD *)&v4[v9 + 8] = data[33], *(_DWORD *)&v4[v9 + 12] = data[34], *(_DWORD *)&v4[v9 + 16] = data[35], v10 = v3 + v9, *(_DWORD *)&v4[v10] = data[43], *(_DWORD *)&v4[v10 + 4] = data[44], *(_DWORD *)&v4[v10 + 8] = data[45], *(_DWORD *)&v4[v10 + 12] = data[46], *(_DWORD *)&v4[v10 + 16] = data[47], *(_DWORD *)&v4[v10 + 20] = data[48], v11 = v3 + v10, *(_DWORD *)&v4[v11] = data[57], *(_DWORD *)&v4[v11 + 4] = data[58], *(_DWORD *)&v4[v11 + 8] = data[59], *(_DWORD *)&v4[v11 + 12] = data[60], *(_DWORD *)&v4[v11 + 16] = data[61], *(_DWORD *)&v4[v11 + 20] = data[62], *(_DWORD *)&v4[v11 + 24] = data[63], v12 = v3 + v11, *(_DWORD *)&v4[v12] = data[73], *(_DWORD *)&v4[v12 + 4] = data[74], *(_DWORD *)&v4[v12 + 8] = data[75], *(_DWORD *)&v4[v12 + 12] = data[76], *(_DWORD *)&v4[v12 + 16] = data[77], *(_DWORD *)&v4[v12 + 20] = data[78], *(_DWORD *)&v4[v12 + 24] = data[79], *(_DWORD *)&v4[v12 + 28] = data[80], v13 = v3 + v12, *(_DWORD *)&v4[v13] = data[91], *(_DWORD *)&v4[v13 + 4] = data[92], *(_DWORD *)&v4[v13 + 8] = data[93], *(_DWORD *)&v4[v13 + 12] = data[94], *(_DWORD *)&v4[v13 + 16] = data[95], *(_DWORD *)&v4[v13 + 20] = data[96], *(_DWORD *)&v4[v13 + 24] = data[97], *(_DWORD *)&v4[v13 + 28] = data[98], *(_DWORD *)&v4[v13 + 32] = data[99], v14 = v3 + v13, *(_DWORD *)&v4[v14] = data[111], *(_DWORD *)&v4[v14 + 4] = data[112], *(_DWORD *)&v4[v14 + 8] = data[113], *(_DWORD *)&v4[v14 + 12] = data[114], *(_DWORD *)&v4[v14 + 16] = data[115], *(_DWORD *)&v4[v14 + 20] = data[116], *(_DWORD *)&v4[v14 + 24] = data[117], *(_DWORD *)&v4[v14 + 28] = data[118], *(_DWORD *)&v4[v14 + 32] = data[119], *(_DWORD *)&v4[v14 + 36] = data[120], v15 = v3 + v14, *(_DWORD *)&v4[v15] = data[133], *(_DWORD *)&v4[v15 + 4] = data[134], *(_DWORD *)&v4[v15 + 8] = data[135], *(_DWORD *)&v4[v15 + 12] = data[136], *(_DWORD *)&v4[v15 + 16] = data[137], *(_DWORD *)&v4[v15 + 20] = data[138], *(_DWORD *)&v4[v15 + 24] = data[139], *(_DWORD *)&v4[v15 + 28] = data[140], *(_DWORD *)&v4[v15 + 32] = data[141], *(_DWORD *)&v4[v15 + 36] = data[142], *(_DWORD *)&v4[v15 + 40] = data[143], v16 = v3 + v15, *(_DWORD *)&v4[v16] = data[157], *(_DWORD *)&v4[v16 + 4] = data[158], *(_DWORD *)&v4[v16 + 8] = data[159], *(_DWORD *)&v4[v16 + 12] = data[160], *(_DWORD *)&v4[v16 + 16] = data[161], *(_DWORD *)&v4[v16 + 20] = data[162], *(_DWORD *)&v4[v16 + 24] = data[163], *(_DWORD *)&v4[v16 + 28] = data[164], *(_DWORD *)&v4[v16 + 32] = data[165], *(_DWORD *)&v4[v16 + 36] = data[166], *(_DWORD *)&v4[v16 + 40] = data[167], *(_DWORD *)&v4[v16 + 44] = data[168], v17 = v3 + v16, *(_DWORD *)&v4[v17] = data[183], *(_DWORD *)&v4[v17 + 4] = data[184], *(_DWORD *)&v4[v17 + 8] = data[185], *(_DWORD *)&v4[v17 + 12] = data[186], *(_DWORD *)&v4[v17 + 16] = data[187], *(_DWORD *)&v4[v17 + 20] = data[188], *(_DWORD *)&v4[v17 + 24] = data[189], *(_DWORD *)&v4[v17 + 28] = data[190], *(_DWORD *)&v4[v17 + 32] = data[191], *(_DWORD *)&v4[v17 + 36] = data[192], *(_DWORD *)&v4[v17 + 40] = data[193], *(_DWORD *)&v4[v17 + 44] = data[194], *(_DWORD *)&v4[v17 + 48] = data[195], v18 = v3 + v17, *(_DWORD *)&v4[v18] = data[211], *(_DWORD *)&v4[v18 + 4] = data[212], *(_DWORD *)&v4[v18 + 8] = data[213], *(_DWORD *)&v4[v18 + 12] = data[214], *(_DWORD *)&v4[v18 + 16] = data[215], *(_DWORD *)&v4[v18 + 20] = data[216], *(_DWORD *)&v4[v18 + 24] = data[217], *(_DWORD *)&v4[v18 + 28] = data[218], *(_DWORD *)&v4[v18 + 32] = data[219], *(_DWORD *)&v4[v18 + 36] = data[220], *(_DWORD *)&v4[v18 + 40] = data[221], *(_DWORD *)&v4[v18 + 44] = data[222], *(_DWORD *)&v4[v18 + 48] = data[223], *(_DWORD *)&v4[v18 + 52] = data[224], v2 = v3 + v18, clipYcode != 4) ) { *(_DWORD *)&v4[v2] = data[240]; *(_DWORD *)&v4[v2 + 4] = data[241]; *(_DWORD *)&v4[v2 + 8] = data[242]; *(_DWORD *)&v4[v2 + 12] = data[243]; *(_DWORD *)&v4[v2 + 16] = data[243]; *(_DWORD *)&v4[v2 + 20] = data[245]; *(_DWORD *)&v4[v2 + 24] = data[246]; *(_DWORD *)&v4[v2 + 28] = data[247]; *(_DWORD *)&v4[v2 + 32] = data[248]; *(_DWORD *)&v4[v2 + 36] = data[249]; *(_DWORD *)&v4[v2 + 40] = data[250]; *(_DWORD *)&v4[v2 + 44] = data[251]; *(_DWORD *)&v4[v2 + 48] = data[252]; *(_DWORD *)&v4[v2 + 52] = data[253]; v19 = v3 + v2; *(_DWORD *)&v4[v19] = data[268]; *(_DWORD *)&v4[v19 + 4] = data[269]; *(_DWORD *)&v4[v19 + 8] = data[270]; *(_DWORD *)&v4[v19 + 12] = data[271]; *(_DWORD *)&v4[v19 + 16] = data[272]; *(_DWORD *)&v4[v19 + 20] = data[273]; *(_DWORD *)&v4[v19 + 24] = data[274]; *(_DWORD *)&v4[v19 + 28] = data[275]; *(_DWORD *)&v4[v19 + 32] = data[276]; *(_DWORD *)&v4[v19 + 36] = data[277]; *(_DWORD *)&v4[v19 + 40] = data[278]; *(_DWORD *)&v4[v19 + 44] = data[279]; *(_DWORD *)&v4[v19 + 48] = data[280]; v20 = v3 + v19; *(_DWORD *)&v4[v20] = data[294]; *(_DWORD *)&v4[v20 + 4] = data[295]; *(_DWORD *)&v4[v20 + 8] = data[296]; *(_DWORD *)&v4[v20 + 12] = data[297]; *(_DWORD *)&v4[v20 + 16] = data[298]; *(_DWORD *)&v4[v20 + 20] = data[299]; *(_DWORD *)&v4[v20 + 24] = data[300]; *(_DWORD *)&v4[v20 + 28] = data[301]; *(_DWORD *)&v4[v20 + 32] = data[302]; *(_DWORD *)&v4[v20 + 36] = data[303]; *(_DWORD *)&v4[v20 + 40] = data[304]; *(_DWORD *)&v4[v20 + 44] = data[305]; v21 = v3 + v20; *(_DWORD *)&v4[v21] = data[318]; *(_DWORD *)&v4[v21 + 4] = data[319]; *(_DWORD *)&v4[v21 + 8] = data[320]; *(_DWORD *)&v4[v21 + 12] = data[321]; *(_DWORD *)&v4[v21 + 16] = data[322]; *(_DWORD *)&v4[v21 + 20] = data[323]; *(_DWORD *)&v4[v21 + 24] = data[324]; *(_DWORD *)&v4[v21 + 28] = data[325]; *(_DWORD *)&v4[v21 + 32] = data[326]; *(_DWORD *)&v4[v21 + 36] = data[327]; *(_DWORD *)&v4[v21 + 40] = data[328]; v22 = v3 + v21; *(_DWORD *)&v4[v22] = data[340]; *(_DWORD *)&v4[v22 + 4] = data[341]; *(_DWORD *)&v4[v22 + 8] = data[342]; *(_DWORD *)&v4[v22 + 12] = data[343]; *(_DWORD *)&v4[v22 + 16] = data[344]; *(_DWORD *)&v4[v22 + 20] = data[345]; *(_DWORD *)&v4[v22 + 24] = data[346]; *(_DWORD *)&v4[v22 + 28] = data[347]; *(_DWORD *)&v4[v22 + 32] = data[348]; *(_DWORD *)&v4[v22 + 36] = data[349]; v23 = v3 + v22; *(_DWORD *)&v4[v23] = data[360]; *(_DWORD *)&v4[v23 + 4] = data[361]; *(_DWORD *)&v4[v23 + 8] = data[362]; *(_DWORD *)&v4[v23 + 12] = data[363]; *(_DWORD *)&v4[v23 + 16] = data[364]; *(_DWORD *)&v4[v23 + 20] = data[365]; *(_DWORD *)&v4[v23 + 24] = data[366]; *(_DWORD *)&v4[v23 + 28] = data[367]; *(_DWORD *)&v4[v23 + 32] = data[368]; v24 = v3 + v23; *(_DWORD *)&v4[v24] = data[378]; *(_DWORD *)&v4[v24 + 4] = data[379]; *(_DWORD *)&v4[v24 + 8] = data[380]; *(_DWORD *)&v4[v24 + 12] = data[381]; *(_DWORD *)&v4[v24 + 16] = data[382]; *(_DWORD *)&v4[v24 + 20] = data[383]; *(_DWORD *)&v4[v24 + 24] = data[384]; *(_DWORD *)&v4[v24 + 28] = data[385]; v25 = v3 + v24; *(_DWORD *)&v4[v25] = data[394]; *(_DWORD *)&v4[v25 + 4] = data[395]; *(_DWORD *)&v4[v25 + 8] = data[396]; *(_DWORD *)&v4[v25 + 12] = data[397]; *(_DWORD *)&v4[v25 + 16] = data[398]; *(_DWORD *)&v4[v25 + 20] = data[399]; *(_DWORD *)&v4[v25 + 24] = data[400]; v26 = v3 + v25; *(_DWORD *)&v4[v26] = data[408]; *(_DWORD *)&v4[v26 + 4] = data[409]; *(_DWORD *)&v4[v26 + 8] = data[410]; *(_DWORD *)&v4[v26 + 12] = data[411]; *(_DWORD *)&v4[v26 + 16] = data[412]; *(_DWORD *)&v4[v26 + 20] = data[413]; v27 = v3 + v26; *(_DWORD *)&v4[v27] = data[420]; *(_DWORD *)&v4[v27 + 4] = data[421]; *(_DWORD *)&v4[v27 + 8] = data[422]; *(_DWORD *)&v4[v27 + 12] = data[423]; *(_DWORD *)&v4[v27 + 16] = data[424]; v28 = v3 + v27; *(_DWORD *)&v4[v28] = data[430]; *(_DWORD *)&v4[v28 + 4] = data[431]; v29 = data[432]; *(_DWORD *)&v4[v28 + 8] = v29; v29 = (v29 & 0xffff0000) + *((_WORD *)data + 866); *(_DWORD *)&v4[v28 + 12] = v29; v30 = v3 + v28; *(_DWORD *)&v4[v30] = data[438]; *(_DWORD *)&v4[v30 + 4] = data[439]; *(_DWORD *)&v4[v30 + 8] = data[440]; v31 = v3 + v30; *(_DWORD *)&v4[v31] = data[444]; *(_DWORD *)&v4[v31 + 4] = data[445]; *(_DWORD *)(&v4[v3] + v31) = data[448]; } } } void fun_drawBuildingFootprint_xClipRight_colored(int *data, int clipYcode) { int v2; // edx@1 int v3; // ecx@1 int v4; // ebx@1 char *v5; // edi@1 int v6; // edx@2 int v7; // edx@2 int v8; // edx@2 int v9; // edx@2 int v10; // edx@2 int v11; // edx@2 int v12; // edx@2 int v13; // edx@2 int v14; // edx@2 int v15; // edx@2 int v16; // edx@2 int v17; // edx@2 int v18; // edx@2 int v19; // edx@2 int v20; // edx@4 int v21; // edx@4 int v22; // edx@4 int v23; // edx@4 int v24; // edx@4 int v25; // edx@4 int v26; // edx@4 int v27; // edx@4 int v28; // edx@4 int v29; // edx@4 int v30; // eax@4 int v31; // edx@4 int v32; // edx@4 v5 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v4 = (unsigned __int16)drawGraphic_colorMask << 16; v4 = (v4 & 0xffff0000 ) + drawGraphic_colorMask; v2 = 0; v3 = ddraw_scanline; if ( clipYcode == 3 || (v6 = ddraw_scanline, *(_DWORD *)&v5[ddraw_scanline] = v4 & data[3], v7 = v3 + v6, *(_DWORD *)&v5[v7] = v4 & data[7], *(_DWORD *)&v5[v7 + 4] = v4 & data[8], v8 = v3 + v7, *(_DWORD *)&v5[v8] = v4 & data[13], *(_DWORD *)&v5[v8 + 4] = v4 & data[14], *(_DWORD *)&v5[v8 + 8] = v4 & data[15], v9 = v3 + v8, *(_DWORD *)&v5[v9] = v4 & data[21], *(_DWORD *)&v5[v9 + 4] = v4 & data[22], *(_DWORD *)&v5[v9 + 8] = v4 & data[23], *(_DWORD *)&v5[v9 + 12] = v4 & data[24], v10 = v3 + v9, *(_DWORD *)&v5[v10] = v4 & data[31], *(_DWORD *)&v5[v10 + 4] = v4 & data[32], *(_DWORD *)&v5[v10 + 8] = v4 & data[33], *(_DWORD *)&v5[v10 + 12] = v4 & data[34], *(_DWORD *)&v5[v10 + 16] = v4 & data[35], v11 = v3 + v10, *(_DWORD *)&v5[v11] = v4 & data[43], *(_DWORD *)&v5[v11 + 4] = v4 & data[44], *(_DWORD *)&v5[v11 + 8] = v4 & data[45], *(_DWORD *)&v5[v11 + 12] = v4 & data[46], *(_DWORD *)&v5[v11 + 16] = v4 & data[47], *(_DWORD *)&v5[v11 + 20] = v4 & data[48], v12 = v3 + v11, *(_DWORD *)&v5[v12] = v4 & data[57], *(_DWORD *)&v5[v12 + 4] = v4 & data[58], *(_DWORD *)&v5[v12 + 8] = v4 & data[59], *(_DWORD *)&v5[v12 + 12] = v4 & data[60], *(_DWORD *)&v5[v12 + 16] = v4 & data[61], *(_DWORD *)&v5[v12 + 20] = v4 & data[62], *(_DWORD *)&v5[v12 + 24] = v4 & data[63], v13 = v3 + v12, *(_DWORD *)&v5[v13] = v4 & data[73], *(_DWORD *)&v5[v13 + 4] = v4 & data[74], *(_DWORD *)&v5[v13 + 8] = v4 & data[75], *(_DWORD *)&v5[v13 + 12] = v4 & data[76], *(_DWORD *)&v5[v13 + 16] = v4 & data[77], *(_DWORD *)&v5[v13 + 20] = v4 & data[78], *(_DWORD *)&v5[v13 + 24] = v4 & data[79], *(_DWORD *)&v5[v13 + 28] = v4 & data[80], v14 = v3 + v13, *(_DWORD *)&v5[v14] = v4 & data[91], *(_DWORD *)&v5[v14 + 4] = v4 & data[92], *(_DWORD *)&v5[v14 + 8] = v4 & data[93], *(_DWORD *)&v5[v14 + 12] = v4 & data[94], *(_DWORD *)&v5[v14 + 16] = v4 & data[95], *(_DWORD *)&v5[v14 + 20] = v4 & data[96], *(_DWORD *)&v5[v14 + 24] = v4 & data[97], *(_DWORD *)&v5[v14 + 28] = v4 & data[98], *(_DWORD *)&v5[v14 + 32] = v4 & data[99], v15 = v3 + v14, *(_DWORD *)&v5[v15] = v4 & data[111], *(_DWORD *)&v5[v15 + 4] = v4 & data[112], *(_DWORD *)&v5[v15 + 8] = v4 & data[113], *(_DWORD *)&v5[v15 + 12] = v4 & data[114], *(_DWORD *)&v5[v15 + 16] = v4 & data[115], *(_DWORD *)&v5[v15 + 20] = v4 & data[116], *(_DWORD *)&v5[v15 + 24] = v4 & data[117], *(_DWORD *)&v5[v15 + 28] = v4 & data[118], *(_DWORD *)&v5[v15 + 32] = v4 & data[119], *(_DWORD *)&v5[v15 + 36] = v4 & data[120], v16 = v3 + v15, *(_DWORD *)&v5[v16] = v4 & data[133], *(_DWORD *)&v5[v16 + 4] = v4 & data[134], *(_DWORD *)&v5[v16 + 8] = v4 & data[135], *(_DWORD *)&v5[v16 + 12] = v4 & data[136], *(_DWORD *)&v5[v16 + 16] = v4 & data[137], *(_DWORD *)&v5[v16 + 20] = v4 & data[138], *(_DWORD *)&v5[v16 + 24] = v4 & data[139], *(_DWORD *)&v5[v16 + 28] = v4 & data[140], *(_DWORD *)&v5[v16 + 32] = v4 & data[141], *(_DWORD *)&v5[v16 + 36] = v4 & data[142], *(_DWORD *)&v5[v16 + 40] = v4 & data[143], v17 = v3 + v16, *(_DWORD *)&v5[v17] = v4 & data[157], *(_DWORD *)&v5[v17 + 4] = v4 & data[158], *(_DWORD *)&v5[v17 + 8] = v4 & data[159], *(_DWORD *)&v5[v17 + 12] = v4 & data[160], *(_DWORD *)&v5[v17 + 16] = v4 & data[161], *(_DWORD *)&v5[v17 + 20] = v4 & data[162], *(_DWORD *)&v5[v17 + 24] = v4 & data[163], *(_DWORD *)&v5[v17 + 28] = v4 & data[164], *(_DWORD *)&v5[v17 + 32] = v4 & data[165], *(_DWORD *)&v5[v17 + 36] = v4 & data[166], *(_DWORD *)&v5[v17 + 40] = v4 & data[167], *(_DWORD *)&v5[v17 + 44] = v4 & data[168], v18 = v3 + v17, *(_DWORD *)&v5[v18] = v4 & data[183], *(_DWORD *)&v5[v18 + 4] = v4 & data[184], *(_DWORD *)&v5[v18 + 8] = v4 & data[185], *(_DWORD *)&v5[v18 + 12] = v4 & data[186], *(_DWORD *)&v5[v18 + 16] = v4 & data[187], *(_DWORD *)&v5[v18 + 20] = v4 & data[188], *(_DWORD *)&v5[v18 + 24] = v4 & data[189], *(_DWORD *)&v5[v18 + 28] = v4 & data[190], *(_DWORD *)&v5[v18 + 32] = v4 & data[191], *(_DWORD *)&v5[v18 + 36] = v4 & data[192], *(_DWORD *)&v5[v18 + 40] = v4 & data[193], *(_DWORD *)&v5[v18 + 44] = v4 & data[194], *(_DWORD *)&v5[v18 + 48] = v4 & data[195], v19 = v3 + v18, *(_DWORD *)&v5[v19] = v4 & data[211], *(_DWORD *)&v5[v19 + 4] = v4 & data[212], *(_DWORD *)&v5[v19 + 8] = v4 & data[213], *(_DWORD *)&v5[v19 + 12] = v4 & data[214], *(_DWORD *)&v5[v19 + 16] = v4 & data[215], *(_DWORD *)&v5[v19 + 20] = v4 & data[216], *(_DWORD *)&v5[v19 + 24] = v4 & data[217], *(_DWORD *)&v5[v19 + 28] = v4 & data[218], *(_DWORD *)&v5[v19 + 32] = v4 & data[219], *(_DWORD *)&v5[v19 + 36] = v4 & data[220], *(_DWORD *)&v5[v19 + 40] = v4 & data[221], *(_DWORD *)&v5[v19 + 44] = v4 & data[222], *(_DWORD *)&v5[v19 + 48] = v4 & data[223], *(_DWORD *)&v5[v19 + 52] = v4 & data[224], v2 = v3 + v19, clipYcode != 4) ) { *(_DWORD *)&v5[v2] = v4 & data[240]; *(_DWORD *)&v5[v2 + 4] = v4 & data[241]; *(_DWORD *)&v5[v2 + 8] = v4 & data[242]; *(_DWORD *)&v5[v2 + 12] = v4 & data[243]; *(_DWORD *)&v5[v2 + 16] = v4 & data[243]; *(_DWORD *)&v5[v2 + 20] = v4 & data[245]; *(_DWORD *)&v5[v2 + 24] = v4 & data[246]; *(_DWORD *)&v5[v2 + 28] = v4 & data[247]; *(_DWORD *)&v5[v2 + 32] = v4 & data[248]; *(_DWORD *)&v5[v2 + 36] = v4 & data[249]; *(_DWORD *)&v5[v2 + 40] = v4 & data[250]; *(_DWORD *)&v5[v2 + 44] = v4 & data[251]; *(_DWORD *)&v5[v2 + 48] = v4 & data[252]; *(_DWORD *)&v5[v2 + 52] = v4 & data[253]; v20 = v3 + v2; *(_DWORD *)&v5[v20] = v4 & data[268]; *(_DWORD *)&v5[v20 + 4] = v4 & data[269]; *(_DWORD *)&v5[v20 + 8] = v4 & data[270]; *(_DWORD *)&v5[v20 + 12] = v4 & data[271]; *(_DWORD *)&v5[v20 + 16] = v4 & data[272]; *(_DWORD *)&v5[v20 + 20] = v4 & data[273]; *(_DWORD *)&v5[v20 + 24] = v4 & data[274]; *(_DWORD *)&v5[v20 + 28] = v4 & data[275]; *(_DWORD *)&v5[v20 + 32] = v4 & data[276]; *(_DWORD *)&v5[v20 + 36] = v4 & data[277]; *(_DWORD *)&v5[v20 + 40] = v4 & data[278]; *(_DWORD *)&v5[v20 + 44] = v4 & data[279]; *(_DWORD *)&v5[v20 + 48] = v4 & data[280]; v21 = v3 + v20; *(_DWORD *)&v5[v21] = v4 & data[294]; *(_DWORD *)&v5[v21 + 4] = v4 & data[295]; *(_DWORD *)&v5[v21 + 8] = v4 & data[296]; *(_DWORD *)&v5[v21 + 12] = v4 & data[297]; *(_DWORD *)&v5[v21 + 16] = v4 & data[298]; *(_DWORD *)&v5[v21 + 20] = v4 & data[299]; *(_DWORD *)&v5[v21 + 24] = v4 & data[300]; *(_DWORD *)&v5[v21 + 28] = v4 & data[301]; *(_DWORD *)&v5[v21 + 32] = v4 & data[302]; *(_DWORD *)&v5[v21 + 36] = v4 & data[303]; *(_DWORD *)&v5[v21 + 40] = v4 & data[304]; *(_DWORD *)&v5[v21 + 44] = v4 & data[305]; v22 = v3 + v21; *(_DWORD *)&v5[v22] = v4 & data[318]; *(_DWORD *)&v5[v22 + 4] = v4 & data[319]; *(_DWORD *)&v5[v22 + 8] = v4 & data[320]; *(_DWORD *)&v5[v22 + 12] = v4 & data[321]; *(_DWORD *)&v5[v22 + 16] = v4 & data[322]; *(_DWORD *)&v5[v22 + 20] = v4 & data[323]; *(_DWORD *)&v5[v22 + 24] = v4 & data[324]; *(_DWORD *)&v5[v22 + 28] = v4 & data[325]; *(_DWORD *)&v5[v22 + 32] = v4 & data[326]; *(_DWORD *)&v5[v22 + 36] = v4 & data[327]; *(_DWORD *)&v5[v22 + 40] = v4 & data[328]; v23 = v3 + v22; *(_DWORD *)&v5[v23] = v4 & data[340]; *(_DWORD *)&v5[v23 + 4] = v4 & data[341]; *(_DWORD *)&v5[v23 + 8] = v4 & data[342]; *(_DWORD *)&v5[v23 + 12] = v4 & data[343]; *(_DWORD *)&v5[v23 + 16] = v4 & data[344]; *(_DWORD *)&v5[v23 + 20] = v4 & data[345]; *(_DWORD *)&v5[v23 + 24] = v4 & data[346]; *(_DWORD *)&v5[v23 + 28] = v4 & data[347]; *(_DWORD *)&v5[v23 + 32] = v4 & data[348]; *(_DWORD *)&v5[v23 + 36] = v4 & data[349]; v24 = v3 + v23; *(_DWORD *)&v5[v24] = v4 & data[360]; *(_DWORD *)&v5[v24 + 4] = v4 & data[361]; *(_DWORD *)&v5[v24 + 8] = v4 & data[362]; *(_DWORD *)&v5[v24 + 12] = v4 & data[363]; *(_DWORD *)&v5[v24 + 16] = v4 & data[364]; *(_DWORD *)&v5[v24 + 20] = v4 & data[365]; *(_DWORD *)&v5[v24 + 24] = v4 & data[366]; *(_DWORD *)&v5[v24 + 28] = v4 & data[367]; *(_DWORD *)&v5[v24 + 32] = v4 & data[368]; v25 = v3 + v24; *(_DWORD *)&v5[v25] = v4 & data[378]; *(_DWORD *)&v5[v25 + 4] = v4 & data[379]; *(_DWORD *)&v5[v25 + 8] = v4 & data[380]; *(_DWORD *)&v5[v25 + 12] = v4 & data[381]; *(_DWORD *)&v5[v25 + 16] = v4 & data[382]; *(_DWORD *)&v5[v25 + 20] = v4 & data[383]; *(_DWORD *)&v5[v25 + 24] = v4 & data[384]; *(_DWORD *)&v5[v25 + 28] = v4 & data[385]; v26 = v3 + v25; *(_DWORD *)&v5[v26] = v4 & data[394]; *(_DWORD *)&v5[v26 + 4] = v4 & data[395]; *(_DWORD *)&v5[v26 + 8] = v4 & data[396]; *(_DWORD *)&v5[v26 + 12] = v4 & data[397]; *(_DWORD *)&v5[v26 + 16] = v4 & data[398]; *(_DWORD *)&v5[v26 + 20] = v4 & data[399]; *(_DWORD *)&v5[v26 + 24] = v4 & data[400]; v27 = v3 + v26; *(_DWORD *)&v5[v27] = v4 & data[408]; *(_DWORD *)&v5[v27 + 4] = v4 & data[409]; *(_DWORD *)&v5[v27 + 8] = v4 & data[410]; *(_DWORD *)&v5[v27 + 12] = v4 & data[411]; *(_DWORD *)&v5[v27 + 16] = v4 & data[412]; *(_DWORD *)&v5[v27 + 20] = v4 & data[413]; v28 = v3 + v27; *(_DWORD *)&v5[v28] = v4 & data[420]; *(_DWORD *)&v5[v28 + 4] = v4 & data[421]; *(_DWORD *)&v5[v28 + 8] = v4 & data[422]; *(_DWORD *)&v5[v28 + 12] = v4 & data[423]; *(_DWORD *)&v5[v28 + 16] = v4 & data[424]; v29 = v3 + v28; *(_DWORD *)&v5[v29] = v4 & data[430]; *(_DWORD *)&v5[v29 + 4] = v4 & data[431]; v30 = v4 & data[432]; *(_DWORD *)&v5[v29 + 8] = v30; v30 = (v32 & 0xffff0000 ) + *((_WORD *)data + 866); *(_DWORD *)&v5[v29 + 12] = v4 & v30; v31 = v3 + v29; *(_DWORD *)&v5[v31] = v4 & data[438]; *(_DWORD *)&v5[v31 + 4] = v4 & data[439]; *(_DWORD *)&v5[v31 + 8] = v4 & data[440]; v32 = v3 + v31; *(_DWORD *)&v5[v32] = v4 & data[444]; *(_DWORD *)&v5[v32 + 4] = v4 & data[445]; *(_DWORD *)(&v5[v3] + v32) = v4 & data[448]; } } void fun_drawBuildingFootprint_xClipLeft(int *data, int clipYcode) { int v2; // edx@3 int scanline; // ecx@3 char *v4; // edi@3 int v5; // edx@4 int v6; // edx@4 int v7; // edx@4 int v8; // edx@4 int v9; // edx@4 int v10; // edx@4 int v11; // edx@4 int v12; // edx@4 int v13; // edx@4 int v14; // edx@4 int v15; // edx@4 int v16; // edx@4 int v17; // edx@4 int v18; // edx@4 int v19; // edx@6 int v20; // edx@6 int v21; // edx@6 int v22; // edx@6 int v23; // edx@6 int v24; // edx@6 int v25; // edx@6 int v26; // edx@6 int v27; // edx@6 int v28; // edx@6 int v29; // edx@6 int v30; // edx@6 if ( drawGraphic_colorMask ) { fun_drawBuildingFootprint_xClipLeft_colored(data, clipYcode); } else { v4 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v2 = 0; scanline = ddraw_scanline; if ( clipYcode == 3 || (v5 = ddraw_scanline, *(_DWORD *)&v4[ddraw_scanline + 52] = data[1], v6 = scanline + v5, *(_DWORD *)&v4[v6 + 48] = data[4], *(_DWORD *)&v4[v6 + 52] = data[5], v7 = scanline + v6, *(_DWORD *)&v4[v7 + 44] = data[9], *(_DWORD *)&v4[v7 + 48] = data[10], *(_DWORD *)&v4[v7 + 52] = data[11], v8 = scanline + v7, *(_DWORD *)&v4[v8 + 40] = data[16], *(_DWORD *)&v4[v8 + 44] = data[17], *(_DWORD *)&v4[v8 + 48] = data[18], *(_DWORD *)&v4[v8 + 52] = data[19], v9 = scanline + v8, *(_DWORD *)&v4[v9 + 36] = data[25], *(_DWORD *)&v4[v9 + 40] = data[26], *(_DWORD *)&v4[v9 + 44] = data[27], *(_DWORD *)&v4[v9 + 48] = data[28], *(_DWORD *)&v4[v9 + 52] = data[29], v10 = scanline + v9, *(_DWORD *)&v4[v10 + 32] = data[36], *(_DWORD *)&v4[v10 + 36] = data[37], *(_DWORD *)&v4[v10 + 40] = data[38], *(_DWORD *)&v4[v10 + 44] = data[39], *(_DWORD *)&v4[v10 + 48] = data[40], *(_DWORD *)&v4[v10 + 52] = data[41], v11 = scanline + v10, *(_DWORD *)&v4[v11 + 28] = data[49], *(_DWORD *)&v4[v11 + 32] = data[50], *(_DWORD *)&v4[v11 + 36] = data[51], *(_DWORD *)&v4[v11 + 40] = data[52], *(_DWORD *)&v4[v11 + 44] = data[53], *(_DWORD *)&v4[v11 + 48] = data[54], *(_DWORD *)&v4[v11 + 52] = data[55], v12 = scanline + v11, *(_DWORD *)&v4[v12 + 24] = data[64], *(_DWORD *)&v4[v12 + 28] = data[65], *(_DWORD *)&v4[v12 + 32] = data[66], *(_DWORD *)&v4[v12 + 36] = data[67], *(_DWORD *)&v4[v12 + 40] = data[68], *(_DWORD *)&v4[v12 + 44] = data[69], *(_DWORD *)&v4[v12 + 48] = data[70], *(_DWORD *)&v4[v12 + 52] = data[71], v13 = scanline + v12, *(_DWORD *)&v4[v13 + 20] = data[81], *(_DWORD *)&v4[v13 + 24] = data[82], *(_DWORD *)&v4[v13 + 28] = data[83], *(_DWORD *)&v4[v13 + 32] = data[84], *(_DWORD *)&v4[v13 + 36] = data[85], *(_DWORD *)&v4[v13 + 40] = data[86], *(_DWORD *)&v4[v13 + 44] = data[87], *(_DWORD *)&v4[v13 + 48] = data[88], *(_DWORD *)&v4[v13 + 52] = data[89], v14 = scanline + v13, *(_DWORD *)&v4[v14 + 16] = data[100], *(_DWORD *)&v4[v14 + 20] = data[101], *(_DWORD *)&v4[v14 + 24] = data[102], *(_DWORD *)&v4[v14 + 28] = data[103], *(_DWORD *)&v4[v14 + 32] = data[104], *(_DWORD *)&v4[v14 + 36] = data[105], *(_DWORD *)&v4[v14 + 40] = data[106], *(_DWORD *)&v4[v14 + 44] = data[107], *(_DWORD *)&v4[v14 + 48] = data[108], *(_DWORD *)&v4[v14 + 52] = data[109], v15 = scanline + v14, *(_DWORD *)&v4[v15 + 12] = data[121], *(_DWORD *)&v4[v15 + 16] = data[122], *(_DWORD *)&v4[v15 + 20] = data[123], *(_DWORD *)&v4[v15 + 24] = data[124], *(_DWORD *)&v4[v15 + 28] = data[125], *(_DWORD *)&v4[v15 + 32] = data[126], *(_DWORD *)&v4[v15 + 36] = data[127], *(_DWORD *)&v4[v15 + 40] = data[128], *(_DWORD *)&v4[v15 + 44] = data[129], *(_DWORD *)&v4[v15 + 48] = data[130], *(_DWORD *)&v4[v15 + 52] = data[131], v16 = scanline + v15, *(_DWORD *)&v4[v16 + 8] = data[144], *(_DWORD *)&v4[v16 + 12] = data[145], *(_DWORD *)&v4[v16 + 16] = data[146], *(_DWORD *)&v4[v16 + 20] = data[147], *(_DWORD *)&v4[v16 + 24] = data[148], *(_DWORD *)&v4[v16 + 28] = data[149], *(_DWORD *)&v4[v16 + 32] = data[150], *(_DWORD *)&v4[v16 + 36] = data[151], *(_DWORD *)&v4[v16 + 40] = data[152], *(_DWORD *)&v4[v16 + 44] = data[153], *(_DWORD *)&v4[v16 + 48] = data[154], *(_DWORD *)&v4[v16 + 52] = data[155], v17 = scanline + v16, *(_DWORD *)&v4[v17 + 4] = data[169], *(_DWORD *)&v4[v17 + 8] = data[170], *(_DWORD *)&v4[v17 + 12] = data[171], *(_DWORD *)&v4[v17 + 16] = data[172], *(_DWORD *)&v4[v17 + 20] = data[173], *(_DWORD *)&v4[v17 + 24] = data[174], *(_DWORD *)&v4[v17 + 28] = data[175], *(_DWORD *)&v4[v17 + 32] = data[176], *(_DWORD *)&v4[v17 + 36] = data[177], *(_DWORD *)&v4[v17 + 40] = data[178], *(_DWORD *)&v4[v17 + 44] = data[179], *(_DWORD *)&v4[v17 + 48] = data[180], *(_DWORD *)&v4[v17 + 52] = data[181], v18 = scanline + v17, *(_DWORD *)&v4[v18] = data[196], *(_DWORD *)&v4[v18 + 4] = data[197], *(_DWORD *)&v4[v18 + 8] = data[198], *(_DWORD *)&v4[v18 + 12] = data[199], *(_DWORD *)&v4[v18 + 16] = data[200], *(_DWORD *)&v4[v18 + 20] = data[201], *(_DWORD *)&v4[v18 + 24] = data[202], *(_DWORD *)&v4[v18 + 28] = data[203], *(_DWORD *)&v4[v18 + 32] = data[204], *(_DWORD *)&v4[v18 + 36] = data[205], *(_DWORD *)&v4[v18 + 40] = data[206], *(_DWORD *)&v4[v18 + 44] = data[207], *(_DWORD *)&v4[v18 + 48] = data[208], *(_DWORD *)&v4[v18 + 52] = data[209], v2 = scanline + v18, clipYcode != 4) ) { *(_DWORD *)&v4[v2] = data[225]; *(_DWORD *)&v4[v2 + 4] = data[226]; *(_DWORD *)&v4[v2 + 8] = data[227]; *(_DWORD *)&v4[v2 + 12] = data[228]; *(_DWORD *)&v4[v2 + 16] = data[229]; *(_DWORD *)&v4[v2 + 20] = data[230]; *(_DWORD *)&v4[v2 + 24] = data[231]; *(_DWORD *)&v4[v2 + 28] = data[232]; *(_DWORD *)&v4[v2 + 32] = data[233]; *(_DWORD *)&v4[v2 + 36] = data[234]; *(_DWORD *)&v4[v2 + 40] = data[235]; *(_DWORD *)&v4[v2 + 44] = data[236]; *(_DWORD *)&v4[v2 + 48] = data[237]; *(_DWORD *)&v4[v2 + 52] = data[238]; v19 = scanline + v2; *(_DWORD *)&v4[v19 + 4] = data[254]; *(_DWORD *)&v4[v19 + 8] = data[255]; *(_DWORD *)&v4[v19 + 12] = data[256]; *(_DWORD *)&v4[v19 + 16] = data[257]; *(_DWORD *)&v4[v19 + 20] = data[258]; *(_DWORD *)&v4[v19 + 24] = data[259]; *(_DWORD *)&v4[v19 + 28] = data[260]; *(_DWORD *)&v4[v19 + 32] = data[261]; *(_DWORD *)&v4[v19 + 36] = data[262]; *(_DWORD *)&v4[v19 + 40] = data[263]; *(_DWORD *)&v4[v19 + 44] = data[264]; *(_DWORD *)&v4[v19 + 48] = data[265]; *(_DWORD *)&v4[v19 + 52] = data[266]; v20 = scanline + v19; *(_DWORD *)&v4[v20 + 8] = data[281]; *(_DWORD *)&v4[v20 + 12] = data[282]; *(_DWORD *)&v4[v20 + 16] = data[283]; *(_DWORD *)&v4[v20 + 20] = data[284]; *(_DWORD *)&v4[v20 + 24] = data[285]; *(_DWORD *)&v4[v20 + 28] = data[286]; *(_DWORD *)&v4[v20 + 32] = data[287]; *(_DWORD *)&v4[v20 + 36] = data[288]; *(_DWORD *)&v4[v20 + 40] = data[289]; *(_DWORD *)&v4[v20 + 44] = data[290]; *(_DWORD *)&v4[v20 + 48] = data[291]; *(_DWORD *)&v4[v20 + 52] = data[292]; v21 = scanline + v20; *(_DWORD *)&v4[v21 + 12] = data[306]; *(_DWORD *)&v4[v21 + 16] = data[307]; *(_DWORD *)&v4[v21 + 20] = data[308]; *(_DWORD *)&v4[v21 + 24] = data[309]; *(_DWORD *)&v4[v21 + 28] = data[310]; *(_DWORD *)&v4[v21 + 32] = data[311]; *(_DWORD *)&v4[v21 + 36] = data[312]; *(_DWORD *)&v4[v21 + 40] = data[313]; *(_DWORD *)&v4[v21 + 44] = data[314]; *(_DWORD *)&v4[v21 + 48] = data[315]; *(_DWORD *)&v4[v21 + 52] = data[316]; v22 = scanline + v21; *(_DWORD *)&v4[v22 + 16] = data[329]; *(_DWORD *)&v4[v22 + 20] = data[330]; *(_DWORD *)&v4[v22 + 24] = data[331]; *(_DWORD *)&v4[v22 + 28] = data[332]; *(_DWORD *)&v4[v22 + 32] = data[333]; *(_DWORD *)&v4[v22 + 36] = data[334]; *(_DWORD *)&v4[v22 + 40] = data[335]; *(_DWORD *)&v4[v22 + 44] = data[336]; *(_DWORD *)&v4[v22 + 48] = data[337]; *(_DWORD *)&v4[v22 + 52] = data[338]; v23 = scanline + v22; *(_DWORD *)&v4[v23 + 20] = data[350]; *(_DWORD *)&v4[v23 + 24] = data[351]; *(_DWORD *)&v4[v23 + 28] = data[352]; *(_DWORD *)&v4[v23 + 32] = data[353]; *(_DWORD *)&v4[v23 + 36] = data[354]; *(_DWORD *)&v4[v23 + 40] = data[355]; *(_DWORD *)&v4[v23 + 44] = data[356]; *(_DWORD *)&v4[v23 + 48] = data[357]; *(_DWORD *)&v4[v23 + 52] = data[358]; v24 = scanline + v23; *(_DWORD *)&v4[v24 + 24] = data[369]; *(_DWORD *)&v4[v24 + 28] = data[370]; *(_DWORD *)&v4[v24 + 32] = data[371]; *(_DWORD *)&v4[v24 + 36] = data[372]; *(_DWORD *)&v4[v24 + 40] = data[373]; *(_DWORD *)&v4[v24 + 44] = data[374]; *(_DWORD *)&v4[v24 + 48] = data[375]; *(_DWORD *)&v4[v24 + 52] = data[376]; v25 = scanline + v24; *(_DWORD *)&v4[v25 + 28] = data[386]; *(_DWORD *)&v4[v25 + 32] = data[387]; *(_DWORD *)&v4[v25 + 36] = data[388]; *(_DWORD *)&v4[v25 + 40] = data[389]; *(_DWORD *)&v4[v25 + 44] = data[390]; *(_DWORD *)&v4[v25 + 48] = data[391];// 6606AC: using guessed type int ddraw_scanline; //----- (00426B50) -------------------------------------------------------- *(_DWORD *)&v4[v25 + 52] = data[392]; v26 = scanline + v25; *(_DWORD *)&v4[v26 + 32] = data[401]; *(_DWORD *)&v4[v26 + 36] = data[402]; *(_DWORD *)&v4[v26 + 40] = data[403]; *(_DWORD *)&v4[v26 + 44] = data[404]; *(_DWORD *)&v4[v26 + 48] = data[405]; *(_DWORD *)&v4[v26 + 52] = data[406]; v27 = scanline + v26; *(_DWORD *)&v4[v27 + 36] = data[414]; *(_DWORD *)&v4[v27 + 40] = data[415]; *(_DWORD *)&v4[v27 + 44] = data[416]; *(_DWORD *)&v4[v27 + 48] = data[417]; *(_DWORD *)&v4[v27 + 52] = data[418]; v28 = scanline + v27; *(_DWORD *)&v4[v28 + 40] = data[425]; *(_DWORD *)&v4[v28 + 44] = data[426]; *(_DWORD *)&v4[v28 + 48] = data[427]; *(_DWORD *)&v4[v28 + 52] = data[428]; v29 = scanline + v28; *(_DWORD *)&v4[v29 + 44] = data[434]; *(_DWORD *)&v4[v29 + 48] = data[435]; *(_DWORD *)&v4[v29 + 52] = data[436]; v30 = scanline + v29; *(_DWORD *)&v4[v30 + 48] = data[441]; *(_DWORD *)&v4[v30 + 52] = data[442]; *(_DWORD *)(&v4[v30 + 52] + scanline) = data[446]; } } } void fun_drawBuildingFootprint_xClipLeft_colored(int *data, int clipYcode) { int v2; // edx@1 int v3; // ecx@1 int v4; // ebx@1 char *v5; // edi@1 int v6; // edx@2 int v7; // edx@2 int v8; // edx@2 int v9; // edx@2 int v10; // edx@2 int v11; // edx@2 int v12; // edx@2 int v13; // edx@2 int v14; // edx@2 int v15; // edx@2 int v16; // edx@2 int v17; // edx@2 int v18; // edx@2 int v19; // edx@2 int v20; // edx@4 int v21; // edx@4 int v22; // edx@4 int v23; // edx@4 int v24; // edx@4 int v25; // edx@4 int v26; // edx@4 int v27; // edx@4 int v28; // edx@4 int v29; // edx@4 int v30; // edx@4 int v31; // edx@4 v5 = (char *)&ddraw_buffer[graphic_xOffset] + ddraw_scanline * graphic_yOffset; v4 = (unsigned __int16)drawGraphic_colorMask << 16; v4 = (v4 & 0xffff0000 ) + drawGraphic_colorMask; v2 = 0; v3 = ddraw_scanline; if ( clipYcode == 3 || (v6 = ddraw_scanline, *(_DWORD *)&v5[ddraw_scanline + 52] = v4 & data[1], v7 = v3 + v6, *(_DWORD *)&v5[v7 + 48] = v4 & data[4], *(_DWORD *)&v5[v7 + 52] = v4 & data[5], v8 = v3 + v7, *(_DWORD *)&v5[v8 + 44] = v4 & data[9], *(_DWORD *)&v5[v8 + 48] = v4 & data[10], *(_DWORD *)&v5[v8 + 52] = v4 & data[11], v9 = v3 + v8, *(_DWORD *)&v5[v9 + 40] = v4 & data[16], *(_DWORD *)&v5[v9 + 44] = v4 & data[17], *(_DWORD *)&v5[v9 + 48] = v4 & data[18], *(_DWORD *)&v5[v9 + 52] = v4 & data[19], v10 = v3 + v9, *(_DWORD *)&v5[v10 + 36] = v4 & data[25], *(_DWORD *)&v5[v10 + 40] = v4 & data[26], *(_DWORD *)&v5[v10 + 44] = v4 & data[27], *(_DWORD *)&v5[v10 + 48] = v4 & data[28], *(_DWORD *)&v5[v10 + 52] = v4 & data[29], v11 = v3 + v10, *(_DWORD *)&v5[v11 + 32] = v4 & data[36], *(_DWORD *)&v5[v11 + 36] = v4 & data[37], *(_DWORD *)&v5[v11 + 40] = v4 & data[38], *(_DWORD *)&v5[v11 + 44] = v4 & data[39], *(_DWORD *)&v5[v11 + 48] = v4 & data[40], *(_DWORD *)&v5[v11 + 52] = v4 & data[41], v12 = v3 + v11, *(_DWORD *)&v5[v12 + 28] = v4 & data[49], *(_DWORD *)&v5[v12 + 32] = v4 & data[50], *(_DWORD *)&v5[v12 + 36] = v4 & data[51], *(_DWORD *)&v5[v12 + 40] = v4 & data[52], *(_DWORD *)&v5[v12 + 44] = v4 & data[53], *(_DWORD *)&v5[v12 + 48] = v4 & data[54], *(_DWORD *)&v5[v12 + 52] = v4 & data[55], v13 = v3 + v12, *(_DWORD *)&v5[v13 + 24] = v4 & data[64], *(_DWORD *)&v5[v13 + 28] = v4 & data[65], *(_DWORD *)&v5[v13 + 32] = v4 & data[66], *(_DWORD *)&v5[v13 + 36] = v4 & data[67], *(_DWORD *)&v5[v13 + 40] = v4 & data[68], *(_DWORD *)&v5[v13 + 44] = v4 & data[69], *(_DWORD *)&v5[v13 + 48] = v4 & data[70], *(_DWORD *)&v5[v13 + 52] = v4 & data[71], v14 = v3 + v13, *(_DWORD *)&v5[v14 + 20] = v4 & data[81], *(_DWORD *)&v5[v14 + 24] = v4 & data[82], *(_DWORD *)&v5[v14 + 28] = v4 & data[83], *(_DWORD *)&v5[v14 + 32] = v4 & data[84], *(_DWORD *)&v5[v14 + 36] = v4 & data[85], *(_DWORD *)&v5[v14 + 40] = v4 & data[86], *(_DWORD *)&v5[v14 + 44] = v4 & data[87], *(_DWORD *)&v5[v14 + 48] = v4 & data[88], *(_DWORD *)&v5[v14 + 52] = v4 & data[89], v15 = v3 + v14, *(_DWORD *)&v5[v15 + 16] = v4 & data[100], *(_DWORD *)&v5[v15 + 20] = v4 & data[101], *(_DWORD *)&v5[v15 + 24] = v4 & data[102], *(_DWORD *)&v5[v15 + 28] = v4 & data[103], *(_DWORD *)&v5[v15 + 32] = v4 & data[104], *(_DWORD *)&v5[v15 + 36] = v4 & data[105], *(_DWORD *)&v5[v15 + 40] = v4 & data[106], *(_DWORD *)&v5[v15 + 44] = v4 & data[107], *(_DWORD *)&v5[v15 + 48] = v4 & data[108], *(_DWORD *)&v5[v15 + 52] = v4 & data[109], v16 = v3 + v15, *(_DWORD *)&v5[v16 + 12] = v4 & data[121], *(_DWORD *)&v5[v16 + 16] = v4 & data[122], *(_DWORD *)&v5[v16 + 20] = v4 & data[123], *(_DWORD *)&v5[v16 + 24] = v4 & data[124], *(_DWORD *)&v5[v16 + 28] = v4 & data[125], *(_DWORD *)&v5[v16 + 32] = v4 & data[126], *(_DWORD *)&v5[v16 + 36] = v4 & data[127], *(_DWORD *)&v5[v16 + 40] = v4 & data[128], *(_DWORD *)&v5[v16 + 44] = v4 & data[129], *(_DWORD *)&v5[v16 + 48] = v4 & data[130], *(_DWORD *)&v5[v16 + 52] = v4 & data[131], v17 = v3 + v16, *(_DWORD *)&v5[v17 + 8] = v4 & data[144], *(_DWORD *)&v5[v17 + 12] = v4 & data[145], *(_DWORD *)&v5[v17 + 16] = v4 & data[146], *(_DWORD *)&v5[v17 + 20] = v4 & data[147], *(_DWORD *)&v5[v17 + 24] = v4 & data[148], *(_DWORD *)&v5[v17 + 28] = v4 & data[149], *(_DWORD *)&v5[v17 + 32] = v4 & data[150], *(_DWORD *)&v5[v17 + 36] = v4 & data[151], *(_DWORD *)&v5[v17 + 40] = v4 & data[152], *(_DWORD *)&v5[v17 + 44] = v4 & data[153], *(_DWORD *)&v5[v17 + 48] = v4 & data[154], *(_DWORD *)&v5[v17 + 52] = v4 & data[155], v18 = v3 + v17, *(_DWORD *)&v5[v18 + 4] = v4 & data[169], *(_DWORD *)&v5[v18 + 8] = v4 & data[170], *(_DWORD *)&v5[v18 + 12] = v4 & data[171], *(_DWORD *)&v5[v18 + 16] = v4 & data[172], *(_DWORD *)&v5[v18 + 20] = v4 & data[173], *(_DWORD *)&v5[v18 + 24] = v4 & data[174], *(_DWORD *)&v5[v18 + 28] = v4 & data[175], *(_DWORD *)&v5[v18 + 32] = v4 & data[176], *(_DWORD *)&v5[v18 + 36] = v4 & data[177], *(_DWORD *)&v5[v18 + 40] = v4 & data[178], *(_DWORD *)&v5[v18 + 44] = v4 & data[179], *(_DWORD *)&v5[v18 + 48] = v4 & data[180], *(_DWORD *)&v5[v18 + 52] = v4 & data[181], v19 = v3 + v18, *(_DWORD *)&v5[v19] = v4 & data[196], *(_DWORD *)&v5[v19 + 4] = v4 & data[197], *(_DWORD *)&v5[v19 + 8] = v4 & data[198], *(_DWORD *)&v5[v19 + 12] = v4 & data[199], *(_DWORD *)&v5[v19 + 16] = v4 & data[200], *(_DWORD *)&v5[v19 + 20] = v4 & data[201], *(_DWORD *)&v5[v19 + 24] = v4 & data[202], *(_DWORD *)&v5[v19 + 28] = v4 & data[203], *(_DWORD *)&v5[v19 + 32] = v4 & data[204], *(_DWORD *)&v5[v19 + 36] = v4 & data[205], *(_DWORD *)&v5[v19 + 40] = v4 & data[206], *(_DWORD *)&v5[v19 + 44] = v4 & data[207], *(_DWORD *)&v5[v19 + 48] = v4 & data[208], *(_DWORD *)&v5[v19 + 52] = v4 & data[209], v2 = v3 + v19, clipYcode != 4) ) { *(_DWORD *)&v5[v2] = v4 & data[225]; *(_DWORD *)&v5[v2 + 4] = v4 & data[226]; *(_DWORD *)&v5[v2 + 8] = v4 & data[227]; *(_DWORD *)&v5[v2 + 12] = v4 & data[228]; *(_DWORD *)&v5[v2 + 16] = v4 & data[229]; *(_DWORD *)&v5[v2 + 20] = v4 & data[230]; *(_DWORD *)&v5[v2 + 24] = v4 & data[231]; *(_DWORD *)&v5[v2 + 28] = v4 & data[232]; *(_DWORD *)&v5[v2 + 32] = v4 & data[233]; *(_DWORD *)&v5[v2 + 36] = v4 & data[234]; *(_DWORD *)&v5[v2 + 40] = v4 & data[235]; *(_DWORD *)&v5[v2 + 44] = v4 & data[236]; *(_DWORD *)&v5[v2 + 48] = v4 & data[237]; *(_DWORD *)&v5[v2 + 52] = v4 & data[238]; v20 = v3 + v2; *(_DWORD *)&v5[v20 + 4] = v4 & data[254]; *(_DWORD *)&v5[v20 + 8] = v4 & data[255]; *(_DWORD *)&v5[v20 + 12] = v4 & data[256]; *(_DWORD *)&v5[v20 + 16] = v4 & data[257]; *(_DWORD *)&v5[v20 + 20] = v4 & data[258]; *(_DWORD *)&v5[v20 + 24] = v4 & data[259]; *(_DWORD *)&v5[v20 + 28] = v4 & data[260]; *(_DWORD *)&v5[v20 + 32] = v4 & data[261]; *(_DWORD *)&v5[v20 + 36] = v4 & data[262]; *(_DWORD *)&v5[v20 + 40] = v4 & data[263]; *(_DWORD *)&v5[v20 + 44] = v4 & data[264]; *(_DWORD *)&v5[v20 + 48] = v4 & data[265]; *(_DWORD *)&v5[v20 + 52] = v4 & data[266]; v21 = v3 + v20; *(_DWORD *)&v5[v21 + 8] = v4 & data[281]; *(_DWORD *)&v5[v21 + 12] = v4 & data[282]; *(_DWORD *)&v5[v21 + 16] = v4 & data[283]; *(_DWORD *)&v5[v21 + 20] = v4 & data[284]; *(_DWORD *)&v5[v21 + 24] = v4 & data[285]; *(_DWORD *)&v5[v21 + 28] = v4 & data[286]; *(_DWORD *)&v5[v21 + 32] = v4 & data[287]; *(_DWORD *)&v5[v21 + 36] = v4 & data[288]; *(_DWORD *)&v5[v21 + 40] = v4 & data[289]; *(_DWORD *)&v5[v21 + 44] = v4 & data[290]; *(_DWORD *)&v5[v21 + 48] = v4 & data[291]; *(_DWORD *)&v5[v21 + 52] = v4 & data[292]; v22 = v3 + v21; *(_DWORD *)&v5[v22 + 12] = v4 & data[306]; *(_DWORD *)&v5[v22 + 16] = v4 & data[307]; *(_DWORD *)&v5[v22 + 20] = v4 & data[308]; *(_DWORD *)&v5[v22 + 24] = v4 & data[309]; *(_DWORD *)&v5[v22 + 28] = v4 & data[310]; *(_DWORD *)&v5[v22 + 32] = v4 & data[311]; *(_DWORD *)&v5[v22 + 36] = v4 & data[312]; *(_DWORD *)&v5[v22 + 40] = v4 & data[313]; *(_DWORD *)&v5[v22 + 44] = v4 & data[314]; *(_DWORD *)&v5[v22 + 48] = v4 & data[315]; *(_DWORD *)&v5[v22 + 52] = v4 & data[316]; v23 = v3 + v22; *(_DWORD *)&v5[v23 + 16] = v4 & data[329]; *(_DWORD *)&v5[v23 + 20] = v4 & data[330]; *(_DWORD *)&v5[v23 + 24] = v4 & data[331]; *(_DWORD *)&v5[v23 + 28] = v4 & data[332]; *(_DWORD *)&v5[v23 + 32] = v4 & data[333]; *(_DWORD *)&v5[v23 + 36] = v4 & data[334]; *(_DWORD *)&v5[v23 + 40] = v4 & data[335]; *(_DWORD *)&v5[v23 + 44] = v4 & data[336]; *(_DWORD *)&v5[v23 + 48] = v4 & data[337]; *(_DWORD *)&v5[v23 + 52] = v4 & data[338]; v24 = v3 + v23; *(_DWORD *)&v5[v24 + 20] = v4 & data[350]; *(_DWORD *)&v5[v24 + 24] = v4 & data[351]; *(_DWORD *)&v5[v24 + 28] = v4 & data[352]; *(_DWORD *)&v5[v24 + 32] = v4 & data[353]; *(_DWORD *)&v5[v24 + 36] = v4 & data[354]; *(_DWORD *)&v5[v24 + 40] = v4 & data[355]; *(_DWORD *)&v5[v24 + 44] = v4 & data[356]; *(_DWORD *)&v5[v24 + 48] = v4 & data[357]; *(_DWORD *)&v5[v24 + 52] = v4 & data[358]; v25 = v3 + v24; *(_DWORD *)&v5[v25 + 24] = v4 & data[369]; *(_DWORD *)&v5[v25 + 28] = v4 & data[370]; *(_DWORD *)&v5[v25 + 32] = v4 & data[371]; *(_DWORD *)&v5[v25 + 36] = v4 & data[372]; *(_DWORD *)&v5[v25 + 40] = v4 & data[373]; *(_DWORD *)&v5[v25 + 44] = v4 & data[374]; *(_DWORD *)&v5[v25 + 48] = v4 & data[375]; *(_DWORD *)&v5[v25 + 52] = v4 & data[376]; v26 = v3 + v25; *(_DWORD *)&v5[v26 + 28] = v4 & data[386]; *(_DWORD *)&v5[v26 + 32] = v4 & data[387]; *(_DWORD *)&v5[v26 + 36] = v4 & data[388]; *(_DWORD *)&v5[v26 + 40] = v4 & data[389]; *(_DWORD *)&v5[v26 + 44] = v4 & data[390]; *(_DWORD *)&v5[v26 + 48] = v4 & data[391]; *(_DWORD *)&v5[v26 + 52] = v4 & data[392]; v27 = v3 + v26; *(_DWORD *)&v5[v27 + 32] = v4 & data[401]; *(_DWORD *)&v5[v27 + 36] = v4 & data[402]; *(_DWORD *)&v5[v27 + 40] = v4 & data[403]; *(_DWORD *)&v5[v27 + 44] = v4 & data[404]; *(_DWORD *)&v5[v27 + 48] = v4 & data[405]; *(_DWORD *)&v5[v27 + 52] = v4 & data[406]; v28 = v3 + v27; *(_DWORD *)&v5[v28 + 36] = v4 & data[414]; *(_DWORD *)&v5[v28 + 40] = v4 & data[415]; *(_DWORD *)&v5[v28 + 44] = v4 & data[416]; *(_DWORD *)&v5[v28 + 48] = v4 & data[417]; *(_DWORD *)&v5[v28 + 52] = v4 & data[418]; v29 = v3 + v28; *(_DWORD *)&v5[v29 + 40] = v4 & data[425]; *(_DWORD *)&v5[v29 + 44] = v4 & data[426]; *(_DWORD *)&v5[v29 + 48] = v4 & data[427]; *(_DWORD *)&v5[v29 + 52] = v4 & data[428]; v30 = v3 + v29; *(_DWORD *)&v5[v30 + 44] = v4 & data[434]; *(_DWORD *)&v5[v30 + 48] = v4 & data[435]; *(_DWORD *)&v5[v30 + 52] = v4 & data[436]; v31 = v3 + v30; *(_DWORD *)&v5[v31 + 48] = v4 & data[441]; *(_DWORD *)&v5[v31 + 52] = v4 & data[442]; *(_DWORD *)(&v5[v31 + 52] + v3) = v4 & data[446]; } } void unused_grabBuildingFootprintTileFromBuffer(char *buffer, int *data, int scanline) { char *source; // esi@1 source = &buffer[2 * graphic_xOffset] + 2 * scanline * graphic_yOffset; *data = *((_DWORD *)source + 14); data[1] = *(_DWORD *)&source[2 * scanline + 52]; data[2] = *(_DWORD *)&source[2 * scanline + 56]; data[3] = *(_DWORD *)&source[2 * scanline + 60]; data[4] = *(_DWORD *)&source[4 * scanline + 48]; data[5] = *(_DWORD *)&source[4 * scanline + 52]; data[6] = *(_DWORD *)&source[4 * scanline + 56]; data[7] = *(_DWORD *)&source[4 * scanline + 60]; data[8] = *(_DWORD *)&source[4 * scanline + 64]; data[9] = *(_DWORD *)&source[6 * scanline + 44]; data[10] = *(_DWORD *)&source[6 * scanline + 48]; data[11] = *(_DWORD *)&source[6 * scanline + 52]; data[12] = *(_DWORD *)&source[6 * scanline + 56]; data[13] = *(_DWORD *)&source[6 * scanline + 60]; data[14] = *(_DWORD *)&source[6 * scanline + 64]; data[15] = *(_DWORD *)&source[6 * scanline + 68]; data[16] = *(_DWORD *)&source[8 * scanline + 40]; data[17] = *(_DWORD *)&source[8 * scanline + 44]; data[18] = *(_DWORD *)&source[8 * scanline + 48]; data[19] = *(_DWORD *)&source[8 * scanline + 52]; data[20] = *(_DWORD *)&source[8 * scanline + 56]; data[21] = *(_DWORD *)&source[8 * scanline + 60]; data[22] = *(_DWORD *)&source[8 * scanline + 64]; data[23] = *(_DWORD *)&source[8 * scanline + 68]; data[24] = *(_DWORD *)&source[8 * scanline + 72]; data[25] = *(_DWORD *)&source[10 * scanline + 36]; data[26] = *(_DWORD *)&source[10 * scanline + 40]; data[27] = *(_DWORD *)&source[10 * scanline + 44]; data[28] = *(_DWORD *)&source[10 * scanline + 48]; data[29] = *(_DWORD *)&source[10 * scanline + 52]; data[30] = *(_DWORD *)&source[10 * scanline + 56]; data[31] = *(_DWORD *)&source[10 * scanline + 60]; data[32] = *(_DWORD *)&source[10 * scanline + 64]; data[33] = *(_DWORD *)&source[10 * scanline + 68]; data[34] = *(_DWORD *)&source[10 * scanline + 72]; data[35] = *(_DWORD *)&source[10 * scanline + 76]; data[36] = *(_DWORD *)&source[12 * scanline + 32]; data[37] = *(_DWORD *)&source[12 * scanline + 36]; data[38] = *(_DWORD *)&source[12 * scanline + 40]; data[39] = *(_DWORD *)&source[12 * scanline + 44]; data[40] = *(_DWORD *)&source[12 * scanline + 48]; data[41] = *(_DWORD *)&source[12 * scanline + 52]; data[42] = *(_DWORD *)&source[12 * scanline + 56]; data[43] = *(_DWORD *)&source[12 * scanline + 60]; data[44] = *(_DWORD *)&source[12 * scanline + 64]; data[45] = *(_DWORD *)&source[12 * scanline + 68]; data[46] = *(_DWORD *)&source[12 * scanline + 72]; data[47] = *(_DWORD *)&source[12 * scanline + 76]; data[48] = *(_DWORD *)&source[12 * scanline + 80]; data[49] = *(_DWORD *)&source[14 * scanline + 28]; data[50] = *(_DWORD *)&source[14 * scanline + 32]; data[51] = *(_DWORD *)&source[14 * scanline + 36]; data[52] = *(_DWORD *)&source[14 * scanline + 40]; data[53] = *(_DWORD *)&source[14 * scanline + 44]; data[54] = *(_DWORD *)&source[14 * scanline + 48]; data[55] = *(_DWORD *)&source[14 * scanline + 52]; data[56] = *(_DWORD *)&source[14 * scanline + 56]; data[57] = *(_DWORD *)&source[14 * scanline + 60]; data[58] = *(_DWORD *)&source[14 * scanline + 64]; data[59] = *(_DWORD *)&source[14 * scanline + 68]; data[60] = *(_DWORD *)&source[14 * scanline + 72]; data[61] = *(_DWORD *)&source[14 * scanline + 76]; data[62] = *(_DWORD *)&source[14 * scanline + 80]; data[63] = *(_DWORD *)&source[14 * scanline + 84]; data[64] = *(_DWORD *)&source[16 * scanline + 24]; data[65] = *(_DWORD *)&source[16 * scanline + 28]; data[66] = *(_DWORD *)&source[16 * scanline + 32]; data[67] = *(_DWORD *)&source[16 * scanline + 36]; data[68] = *(_DWORD *)&source[16 * scanline + 40]; data[69] = *(_DWORD *)&source[16 * scanline + 44]; data[70] = *(_DWORD *)&source[16 * scanline + 48]; data[71] = *(_DWORD *)&source[16 * scanline + 52]; data[72] = *(_DWORD *)&source[16 * scanline + 56]; data[73] = *(_DWORD *)&source[16 * scanline + 60]; data[74] = *(_DWORD *)&source[16 * scanline + 64]; data[75] = *(_DWORD *)&source[16 * scanline + 68]; data[76] = *(_DWORD *)&source[16 * scanline + 72]; data[77] = *(_DWORD *)&source[16 * scanline + 76]; data[78] = *(_DWORD *)&source[16 * scanline + 80]; data[79] = *(_DWORD *)&source[16 * scanline + 84]; data[80] = *(_DWORD *)&source[16 * scanline + 88]; data[81] = *(_DWORD *)&source[18 * scanline + 20]; data[82] = *(_DWORD *)&source[18 * scanline + 24]; data[83] = *(_DWORD *)&source[18 * scanline + 28]; data[84] = *(_DWORD *)&source[18 * scanline + 32]; data[85] = *(_DWORD *)&source[18 * scanline + 36]; data[86] = *(_DWORD *)&source[18 * scanline + 40]; data[87] = *(_DWORD *)&source[18 * scanline + 44]; data[88] = *(_DWORD *)&source[18 * scanline + 48]; data[89] = *(_DWORD *)&source[18 * scanline + 52]; data[90] = *(_DWORD *)&source[18 * scanline + 56]; data[91] = *(_DWORD *)&source[18 * scanline + 60]; data[92] = *(_DWORD *)&source[18 * scanline + 64]; data[93] = *(_DWORD *)&source[18 * scanline + 68]; data[94] = *(_DWORD *)&source[18 * scanline + 72]; data[95] = *(_DWORD *)&source[18 * scanline + 76]; data[96] = *(_DWORD *)&source[18 * scanline + 80]; data[97] = *(_DWORD *)&source[18 * scanline + 84]; data[98] = *(_DWORD *)&source[18 * scanline + 88]; data[99] = *(_DWORD *)&source[18 * scanline + 92]; data[100] = *(_DWORD *)&source[20 * scanline + 16]; data[101] = *(_DWORD *)&source[20 * scanline + 20]; data[102] = *(_DWORD *)&source[20 * scanline + 24]; data[103] = *(_DWORD *)&source[20 * scanline + 28]; data[104] = *(_DWORD *)&source[20 * scanline + 32]; data[105] = *(_DWORD *)&source[20 * scanline + 36]; data[106] = *(_DWORD *)&source[20 * scanline + 40]; data[107] = *(_DWORD *)&source[20 * scanline + 44]; data[108] = *(_DWORD *)&source[20 * scanline + 48]; data[109] = *(_DWORD *)&source[20 * scanline + 52]; data[110] = *(_DWORD *)&source[20 * scanline + 56]; data[111] = *(_DWORD *)&source[20 * scanline + 60]; data[112] = *(_DWORD *)&source[20 * scanline + 64]; data[113] = *(_DWORD *)&source[20 * scanline + 68]; data[114] = *(_DWORD *)&source[20 * scanline + 72]; data[115] = *(_DWORD *)&source[20 * scanline + 76]; data[116] = *(_DWORD *)&source[20 * scanline + 80]; data[117] = *(_DWORD *)&source[20 * scanline + 84]; data[118] = *(_DWORD *)&source[20 * scanline + 88]; data[119] = *(_DWORD *)&source[20 * scanline + 92]; data[120] = *(_DWORD *)&source[20 * scanline + 96]; data[121] = *(_DWORD *)&source[22 * scanline + 12]; data[122] = *(_DWORD *)&source[22 * scanline + 16]; data[123] = *(_DWORD *)&source[22 * scanline + 20]; data[124] = *(_DWORD *)&source[22 * scanline + 24]; data[125] = *(_DWORD *)&source[22 * scanline + 28]; data[126] = *(_DWORD *)&source[22 * scanline + 32]; data[127] = *(_DWORD *)&source[22 * scanline + 36]; data[128] = *(_DWORD *)&source[22 * scanline + 40]; data[129] = *(_DWORD *)&source[22 * scanline + 44]; data[130] = *(_DWORD *)&source[22 * scanline + 48]; data[131] = *(_DWORD *)&source[22 * scanline + 52]; data[132] = *(_DWORD *)&source[22 * scanline + 56]; data[133] = *(_DWORD *)&source[22 * scanline + 60]; data[134] = *(_DWORD *)&source[22 * scanline + 64]; data[135] = *(_DWORD *)&source[22 * scanline + 68]; data[136] = *(_DWORD *)&source[22 * scanline + 72]; data[137] = *(_DWORD *)&source[22 * scanline + 76]; data[138] = *(_DWORD *)&source[22 * scanline + 80]; data[139] = *(_DWORD *)&source[22 * scanline + 84]; data[140] = *(_DWORD *)&source[22 * scanline + 88]; data[141] = *(_DWORD *)&source[22 * scanline + 92]; data[142] = *(_DWORD *)&source[22 * scanline + 96]; data[143] = *(_DWORD *)&source[22 * scanline + 100]; data[144] = *(_DWORD *)&source[24 * scanline + 8]; data[145] = *(_DWORD *)&source[24 * scanline + 12]; data[146] = *(_DWORD *)&source[24 * scanline + 16]; data[147] = *(_DWORD *)&source[24 * scanline + 20]; data[148] = *(_DWORD *)&source[24 * scanline + 24]; data[149] = *(_DWORD *)&source[24 * scanline + 28]; data[150] = *(_DWORD *)&source[24 * scanline + 32]; data[151] = *(_DWORD *)&source[24 * scanline + 36]; data[152] = *(_DWORD *)&source[24 * scanline + 40]; data[153] = *(_DWORD *)&source[24 * scanline + 44]; data[154] = *(_DWORD *)&source[24 * scanline + 48]; data[155] = *(_DWORD *)&source[24 * scanline + 52]; data[156] = *(_DWORD *)&source[24 * scanline + 56]; data[157] = *(_DWORD *)&source[24 * scanline + 60]; data[158] = *(_DWORD *)&source[24 * scanline + 64]; data[159] = *(_DWORD *)&source[24 * scanline + 68]; data[160] = *(_DWORD *)&source[24 * scanline + 72]; data[161] = *(_DWORD *)&source[24 * scanline + 76]; data[162] = *(_DWORD *)&source[24 * scanline + 80]; data[163] = *(_DWORD *)&source[24 * scanline + 84]; data[164] = *(_DWORD *)&source[24 * scanline + 88]; data[165] = *(_DWORD *)&source[24 * scanline + 92]; data[166] = *(_DWORD *)&source[24 * scanline + 96]; data[167] = *(_DWORD *)&source[24 * scanline + 100]; data[168] = *(_DWORD *)&source[24 * scanline + 104]; data[169] = *(_DWORD *)&source[26 * scanline + 4]; data[170] = *(_DWORD *)&source[26 * scanline + 8]; data[171] = *(_DWORD *)&source[26 * scanline + 12]; data[172] = *(_DWORD *)&source[26 * scanline + 16]; data[173] = *(_DWORD *)&source[26 * scanline + 20]; data[174] = *(_DWORD *)&source[26 * scanline + 24]; data[175] = *(_DWORD *)&source[26 * scanline + 28]; data[176] = *(_DWORD *)&source[26 * scanline + 32]; data[177] = *(_DWORD *)&source[26 * scanline + 36]; data[178] = *(_DWORD *)&source[26 * scanline + 40]; data[179] = *(_DWORD *)&source[26 * scanline + 44]; data[180] = *(_DWORD *)&source[26 * scanline + 48]; data[181] = *(_DWORD *)&source[26 * scanline + 52]; data[182] = *(_DWORD *)&source[26 * scanline + 56]; data[183] = *(_DWORD *)&source[26 * scanline + 60]; data[184] = *(_DWORD *)&source[26 * scanline + 64]; data[185] = *(_DWORD *)&source[26 * scanline + 68]; data[186] = *(_DWORD *)&source[26 * scanline + 72]; data[187] = *(_DWORD *)&source[26 * scanline + 76]; data[188] = *(_DWORD *)&source[26 * scanline + 80]; data[189] = *(_DWORD *)&source[26 * scanline + 84]; data[190] = *(_DWORD *)&source[26 * scanline + 88]; data[191] = *(_DWORD *)&source[26 * scanline + 92]; data[192] = *(_DWORD *)&source[26 * scanline + 96]; data[193] = *(_DWORD *)&source[26 * scanline + 100]; data[194] = *(_DWORD *)&source[26 * scanline + 104]; data[195] = *(_DWORD *)&source[26 * scanline + 108]; data[196] = *(_DWORD *)&source[28 * scanline]; data[197] = *(_DWORD *)&source[28 * scanline + 4]; data[198] = *(_DWORD *)&source[28 * scanline + 8]; data[199] = *(_DWORD *)&source[28 * scanline + 12]; data[200] = *(_DWORD *)&source[28 * scanline + 16]; data[201] = *(_DWORD *)&source[28 * scanline + 20]; data[202] = *(_DWORD *)&source[28 * scanline + 24]; data[203] = *(_DWORD *)&source[28 * scanline + 28]; data[204] = *(_DWORD *)&source[28 * scanline + 32]; data[205] = *(_DWORD *)&source[28 * scanline + 36]; data[206] = *(_DWORD *)&source[28 * scanline + 40]; data[207] = *(_DWORD *)&source[28 * scanline + 44]; data[208] = *(_DWORD *)&source[28 * scanline + 48]; data[209] = *(_DWORD *)&source[28 * scanline + 52]; data[210] = *(_DWORD *)&source[28 * scanline + 56]; data[211] = *(_DWORD *)&source[28 * scanline + 60]; data[212] = *(_DWORD *)&source[28 * scanline + 64]; data[213] = *(_DWORD *)&source[28 * scanline + 68]; data[214] = *(_DWORD *)&source[28 * scanline + 72]; data[215] = *(_DWORD *)&source[28 * scanline + 76]; data[216] = *(_DWORD *)&source[28 * scanline + 80]; data[217] = *(_DWORD *)&source[28 * scanline + 84]; data[218] = *(_DWORD *)&source[28 * scanline + 88]; data[219] = *(_DWORD *)&source[28 * scanline + 92]; data[220] = *(_DWORD *)&source[28 * scanline + 96]; data[221] = *(_DWORD *)&source[28 * scanline + 100]; data[222] = *(_DWORD *)&source[28 * scanline + 104]; data[223] = *(_DWORD *)&source[28 * scanline + 108]; data[224] = *(_DWORD *)&source[28 * scanline + 112]; data[225] = *(_DWORD *)&source[30 * scanline]; data[226] = *(_DWORD *)&source[30 * scanline + 4]; data[227] = *(_DWORD *)&source[30 * scanline + 8]; data[228] = *(_DWORD *)&source[30 * scanline + 12]; data[229] = *(_DWORD *)&source[30 * scanline + 16]; data[230] = *(_DWORD *)&source[30 * scanline + 20]; data[231] = *(_DWORD *)&source[30 * scanline + 24]; data[232] = *(_DWORD *)&source[30 * scanline + 28]; data[233] = *(_DWORD *)&source[30 * scanline + 32]; data[234] = *(_DWORD *)&source[30 * scanline + 36]; data[235] = *(_DWORD *)&source[30 * scanline + 40]; data[236] = *(_DWORD *)&source[30 * scanline + 44]; data[237] = *(_DWORD *)&source[30 * scanline + 48]; data[238] = *(_DWORD *)&source[30 * scanline + 52]; data[239] = *(_DWORD *)&source[30 * scanline + 56]; data[240] = *(_DWORD *)&source[30 * scanline + 60]; data[241] = *(_DWORD *)&source[30 * scanline + 64]; data[242] = *(_DWORD *)&source[30 * scanline + 68]; data[243] = *(_DWORD *)&source[30 * scanline + 72]; data[244] = *(_DWORD *)&source[30 * scanline + 76]; data[245] = *(_DWORD *)&source[30 * scanline + 80]; data[246] = *(_DWORD *)&source[30 * scanline + 84]; data[247] = *(_DWORD *)&source[30 * scanline + 88]; data[248] = *(_DWORD *)&source[30 * scanline + 92]; data[249] = *(_DWORD *)&source[30 * scanline + 96]; data[250] = *(_DWORD *)&source[30 * scanline + 100]; data[251] = *(_DWORD *)&source[30 * scanline + 104]; data[252] = *(_DWORD *)&source[30 * scanline + 108]; data[253] = *(_DWORD *)&source[30 * scanline + 112]; data[254] = *(_DWORD *)&source[32 * scanline + 4]; data[255] = *(_DWORD *)&source[32 * scanline + 8]; data[256] = *(_DWORD *)&source[32 * scanline + 12]; data[257] = *(_DWORD *)&source[32 * scanline + 16]; data[258] = *(_DWORD *)&source[32 * scanline + 20]; data[259] = *(_DWORD *)&source[32 * scanline + 24]; data[260] = *(_DWORD *)&source[32 * scanline + 28]; data[261] = *(_DWORD *)&source[32 * scanline + 32]; data[262] = *(_DWORD *)&source[32 * scanline + 36]; data[263] = *(_DWORD *)&source[32 * scanline + 40]; data[264] = *(_DWORD *)&source[32 * scanline + 44]; data[265] = *(_DWORD *)&source[32 * scanline + 48]; data[266] = *(_DWORD *)&source[32 * scanline + 52]; data[267] = *(_DWORD *)&source[32 * scanline + 56]; data[268] = *(_DWORD *)&source[32 * scanline + 60]; data[269] = *(_DWORD *)&source[32 * scanline + 64]; data[270] = *(_DWORD *)&source[32 * scanline + 68]; data[271] = *(_DWORD *)&source[32 * scanline + 72]; data[272] = *(_DWORD *)&source[32 * scanline + 76]; data[273] = *(_DWORD *)&source[32 * scanline + 80]; data[274] = *(_DWORD *)&source[32 * scanline + 84]; data[275] = *(_DWORD *)&source[32 * scanline + 88]; data[276] = *(_DWORD *)&source[32 * scanline + 92]; data[277] = *(_DWORD *)&source[32 * scanline + 96]; data[278] = *(_DWORD *)&source[32 * scanline + 100]; data[279] = *(_DWORD *)&source[32 * scanline + 104]; data[280] = *(_DWORD *)&source[32 * scanline + 108]; data[281] = *(_DWORD *)&source[34 * scanline + 8]; data[282] = *(_DWORD *)&source[34 * scanline + 12]; data[283] = *(_DWORD *)&source[34 * scanline + 16]; data[284] = *(_DWORD *)&source[34 * scanline + 20]; data[285] = *(_DWORD *)&source[34 * scanline + 24]; data[286] = *(_DWORD *)&source[34 * scanline + 28]; data[287] = *(_DWORD *)&source[34 * scanline + 32]; data[288] = *(_DWORD *)&source[34 * scanline + 36]; data[289] = *(_DWORD *)&source[34 * scanline + 40]; data[290] = *(_DWORD *)&source[34 * scanline + 44]; data[291] = *(_DWORD *)&source[34 * scanline + 48]; data[292] = *(_DWORD *)&source[34 * scanline + 52]; data[293] = *(_DWORD *)&source[34 * scanline + 56]; data[294] = *(_DWORD *)&source[34 * scanline + 60]; data[295] = *(_DWORD *)&source[34 * scanline + 64]; data[296] = *(_DWORD *)&source[34 * scanline + 68]; data[297] = *(_DWORD *)&source[34 * scanline + 72]; data[298] = *(_DWORD *)&source[34 * scanline + 76]; data[299] = *(_DWORD *)&source[34 * scanline + 80]; data[300] = *(_DWORD *)&source[34 * scanline + 84]; data[301] = *(_DWORD *)&source[34 * scanline + 88]; data[302] = *(_DWORD *)&source[34 * scanline + 92]; data[303] = *(_DWORD *)&source[34 * scanline + 96]; data[304] = *(_DWORD *)&source[34 * scanline + 100]; data[305] = *(_DWORD *)&source[34 * scanline + 104]; data[306] = *(_DWORD *)&source[36 * scanline + 12]; data[307] = *(_DWORD *)&source[36 * scanline + 16]; data[308] = *(_DWORD *)&source[36 * scanline + 20]; data[309] = *(_DWORD *)&source[36 * scanline + 24]; data[310] = *(_DWORD *)&source[36 * scanline + 28]; data[311] = *(_DWORD *)&source[36 * scanline + 32]; data[312] = *(_DWORD *)&source[36 * scanline + 36]; data[313] = *(_DWORD *)&source[36 * scanline + 40]; data[314] = *(_DWORD *)&source[36 * scanline + 44]; data[315] = *(_DWORD *)&source[36 * scanline + 48]; data[316] = *(_DWORD *)&source[36 * scanline + 52]; data[317] = *(_DWORD *)&source[36 * scanline + 56]; data[318] = *(_DWORD *)&source[36 * scanline + 60]; data[319] = *(_DWORD *)&source[36 * scanline + 64]; data[320] = *(_DWORD *)&source[36 * scanline + 68]; data[321] = *(_DWORD *)&source[36 * scanline + 72]; data[322] = *(_DWORD *)&source[36 * scanline + 76]; data[323] = *(_DWORD *)&source[36 * scanline + 80]; data[324] = *(_DWORD *)&source[36 * scanline + 84]; data[325] = *(_DWORD *)&source[36 * scanline + 88]; data[326] = *(_DWORD *)&source[36 * scanline + 92]; data[327] = *(_DWORD *)&source[36 * scanline + 96]; data[328] = *(_DWORD *)&source[36 * scanline + 100]; data[329] = *(_DWORD *)&source[38 * scanline + 16]; data[330] = *(_DWORD *)&source[38 * scanline + 20]; data[331] = *(_DWORD *)&source[38 * scanline + 24]; data[332] = *(_DWORD *)&source[38 * scanline + 28]; data[333] = *(_DWORD *)&source[38 * scanline + 32]; data[334] = *(_DWORD *)&source[38 * scanline + 36]; data[335] = *(_DWORD *)&source[38 * scanline + 40]; data[336] = *(_DWORD *)&source[38 * scanline + 44]; data[337] = *(_DWORD *)&source[38 * scanline + 48]; data[338] = *(_DWORD *)&source[38 * scanline + 52]; data[339] = *(_DWORD *)&source[38 * scanline + 56]; data[340] = *(_DWORD *)&source[38 * scanline + 60]; data[341] = *(_DWORD *)&source[38 * scanline + 64]; data[342] = *(_DWORD *)&source[38 * scanline + 68]; data[343] = *(_DWORD *)&source[38 * scanline + 72]; data[344] = *(_DWORD *)&source[38 * scanline + 76]; data[345] = *(_DWORD *)&source[38 * scanline + 80]; data[346] = *(_DWORD *)&source[38 * scanline + 84]; data[347] = *(_DWORD *)&source[38 * scanline + 88]; data[348] = *(_DWORD *)&source[38 * scanline + 92]; data[349] = *(_DWORD *)&source[38 * scanline + 96]; data[350] = *(_DWORD *)&source[40 * scanline + 20]; data[351] = *(_DWORD *)&source[40 * scanline + 24]; data[352] = *(_DWORD *)&source[40 * scanline + 28]; data[353] = *(_DWORD *)&source[40 * scanline + 32]; data[354] = *(_DWORD *)&source[40 * scanline + 36]; data[355] = *(_DWORD *)&source[40 * scanline + 40]; data[356] = *(_DWORD *)&source[40 * scanline + 44]; data[357] = *(_DWORD *)&source[40 * scanline + 48]; data[358] = *(_DWORD *)&source[40 * scanline + 52]; data[359] = *(_DWORD *)&source[40 * scanline + 56]; data[360] = *(_DWORD *)&source[40 * scanline + 60]; data[361] = *(_DWORD *)&source[40 * scanline + 64]; data[362] = *(_DWORD *)&source[40 * scanline + 68]; data[363] = *(_DWORD *)&source[40 * scanline + 72]; data[364] = *(_DWORD *)&source[40 * scanline + 76]; data[365] = *(_DWORD *)&source[40 * scanline + 80]; data[366] = *(_DWORD *)&source[40 * scanline + 84]; data[367] = *(_DWORD *)&source[40 * scanline + 88]; data[368] = *(_DWORD *)&source[40 * scanline + 92]; data[369] = *(_DWORD *)&source[42 * scanline + 24]; data[370] = *(_DWORD *)&source[42 * scanline + 28]; data[371] = *(_DWORD *)&source[42 * scanline + 32]; data[372] = *(_DWORD *)&source[42 * scanline + 36]; data[373] = *(_DWORD *)&source[42 * scanline + 40]; data[374] = *(_DWORD *)&source[42 * scanline + 44]; data[375] = *(_DWORD *)&source[42 * scanline + 48]; data[376] = *(_DWORD *)&source[42 * scanline + 52]; data[377] = *(_DWORD *)&source[42 * scanline + 56]; data[378] = *(_DWORD *)&source[42 * scanline + 60]; data[379] = *(_DWORD *)&source[42 * scanline + 64]; data[380] = *(_DWORD *)&source[42 * scanline + 68]; data[381] = *(_DWORD *)&source[42 * scanline + 72]; data[382] = *(_DWORD *)&source[42 * scanline + 76]; data[383] = *(_DWORD *)&source[42 * scanline + 80]; data[384] = *(_DWORD *)&source[42 * scanline + 84]; data[385] = *(_DWORD *)&source[42 * scanline + 88]; data[386] = *(_DWORD *)&source[44 * scanline + 28]; data[387] = *(_DWORD *)&source[44 * scanline + 32]; data[388] = *(_DWORD *)&source[44 * scanline + 36]; data[389] = *(_DWORD *)&source[44 * scanline + 40]; data[390] = *(_DWORD *)&source[44 * scanline + 44]; data[391] = *(_DWORD *)&source[44 * scanline + 48]; data[392] = *(_DWORD *)&source[44 * scanline + 52]; data[393] = *(_DWORD *)&source[44 * scanline + 56]; data[394] = *(_DWORD *)&source[44 * scanline + 60]; data[395] = *(_DWORD *)&source[44 * scanline + 64]; data[396] = *(_DWORD *)&source[44 * scanline + 68]; data[397] = *(_DWORD *)&source[44 * scanline + 72]; data[398] = *(_DWORD *)&source[44 * scanline + 76]; data[399] = *(_DWORD *)&source[44 * scanline + 80]; data[400] = *(_DWORD *)&source[44 * scanline + 84]; data[401] = *(_DWORD *)&source[46 * scanline + 32]; data[402] = *(_DWORD *)&source[46 * scanline + 36]; data[403] = *(_DWORD *)&source[46 * scanline + 40]; data[404] = *(_DWORD *)&source[46 * scanline + 44]; data[405] = *(_DWORD *)&source[46 * scanline + 48]; data[406] = *(_DWORD *)&source[46 * scanline + 52]; data[407] = *(_DWORD *)&source[46 * scanline + 56]; data[408] = *(_DWORD *)&source[46 * scanline + 60]; data[409] = *(_DWORD *)&source[46 * scanline + 64]; data[410] = *(_DWORD *)&source[46 * scanline + 68]; data[411] = *(_DWORD *)&source[46 * scanline + 72]; data[412] = *(_DWORD *)&source[46 * scanline + 76]; data[413] = *(_DWORD *)&source[46 * scanline + 80]; data[414] = *(_DWORD *)&source[48 * scanline + 36]; data[415] = *(_DWORD *)&source[48 * scanline + 40]; data[416] = *(_DWORD *)&source[48 * scanline + 44]; data[417] = *(_DWORD *)&source[48 * scanline + 48]; data[418] = *(_DWORD *)&source[48 * scanline + 52]; data[419] = *(_DWORD *)&source[48 * scanline + 56]; data[420] = *(_DWORD *)&source[48 * scanline + 60]; data[421] = *(_DWORD *)&source[48 * scanline + 64]; data[422] = *(_DWORD *)&source[48 * scanline + 68]; data[423] = *(_DWORD *)&source[48 * scanline + 72]; data[424] = *(_DWORD *)&source[48 * scanline + 76]; data[425] = *(_DWORD *)&source[50 * scanline + 40]; data[426] = *(_DWORD *)&source[50 * scanline + 44]; data[427] = *(_DWORD *)&source[50 * scanline + 48]; data[428] = *(_DWORD *)&source[50 * scanline + 52]; data[429] = *(_DWORD *)&source[50 * scanline + 56]; data[430] = *(_DWORD *)&source[50 * scanline + 60]; data[431] = *(_DWORD *)&source[50 * scanline + 64]; data[432] = *(_DWORD *)&source[50 * scanline + 68]; data[433] = *(_DWORD *)&source[50 * scanline + 72]; data[434] = *(_DWORD *)&source[52 * scanline + 44]; data[435] = *(_DWORD *)&source[52 * scanline + 48]; data[436] = *(_DWORD *)&source[52 * scanline + 52]; data[437] = *(_DWORD *)&source[52 * scanline + 56]; data[438] = *(_DWORD *)&source[52 * scanline + 60]; data[439] = *(_DWORD *)&source[52 * scanline + 64]; data[440] = *(_DWORD *)&source[52 * scanline + 68]; data[441] = *(_DWORD *)&source[54 * scanline + 48]; data[442] = *(_DWORD *)&source[54 * scanline + 52]; data[443] = *(_DWORD *)&source[54 * scanline + 56]; data[444] = *(_DWORD *)&source[54 * scanline + 60]; data[445] = *(_DWORD *)&source[54 * scanline + 64]; data[446] = *(_DWORD *)&source[56 * scanline + 52]; data[447] = *(_DWORD *)&source[56 * scanline + 56]; data[448] = *(_DWORD *)&source[56 * scanline + 60]; data[449] = *(_DWORD *)&source[58 * scanline + 56]; } void unused_clearBuildingFootprintTile(char *buffer, int scanline) { char *v2; // esi@1 v2 = &buffer[2 * graphic_xOffset] + 2 * scanline * graphic_yOffset; *((_DWORD *)v2 + 14) = 0xF81FF81Fu; *(_DWORD *)&v2[2 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[2 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[2 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[4 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[4 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[4 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[4 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[4 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[6 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[8 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[10 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[12 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[14 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[16 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[18 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[20 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[22 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 8] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[24 * scanline + 104] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 4] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 8] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 104] = 0xF81FF81Fu; *(_DWORD *)&v2[26 * scanline + 108] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 4] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 8] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 104] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 108] = 0xF81FF81Fu; *(_DWORD *)&v2[28 * scanline + 112] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 4] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 8] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 104] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 108] = 0xF81FF81Fu; *(_DWORD *)&v2[30 * scanline + 112] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 4] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 8] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 104] = 0xF81FF81Fu; *(_DWORD *)&v2[32 * scanline + 108] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 8] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[34 * scanline + 104] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 12] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[36 * scanline + 100] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 16] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[38 * scanline + 96] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 20] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[40 * scanline + 92] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 24] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[42 * scanline + 88] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 28] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[44 * scanline + 84] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 32] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[46 * scanline + 80] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 36] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[48 * scanline + 76] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 40] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[50 * scanline + 72] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 44] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[52 * scanline + 68] = 0xF81FF81Fu; *(_DWORD *)&v2[54 * scanline + 48] = 0xF81FF81Fu; *(_DWORD *)&v2[54 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[54 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[54 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[54 * scanline + 64] = 0xF81FF81Fu; *(_DWORD *)&v2[56 * scanline + 52] = 0xF81FF81Fu; *(_DWORD *)&v2[56 * scanline + 56] = 0xF81FF81Fu; *(_DWORD *)&v2[56 * scanline + 60] = 0xF81FF81Fu; *(_DWORD *)&v2[58 * scanline + 56] = 0xF81FF81Fu; } //----- (0042A540) -------------------------------------------------------- void fun_clearBuildingFootprintTile_26px() { ; } //----- (0042A560) -------------------------------------------------------- void fun_drawBuildingFootprint_26px_xFull() { ; } //----- (0042A580) -------------------------------------------------------- void fun_drawBuildingFootprint_26px_xClipRight() { ; } //----- (0042A5A0) -------------------------------------------------------- void fun_drawBuildingFootprint_26px_xClipLeft() { ; } //----- (0042A5C0) -------------------------------------------------------- void fun_grabBuildingFootprintTileFromBuffer_26px() { ; } //----- (0042A5E0) -------------------------------------------------------- void fun_drawBuildingFootprint_10px_xFull() { ; } //----- (0042A600) -------------------------------------------------------- void fun_drawBuildingFootprint_10px_xClipRight() { ; } //----- (0042A620) -------------------------------------------------------- void fun_drawBuildingFootprint_10px_xClipLeft() { ; } //----- (0042A640) -------------------------------------------------------- void fun_grabBuildingFootprintTileFromBuffer_10px() { ; } //----- (0042A660) -------------------------------------------------------- void fun_clearBuildingFootprintTile_10px() { ; } //----- (0042A680) -------------------------------------------------------- signed int fun_drawBuildingFootprintSize2() { int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@1 drawGraphic_width = (drawGraphic_width & 0xffff0000 ) + 58; drawGraphic_height = (drawGraphic_height & 0xffff0000 ) + 30; v2 = graphic_xOffset; v1 = graphic_yOffset; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } } return 58; } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (0042AA50) -------------------------------------------------------- signed int fun_drawBuildingFootprintSize3() { int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@1 drawGraphic_width = (drawGraphic_width & 0xffff0000 ) + 58; drawGraphic_height = (drawGraphic_height & 0xffff0000 ) + 30; v2 = graphic_xOffset; v1 = graphic_yOffset; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 60; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 60; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); } } return 58; } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (0042B2B0) -------------------------------------------------------- signed int fun_drawBuildingFootprintSize4() { int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@1 drawGraphic_width = (drawGraphic_width & 0xffff0000 ) + 58; drawGraphic_height = (drawGraphic_height & 0xffff0000 ) + 30; v2 = graphic_xOffset; v1 = graphic_yOffset; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 60; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 60; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 90; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 90; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 16200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 16200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 16200], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 60; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 18000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 18000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 18000], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 19800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 19800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 19800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 60; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 21600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 21600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 21600], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 75; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 23400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 23400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 23400], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 75; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 25200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 25200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 25200], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 90; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 27000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 27000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 27000], drawGraphic_clipYCode); } } return 58; } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (0042C180) -------------------------------------------------------- signed int fun_drawBuildingFootprintSize5() { int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@1 drawGraphic_width = (drawGraphic_width & 0xffff0000 ) + 58; drawGraphic_height = (drawGraphic_height & 0xffff0000 ) + 30; v2 = graphic_xOffset; v1 = graphic_yOffset; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 1800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 15; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 3600], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 60; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 5400], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 7200], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 60; graphic_yOffset = v1 + 30; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 9000], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 90; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 10800], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 12600], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 14400], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 90; graphic_yOffset = v1 + 45; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 16200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 16200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 16200], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 120; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 18000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 18000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 18000], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 60; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 19800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 19800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 19800], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 21600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 21600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 21600], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 60; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 23400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 23400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 23400], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 120; graphic_yOffset = v1 + 60; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 25200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 25200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 25200], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 90; graphic_yOffset = v1 + 75; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 27000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 27000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 27000], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 75; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 28800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 28800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 28800], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 75; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 30600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 30600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 30600], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 90; graphic_yOffset = v1 + 75; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 32400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 32400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 32400], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 60; graphic_yOffset = v1 + 90; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 34200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 34200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 34200], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 90; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 36000], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 36000], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 36000], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 60; graphic_yOffset = v1 + 90; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 37800], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 37800], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 37800], drawGraphic_clipYCode); } } graphic_xOffset = v2 - 30; graphic_yOffset = v1 + 105; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 39600], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 39600], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 39600], drawGraphic_clipYCode); } } graphic_xOffset = v2 + 30; graphic_yOffset = v1 + 105; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 41400], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 41400], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 41400], drawGraphic_clipYCode); } } graphic_xOffset = v2; graphic_yOffset = v1 + 120; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset + 43200], drawGraphic_clipYCode); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset + 43200], drawGraphic_clipYCode); else fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset + 43200], drawGraphic_clipYCode); } } return 58; } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (0042D890) -------------------------------------------------------- void fun_setIsometricViewport(int gridwidth, int gridheight, int xoffset, int yoffset, int numtiles_width, int numtiles_height, signed int tilewidth, signed int tileheight) { iso_grid_width = gridwidth; iso_grid_height = gridheight; iso_viewport_width = numtiles_width; iso_viewport_height = numtiles_height; iso_xoffset = xoffset; iso_yoffset = yoffset; iso_tile_width = tilewidth; iso_tile_half_width = tilewidth / 2; dword_9A04B8 = tilewidth / 2 + tilewidth; dword_9A0514 = 2 * tilewidth; iso_tile_height = tileheight; iso_tile_half_height = tileheight / 2; dword_9A04F0 = tileheight / 2 + tileheight; dword_9A049C = 2 * tileheight; dword_9D4B54 = iso_grid_width - iso_viewport_width; cityviewport_x = iso_xoffset; cityviewport_xEnd = cityviewport_x + (iso_tile_width + 2) * iso_viewport_width - 2; cityviewport_y = iso_yoffset; cityviewport_yEnd = iso_tile_half_height * (iso_viewport_height - 1) + cityviewport_y; dword_9A050C = iso_grid_width / 2; dword_9A0510 = iso_grid_height; } void sub_42DA10() { signed int j; // [sp+4Ch] [bp-8h]@3 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 325; ++i ) { for ( j = 0; j < 165; ++j ) *(int *)((char *)&dword_9A0560[165 * i] + 4 * j) = graphic_terrain_start + 268369920; } } void sub_42DAA0(int gridOffset) { signed int j; // [sp+4Ch] [bp-8h]@3 signed int i; // [sp+50h] [bp-4h]@1 walkerGridY = 0; walkerGridX = walkerGridY; for ( i = 0; i < 325; ++i ) { for ( j = 0; j < 165; ++j ) { if ( *(unsigned int *)((char *)&dword_9A0560[165 * i] + 4 * j) < 0xFFF0000 && *(int *)((char *)&dword_9A0560[165 * i] + 4 * j) == gridOffset ) { walkerGridX = j; walkerGridY = i; return; } } } } void sub_42DB70(int a1) { int j; // [sp+4Ch] [bp-2Ch]@11 int i; // [sp+50h] [bp-28h]@9 signed int v3; // [sp+58h] [bp-20h]@11 signed int v4; // [sp+5Ch] [bp-1Ch]@16 signed int v5; // [sp+60h] [bp-18h]@17 int v6; // [sp+64h] [bp-14h]@11 int v7; // [sp+68h] [bp-10h]@11 signed int v8; // [sp+6Ch] [bp-Ch]@16 signed int v9; // [sp+70h] [bp-8h]@17 int v10; // [sp+74h] [bp-4h]@11 sub_42DA10(); dword_9D4B44 = 0; dword_995C50[0] = 0; dword_9A0530 = 162; dword_9A04BC = 162; dword_9D4DEC = a1; if ( a1 ) { switch ( a1 ) { case 2: v10 = 164; v9 = 1; v8 = -1; v6 = 2 * dword_995C50[0] + 1; v5 = 1; v4 = 1; break; case 4: v10 = 325 - 2 * dword_9D4B44 - 2; v9 = -1; v8 = -1; v6 = 164; v5 = 1; v4 = -1; break; case 6: v10 = 164; v9 = -1; v8 = 1; v6 = 325 - 2 * dword_9D4B44 - 2; v5 = -1; v4 = -1; break; } } else { v10 = 2 * dword_9D4B44 + 1; v9 = 1; v8 = 1; v6 = 164; v5 = -1; v4 = 1; } for ( i = 0; i < dword_9A0530; ++i ) { v7 = v10; v3 = v6; for ( j = 0; j < dword_9A04BC; ++j ) { if ( grid_graphicIds[j + dword_9A04BC * i] < 6 ) *(int *)((char *)&dword_9A0560[165 * v7] + 4 * v3 / 2) = graphic_terrain_start + 268369920; else *(int *)((char *)&dword_9A0560[165 * v7] + 4 * v3 / 2) = j + dword_9A04BC * i; v7 += v8; v3 += v4; } v10 += v9; v6 += v5; } } int sub_42DE10() { int result; // eax@2 int v1; // [sp+58h] [bp-1Ch]@9 int v2; // [sp+5Ch] [bp-18h]@9 int v3; // [sp+60h] [bp-14h]@9 int v4; // [sp+64h] [bp-10h]@9 int v5; // [sp+68h] [bp-Ch]@9 if ( mouseclick_x >= iso_xoffset ) { if ( mouseclick_x < (iso_tile_width + 2) * iso_viewport_width + iso_xoffset ) { if ( mouseclick_y >= iso_yoffset ) { if ( mouseclick_y < iso_tile_half_height * iso_viewport_height + iso_yoffset ) { v5 = ((mouseclick_y - iso_yoffset) / iso_tile_half_height + (mouseclick_x - iso_xoffset) / (iso_tile_half_width + 1)) & 1; v2 = (mouseclick_x - iso_xoffset) / (iso_tile_half_width + 1) & 1; v1 = (mouseclick_y - iso_yoffset) / iso_tile_half_height & 1; v4 = (mouseclick_x - iso_xoffset) % (iso_tile_half_width + 1) / 2; v3 = (mouseclick_y - iso_yoffset) % iso_tile_half_height; dword_9A04AC = (mouseclick_y - iso_yoffset) / iso_tile_half_height; dword_9A04D4 = (mouseclick_x - iso_xoffset) / (iso_tile_half_width + 1) / 2; if ( v5 ) { if ( v5 == 1 ) { if ( v4 + v3 >= iso_tile_half_height - 1 ) { ++dword_9A04AC; if ( v2 ) { if ( !v1 ) ++dword_9A04D4; } } } } else { if ( v3 <= v4 ) { if ( v2 ) { if ( v1 ) ++dword_9A04D4; } } else { ++dword_9A04AC; } } dword_9A04E8 = (iso_tile_width + 2) * dword_9A04D4 + iso_xoffset; if ( dword_9A04AC & 1 ) dword_9A04E8 -= iso_tile_half_width + 1; dword_9A04EC = iso_tile_half_height * dword_9A04AC + iso_yoffset; dword_9A04A4 = *(int *)((char *)&dword_9A0560[165 * (dword_9A0510 + dword_9A04AC)] + 4 * (dword_9A050C + dword_9A04D4)); if ( dword_9A04A4 < 268369920 ) { dword_9D4DE8 = 0; dword_9A04A0 = dword_9D4DE8; if ( dword_9A04AC ) { if ( dword_9A04AC >= iso_viewport_height ) dword_9D4DE8 = 1; } else { dword_9D4DE8 = 2; } if ( dword_9A04AC & 1 ) { if ( dword_9A04D4 ) { if ( dword_9A04D4 >= iso_viewport_width ) dword_9A04A0 = 1; } else { dword_9A04A0 = 2; } } result = dword_9A04A4; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void fun_rotateMapCounterClockwise() { int v0; // [sp+4Ch] [bp-Ch]@1 v0 = *(int *)((char *)&dword_9A0560[165 * (iso_viewport_height / 2 + setting_map_camera_y)] + 4 * (iso_viewport_width / 2 + setting_map_camera_x)); mapOrientation += 2; if ( mapOrientation > 6 ) mapOrientation = 0; sub_42DB70(mapOrientation); if ( v0 < 0xFFF0000u ) { sub_42DAA0(v0); setting_map_camera_x = walkerGridX - iso_viewport_width / 2; setting_map_camera_y = walkerGridY - iso_viewport_height / 2; if ( mapOrientation == 4 ) ++setting_map_camera_x; if ( !mapOrientation ) ++setting_map_camera_x; } } void fun_rotateMapClockwise() { int v0; // [sp+4Ch] [bp-Ch]@1 v0 = *(int *)((char *)&dword_9A0560[165 * (iso_viewport_height / 2 + setting_map_camera_y)] + 4 * (iso_viewport_width / 2 + setting_map_camera_x)); mapOrientation -= 2; if ( mapOrientation < 0 ) mapOrientation = 6; sub_42DB70(mapOrientation); if ( v0 < 0xFFF0000u ) { sub_42DAA0(v0); setting_map_camera_x = walkerGridX - iso_viewport_width / 2; setting_map_camera_y = walkerGridY - iso_viewport_height / 2; if ( mapOrientation == 4 ) setting_map_camera_y += 2; if ( !mapOrientation ) setting_map_camera_y += 2; } } int fun_getIsometricViewportWidth() { return iso_viewport_width; } int fun_getIsometricViewportHeight() { return iso_viewport_height; } int fun_getCityScreenWidth() { return iso_viewport_width * (iso_tile_width + 2); } int unused_42E480() { return iso_tile_half_height * iso_viewport_height; } void fun_gotoGridOffset(__int16 gridOffset) { sub_42DAA0(gridOffset); setting_map_camera_x = walkerGridX; setting_map_camera_y = walkerGridY; setting_map_camera_x -= iso_viewport_width / 2; setting_map_camera_y -= iso_viewport_height / 2; setting_map_camera_y &= 0xFFFEu; shouldScrollMap = 1; sub_4DC600(); } void sub_42E6D0(int x, int y, int gridOffset, int a4) { dword_9A050C = x; dword_9A0510 = y; dword_9A04E0 = gridOffset; draw_clip_x = cityviewport_x; draw_clip_xEnd = cityviewport_xEnd; draw_clip_y = cityviewport_y; draw_clip_yEnd = cityviewport_yEnd; sub_42E7A0(); fun_drawExtraBuildingImages(a4); sub_437E20(0); draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } void sub_42E7A0() { int v0; // [sp+4Ch] [bp-2Ch]@1 signed int v1; // [sp+50h] [bp-28h]@1 int v2; // [sp+54h] [bp-24h]@24 char v3; // [sp+60h] [bp-18h]@32 int v4; // [sp+60h] [bp-18h]@36 signed int v5; // [sp+64h] [bp-14h]@1 int v6; // [sp+68h] [bp-10h]@1 int v7; // [sp+6Ch] [bp-Ch]@4 int v8; // [sp+6Ch] [bp-Ch]@6 int v9; // [sp+70h] [bp-8h]@1 int v10; // [sp+74h] [bp-4h]@6 v1 = graphic_terrain_water; v0 = graphic_terrain_water + 5; v6 = iso_yoffset - iso_tile_half_height - 8 * iso_tile_half_height; v5 = 0; v9 = 0; dword_9A0540[0] = dword_9A0510 - 8; while ( v9 < iso_viewport_height + 14 ) { if ( v5 ) { v7 = iso_xoffset - (iso_tile_half_width + 1); v5 = 0; } else { v7 = iso_xoffset; v5 = 1; } v8 = v7 - (4 * iso_tile_width + 8); v10 = 0; dword_9A053C = dword_9A050C - 4; while ( v10 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { if ( dword_9A0540[0] >= 0 ) { if ( dword_9A0540[0] < 325 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C == dword_9DA808 ) { dword_9A04D8 = v8; dword_9A051C = v6; } if ( dword_9D4B4C < 268369920 ) { if ( grid_edge[dword_9D4B4C] & 0x40 ) { v2 = grid_buildingIds[dword_9D4B4C]; if ( grid_buildingIds[dword_9D4B4C] ) { if ( buildings[v2].byte_94BDBB ) drawGraphic_colorMask = 0xF863u; if ( v10 >= 4 ) { if ( v10 <= iso_viewport_width + 2 ) sub_41C000(v2, 2); else sub_41C000(v2, 4); } else { sub_41C000(v2, 0); } } graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v3 = grid_bitfields[dword_9D4B4C]; if ( grid_terrain[dword_9D4B4C] & T_Garden ) { buildings[0].type = B_Gardens; sub_41C000(0, 2); } if ( v3 & 0x10 ) graphic_currentGraphicId = graphic_overlaytiles; v4 = v3 & 0xF; if ( v4 ) { switch ( v4 ) { case 1: drawGraphic( graphic_currentGraphicId, v8 + iso_tile_half_width + 1, v6 - iso_tile_half_height); break; case 2: drawGraphic(graphic_currentGraphicId, v8 + iso_tile_width + 2, v6 - iso_tile_height); break; case 4: drawGraphic(graphic_currentGraphicId, v8 + dword_9A04B8 + 3, v6 - dword_9A04F0); break; case 8: drawGraphic(graphic_currentGraphicId, v8 + dword_9A0514 + 4, v6 - dword_9A049C); break; } } else { if ( graphic_currentGraphicId <= v0 ) { if ( graphic_currentGraphicId >= v1 ) { if ( dword_9A0534 ) { ++graphic_currentGraphicId; if ( graphic_currentGraphicId > v0 ) graphic_currentGraphicId = v1; grid_graphicIds[dword_9D4B4C] = graphic_currentGraphicId; } } } drawGraphic(graphic_currentGraphicId, v8, v6); } drawGraphic_colorMask = 0; } } else { if ( dword_660B7C == 1 ) graphic_currentGraphicId = 0; else graphic_currentGraphicId = dword_9D4B4C - 0xFFF0000; drawGraphic(graphic_currentGraphicId, v8, v6); } } } } } v8 += iso_tile_width + 2; ++v10; ++dword_9A053C; } v6 += iso_tile_half_height; ++v9; ++dword_9A0540[0]; } } void fun_drawOverlay() { int v0; // [sp+54h] [bp-1Ch]@27 __int16 terrain; // [sp+58h] [bp-18h]@27 signed int v2; // [sp+5Ch] [bp-14h]@1 int v3; // [sp+60h] [bp-10h]@1 int v4; // [sp+64h] [bp-Ch]@4 int v5; // [sp+64h] [bp-Ch]@6 int v6; // [sp+68h] [bp-8h]@1 int v7; // [sp+6Ch] [bp-4h]@6 v3 = iso_yoffset - iso_tile_half_height - 8 * iso_tile_half_height; v2 = 0; v6 = 0; dword_9A0540[0] = dword_9A0510 - 8; while ( v6 < iso_viewport_height + 14 ) { if ( v2 ) { v4 = iso_xoffset - (iso_tile_half_width + 1); v2 = 0; } else { v4 = iso_xoffset; v2 = 1; } v5 = v4 - (4 * iso_tile_width + 8); v7 = 0; dword_9A053C = dword_9A050C - 4; while ( v7 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { if ( dword_9A0540[0] >= 0 ) { if ( dword_9A0540[0] < 325 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C == dword_9DA808 ) { dword_9A04D8 = v5; dword_9A051C = v3; } if ( dword_9D4B4C < 268369920 ) { if ( currentOverlay == Overlay_Desirability ) { fun_drawBuildingOnDesirabilityOverlay(v5, v3); } else { if ( grid_edge[dword_9D4B4C] & 0x40 ) { if ( currentOverlay == Overlay_Water ) { fun_drawBuildingOnWaterOverlayPipes(v5, v3); } else { if ( currentOverlay == Overlay_Native ) { fun_drawBuildingOnNativeOverlayRed(v5, v3); } else { terrain = grid_terrain[dword_9D4B4C]; v0 = grid_bitfields[dword_9D4B4C] & 0xF; if ( terrain & T_Aqueduct ) { graphic_currentGraphicId = (grid_random[dword_9D4B4C] & 7) + graphic_terrain_grass1; drawGraphic(graphic_currentGraphicId, v5, v3); } else { if ( !(terrain & T_Road) || terrain & T_Building ) { if ( terrain & T_Wall ) { graphic_currentGraphicId = (grid_random[dword_9D4B4C] & 7) + graphic_terrain_grass1; drawGraphic(graphic_currentGraphicId, v5, v3); } else { if ( terrain & T_Building ) { fun_drawBuildingWithOverlay(grid_buildingIds[dword_9D4B4C], v5, v3, 0); } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( v0 ) { switch ( v0 ) { case 1: drawGraphic( graphic_currentGraphicId, v5 + iso_tile_half_width + 1, v3 - iso_tile_half_height); break; case 2: drawGraphic( graphic_currentGraphicId, v5 + iso_tile_width + 2, v3 - iso_tile_height); break; case 4: drawGraphic( graphic_currentGraphicId, v5 + dword_9A04B8 + 3, v3 - dword_9A04F0); break; case 8: drawGraphic( graphic_currentGraphicId, v5 + dword_9A0514 + 4, v3 - dword_9A049C); break; } } else { drawGraphic(graphic_currentGraphicId, v5, v3); } } } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( v0 ) { if ( v0 == 1 ) drawGraphic( graphic_currentGraphicId, v5 + iso_tile_half_width + 1, v3 - iso_tile_half_height); } else { drawGraphic(graphic_currentGraphicId, v5, v3); } } } } } } } } else { graphic_currentGraphicId = dword_9D4B4C - 268369920; drawGraphic(graphic_currentGraphicId, v5, v3); } } } } } v5 += iso_tile_width + 2; ++v7; ++dword_9A053C; } v3 += iso_tile_half_height; ++v6; ++dword_9A0540[0]; } } void fun_drawBuildingOnWaterOverlayPipes(int a1, int a2) { int v2; // ST68_4@3 int v3; // ecx@28 int v4; // [sp+58h] [bp-18h]@26 int v5; // [sp+68h] [bp-8h]@4 __int16 v6; // [sp+6Ch] [bp-4h]@1 int v7; // [sp+6Ch] [bp-4h]@18 int v8; // [sp+6Ch] [bp-4h]@26 v6 = grid_terrain[dword_9D4B4C]; if ( v6 & 6007 ) { if ( v6 & T_Building ) { v2 = grid_buildingIds[dword_9D4B4C]; graphic_currentGraphicId = graphic_overlaytiles; fun_drawBuildingWithOverlay(v2, a1, a2, 0); } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v5 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v5 ) { case 1: drawGraphic(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); break; case 2: drawGraphic(graphic_currentGraphicId, a1 + iso_tile_width + 2, a2 - iso_tile_height); break; case 4: drawGraphic(graphic_currentGraphicId, a1 + dword_9A04B8 + 3, a2 - dword_9A04F0); break; case 8: drawGraphic(graphic_currentGraphicId, a1 + dword_9A0514 + 4, a2 - dword_9A049C); break; } } else { drawGraphic(graphic_currentGraphicId, a1, a2); } } } else { if ( v6 & 0x4000 ) { graphic_currentGraphicId = (grid_random[dword_9D4B4C] & 7) + graphic_terrain_grass1; drawGraphic(graphic_currentGraphicId, a1, a2); } else { if ( v6 & 8 ) { v4 = grid_buildingIds[dword_9D4B4C]; v8 = v6 & 0x2080; if ( grid_buildingIds[dword_9D4B4C] ) { if ( buildings[v4].house_hasWell == 1 ) { v3 = v8; v3 |= 0x20; v8 = v3; } } graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[v4].type ) { case 90: drawGraphic(graphic_currentGraphicId, a1 + iso_tile_width + 2, a2 - iso_tile_height); break; case 91: drawGraphic(graphic_currentGraphicId, a1, a2); break; case 92: drawGraphic(graphic_currentGraphicId, a1, a2); break; default: switch ( v8 ) { case 0x2080: fun_drawBuildingWithOverlay(v4, a1, a2, 24); break; case 0x80: fun_drawBuildingWithOverlay(v4, a1, a2, 8); break; case 0x2000: fun_drawBuildingWithOverlay(v4, a1, a2, 16); break; default: fun_drawBuildingWithOverlay(v4, a1, a2, 0); break; } break; } } else { v7 = v6 & 0x2080; graphic_currentGraphicId = graphic_overlaytiles; switch ( v7 ) { case 0x2080: graphic_currentGraphicId += 27; break; case 0x80: graphic_currentGraphicId += 11; break; case 0x2000: graphic_currentGraphicId += 19; break; default: graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; break; } drawGraphic(graphic_currentGraphicId, a1, a2); } } } } void fun_drawBuildingOnWaterOverlay(int x, int y) { int buildingId; // [sp+4Ch] [bp-Ch]@1 int v3; // [sp+50h] [bp-8h]@4 __int16 terrain; // [sp+54h] [bp-4h]@1 terrain = grid_terrain[dword_9D4B4C]; buildingId = grid_buildingIds[dword_9D4B4C]; if ( terrain & 0x1777 ) { if ( !(terrain & T_Building) ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v3 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v3 ) { case 1: fun_drawBuilding(graphic_currentGraphicId, x + iso_tile_half_width + 1, y - iso_tile_half_height); break; case 2: fun_drawBuilding(graphic_currentGraphicId, x + iso_tile_width + 2, y - iso_tile_height); break; case 4: fun_drawBuilding(graphic_currentGraphicId, x + dword_9A04B8 + 3, y - dword_9A04F0); break; case 8: fun_drawBuilding(graphic_currentGraphicId, x + dword_9A0514 + 4, y - dword_9A049C); break; } } else { fun_drawBuilding(graphic_currentGraphicId, x, y); } } } else { if ( grid_buildingIds[dword_9D4B4C] ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[buildingId].type ) { case B_Reservoir: fun_drawBuilding(graphic_currentGraphicId, x + iso_tile_width + 2, y - iso_tile_height); break; case B_Fountain: fun_drawBuilding(graphic_currentGraphicId, x, y); break; case B_Well: fun_drawBuilding(graphic_currentGraphicId, x, y); break; } } } } void fun_drawBuildingOnNativeOverlayRed(int a1, int a2) { int v2; // ST5C_4@3 int v3; // ST5C_4@25 int v4; // [sp+50h] [bp-Ch]@4 int v5; // [sp+54h] [bp-8h]@1 __int16 v6; // [sp+58h] [bp-4h]@1 v6 = grid_terrain[dword_9D4B4C]; v5 = grid_edge[dword_9D4B4C] & 0x80; if ( v6 & 0x1637 ) { if ( v6 & 8 ) { v2 = grid_buildingIds[dword_9D4B4C]; graphic_currentGraphicId = graphic_overlaytiles; fun_drawBuildingWithOverlay(v2, a1, a2, 0); } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v4 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v4 ) { case 1: drawGraphic(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); break; case 2: drawGraphic(graphic_currentGraphicId, a1 + iso_tile_width + 2, a2 - iso_tile_height); break; case 4: drawGraphic(graphic_currentGraphicId, a1 + dword_9A04B8 + 3, a2 - dword_9A04F0); break; case 8: drawGraphic(graphic_currentGraphicId, a1 + dword_9A0514 + 4, a2 - dword_9A049C); break; } } else { drawGraphic(graphic_currentGraphicId, a1, a2); } } } else { if ( v6 & 0x4100 ) { graphic_currentGraphicId = (grid_random[dword_9D4B4C] & 7) + graphic_terrain_grass1; drawGraphic(graphic_currentGraphicId, a1, a2); } else { if ( v6 & 8 ) { v3 = grid_buildingIds[dword_9D4B4C]; graphic_currentGraphicId = graphic_overlaytiles; fun_drawBuildingWithOverlay(v3, a1, a2, 0); } else { graphic_currentGraphicId = word_6E6CBE; if ( v5 ) { drawGraphic(graphic_currentGraphicId + 1, a1, a2); } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { if ( (grid_bitfields[dword_9D4B4C] & 0xF) == 1 ) drawGraphic(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); } else { drawGraphic(graphic_currentGraphicId, a1, a2); } } } } } } void fun_drawBuildingOnNativeOverlay(int a1, int a2) { int v2; // [sp+4Ch] [bp-Ch]@1 int v3; // [sp+50h] [bp-8h]@4 __int16 v4; // [sp+54h] [bp-4h]@1 v4 = grid_terrain[dword_9D4B4C]; v2 = grid_buildingIds[dword_9D4B4C]; if ( v4 & 0x1637 ) { if ( !(v4 & 8) ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v3 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v3 ) { case 1: fun_drawBuilding(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); break; case 2: fun_drawBuilding(graphic_currentGraphicId, a1 + iso_tile_width + 2, a2 - iso_tile_height); break; case 4: fun_drawBuilding(graphic_currentGraphicId, a1 + dword_9A04B8 + 3, a2 - dword_9A04F0); break; case 8: fun_drawBuilding(graphic_currentGraphicId, a1 + dword_9A0514 + 4, a2 - dword_9A049C); break; } } else { fun_drawBuilding(graphic_currentGraphicId, a1, a2); } } } else { if ( v2 > 0 ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[v2].type ) { case B_NativeHut: fun_drawBuilding(graphic_currentGraphicId, a1, a2); break; case B_NativeMeeting: fun_drawBuilding(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); break; case B_MissionPost: fun_drawBuilding(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); break; } } } } void fun_drawBuildingWithOverlay(int buildingId, int xOffset, int yOffset, int graphicOffset) { signed int v4; // [sp+4Ch] [bp-14h]@1 int v5; // [sp+50h] [bp-10h]@124 int v6; // [sp+50h] [bp-10h]@147 signed int i; // [sp+5Ch] [bp-4h]@75 signed int j; // [sp+5Ch] [bp-4h]@159 signed int k; // [sp+5Ch] [bp-4h]@166 signed int l; // [sp+5Ch] [bp-4h]@189 v4 = 0; if ( buildingId ) { switch ( buildings[buildingId].size ) { case 1: graphic_currentGraphicId = graphic_overlaytiles; if ( buildings[buildingId].house_size ) graphic_currentGraphicId += 4; if ( currentOverlay != 8 && currentOverlay != 10 ) { switch ( currentOverlay ) { case Overlay_Damage: if ( buildings[buildingId].type == B_EngineersPost ) graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; break; case Overlay_Barber: if ( buildings[buildingId].type == B_Barber ) graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; break; case Overlay_Clinic: if ( buildings[buildingId].type == B_Doctor ) graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; break; case Overlay_Native: if ( buildings[buildingId].type == B_NativeHut ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; graphicOffset = 0; } break; case Overlay_Problems: if ( buildings[buildingId].haveProblems ) graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; break; } } else { if ( buildings[buildingId].type == B_Prefecture ) graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[buildingId].type == B_BurningRuin ) graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; } graphic_currentGraphicId += graphicOffset; drawGraphic(graphic_currentGraphicId, xOffset, yOffset); break; case 2: if ( currentOverlay != Overlay_Entertainment || buildings[buildingId].type != B_Theater ) { if ( currentOverlay != Overlay_Education || buildings[buildingId].type != 51 && buildings[buildingId].type != B_Library ) { if ( currentOverlay != Overlay_Theater || buildings[buildingId].type != B_Theater ) { if ( currentOverlay != Overlay_FoodStocks || buildings[buildingId].type != B_Market && buildings[buildingId].type != B_Wharf ) { if ( currentOverlay != Overlay_Religion || buildings[buildingId].type != B_Oracle && buildings[buildingId].type != B_SmallTempleCeres && buildings[buildingId].type != B_SmallTempleNeptune && buildings[buildingId].type != B_SmallTempleMercury && buildings[buildingId].type != B_SmallTempleMars && buildings[buildingId].type != B_SmallTempleVenus ) { if ( currentOverlay != Overlay_School || buildings[buildingId].type != B_School ) { if ( currentOverlay != Overlay_Library || buildings[buildingId].type != B_Library ) { if ( currentOverlay != Overlay_Bathhouse || buildings[buildingId].type != B_Bathhouse ) { if ( currentOverlay != Overlay_TaxIncome || buildings[buildingId].type != B_Forum ) { if ( currentOverlay != Overlay_Native || buildings[buildingId].type != 89 && buildings[buildingId].type != B_MissionPost ) { if ( currentOverlay == Overlay_Problems && buildings[buildingId].haveProblems ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } else { for ( i = 0; i < 4; ++i ) { graphic_currentGraphicId = graphic_overlaytiles; graphic_currentGraphicId += dword_5F949C[i]; graphic_currentGraphicId += graphicOffset; if ( buildings[buildingId].house_size ) graphic_currentGraphicId += 4; drawGraphic( graphic_currentGraphicId, dword_5F5B88[2 * i] + xOffset, dword_5F5B8C[2 * i] + yOffset); } } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } break; case 3: if ( currentOverlay != Overlay_Entertainment || buildings[buildingId].type != B_Amphitheater && buildings[buildingId].type != B_GladiatorSchool && buildings[buildingId].type != B_LionHouse && buildings[buildingId].type != B_ActorColony && buildings[buildingId].type != B_ChariotMaker ) { if ( currentOverlay != Overlay_Education || buildings[buildingId].type != B_Academy ) { if ( currentOverlay != Overlay_Theater || buildings[buildingId].type != B_ActorColony ) { if ( currentOverlay != Overlay_Amphiheater || buildings[buildingId].type != B_Amphitheater && buildings[buildingId].type != B_GladiatorSchool && buildings[buildingId].type != B_ActorColony ) { if ( currentOverlay != Overlay_Colosseum || buildings[buildingId].type != B_GladiatorSchool && buildings[buildingId].type != B_LionHouse ) { if ( currentOverlay != Overlay_Hippodrome || buildings[buildingId].type != B_ChariotMaker ) { if ( currentOverlay != Overlay_Religion || buildings[buildingId].type != B_LargeTempleCeres && buildings[buildingId].type != B_LargeTempleNeptune && buildings[buildingId].type != B_LargeTempleMercury && buildings[buildingId].type != B_LargeTempleMars && buildings[buildingId].type != B_LargeTempleVenus ) { if ( currentOverlay != Overlay_Academy || buildings[buildingId].type != B_Academy ) { if ( currentOverlay != Overlay_Hospital || buildings[buildingId].type != B_Hospital ) { if ( currentOverlay == Overlay_Problems && buildings[buildingId].haveProblems ) { if ( buildings[buildingId].type < B_WheatFarm || buildings[buildingId].type > B_PigFarm ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } else { v5 = grid_edge[dword_9D4B4C]; if ( !setting_map_orientation ) { if ( v5 != 72 ) v4 = 1; } if ( setting_map_orientation == 2 ) { if ( v5 != 64 ) v4 = 1; } if ( setting_map_orientation == 4 ) { if ( v5 != 65 ) v4 = 1; } if ( setting_map_orientation == 6 ) { if ( v5 != 73 ) v4 = 1; } if ( v4 ) { if ( v5 & 0x40 ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset, yOffset); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_half_width + 1, yOffset - iso_tile_half_height); } } } else { if ( currentOverlay != Overlay_FoodStocks || buildings[buildingId].type != 71 ) { if ( buildings[buildingId].type < 100 || buildings[buildingId].type > 105 || ((v6 = grid_edge[dword_9D4B4C], setting_map_orientation) || v6 == 80) && (setting_map_orientation != 2 || v6 == 64) && (setting_map_orientation != 4 || v6 == 66) && (setting_map_orientation != 6 || v6 == 82) ) { for ( j = 0; j < 9; ++j ) { graphic_currentGraphicId = graphic_overlaytiles; graphic_currentGraphicId += dword_5F94AC[j]; graphic_currentGraphicId += graphicOffset; if ( buildings[buildingId].house_size ) graphic_currentGraphicId += 4; drawGraphic( graphic_currentGraphicId, dword_5F5BA8[2 * j] + xOffset, dword_5F5BAC[2 * j] + yOffset); } } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic( graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + iso_tile_width + 2, yOffset - iso_tile_height); } break; case 4: for ( k = 0; k < 16; ++k ) { graphic_currentGraphicId = graphic_overlaytiles; graphic_currentGraphicId += dword_5F94D0[k]; graphic_currentGraphicId += graphicOffset; if ( buildings[buildingId].house_size ) graphic_currentGraphicId += 4; drawGraphic(graphic_currentGraphicId, dword_5F5BF0[2 * k] + xOffset, dword_5F5BF4[2 * k] + yOffset); } break; case 5: if ( currentOverlay != Overlay_Entertainment || buildings[buildingId].type != B_Hippodrome && buildings[buildingId].type != B_Colosseum ) { if ( currentOverlay != Overlay_Colosseum || buildings[buildingId].type != B_Colosseum ) { if ( currentOverlay != Overlay_Hippodrome || buildings[buildingId].type != B_Hippodrome ) { if ( currentOverlay != Overlay_TaxIncome || buildings[buildingId].type != B_SenateUpgraded ) { if ( currentOverlay == Overlay_Problems && buildings[buildingId].haveProblems ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + dword_9A0514 + 4, yOffset - dword_9A049C); } else { for ( l = 0; l < 25; ++l ) { graphic_currentGraphicId = graphic_overlaytiles; graphic_currentGraphicId += dword_5F9510[l]; graphic_currentGraphicId += graphicOffset; if ( buildings[buildingId].house_size ) graphic_currentGraphicId += 4; drawGraphic( graphic_currentGraphicId, dword_5F5C70[2 * l] + xOffset, dword_5F5C74[2 * l] + yOffset); } } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + dword_9A0514 + 4, yOffset - dword_9A049C); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + dword_9A0514 + 4, yOffset - dword_9A049C); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + dword_9A0514 + 4, yOffset - dword_9A049C); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, xOffset + dword_9A0514 + 4, yOffset - dword_9A049C); } break; } } } void fun_drawBuildingOnDesirabilityOverlay(int x, int y) { int v2; // [sp+4Ch] [bp-10h]@4 __int16 v3; // [sp+54h] [bp-8h]@1 signed int v4; // [sp+58h] [bp-4h]@1 v3 = grid_terrain[dword_9D4B4C]; v4 = grid_desirability[dword_9D4B4C]; if ( !(v3 & 0x1677) || v3 & 8 ) { if ( v3 & 0x4100 ) { graphic_currentGraphicId = (grid_random[dword_9D4B4C] & 7) + graphic_terrain_grass1; drawGraphic(graphic_currentGraphicId, x, y); } else { if ( v3 & 8 || grid_desirability[dword_9D4B4C] ) { if ( v4 >= -10 ) { if ( v4 >= -5 ) { if ( v4 >= 0 ) { if ( grid_desirability[dword_9D4B4C] ) { if ( v4 >= 5 ) { if ( v4 >= 10 ) { if ( v4 >= 15 ) { if ( v4 >= 20 ) { if ( v4 >= 25 ) graphic_currentGraphicId = word_6E6CBE + 9; else graphic_currentGraphicId = word_6E6CBE + 8; } else { graphic_currentGraphicId = word_6E6CBE + 7; } } else { graphic_currentGraphicId = word_6E6CBE + 6; } } else { graphic_currentGraphicId = word_6E6CBE + 5; } } else { graphic_currentGraphicId = word_6E6CBE + 4; } } else { graphic_currentGraphicId = word_6E6CBE + 3; } } else { graphic_currentGraphicId = word_6E6CBE + 2; } } else { graphic_currentGraphicId = word_6E6CBE + 1; } } else { graphic_currentGraphicId = word_6E6CBE; } drawGraphic(graphic_currentGraphicId, x, y); } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; drawGraphic(graphic_currentGraphicId, x, y); } } } else { if ( grid_edge[dword_9D4B4C] & 0x40 ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v2 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v2 ) { case 1: drawGraphic(graphic_currentGraphicId, x + iso_tile_half_width + 1, y - iso_tile_half_height); break; case 2: drawGraphic(graphic_currentGraphicId, x + iso_tile_width + 2, y - iso_tile_height); break; case 4: drawGraphic(graphic_currentGraphicId, x + dword_9A04B8 + 3, y - dword_9A04F0); break; case 8: drawGraphic(graphic_currentGraphicId, x + dword_9A0514 + 4, y - dword_9A049C); break; } } else { drawGraphic(graphic_currentGraphicId, x, y); } } } } void fun_drawBuildingOnDesirabilityOverlayColored(int a1, int a2) { int v2; // [sp+4Ch] [bp-10h]@4 __int16 v3; // [sp+54h] [bp-8h]@1 signed int v4; // [sp+58h] [bp-4h]@1 v3 = grid_terrain[dword_9D4B4C]; v4 = grid_desirability[dword_9D4B4C]; if ( !(v3 & 0x1677) || v3 & 8 ) { if ( !(v3 & 0x4100) ) { if ( v3 & 8 || grid_desirability[dword_9D4B4C] ) { if ( v4 >= -10 ) { if ( v4 >= -5 ) { if ( v4 >= 0 ) { if ( grid_desirability[dword_9D4B4C] ) { if ( v4 >= 5 ) { if ( v4 >= 10 ) { if ( v4 >= 15 ) { if ( v4 >= 20 ) { if ( v4 >= 25 ) graphic_currentGraphicId = word_6E6CBE + 9; else graphic_currentGraphicId = word_6E6CBE + 8; } else { graphic_currentGraphicId = word_6E6CBE + 7; } } else { graphic_currentGraphicId = word_6E6CBE + 6; } } else { graphic_currentGraphicId = word_6E6CBE + 5; } } else { graphic_currentGraphicId = word_6E6CBE + 4; } } else { graphic_currentGraphicId = word_6E6CBE + 3; } } else { graphic_currentGraphicId = word_6E6CBE + 2; } } else { graphic_currentGraphicId = word_6E6CBE + 1; } } else { graphic_currentGraphicId = word_6E6CBE; } fun_drawBuilding(graphic_currentGraphicId, a1, a2); } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; fun_drawBuilding(graphic_currentGraphicId, a1, a2); } } } else { if ( grid_edge[dword_9D4B4C] & 0x40 ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; v2 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v2 ) { case 1: fun_drawBuilding(graphic_currentGraphicId, a1 + iso_tile_half_width + 1, a2 - iso_tile_half_height); break; case 2: fun_drawBuilding(graphic_currentGraphicId, a1 + iso_tile_width + 2, a2 - iso_tile_height); break; case 4: fun_drawBuilding(graphic_currentGraphicId, a1 + dword_9A04B8 + 3, a2 - dword_9A04F0); break; case 8: fun_drawBuilding(graphic_currentGraphicId, a1 + dword_9A0514 + 4, a2 - dword_9A049C); break; } } else { fun_drawBuilding(graphic_currentGraphicId, a1, a2); } } } } void fun_drawBuildingOnFireOverlay(int buildingId, int a2, int a3) { int v3; // [sp+4Ch] [bp-8h]@9 graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[buildingId].type == B_Prefecture ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if ( buildings[buildingId].type == B_BurningRuin ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if (buildings[buildingId].fireRisk > 0 ) { if ( buildings[buildingId].type < B_WheatFarm || buildings[buildingId].type > B_PigFarm || ((v3 = grid_edge[dword_9D4B4C], setting_map_orientation) || v3 == 80) && (setting_map_orientation != 2 || v3 == 64) && (setting_map_orientation != 4 || v3 == 66) && (setting_map_orientation != 6 || v3 == 82) ) fun_drawOverlayColumn(buildings[buildingId].fireRisk / 10, a2, a3, 1); } } } } void fun_drawBuildingOnDamageOverlay(int a1, int a2, int a3) { int v3; // [sp+4Ch] [bp-8h]@7 graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_EngineersPost ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if ( buildings[a1].damageRisk > 0 ) { if ( buildings[a1].type < B_WheatFarm || buildings[a1].type > B_PigFarm || ((v3 = grid_edge[dword_9D4B4C], setting_map_orientation) || v3 == 80) && (setting_map_orientation != 2 || v3 == 64) && (setting_map_orientation != 4 || v3 == 66) && (setting_map_orientation != 6 || v3 == 82) ) fun_drawOverlayColumn(buildings[a1].damageRisk / 20, a2, a3, 1); } } } void fun_drawBuildingOnCrimeOverlay(int a1, int a2, int a3) { signed int v3; // [sp+4Ch] [bp-4h]@9 graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Prefecture ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if ( buildings[a1].type == B_BurningRuin ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if ( buildings[a1].house_size > 0 ) { if ( buildings[a1].house_crimeRisk < 50 ) { if ( buildings[a1].house_crimeRisk > 0 ) { if ( buildings[a1].house_crimeRisk > 10 ) { if ( buildings[a1].house_crimeRisk > 20 ) { if ( buildings[a1].house_crimeRisk > 30 ) { if ( buildings[a1].house_crimeRisk > 40 ) v3 = 1; else v3 = 2; } else { v3 = 4; } } else { v3 = 6; } } else { v3 = 8; } } else { v3 = 10; } fun_drawOverlayColumn(v3, a2, a3, 1); } } } } } void fun_drawBuildingOnEntertainmentOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[a1].type ) { case B_Amphitheater: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_Theater: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_Hippodrome: fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A0514 + 4, a3 - dword_9A049C); break; case B_Colosseum: fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A0514 + 4, a3 - dword_9A049C); break; case B_GladiatorSchool: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_LionHouse: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_ActorColony: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_ChariotMaker: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; default: if ( buildings[a1].house_size ) { if ( buildings[a1].house_entertainment > 0 ) fun_drawOverlayColumn(buildings[a1].house_entertainment / 10, a2, a3, 0); } break; } } void fun_drawBuildingOnEducationOverlay(int a1, int a2, int a3) { signed int v3; // [sp+4Ch] [bp-4h]@12 graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Academy ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); return; } if ( buildings[a1].type == B_School ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); return; } if ( buildings[a1].type == B_Library ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); return; } if ( buildings[a1].house_size && buildings[a1].house_education > 0 ) { if ( buildings[a1].house_education == 1 ) { v3 = 2; } else { if ( buildings[a1].house_education == 2 ) { v3 = 5; } else { if ( buildings[a1].house_education != 3 ) return; v3 = 8; } } fun_drawOverlayColumn(v3, a2, a3, 0); } } void fun_drawBuildingOnTheaterOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Theater ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); } else { if ( buildings[a1].type == B_ActorColony ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); } else { if ( buildings[a1].house_size ) { if ( LOBYTE(buildings[a1].house_theater_amphi_wine) > 0 ) fun_drawOverlayColumn(LOBYTE(buildings[a1].house_theater_amphi_wine) / 10, a2, a3, 0); } } } } void fun_drawBuildingOnAmphitheaterOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[a1].type ) { case B_Amphitheater: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_GladiatorSchool: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_ActorColony: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; default: if ( buildings[a1].house_size ) { if ( HIBYTE(buildings[a1].house_theater_amphi_wine) > 0 ) fun_drawOverlayColumn(HIBYTE(buildings[a1].house_theater_amphi_wine) / 10, a2, a3, 0); } break; } } void fun_drawBuildingOnColosseumOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[a1].type ) { case B_Colosseum: fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A0514 + 4, a3 - dword_9A049C); break; case B_GladiatorSchool: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_LionHouse: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; default: if ( buildings[a1].house_size ) { if ( HIBYTE(buildings[a1].house_amphiGlad_colo) > 0 ) fun_drawOverlayColumn(HIBYTE(buildings[a1].house_amphiGlad_colo) / 10, a2, a3, 0); } break; } } void fun_drawBuildingOnHippodromeOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Hippodrome ) { fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A0514 + 4, a3 - dword_9A049C); } else { if ( buildings[a1].type == B_ChariotMaker ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); } else { if ( buildings[a1].house_size ) { if ( HIBYTE(buildings[a1].house_coloLion_hippo) > 0 ) fun_drawOverlayColumn(HIBYTE(buildings[a1].house_coloLion_hippo) / 10, a2, a3, 0); } } } } void fun_drawBuildingOnFoodStocksOverlay(int a1, int a2, int a3) { int v3; // [sp+4Ch] [bp-14h]@15 int houseFoodCount; // [sp+50h] [bp-10h]@11 signed int foodTypesCount; // [sp+54h] [bp-Ch]@9 signed int i; // [sp+58h] [bp-8h]@11 signed int v7; // [sp+5Ch] [bp-4h]@20 graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[a1].type ) { case B_Market: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_Wharf: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_Granary: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; default: if ( buildings[a1].house_size ) { foodTypesCount = model_houses[ buildings[a1].level_resourceId ].foodtypes; if ( foodTypesCount ) foodTypesCount = buildings[a1].house_population; houseFoodCount = 0; for ( i = 0; i < 4; ++i ) houseFoodCount += buildings[a1].grow_value_house_foodstocks[i]; if ( foodTypesCount ) v3 = getPercentage(houseFoodCount, foodTypesCount); else v3 = 400; if ( v3 <= 200 ) { if ( v3 < 100 ) { if ( v3 <= 0 ) v7 = 10; else v7 = 5; } else { v7 = 1; } fun_drawOverlayColumn(v7, a2, a3, 1); } } break; } } void fun_drawBuildingOnBathhouseOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Bathhouse ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); } else { if ( buildings[a1].house_size ) { if ( buildings[a1].house_bathhouse_dock_numships_entert_days > 0 ) fun_drawOverlayColumn( buildings[a1].house_bathhouse_dock_numships_entert_days / 10, a2, a3, 0); } } } void fun_drawBuildingOnReligionOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; switch ( buildings[a1].type ) { case B_Oracle: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_SmallTempleCeres: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_SmallTempleNeptune: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_SmallTempleMercury: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_SmallTempleMars: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_SmallTempleVenus: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case B_LargeTempleCeres: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_LargeTempleNeptune: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_LargeTempleMercury: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_LargeTempleMars: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case B_LargeTempleVenus: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; default: if ( buildings[a1].house_size ) { if ( buildings[a1].house_numGods > 0 ) fun_drawOverlayColumn(17 * buildings[a1].house_numGods / 10, a2, a3, 0); } break; } } void fun_drawBuildingOnSchoolOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_School ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); } else { if ( buildings[a1].house_size ) { if ( LOBYTE(buildings[a1].house_school_library) > 0 ) fun_drawOverlayColumn(LOBYTE(buildings[a1].house_school_library) / 10, a2, a3, 0); } } } void fun_drawBuildingOnLibraryOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Library ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); } else { if ( buildings[a1].house_size ) { if ( HIBYTE(buildings[a1].house_school_library) > 0 ) fun_drawOverlayColumn(HIBYTE(buildings[a1].house_school_library) / 10, a2, a3, 0); } } } void fun_drawBuildingOnAcademyOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Academy ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); } else { if ( buildings[a1].house_size ) { if ( LOBYTE(buildings[a1].house_academy_barber) > 0 ) fun_drawOverlayColumn(LOBYTE(buildings[a1].house_academy_barber) / 10, a2, a3, 0); } } } void fun_drawBuildingOnBarberOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Barber ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if ( buildings[a1].house_size ) { if ( HIBYTE(buildings[a1].house_academy_barber) > 0 ) fun_drawOverlayColumn(HIBYTE(buildings[a1].house_academy_barber) / 10, a2, a3, 0); } } } void drawBuildingOnClinicOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Doctor ) { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } else { if ( buildings[a1].house_size ) { if ( buildings[a1].house_clinic > 0 ) fun_drawOverlayColumn(buildings[a1].house_clinic / 10, a2, a3, 0); } } } void fun_drawBuildingOnHospitalOverlay(int a1, int a2, int a3) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_Hospital ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); } else { if ( buildings[a1].house_size ) { if ( buildings[a1].house_hospital_entert_days2 > 0 ) fun_drawOverlayColumn( buildings[a1].house_hospital_entert_days2 / 10, a2, a3, 0); } } } void fun_drawBuildingOnTaxIncomeOverlay(int a1, int a2, int a3) { signed int v3; // [sp+4Ch] [bp-8h]@7 graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( buildings[a1].type == B_SenateUpgraded ) { fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A0514 + 4, a3 - dword_9A049C); } else { if ( buildings[a1].type == B_Forum ) { fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); } else { if ( buildings[a1].house_size ) { v3 = fun_adjustWithPercentage( building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * a1] / 2, city_inform[ciid].taxrate); if ( v3 > 0 ) fun_drawOverlayColumn(v3 / 25, a2, a3, 0); } } } } void fun_drawBuildingOnProblemsOverlay(int a1, int a2, int a3) { signed int v3; // [sp+4Ch] [bp-1Ch]@1 int v4; // [sp+50h] [bp-18h]@27 int v5; // [sp+54h] [bp-14h]@55 int v6; // [sp+5Ch] [bp-Ch]@10 int v7; // [sp+5Ch] [bp-Ch]@17 v3 = 0; if ( !buildings[a1].house_size ) { if ( buildings[a1].type != B_Fountain && buildings[a1].type != B_Bathhouse ) { if ( buildings[a1].type < B_WheatFarm || buildings[a1].type > B_ClayPit ) { if ( buildings[a1].type >= B_OilWorkshop ) { if ( buildings[a1].type <= B_PotteryWorkshop ) { v7 = buildings[a1].walkerId; if ( buildings[a1].walkerId && walkers[v7].actionState == 20 && walkers[v7].maxLevelOrRiskSeen ) { buildings[a1].haveProblems = 1; } else { if ( buildings[a1].industry_unitsStored <= 0 ) buildings[a1].haveProblems = 1; } } } } else { v6 = buildings[a1].walkerId; if ( buildings[a1].walkerId ) { if ( walkers[v6].actionState == 20 ) { if ( walkers[v6].maxLevelOrRiskSeen ) buildings[a1].haveProblems = 1; } } } } else { if ( !buildings[a1].hasFountain ) buildings[a1].haveProblems = 1; } if ( buildings[a1].haveProblems > 0 ) { if ( buildings[a1].type < B_WheatFarm || buildings[a1].type > B_PigFarm ) { if ( buildings[a1].type == B_Granary ) { drawGraphic( graphic_granary + 1, c3_sg2[grid_graphicIds[dword_9D4B4C]].sprite_top_offset + a2, c3_sg2[grid_graphicIds[dword_9D4B4C]].sprite_left_offset + a3 - iso_tile_height - (c3_sg2[grid_graphicIds[dword_9D4B4C]].height - 90)); if ( buildings[a1].granary_capacity[0] < 2400 ) { drawGraphic(graphic_granary + 2, a2 + 32, a3 - 61); if ( buildings[a1].granary_capacity[0] < 1800 ) drawGraphic(graphic_granary + 3, a2 + 56, a3 - 51); if ( buildings[a1].granary_capacity[0] < 1200 ) drawGraphic(graphic_granary + 4, a2 + 91, a3 - 51); if ( buildings[a1].granary_capacity[0] < 600 ) drawGraphic(graphic_granary + 5, a2 + 118, a3 - 61); } } if ( buildings[a1].type == 72 ) drawGraphic(word_6E6C54 + 17, a2 - 4, a3 - 42); v5 = grid_bitfields[dword_9D4B4C] & 0xF; graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( v5 ) { switch ( v5 ) { case 1: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); break; case 2: fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_width + 2, a3 - iso_tile_height); break; case 4: fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A04B8 + 3, a3 - dword_9A04F0); break; case 8: fun_drawBuilding(graphic_currentGraphicId, a2 + dword_9A0514 + 4, a3 - dword_9A049C); break; } } else { fun_drawBuilding(graphic_currentGraphicId, a2, a3); } } else { v4 = grid_edge[dword_9D4B4C]; if ( !setting_map_orientation ) { if ( v4 != 72 ) v3 = 1; } if ( setting_map_orientation == 2 ) { if ( v4 != 64 ) v3 = 1; } if ( setting_map_orientation == 4 ) { if ( v4 != 65 ) v3 = 1; } if ( setting_map_orientation == 6 ) { if ( v4 != 73 ) v3 = 1; } if ( v3 ) { if ( v4 & 0x40 ) { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; fun_drawBuilding(graphic_currentGraphicId, a2, a3); } } else { graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; fun_drawBuilding(graphic_currentGraphicId, a2 + iso_tile_half_width + 1, a3 - iso_tile_half_height); } } } } } void fun_drawBuildingOnWorkersOverlay(int buildingId, int a2, int a3) { int v3; // ST60_4@5 if ( !buildings[buildingId].house_size ) { if ( buildings[buildingId].walkerServiceAccess > 0 ) { v3 = getPercentage(buildings[buildingId].walkerServiceAccess, 300) / 10; fun_drawOverlayColumn(v3, a2, a3, 0); } } } void fun_drawOverlayColumn(signed int height, int a2, int a3, int isRed) { signed int v4; // [sp+4Ch] [bp-10h]@3 int v5; // [sp+50h] [bp-Ch]@5 signed int v6; // [sp+54h] [bp-8h]@5 int i; // [sp+58h] [bp-4h]@9 if ( height > 10 ) height = 10; v4 = 0; if ( isRed ) v4 = 9; v6 = v4 + word_6E6C7E; v5 = c3_sg2[v4 + word_6E6C7E].height; if ( height ) { if ( height == 1 ) { drawGraphic(word_6E6C7E + v4 + 2, a2 + 9, a3 - 8); drawGraphic(v6, a2 + 5, a3 - 8 - v5 + 13); } else { drawGraphic(word_6E6C7E + v4 + 2, a2 + 9, a3 - 8); drawGraphic(v6, a2 + 5, a3 - 8 - v5 - 10 * (height - 1) + 13); graphic_currentGraphicId = word_6E6C7E + v4 + 1; for ( i = 0; i < height - 1; ++i ) drawGraphic(graphic_currentGraphicId, a2 + 17, a3 - 8 - 10 * (i + 1) + 13); } } else { graphic_currentGraphicId = word_6E6C7E + v4 + 2; drawGraphic(graphic_currentGraphicId, a2 + 9, a3 - 8); } } void fun_drawExtraBuildingImages(int a1) { int v1; // [sp+4Ch] [bp-40h]@178 signed int v2; // [sp+50h] [bp-3Ch]@179 signed int v3; // [sp+54h] [bp-38h]@176 signed int v4; // [sp+58h] [bp-34h]@239 char v5; // [sp+5Ch] [bp-30h]@229 int v6; // [sp+5Ch] [bp-30h]@239 int v7; // [sp+60h] [bp-2Ch]@22 int v8; // [sp+60h] [bp-2Ch]@213 int v9; // [sp+68h] [bp-24h]@19 int v10; // [sp+68h] [bp-24h]@172 int v11; // [sp+68h] [bp-24h]@229 int i; // [sp+6Ch] [bp-20h]@153 signed int v13; // [sp+70h] [bp-1Ch]@208 int v14; // [sp+74h] [bp-18h]@170 signed int v15; // [sp+78h] [bp-14h]@1 int v16; // [sp+7Ch] [bp-10h]@1 int v17; // [sp+80h] [bp-Ch]@8 int v18; // [sp+80h] [bp-Ch]@10 int v19; // [sp+80h] [bp-Ch]@143 int v20; // [sp+80h] [bp-Ch]@145 int v21; // [sp+80h] [bp-Ch]@160 int v22; // [sp+80h] [bp-Ch]@162 int v23; // [sp+84h] [bp-8h]@1 int v24; // [sp+88h] [bp-4h]@10 int v25; // [sp+88h] [bp-4h]@145 int v26; // [sp+88h] [bp-4h]@162 v16 = iso_yoffset - iso_tile_half_height - 8 * iso_tile_half_height; v15 = 0; v23 = 0; dword_9A0540[0] = dword_9A0510 - 8; while ( v23 < iso_viewport_height + 14 ) { if ( dword_9A0540[0] >= 0 ) { if ( dword_9A0540[0] < 325 ) { if ( v15 ) v17 = iso_xoffset - (iso_tile_half_width + 1); else v17 = iso_xoffset; v18 = v17 - (4 * iso_tile_width + 8); v24 = 0; dword_9A053C = dword_9A050C - 4; while ( v24 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { if ( grid_edge[dword_9D4B4C] & 0x40 ) { v9 = grid_buildingIds[dword_9D4B4C]; if ( grid_buildingIds[dword_9D4B4C] ) { if ( buildings[v9].byte_94BDBB ) drawGraphic_colorMask = 0xfff79du; } v7 = grid_bitfields[dword_9D4B4C] & 0xF; graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( v7 ) { switch ( v7 ) { case 1: fun_drawBuilding( graphic_currentGraphicId, v18 + iso_tile_half_width + 1, v16 - iso_tile_half_height); break; case 2: fun_drawBuilding(graphic_currentGraphicId, v18 + iso_tile_width + 2, v16 - iso_tile_height); break; case 4: fun_drawBuilding(graphic_currentGraphicId, v18 + dword_9A04B8 + 3, v16 - dword_9A04F0); break; case 8: fun_drawBuilding(graphic_currentGraphicId, v18 + dword_9A0514 + 4, v16 - dword_9A049C); break; } } else { fun_drawBuilding(graphic_currentGraphicId, v18, v16); } if ( buildings[v9].type == B_SenateUpgraded ) { graphic_currentGraphicId = word_6E6C2C; drawGraphic( graphic_currentGraphicId + 1, v18 + 138, v16 - dword_9A049C + 104 - city_inform[ciid].cultureRating / 2); drawGraphic( graphic_currentGraphicId + 2, v18 + 168, v16 - dword_9A049C + 96 - city_inform[ciid].prosperityRating / 2); drawGraphic( graphic_currentGraphicId + 3, v18 + 198, v16 - dword_9A049C + 87 - city_inform[ciid].peaceRating / 2); drawGraphic( graphic_currentGraphicId + 4, v18 + 228, v16 - dword_9A049C + 79 - city_inform[ciid].favorRating / 2); if ( city_inform[ciid].unemploymentForSenateDrawing > 0 ) drawGraphic(graphic_homeless + 108, v18 + 80, v16); if ( city_inform[ciid].unemploymentForSenateDrawing > 5 ) drawGraphic(graphic_homeless + 104, v18 + 230, v16 - 30); if ( city_inform[ciid].unemploymentForSenateDrawing > 10 ) drawGraphic(graphic_homeless + 107, v18 + 100, v16 + 20); if ( city_inform[ciid].unemploymentForSenateDrawing > 15 ) drawGraphic(graphic_homeless + 106, v18 + 235, v16 - 10); if ( city_inform[ciid].unemploymentForSenateDrawing > 20 ) drawGraphic(graphic_homeless + 106, v18 + 66, v16 + 20); } if ( buildings[v9].type == B_Amphitheater ) { if ( buildings[v9].num_workers > 0 ) drawGraphic(word_6E6D30, v18 + 36, v16 - 47); } if ( buildings[v9].type == B_Theater ) { if ( buildings[v9].num_workers > 0 ) drawGraphic(word_6E6D2E, v18 + 34, v16 - 22); } if ( buildings[v9].type == B_Hippodrome ) { if ( buildings[sub_4789E0(v9)].num_workers > 0 ) { if ( city_inform[ciid].dword_654624 ) { if ( buildings[v9].level_resourceId || city_inform[ciid].population <= 2000 ) { if ( buildings[v9].level_resourceId != 1 || city_inform[ciid].population <= 100 ) { if ( buildings[v9].level_resourceId != 2 || city_inform[ciid].population <= 1000 ) { if ( buildings[v9].level_resourceId != 3 || city_inform[ciid].population <= 2000 ) { if ( buildings[v9].level_resourceId != 4 || city_inform[ciid].population <= 100 ) { if ( buildings[v9].level_resourceId == 5 ) { if ( city_inform[ciid].population > 1000 ) { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: drawGraphic(word_6E6D5A + 6, v18, v16 - 72); break; case 4: drawGraphic(word_6E6D5C + 6, v18 + 147, v16 - 72); break; case 6: drawGraphic(word_6E6D5A + 8, v18 + 58, v16 - 79); break; } } else { drawGraphic(word_6E6D5C + 8, v18 + 119, v16 - 80); } } } } else { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: drawGraphic(word_6E6D5A + 7, v18, v16 - 80); break; case 4: drawGraphic(word_6E6D5C + 7, v18 + 122, v16 - 79); break; case 6: drawGraphic(word_6E6D5A + 7, v18, v16 - 80); break; } } else { drawGraphic(word_6E6D5C + 7, v18 + 122, v16 - 79); } } } else { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: drawGraphic(word_6E6D5A + 8, v18 + 58, v16 - 79); break; case 4: drawGraphic(word_6E6D5C + 8, v18 + 119, v16 - 80); break; case 6: drawGraphic(word_6E6D5A + 6, v18, v16 - 72); break; } } else { drawGraphic(word_6E6D5C + 6, v18 + 147, v16 - 72); } } } else { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: drawGraphic(word_6E6D5A + 6, v18, v16 - 72); break; case 4: drawGraphic(word_6E6D5C + 6, v18 + 147, v16 - 72); break; case 6: drawGraphic(word_6E6D5A + 8, v18 + 58, v16 - 79); break; } } else { drawGraphic(word_6E6D5C + 8, v18 + 119, v16 - 80); } } } else { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: drawGraphic(word_6E6D5A + 7, v18, v16 - 80); break; case 4: drawGraphic(word_6E6D5C + 7, v18 + 122, v16 - 79); break; case 6: drawGraphic(word_6E6D5A + 7, v18, v16 - 80); break; } } else { drawGraphic(word_6E6D5C + 7, v18 + 122, v16 - 79); } } } else { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: drawGraphic(word_6E6D5A + 8, v18 + 58, v16 - 79); break; case 4: drawGraphic(word_6E6D5C + 8, v18 + 119, v16 - 80); break; case 6: drawGraphic(word_6E6D5A + 6, v18, v16 - 72); break; } } else { drawGraphic(word_6E6D5C + 6, v18 + 147, v16 - 72); } } } } } if ( buildings[v9].type == B_Colosseum ) { if ( buildings[v9].num_workers > 0 ) drawGraphic(word_6E6D32, v18 + 70, v16 - 90); } if ( buildings[v9].type == B_WineWorkshop ) { if ( buildings[v9].industry_unitsStored >= 2 || buildings[v9].house_mercury ) drawGraphic(word_6E6C28, v18 + 45, v16 + 23); } if ( buildings[v9].type == B_OilWorkshop ) { if ( buildings[v9].industry_unitsStored >= 2 || buildings[v9].house_mercury ) drawGraphic(word_6E6C28 + 1, v18 + 35, v16 + 15); } if ( buildings[v9].type == B_WeaponsWorkshop ) { if ( buildings[v9].industry_unitsStored >= 2 || buildings[v9].house_mercury ) drawGraphic(word_6E6C28 + 3, v18 + 46, v16 + 24); } if ( buildings[v9].type == B_FurnitureWorkshop ) { if ( buildings[v9].industry_unitsStored >= 2 || buildings[v9].house_mercury ) drawGraphic(word_6E6C28 + 2, v18 + 48, v16 + 19); } if ( buildings[v9].type == B_PotteryWorkshop ) { if ( buildings[v9].industry_unitsStored >= 2 || buildings[v9].house_mercury ) drawGraphic(word_6E6C28 + 4, v18 + 47, v16 + 24); } drawGraphic_colorMask = 0; } } } } v18 += iso_tile_width + 2; ++v24; ++dword_9A053C; } if ( v15 ) v19 = iso_xoffset - (iso_tile_half_width + 1); else v19 = iso_xoffset; v20 = v19 - (4 * iso_tile_width + 8); v25 = 0; dword_9A053C = dword_9A050C - 4; while ( v25 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { for ( i = grid_walkerIds[dword_9D4B4C]; i > 0; i = walkers[i].nextIdOnSameTile ) { if ( !walkers[i].reachedLastStep ) drawWalker(i, v20, v16, a1); } } } } v20 += iso_tile_width + 2; ++v25; ++dword_9A053C; } if ( v15 ) v21 = iso_xoffset - (iso_tile_half_width + 1); else v21 = iso_xoffset; v22 = v21 - (4 * iso_tile_width + 8); v26 = 0; dword_9A053C = dword_9A050C - 4; while ( v26 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { v14 = grid_graphicIds[dword_9D4B4C]; if ( c3_sg2[v14].unknown_1E ) { if ( grid_edge[dword_9D4B4C] & 0x40 ) { v10 = grid_buildingIds[dword_9D4B4C]; if ( grid_buildingIds[dword_9D4B4C] ) { if ( buildings[v10].byte_94BDBB ) drawGraphic_colorMask = -1949; } if ( buildings[v10].type == B_Dock ) { v3 = sub_4A4F80(v10); if ( v3 > 0 ) { v1 = grid_graphicIds[buildings[v10].gridOffset]; if ( v1 == word_6E6C4C ) { v2 = word_6E6D06; } else { if ( v1 == word_6E6D00 ) { v2 = word_6E6D06 + 3; } else { if ( v1 == word_6E6D02 ) v2 = word_6E6D06 + 6; else v2 = word_6E6D06 + 9; } } if ( v3 > 1 ) { if ( v3 > 2 ) { if ( v3 <= 3 ) v2 += 2; } else { ++v2; } } drawGraphic(v2, c3_sg2[v2].sprite_top_offset + v22, c3_sg2[v2].sprite_left_offset + v16); } v14 = grid_graphicIds[dword_9D4B4C]; } if ( buildings[v10].type == B_Warehouse ) { drawGraphic(word_6E6C54 + 17, v22 - 4, v16 - 42); if ( v10 == city_inform[ciid].tradeCenterId ) drawGraphic(word_6E6D8C, v22 + 19, v16 - 56); } if ( buildings[v10].type == B_Granary ) { drawGraphic( graphic_granary + 1, c3_sg2[v14].sprite_top_offset + v22, c3_sg2[v14].sprite_left_offset + v16 - iso_tile_height - (c3_sg2[v14].height - 90)); if ( buildings[v10].granary_capacity[0] < 2400 ) { drawGraphic(graphic_granary + 2, v22 + 33, v16 - 60); if ( buildings[v10].granary_capacity[0] < 1800 ) drawGraphic(graphic_granary + 3, v22 + 56, v16 - 50); if ( buildings[v10].granary_capacity[0] < 1200 ) drawGraphic(graphic_granary + 4, v22 + 91, v16 - 50); if ( buildings[v10].granary_capacity[0] < 600 ) drawGraphic(graphic_granary + 5, v22 + 117, v16 - 62); } } if ( buildings[v10].type == B_BurningRuin ) { if ( buildings[v10].byte_94BDB9 ) drawGraphic(word_6E6D76, v22 + 18, v16 - 32); } v13 = fun_getBuildingAnimationIndex(v14, dword_9D4B4C); if ( buildings[v10].type != B_Hippodrome ) { if ( v13 > 0 ) { if ( v13 > c3_sg2[v14].unknown_1E ) v13 = c3_sg2[v14].unknown_1E; v8 = grid_bitfields[dword_9D4B4C] & 0xF; if ( buildings[v10].type == B_Granary ) { drawGraphic(v14 + v13 + 5, v22 + 77, v16 - 49); } else { if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v8 ) { case 1: drawGraphic( v13 + v14, c3_sg2[v14].sprite_top_offset + v22, c3_sg2[v14].sprite_left_offset + v16 - iso_tile_half_height - (c3_sg2[v14].height - 60)); break; case 2: drawGraphic( v13 + v14, c3_sg2[v14].sprite_top_offset + v22, c3_sg2[v14].sprite_left_offset + v16 - iso_tile_height - (c3_sg2[v14].height - 90)); break; case 4: drawGraphic( v13 + v14, c3_sg2[v14].sprite_top_offset + v22, c3_sg2[v14].sprite_left_offset + v16 - dword_9A04F0 - (c3_sg2[v14].height - 120)); break; case 8: drawGraphic( v13 + v14, c3_sg2[v14].sprite_top_offset + v22, c3_sg2[v14].sprite_left_offset + v16 - dword_9A049C - (c3_sg2[v14].height - 150)); break; } } else { drawGraphic( v13 + v14, c3_sg2[v14].sprite_top_offset + v22, c3_sg2[v14].sprite_left_offset + v16 - (c3_sg2[v14].height - 30)); } } } } drawGraphic_colorMask = 0; } } else { if ( grid_animation[dword_9D4B4C] ) { fun_drawBridge(v22, v16); } else { v5 = grid_edge[dword_9D4B4C]; v11 = grid_buildingIds[dword_9D4B4C]; if ( buildings[v11].type == B_FortGround__ ) { if ( v5 & 0x40 ) { switch ( buildings[v11].level_resourceId ) { case 13: drawGraphic(word_6E6C34 + 4, v22 + 81, v16 + 5); break; case 12: drawGraphic(word_6E6C34 + 3, v22 + 81, v16 + 5); break; case 11: drawGraphic(word_6E6C34 + 2, v22 + 81, v16 + 5); break; } } } else { if ( buildings[v11].type == B_Gatehouse ) { v4 = 0; v6 = v5 & 0x3F; if ( setting_map_orientation || v6 != 9 ) { if ( setting_map_orientation != 2 || v6 != 8 ) { if ( setting_map_orientation != 4 || v6 ) { if ( setting_map_orientation == 6 ) { if ( v6 == 1 ) v4 = 1; } } else { v4 = 1; } } else { v4 = 1; } } else { v4 = 1; } if ( v4 ) { if ( buildings[v11].level_resourceId == 1 ) { if ( setting_map_orientation && setting_map_orientation != 4 ) drawGraphic(word_6E6DA0 + 1, v22 - 18, v16 - 81); else drawGraphic(word_6E6DA0, v22 - 22, v16 - 80); } else { if ( buildings[v11].level_resourceId == 2 ) { if ( setting_map_orientation && setting_map_orientation != 4 ) drawGraphic(word_6E6DA0, v22 - 22, v16 - 80); else drawGraphic(word_6E6DA0 + 1, v22 - 18, v16 - 81); } } } } } } } } } } v22 += iso_tile_width + 2; ++v26; ++dword_9A053C; } } } if ( v15 ) v15 = 0; else v15 = 1; v16 += iso_tile_half_height; ++v23; ++dword_9A0540[0]; } } void fun_drawBridge(int x, int y) { __int16 terrain; // ax@1 __int16 terrain2; // ax@3 int animationId; // [sp+4Ch] [bp-4h]@1 animationId = grid_animation[dword_9D4B4C]; terrain = grid_terrain[dword_9D4B4C]; if ( terrain & T_Water ) { terrain2 = grid_terrain[dword_9D4B4C]; if ( !(terrain2 & T_Building) ) { if ( grid_bitfields[dword_9D4B4C] & 0x40 ) drawGraphic_colorMask = 0xF863u; switch ( animationId ) { case 1: drawGraphic(graphic_bridge + 5, x, y - 20); break; case 2: drawGraphic(graphic_bridge, x - 1, y - 8); break; case 3: drawGraphic(graphic_bridge + 3, x, y - 8); break; case 4: drawGraphic(graphic_bridge + 2, x + 7, y - 20); break; case 5: drawGraphic(graphic_bridge + 4, x, y - 21); break; case 6: drawGraphic(graphic_bridge + 1, x + 5, y - 21); break; case 7: drawGraphic(graphic_bridge + 11, x - 3, y - 50); break; case 8: drawGraphic(graphic_bridge + 6, x - 1, y - 12); break; case 9: drawGraphic(graphic_bridge + 9, x - 30, y - 12); break; case 10: drawGraphic(graphic_bridge + 8, x - 23, y - 53); break; case 11: drawGraphic(graphic_bridge + 10, x, y - 37); break; case 12: drawGraphic(graphic_bridge + 7, x + 7, y - 38); break; default: if ( animationId != 13 ) // ship bridge pillars { if ( animationId == 14 ) { drawGraphic(graphic_bridge + 13, x, y - 38); } else { if ( animationId == 15 ) drawGraphic(graphic_bridge + 12, x + 7, y - 38); } } break; } drawGraphic_colorMask = 0; } } else { grid_animation[dword_9D4B4C] = 0; } } void drawWalker(int walkerId, int a2, int a3, int a4) { signed int v4; // ST70_4@279 int v5; // ST74_4@279 int v6; // [sp+4Ch] [bp-20h]@277 int v7; // [sp+50h] [bp-1Ch]@75 int v8; // [sp+50h] [bp-1Ch]@85 int v9; // [sp+50h] [bp-1Ch]@93 int v10; // [sp+50h] [bp-1Ch]@104 signed int v11; // [sp+54h] [bp-18h]@1 int v12; // [sp+5Ch] [bp-10h]@4 int v13; // [sp+60h] [bp-Ch]@4 int v14; // [sp+64h] [bp-8h]@12 int v15; // [sp+64h] [bp-8h]@12 int v16; // [sp+64h] [bp-8h]@16 int v17; // [sp+64h] [bp-8h]@17 int v18; // [sp+68h] [bp-4h]@16 int v19; // [sp+68h] [bp-4h]@16 int v20; // [sp+68h] [bp-4h]@17 dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; v11 = walkers[walkerId].word_7FA344; if ( debug_showPeople != 1 ) { if ( walkers[walkerId].byte_7FA34C ) { v13 = walkers[walkerId].tilePosition_y % 15; v12 = walkers[walkerId].tilePosition_x % 15; if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 2: v18 = *(&byte_5F12D0[16 * v12] + v13); v14 = -*(&byte_5F13D0[16 * v12] + v13); break; case 4: v18 = -*(&byte_5F10D0[16 * v12] + v13); v14 = -*(&byte_5F11D0[16 * v12] + v13); break; case 6: v18 = -*(&byte_5F12D0[16 * v12] + v13); v14 = *(&byte_5F13D0[16 * v12] + v13); break; } } else { v18 = *(&byte_5F10D0[16 * v12] + v13); v14 = *(&byte_5F11D0[16 * v12] + v13); } v15 = v14 - walkers[walkerId].speed; } else { v18 = *(&byte_5F14D0[16 * dword_65DF24] + walkers[walkerId].progressOnTile); v15 = *(&byte_5F1550[16 * dword_65DF24] + walkers[walkerId].progressOnTile) - walkers[walkerId].byte_7FA3A6; if ( walkers[walkerId].byte_7FA3B8 ) { if ( walkers[walkerId].type != Walker_Ballista ) { v18 += byte_5F17D0[walkers[walkerId].byte_7FA3B8]; v15 += byte_5F17E8[walkers[walkerId].byte_7FA3B8]; } } } v19 = iso_tile_half_width + v18; v16 = iso_tile_half_height + v15; if ( walkers[walkerId].byte_7FA342 ) { v20 = v19 - enemy_sg2[v11].sprite_top_offset; v17 = v16 - enemy_sg2[v11].sprite_left_offset; } else { v20 = v19 - c3_sg2[v11].sprite_top_offset; v17 = v16 - c3_sg2[v11].sprite_left_offset; } if ( a4 ) { if ( a4 == 9999 ) { if ( currentOverlay == 2 ) return; if ( currentOverlay == Overlay_Native ) { if ( walkers[walkerId].type != Walker_IndigenousNative && walkers[walkerId].type != Walker_Missionary ) return; } else { if ( currentOverlay == Overlay_Desirability || currentOverlay == Overlay_Fire && walkers[walkerId].type != Walker_Prefect || currentOverlay == Overlay_Damage && walkers[walkerId].type != Walker_Engineer || currentOverlay == Overlay_TaxIncome && walkers[walkerId].type != Walker_TaxCollector ) return; switch ( currentOverlay ) { case Overlay_Crime: if ( walkers[walkerId].type != Walker_Prefect && walkers[walkerId].type != Walker_Protestor && walkers[walkerId].type != Walker_Criminal && walkers[walkerId].type != Walker_Rioter ) return; break; case Overlay_Entertainment: if ( walkers[walkerId].type != Walker_Actor && walkers[walkerId].type != Walker_Gladiator && walkers[walkerId].type != Walker_LionTamer && walkers[walkerId].type != Walker_Charioteer ) return; break; case Overlay_Education: if ( walkers[walkerId].type != Walker_SchoolChild && walkers[walkerId].type != Walker_Librarian && walkers[walkerId].type != Walker_Teacher ) return; break; case Overlay_Theater: if ( walkers[walkerId].type != Walker_Actor || (walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ? (v7 = walkers[walkerId].baseWorkingBuildingId) : (v7 = walkers[walkerId].buildingId), buildings[v7].type != B_Theater) ) return; break; case Overlay_Amphiheater: if ( walkers[walkerId].type == Walker_Actor ) { if ( walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ) v8 = walkers[walkerId].baseWorkingBuildingId; else v8 = walkers[walkerId].buildingId; if ( buildings[v8].type != B_Amphitheater ) return; } else { if ( walkers[walkerId].type != Walker_Gladiator || (walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ? (v9 = walkers[walkerId].baseWorkingBuildingId) : (v9 = walkers[walkerId].buildingId), buildings[v9].type != B_Amphitheater) ) return; } break; case Overlay_Colosseum: if ( walkers[walkerId].type == Walker_Gladiator ) { if ( walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ) v10 = walkers[walkerId].baseWorkingBuildingId; else v10 = walkers[walkerId].buildingId; if ( buildings[v10].type != B_Colosseum ) return; } else { if ( walkers[walkerId].type != Walker_LionTamer ) return; } break; case Overlay_Hippodrome: if ( walkers[walkerId].type != Walker_Charioteer ) return; break; case Overlay_FoodStocks: if ( walkers[walkerId].type != Walker_MarketTrader && walkers[walkerId].type != Walker_MarketBuyer && walkers[walkerId].type != Walker_DeliveryBoy && walkers[walkerId].type != Walker_FishingBoat && (walkers[walkerId].type != Walker_CartPusher || walkers[walkerId].cartPusherGoodType != G_Wheat && walkers[walkerId].cartPusherGoodType != G_Vegetables && walkers[walkerId].cartPusherGoodType != G_Fruit && walkers[walkerId].cartPusherGoodType != G_MeatFish) ) return; break; case Overlay_Religion: if ( walkers[walkerId].type != Walker_Priest ) return; break; case Overlay_School: if ( walkers[walkerId].type != Walker_SchoolChild ) return; break; case Overlay_Library: if ( walkers[walkerId].type != Walker_Librarian ) return; break; case Overlay_Academy: if ( walkers[walkerId].type != Walker_Teacher ) return; break; case Overlay_Barber: if ( walkers[walkerId].type != Walker_Barber ) return; break; case Overlay_Bathhouse: if ( walkers[walkerId].type != Walker_BathhouseWorker ) return; break; case Overlay_Clinic: if ( walkers[walkerId].type != Walker_Doctor ) return; break; case Overlay_Hospital: if ( walkers[walkerId].type != Walker_Surgeon ) return; break; case Overlay_Workers: if ( walkers[walkerId].type != Walker_LaborSeeker ) return; break; case Overlay_Problems: if ( walkers[walkerId].type == Walker_LaborSeeker ) { if ( !buildings[walkers[walkerId].buildingId].haveProblems ) return; } else { if ( walkers[walkerId].type != Walker_CartPusher || walkers[walkerId].actionState != 20 || !walkers[walkerId].maxLevelOrRiskSeen ) return; } break; } } } else { if ( walkerId != a4 ) return; dword_9D4B50 = v20 + a2; dword_9D4B48 = v17 + a3; } } if ( walkers[walkerId].word_7FA346 ) { if ( walkers[walkerId].type != Walker_CartPusher && walkers[walkerId].type != Walker_Warehouseman && walkers[walkerId].type != Walker_LionTamer && walkers[walkerId].type != Walker_Dockman && walkers[walkerId].type != Walker_NativeTrader ) { if ( walkers[walkerId].type == Walker_HippodromeMiniHorses ) { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: v20 -= 10; if ( walkers[walkerId].byte_7FA39B > 9 ) { if ( walkers[walkerId].byte_7FA39B > 10 ) { if ( walkers[walkerId].byte_7FA39B > 11 ) { if ( walkers[walkerId].byte_7FA39B > 12 ) { if ( walkers[walkerId].byte_7FA39B > 13 ) { if ( walkers[walkerId].byte_7FA39B > 20 ) { if ( walkers[walkerId].byte_7FA39B > 21 ) v17 -= 12; else v17 -= 6; } else { v17 -= 2; } } } } else { v17 += 2; } } else { v17 += 4; } } else { v17 -= 12; } break; case 4: v20 += 20; if ( walkers[walkerId].byte_7FA39B > 9 ) { if ( walkers[walkerId].byte_7FA39B > 10 ) { if ( walkers[walkerId].byte_7FA39B > 11 ) { if ( walkers[walkerId].byte_7FA39B > 12 ) { if ( walkers[walkerId].byte_7FA39B > 13 ) { if ( walkers[walkerId].byte_7FA39B > 20 ) { if ( walkers[walkerId].byte_7FA39B > 21 ) v17 -= 2; else v17 -= 10; } else { v17 -= 12; } } else { v17 -= 6; } } else { v17 -= 4; v20 += 10; } } else { v17 -= 4; v20 += 10; } } else { v17 += 4; v20 += 10; } } else { v17 += 4; } break; case 2: v20 -= 10; if ( walkers[walkerId].byte_7FA39B > 9 ) { if ( walkers[walkerId].byte_7FA39B > 10 ) { if ( walkers[walkerId].byte_7FA39B > 11 ) { if ( walkers[walkerId].byte_7FA39B > 12 ) { if ( walkers[walkerId].byte_7FA39B > 13 ) { if ( walkers[walkerId].byte_7FA39B > 20 ) { if ( walkers[walkerId].byte_7FA39B > 21 ) v17 -= 12; else v17 -= 6; } else { v17 -= 2; } } else { v20 -= 5; } } else { v20 -= 5; } } else { v17 += 2; v20 -= 5; } } else { v17 += 4; } } else { v17 -= 12; } break; } } else { v20 += 10; if ( walkers[walkerId].byte_7FA39B > 10 ) { if ( walkers[walkerId].byte_7FA39B > 11 ) { if ( walkers[walkerId].byte_7FA39B > 12 ) { if ( walkers[walkerId].byte_7FA39B > 13 ) { if ( walkers[walkerId].byte_7FA39B > 20 ) { if ( walkers[walkerId].byte_7FA39B > 21 ) v17 -= 2; else v17 -= 10; } else { v17 -= 14; } } else { v17 -= 16; } } else { v17 -= 18; } } else { v17 -= 10; } } else { v17 -= 2; } } if ( walkers[walkerId].byte_7FA39D >= 0 ) { drawGraphic(v11, v20 + a2, v17 + a3); drawGraphic( walkers[walkerId].word_7FA346, walkers[walkerId].byte_7FA39C + v20 + a2, walkers[walkerId].byte_7FA39D + v17 + a3); } else { drawGraphic( walkers[walkerId].word_7FA346, walkers[walkerId].byte_7FA39C + v20 + a2, walkers[walkerId].byte_7FA39D + v17 + a3); drawGraphic(v11, v20 + a2, v17 + a3); } } else { if ( walkers[walkerId].type != Walker_Immigrant && walkers[walkerId].type != Walker_Emigrant ) { if ( walkers[walkerId].type == Walker_FortStandard ) { v6 = walkers[walkerId].formationId; if ( !formations[v6].formation_60 ) { drawGraphic(v11, v20 + a2, v17 + a3); v4 = walkers[walkerId].word_7FA346; v5 = c3_sg2[v4].height; drawGraphic(v4, v20 + a2, v17 + a3 - v5); drawGraphic( word_6E6CAE + v6 - 1, v20 + a2, v17 + a3 - (c3_sg2[word_6E6CAE + v6 - 1].height + v5)); } } else { if ( walkers[walkerId].type == Walker_MapFlag ) { if ( walkers[walkerId].y >= 0 ) { drawGraphic(v11, v20 + a2, v17 + a3); drawGraphic( walkers[walkerId].word_7FA346, v20 + a2, v17 + a3 - c3_sg2[walkers[walkerId].word_7FA346].height); if ( walkers[walkerId].cartPusherGoodType <= 3 || walkers[walkerId].cartPusherGoodType >= 12 ) { if ( walkers[walkerId].cartPusherGoodType < 14 || walkers[walkerId].cartPusherGoodType > 21 ) { if ( walkers[walkerId].cartPusherGoodType >= 22 ) { if( walkers[walkerId].cartPusherGoodType <= 25 ) drawNumber( walkers[walkerId].cartPusherGoodType - 21, 32, " ", a2 + v20 + 9, a3 + v17 + 4, 107, -1); } } else { drawNumber( walkers[walkerId].cartPusherGoodType - 13, 32, " ", a2 + v20 + 9, a3 + v17 + 4, 107, -1); } } else { drawNumber( walkers[walkerId].cartPusherGoodType - 3, 32, " ", a2 + v20 + 9, a3 + v17 + 4, 107, -1); } } } else { drawGraphic(v11, v20 + a2, v17 + a3); } } } else { if ( walkers[walkerId].byte_7FA39D >= 0 ) { drawGraphic(v11, v20 + a2, v17 + a3); drawGraphic( walkers[walkerId].word_7FA346, walkers[walkerId].byte_7FA39C + v20 + a2, walkers[walkerId].byte_7FA39D + v17 + a3); } else { drawGraphic( walkers[walkerId].word_7FA346, walkers[walkerId].byte_7FA39C + v20 + a2, walkers[walkerId].byte_7FA39D + v17 + a3); drawGraphic(v11, v20 + a2, v17 + a3); } } } } else { if ( walkers[walkerId].byte_7FA39D >= 0 ) { drawGraphic(v11, v20 + a2, v17 + a3); drawGraphic( walkers[walkerId].word_7FA346, walkers[walkerId].byte_7FA39C + v20 + a2, walkers[walkerId].byte_7FA39D + v17 + a3); } else { drawGraphic( walkers[walkerId].word_7FA346, walkers[walkerId].byte_7FA39C + v20 + a2, walkers[walkerId].byte_7FA39D + v17 + a3); drawGraphic(v11, v20 + a2, v17 + a3); } } } else { if ( walkers[walkerId].byte_7FA342 ) fun_drawEnemyGraphic(v11, v20 + a2, v17 + a3); else drawGraphic(v11, v20 + a2, v17 + a3); } } } void sub_437E20(int a1) { int v1; // [sp+50h] [bp-28h]@46 int v2; // [sp+5Ch] [bp-1Ch]@43 int i; // [sp+60h] [bp-18h]@21 signed int v4; // [sp+64h] [bp-14h]@4 int v5; // [sp+68h] [bp-10h]@4 int v6; // [sp+6Ch] [bp-Ch]@11 int v7; // [sp+6Ch] [bp-Ch]@13 int v8; // [sp+6Ch] [bp-Ch]@32 int v9; // [sp+6Ch] [bp-Ch]@34 int v10; // [sp+70h] [bp-8h]@4 int v11; // [sp+74h] [bp-4h]@13 int v12; // [sp+74h] [bp-4h]@34 if ( byte_9DA645 == 1 ) { ++dword_94A2FC; if ( dword_94A2FC >= 5 ) dword_94A2FC = 0; } v5 = iso_yoffset - iso_tile_half_height - 8 * iso_tile_half_height; v4 = 0; v10 = 0; dword_9A0540[0] = dword_9A0510 - 8; while ( v10 < iso_viewport_height + 14 ) { if ( dword_9A0540[0] >= 0 ) { if ( dword_9A0540[0] < 325 ) { if ( v4 ) v6 = iso_xoffset - (iso_tile_half_width + 1); else v6 = iso_xoffset; v7 = v6 - (4 * iso_tile_width + 8); v11 = 0; dword_9A053C = dword_9A050C - 4; while ( v11 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { for ( i = grid_walkerIds[dword_9D4B4C]; i > 0; i = walkers[i].nextIdOnSameTile ) { if ( walkers[i].byte_7FA34C ) { if ( !walkers[i].reachedLastStep ) drawWalker(i, v7, v5, a1); } if ( walkers[i].byte_7FA3A5 ) drawWalker(i, v7, v5, a1); } } } } v7 += iso_tile_width + 2; ++v11; ++dword_9A053C; } if ( v4 ) v8 = iso_xoffset - (iso_tile_half_width + 1); else v8 = iso_xoffset; v9 = v8 - (4 * iso_tile_width + 8); v12 = 0; dword_9A053C = dword_9A050C - 4; while ( v12 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { if ( !currentOverlay ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { v2 = grid_graphicIds[dword_9D4B4C]; if ( c3_sg2[v2].unknown_1E ) { if ( grid_edge[dword_9D4B4C] & 0x40 ) { if ( buildings[grid_buildingIds[dword_9D4B4C]].type == 32 ) { v1 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v1 ) { case 1: drawGraphic( v2 + 1, c3_sg2[v2].sprite_top_offset + v9, c3_sg2[v2].sprite_left_offset + v5 - iso_tile_half_height - (c3_sg2[v2].height - 60)); break; case 2: drawGraphic( v2 + 1, c3_sg2[v2].sprite_top_offset + v9, c3_sg2[v2].sprite_left_offset + v5 - iso_tile_height - (c3_sg2[v2].height - 90)); break; case 4: drawGraphic( v2 + 1, c3_sg2[v2].sprite_top_offset + v9, c3_sg2[v2].sprite_left_offset + v5 - dword_9A04F0 - (c3_sg2[v2].height - 120)); break; case 8: drawGraphic( v2 + 1, c3_sg2[v2].sprite_top_offset + v9, c3_sg2[v2].sprite_left_offset + v5 - dword_9A049C - (c3_sg2[v2].height - 150)); break; } } else { drawGraphic( v2 + 1, c3_sg2[v2].sprite_top_offset + v9, c3_sg2[v2].sprite_left_offset + v5 - (c3_sg2[v2].height - 30)); } } } } } } } } v9 += iso_tile_width + 2; ++v12; ++dword_9A053C; } } } if ( v4 ) v4 = 0; else v4 = 1; v5 += iso_tile_half_height; ++v10; ++dword_9A0540[0]; } } void sub_4384F0() { __int16 v0; // ax@159 int v1; // [sp+4Ch] [bp-34h]@42 int v2; // [sp+4Ch] [bp-34h]@111 int v3; // [sp+50h] [bp-30h]@89 int v4; // [sp+50h] [bp-30h]@147 __int16 v5; // [sp+54h] [bp-2Ch]@42 int i; // [sp+5Ch] [bp-24h]@18 signed int v7; // [sp+60h] [bp-20h]@144 int v8; // [sp+64h] [bp-1Ch]@131 signed int v9; // [sp+68h] [bp-18h]@111 signed int v10; // [sp+6Ch] [bp-14h]@1 int v11; // [sp+70h] [bp-10h]@1 int v12; // [sp+74h] [bp-Ch]@8 int v13; // [sp+74h] [bp-Ch]@10 int v14; // [sp+74h] [bp-Ch]@25 int v15; // [sp+74h] [bp-Ch]@27 int v16; // [sp+74h] [bp-Ch]@101 int v17; // [sp+74h] [bp-Ch]@103 int v18; // [sp+78h] [bp-8h]@1 int v19; // [sp+7Ch] [bp-4h]@10 int v20; // [sp+7Ch] [bp-4h]@27 int v21; // [sp+7Ch] [bp-4h]@103 v11 = iso_yoffset - iso_tile_half_height - 8 * iso_tile_half_height; v10 = 0; v18 = 0; dword_9A0540[0] = dword_9A0510 - 8; while ( v18 < iso_viewport_height + 14 ) { if ( dword_9A0540[0] >= 0 ) { if ( dword_9A0540[0] < 325 ) { if ( v10 ) v12 = iso_xoffset - (iso_tile_half_width + 1); else v12 = iso_xoffset; v13 = v12 - (4 * iso_tile_width + 8); v19 = 0; dword_9A053C = dword_9A050C - 4; while ( v19 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 0xFFF0000u ) { for ( i = grid_walkerIds[dword_9D4B4C]; i > 0; i = walkers[i].nextIdOnSameTile ) { if ( !walkers[i].reachedLastStep ) drawWalker(i, v13, v11, 9999); } } } } v13 += iso_tile_width + 2; ++v19; ++dword_9A053C; } if ( v10 ) v14 = iso_xoffset - (iso_tile_half_width + 1); else v14 = iso_xoffset; v15 = v14 - (4 * iso_tile_width + 8); v20 = 0; dword_9A053C = dword_9A050C - 4; while ( v20 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 0xFFF0000u ) { if ( currentOverlay == Overlay_Desirability ) { fun_drawBuildingOnDesirabilityOverlayColored(v15, v11); } else { if ( grid_edge[dword_9D4B4C] & 0x40 ) { if ( currentOverlay == Overlay_Water ) { fun_drawBuildingOnWaterOverlay(v15, v11); } else { if ( currentOverlay == Overlay_Native ) { fun_drawBuildingOnNativeOverlay(v15, v11); } else { v5 = grid_terrain[dword_9D4B4C]; v1 = grid_buildingIds[dword_9D4B4C]; if ( !(v5 & 0x4140) ) { if ( v5 & 8 ) { if ( grid_buildingIds[dword_9D4B4C] ) { switch ( currentOverlay ) { case Overlay_Fire: fun_drawBuildingOnFireOverlay(v1, v15, v11); break; case Overlay_Damage: fun_drawBuildingOnDamageOverlay(v1, v15, v11); break; case Overlay_Crime: fun_drawBuildingOnCrimeOverlay(v1, v15, v11); break; case Overlay_Entertainment: fun_drawBuildingOnEntertainmentOverlay(v1, v15, v11); break; case Overlay_Education: fun_drawBuildingOnEducationOverlay(v1, v15, v11); break; case Overlay_Theater: fun_drawBuildingOnTheaterOverlay(v1, v15, v11); break; case Overlay_Amphiheater: fun_drawBuildingOnAmphitheaterOverlay(v1, v15, v11); break; case Overlay_Colosseum: fun_drawBuildingOnColosseumOverlay(v1, v15, v11); break; case Overlay_Hippodrome: fun_drawBuildingOnHippodromeOverlay(v1, v15, v11); break; case Overlay_FoodStocks: fun_drawBuildingOnFoodStocksOverlay(v1, v15, v11); break; case Overlay_Religion: fun_drawBuildingOnReligionOverlay(v1, v15, v11); break; case Overlay_School: fun_drawBuildingOnSchoolOverlay(v1, v15, v11); break; case Overlay_Library: fun_drawBuildingOnLibraryOverlay(v1, v15, v11); break; case Overlay_Academy: fun_drawBuildingOnAcademyOverlay(v1, v15, v11); break; case Overlay_Barber: fun_drawBuildingOnBarberOverlay(v1, v15, v11); break; case Overlay_Bathhouse: fun_drawBuildingOnBathhouseOverlay(v1, v15, v11); break; case Overlay_Clinic: drawBuildingOnClinicOverlay(v1, v15, v11); break; case Overlay_Hospital: fun_drawBuildingOnHospitalOverlay(v1, v15, v11); break; case Overlay_TaxIncome: fun_drawBuildingOnTaxIncomeOverlay(v1, v15, v11); break; case Overlay_Workers: fun_drawBuildingOnWorkersOverlay(v1, v15, v11); break; case Overlay_Problems: fun_drawBuildingOnProblemsOverlay(v1, v15, v11); break; } } } else { v3 = grid_bitfields[dword_9D4B4C] & 0xF; graphic_currentGraphicId = grid_graphicIds[dword_9D4B4C]; if ( v3 ) { switch ( v3 ) { case 1: fun_drawBuilding( graphic_currentGraphicId, v15 + iso_tile_half_width + 1, v11 - iso_tile_half_height); break; case 2: fun_drawBuilding( graphic_currentGraphicId, v15 + iso_tile_width + 2, v11 - iso_tile_height); break; case 4: fun_drawBuilding( graphic_currentGraphicId, v15 + dword_9A04B8 + 3, v11 - dword_9A04F0); break; case 8: fun_drawBuilding( graphic_currentGraphicId, v15 + dword_9A0514 + 4, v11 - dword_9A049C); break; } } else { fun_drawBuilding(graphic_currentGraphicId, v15, v11); } } } } } } } } } } v15 += iso_tile_width + 2; ++v20; ++dword_9A053C; } if ( v10 ) v16 = iso_xoffset - (iso_tile_half_width + 1); else v16 = iso_xoffset; v17 = v16 - (4 * iso_tile_width + 8); v21 = 0; dword_9A053C = dword_9A050C - 4; while ( v21 <= iso_viewport_width + 6 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { v9 = 0; v2 = grid_buildingIds[dword_9D4B4C]; if ( grid_buildingIds[dword_9D4B4C] ) { if ( currentOverlay != 8 && currentOverlay != 10 ) { switch ( currentOverlay ) { case 9: if ( buildings[v2].type == 81 ) v9 = 1; break; case 25: if ( buildings[v2].type == 71 || buildings[v2].type == 70 ) v9 = 1; break; case 2: if ( buildings[v2].type == 90 || buildings[v2].type == 91 ) v9 = 1; break; } } else { if ( buildings[v2].type == 55 || buildings[v2].type == 99 ) v9 = 1; } } v8 = grid_graphicIds[dword_9D4B4C]; if ( c3_sg2[v8].unknown_1E && v9 ) { if ( grid_edge[dword_9D4B4C] & 0x40 ) { if ( buildings[v2].type == 71 ) { drawGraphic( graphic_granary + 1, c3_sg2[v8].sprite_top_offset + v17, c3_sg2[v8].sprite_left_offset + v11 - iso_tile_height - (c3_sg2[v8].height - 90)); if ( buildings[v2].granary_capacity[0] < 2400 ) { drawGraphic(graphic_granary + 2, v17 + 32, v11 - 61); if ( buildings[v2].granary_capacity[0] < 1800 ) drawGraphic(graphic_granary + 3, v17 + 56, v11 - 51); if ( buildings[v2].granary_capacity[0] < 1200 ) drawGraphic(graphic_granary + 4, v17 + 91, v11 - 51); if ( buildings[v2].granary_capacity[0] < 600 ) drawGraphic(graphic_granary + 5, v17 + 117, v11 - 62); } } else { v7 = fun_getBuildingAnimationIndex(v8, dword_9D4B4C); if ( v7 > 0 ) { if ( v7 > c3_sg2[v8].unknown_1E ) v7 = c3_sg2[v8].unknown_1E; v4 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v4 ) { case 1: drawGraphic( v7 + v8, c3_sg2[v8].sprite_top_offset + v17, c3_sg2[v8].sprite_left_offset + v11 - iso_tile_half_height - (c3_sg2[v8].height - 60)); break; case 2: drawGraphic( v7 + v8, c3_sg2[v8].sprite_top_offset + v17, c3_sg2[v8].sprite_left_offset + v11 - iso_tile_height - (c3_sg2[v8].height - 90)); break; case 4: drawGraphic( v7 + v8, c3_sg2[v8].sprite_top_offset + v17, c3_sg2[v8].sprite_left_offset + v11 - dword_9A04F0 - (c3_sg2[v8].height - 120)); break; case 8: drawGraphic( v7 + v8, c3_sg2[v8].sprite_top_offset + v17, c3_sg2[v8].sprite_left_offset + v11 - dword_9A049C - (c3_sg2[v8].height - 150)); break; } } else { drawGraphic( v7 + v8, c3_sg2[v8].sprite_top_offset + v17, c3_sg2[v8].sprite_left_offset + v11 - (c3_sg2[v8].height - 30)); } } } } } else { if ( grid_animation[dword_9D4B4C] ) { v0 = grid_terrain[dword_9D4B4C]; if ( v0 & T_Water ) fun_drawBridge(v17, v11); } } } } } v17 += iso_tile_width + 2; ++v21; ++dword_9A053C; } } } if ( v10 ) v10 = 0; else v10 = 1; v11 += iso_tile_half_height; ++v18; ++dword_9A0540[0]; } } void fun_drawSelectedBuildingGhost() { if ( dword_8C79EC ) { if ( !shouldScrollMap ) { if ( !dword_9DA7C8 ) { if ( toPlace_buildingType > 0 ) { if ( mode_editor != 1 || toPlace_buildingType == 126 || toPlace_buildingType == 132 || toPlace_buildingType == 133 || toPlace_buildingType == 127 || toPlace_buildingType == 128 || toPlace_buildingType == 119 || toPlace_buildingType == 130 || toPlace_buildingType == 131 || toPlace_buildingType == B_NativeHut || toPlace_buildingType == B_NativeMeeting || toPlace_buildingType == B_NativeCrops || toPlace_buildingType == 129 ) { switch ( toPlace_buildingType ) { case B_ReservoirSimon: fun_drawBuildingGhostReservoirSimon(); break; case B_Aqueduct: fun_drawBuildingGhostAqueduct(); break; case B_Fountain: fun_drawBuildingGhostFountain(); break; case B_Bathhouse: fun_drawBuildingGhostBathhouse(); break; case B_LowBridge: fun_drawBuildingGhostBridge(); break; case B_ShipBridge: fun_drawBuildingGhostBridge(); break; case B_FortLegionaries: fun_drawBuildingGhostFort(); break; case B_FortJavelin: fun_drawBuildingGhostFort(); break; case B_FortMounted: fun_drawBuildingGhostFort(); break; case B_Hippodrome: fun_drawBuildingGhostHippodrome(); break; case B_Shipyard: fun_drawBuildingGhostShipyardWharf(); break; case B_Wharf: fun_drawBuildingGhostShipyardWharf(); break; case B_Dock: fun_drawBuildingGhostDock(); break; case B_Road: fun_drawBuildingGhostRoad(); break; case 0x81: fun_drawBuildingGhostType81(); break; default: fun_drawBuildingGhostDefault(); break; } } } } } } } void fun_drawBuildingGhostDefault() { __int16 v0; // dx@82 int v1; // ST8C_4@162 int v2; // ST8C_4@167 int v3; // ST90_4@169 int v4; // ST8C_4@169 int v5; // ST8C_4@172 int v6; // ST8C_4@174 int v7; // ST8C_4@186 int v8; // [sp+4Ch] [bp-44h]@17 int v9; // [sp+50h] [bp-40h]@17 int v10; // [sp+54h] [bp-3Ch]@37 int v11; // [sp+54h] [bp-3Ch]@51 int v12; // [sp+5Ch] [bp-34h]@97 int v13; // [sp+60h] [bp-30h]@97 int v14; // [sp+64h] [bp-2Ch]@99 int v15; // [sp+64h] [bp-2Ch]@131 int v16; // [sp+68h] [bp-28h]@97 signed int v17; // [sp+6Ch] [bp-24h]@1 signed int v18; // [sp+70h] [bp-20h]@1 int v19; // [sp+74h] [bp-1Ch]@6 int v20; // [sp+78h] [bp-18h]@131 int v21; // [sp+78h] [bp-18h]@182 int v22; // [sp+7Ch] [bp-14h]@131 bool v23; // [sp+80h] [bp-10h]@38 signed int v24; // [sp+80h] [bp-10h]@52 signed int v25; // [sp+84h] [bp-Ch]@6 int i; // [sp+88h] [bp-8h]@97 int j; // [sp+88h] [bp-8h]@129 signed int m; // [sp+88h] [bp-8h]@162 signed int k; // [sp+88h] [bp-8h]@167 int l; // [sp+88h] [bp-8h]@177 int v31; // [sp+8Ch] [bp-4h]@6 int v32; // [sp+8Ch] [bp-4h]@97 v18 = 0; v17 = 0; if ( dword_9363AC > 0 ) { if ( time_current > dword_8B460C + 1500 ) { dword_8B460C = time_current; if ( dword_9363AC == 1 ) dword_9363AC = 2; else dword_9363AC = 1; } } v19 = dword_8C79EC; v31 = buildingSizes[4 * toPlace_buildingType]; v25 = dword_5F6420[4 * toPlace_buildingType] + graphic_id_start[dword_5F641C[4 * toPlace_buildingType]]; if ( toPlace_buildingType == 72 ) v31 = 3; if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: v9 = setting_map_x; v8 = setting_map_y - v31 + 1; break; case 4: v9 = setting_map_x - v31 + 1; v8 = setting_map_y - v31 + 1; break; case 2: v9 = setting_map_x - v31 + 1; v8 = setting_map_y; break; } } else { v9 = setting_map_x; v8 = setting_map_y; } if ( dword_9DA800 ) { if ( !sub_48D300(v9, v8, 3, 1, 2048) ) { v18 = 1; v17 = 1; } } else { if ( dword_9DA8B4 ) { if ( !sub_48D300(v9, v8, 2, 1, 2) ) { v18 = 1; v17 = 1; } } else { if ( dword_9DA7C4 ) { if ( !sub_48D300(v9, v8, 2, 1, 17) ) { v18 = 1; v17 = 1; } } else { if ( dword_9DA828 ) { if ( !sub_48D300(v9, v8, 2, 3, 4) ) { v18 = 1; v17 = 1; } } else { if ( dword_9DA908 ) { if ( !sub_48D600(v9, v8, 2, 0, 16384) ) { v18 = 1; v17 = 1; } } else { if ( toPlace_buildingType == 58 ) { v10 = sub_488430(setting_map_x, setting_map_y); if ( v10 == 2 ) { v23 = 1; } else { if ( v10 == 1 ) v23 = 0; else v23 = dword_9363AC == 2; } if ( setting_map_orientation == 2 || setting_map_orientation == 6 ) v23 = v23 != 1; v25 += v23; } else { if ( toPlace_buildingType == 56 ) { v11 = sub_488860(setting_map_x, setting_map_y); if ( v11 == 2 ) { v24 = 2; } else { if ( v11 == 1 ) { v24 = 0; } else { if ( dword_9363AC == 2 ) v24 = 2; else v24 = 0; } } if ( setting_map_orientation == 2 || setting_map_orientation == 6 ) { if ( v24 == 2 ) v24 = 0; else v24 = 2; } v25 += v24; } else { if ( toPlace_buildingType != 126 && toPlace_buildingType != 127 && toPlace_buildingType != 128 && toPlace_buildingType != 130 && toPlace_buildingType != 131 ) { if ( toPlace_buildingType == 132 ) { v0 = grid_terrain[dword_8C79EC]; if ( !(v0 & 4) ) { v18 = 1; v17 = 1; } } else { if ( toPlace_buildingType == 133 ) { if ( grid_terrain[dword_8C79EC] & 0xD77F ) { v18 = 1; v17 = 1; } } } } else { if ( setting_map_x ) { if ( setting_map_x != setting_map_width - 1 ) { if ( setting_map_y ) { if ( setting_map_y != setting_map_height - 1 ) { v18 = 1; v17 = 1; } } } } if ( toPlace_buildingType == 130 || toPlace_buildingType == 131 ) { if ( !sub_4864B0(dword_8C79EC) ) { v18 = 1; v17 = 1; } } } } } } } } } } if ( toPlace_buildingType == 85 ) { if( city_inform[ciid].word_6543AE ) { v18 = 1; v17 = 1; } } if ( toPlace_buildingType == 95 ) { if ( numBarracks ) { v18 = 1; v17 = 1; } } if ( toPlace_buildingType == 50 ) { if ( city_inform[ciid].dword_654520 ) { v18 = 1; v17 = 1; } } v13 = dword_9A04E8; v12 = dword_9A04EC; v32 = dword_5F5918[v31]; v16 = setting_map_orientation / 2; for ( i = 0; i < v32; ++i ) { v14 = grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v16] + 4 * i) + v19] & 0xD77F; if ( toPlace_buildingType == 58 ) v14 &= 0xFFBFu; if ( toPlace_buildingType == 59 ) v14 &= 0xBFFFu; if ( toPlace_buildingType == 56 ) v14 &= 0xFFBFu; if ( toPlace_buildingType == 38 ) v14 &= 0xFFBFu; if ( toPlace_buildingType == 126 || toPlace_buildingType == 127 || toPlace_buildingType == 128 || toPlace_buildingType == 119 || toPlace_buildingType == 133 ) v14 &= 0xFFBFu; if ( toPlace_buildingType == 130 || toPlace_buildingType == 131 ) v14 = 0; if ( toPlace_buildingType == 132 ) v14 = 0; if ( v14 ) v17 = 1; if ( grid_walkerIds[*(int *)((char *)&dword_5F59F8[25 * v16] + 4 * i) + v19] ) v17 = 1; } if ( toPlace_buildingType == 38 ) { if ( !(grid_terrain[dword_5F59F8[25 * v16] + v19] & 0x40) ) v17 = 1; } if ( city_inform[ciid].treasury <= -5000 ) { v18 = 1; v17 = 1; } if ( v17 ) { for ( j = 0; j < v32; ++j ) { v22 = dword_5F5930[2 * j] + v13; v20 = dword_5F5934[2 * j] + v12 - iso_tile_half_height; v15 = grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v16] + 4 * j) + v19] & 0xD77F; if ( toPlace_buildingType == 58 ) v15 &= 0xFFBFu; if ( toPlace_buildingType == 126 || toPlace_buildingType == 127 || toPlace_buildingType == 128 || toPlace_buildingType == 119 ) v15 &= 0xFFBFu; if ( grid_walkerIds[*(int *)((char *)&dword_5F59F8[25 * v16] + 4 * j) + v19] ) v15 = 1; if ( v18 ) { sub_4D0B70(graphic_fire_almost, v22, v20, -1949); } else { if ( v15 ) sub_4D0B70(graphic_fire_almost, v22, v20, -1949); else sub_4D0B70(graphic_fire_almost, v22, v20, 8163); } } } else { if ( toPlace_buildingType != 126 && toPlace_buildingType != 132 && toPlace_buildingType != 133 && toPlace_buildingType != 127 && toPlace_buildingType != 128 && toPlace_buildingType != 119 && toPlace_buildingType != 130 && toPlace_buildingType != 131 ) { if ( toPlace_buildingType != 100 && toPlace_buildingType != 101 && toPlace_buildingType != 102 && toPlace_buildingType != 103 && toPlace_buildingType != 104 && toPlace_buildingType != 105 ) { switch ( toPlace_buildingType ) { case 72: v2 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v25, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v25, v13, v2); drawGraphic(word_6E6C54 + 17, v13 - 4, v2 - 42); for ( k = 1; k < 9; ++k ) { v3 = dword_5F5930[2 * k] + v13; v4 = dword_5F5934[2 * k] + v12 - iso_tile_half_height; drawGraphic(graphic_emptyWarehouseTile, v3, v4); fun_drawBuilding(graphic_emptyWarehouseTile, v3, v4); } drawGraphic_colorMask = 0; break; case 71: v5 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v25, dword_9A04E8, dword_9A04EC - iso_tile_half_height); drawGraphic( v25 + 1, v13 + c3_sg2[v25 + 1].sprite_top_offset - 32, v5 + c3_sg2[v25 + 1].sprite_left_offset - 64); drawGraphic_colorMask = 0; break; case 10: v6 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(graphic_housing_vacant, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(graphic_housing_vacant, v13, v6); drawGraphic_colorMask = 0; break; default: if ( toPlace_buildingType < 11 || toPlace_buildingType > 29 ) { if ( toPlace_buildingType == 56 ) { v21 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v25, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v25, v13, v21); if ( v25 == word_6E6D4A ) drawGraphic( v25 + 1, v13 + c3_sg2[v25 + 1].sprite_top_offset + 4, v21 + c3_sg2[v25 + 1].sprite_left_offset - 51); else drawGraphic( v25 + 1, v13 + c3_sg2[v25 + 1].sprite_top_offset - 33, v21 + c3_sg2[v25 + 1].sprite_left_offset - 56); drawGraphic_colorMask = 0; } else { v7 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v25, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v25, v13, v7); drawGraphic_colorMask = 0; } } else { for ( l = 0; l < v32; ++l ) sub_4D0B70( graphic_fire_almost, dword_5F5930[2 * l] + v13, dword_5F5934[2 * l] + v12 - iso_tile_half_height, 8163); } break; } } else { v1 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v25, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v25, v13, v1); for ( m = 4; m < 9; ++m ) drawGraphic(v25 + 1, dword_5F5930[2 * m] + v13, dword_5F5934[2 * m] + v12 - iso_tile_half_height); drawGraphic_colorMask = 0; } } else { sub_4D0B70(graphic_fire_almost, dword_9A04E8, dword_9A04EC - iso_tile_half_height, 8163); } } } void fun_drawBuildingGhostRoad() { int v0; // ST74_4@16 int v1; // [sp+4Ch] [bp-24h]@1 int v2; // [sp+50h] [bp-20h]@1 int cannotBuildAny; // [sp+5Ch] [bp-14h]@1 int v4; // [sp+60h] [bp-10h]@1 signed int v5; // [sp+6Ch] [bp-4h]@16 cannotBuildAny = 0; v4 = dword_8C79EC; v2 = dword_9A04E8; v1 = dword_9A04EC; if ( grid_terrain[dword_5F59F8[25 * setting_map_orientation / 2] + dword_8C79EC] & 0x100 ) { v5 = graphic_aqueduct; if ( sub_503A40(dword_8C79EC) ) v5 += sub_503C20(v4); else cannotBuildAny = 1; } else { if ( grid_terrain[dword_5F59F8[25 * setting_map_orientation / 2] + dword_8C79EC] & 0xD77F ) { cannotBuildAny = 1; } else { v5 = word_6E6C90; if ( !sub_486310(dword_8C79EC, 64) ) { if ( sub_4862B0(dword_8C79EC, 64) ) ++v5; } } } if ( city_inform[ciid].treasury <= -5000 ) cannotBuildAny = 1; if ( cannotBuildAny ) { sub_4D0B70(graphic_fire_almost, v2, v1 - iso_tile_half_height, -1949); } else { v0 = v1 - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v5, v2, v1 - iso_tile_half_height); fun_drawBuilding(v5, v2, v0); drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostReservoirSimon() { int v0; // [sp+4Ch] [bp-20h]@12 int v1; // [sp+4Ch] [bp-20h]@21 int v2; // [sp+50h] [bp-1Ch]@12 int v3; // [sp+50h] [bp-1Ch]@21 signed int v4; // [sp+54h] [bp-18h]@1 int v5; // [sp+5Ch] [bp-10h]@15 int v6; // [sp+5Ch] [bp-10h]@24 int v7; // [sp+5Ch] [bp-10h]@29 int v8; // [sp+60h] [bp-Ch]@15 int v9; // [sp+60h] [bp-Ch]@24 signed int v10; // [sp+64h] [bp-8h]@29 signed int i; // [sp+68h] [bp-4h]@13 signed int j; // [sp+68h] [bp-4h]@22 v4 = 0; if ( dword_9DA918 ) { if ( !dword_9363B4 ) v4 = 1; } else { if ( sub_486AF0(setting_map_x + setting_map_startGridOffset + 162 * (setting_map_y - 1) - 1) ) { v4 = 0; } else { if ( !fun_terrainIsClear(setting_map_x - 1, setting_map_y - 1, 3, 3, 0xFFFFu, 0) ) v4 = 1; } } if ( city_inform[ciid].treasury <= -5000 ) v4 = 1; if ( dword_9DA918 ) { v2 = dword_9A04D8; v0 = dword_9A051C - iso_tile_height; if ( v4 ) { for ( i = 0; i < 9; ++i ) { v8 = dword_5F5930[2 * i] + v2; v5 = dword_5F5934[2 * i] + v0; if ( v4 ) sub_4D0B70(graphic_fire_almost, v8, v5, -1949); else sub_4D0B70(graphic_fire_almost, v8, v5, 8163); } } else { drawGraphic_colorMask = 8163; drawGraphic(graphic_reservoir, dword_9A04D8, v0); fun_drawBuilding(graphic_reservoir, v2, v0); drawGraphic_colorMask = 0; } } v3 = dword_9A04E8; v1 = dword_9A04EC - iso_tile_height; if ( v4 ) { for ( j = 0; j < 9; ++j ) { v9 = dword_5F5930[2 * j] + v3; v6 = dword_5F5934[2 * j] + v1 - iso_tile_half_height; if ( v4 ) sub_4D0B70(graphic_fire_almost, v9, v6, -1949); else sub_4D0B70(graphic_fire_almost, v9, v6, 8163); } } else { v7 = v1 - iso_tile_half_height; v10 = graphic_reservoir; if ( fun_mapAreaContainsTerrain(setting_map_x - 2, setting_map_y - 2, 5, T_Water) ) { drawGraphic_colorMask = 8163; drawGraphic(v10, v3, v7); fun_drawBuilding(v10, v3, v7); drawGraphic( v10 + 1, v3 - iso_tile_width + c3_sg2[v10].sprite_top_offset - 2, c3_sg2[v10].sprite_left_offset + v7 - (c3_sg2[v10].height - 90)); sub_4D0B70( v10 + 1, v3 - iso_tile_width + c3_sg2[v10].sprite_top_offset - 2, c3_sg2[v10].sprite_left_offset + v7 - (c3_sg2[v10].height - 90), 8163); } else { drawGraphic_colorMask = 8163; drawGraphic(v10, v3, v7); fun_drawBuilding(v10, v3, v7); } drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostAqueduct() { __int16 v0; // ax@2 int v1; // ecx@17 __int16 v2; // ax@17 __int16 v3; // dx@19 bool v4; // [sp+4Ch] [bp-10h]@1 int v5; // [sp+50h] [bp-Ch]@23 int v6; // [sp+54h] [bp-8h]@15 int v7; // [sp+58h] [bp-4h]@15 v4 = 0; if ( dword_9DA918 ) { if ( !dword_9363B4 ) v4 = 1; } else { walkerBaseGridOffset = 162 * setting_map_y + setting_map_x + setting_map_startGridOffset; v0 = grid_terrain[walkerBaseGridOffset]; if ( v0 & 0x40 ) { v4 = sub_4840B0(walkerBaseGridOffset) != 2; } else { if ( grid_terrain[walkerBaseGridOffset] & 0xD77F ) v4 = 1; else v4 = 0; } } if ( city_inform[ciid].treasury <= -5000 ) v4 = 1; v7 = dword_9A04E8; v6 = dword_9A04EC - iso_tile_half_height; if ( v4 ) { sub_4D0B70(graphic_fire_almost, dword_9A04E8, v6, -1949); } else { drawGraphic_colorMask = 8163; walkerBaseGridOffset = dword_8C79EC; sub_485A80(); sub_490850(byte_5F3000, 16); v2 = grid_terrain[walkerBaseGridOffset]; if ( v2 & 0x40 ) { if ( !dword_89AA70 ) { v1 = walkerBaseGridOffset; v3 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; if ( v3 & 0x40 ) dword_9363A8 = 3; else dword_9363A8 = 2; } if ( sub_47F7B0() ) v5 = dword_9363A8 + 13; else v5 = dword_9363A8 + 21; } else { v5 = dword_9363A8 + 15; } drawGraphic(v5 + graphic_aqueduct, v7, v6); fun_drawBuilding(v5 + graphic_aqueduct, v7, v6); drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostFountain() { __int16 v0; // dx@5 signed int v1; // [sp+4Ch] [bp-28h]@1 int v2; // [sp+54h] [bp-20h]@1 signed int v3; // [sp+5Ch] [bp-18h]@1 int v4; // [sp+64h] [bp-10h]@1 int v5; // [sp+68h] [bp-Ch]@3 v3 = 0; v4 = dword_8C79EC; v1 = graphic_id_start[dword_5F69CC[0]]; v2 = dword_9A04E8; if ( city_inform[ciid].treasury <= -5000 ) v3 = 1; v5 = dword_9A04EC - iso_tile_half_height; if ( v3 ) { sub_4D0B70(graphic_fire_almost, dword_9A04E8, v5, 0xF863u); } else { drawGraphic_colorMask = 0x1FE3u; drawGraphic(v1, dword_9A04E8, v5); fun_drawBuilding(v1, v2, v5); v0 = grid_terrain[v4]; if ( v0 & 0x80 ) { drawGraphic(v1 + 1, c3_sg2[v1].sprite_top_offset + v2, c3_sg2[v1].sprite_left_offset + v5); sub_4D0B70(v1 + 1, c3_sg2[v1].sprite_top_offset + v2, c3_sg2[v1].sprite_left_offset + v5, 8163); } drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostBathhouse() { __int16 v0; // ax@22 __int16 v1; // dx@24 __int16 v2; // cx@26 __int16 v3; // ax@28 signed int v4; // [sp+4Ch] [bp-34h]@22 signed int v5; // [sp+50h] [bp-30h]@1 int v6; // [sp+54h] [bp-2Ch]@1 int v7; // [sp+58h] [bp-28h]@1 int v8; // [sp+5Ch] [bp-24h]@1 int v9; // [sp+60h] [bp-20h]@13 int i; // [sp+64h] [bp-1Ch]@1 int j; // [sp+64h] [bp-1Ch]@11 signed int v12; // [sp+68h] [bp-18h]@1 signed int v13; // [sp+6Ch] [bp-14h]@1 int v14; // [sp+70h] [bp-10h]@1 int v15; // [sp+74h] [bp-Ch]@10 int v16; // [sp+74h] [bp-Ch]@13 int v17; // [sp+78h] [bp-8h]@13 int v18; // [sp+7Ch] [bp-4h]@1 v13 = 0; v12 = 0; v14 = dword_8C79EC; v5 = graphic_id_start[dword_5F671C[0]]; v7 = dword_9A04E8; v6 = dword_9A04EC; v18 = dword_5F5918[2]; v8 = setting_map_orientation / 2; for ( i = 0; i < v18; ++i ) { if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v8] + 4 * i) + dword_8C79EC] & 0xD77F ) v12 = 1; if ( grid_walkerIds[*(int *)((char *)&dword_5F59F8[25 * v8] + 4 * i) + dword_8C79EC] ) v12 = 1; } if ( city_inform[ciid].treasury <= -5000 ) { v13 = 1; v12 = 1; } v15 = dword_9A04EC - iso_tile_half_height; if ( v12 ) { for ( j = 0; j < v18; ++j ) { v17 = dword_5F5930[2 * j] + v7; v16 = dword_5F5934[2 * j] + v6 - iso_tile_half_height; v9 = grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v8] + 4 * j) + v14] & 0xD77F; if ( grid_walkerIds[*(int *)((char *)&dword_5F59F8[25 * v8] + 4 * j) + v14] ) v9 = 1; if ( v13 ) { sub_4D0B70(graphic_fire_almost, v17, v16, -1949); } else { if ( v9 ) sub_4D0B70(graphic_fire_almost, v17, v16, -1949); else sub_4D0B70(graphic_fire_almost, v17, v16, 8163); } } } else { drawGraphic_colorMask = 8163; drawGraphic(v5, dword_9A04E8, v15); fun_drawBuilding(v5, v7, v15); v4 = 0; v0 = grid_terrain[v14]; if ( v0 & 0x80 ) v4 = 1; v1 = grid_terrain_xPlusOne_y[v14]; if ( v1 & 0x80 ) v4 = 1; v2 = grid_terrain_x_yPlusOne[v14]; if ( v2 & 0x80 ) v4 = 1; v3 = grid_terrain_xPlusOne_yPlusOne[v14]; if ( v3 & 0x80 ) v4 = 1; if ( v4 ) { drawGraphic(v5 - 1, c3_sg2[v5].sprite_top_offset + v7, c3_sg2[v5].sprite_left_offset + v15); sub_4D0B70(v5 - 1, c3_sg2[v5].sprite_top_offset + v7, c3_sg2[v5].sprite_left_offset + v15, 8163); } drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostBridge() { int v0; // [sp+4Ch] [bp-20h]@1 signed int v1; // [sp+58h] [bp-14h]@69 signed int v2; // [sp+5Ch] [bp-10h]@5 int v3; // [sp+60h] [bp-Ch]@12 int v4; // [sp+60h] [bp-Ch]@29 int v5; // [sp+64h] [bp-8h]@12 int v6; // [sp+64h] [bp-8h]@29 signed int i; // [sp+68h] [bp-4h]@17 signed int j; // [sp+68h] [bp-4h]@38 signed int k; // [sp+68h] [bp-4h]@93 int l; // [sp+68h] [bp-4h]@139 sub_486DF0(setting_map_x, setting_map_y); v0 = dword_86331C[0] - setting_map_orientation; if ( dword_86331C[0] - setting_map_orientation < 0 ) v0 += 8; if ( toPlace_buildingType != 83 || bridge_something >= 5 ) { if ( dword_8E1490 ) v2 = 0; else v2 = 1; } else { v2 = 1; } if ( city_inform[ciid].treasury <= -5000 ) v2 = 1; if ( v2 ) { v5 = dword_9A04E8; v3 = dword_9A04EC - iso_tile_half_height; if ( bridge_something >= 1 ) sub_4D0B70(graphic_fire_almost, dword_9A04E8, v3, 8163); else sub_4D0B70(graphic_fire_almost, dword_9A04E8, v3, -1949); if ( bridge_something > 1 ) { for ( i = 1; i < bridge_something; ++i ) { if ( v0 ) { switch ( v0 ) { case 2: v5 += iso_tile_half_width; v3 += iso_tile_half_height; break; case 4: v5 -= iso_tile_half_width; v3 += iso_tile_half_height; break; case 6: v5 -= iso_tile_half_width; v3 -= iso_tile_half_height; break; } } else { v5 += iso_tile_half_width; v3 -= iso_tile_half_height; } } sub_4D0B70(graphic_fire_almost, v5, v3, -1949); } } else { v6 = dword_9A04E8; v4 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; dword_9D4DE4 = 0; if ( toPlace_buildingType == 82 ) { if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge, dword_9A04E8 - 1, v4 - 8); break; case 4: drawGraphic(graphic_bridge + 3, dword_9A04E8, v4 - 8); break; case 6: drawGraphic(graphic_bridge + 2, dword_9A04E8 + 7, v4 - 20); break; } } else { drawGraphic(graphic_bridge + 5, dword_9A04E8, v4 - 20); } dword_9D4B60[4 * dword_9D4DE4] = drawGraphic_graphicId; dword_9D4B64[4 * dword_9D4DE4] = drawGraphic_xOffset; dword_9D4B68[4 * dword_9D4DE4++] = drawGraphic_yOffset; for ( j = 1; j < bridge_something; ++j ) { if ( v0 ) { switch ( v0 ) { case 2: v6 += iso_tile_half_width; v4 += iso_tile_half_height; break; case 4: v6 -= iso_tile_half_width; v4 += iso_tile_half_height; break; case 6: v6 -= iso_tile_half_width; v4 -= iso_tile_half_height; break; } } else { v6 += iso_tile_half_width; v4 -= iso_tile_half_height; } if ( j == bridge_something - 1 ) { if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge + 2, v6 + 7, v4 - 20); break; case 4: drawGraphic(graphic_bridge + 5, v6, v4 - 20); break; case 6: drawGraphic(graphic_bridge, v6 - 1, v4 - 8); break; } } else { drawGraphic(graphic_bridge + 3, v6, v4 - 8); } } else { if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge + 1, v6 + 5, v4 - 21); break; case 4: drawGraphic(graphic_bridge + 4, v6, v4 - 21); break; case 6: drawGraphic(graphic_bridge + 1, v6 + 5, v4 - 21); break; } } else { drawGraphic(graphic_bridge + 4, v6, v4 - 21); } } dword_9D4B60[4 * dword_9D4DE4] = drawGraphic_graphicId; dword_9D4B64[4 * dword_9D4DE4] = drawGraphic_xOffset; dword_9D4B68[4 * dword_9D4DE4++] = drawGraphic_yOffset; } } else { switch ( bridge_something ) { case 9: v1 = 4; break; case 10: v1 = 4; break; case 11: v1 = 5; break; case 12: v1 = 5; break; case 13: v1 = 6; break; case 14: v1 = 6; break; case 15: v1 = 7; break; case 16: v1 = 7; break; default: v1 = 8; break; } if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge + 6, dword_9A04E8 - 1, v4 - 12); break; case 4: drawGraphic(graphic_bridge + 9, dword_9A04E8 - 30, v4 - 12); break; case 6: drawGraphic(graphic_bridge + 8, dword_9A04E8 - 23, v4 - 53); break; } } else { drawGraphic(graphic_bridge + 11, dword_9A04E8 - 3, v4 - 50); } dword_9D4B60[4 * dword_9D4DE4] = drawGraphic_graphicId; dword_9D4B64[4 * dword_9D4DE4] = drawGraphic_xOffset; dword_9D4B68[4 * dword_9D4DE4++] = drawGraphic_yOffset; for ( k = 1; k < bridge_something; ++k ) { if ( v0 ) { switch ( v0 ) { case 2: v6 += iso_tile_half_width; v4 += iso_tile_half_height; break; case 4: v6 -= iso_tile_half_width; v4 += iso_tile_half_height; break; case 6: v6 -= iso_tile_half_width; v4 -= iso_tile_half_height; break; } } else { v6 += iso_tile_half_width; v4 -= iso_tile_half_height; } if ( k != bridge_something - 1 ) { if ( k != 1 ) { if ( k == bridge_something - 2 ) { if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge + 8, v6 + 7, v4 - 39); break; case 4: drawGraphic(graphic_bridge + 11, v6 - 34, v4 - 35); break; case 6: drawGraphic(graphic_bridge + 6, v6 - 29, v4 - 22); break; } } else { drawGraphic(graphic_bridge + 9, v6 + 1, v4 - 24); } } else { if ( k == v1 ) { if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge + 12, v6 + 7, v4 - 38); break; case 4: drawGraphic(graphic_bridge + 13, v6, v4 - 38); break; case 6: drawGraphic(graphic_bridge + 12, v6 + 7, v4 - 38); break; } } else { drawGraphic(graphic_bridge + 13, v6, v4 - 38); } } else { if ( v0 ) { switch ( v0 ) { case 2: drawGraphic(graphic_bridge + 7, v6 + 7, v4 - 38); break; case 4: drawGraphic(graphic_bridge + 10, v6, v4 - 37); break; case 6: drawGraphic(graphic_bridge + 7, v6 + 7, v4 - 38); break; } } else { drawGraphic(graphic_bridge + 10, v6, v4 - 37); } } } dword_9D4B60[4 * dword_9D4DE4] = drawGraphic_graphicId; dword_9D4B64[4 * dword_9D4DE4] = drawGraphic_xOffset; dword_9D4B68[4 * dword_9D4DE4++] = drawGraphic_yOffset; } } } } if ( !v0 || v0 == 6 ) { for ( l = dword_9D4DE4 - 1; l >= 0; --l ) drawGraphic(dword_9D4B60[4 * l], dword_9D4B64[4 * l], dword_9D4B68[4 * l]); } drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostFort() { int v0; // ST84_4@35 int v1; // ST80_4@35 int v2; // ST84_4@35 int v3; // ST80_4@35 int v4; // ST84_4@36 int v5; // ST80_4@36 int v6; // ST84_4@36 int v7; // ST80_4@36 signed int v8; // [sp+4Ch] [bp-34h]@1 signed int v9; // [sp+50h] [bp-30h]@1 int v10; // [sp+5Ch] [bp-24h]@16 int v11; // [sp+5Ch] [bp-24h]@24 int v12; // [sp+60h] [bp-20h]@16 int v13; // [sp+60h] [bp-20h]@24 int v14; // [sp+68h] [bp-18h]@16 int v15; // [sp+68h] [bp-18h]@24 int v16; // [sp+6Ch] [bp-14h]@16 int v17; // [sp+6Ch] [bp-14h]@24 int v18; // [sp+70h] [bp-10h]@18 int v19; // [sp+70h] [bp-10h]@26 int v20; // [sp+74h] [bp-Ch]@18 int v21; // [sp+74h] [bp-Ch]@26 int i; // [sp+78h] [bp-8h]@5 int j; // [sp+78h] [bp-8h]@10 int k; // [sp+78h] [bp-8h]@16 int l; // [sp+78h] [bp-8h]@24 int v26; // [sp+7Ch] [bp-4h]@16 int v27; // [sp+7Ch] [bp-4h]@24 v9 = 0; v8 = 0; if ( numForts >= 6 ) { v9 = 1; v8 = 1; } if ( city_inform[ciid].treasury <= -5000 ) { v9 = 1; v8 = 1; } for ( i = 0; i < dword_5F5918[dword_5F67A4[0]]; ++i ) { if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * setting_map_orientation / 2] + 4 * i) + dword_8C79EC] & 0xD77F ) v8 = 1; } for ( j = 0; j < dword_5F5918[dword_5F6774[0]]; ++j ) { if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * setting_map_orientation / 2] + 4 * j) + dword_5F44B0[setting_map_orientation / 2] + dword_8C79EC] & 0xD77F ) v8 = 1; } if ( v8 ) { v16 = dword_8C79EC; v12 = dword_9A04E8; v10 = dword_9A04EC; v26 = dword_5F5918[dword_5F67A4[0]]; v14 = setting_map_orientation / 2; for ( k = 0; k < v26; ++k ) { v20 = dword_5F5930[2 * k] + v12; v18 = dword_5F5934[2 * k] + v10 - iso_tile_half_height; if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v14] + 4 * k) + v16] & 0xD77F ) { sub_4D0B70(graphic_fire_almost, v20, v18, -1949); } else { if ( v9 ) sub_4D0B70(graphic_fire_almost, v20, v18, -1949); else sub_4D0B70(graphic_fire_almost, v20, v18, 8163); } } v15 = setting_map_orientation / 2; v17 = dword_5F44B0[setting_map_orientation / 2] + dword_8C79EC; v13 = dword_5F95B4[setting_map_orientation / 2] + dword_5F9594[2 * setting_map_orientation / 2] * iso_tile_half_width + dword_5F9574[2 * setting_map_orientation / 2] * iso_tile_width + dword_9A04E8; v11 = dword_5F9598[2 * setting_map_orientation / 2] * iso_tile_half_height + dword_5F9578[2 * setting_map_orientation / 2] * iso_tile_height + dword_9A04EC; v27 = dword_5F5918[dword_5F6774[0]]; for ( l = 0; l < v27; ++l ) { v21 = dword_5F5930[2 * l] + v13; v19 = dword_5F5934[2 * l] + v11 - iso_tile_half_height; if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v15] + 4 * l) + v17] & 0xD77F ) { sub_4D0B70(graphic_fire_almost, v21, v19, -1949); } else { if ( v9 ) sub_4D0B70(graphic_fire_almost, v21, v19, -1949); else sub_4D0B70(graphic_fire_almost, v21, v19, 8163); } } } else { if ( setting_map_orientation && setting_map_orientation != 6 ) { v4 = dword_5F95B4[setting_map_orientation / 2] + dword_5F9594[2 * setting_map_orientation / 2] * iso_tile_half_width + dword_5F9574[2 * setting_map_orientation / 2] * iso_tile_width + dword_9A04E8; v5 = dword_5F9598[2 * setting_map_orientation / 2] * iso_tile_half_height + dword_5F9578[2 * setting_map_orientation / 2] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(word_6E6C34 + 1, v4, v5); fun_drawBuilding(word_6E6C34 + 1, v4, v5); v6 = dword_9A04E8; v7 = dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6C34, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(word_6E6C34, v6, v7); drawGraphic_colorMask = 0; } else { v0 = dword_9A04E8; v1 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(word_6E6C34, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(word_6E6C34, v0, v1); v2 = dword_5F95B4[setting_map_orientation / 2] + dword_5F9594[2 * setting_map_orientation / 2] * iso_tile_half_width + dword_5F9574[2 * setting_map_orientation / 2] * iso_tile_width + dword_9A04E8; v3 = dword_5F9598[2 * setting_map_orientation / 2] * iso_tile_half_height + dword_5F9578[2 * setting_map_orientation / 2] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6C34 + 1, v2, v3); fun_drawBuilding(word_6E6C34 + 1, v2, v3); drawGraphic_colorMask = 0; } } } void fun_drawBuildingGhostHippodrome() { int v0; // ST84_4@47 int v1; // ST80_4@47 int v2; // ST84_4@47 int v3; // ST80_4@47 int v4; // ST84_4@47 int v5; // ST80_4@47 int v6; // ST84_4@49 int v7; // ST80_4@49 int v8; // ST84_4@49 int v9; // ST80_4@49 int v10; // ST84_4@49 int v11; // ST80_4@49 int v12; // ST84_4@51 int v13; // ST80_4@51 int v14; // ST84_4@51 int v15; // ST80_4@51 int v16; // ST84_4@51 int v17; // ST80_4@51 int v18; // ST84_4@52 int v19; // ST80_4@52 int v20; // ST84_4@52 int v21; // ST80_4@52 int v22; // ST84_4@52 int v23; // ST80_4@52 signed int v24; // [sp+4Ch] [bp-34h]@1 signed int v25; // [sp+50h] [bp-30h]@1 int v26; // [sp+5Ch] [bp-24h]@21 int v27; // [sp+5Ch] [bp-24h]@29 int v28; // [sp+5Ch] [bp-24h]@37 int v29; // [sp+60h] [bp-20h]@21 int v30; // [sp+60h] [bp-20h]@29 int v31; // [sp+60h] [bp-20h]@37 int v32; // [sp+68h] [bp-18h]@21 int v33; // [sp+68h] [bp-18h]@29 int v34; // [sp+68h] [bp-18h]@37 int v35; // [sp+68h] [bp-18h]@46 int v36; // [sp+6Ch] [bp-14h]@21 int v37; // [sp+6Ch] [bp-14h]@29 int v38; // [sp+6Ch] [bp-14h]@37 int v39; // [sp+70h] [bp-10h]@23 int v40; // [sp+70h] [bp-10h]@31 int v41; // [sp+70h] [bp-10h]@39 int v42; // [sp+74h] [bp-Ch]@23 int v43; // [sp+74h] [bp-Ch]@31 int v44; // [sp+74h] [bp-Ch]@39 int i; // [sp+78h] [bp-8h]@5 int j; // [sp+78h] [bp-8h]@10 int k; // [sp+78h] [bp-8h]@15 int l; // [sp+78h] [bp-8h]@21 int m; // [sp+78h] [bp-8h]@29 int n; // [sp+78h] [bp-8h]@37 int v51; // [sp+7Ch] [bp-4h]@21 int v52; // [sp+7Ch] [bp-4h]@29 int v53; // [sp+7Ch] [bp-4h]@37 v25 = 0; v24 = 0; if ( city_inform[ciid].hippodromeBuiltInCity ) { v25 = 1; v24 = 1; } if ( city_inform[ciid].treasury <= -5000 ) { v25 = 1; v24 = 1; } for ( i = 0; i < dword_5F592C; ++i ) { if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * setting_map_orientation / 2] + 4 * i) + dword_8C79EC] & 0xD77F ) v24 = 1; } for ( j = 0; j < dword_5F592C; ++j ) { if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * setting_map_orientation / 2] + 4 * j) + dword_5F44E0[setting_map_orientation / 2] + dword_8C79EC] & 0xD77F ) v24 = 1; } for ( k = 0; k < dword_5F592C; ++k ) { if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * setting_map_orientation / 2] + 4 * k) + dword_5F44F0[setting_map_orientation / 2] + dword_8C79EC] & 0xD77F ) v24 = 1; } if ( v24 ) { v36 = dword_8C79EC; v29 = dword_9A04E8; v26 = dword_9A04EC; v51 = dword_5F592C; v32 = setting_map_orientation / 2; for ( l = 0; l < v51; ++l ) { v42 = dword_5F5930[2 * l] + v29; v39 = dword_5F5934[2 * l] + v26 - iso_tile_half_height; if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v32] + 4 * l) + v36] & 0xD77F ) { sub_4D0B70(graphic_fire_almost, v42, v39, -1949); } else { if ( v25 ) sub_4D0B70(graphic_fire_almost, v42, v39, -1949); else sub_4D0B70(graphic_fire_almost, v42, v39, 8163); } } v33 = setting_map_orientation / 2; v37 = dword_5F44E0[setting_map_orientation / 2] + dword_8C79EC; v30 = dword_5F9624[setting_map_orientation / 2] + dword_5F9604[2 * setting_map_orientation / 2] * iso_tile_half_width + dword_5F95C4[2 * setting_map_orientation / 2] * iso_tile_width + dword_9A04E8; v27 = dword_5F9608[2 * setting_map_orientation / 2] * iso_tile_half_height + dword_5F95C8[2 * setting_map_orientation / 2] * iso_tile_height + dword_9A04EC; v52 = dword_5F592C; for ( m = 0; m < v52; ++m ) { v43 = dword_5F5930[2 * m] + v30; v40 = dword_5F5934[2 * m] + v27 - iso_tile_half_height; if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v33] + 4 * m) + v37] & 0xD77F ) { sub_4D0B70(graphic_fire_almost, v43, v40, -1949); } else { if ( v25 ) sub_4D0B70(graphic_fire_almost, v43, v40, -1949); else sub_4D0B70(graphic_fire_almost, v43, v40, 8163); } } v34 = setting_map_orientation / 2; v38 = dword_5F44F0[setting_map_orientation / 2] + dword_8C79EC; v31 = dword_5F9634[setting_map_orientation / 2] + dword_607F34[2 * setting_map_orientation / 2] * iso_tile_half_width + dword_5F95E4[2 * setting_map_orientation / 2] * iso_tile_width + dword_9A04E8; v28 = dword_607F38[2 * setting_map_orientation / 2] * iso_tile_half_height + dword_5F95E8[2 * setting_map_orientation / 2] * iso_tile_height + dword_9A04EC; v53 = dword_5F592C; for ( n = 0; n < v53; ++n ) { v44 = dword_5F5930[2 * n] + v31; v41 = dword_5F5934[2 * n] + v28 - iso_tile_half_height; if ( grid_terrain[*(int *)((char *)&dword_5F59F8[25 * v34] + 4 * n) + v38] & 0xD77F ) { sub_4D0B70(graphic_fire_almost, v44, v41, -1949); } else { if ( v25 ) sub_4D0B70(graphic_fire_almost, v44, v41, -1949); else sub_4D0B70(graphic_fire_almost, v44, v41, 8163); } } } else { v35 = setting_map_orientation / 2; drawGraphic_colorMask = 8163; if ( setting_map_orientation / 2 ) { if ( v35 == 2 ) { v6 = dword_9A04E8; v7 = dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5C + 4, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(word_6E6D5C + 4, v6, v7); v8 = dword_5F9624[2] + dword_5F9604[4] * iso_tile_half_width + dword_5F95C4[4] * iso_tile_width + dword_9A04E8; v9 = dword_5F9608[4] * iso_tile_half_height + dword_5F95C8[4] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5C + 2, v8, v9); fun_drawBuilding(word_6E6D5C + 2, v8, v9); v10 = dword_5F9634[2] + dword_607F34[4] * iso_tile_half_width + dword_5F95E4[4] * iso_tile_width + dword_9A04E8; v11 = dword_607F38[4] * iso_tile_half_height + dword_5F95E8[4] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5C, v10, v11); fun_drawBuilding(word_6E6D5C, v10, v11); } else { if ( v35 == 3 ) { v12 = dword_5F9634[3] + dword_607F34[6] * iso_tile_half_width + dword_5F95E4[6] * iso_tile_width + dword_9A04E8; v13 = dword_607F38[6] * iso_tile_half_height + dword_5F95E8[6] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5A + 4, v12, v13); fun_drawBuilding(word_6E6D5A + 4, v12, v13); v14 = dword_5F9624[3] + dword_5F9604[6] * iso_tile_half_width + dword_5F95C4[6] * iso_tile_width + dword_9A04E8; v15 = dword_5F9608[6] * iso_tile_half_height + dword_5F95C8[6] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5A + 2, v14, v15); fun_drawBuilding(word_6E6D5A + 2, v14, v15); v16 = dword_9A04E8; v17 = dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5A, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(word_6E6D5A, v16, v17); } else { v18 = dword_5F9634[v35] + dword_607F34[2 * v35] * iso_tile_half_width + dword_5F95E4[2 * v35] * iso_tile_width + dword_9A04E8; v19 = dword_607F38[2 * v35] * iso_tile_half_height + dword_5F95E8[2 * v35] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5A, v18, v19); fun_drawBuilding(word_6E6D5A, v18, v19); v20 = dword_5F9624[v35] + dword_5F9604[2 * v35] * iso_tile_half_width + dword_5F95C4[2 * v35] * iso_tile_width + dword_9A04E8; v21 = dword_5F9608[2 * v35] * iso_tile_half_height + dword_5F95C8[2 * v35] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5A + 2, v20, v21); fun_drawBuilding(word_6E6D5A + 2, v20, v21); v22 = dword_9A04E8; v23 = dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5A + 4, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(word_6E6D5A + 4, v22, v23); } } } else { v0 = dword_9A04E8; v1 = dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5C, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(word_6E6D5C, v0, v1); v2 = dword_5F9624[v35] + dword_5F9604[2 * v35] * iso_tile_half_width + dword_5F95C4[2 * v35] * iso_tile_width + dword_9A04E8; v3 = dword_5F9608[2 * v35] * iso_tile_half_height + dword_5F95C8[2 * v35] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5C + 2, v2, v3); fun_drawBuilding(word_6E6D5C + 2, v2, v3); v4 = dword_5F9634[v35] + dword_607F34[2 * v35] * iso_tile_half_width + dword_5F95E4[2 * v35] * iso_tile_width + dword_9A04E8; v5 = dword_607F38[2 * v35] * iso_tile_half_height + dword_5F95E8[2 * v35] * iso_tile_height + dword_9A04EC - iso_tile_half_height; drawGraphic(word_6E6D5C + 4, v4, v5); fun_drawBuilding(word_6E6D5C + 4, v4, v5); } drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostShipyardWharf() { signed int v0; // ST6C_4@4 int v1; // ST64_4@4 int v2; // ST60_4@4 int v3; // [sp+50h] [bp-18h]@7 int v4; // [sp+54h] [bp-14h]@7 int v5; // [sp+5Ch] [bp-Ch]@1 signed int v6; // [sp+60h] [bp-8h]@1 signed int i; // [sp+64h] [bp-4h]@5 v5 = dword_5F6420[4 * toPlace_buildingType] + graphic_id_start[dword_5F641C[4 * toPlace_buildingType]]; v6 = sub_481A50(setting_map_x, setting_map_y, 1); if ( city_inform[ciid].treasury <= -5000 ) v6 = 999; if ( v6 ) { for ( i = 0; i < 4; ++i ) { v4 = dword_5F5930[2 * i] + dword_9A04E8; v3 = dword_5F5934[2 * i] + dword_9A04EC - iso_tile_half_height; if ( v6 == 999 ) { sub_4D0B70(graphic_fire_almost, v4, v3, -1949); } else { if ( v6 ) sub_4D0B70(graphic_fire_almost, v4, v3, -1949); else sub_4D0B70(graphic_fire_almost, v4, v3, 8163); } } } else { v0 = dword_89AA88 + v5; v1 = dword_9A04E8; v2 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v0, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v0, v1, v2); drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostDock() { int v0; // ST60_4@11 int v1; // ST5C_4@11 int v2; // [sp+4Ch] [bp-18h]@14 int v3; // [sp+50h] [bp-14h]@14 signed int v4; // [sp+58h] [bp-Ch]@5 signed int v5; // [sp+5Ch] [bp-8h]@1 signed int i; // [sp+60h] [bp-4h]@12 v5 = sub_482140(setting_map_x, setting_map_y, 1); if ( city_inform[ciid].treasury <= -5000 ) v5 = 999; if ( v5 ) { for ( i = 0; i < 9; ++i ) { v3 = dword_5F5930[2 * i] + dword_9A04E8; v2 = dword_5F5934[2 * i] + dword_9A04EC - iso_tile_half_height; if ( v5 == 999 ) { sub_4D0B70(graphic_fire_almost, v3, v2, 0xF863u); } else { if ( v5 ) sub_4D0B70(graphic_fire_almost, v3, v2, 0xF863u); else sub_4D0B70(graphic_fire_almost, v3, v2, 0x1FE3u); } } } else { if ( dword_89AA88 ) { if ( dword_89AA88 == 1 ) { v4 = word_6E6D00; } else { if ( dword_89AA88 == 2 ) v4 = word_6E6D02; else v4 = word_6E6D04; } } else { v4 = word_6E6C4C; } v0 = dword_9A04E8; v1 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v4, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v4, v0, v1); drawGraphic_colorMask = 0; } } void fun_drawBuildingGhostType81() { signed int v0; // ST68_4@2 int v1; // ST64_4@2 int v2; // ST60_4@2 int v3; // [sp+58h] [bp-Ch]@1 signed int i; // [sp+60h] [bp-4h]@3 v3 = dword_5F6420[4 * toPlace_buildingType] + graphic_id_start[dword_5F641C[4 * toPlace_buildingType]]; if ( sub_4827B0(setting_map_x, setting_map_y, 0) ) { for ( i = 0; i < 4; ++i ) sub_4D0B70( graphic_fire_almost, dword_5F5930[2 * i] + dword_9A04E8, dword_5F5934[2 * i] + dword_9A04EC - iso_tile_half_height, -1949); } else { v0 = dword_8B4604 + v3; v1 = dword_9A04E8; v2 = dword_9A04EC - iso_tile_half_height; drawGraphic_colorMask = 8163; drawGraphic(v0, dword_9A04E8, dword_9A04EC - iso_tile_half_height); fun_drawBuilding(v0, v1, v2); drawGraphic_colorMask = 0; } } void fun_drawSelectedCost() { __int16 color; // [sp+4Ch] [bp-4h]@8 if ( dword_8C79EC ) { if ( !shouldScrollMap ) { if ( dword_9363B4 ) { draw_clip_x = cityviewport_x; draw_clip_xEnd = cityviewport_xEnd; draw_clip_y = cityviewport_y; draw_clip_yEnd = cityviewport_yEnd; if ( dword_9363B4 <= city_inform[ciid].treasury ) color = 0xFAC1u; else color = 0xF800u; drawNumber( dword_9363B4, 64, " ", dword_9A04E8 + iso_tile_width + 1, dword_9A04EC - iso_tile_half_height + 1, graphic_font, 0); drawNumber( dword_9363B4, 64, " ", iso_tile_width + dword_9A04E8, dword_9A04EC - iso_tile_half_height, graphic_font, color); dword_9363B4 = 0; draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } } } } void sub_43E600() { signed int v0; // [sp+4Ch] [bp-14h]@5 int v1; // [sp+50h] [bp-10h]@5 int v2; // [sp+54h] [bp-Ch]@8 int v3; // [sp+58h] [bp-8h]@5 int v4; // [sp+5Ch] [bp-4h]@10 if ( debug_drawBuildingInfo || debug_drawEvolveInfo || debug_drawFigureInfo ) { v1 = iso_yoffset - iso_tile_half_height; v0 = 0; v3 = 0; dword_9A0540[0] = dword_9A0510; while ( v3 < iso_viewport_height ) { if ( v0 ) { v2 = iso_xoffset - (iso_tile_half_width + 1); v0 = 0; } else { v2 = iso_xoffset; v0 = 1; } v4 = 0; dword_9A053C = dword_9A050C; while ( v4 <= iso_viewport_width ) { dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 0xFFF0000u ) sub_43E7A0(v2, v1); v2 += iso_tile_width + 2; ++v4; ++dword_9A053C; } v1 += iso_tile_half_height; ++v3; ++dword_9A0540[0]; } } } void sub_43E7A0(int a1, int a2) { __int16 v2; // [sp+4Ch] [bp-Ch]@1 int v3; // [sp+50h] [bp-8h]@1 int v4; // [sp+54h] [bp-4h]@2 v2 = -1; v3 = grid_buildingIds[dword_9D4B4C]; if ( setting_debug_grid ) { switch ( setting_debug_grid ) { case 1: v4 = grid_terrain[dword_9D4B4C]; break; case 2: v4 = grid_bitfields[dword_9D4B4C]; break; case 3: v4 = grid_graphicIds[dword_9D4B4C]; break; case 4: v4 = grid_edge[dword_9D4B4C]; break; case 5: v4 = grid_aqueducts[dword_9D4B4C]; break; case 6: v4 = grid_random[dword_9D4B4C]; break; case 7: v4 = grid_walkerIds[dword_9D4B4C]; break; case 8: v4 = grid_animation[dword_9D4B4C]; break; case 9: v4 = grid_groundType[dword_9D4B4C]; break; case 10: v4 = grid_pathingDistance[dword_9D4B4C]; break; case 11: v4 = buildings[v3].hasFountain; break; case 12: v4 = buildings[v3].walkerServiceAccess; break; case 13: v4 = buildings[v3].haveRomeroad; break; case 14: v4 = buildings[v3].damageRisk; break; case 15: v4 = buildings[v3].house_population; break; case 16: v4 = grid_desirability[dword_9D4B4C]; break; case 17: v4 = grid_elevation[dword_9D4B4C]; break; case 18: v4 = byte_614180[dword_9D4B4C]; break; case 19: v4 = byte_6415A0[dword_9D4B4C]; break; case 20: v4 = grid_buildingDamage[dword_9D4B4C]; break; case 21: v4 = sub_4B8D50(dword_9D4B4C); break; case 22: v4 = rubble_originalBuildingType[dword_9D4B4C]; break; case 23: v4 = byte_902EC0[dword_9D4B4C]; break; case 24: v4 = byte_61AA20[dword_9D4B4C]; break; case 25: v4 = byte_91C920[dword_9D4B4C]; break; default: if ( setting_debug_grid != 26 ) return; v4 = byte_8ADF60[dword_9D4B4C]; break; } } else { v4 = grid_buildingIds[dword_9D4B4C]; } if ( v4 ) { if ( v4 < 0 ) { v4 = -v4; v2 = -2048; } drawNumber(v4, 32, " ", a1 + 24, a2 + 10, 107, v2); } } void fun_drawMinimap(int in_x, int in_y, signed int a3, int a4) { int enemyColor; // [sp+4Ch] [bp-50h]@7 int soldierColor; // [sp+50h] [bp-4Ch]@2 signed int v6; // [sp+54h] [bp-48h]@3 signed int v7; // [sp+54h] [bp-48h]@9 int v8; // [sp+58h] [bp-44h]@106 signed int v9; // [sp+64h] [bp-38h]@39 signed int walkerColor; // [sp+68h] [bp-34h]@54 char v11; // [sp+70h] [bp-2Ch]@85 __int16 v12; // [sp+74h] [bp-28h]@51 signed int v13; // [sp+78h] [bp-24h]@67 int v14; // [sp+7Ch] [bp-20h]@66 char v15; // [sp+80h] [bp-1Ch]@65 int v16; // [sp+84h] [bp-18h]@71 signed int v17; // [sp+88h] [bp-14h]@14 int v18; // [sp+8Ch] [bp-10h]@24 int v19; // [sp+90h] [bp-Ch]@27 int v20; // [sp+94h] [bp-8h]@24 signed int v21; // [sp+98h] [bp-4h]@29 if ( graphics_format_id == 2 ) { soldierColor = 0xF000F000u; if ( scn_climate ) { if ( scn_climate == 1 ) v6 = 6175; else v6 = 2063; } else { v6 = 0x7800u; } enemyColor = 0x10001 * v6; } else { soldierColor = 0x78007800u; if ( scn_climate ) { if ( scn_climate == 1 ) v7 = 3103; else v7 = 1055; } else { v7 = 15360; } enemyColor = 65537 * v7; } v17 = 0; draw_clip_x = in_x; draw_clip_xEnd = in_x + 2 * a3; draw_clip_y = in_y; draw_clip_yEnd = a4 + in_y; dword_9A052C = (165 - a3) / 2; dword_9D4DF0 = (325 - a4) / 2; minimap_left = in_x; minimap_top = in_y; minimap_right = in_x + 2 * a3; minimap_bottom = a4 + in_y; if ( (setting_map_width - a3) / 2 > 0 ) { if ( dword_9A050C >= dword_9A052C ) { if ( dword_9A050C > a3 + dword_9A052C - iso_viewport_width ) dword_9A052C = iso_viewport_width + dword_9A050C - a3; } else { dword_9A052C = dword_9A050C; } } if ( (2 * setting_map_height - a4) / 2 > 0 ) { if ( dword_9A0510 >= dword_9D4DF0 ) { if ( dword_9A0510 > a4 + dword_9D4DF0 - iso_viewport_height ) dword_9D4DF0 = iso_viewport_height + dword_9A0510 - a4; } else { dword_9D4DF0 = dword_9A0510; } } dword_9D4DF0 &= 0xFFFEu; v18 = in_y - 4; v20 = -4; dword_9A0540[0] = dword_9D4DF0 - 4; while ( v20 < a4 + 4 ) { if ( v17 ) { v19 = in_x - 9; v17 = 0; } else { v19 = in_x - 8; v17 = 1; } v21 = -4; dword_9A053C = dword_9A052C - 4; while ( v21 < a3 ) { if ( dword_9A053C >= 0 ) { if ( dword_9A053C < 165 ) { if ( dword_9A0540[0] >= 0 ) { if ( dword_9A0540[0] < 325 ) { v9 = 0; if ( v20 >= 0 ) { if ( v20 >= a4 ) v9 = 1; } else { v9 = 1; } if ( v21 >= 0 ) { if ( v21 >= a3 ) v9 = 1; } else { v9 = 1; } dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) { v12 = grid_terrain[dword_9D4B4C]; if ( v12 & T_Building ) { v15 = grid_edge[dword_9D4B4C]; v14 = grid_buildingIds[dword_9D4B4C]; if ( buildings[v14].type == B_FortGround ) v12 = 0; } walkerColor = fun_minimapGetWalkerColor(grid_walkerIds[dword_9D4B4C]); if ( walkerColor ) { graphic_xOffset = v19; graphic_yOffset = v18; if ( v9 ) walkerColor = 0; switch ( walkerColor ) { case 1: fun_drawTwoPixels(soldierColor); break; case 2: fun_drawTwoPixels(enemyColor); break; case 3: // wolf fun_drawTwoPixels(0); break; } } else { if ( v12 & T_Building ) { if ( v15 & 0x40 ) { if ( buildings[v14].house_size ) { v13 = word_6E6CD8; } else { if ( buildings[v14].type == B_Reservoir ) v13 = word_6E6CDE - 1; else v13 = word_6E6CDA; } v16 = grid_bitfields[dword_9D4B4C] & 0xF; if ( grid_bitfields[dword_9D4B4C] & 0xF ) { switch ( v16 ) { case 1: drawGraphic(v13 + 1, v19, v18 - 1); break; case 2: drawGraphic(v13 + 2, v19, v18 - 2); break; case 4: drawGraphic(v13 + 3, v19, v18 - 3); break; case 8: drawGraphic(v13 + 4, v19, v18 - 4); break; } } else { if ( !v9 ) fun_drawMinimapPixelGraphic(v13, v19, v18); } } } else { if ( !v9 ) { v11 = grid_random[dword_9D4B4C]; if ( v12 & T_Water ) { fun_drawMinimapPixelGraphic((v11 & 3) + word_6E6CCC, v19, v18); } else { if ( v12 & T_Scrub ) { fun_drawMinimapPixelGraphic((v11 & 3) + word_6E6CCE, v19, v18); } else { if ( v12 & T_Tree ) { fun_drawMinimapPixelGraphic((v11 & 3) + word_6E6CCE, v19, v18); } else { if ( v12 & T_Rock ) { fun_drawMinimapPixelGraphic((v11 & 3) + word_6E6CD2, v19, v18); } else { if ( v12 & T_Elevation ) { fun_drawMinimapPixelGraphic((v11 & 3) + word_6E6CD2, v19, v18); } else { if ( v12 & T_Road ) { fun_drawMinimapPixelGraphic(word_6E6CD6, v19, v18); } else { if ( v12 & T_Aqueduct ) { fun_drawMinimapPixelGraphic(word_6E6CDE, v19, v18); } else { if ( v12 & T_Wall ) { fun_drawMinimapPixelGraphic(word_6E6CDC, v19, v18); } else { if ( v12 & T_Meadow ) fun_drawMinimapPixelGraphic((v11 & 3) + word_6E6CD4, v19, v18); else fun_drawMinimapPixelGraphic((v11 & 7) + word_6E6CCA, v19, v18); } } } } } } } } } } } } else { if ( !v9 ) fun_drawMinimapPixelGraphic(word_6E6CE0, v19, v18); } } } } } v19 += 2; ++v21; ++dword_9A053C; } ++v18; ++v20; ++dword_9A0540[0]; } v8 = in_x + 2 * (dword_9A050C - dword_9A052C) - 2; if ( in_x + 2 * (dword_9A050C - dword_9A052C) - 2 < in_x ) v8 = in_x; if ( v8 + 2 * iso_viewport_width + 4 > a3 + in_x ) v8 -= 2; fun_drawRect(v8, dword_9A0510 + in_y - dword_9D4DF0 + 2, 2 * iso_viewport_width + 4, iso_viewport_height - 4, 59147); draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } signed int fun_minimapGetWalkerColor(int walkerId) { while ( walkerId ) { if ( walkers[walkerId].type >= Walker_FortJavelin && walkers[walkerId].type <= Walker_FortLegionary ) return 1; if ( walkers[walkerId].type >= Walker_Enemy43 && walkers[walkerId].type <= Walker_Enemy57 ) return 2; if ( walkers[walkerId].type == Walker_IndigenousNative && walkers[walkerId].actionState == 159 ) return 2; if ( walkers[walkerId].type == Walker_Wolf ) return 3; walkerId = walkers[walkerId].nextIdOnSameTile; } return 0; } int sub_43F750(int a1, int a2, signed int a3, int a4) { int result; // eax@30 signed int v5; // [sp+54h] [bp-14h]@1 int v6; // [sp+58h] [bp-10h]@11 int v7; // [sp+5Ch] [bp-Ch]@14 int v8; // [sp+60h] [bp-8h]@11 signed int v9; // [sp+64h] [bp-4h]@16 v5 = 0; dword_9A052C = (165 - a3) / 2; dword_9D4DF0 = (325 - a4) / 2; minimap_left = a1; minimap_top = a2; minimap_right = a1 + 2 * a3; minimap_bottom = a4 + a2; if ( (setting_map_width - a3) / 2 > 0 ) { if ( dword_9A050C >= dword_9A052C ) { if ( dword_9A050C > a3 + dword_9A052C - iso_viewport_width ) dword_9A052C = iso_viewport_width + dword_9A050C - a3; } else { dword_9A052C = dword_9A050C; } } if ( (2 * setting_map_height - a4) / 2 > 0 ) { if ( dword_9A0510 >= dword_9D4DF0 ) { if ( dword_9A0510 > a4 + dword_9D4DF0 - iso_viewport_height ) dword_9D4DF0 = iso_viewport_height + dword_9A0510 - a4; } else { dword_9D4DF0 = dword_9A0510; } } dword_9D4DF0 &= 0xFFFEu; v6 = a2 - 4; v8 = -4; dword_9A0540[0] = dword_9D4DF0 - 4; LABEL_12: if ( v8 >= a4 + 4 ) { result = 0; } else { if ( v5 ) { v7 = a1 - 9; v5 = 0; } else { v7 = a1 - 8; v5 = 1; } v9 = -4; for ( dword_9A053C = dword_9A052C - 4; ; ++dword_9A053C ) { if ( v9 >= a3 ) { ++v6; ++v8; ++dword_9A0540[0]; goto LABEL_12; } if ( dword_9A053C >= 0 && dword_9A053C < 165 && dword_9A0540[0] >= 0 && dword_9A0540[0] < 325 && mouseclick_y == v6 && (mouseclick_x == v7 || mouseclick_x == v7 + 1) ) break; v7 += 2; ++v9; } dword_9D4B4C = *(int *)((char *)&dword_9A0560[165 * dword_9A0540[0]] + 4 * dword_9A053C); if ( dword_9D4B4C < 268369920 ) result = dword_9D4B4C; else result = 0; } return result; } signed int fun_sound_43FA80(int a1, int a2) { signed int result; // eax@3 if ( a2 ) { if ( !ds_dword_995C48[a1] ) { dword_607F64 = 0; return 0; } ++dword_607F60; } else { if ( !ds_dword_995AC8[a1] ) { dword_607F64 = 0; return 0; } ++dword_607F5C; } ++dword_607F64; if ( dword_607F64 < 100000000 ) { result = 1; } else { dword_607F64 = 0; result = 0; } return result; } signed int fun_directSound_init() { DSBUFFERDESC Dst; // [sp+4Ch] [bp-18h]@5 int v2; // [sp+50h] [bp-14h]@5 int v3; // [sp+54h] [bp-10h]@5 int v4; // [sp+5Ch] [bp-8h]@5 int i; // [sp+60h] [bp-4h]@11 if ( ds_idirectsound ) return 1; ds_hresult = DirectSoundCreate(0, &ds_idirectsound, 0); if ( ds_hresult ) { ds_hresult = fun_directSoundTranslateError(ds_hresult); fun_logDebugMessage("ERR:DS failed open ", 0, ds_hresult + 1); return 0; } fun_sound_init(); memset(&Dst, 0, 0x14u); // Dst = 20; Dst.dwSize = 20; v2 = 1; v3 = 0; v4 = 0; ds_hresult = ds_idirectsound->SetCooperativeLevel( main_window, 2); if ( ds_hresult ) { fun_logDebugMessage("ERR:DS failed set co-op ", 0, ds_hresult + 1); LABEL_27: fun_deinitDirectSound(); return 0; } ds_hresult = ds_idirectsound->CreateSoundBuffer(&Dst,&ds_primaryBuffer,0); if ( ds_hresult ) { fun_logDebugMessage("ERR:DS failed setup primary buffer ", 0, ds_hresult + 1); goto LABEL_27; } ds_hresult = ds_primaryBuffer->SetPan( ds_lPan ); if ( ds_hresult ) { fun_logDebugMessage("ERR:DS failed to change primary buffer format ", 0, ds_hresult + 1); goto LABEL_27; } for ( i = 0; i < 160; ++i ) lpDirectSoundBuffer[i] = 0; for ( i = 0; i < 2; ++i ) sound_musicChannels[i] = 0; for ( i = 0; i < 2; ++i ) *(&uTimerID + i) = 0; for ( i = 0; i < 2; ++i ) ds_dword_995AC8[i] = 0; for ( i = 0; i < 2; ++i ) ds_dword_995C48[i] = 0; fun_logDebugMessage("OK :DS Installed.", 0, 0); return 1; } signed int fun_deinitDirectSound() { signed int result; // eax@2 int i; // [sp+4Ch] [bp-4h]@3 int j; // [sp+4Ch] [bp-4h]@6 if ( ds_idirectsound ) { for ( i = 0; i < 2; ++i ) fun_soundStopChannel(i); for ( j = 1; j <= 160; ++j ) fun_soundStopEffectsChannel(j); ds_hresult = ds_idirectsound->Release(); ds_idirectsound = 0; fun_logDebugMessage("OK :DS was_in_interupt", 0, dword_607F5C + 1); fun_logDebugMessage("OK :DS was_in_setup", 0, dword_607F60 + 1); fun_logDebugMessage("OK :DS Released.", 0, 0); result = 1; } else { result = 1; } return result; } void fun_sound_init() { memset(&ds_lPan, 0, 0x12u); ds_lPan = 1; ds_995B82 = 2; ds_hertz = 22050; ds_995B8C = 524290; ds_995B88 = (unsigned __int16)ds_995B8C * ds_hertz; } signed int fun_sound_playTestSound(const char *filename, int channel) { char *audioPtr2; // [sp+4Ch] [bp-34h]@18 DWORD audioBytes1; // [sp+50h] [bp-30h]@18 DWORD audioBytes2; // [sp+54h] [bp-2Ch]@18 char *audioPtr1; // [sp+58h] [bp-28h]@18 DSBUFFERDESC Dst; // [sp+5Ch] [bp-24h]@16 int v8; // [sp+60h] [bp-20h]@16 int v9; // [sp+64h] [bp-1Ch]@16 HGLOBAL v10; // [sp+6Ch] [bp-14h]@16 char *src; // [sp+70h] [bp-10h]@10 HGLOBAL hMem; // [sp+74h] [bp-Ch]@10 int soundBytes; // [sp+78h] [bp-8h]@12 int a1; // [sp+7Ch] [bp-4h]@3 if ( !ds_idirectsound ) return 0; for ( a1 = 1; a1 <= 160; ++a1 ) fun_soundStopEffectsChannel(a1); if ( channel > 160 ) channel = 160; for ( a1 = 0; ; ++a1 ) { if ( a1 >= channel ) { fun_adjustSoundVolumeForEffectsChannels(setting_sound_effects_pct, 1, 30); fun_adjustSoundVolumeForEffectsChannels(setting_sound_city_pct, 31, 150); return 1; } hMem = 0; src = 0; if( strcmp(filename, "null.wav") ) { if ( mmio_530D80(filename, &soundBytes, &hMem, (HGLOBAL *)&src) ) { fun_chdirToCdBasedOnExtension(filename); if ( mmio_530D80(filename, &soundBytes, &hMem, (HGLOBAL *)&src) ) { fun_chdirHome(); fun_logDebugMessage("ERR:Not found file :", filename, 0); goto LABEL_22; } fun_chdirHome(); } //memset(&Dst, 0, 0x14u); Dst.dwSize = 20; v8 = 226; v9 = soundBytes; v10 = hMem; ds_hresult = ds_idirectsound->CreateSoundBuffer( &Dst, &lpDirectSoundBuffer[a1],0); if ( ds_hresult ) break; ds_hresult = lpDirectSoundBuffer[a1]->Lock(0,soundBytes,(LPVOID*)&audioPtr1, &audioBytes1, (LPVOID*)&audioPtr2, &audioBytes2,0); if ( ds_hresult ) break; fun_strncpy(src, audioPtr1, soundBytes); ds_hresult = lpDirectSoundBuffer[a1]->Unlock(&audioPtr1,audioBytes1,audioPtr2,0); if ( ds_hresult ) break; } LABEL_22: if ( hMem ) { GlobalFree(hMem); hMem = 0; } if ( src ) { GlobalFree(src); src = 0; } filename += 32; } if ( hMem ) { GlobalFree(hMem); hMem = 0; } if ( src ) { GlobalFree(src); src = 0; } fun_logDebugMessage("ERR:Loading WAV file :", filename, 0); return 0; } signed int fun_sound_440330(int a1, int a2) { signed int result; // eax@2 signed int v3; // [sp+4Ch] [bp-Ch]@12 int v4; // [sp+50h] [bp-8h]@7 int v5; // [sp+54h] [bp-4h]@11 if ( ds_idirectsound ) { if ( sound_effectsChannels[a1] ) { if ( setting_sound_city_on ) { ds_hresult = (*(int (__fastcall **)(_DWORD, int, int, int *))(*(_DWORD *)sound_effectsChannels[a1] + 36))( *(_DWORD *)sound_effectsChannels[a1], a1, sound_effectsChannels[a1], &v4); if ( ds_hresult ) { fun_logDebugMessage("OK :DS BAD STATUS2 -", 0, a1 + 1); result = 0; } else { if ( v4 == 1 ) { result = 0; } else { v5 = 0; if ( a2 ) { if ( a2 == 2 ) { v3 = 0; } else { if ( a2 == 4 ) v3 = 10000; else v3 = 0; } } else { v3 = -10000; } ds_hresult = (*(int (__stdcall **)(int, signed int))(*(_DWORD *)sound_effectsChannels[a1] + 64))( sound_effectsChannels[a1], v3); ds_hresult = (*(int (__stdcall **)(int, _DWORD, _DWORD, int))(*(_DWORD *)sound_effectsChannels[a1] + 48))( sound_effectsChannels[a1], 0, 0, v5); if ( ds_hresult ) result = 0; else result = 1; } } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int sound_playChannel(int channel) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-8h]@7 int v3; // [sp+50h] [bp-4h]@11 if ( ds_idirectsound ) { if ( sound_effectsChannels[channel] ) { if ( setting_sound_effects_on ) { ds_hresult = (*(int (__fastcall **)(_DWORD, int, int, int *))(*(_DWORD *)sound_effectsChannels[channel] + 36))( *(_DWORD *)sound_effectsChannels[channel], channel, sound_effectsChannels[channel], &v2); if ( ds_hresult ) { fun_logDebugMessage("OK :DS BAD STATUS -", 0, channel + 1); result = 0; } else { if ( v2 == 1 ) { result = 0; } else { v3 = 0; ds_hresult = (*(int (__stdcall **)(int, _DWORD, _DWORD, _DWORD))(*(_DWORD *)sound_effectsChannels[channel] + 48))( sound_effectsChannels[channel], 0, 0, 0); if ( ds_hresult ) result = 0; else result = 1; } } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int fun_sound_isEffectsChannelInUse(int a1) { signed int result; // eax@2 if ( sound_effectsChannels[a1] ) result = 1; else result = 0; return result; } signed int fun_playInterfaceButtonSound(int a1) { signed int result; // eax@2 if ( ds_idirectsound ) { if ( sound_effectsChannels[a1] ) { if ( setting_sound_effects_on ) { ds_hresult = (*(int (__thiscall **)(_DWORD, _DWORD))(*(_DWORD *)sound_effectsChannels[a1] + 72))( a1, sound_effectsChannels[a1]); ds_hresult = (*(int (__thiscall **)(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD))(*(_DWORD *)sound_effectsChannels[a1] + 48))( a1, sound_effectsChannels[a1], 0, 0, 0); if ( ds_hresult ) result = 0; else result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void fun_soundStopEffectsChannel(int channel) { if ( ds_idirectsound ) { if ( sound_effectsChannels[channel] ) { (*(void (__stdcall **)(_DWORD))(*(_DWORD *)sound_effectsChannels[channel] + 72))(sound_effectsChannels[channel]); (*(void (__fastcall **)(_DWORD, _DWORD, _DWORD))(*(_DWORD *)sound_effectsChannels[channel] + 8))( *(_DWORD *)sound_effectsChannels[channel], channel, sound_effectsChannels[channel]); sound_effectsChannels[channel] = 0; } } } int unused_440760(int a1) { int result; // eax@3 if ( ds_idirectsound ) { result = a1; if ( sound_effectsChannels[a1] ) result = (*(int (__stdcall **)(_DWORD))(*(_DWORD *)sound_effectsChannels[a1] + 72))(sound_effectsChannels[a1]); } return result; } signed int fun_playSound(const char *filename, int isSpeech, int isBackgroundMusic) { signed int result; // eax@2 int v4; // eax@11 if ( ds_idirectsound ) { if ( setting_sound_speech_on || isSpeech != 1 ) { if ( setting_sound_music_on || isSpeech ) { if ( *(&uTimerID + isSpeech) ) fun_soundStopChannel(isSpeech); strcpy( ddSounds[isSpeech].str, filename); fun_sound_440B40(isSpeech, isBackgroundMusic); if ( v4 ) { fun_logDebugMessage("ERR:Cannot setup stream ", filename, 0); result = 1; } else { if ( fun_sound_441190(isSpeech) ) { fun_logDebugMessage("ERR:Cannot start stream ", filename, 0); result = 2; } else { if ( isSpeech ) fun_adjustSoundVolumeForChannel(setting_sound_speech_pct, isSpeech); else fun_adjustSoundVolumeForChannel(setting_sound_music_pct, 0); ds_dword_995C48[isSpeech] = 0; result = 0; } } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int unused_440920(const char *a2, DWORD_PTR arg4, int a3) { signed int result; // eax@2 int v4; // eax@13 if ( ds_idirectsound ) { if ( setting_sound_speech_on || arg4 != 1 ) { if ( setting_sound_music_on || arg4 ) { if ( *(&uTimerID + arg4) ) { result = 0; } else { if ( *(&uTimerID + arg4) ) fun_soundStopChannel(arg4); strcpy( ddSounds[arg4].str, a2); fun_sound_440B40(arg4, a3); if ( v4 ) { fun_logDebugMessage("ERR:Cannot setup stream ", a2, 0); result = 1; } else { if ( fun_sound_441190(arg4) ) { fun_logDebugMessage("ERR:Cannot start stream ", a2, 0); result = 2; } else { if ( arg4 ) fun_adjustSoundVolumeForChannel(setting_sound_speech_pct, arg4); else fun_adjustSoundVolumeForChannel(setting_sound_music_pct, 0); ds_dword_995C48[arg4] = 0; result = 0; } } } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int unused_440AA0(int a1) { signed int result; // eax@2 if ( ds_idirectsound ) { if ( setting_sound_speech_on || a1 != 1 ) { if ( setting_sound_music_on || a1 ) { if ( *(&uTimerID + a1) ) result = 1; else result = 0; } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void unused_440B20() { ; } void fun_sound_440B40(int a1, int a2) { int v2; // eax@22 char* v3; // [sp+4Ch] [bp-30h]@15 int v4; // [sp+54h] [bp-28h]@11 DWORD audioBytes2; // [sp+58h] [bp-24h]@10 DWORD audioBytes1; // [sp+5Ch] [bp-20h]@10 char* audioPtr2; // [sp+60h] [bp-1Ch]@10 char* audioPtr1; // [sp+64h] [bp-18h]@10 DSBUFFERDESC Dst; // [sp+68h] [bp-14h]@8 int v10; // [sp+6Ch] [bp-10h]@8 int v11; // [sp+70h] [bp-Ch]@8 HGLOBAL hglobal12; // [sp+78h] [bp-4h]@8 if ( !mmio_loadFile( ddSounds[a1].str, (HMMIO *)&sound_handles[21 * a1], (void **)&global_handles[21 * a1], (const MMCKINFO *)((char *)&unk_995BBC + 84 * a1)) ) { if ( *(_WORD *)global_handles[21 * a1] != 1 ) { mmio_close((HMMIO *)&sound_handles[21 * a1], (HGLOBAL *)&global_handles[21 * a1]); return; } if ( mmio_530A90( (HMMIO *)&sound_handles[21 * a1], (LPMMCKINFO)((char *)&unk_995BA8 + 84 * a1), (const MMCKINFO *)((char *)&unk_995BBC + 84 * a1)) ) { mmio_close((HMMIO *)&sound_handles[21 * a1], (HGLOBAL *)&global_handles[21 * a1]); return; } if ( !sound_musicChannels[a1] ) { ds_sound_buffer_lenght[21 * a1] = *(_DWORD *)(global_handles[21 * a1] + 8) * (uPeriod * dword_5F96A0) / 10 / 0x64u; ds_dword_995BD8[21 * a1] = ds_sound_buffer_lenght[21 * a1] / (unsigned int)dword_5F96A0; ds_sound_buffer_lenght[21 * a1] = dword_5F96A0 * ds_dword_995BD8[21 * a1]; memset(&Dst, 0, 0x14u); Dst.dwSize = 20; v10 = 224; v11 = ds_sound_buffer_lenght[21 * a1]; hglobal12 = global_handles[21 * a1]; ds_hresult = ds_idirectsound->CreateSoundBuffer(&Dst,&sound_musicChannels[a1],0); if ( ds_hresult ) { mmio_close((HMMIO *)&sound_handles[21 * a1], (HGLOBAL *)&global_handles[21 * a1]); return; } } ds_sound_buffer_ptr[21 * a1] = sound_musicChannels[a1]; ds_dword_995BEC[21 * a1] = 0; ds_dword_995BF0[21 * a1] = 0; ds_dword_995BE0[21 * a1] = 0; ds_dword_995BE4[21 * a1] = 0; ds_dword_995BE8[21 * a1] = a2; ds_hresult = sound_musicChannels[a1]->Lock(0,ds_sound_buffer_lenght[21 * a1], (LPVOID*)&audioPtr1,&audioBytes1,(LPVOID*)&audioPtr2,&audioBytes2,0); if ( audioBytes1 ) { if( false /*j_mmio_530B40((HMMIO)dword_995BA4[21 * a1], audioBytes2, audioPtr2, (int)((char *)&unk_995BA8 + 84 * a1), (int)&v4)*/ ) { LABEL_24: /* ds_hresult = (*(int (__fastcall **)(_DWORD, int, int, int, int, int, _DWORD))(*(_DWORD *)sound_musicChannels[a1] + 76))( *(_DWORD *)sound_musicChannels[a1], a1, sound_musicChannels[a1], audioPtr2, audioBytes2, v7, 0);*/ ds_dword_995BE4[21 * a1] = 1; fun_logDebugMessage("ERR:DS-str ss stopped - pre stop ", ddSounds[a1].str, 0); fun_soundStopChannel(a1); fun_logDebugMessage("ERR:DS-str ss stopped - ", ddSounds[a1].str, 0); return; } if ( v4 < (unsigned int)audioBytes1 ) { if ( ds_dword_995BE8[21 * a1] ) { v3 = audioPtr1; while ( 1 ) { v3 += v4; audioBytes1 -= v4; if ( mmio_530A90( (HMMIO *)&sound_handles[21 * a1], (LPMMCKINFO)((char *)&unk_995BA8 + 84 * a1), (const MMCKINFO *)((char *)&unk_995BBC + 84 * a1)) ) goto LABEL_24; if ( mmio_530B40((HMMIO)sound_handles[21 * a1], audioBytes1, v3, (int)((char *)&unk_995BA8 + 84 * a1), v4) ) goto LABEL_24; if ( v4 >= (unsigned int)audioBytes1 ) goto LABEL_23; } } ds_dword_995BEC[21 * a1] = 1; ds_dword_995BF0[21 * a1] = v4 / (unsigned int)ds_dword_995BD8[21 * a1]; v2 = -(*(_WORD *)(global_handles[21 * a1] + 14) != 8); v2 = v2 & 0x80; memset((void *)(v4 + audioPtr1), v2 + 128, audioBytes1 - v4); } } LABEL_23: ds_hresult = sound_musicChannels[a1]->Unlock(audioPtr1,audioBytes1,audioPtr2,0); ds_sound_buffer_offset[21 * a1] = 0; ds_dword_995BE4[21 * a1] = 0; } } signed int fun_sound_441190(DWORD_PTR dwUser) { signed int result; // eax@2 if ( sound_musicChannels[dwUser] ) { ds_hresult = sound_musicChannels[dwUser]->SetCurrentPosition(0); ds_hresult = sound_musicChannels[dwUser]->Play(0,0,1); if ( timeBeginPeriod(uPeriod) ) { ds_hresult = sound_musicChannels[dwUser]->Stop(); mmio_close((HMMIO *)&sound_handles[21 * dwUser], (HGLOBAL *)&global_handles[21 * dwUser]); result = 1; } else { *(&uTimerID + dwUser) = timeSetEvent(uPeriod, uResolution, (LPTIMECALLBACK)fptc_0, dwUser, 1u); if ( *(&uTimerID + dwUser) ) { result = 0; } else { timeEndPeriod(uPeriod); ds_hresult = sound_musicChannels[dwUser]->Stop(); mmio_close((HMMIO *)&sound_handles[21 * dwUser], (HGLOBAL *)&global_handles[21 * dwUser]); result = 2; } } } else { result = 1; } return result; } void fun_soundStopChannel(int channel) { if ( ds_idirectsound ) { if ( *(&uTimerID + channel) ) { if ( sound_musicChannels[channel] ) { ds_dword_995BE4[21 * channel] = 1; while ( fun_sound_43FA80(channel, 0) ) ; ds_dword_995C48[channel] = 1; while ( fun_sound_43FA80(channel, 0) ) ; timeKillEvent(*(&uTimerID + channel)); timeEndPeriod(uPeriod); *(&uTimerID + channel) = 0; ds_hresult = sound_musicChannels[channel]->Stop(); mmio_close((HMMIO *)&sound_handles[21 * channel], (HGLOBAL *)&global_handles[21 * channel]); ds_dword_995C48[channel] = 0; } } } } LONG __stdcall fptc_0(int a1, int a2, int a3, int a4, int a5) { LONG result; // eax@1 int v6; // [sp+4Ch] [bp-28h]@37 MMRESULT v7; // [sp+50h] [bp-24h]@37 DWORD status; // [sp+54h] [bp-20h]@9 DWORD v9; // [sp+58h] [bp-1Ch]@11 DWORD currentPlayCursor; // [sp+5Ch] [bp-18h]@11 DWORD audioBytes2; // [sp+60h] [bp-14h]@24 DWORD Size; // [sp+64h] [bp-10h]@24 char* v13; // [sp+68h] [bp-Ch]@49 char* audioPtr2; // [sp+6Ch] [bp-8h]@24 void *Dst; // [sp+70h] [bp-4h]@24 result = InterlockedExchange(&Target, 1); if ( result ) return result; if ( !*(&uTimerID + a3) || ds_dword_995C48[a3] || ds_dword_995BE4[21 * a3] ) { if ( ds_dword_995C48[a3] ) fun_sound_43FA80(a3, 1); ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } ds_dword_995AC8[a3] = 1; ds_primaryBuffer->GetStatus(/*ds_sound_buffer_ptr[21 * a3],*/ &status); if ( status & 2 ) { ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } ds_sound_buffer_ptr[21 * a3]->GetCurrentPosition( ¤tPlayCursor, &v9); if ( currentPlayCursor == ds_sound_buffer_offset[21 * a3] ) { ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } if ( ds_sound_buffer_offset[21 * a3] < currentPlayCursor && ds_dword_995BD8[21 * a3] + ds_sound_buffer_offset[21 * a3] > currentPlayCursor ) { ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } if ( ds_dword_995BEC[21 * a3] && !ds_dword_995BF0[21 * a3] ) { if ( !ds_dword_995BE4[21 * a3] ) { ds_dword_995BE4[21 * a3] = 1; ds_hresult = sound_musicChannels[a3]->Stop(); } ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } if ( !ds_dword_995BEC[21 * a3] || !ds_dword_995BF0[21 * a3] ) { if ( ds_sound_buffer_ptr[21 * a3]->Lock(ds_sound_buffer_offset[21 * a3],ds_dword_995BD8[21 * a3],&Dst,&Size,(LPVOID*)&audioPtr2,&audioBytes2,0) ) { ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } if ( !Size || ds_dword_995BE4[21 * a3] ) { if ( Size ) { if ( ds_dword_995BE4[21 * a3] ) memset(Dst, *(_WORD *)(global_handles[21 * a3] + 14) != 8 ? 0 : 128, Size); } } else { v7 = mmio_530B40((HMMIO)sound_handles[21 * a3], Size, (char*)Dst,(int)((char *)&unk_995BA8 + 84 * a3), v6); if ( v7 ) { LABEL_86: ds_sound_buffer_ptr[21 * a3]->Unlock(Dst,Size,audioPtr2,audioBytes2); ds_dword_995BE4[21 * a3] = 1; fun_logDebugMessage("ERR:DS-str ts stopped - pre stop ", ddSounds[a3].str, 0); ds_hresult = sound_musicChannels[a3]->Stop();/* a3,sound_musicChannels[a3]); */ fun_logDebugMessage("ERR:DS-str ts stopped - ", ddSounds[a3].str, 0); ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } if ( v6 < Size ) { if ( ds_dword_995BE8[21 * a3] ) { v13 = (char*)Dst; while ( 1 ) { v13 += v6; Size -= v6; v7 = mmio_530A90( (HMMIO *)&sound_handles[21 * a3], (LPMMCKINFO)((char *)&unk_995BA8 + 84 * a3), (const MMCKINFO *)((char *)&unk_995BBC + 84 * a3)); if ( v7 ) goto LABEL_86; v7 = mmio_530B40((HMMIO)sound_handles[21 * a3], Size, v13, (int)((char *)&unk_995BA8 + 84 * a3), (int)&v6); if ( v7 ) goto LABEL_86; if ( v6 >= Size ) goto LABEL_59; } } if ( *(_WORD *)(global_handles[21 * a3] + 14) == 8 ) { memset((char *)Dst + v6, 128, Size - v6); } else { if ( *(_WORD *)(global_handles[21 * a3] + 14) == 16 ) memset((char *)Dst + v6, 0, Size - v6); } ds_dword_995BEC[21 * a3] = 1; if ( currentPlayCursor <= ds_sound_buffer_offset[21 * a3] ) ds_dword_995BF0[21 * a3] = (ds_sound_buffer_offset[21 * a3] - currentPlayCursor) / ds_dword_995BD8[21 * a3]; else ds_dword_995BF0[21 * a3] = (ds_sound_buffer_lenght[21 * a3] + ds_sound_buffer_offset[21 * a3] - currentPlayCursor) / ds_dword_995BD8[21 * a3]; } } LABEL_59: if ( !audioBytes2 || ds_dword_995BE4[21 * a3] ) { if ( audioBytes2 ) { if ( ds_dword_995BE4[21 * a3] ) memset((void *)audioPtr2, *(_WORD *)(global_handles[21 * a3] + 14) != 8 ? 0 : 128, audioBytes2); } } else { v7 = mmio_530B40((HMMIO)sound_handles[21 * a3], audioBytes2, audioPtr2, (int)((char *)&unk_995BA8 + 84 * a3), (int)&v6); if ( v7 ) goto LABEL_86; if ( v6 < (unsigned int)audioBytes2 ) { if ( ds_dword_995BE8[21 * a3] ) { v13 = audioPtr2; while ( 1 ) { v13 += v6; audioBytes2 -= v6; v7 = mmio_530A90( (HMMIO *)&sound_handles[21 * a3], (LPMMCKINFO)((char *)&unk_995BA8 + 84 * a3), (const MMCKINFO *)((char *)&unk_995BBC + 84 * a3)); if ( v7 ) goto LABEL_86; v7 = mmio_530B40((HMMIO)sound_handles[21 * a3], audioBytes2, v13, (int)((char *)&unk_995BA8 + 84 * a3), (int)&v6); if ( v7 ) goto LABEL_86; if ( v6 >= (unsigned int)audioBytes2 ) goto LABEL_83; } } if ( *(_WORD *)(global_handles[21 * a3] + 14) == 8 ) { memset((void *)(v6 + audioPtr2), 128, audioBytes2 - v6); } else { if ( *(_WORD *)(global_handles[21 * a3] + 14) == 16 ) memset((void *)(v6 + audioPtr2), 0, audioBytes2 - v6); } ds_dword_995BEC[21 * a3] = 1; if ( currentPlayCursor <= ds_sound_buffer_offset[21 * a3] ) ds_dword_995BF0[21 * a3] = (ds_sound_buffer_offset[21 * a3] - currentPlayCursor) / ds_dword_995BD8[21 * a3]; else ds_dword_995BF0[21 * a3] = (ds_sound_buffer_lenght[21 * a3] + ds_sound_buffer_offset[21 * a3] - currentPlayCursor) / ds_dword_995BD8[21 * a3]; } } LABEL_83: ds_sound_buffer_ptr[21 * a3]->Unlock(Dst,Size,audioPtr2,audioBytes2); ds_sound_buffer_offset[21 * a3] += ds_dword_995BD8[21 * a3]; if ( ds_sound_buffer_offset[21 * a3] >= (unsigned int)ds_sound_buffer_lenght[21 * a3] ) ds_sound_buffer_offset[21 * a3] -= ds_sound_buffer_lenght[21 * a3]; ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } --ds_dword_995BF0[21 * a3]; if ( ds_dword_995BF0[21 * a3] > 1 ) { if ( ds_sound_buffer_ptr[21 * a3]->Lock(ds_sound_buffer_offset[21 * a3],ds_dword_995BD8[21 * a3],(LPVOID*)&Dst,&Size,(LPVOID*)&audioPtr2,&audioBytes2,0) ) { ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } if ( *(_WORD *)(global_handles[21 * a3] + 14) == 8 ) { memset(Dst, 128, Size); } else { if ( *(_WORD *)(global_handles[21 * a3] + 14) == 16 ) memset(Dst, 0, Size); } ds_sound_buffer_ptr[21 * a3]->Unlock(Dst,Size,audioPtr2,audioBytes2); ds_sound_buffer_offset[21 * a3] += ds_dword_995BD8[21 * a3]; if ( ds_sound_buffer_offset[21 * a3] >= (unsigned int)ds_sound_buffer_lenght[21 * a3] ) ds_sound_buffer_offset[21 * a3] -= ds_sound_buffer_lenght[21 * a3]; } ds_dword_995AC8[a3] = 0; return InterlockedExchange(&Target, 0); } signed int fun_directSoundTranslateError(int error) { signed int result; // eax@2 switch ( error ) { case 0x8878000A: result = 1; break; case 0x8878001E: result = 2; break; case 0x80070057: result = 3; break; case 0x88780032: result = 4; break; case 0x80004005: result = 5; break; case 0x88780046: result = 6; break; case 0x8007000E: result = 7; break; case 0x88780064: result = 8; break; case 0x80004001: result = 9; break; case 0x88780078: result = 10; break; case 0x88780082: result = 11; break; case 0x80040110: result = 12; break; case 0x88780096: result = 13; break; case 0x887800A0: result = 14; break; default: result = 0; break; } return result; } void fun_adjustSoundVolumeForChannel(int percentage, int channel) { int v2; // eax@8 int v3; // [sp+58h] [bp+8h]@6 if ( ds_idirectsound ) { if ( sound_musicChannels[channel] ) { if ( percentage ) v3 = fun_adjustWithPercentage(30, percentage) + 70; else v3 = 0; v2 = fun_adjustWithPercentage(10000, v3); ds_hresult = sound_musicChannels[channel]->SetVolume(v2 - 10000); } } } void fun_adjustSoundVolumeForEffectsChannels(int percentage, int channelFrom, int channelTo) { int i; // [sp+4Ch] [bp-8h]@6 int v4; // [sp+50h] [bp-4h]@6 int volume; // [sp+5Ch] [bp+8h]@4 if ( ds_idirectsound ) { if ( percentage ) volume = fun_adjustWithPercentage(30, percentage) + 70; else volume = 0; v4 = fun_adjustWithPercentage(10000, volume) - 10000; for ( i = channelFrom; i <= channelTo; ++i ) { if ( sound_effectsChannels[i] ) ds_hresult = (*(int (__thiscall **)(int, int, int))(*(_DWORD *)sound_effectsChannels[i] + 60))( i, sound_effectsChannels[i], v4); } } } void fun_editor_empire_determineMaxEntryInUse() { signed int i; // [sp+4Ch] [bp-4h]@1 edit_empire_max_inUse = 0; for ( i = 0; i < 200 && empire[i].inUse > 1; ++i ) ++edit_empire_max_inUse; if ( edit_empire_max_inUse >= 200 ) edit_empire_max_inUse = 199; } void fun_editor_empire_clearEmpireEntry(int entryId) { int i; // [sp+4Ch] [bp-8h]@3 int v2; // [sp+50h] [bp-4h]@3 if ( empire[entryId].inUse ) { memset( &empire[entryId], 0, sizeof(Empire)); v2 = entryId; for ( i = entryId + 1; v2 < 199 && empire[i].inUse; ++i ) { memcpy( &empire[i], &empire[v2], sizeof(Empire)); memset(&empire[i], 0, sizeof(Empire)); ++v2; } } } int unused_4425B0() { int result; // eax@2 int v1; // ST4C_4@35 signed int i; // [sp+5Ch] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { switch ( empire[i].type ) { case 3: empire[i].graphicID = graphic_empireBattleIcon; break; case 4: empire[i].graphicID = empire[i].graphicID - 17 + graphic_empireLandTradeRoute; break; case 5: empire[i].graphicID = empire[i].graphicID - 25 + graphic_empireSeaTradeRoute; break; case 6: empire[i].graphicID = graphic_empireDistantBattleRomanArmy; break; case 7: empire[i].graphicID = graphic_empireDistantBattleEnemyArmy; break; case 1: if ( empire[i].cityType ) { switch ( empire[i].cityType ) { case 1: empire[i].graphicID = graphic_empireCity; break; case 2: empire[i].graphicID = graphic_empireCityTrade; break; case 3: empire[i].graphicID = graphic_empireCityDistant; empire[i].graphicID_exp = graphic_empireCityTrade; break; case 4: empire[i].graphicID = word_6E6D6E; break; case 5: empire[i].graphicID = graphic_empireCityDistant; break; case 6: empire[i].graphicID = word_6E6D6E; empire[i].graphicID_exp = graphic_empireCityDistant; break; } } else { empire[i].graphicID = graphic_empireCityDistant; } break; default: if ( empire[i].currentAnimationIndex ) empire[i].graphicID = graphic_empireBorderMarker; else empire[i].graphicID = word_6E6D16; break; } empire[i].graphicID_exp = empire[i].graphicID; v1 = empire[i].graphicID; empire[i].width = c3_sg2[v1].width; empire[i].height = c3_sg2[v1].height; } result = i + 1; } return result; } void fun_initEmpire() { int v0; // [sp+4Ch] [bp-10h]@15 int v1; // [sp+54h] [bp-8h]@1 signed int i; // [sp+58h] [bp-4h]@1 signed int j; // [sp+58h] [bp-4h]@15 v1 = 0; for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse && empire[i].type == Emp_City && empire[i].cityType == City_Ours ) { v1 = empire[i].graphicID; break; } } if ( v1 > 0 ) { if ( v1 != graphic_empireCity ) { v0 = graphic_empireCity - v1; for ( j = 0; j < 200; ++j ) { if ( empire[j].inUse ) { if (empire[j].graphicID ) { empire[j].graphicID += v0; if ( empire[j].graphicID_exp ) empire[j].graphicID_exp += v0; } } } } } } void fun_editor_empire_determineGraphicSize() { int v0; // ST4C_4@21 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].type == 1 ) { if ( empire[i].cityType ) { switch ( empire[i].cityType ) { case 1: empire[i].graphicID = graphic_empireCity; break; case 2: empire[i].graphicID = graphic_empireCityTrade; break; case 3: empire[i].graphicID = graphic_empireCityDistant; break; case 4: empire[i].graphicID = word_6E6D6E; break; case 5: empire[i].graphicID = graphic_empireCityDistant; break; case 6: empire[i].graphicID = word_6E6D6E; break; } } else { empire[i].graphicID = graphic_empireCityDistant; } v0 = empire[i].graphicID; empire[i].width = c3_sg2[v0].width; empire[i].height = c3_sg2[v0].height; } } } } void fun_scrollEmpireMap(int direction) { if ( direction != 8 ) { if ( direction ) { switch ( direction ) { case 1: empire_scroll_y -= 20; empire_scroll_x += 20; break; case 2: empire_scroll_x += 20; break; case 3: empire_scroll_y += 20; empire_scroll_x += 20; break; case 4: empire_scroll_y += 20; break; case 5: empire_scroll_y += 20; empire_scroll_x -= 20; break; case 6: empire_scroll_x -= 20; break; case 7: empire_scroll_y -= 20; empire_scroll_x -= 20; break; } } else { empire_scroll_y -= 20; } fun_checkEmpireMapScrollBoundaries(); } } void fun_checkEmpireMapScrollBoundaries() { if ( empire_scroll_x < 0 ) empire_scroll_x = 0; if ( empire_scroll_x >= empireMapWidth - (ddraw_width - 2 * empireMapBorderLeftRight) ) empire_scroll_x = empireMapWidth - (ddraw_width - 2 * empireMapBorderLeftRight) - 1; if ( empire_scroll_y < 0 ) empire_scroll_y = 0; if ( empire_scroll_y >= empireMapHeight - (ddraw_height - empireMapBorderTop - empireMapBorderBottom) ) empire_scroll_y = empireMapHeight - (ddraw_height - empireMapBorderTop - empireMapBorderBottom) - 1; } void fun_sortRequests() { __int16 v0; // ST58_2@10 __int16 v1; // ST54_2@10 __int16 v2; // ST50_2@10 __int16 v3; // ST4C_2@10 signed int j; // [sp+5Ch] [bp-8h]@3 signed int i; // [sp+60h] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { for ( j = 19; j > 0; --j ) { if ( map_requests_good[j] ) { if ( !map_requests_year[j + 19] || *(&map_unknown_0c + j) > map_requests_year[j] ) { v0 = *(&map_unknown_0c + j); v1 = map_requests_good[j + 19]; v2 = map_requests_year[j + 19]; v3 = map_requests_amount[j + 19]; *(&map_unknown_0c + j) = map_requests_year[j]; map_requests_good[j + 19] = map_requests_amount[j]; map_requests_year[j + 19] = map_requests_good[j]; map_requests_amount[j + 19] = map_requests_deadline[j]; map_requests_year[j] = v0; map_requests_amount[j] = v1; map_requests_good[j] = v2; map_requests_deadline[j] = v3; } } } } } void fun_sortInvasions() { __int16 v0; // ST5C_2@10 __int16 v1; // ST58_2@10 __int16 v2; // ST54_2@10 __int16 v3; // ST50_2@10 __int16 v4; // ST4C_2@10 signed int j; // [sp+60h] [bp-8h]@3 signed int i; // [sp+64h] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { for ( j = 19; j > 0; --j ) { if ( map_invasions_type[j] ) { if ( !map_invasions_year[j + 19] || map_requests_deadline[j + 19] > map_invasions_year[j] ) { v0 = map_requests_deadline[j + 19]; v1 = map_invasions_type[j + 19]; v2 = map_invasions_year[j + 19]; v3 = map_invasions_amount[j + 19]; v4 = map_invasions_from[j + 19]; map_requests_deadline[j + 19] = map_invasions_year[j]; map_invasions_type[j + 19] = map_invasions_amount[j]; map_invasions_year[j + 19] = map_invasions_type[j]; map_invasions_amount[j + 19] = map_invasions_from[j]; map_invasions_from[j + 19] = map_invasions_attack[j]; map_invasions_year[j] = v0; map_invasions_amount[j] = v1; map_invasions_type[j] = v2; map_invasions_from[j] = v3; map_invasions_attack[j] = v4; } } } } } void fun_sortDemandChanges() { __int16 v0; // ST58_2@15 char v1; // ST54_1@15 char v2; // ST50_1@15 char v3; // ST4C_1@15 signed int k; // [sp+5Ch] [bp-8h]@8 signed int i; // [sp+60h] [bp-4h]@1 signed int j; // [sp+60h] [bp-4h]@6 for ( i = 0; i < 20; ++i ) { if ( !map_demandChanges_good[i] ) map_demandChanges_year[i] = 0; } for ( j = 0; j < 20; ++j ) { for ( k = 19; k > 0; --k ) { if ( map_demandChanges_year[k] ) { if ( !map_herd_y[k + 3] || map_herd_y[k + 3] > map_demandChanges_year[k] ) { v0 = map_herd_y[k + 3]; v1 = byte_990A63[k]; v2 = map_demandChanges_good[k + 19]; v3 = map_demandChanges_route[k + 19]; map_herd_y[k + 3] = map_demandChanges_year[k]; byte_990A63[k] = map_demandChanges_good[k]; map_demandChanges_good[k + 19] = map_demandChanges_route[k]; map_demandChanges_route[k + 19] = map_demandChanges_isRise[k]; map_demandChanges_year[k] = v0; map_demandChanges_good[k] = v1; map_demandChanges_route[k] = v2; map_demandChanges_isRise[k] = v3; } } } } } void fun_sortPriceChanges() { __int16 v0; // ST58_2@15 char v1; // ST54_1@15 char v2; // ST50_1@15 char v3; // ST4C_1@15 signed int k; // [sp+5Ch] [bp-8h]@8 signed int i; // [sp+60h] [bp-4h]@1 signed int j; // [sp+60h] [bp-4h]@6 for ( i = 0; i < 20; ++i ) { if ( !map_priceChanges_good[i] ) map_priceChanges_year[i] = 0; } for ( j = 0; j < 20; ++j ) { for ( k = 19; k > 0; --k ) { if ( map_priceChanges_year[k] ) { if ( !*(_WORD *)&map_demandChanges_isRise[2 * k + 18] || *(_WORD *)&map_demandChanges_isRise[2 * k + 18] > map_priceChanges_year[k] ) { v0 = *(_WORD *)&map_demandChanges_isRise[2 * k + 18]; v1 = byte_990ADB[k]; v2 = map_priceChanges_good[k + 19]; v3 = map_priceChanges_amount[k + 19]; *(_WORD *)&map_demandChanges_isRise[2 * k + 18] = map_priceChanges_year[k]; byte_990ADB[k] = map_priceChanges_good[k]; map_priceChanges_good[k + 19] = map_priceChanges_amount[k]; map_priceChanges_amount[k + 19] = map_priceChanges_isRise[k]; map_priceChanges_year[k] = v0; map_priceChanges_good[k] = v1; map_priceChanges_amount[k] = v2; map_priceChanges_isRise[k] = v3; } } } } } void fun_empireCityClearBuysSells(int empireItemId) { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 for ( i = 0; i < 10; ++i ) empire[empireItemId].citySells[i] = 0; for ( j = 0; j < 8; ++j ) empire[empireItemId].cityBuys[j] = 0; } void fun_editor_empire_fixBuySell(int a1) { char v1; // ST4C_1@12 char v2; // ST4C_1@26 signed int j; // [sp+50h] [bp-8h]@3 signed int l; // [sp+50h] [bp-8h]@17 signed int i; // [sp+54h] [bp-4h]@1 signed int k; // [sp+54h] [bp-4h]@15 for ( i = 0; i < 10; ++i ) { for ( j = 9; j > 0; --j ) { if ( empire[a1].citySells[j] ) { if ( empire[a1].tradeCostToOpen[j + 1] == empire[a1].citySells[j] ) { empire[a1].citySells[j] = 0; } else { if ( !empire[a1].tradeCostToOpen[j + 1] || empire[a1].tradeCostToOpen[j + 1] > empire[a1].citySells[j] ) { v1 = empire[a1].tradeCostToOpen[j + 1]; empire[a1].tradeCostToOpen[j + 1] = empire[a1].citySells[j]; empire[a1].citySells[j] = v1; } } } } } for ( k = 0; k < 10; ++k ) { for ( l = 9; l > 0; --l ) { if ( empire[a1].cityBuys[l] ) { if ( empire[a1].f990D29[l] == empire[a1].cityBuys[l] ) { empire[a1].cityBuys[l] = 0; } else { if ( !empire[a1].f990D29[l] || empire[a1].f990D29[l] > empire[a1].cityBuys[l] ) { v2 = empire[a1].f990D29[l]; empire[a1].f990D29[l] = empire[a1].cityBuys[l]; empire[a1].cityBuys[l] = v2; } } } } } } void fun_editor_empire_fixOwnCity() { int numOwnCities; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 int j; // [sp+50h] [bp-4h]@18 numOwnCities = 0; for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].f990D29[0] > 0 ) --empire[i].f990D29[0]; if ( empire[i].type == Emp_City ) { if ( empire[i].cityType == City_Ours ) ++numOwnCities; } } } empireindex_inUse[16 * scenario_map_empire] = numOwnCities >= 0; if ( numOwnCities != 1 ) { for ( j = 0; j < 200; ++j ) { if ( empire[j].inUse ) { if (empire[j].type == Emp_City ) { if ( empire[i].cityType == City_Ours ) { if ( !empire[i].f990D29 ) { empire[j].cityType = City_DistantRoman; fun_empireCityClearBuysSells(j); } } } } } } } void fun_empireObjectsCorrectOwnerCity(int cityId) { signed int i; // [sp+4Ch] [bp-8h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse && empire[i].type == 1 && empire[i].tradeRouteId == empire[cityId].tradeRouteId ) { empire[cityId].ownerCityIndex = i; empire[cityId].cityNameId = empire[i].cityNameId; return; } } } void fun_empireObjectsCorrectTradeStatus() { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { // trade route dots if ( empire[i].type == Emp_LandTradeRoute || empire[i].type == Emp_SeaTradeRoute ) empire[i].tradeRouteOpen = empire[empire[i].ownerCityIndex].tradeRouteOpen; } } } signed int canEmpireCitySellsGood(int empireId, int goodId) { signed int i; // [sp+4Ch] [bp-4h]@1 for( i = 0; i < 10; ++i ) { if( empire[empireId].citySells[i] == goodId ) return 1; } return 0; } signed int canEmpireCityBuysGood(int empireId, int goodId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 8; ++i ) { if ( empire[empireId].cityBuys[i] == goodId ) return 1; } return 0; } bool fun_canExportGoodToCity(int ciid, int cityId, int resourceId) { bool result; // eax@4 if ( cityId && tradedSoFar[ tradeRoutes[cityId].routeId[ resourceId ] ] >= tradeRoutes[ tradeRoutes[cityId].routeId[ resourceId ] ].quotas[0] ) { result = 0; // quota reached } else { if ( city_inform[ciid].resourceInStock[resourceId] > city_inform[ciid].exportOver[resourceId] ) { if ( !cityId || tradeRoutes[cityId].buysFlag[ resourceId ] ) result = city_inform[ciid].resourceTradeStatus[ resourceId ] == 2; else result = 0; } else { result = 0; } } return result; } bool canImportGoodFromCity(int ciid, int cityId, signed int resourceId) { bool result; // eax@2 GoodType finishedGood; // [sp+4Ch] [bp-Ch]@36 signed int maxFoodStock; // [sp+50h] [bp-8h]@12 signed int maxGoodStock; // [sp+50h] [bp-8h]@44 int inStock; // [sp+54h] [bp-4h]@7 if ( tradeRoutes[cityId].sellsFlag[ resourceId ] ) { if ( city_inform[ciid].resourceTradeStatus[ resourceId ] == 1 ) { if( tradedSoFar[ tradeRoutes[cityId].routeId[ resourceId ] ] < tradeRoutes[ tradeRoutes[cityId].routeId[ resourceId ] ].quotas[0] ) { inStock = city_inform[ciid].resourceInStock[ resourceId ]; if ( resourceId >= G_Wheat ) { if ( resourceId >= G_Olives && resourceId != G_MeatFish ) { if ( resourceId != G_Olives && resourceId != G_Vines && resourceId != G_Iron && resourceId != G_Clay && resourceId != G_Timber ) { if ( resourceId != G_Wine && resourceId != G_Oil && resourceId != G_Furniture && resourceId != G_Pottery ) { if ( resourceId != G_Marble && resourceId != G_Weapons ) result = 0; // unknown good? else result = inStock < 10; // marble/weapons } else // finished goods { if ( city_inform[ciid].population >= 2000 ) { if ( city_inform[ciid].population >= 4000 ) { if ( city_inform[ciid].population >= 6000 ) maxGoodStock = 40; else maxGoodStock = 30; } else { maxGoodStock = 20; } } else { maxGoodStock = 10; } result = inStock < maxGoodStock; } } else // raw materials { switch ( resourceId ) { case G_Olives: finishedGood = G_Oil; break; case G_Vines: finishedGood = G_Wine; break; case G_Iron: finishedGood = G_Weapons; break; case G_Clay: finishedGood = G_Pottery; break; case G_Timber: finishedGood = G_Furniture; break; } result = inStock < 2 * numWorkingIndustries[finishedGood] + 2; } } else // food { if ( city_inform[ciid].population >= 2000 ) { if ( city_inform[ciid].population >= 4000 ) { if ( city_inform[ciid].population >= 6000 ) maxFoodStock = 40; else maxFoodStock = 30; } else { maxFoodStock = 20; } } else { maxFoodStock = 10; } result = inStock < maxFoodStock; } } else // resource id invalid (<1) { result = 0; } } else // yearly trade quota reached { result = 0; } } else // we are not importing { result = 0; } } else // city doesn't sell { result = 0; } return result; } signed int fun_tradeCanBuyGoodNow(int goodId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse && tradeRoutes[i].cityType == City_Trade && tradeRoutes[i].isOpen && tradeRoutes[i].sellsFlag[goodId] == 1 ) return 1; } return 0; } signed int fun_tradeCanBuyGoodPotentially(int goodId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse && tradeRoutes[i].cityType == 2 && tradeRoutes[i].sellsFlag[goodId] == 1 ) return 1; } return 0; } signed int fun_tradeCanSellGoodNow(int goodId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse && tradeRoutes[i].cityType == 2 && tradeRoutes[i].isOpen && tradeRoutes[i].buysFlag[ goodId ] == 1 ) return 1; } return 0; } signed int cityCanProduceGoodNow(signed int goodId) { signed int i; // [sp+4Ch] [bp-4h]@20 switch ( goodId ) { case G_Wine: goodId = G_Vines; if ( fun_tradeCanBuyGoodNow(G_Vines) ) return 1; break; case G_Oil: goodId = G_Olives; if ( fun_tradeCanBuyGoodNow(G_Olives) ) return 1; break; case G_Weapons: goodId = G_Iron; if ( fun_tradeCanBuyGoodNow(G_Iron) ) return 1; break; case G_Furniture: goodId = G_Timber; if ( fun_tradeCanBuyGoodNow(G_Timber) ) return 1; break; case G_Pottery: goodId = G_Clay; if ( fun_tradeCanBuyGoodNow(G_Clay) ) return 1; break; } for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse && tradeRoutes[i].cityType == 1 && tradeRoutes[i].sellsFlag[goodId] == 1 ) return 1; } return 0; } signed int fun_cityCanProduceGood(signed int goodId) { signed int i; // [sp+4Ch] [bp-4h]@20 switch ( goodId ) // either we import the raw materials... { case G_Wine: goodId = G_Vines; if ( fun_tradeCanBuyGoodPotentially(G_Vines) ) return 1; break; case G_Oil: goodId = G_Olives; if ( fun_tradeCanBuyGoodPotentially(G_Olives) ) return 1; break; case G_Weapons: goodId = G_Iron; if ( fun_tradeCanBuyGoodPotentially(G_Iron) ) return 1; break; case G_Furniture: goodId = G_Timber; if ( fun_tradeCanBuyGoodPotentially(G_Timber) ) return 1; break; case G_Pottery: goodId = G_Clay; if ( fun_tradeCanBuyGoodPotentially(G_Clay) ) return 1; break; } for ( i = 0; i < 41; ++i ) // ... or we produce the raw materials { if ( tradeRoutes[i].inUse && tradeRoutes[i].cityType == 1 && tradeRoutes[i].sellsFlag[goodId ] == 1 ) return 1; } return 0; } void fun_readEmpireFile(int isCustomScenario) { if ( isCustomScenario ) fun_readDataFromFilename("c32.emp", empireindex_xOffset, 0x500u, 0); else fun_readDataFromFilename("c3.emp", empireindex_xOffset, 0x500u, 0); memset(empire, 0, sizeof(empire)); if ( isCustomScenario ) fun_readDataFromFilename("c32.emp", empire, 0x3200u, 12800 * scenario_map_empire + 1280); else fun_readDataFromFilename("c3.emp", empire, 0x3200u, 12800 * scenario_map_empire + 1280); fun_initEmpire(); } void fun_copyEmpireData(signed int empireMapId) { if ( empireMapId < 40 ) { if ( empireMapId >= 0 ) { memcpy(&empireindex_xOffset[16 * empireMapId], &empireindex_xOffset[16 * scenario_map_empire], 32); fun_readDataFromFilename("c32.emp", empire, 0x3200u, 12800 * empireMapId + 1280); fun_initEmpire(); fun_writeCurrentEmpireToFileCustom(); } } } int fun_writeCurrentEmpireToFileCustom() { fun_writeToFilenameAtOffset("c32.emp", empireindex_xOffset, 0x500u, 0); return fun_writeToFilenameAtOffset("c32.emp", empire, 0x3200u, 12800 * scenario_map_empire + 1280); } void unused_createEmptyEmpireStatesFile() { signed int i; // [sp+4Ch] [bp-4h]@1 DeleteFileA("c32.emp"); setting_unused_create_empire_zero = 0; scenario_map_empire = 0; fun_memset(empireindex_xOffset, 1280, 0); fun_writeToFilenameAppend("c32.emp", empireindex_xOffset, 0x500u); fun_memset(empire, 12800, 0); for ( i = 0; i < 40; ++i ) fun_writeToFilenameAppend("c32.emp", empire, 0x3200u); } void fun_fillExpandedEmpireFields() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( !empire[i].xCoord_exp && !empire[i].yCoord_exp || !empire[i].graphicID_exp ) { empire[i].xCoord_exp = empire[i].xCoord; empire[i].yCoord_exp = empire[i].yCoord; empire[i].graphicID_exp = empire[i].graphicID; } } else { empire[i].yCoord_exp = 0; empire[i].xCoord_exp = 0; } } } void fun_initializeTradeRoutes() { signed int amountId; // [sp+4Ch] [bp-10h]@27 signed int tradeIndex; // [sp+50h] [bp-Ch]@1 signed int resource; // [sp+54h] [bp-8h]@12 int i; // [sp+58h] [bp-4h]@1 memset(tradeRoutes, 0, sizeof(tradeRoutes)); tradeIndex = 1; for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].type == 1 ) { tradeRoutes[i].inUse = 1; tradeRoutes[tradeIndex].cityType = empire[i].cityType; tradeRoutes[tradeIndex].cityNameId = empire[i].cityNameId; if ( empire[i].tradeRouteId < 0 ) empire[i].tradeRouteId = 0; if ( empire[i].tradeRouteId >= 20 ) empire[i].tradeRouteId = 19; tradeRoutes[tradeIndex].routeId[0] = empire[i].tradeRouteId; tradeRoutes[tradeIndex].isOpen = empire[i].tradeRouteOpen; tradeRoutes[tradeIndex].costToOpen = empire[i].tradeCostToOpen[0]; tradeRoutes[tradeIndex].isSeaTrade = isSeaTradeRoute(tradeRoutes[tradeIndex].routeId[0]); for ( resource = 1; resource <= 15; ++resource ) { tradeRoutes[tradeIndex].sellsFlag[ resource ] = 0; tradeRoutes[tradeIndex].buysFlag[ resource ] = 0; if ( tradeRoutes[tradeIndex].cityType ) { if ( tradeRoutes[tradeIndex].cityType != City_DistantForeign ) { if ( tradeRoutes[tradeIndex].cityType != City_VulnerableRoman ) { if ( tradeRoutes[tradeIndex].cityType != City_FutureRoman ) { if ( canEmpireCitySellsGood(i, resource) ) tradeRoutes[tradeIndex].sellsFlag[ resource ] = 1; if ( canEmpireCityBuysGood(i, resource) ) tradeRoutes[tradeIndex].buysFlag[ resource ] = 1; amountId = fun_getEmpireTradeAmountId(i, resource); switch ( amountId ) { case 1: tradeRoutes[ tradeRoutes[tradeIndex].routeId[ resource ] ].quotas[0] = 15; break; case 2: tradeRoutes[ tradeRoutes[tradeIndex].routeId[ resource ] ].quotas[0] = 25; break; case 3: tradeRoutes[ tradeRoutes[tradeIndex].routeId[ resource ] ].quotas[0] = 40; break; default: tradeRoutes[ tradeRoutes[tradeIndex].routeId[ resource ] ].quotas[0] = 0; break; } tradedSoFar[ tradeRoutes[tradeIndex].routeId[ resource ] ] = 0; } } } } } tradeRoutes[tradeIndex].unknown10 = 10; tradeRoutes[tradeIndex].walkerEntryDelay = 4; tradeRoutes[tradeIndex].unknown0 = 0; tradeRoutes[tradeIndex].walkerId1 = 0; tradeRoutes[tradeIndex].walkerId2 = 0; tradeRoutes[tradeIndex].walkerId3 = 0; tradeRoutes[tradeIndex++].empireObjectId = i; } } } } void fun_determineDistantBattleCity() { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].distantBattleCity = 0; for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse ) { if ( tradeRoutes[i].cityType == City_VulnerableRoman ) city_inform[ciid].distantBattleCity = i; } } } void fun_resetTradeAmounts() { signed int j; // [sp+4Ch] [bp-8h]@8 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse ) { if ( tradeRoutes[i].isOpen ) { for ( j = 1; j <= 15; ++j ) tradedSoFar[ tradeRoutes[i].routeId[j] ] = 0; } } } } signed int fun_getTradeCityFromEmpireObject(int empireObjectId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse && tradeRoutes[i].empireObjectId == empireObjectId ) return i; } return 0; } signed int isSeaTradeRoute(int tradeRouteId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse && empire[i].tradeRouteId == tradeRouteId ) { if ( empire[i].type == Emp_SeaTradeRoute ) return 1; if ( empire[i].type == Emp_LandTradeRoute ) return 0; } } return 0; } signed int fun_isTradeRouteOpen(int tradeRouteId) { signed int result; // eax@8 signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; ; ++i ) { if ( i >= 41 ) return 0; if ( tradeRoutes[i].inUse && tradeRoutes[i].routeId[0] == tradeRouteId ) break; } if ( tradeRoutes[i].isOpen ) result = 1; else result = 0; return result; } signed int fun_getTradeRouteCityIndex(int tradeRouteId) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 41; ++i ) { if ( tradeRoutes[i].inUse && tradeRoutes[i].routeId[0] == tradeRouteId ) return i; } return 0; } //----- (00445410) -------------------------------------------------------- void fun_handleExpandEmpireEvent() { int v0; // [sp+4Ch] [bp-8h]@17 signed int i; // [sp+50h] [bp-4h]@7 if ( scn_empireExpanded_flag < 1 && scn_empireExpansion_year > 0 && gametime_year >= scn_empireExpansion_year + scn_settings_startYear ) { for ( i = 0; ; ++i ) { if ( i >= 41 ) { scn_empireExpanded_flag = 1; message_usePopup = 1; fun_postMessageToPlayer(77, 0, 0); return; } if ( tradeRoutes[i].inUse ) { if ( tradeRoutes[i].cityType == City_FutureTrade ) { tradeRoutes[i].cityType = City_Trade; } else { if ( tradeRoutes[i].cityType != City_FutureRoman ) continue; tradeRoutes[i].cityType = City_DistantRoman; } v0 = tradeRoutes[i].empireObjectId; empire[v0].cityType = tradeRoutes[i].cityType; if ( tradeRoutes[i].cityType ) { if ( tradeRoutes[i].cityType == City_Trade ) empire[v0].graphicID_exp = graphic_empireCityTrade; } else { empire[v0].graphicID_exp = graphic_empireCityDistant; } } } } } signed int fun_getEmpireTradeAmountId(int empireEntryId, __int16 goodId) { signed int result; // eax@2 __int16 goodId2; // [sp+4Ch] [bp-4h]@7 if ( empire[empireEntryId].type == 1 ) { if ( empire[empireEntryId].cityType > 1 ) { if ( empire[empireEntryId].cityType < 6 ) { goodId2 = 1 << goodId; if ( (signed __int16)(1 << goodId) & empire[empireEntryId].trade40 ) { result = 3; } else { if ( goodId2 & empire[empireEntryId].trade25 ) { result = 2; } else { if ( goodId2 & empire[empireEntryId].trade15 ) result = 1; else result = 0; } } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void fun_setEmpireTradeAmountId(int empireEntryId, __int16 goodId, int amountId) { __int16 goodMask; // [sp+50h] [bp-4h]@7 if ( empire[empireEntryId].type == 1 ) { if ( empire[empireEntryId].cityType > 1 ) { if ( empire[empireEntryId].cityType < 6 ) { goodMask = 1 << goodId; empire[empireEntryId].trade40 &= ~(1 << goodId);// clear flags empire[empireEntryId].trade25 &= ~(1 << goodId); empire[empireEntryId].trade15 &= ~(1 << goodId); if ( amountId > 0 ) { switch ( amountId ) { case 1: empire[empireEntryId].trade15 |= goodMask; break; case 2: empire[empireEntryId].trade25 |= goodMask; break; case 3: empire[empireEntryId].trade40 |= goodMask; break; } } } } } } void sub_445880() { int totalAmount; // [sp+4Ch] [bp-Ch]@8 signed int resource; // [sp+50h] [bp-8h]@8 signed int resource3; // [sp+50h] [bp-8h]@12 signed int resource2; // [sp+50h] [bp-8h]@16 int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].type == Emp_City ) { totalAmount = 0; for ( resource = 1; resource <= 15; ++resource ) totalAmount += fun_getEmpireTradeAmountId(i, resource); if ( totalAmount ) { for ( resource2 = 1; resource2 <= 15; ++resource2 ) { if ( !canEmpireCitySellsGood(i, resource2) ) { if ( !canEmpireCityBuysGood(i, resource2) ) fun_setEmpireTradeAmountId(i, resource2, 0); } } } else { for ( resource3 = 1; resource3 <= 15; ++resource3 ) fun_setEmpireTradeAmountId(i, resource3, 2); } } } } } void sub_4459F0() { fun_memset(dword_993F60, 4800, 0); dword_990CD8 = 0; } void sub_445A30(int a1) { byte_7FA3AD[128 * a1] = dword_990CD8; fun_memset(&dword_993F60[12 * dword_990CD8++], 48, 0); if ( dword_990CD8 >= 100 ) dword_990CD8 = 0; } void sub_445AB0(int a1, int a2) { int v2; // ST4C_4@1 v2 = byte_7FA3AD[128 * a1]; ++dword_993F64[12 * v2]; ++*(&byte_993F78[48 * v2] + a2); dword_993F8C[12 * v2] += tradeprices_sell[2 * a2]; } void sub_445B60(int a1, int a2) { int v2; // ST4C_4@1 v2 = byte_7FA3AD[128 * a1]; ++dword_993F60[12 * v2]; ++*(&byte_993F68[48 * v2] + a2); dword_993F88[12 * v2] += tradeprices_buy[2 * a2]; } void fun_generateTraders() { int tradeShipId; // eax@94 int caravanHead; // eax@97 __int16 num1; // ST64_2@97 int caravanDonkey1; // eax@97 __int16 num2; // ST64_2@97 int caravanDonkey2; // eax@97 signed int walkerIndexToUse; // [sp+4Ch] [bp-1Ch]@65 signed int maxTradersOnMap; // [sp+58h] [bp-10h]@40 signed int numGoods; // [sp+5Ch] [bp-Ch]@40 signed int k; // [sp+60h] [bp-8h]@40 signed int i; // [sp+64h] [bp-4h]@4 signed int j; // [sp+64h] [bp-4h]@22 city_inform[ciid].numOpenSeaTradeRoutes = 0; city_inform[ciid].numOpenLandTradeRoutes = 0; city_inform[ciid].numWineTypesAvailable[0] = numWineWorkshops > 0; for ( i = 1; i < 41; ++i ) { if ( tradeRoutes[i].inUse ) { if ( tradeRoutes[i].isOpen ) { if ( city_inform[ciid].resourceTradeStatus_wine == 1 ) { if ( tradeRoutes[i].sellsFlag_wine ) ++city_inform[ciid].numWineTypesAvailable[0]; } } } } if ( city_inform[ciid].seaTradeProblemDuration <= 0 ) city_inform[ciid].seaTradeProblemDuration = 0; else --city_inform[ciid].seaTradeProblemDuration; if ( city_inform[ciid].landTradeProblemDuration <= 0 ) city_inform[ciid].landTradeProblemDuration = 0; else --city_inform[ciid].landTradeProblemDuration; for ( j = 1; j < 41; ++j ) { if ( !tradeRoutes[j].inUse || !tradeRoutes[j].isOpen ) continue; if ( tradeRoutes[j].isSeaTrade != 1 ) { ++city_inform[ciid].numOpenLandTradeRoutes; goto LABEL_40; } if ( city_inform[ciid].numWorkingDocks <= 0 ) { if ( messageNoWorkingDockDelay > 0 ) { --messageNoWorkingDockDelay; } else { message_usePopup = 1; fun_postMessageToPlayer(117, 0, 0); messageNoWorkingDockDelay = 384; } continue; } if ( scn_riverEntry_x != -1 || scn_riverEntry_y != -1 ) { ++city_inform[ciid].numOpenSeaTradeRoutes; LABEL_40: maxTradersOnMap = 0; numGoods = 0; for ( k = 1; k <= 15; ++k ) { if ( tradeRoutes[j].buysFlag[ k ] || tradeRoutes[j].sellsFlag[k] ) { ++numGoods; switch ( tradeRoutes[ tradeRoutes[j].routeId[k] ].quotas[0] ) { case 0xF: ++maxTradersOnMap; break; case 0x19: maxTradersOnMap += 2; break; case 0x28: maxTradersOnMap += 3; break; } } } if ( numGoods > 1 ) { if ( maxTradersOnMap % numGoods ) maxTradersOnMap = maxTradersOnMap / numGoods + 1; else maxTradersOnMap /= numGoods; } if ( maxTradersOnMap > 0 && !tradeRoutes[j].unknown0 ) { if ( maxTradersOnMap == 1 ) { if ( tradeRoutes[j].walkerId1 ) continue; walkerIndexToUse = 0; } else { if ( maxTradersOnMap == 2 ) { if ( tradeRoutes[j].walkerId1 ) { if ( tradeRoutes[j].walkerId2 ) continue; walkerIndexToUse = 1; } else { walkerIndexToUse = 0; } } else { if ( tradeRoutes[j].walkerId1 ) { if ( tradeRoutes[j].walkerId2 ) { if ( tradeRoutes[j].walkerId3 ) continue; walkerIndexToUse = 2; } else { walkerIndexToUse = 1; } } else { walkerIndexToUse = 0; } } } if ( tradeRoutes[j].walkerEntryDelay <= 0 ) { if ( tradeRoutes[j].isSeaTrade == 1 ) tradeRoutes[j].walkerEntryDelay = 30; else tradeRoutes[j].walkerEntryDelay = 4; if ( tradeRoutes[j].isSeaTrade == 1 ) { if ( city_inform[ciid].numWorkingDocks > 0 && (scn_riverEntry_x != -1 || scn_riverEntry_y != -1) && !city_inform[ciid].seaTradeProblemDuration ) { tradeShipId = spawnWalker(ciid, Walker_TradeShip, scn_riverEntry_x, scn_riverEntry_y, 0); *(__int16 *)((char *)&tradeRoutes[j].walkerId1 + 2 * walkerIndexToUse) = tradeShipId; walkers[tradeShipId].tradeCityId = j; tradeShipId <<= 7; walkers[tradeShipId].actionState = 110; walkers[tradeShipId].word_7FA366 = 10; return; } } else { if ( !city_inform[ciid].landTradeProblemDuration ) { caravanHead = spawnWalker( ciid, Walker_TradeCaravan, city_inform[ciid].entry_x, city_inform[ciid].entry_y, 0); *(__int16 *)((char *)&tradeRoutes[j].walkerId1 + 2 * walkerIndexToUse) = caravanHead; walkers[caravanHead].tradeCityId = j; walkers[caravanHead].actionState = 100; walkers[caravanHead].word_7FA366 = 10; num1 = caravanHead; caravanDonkey1 = spawnWalker( ciid, Walker_TradeCaravanDonkey, city_inform[ciid].entry_x, city_inform[ciid].entry_y, 0); walkers[caravanDonkey1].actionState = 100; walkers[caravanDonkey1].tradeCaravanNextId = num1; num2 = caravanDonkey1; caravanDonkey2 = spawnWalker( ciid, Walker_TradeCaravanDonkey, city_inform[ciid].entry_x, city_inform[ciid].entry_y, 0); walkers[caravanDonkey2].actionState = 100; walkers[caravanDonkey2].tradeCaravanNextId= num2; return; } } } else { --tradeRoutes[j].walkerEntryDelay; } } continue; } } } signed int sub_446550(int a1, int a2, int a3, int a4, int a5) { int v6; // [sp+4Ch] [bp-28h]@30 signed int v8; // [sp+54h] [bp-20h]@1 signed int v9; // [sp+58h] [bp-1Ch]@1 signed int v10; // [sp+5Ch] [bp-18h]@38 int v11; // [sp+5Ch] [bp-18h]@68 int v12; // [sp+60h] [bp-14h]@30 signed int m; // [sp+64h] [bp-10h]@48 signed int k; // [sp+68h] [bp-Ch]@30 signed int l; // [sp+68h] [bp-Ch]@38 signed int v18; // [sp+6Ch] [bp-8h]@38 signed int j; // [sp+70h] [bp-4h]@21 v9 = 10000; v8 = 0; for ( int i = 1; i < 16; ++i ) { dword_993F20[i] = fun_canExportGoodToCity(ciid, a4, i) != 0; if ( walkers[a1].byte_7FA39F >= 8 ) dword_993F20[i] = 0; if ( a4 ) goodCanImportFromCity[i] = canImportGoodFromCity(ciid, a4, i) != 0; else goodCanImportFromCity[i] = 0; if ( walkers[a1].byte_7FA3A3 >= 8 ) goodCanImportFromCity[i] = 0; } int indexGood = 1; int importGoodsCount = 0; while( indexGood < 16 ) { if ( goodCanImportFromCity[indexGood] == 1 ) ++importGoodsCount; ++indexGood; } for ( j = 1; j < MAX_BUILDINGS; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Warehouse ) { if ( buildings[j].hasRoadAccess ) { if ( buildings[j].haveRomeroad > 0 ) { v6 = buildings[j].storageId; v12 = 0; for ( k = 1; k <= 15; ++k ) { if ( storages[v6].resourceState[k] != 1 ) { if ( canImportGoodFromCity(ciid, a4, k) ) ++v12; } } v10 = 32; v18 = j; for ( l = 0; l < 8; ++l ) { v18 = buildings[v18].warehouse_nextStorage; if ( v18 ) { if ( dword_993F20[buildings[v18].level_resourceId] ) v10 -= 4; } if ( importGoodsCount ) { if ( v12 ) { if ( !storages[v6].emptyAll ) { for ( m = 1; ; ++m ) { if ( m <= 15 ) { ++city_inform[ciid].dword_654220; if ( city_inform[ciid].dword_654220 > 15 ) city_inform[ciid].dword_654220 = 1; if ( storages[v6].resourceState[city_inform[ciid].dword_654220] == 1 ) continue; } break; } if ( storages[v6].resourceState[city_inform[ciid].dword_654220] != 1 ) { if ( !buildings[v18].level_resourceId ) v10 -= 16; if ( v18 ) { if ( goodCanImportFromCity[buildings[v18].level_resourceId] ) { if ( buildings[v18].industry_unitsStored < 4 ) { if ( buildings[v18].level_resourceId == city_inform[ciid].dword_654220 ) v10 -= 8; } } } } } } } } if ( v10 < 32 ) { v11 = sub_45C3E0( buildings[j].x, buildings[j].y, a2, a3, a5, buildings[j].haveRomeroad) + v10; if ( v11 < v9 ) { v9 = v11; v8 = j; } } } } } } } if ( buildings[v8].hasRoadAccess == 1 ) { walkerGridX = buildings[v8].x; walkerGridY = buildings[v8].y; } else { if ( !determineAccessRoad(buildings[v8].x,buildings[v8].y, 3) ) return 0; } return v8; } signed int sub_446B50(int a1, int a2, int tradeCtId, int a4, int a5) { int v6; // [sp+4Ch] [bp-1Ch]@29 signed int v7; // [sp+50h] [bp-18h]@1 signed int v8; // [sp+54h] [bp-14h]@1 signed int v9; // [sp+58h] [bp-10h]@33 int v10; // [sp+58h] [bp-10h]@45 signed int i; // [sp+5Ch] [bp-Ch]@3 signed int j; // [sp+5Ch] [bp-Ch]@9 signed int l; // [sp+5Ch] [bp-Ch]@33 signed int v14; // [sp+60h] [bp-8h]@33 signed int k; // [sp+64h] [bp-4h]@18 v8 = 10000; v7 = 0; ++city_inform[ciid].dword_6543B8; if ( city_inform[ciid].dword_6543B8 > 15 ) city_inform[ciid].dword_6543B8 = 1; for ( i = 1; i < 16; ++i ) goodCanImportFromCity[i] = canImportGoodFromCity(ciid, tradeCtId, i) != 0; for ( j = 1; j < 16 && !goodCanImportFromCity[city_inform[ciid].dword_6543B8]; ++j ) { ++city_inform[ciid].dword_6543B8; if ( city_inform[ciid].dword_6543B8 > 15 ) city_inform[ciid].dword_6543B8 = 1; } if ( !goodCanImportFromCity[city_inform[ciid].dword_6543B8] ) return 0; for ( k = 1; k < MAX_BUILDINGS; ++k ) { if ( buildings[k].inUse == 1 ) { if ( buildings[k].type == B_Warehouse ) { if ( buildings[k].hasRoadAccess ) { if ( buildings[k].haveRomeroad > 0 ) { if ( buildings[k].haveRoadnet == a5 ) { v6 = buildings[k].storageId; if ( storages[v6].resourceState[ city_inform[ciid].dword_6543B8 ] != 1 ) { if ( !storages[v6].emptyAll ) { v9 = 32; v14 = k; for ( l = 0; l < 8; ++l ) { v14 = buildings[v14].warehouse_nextStorage; if ( !buildings[v14].level_resourceId ) v9 -= 8; if ( v14 ) { if ( buildings[v14].level_resourceId == city_inform[ciid].dword_6543B8 ) { if ( buildings[v14].industry_unitsStored < 4 ) v9 -= 4; } } } if ( v9 < 32 ) { v10 = sub_45C3E0( buildings[k].x, buildings[k].y, a1, a2, a4, buildings[k].haveRomeroad) + v9; if ( v10 < v8 ) { v8 = v10; v7 = k; } } } } } } } } } } if ( buildings[v7].hasRoadAccess == 1 ) { walkerGridX = buildings[v7].x; walkerGridY = buildings[v7].y; } else { if ( !determineAccessRoad(buildings[v7].x, buildings[v7].y, 3) ) return 0; } return v7; } signed int fun_importOneGoodFromCity(int buildingId, int resourceId, int cityId) { signed int result; // eax@2 int mainBuildingId; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@3 signed int j; // [sp+50h] [bp-4h]@15 int buildingId2; // [sp+5Ch] [bp+8h]@15 mainBuildingId = buildingId; if ( buildings[buildingId].type == B_Warehouse ) { for ( i = 0; i < 8; ++i ) { buildingId = buildings[buildingId].warehouse_nextStorage; if ( buildingId > 0 && buildings[buildingId].industry_unitsStored && buildings[buildingId].industry_unitsStored < 4 && buildings[buildingId].level_resourceId == resourceId ) { ++tradedSoFar[ tradeRoutes[cityId].routeId[ resourceId ] ]; fun_importGoodAndAddToWarehouse(ciid, buildingId, resourceId); return 1; } } buildingId2 = mainBuildingId; for ( j = 0; j < 8; ++j ) { buildingId2 = buildings[buildingId2].warehouse_nextStorage; if ( buildingId2 > 0 && !buildings[buildingId2].industry_unitsStored ) { ++tradedSoFar[ tradeRoutes[cityId].routeId[ resourceId ] ]; fun_importGoodAndAddToWarehouse(ciid, buildingId2, resourceId); return 1; } } result = 0; } else { result = 0; } return result; } signed int sub_447210(int a1, int a2, int a3, int a4, int a5) { signed int v6; // [sp+4Ch] [bp-18h]@3 signed int v7; // [sp+50h] [bp-14h]@3 signed int v8; // [sp+54h] [bp-10h]@29 int v9; // [sp+54h] [bp-10h]@39 int i; // [sp+58h] [bp-Ch]@3 signed int j; // [sp+58h] [bp-Ch]@9 signed int l; // [sp+58h] [bp-Ch]@29 signed int nextStorageBbldId; // [sp+5Ch] [bp-8h]@29 signed int k; // [sp+60h] [bp-4h]@18 ++city_inform[ciid].dword_6543BC; if ( city_inform[ciid].dword_6543BC > 15 ) city_inform[ciid].dword_6543BC = 1; v7 = 10000; v6 = 0; for ( i = 1; i < 16; ++i ) dword_993F20[i] = fun_canExportGoodToCity(ciid, a3, i) != 0; for ( j = 1; j < 16 && !dword_993F20[city_inform[ciid].dword_6543BC]; ++j ) { ++city_inform[ciid].dword_6543BC; if ( city_inform[ciid].dword_6543BC > 15 ) city_inform[ciid].dword_6543BC = 1; } if ( !dword_993F20[city_inform[ciid].dword_6543BC] ) return 0; for ( k = 1; k < MAX_BUILDINGS; ++k ) { if ( buildings[k].inUse == 1 ) { if ( buildings[k].type == 72 ) { if ( buildings[k].hasRoadAccess ) { if ( buildings[k].haveRomeroad > 0 ) { if ( buildings[k].haveRoadnet == a5 ) { v8 = 32; nextStorageBbldId = k; for ( l = 0; l < 8; ++l ) { nextStorageBbldId = buildings[nextStorageBbldId].warehouse_nextStorage; if ( nextStorageBbldId ) { if ( buildings[nextStorageBbldId].level_resourceId == city_inform[ciid].dword_6543BC ) { if ( buildings[nextStorageBbldId].industry_unitsStored > 0 ) --v8; } } } if ( v8 < 32 ) { v9 = sub_45C3E0( buildings[k].x, buildings[k].y, a1, a2, a4, buildings[k].haveRomeroad) + v8; if ( v9 < v7 ) { v7 = v9; v6 = k; } } } } } } } } if ( buildings[v6].hasRoadAccess == 1 ) { walkerGridX = buildings[v6].x; walkerGridY = buildings[v6].y; } else { if ( !determineAccessRoad(buildings[v6].x, buildings[v6].y, 3) ) return 0; } return v6; } int fun_exportOneGoodToCity(int buildingId, int resourceId, int cityId) { signed int result; // eax@2 int v4; // [sp+4Ch] [bp-Ch]@17 int v5; // [sp+50h] [bp-8h]@16 signed int i; // [sp+54h] [bp-4h]@3 if ( buildings[buildingId].type == B_Warehouse ) { for ( i = 0; ; ++i ) { if ( i >= 8 ) return 0; buildingId = buildings[buildingId].warehouse_nextStorage; if ( buildingId > 0 ) { if ( buildings[buildingId].industry_unitsStored > 0 && buildings[buildingId].level_resourceId == resourceId ) break; } } ++city_inform[ciid].resourceAmountExported[ resourceId ]; --city_inform[ciid].resourceInStock[resourceId]; --buildings[buildingId].industry_unitsStored; if ( buildings[buildingId].industry_unitsStored <= 0 ) buildings[buildingId].level_resourceId = 0; city_inform[ciid].treasury += tradeprices_sell[2 * resourceId]; city_inform[ciid].finance_exports_thisyear += tradeprices_sell[2 * resourceId]; ++tradedSoFar[ tradeRoutes[cityId].routeId[ resourceId ] ]; if ( city_inform[ciid].dword_6544F0 ) { city_inform[ciid].treasury += tradeprices_sell[2 * resourceId]; city_inform[ciid].finance_exports_thisyear += tradeprices_sell[2 * resourceId]; } v5 = buildings[buildingId].gridOffset; if ( buildings[buildingId].industry_unitsStored <= 0 ) v4 = graphic_emptyWarehouseTile & 0xffff0000; else v4 = fun_getResourceGraphicIdOffset(resourceId, 0) + word_6E6C58 + 4 * resourceId - 4 + buildings[buildingId].industry_unitsStored - 1; grid_graphicIds[v5] = v4; result = 1; } else { result = 0; } return result; } void sub_4479A0() { int numEnemies; // [sp+4Ch] [bp-8h]@38 signed int invasionId; // [sp+50h] [bp-4h]@44 if ( city_inform[ciid].treasury < 0 ) { if ( city_inform[ciid].debtState ) { switch ( city_inform[ciid].debtState ) { case 1: city_inform[ciid].debtState = 2; city_inform[ciid].monthsInDebt = 0; message_usePopup = 1; fun_postMessageToPlayer(17, 0, 0); fun_increaseFavorRating(-5); break; case 2: if ( city_inform[ciid].monthsInDebt == -1 ) { message_usePopup = 1; fun_postMessageToPlayer(17, 0, 0); city_inform[ciid].monthsInDebt = 0; } if ( !game_weeks ) ++city_inform[ciid].monthsInDebt; if ( city_inform[ciid].monthsInDebt >= 12 ) { city_inform[ciid].debtState = 3; city_inform[ciid].monthsInDebt = 0; if ( !city_inform[ciid].enemyDestroyedBuildings ) { message_usePopup = 1; fun_postMessageToPlayer(18, 0, 0); fun_increaseFavorRating(-10); } } break; case 3: if ( city_inform[ciid].monthsInDebt == -1 ) { message_usePopup = 1; fun_postMessageToPlayer(18, 0, 0); city_inform[ciid].monthsInDebt = 0; } if ( !game_weeks ) ++city_inform[ciid].monthsInDebt; if ( city_inform[ciid].monthsInDebt >= 12 ) { city_inform[ciid].debtState = 4; city_inform[ciid].monthsInDebt = 0; if ( !city_inform[ciid].enemyDestroyedBuildings ) fun_setFavorRatingMax(10); } break; } } else { city_inform[ciid].treasury += fun_adjustWithPercentage( scn_rescueLoan, difficulty_moneypct[setting_difficulty]); city_inform[ciid].finance_donated_thisyear += fun_adjustWithPercentage( scn_rescueLoan, difficulty_moneypct[setting_difficulty]); fun_calculateFinanceTotals(); fun_calculateTributeThisYear(); city_inform[ciid].debtState = 1; city_inform[ciid].monthsInDebt = 0; message_usePopup = 1; fun_postMessageToPlayer(16, 0, 0); fun_reduceProsperityRatingBecauseOfBailout(); } } else { city_inform[ciid].monthsInDebt = -1; } if ( city_inform[ciid].enemyDestroyedBuildings ) { --city_inform[ciid].dword_654568; if ( city_inform[ciid].favorRating < 35 || city_inform[ciid].dword_654568 >= 176 ) { if ( city_inform[ciid].favorRating >= 22 ) { if ( city_inform[ciid].dword_654568 <= 0 ) { if ( !city_inform[ciid].dword_654568 ) { message_usePopup = 1; fun_postMessageToPlayer(20, 0, 0); } } else { sub_4482C0(); } } } else { sub_448340(); } } else { if ( city_inform[ciid].dword_6545B4 && city_inform[ciid].dword_6545B4 >= city_inform[ciid].dword_6545B0 ) { city_inform[ciid].dword_6545B0 = 0; city_inform[ciid].dword_6545B4 = 0; if ( city_inform[ciid].favorRating < 35 ) { fun_increaseFavorRating(10); message_usePopup = 1; if ( city_inform[ciid].numInvasionsFromCaesar < 3 ) { if ( city_inform[ciid].numInvasionsFromCaesar < 2 ) fun_postMessageToPlayer(106, 0, 0); else fun_postMessageToPlayer(107, 0, 0); } else { fun_postMessageToPlayer(108, 0, 0); } } } else { if ( city_inform[ciid].dword_654570 <= 0 ) { if ( city_inform[ciid].favorRating <= 10 ) { ++city_inform[ciid].dword_65456C; city_inform[ciid].dword_654570 = 192; message_usePopup = 1; if ( city_inform[ciid].dword_65456C <= 1 ) fun_postMessageToPlayer(19, 0, 0); } } else { --city_inform[ciid].dword_654570; if ( !city_inform[ciid].dword_654570 ) { if ( city_inform[ciid].numInvasionsFromCaesar ) { if ( city_inform[ciid].numInvasionsFromCaesar == 1 ) { numEnemies = 64; } else { if ( city_inform[ciid].numInvasionsFromCaesar == 2 ) numEnemies = 96; else numEnemies = 144; } } else { numEnemies = 32; } invasionId = fun_startInvasion(11, numEnemies, 0, 2, 24); if ( invasionId > 0 ) { ++city_inform[ciid].numInvasionsFromCaesar; city_inform[ciid].dword_654568 = 192; city_inform[ciid].dword_654574 = 0; message_usePopup = 1; fun_postMessageToPlayer(24, lastInvasionInternalId, invasionId); city_inform[ciid].dword_6545B0 = numEnemies; city_inform[ciid].dword_6545B4 = 0; } } } } } } void sub_4482C0() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].walkerType == 57 ) formations[i].formation_46 = 20; } } } void sub_448340() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].walkerType == Walker_Enemy57 ) formations[i].formation_5e = 1; } } if ( !city_inform[ciid].dword_654574 ) { city_inform[ciid].dword_654574 = 1; message_usePopup = 1; fun_postMessageToPlayer(21, 0, 0); } } void fun_handleDistantBattleEvent() { signed int i; // [sp+54h] [bp-4h]@3 if ( mode_editor != 1 ) { for ( i = 0; i < 20; ++i ) { if ( scn_invasions_type[i] == 4 && gametime_year == scn_invasions_year[i] + scn_settings_startYear && gametime_month == scn_invasions_month[i] && scn_distantBattle_enemyTravelTime > 4 && scn_distantBattle_romanTravelTime > 4 && city_inform[ciid].byte_654583 <= 0 && city_inform[ciid].byte_654584 <= 0 && city_inform[ciid].byte_654585 <= 0 && city_inform[ciid].byte_654586 <= 0 ) { message_usePopup = 1; fun_postMessageToPlayer(30, 0, 0); city_inform[ciid].byte_65458A = 1; city_inform[ciid].byte_65458B = 1; city_inform[ciid].byte_654583 = 24; city_inform[ciid].byte_654581 = scn_invasions_amount[2 * i]; ++city_inform[ciid].byte_654588; city_inform[ciid].byte_654584 = 0; city_inform[ciid].byte_654585 = 0; return; } } if ( city_inform[ciid].byte_654583 <= 0 ) { if ( city_inform[ciid].byte_654584 <= 0 ) { if ( city_inform[ciid].byte_654586 > 0 ) { --city_inform[ciid].byte_654586; if ( city_inform[ciid].byte_654586 <= 0 ) { message_usePopup = 1; fun_postMessageToPlayer(90, 0, 0); fun_setDistantBattleCityAsVulnerable(); } } } else { --city_inform[ciid].byte_654584; city_inform[ciid].byte_65458B = city_inform[ciid].byte_654584; if ( city_inform[ciid].byte_654584 <= 0 ) { message_usePopup = 1; if ( city_inform[ciid].byte_654586 ) fun_postMessageToPlayer(88, 0, city_inform[ciid].exit_gridOffset); else fun_postMessageToPlayer(89, 0, city_inform[ciid].exit_gridOffset); city_inform[ciid].byte_65458B = 0; sub_4BD8D0(); } } } else { --city_inform[ciid].byte_654583; if ( city_inform[ciid].byte_654583 > 0 ) { if ( city_inform[ciid].byte_654583 < scn_distantBattle_enemyTravelTime ) city_inform[ciid].byte_65458A = scn_distantBattle_enemyTravelTime - city_inform[ciid].byte_654583 + 1; else city_inform[ciid].byte_65458A = 1; if ( city_inform[ciid].byte_654585 >= 1 ) { if ( scn_distantBattle_romanTravelTime - city_inform[ciid].byte_65458B <= scn_distantBattle_enemyTravelTime - city_inform[ciid].byte_65458A ) --city_inform[ciid].byte_654585; else city_inform[ciid].byte_654585 -= 2; if ( city_inform[ciid].byte_654585 <= 1 ) city_inform[ciid].byte_654585 = 1; city_inform[ciid].byte_65458B = scn_distantBattle_romanTravelTime + 1 - city_inform[ciid].byte_654585; if ( city_inform[ciid].byte_65458B < 1 ) city_inform[ciid].byte_65458B = 1; if ( city_inform[ciid].byte_65458B >= scn_distantBattle_romanTravelTime ) city_inform[ciid].byte_65458B = scn_distantBattle_romanTravelTime; } } else { message_usePopup = 1; if ( city_inform[ciid].byte_654585 > 0 ) { if ( city_inform[ciid].byte_654585 <= 2 ) { if ( sub_448D50() ) { fun_postMessageToPlayer(87, 0, 0); fun_increaseFavorRating(25); ++city_inform[ciid].availableTriumphalArches; fun_enableBuildingMenuItems(); ++city_inform[ciid].byte_654589; city_inform[ciid].byte_654586 = 0; city_inform[ciid].byte_654584 = city_inform[ciid].byte_65458B; } else { fun_postMessageToPlayer(86, 0, 0); fun_increaseFavorRating(-10); fun_setDistantBattleCityAsForeign(); city_inform[ciid].byte_654586 = 24; city_inform[ciid].byte_65458B = 0; } } else { fun_postMessageToPlayer(85, 0, 0); fun_increaseFavorRating(-25); fun_setDistantBattleCityAsForeign(); city_inform[ciid].byte_654584 = city_inform[ciid].byte_65458B; city_inform[ciid].byte_654586 = 24; } } else { fun_postMessageToPlayer(84, 0, 0); fun_increaseFavorRating(-50); fun_setDistantBattleCityAsForeign(); city_inform[ciid].byte_654586 = 24; } city_inform[ciid].byte_654583 = 0; city_inform[ciid].byte_65458A = 0; city_inform[ciid].byte_654585 = 0; } } } } signed int sub_448D50() { signed int v1; // [sp+4Ch] [bp-Ch]@2 int v2; // [sp+50h] [bp-8h]@3 int v3; // [sp+54h] [bp-4h]@2 if ( city_inform[ciid].byte_654582 < city_inform[ciid].byte_654581 ) { v1 = 0; v2 = 100; } else { v1 = 1; v3 = getPercentage( city_inform[ciid].byte_654582 - city_inform[ciid].byte_654581, city_inform[ciid].byte_654582); if ( v3 >= 10 ) { if ( v3 >= 25 ) { if ( v3 >= 50 ) { if ( v3 >= 75 ) { if ( v3 >= 100 ) { if ( v3 >= 150 ) v2 = 0; else v2 = 5; } else { v2 = 10; } } else { v2 = 15; } } else { v2 = 25; } } else { v2 = 50; } } else { v2 = 70; } } sub_4BDA20(v2); return v1; } void fun_calculateDistantBattleRomanTravelTime(int isGame) { signed int i; // [sp+4Ch] [bp-4h]@4 if ( isGame ) scn_distantBattle_romanTravelTime = 0; else map_distantBattle_romanTravelTime = 0; for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].type == 6 ) { if ( isGame ) { ++scn_distantBattle_romanTravelTime; empire[i].distBattleTravelMonths = scn_distantBattle_romanTravelTime; } else { ++map_distantBattle_romanTravelTime; empire[i].distBattleTravelMonths = map_distantBattle_romanTravelTime; } } } } } void fun_calculateDistantBattleEnemyTravelTime(int isGame) { signed int i; // [sp+4Ch] [bp-4h]@4 if ( isGame ) scn_distantBattle_enemyTravelTime = 0; else map_distantBattle_enemyTravelTime = 0; for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].type == 7 ) { if ( isGame ) { ++scn_distantBattle_enemyTravelTime; empire[i].distBattleTravelMonths = scn_distantBattle_enemyTravelTime; } else { ++map_distantBattle_enemyTravelTime; empire[i].distBattleTravelMonths = map_distantBattle_enemyTravelTime; } } } } } void fun_setDistantBattleCity() { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].distantBattleCity = 0; for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse && empire[i].type == Emp_City && empire[i].cityType == City_VulnerableRoman ) { city_inform[ciid].distantBattleCity = i; return; } } } void fun_setDistantBattleCityAsVulnerable() { if ( city_inform[ciid].distantBattleCity ) tradeRoutes[ city_inform[ciid].distantBattleCity ].cityType = City_VulnerableRoman; } void fun_setDistantBattleCityAsForeign() { if ( city_inform[ciid].distantBattleCity ) tradeRoutes[ city_inform[ciid].distantBattleCity ].cityType = City_DistantForeign; } void fun_setInvasionMonthsAndPaths() { signed int v0; // [sp+4Ch] [bp-10h]@15 signed int j; // [sp+50h] [bp-Ch]@24 signed int v2; // [sp+54h] [bp-8h]@15 signed int i; // [sp+58h] [bp-4h]@3 int v4; // [sp+58h] [bp-4h]@26 fun_memset(byte_98EF40, 3232, 0); dword_990604 = 1; dword_990CDC = 0; if ( mode_editor != 1 ) { for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse ) { if ( empire[i].type == 3 ) { if ( empire[i].invasionPathId > dword_990CDC ) dword_990CDC = empire[i].invasionPathId; } } } if ( dword_990CDC > 0 ) { v2 = 0; v0 = 1; while ( v2 < 20 ) { fun_generateRandomness(); if ( scn_invasions_type[v2] ) { scn_invasions_month[v2] = (random_7f_1 & 7) + 2; if ( scn_invasions_type[v2] != 1 ) { if ( scn_invasions_type[v2] != 4 ) { for ( j = 1; j < 8; ++j ) { v4 = sub_449570(j); if ( v4 ) { byte_98EF40[32 * v0] = 1; byte_98EF42[32 * v0] = empire[v4].invasionPathId; byte_98EF43[32 * v0] = empire[v4].invasionYears; word_98EF44[16 * v0] = empire[v4].xCoord; word_98EF46[16 * v0] = empire[v4].yCoord; word_98EF48[16 * v0] = empire[v4].graphicID; byte_98EF54[32 * v0] = v2; word_98EF4A[16 * v0] = v4; word_98EF4C[16 * v0] = 0; word_98EF4E[16 * v0] = 0; dword_98EF50[8 * v0] = 12 * scn_invasions_year[v2]; dword_98EF50[8 * v0] += scn_invasions_month[v2]; dword_98EF50[8 * v0++] -= 12 * j; } } ++dword_990604; if ( dword_990604 > dword_990CDC ) dword_990604 = 1; } } } ++v2; } } } } signed int sub_449570(int a1) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { if ( empire[i].inUse && empire[i].type == 3 && empire[i].invasionPathId == dword_990604 && empire[i].invasionYears == a1 ) return i; } return 0; } void fun_handleInvasionEvent() { signed int v0; // [sp+4Ch] [bp-Ch]@22 signed int v1; // [sp+4Ch] [bp-Ch]@27 signed int v2; // [sp+4Ch] [bp-Ch]@39 signed int j; // [sp+50h] [bp-8h]@30 signed int i; // [sp+54h] [bp-4h]@3 if ( mode_editor != 1 ) { for ( i = 0; i < 101; ++i ) { if ( byte_98EF40[32 * i] ) { --dword_98EF50[8 * i]; if ( dword_98EF50[8 * i] <= 0 ) { if ( byte_98EF41[32 * i] != 1 ) { byte_98EF41[32 * i] = 1; word_98EF4E[16 * i] = gametime_year; word_98EF4C[16 * i] = gametime_month; if ( byte_98EF43[32 * i] > 1 ) { if ( byte_98EF43[32 * i] > 2 ) fun_postMessageToPlayer(25, 0, 0); else fun_postMessageToPlayer(26, 0, 0); } else { fun_postMessageToPlayer(27, 0, 0); } } } if ( gametime_year >= scn_invasions_year[byte_98EF54[32 * i]] + scn_settings_startYear ) { if ( gametime_month >= scn_invasions_month[byte_98EF54[32 * i]] ) { byte_98EF40[32 * i] = 0; if ( byte_98EF43[32 * i] <= 1 ) { if ( scn_invasions_type[byte_98EF54[32 * i]] == 2 ) { v0 = fun_startInvasion( dword_5F60A4[scn_enemy], *(_WORD *)&scn_invasions_amount[2 * byte_98EF54[32 * i]], scn_invasions_point[byte_98EF54[32 * i]], scn_invasions_attack[byte_98EF54[32 * i]], byte_98EF54[32 * i]); if ( v0 ) { message_usePopup = 1; if ( dword_5F60A4[scn_enemy] > 4 ) fun_postMessageToPlayer(114, lastInvasionInternalId, v0); else fun_postMessageToPlayer(23, lastInvasionInternalId, v0); } } if ( scn_invasions_type[byte_98EF54[32 * i]] == 3 ) { v1 = fun_startInvasion( 11, *(_WORD *)&scn_invasions_amount[2 * byte_98EF54[32 * i]], scn_invasions_point[byte_98EF54[32 * i]], scn_invasions_attack[byte_98EF54[32 * i]], byte_98EF54[32 * i]); if ( v1 ) { message_usePopup = 1; fun_postMessageToPlayer(24, lastInvasionInternalId, v1); } } } } } } } for ( j = 0; j < 20; ++j ) { if ( scn_invasions_type[j] == 1 ) { if ( gametime_year == scn_invasions_year[j] + scn_settings_startYear ) { if ( gametime_month == scn_invasions_month[j] ) { v2 = fun_startInvasion( 0, *(_WORD *)&scn_invasions_amount[2 * j], scn_invasions_point[j], scn_invasions_attack[j], j); if ( v2 ) { message_usePopup = 1; fun_postMessageToPlayer(22, lastInvasionInternalId, v2); } } } } } } } signed int fun_startLocalUprisingFromMars() { signed int result; // eax@2 int numEnemies; // [sp+4Ch] [bp-8h]@5 signed int v2; // [sp+50h] [bp-4h]@7 if ( savedgame_missionId >= 0 ) { if ( savedgame_missionId <= 19 ) { numEnemies = localUprisingFromMars_numEnemies[savedgame_missionId]; if ( numEnemies > 0 ) { v2 = fun_startInvasion(Enemy_Barbarian, numEnemies, 8, 0, 23); if ( v2 ) { message_usePopup = 1; fun_postMessageToPlayer(121, lastInvasionInternalId, v2); } result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void fun_startInvasionFromCheat() { signed int v0; // [sp+50h] [bp-4h]@1 v0 = fun_startInvasion(dword_5F60A4[scn_enemy], 150, 8, 0, 23); if ( v0 ) { message_usePopup = 1; if ( dword_5F60A4[scn_enemy] > 4 ) fun_postMessageToPlayer(114, lastInvasionInternalId, v0); else fun_postMessageToPlayer(23, lastInvasionInternalId, v0); } } signed int sub_449C60() { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-4h]@3 if ( mode_editor == 1 ) { result = 0; } else { for ( i = 0; i < 101; ++i ) { if ( byte_98EF40[32 * i] && byte_98EF41[32 * i] ) return 1; } result = 0; } return result; } signed int fun_startInvasion(int enemyType, int numEnemies, int invasionPoint, __int16 attack, char invasionId) { int v6; // ST98_4@7 int v7; // ST94_4@7 int v8; // ST90_4@7 __int16 terrain; // ax@71 __int16 terrain2; // dx@72 int walkerId; // ST84_4@89 int v12; // [sp+4Ch] [bp-88h]@77 signed int formationId; // [sp+50h] [bp-84h]@85 signed int orientation; // [sp+54h] [bp-80h]@61 int mapOffset; // [sp+58h] [bp-7Ch]@69 int spawnY; // [sp+5Ch] [bp-78h]@35 int spawnX; // [sp+60h] [bp-74h]@35 int v18; // [sp+64h] [bp-70h]@43 signed int v19; // [sp+68h] [bp-6Ch]@36 WalkerType walkerType; // [sp+6Ch] [bp-68h]@82 signed int v21; // [sp+74h] [bp-60h]@7 signed int v22; // [sp+78h] [bp-5Ch]@7 signed int v23; // [sp+7Ch] [bp-58h]@7 int numSoldiersPerType[12]; // [sp+8Ch] [bp-48h]@11 int numTypes[3]; // [sp+BCh] [bp-18h]@9 int k; // [sp+C8h] [bp-Ch]@87 int j; // [sp+CCh] [bp-8h]@9 int i; // [sp+D0h] [bp-4h]@7 int adjustedEnemies; // [sp+E0h] [bp+Ch]@3 if ( numEnemies <= 0 ) return -1; adjustedEnemies = fun_adjustWithPercentage(numEnemies, difficulty_something[setting_difficulty]); if ( adjustedEnemies >= 150 ) adjustedEnemies = 150; ++lastInvasionInternalId; if ( lastInvasionInternalId > 32000 ) lastInvasionInternalId = 1; v6 = dword_5F9798[8 * enemyType]; v7 = dword_5F979C[8 * enemyType]; v8 = fun_adjustWithPercentage(adjustedEnemies, dword_5F9794[8 * enemyType]); v22 = fun_adjustWithPercentage(adjustedEnemies, v6); v21 = fun_adjustWithPercentage(adjustedEnemies, v7); v23 = adjustedEnemies - (v21 + v22 + v8) + v8; for ( i = 0; i < 3; ++i ) { numTypes[i] = 0; for ( j = 0; j < 4; ++j ) *(&numSoldiersPerType[4 * i] + j) = 0; } if ( v23 > 0 ) { if ( v23 > 16 ) { if ( v23 > 32 ) { numTypes[0] = 3; numSoldiersPerType[2] = v23 / 3; numSoldiersPerType[1] = v23 / 3; numSoldiersPerType[0] = v23 - 2 * v23 / 3; } else { numTypes[0] = 2; numSoldiersPerType[1] = v23 / 2; numSoldiersPerType[0] = v23 - v23 / 2; } } else { numTypes[0] = 1; numSoldiersPerType[0] = v23; } } if ( v22 > 0 ) { if ( v22 > 16 ) { if ( v22 > 32 ) { numTypes[1] = 3; numSoldiersPerType[6] = v22 / 3; numSoldiersPerType[5] = v22 / 3; numSoldiersPerType[4] = v22 - 2 * v22 / 3; } else { numTypes[1] = 2; numSoldiersPerType[5] = v22 / 2; numSoldiersPerType[4] = v22 - v22 / 2; } } else { numTypes[1] = 1; numSoldiersPerType[4] = v22; } } if ( v21 > 0 ) { if ( v21 > 16 ) { if ( v21 > 32 ) { numTypes[2] = 3; numSoldiersPerType[10] = v21 / 3; numSoldiersPerType[9] = v21 / 3; numSoldiersPerType[8] = v21 - 2 * v21 / 3; } else { numTypes[2] = 2; numSoldiersPerType[9] = v21 / 2; numSoldiersPerType[8] = v21 - v21 / 2; } } else { numTypes[2] = 1; numSoldiersPerType[8] = v21; } } if ( enemyType == 11 ) { spawnX = scn_entryPoint_x; spawnY = scn_entryPoint_y; } else { v19 = 0; for ( i = 0; i < 8; ++i ) { if ( scn_invasionPoint_x[i] != -1 ) ++v19; } if ( invasionPoint == 8 ) { if ( v19 > 2 ) { if ( v19 > 4 ) v18 = random_7f_1 & 7; else v18 = random_7f_1 & 3; } else { v18 = random_7f_1 & 1; } } else { v18 = invasionPoint; } for ( i = 0; i < 8 && scn_invasionPoint_x[v18] == -1; ++i ) { ++v18; if ( v18 >= 8 ) v18 = 0; } spawnX = scn_invasionPoint_x[v18]; spawnY = scn_invasionPoint_y[v18]; } if ( spawnX == -1 || spawnY == -1 ) { spawnX = scn_exitPoint_x; spawnY = scn_exitPoint_y; } if ( spawnY ) { if ( spawnY < scn_sizeY - 1 ) { if ( spawnX ) { if ( spawnX < scn_sizeX - 1 ) orientation = 4; else orientation = 6; } else { orientation = 2; } } else { orientation = 0; } } else { orientation = 4; } mapOffset = 162 * spawnY + spawnX + setting_map_startGridOffset; if ( grid_terrain[162 * spawnY + spawnX + setting_map_startGridOffset] & 0x203 )// elevation, rock, tree return -1; terrain = grid_terrain[mapOffset]; if ( terrain & T_Water ) { terrain2 = grid_terrain[mapOffset]; if ( !(terrain2 & T_Road) ) // water + road = bridge return -1; } else { if ( grid_terrain[mapOffset] & 0xC108 ) // building, aqueduct, gate/tower fun_destroyBuildingByEnemyAt(spawnX, spawnY, mapOffset); } v12 = 0; for ( i = 0; i < 3; ++i ) { if ( numTypes[i] > 0 ) { walkerType = enemy_walkerTypes[enemyType][i]; for ( j = 0; j < numTypes[i]; ++j ) { formationId = fun_createFormation( walkerType, enemy_formationLayouts[8 * enemyType], orientation, spawnX, spawnY); if ( formationId > 0 ) { formations[formationId].attackType= attack; formations[formationId].orientation = orientation; formations[formationId].enemyType = enemyType; formations[formationId].invasionId = invasionId; formations[formationId].invasionInternalId = lastInvasionInternalId; for ( k = 0; k < *(&numSoldiersPerType[4 * i] + j); ++k ) { walkerId = spawnWalker(0, walkerType, spawnX, spawnY, orientation); walkers[walkerId].byte_7FA34D = 0; walkers[walkerId].actionState = -105; walkers[walkerId].word_7FA366 = 200 * v12 + 10 * k + 10; walkers[walkerId].formationId = formationId; fun_generateWalkerName(walkerId); walkers[walkerId].reachedLastStep = 1; } ++v12; } } } } return mapOffset; } void fun_setRequestsMonths() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { fun_generateRandomness(); if ( scn_requests_good[i] ) { scn_requests_month[i] = (random_7f_1 & 7) + 2; scn_requests_monthsToComply[i] = 12 * scn_requests_time[i]; } } } void fun_checkRequestsEvent() { int v0; // [sp+4Ch] [bp-8h]@34 int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { if ( scn_requests_good[i] && scn_requests_state[i] <= 3 ) { if ( scn_requests_state[i] != 2 && scn_requests_state[i] != 3 ) { if ( scn_requests_isVisible[i] ) { --scn_requests_monthsToComply[i]; if ( scn_requests_state[i] ) { if ( scn_requests_state[i] == 1 ) { if ( scn_requests_monthsToComply[i] <= 0 ) { message_usePopup = 1; fun_postMessageToPlayer(34, i, 0); scn_requests_state[i] = 4; scn_requests_isVisible[i] = 0; fun_increaseFavorRating(-5); city_inform[ciid].ignoredRequestPoints = 5; } } } else { if ( scn_requests_monthsToComply[i] == 12 ) { message_usePopup = 1; fun_postMessageToPlayer(31, i, 0); } if ( scn_requests_monthsToComply[i] <= 0 ) { message_usePopup = 1; fun_postMessageToPlayer(33, i, 0); scn_requests_state[i] = 1; scn_requests_monthsToComply[i] = 24; fun_increaseFavorRating(-3); city_inform[ciid].ignoredRequestPoints = 3; } } if ( !scn_requests_canComplyShown[i] ) { if ( city_inform[ciid].resourceInStock[ scn_requests_good[i]] >= scn_requests_amount[i] ) { scn_requests_canComplyShown[i] = 1; message_usePopup = 1; fun_postMessageToPlayer(115, i, 0); } } } else { if ( setting_currentMissionId != 1 || setting_isCustomScenario ) { v0 = scn_settings_startYear; } else { if ( !tutorial2_potteryMade ) return; v0 = tutorial2_potteryMadeYear; } if ( gametime_year == scn_requests_year[i] + v0 ) { if ( gametime_month == scn_requests_month[i] ) { scn_requests_isVisible[i] = 1; if ( city_inform[ciid].resourceInStock[ scn_requests_good[i]] >= scn_requests_amount[i] ) scn_requests_canComplyShown[i] = 1; message_usePopup = 1; if ( scn_requests_good[i] == 16 ) { fun_postMessageToPlayer(29, i, 0); } else { if ( scn_requests_good[i] == 17 ) fun_postMessageToPlayer(30, i, 0); else fun_postMessageToPlayer(28, i, 0); } } } } } else { --scn_requests_monthsToComply[i]; if ( scn_requests_monthsToComply[i] <= 0 ) { message_usePopup = 1; if ( scn_requests_state[i] == 2 ) { fun_postMessageToPlayer(32, i, 0); fun_increaseFavorRating(scn_requests_favor[i]); } else { fun_postMessageToPlayer(35, i, 0); fun_increaseFavorRating(scn_requests_favor[i] >> 1); } scn_requests_state[i] = 5; scn_requests_isVisible[i] = 0; } } } } } int sub_44AA30(int a1) { int result; // eax@5 signed int v2; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@9 v2 = 0; if ( city_inform[ciid].byte_654583 > 0 ) { if ( city_inform[ciid].byte_654585 <= 0 ) { v2 = 1; if ( !a1 ) { if ( city_inform[ciid].byte_65458C > 0 ) { if ( city_inform[ciid].byte_65458D > 0 ) result = -2; else result = -3; } else { result = -4; } return result; } } } for ( i = 0; ; ++i ) { if ( i >= 20 ) return 0; if ( scn_requests_good[i] && scn_requests_state[i] <= 1 && scn_requests_isVisible[i] ) break; LABEL_10: ; } if ( v2 != a1 ) { ++v2; goto LABEL_10; } if ( scn_requests_good[i] == 16 ) { if ( city_inform[ciid].treasury <= scn_requests_amount[i] ) return -1; } else { if ( city_inform[ciid].resourceInStock[scn_requests_good[i]]< scn_requests_amount[i] ) return -1; } return i + 1; } void fun_dispatchRequestedGoods(int requestId) { int amount; // [sp+4Ch] [bp-4h]@4 if ( scn_requests_state[requestId] ) scn_requests_state[requestId] = 3; else scn_requests_state[requestId] = 2; scn_requests_monthsToComply[requestId] = (random_7f_1 & 3) + 1; scn_requests_isVisible[requestId] = 0; amount = scn_requests_amount[requestId]; if ( scn_requests_good[requestId] == G_Denarii ) { city_inform[ciid].treasury -= amount; city_inform[ciid].finance_sundries_thisyear += amount; } else { if ( scn_requests_good[requestId] == G_Troops ) { fun_dispatchRequestedTroops(amount); fun_removeGoodsFromCityStorage(ciid, G_Weapons, amount); } else { fun_removeGoodsFromCityStorage(ciid, scn_requests_good[requestId], amount); } } } void fun_setDemandChangesMonths() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { fun_generateRandomness(); if ( scn_demandChanges_year[i] ) scn_demandChanges_month[i] = (random_7f_1 & 7) + 2; } } void fun_checkDemandChangesEvent() { int v0; // eax@21 int v1; // eax@22 int v2; // eax@33 int goodId; // [sp+4Ch] [bp-Ch]@10 int tradeRouteDemand; // [sp+50h] [bp-8h]@10 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { if ( scn_demandChanges_year[i] ) { if ( gametime_year == scn_demandChanges_year[i] + scn_settings_startYear ) { if ( gametime_month == scn_demandChanges_month[i] ) { tradeRouteDemand = scn_demandChanges_tradeRoute[i]; goodId = scn_demandChanges_good[i]; if ( scn_demandChanges_isRise[i] ) { if ( tradeRoutes[tradeRouteDemand].quotas[goodId] < 40 ) { if ( tradeRoutes[tradeRouteDemand].quotas[goodId] ) { if ( tradeRoutes[tradeRouteDemand].quotas[goodId] == 15 ) { tradeRoutes[tradeRouteDemand].quotas[goodId] = 25; } else { if ( tradeRoutes[tradeRouteDemand].quotas[goodId] == 25 ) tradeRoutes[tradeRouteDemand].quotas[goodId] = 40; } } else { tradeRoutes[tradeRouteDemand].quotas[goodId] = 15; } if ( fun_isTradeRouteOpen(tradeRouteDemand) ) { message_usePopup = 1; v2 = fun_getTradeRouteCityIndex(tradeRouteDemand); fun_postMessageToPlayer(74, v2, goodId); } } } else { if ( tradeRoutes[tradeRouteDemand].quotas[goodId] > 0 ) { switch ( tradeRoutes[tradeRouteDemand].quotas[goodId] ) { case 0xF: tradeRoutes[tradeRouteDemand].quotas[goodId] = 0; break; case 0x19: tradeRoutes[tradeRouteDemand].quotas[goodId] = 15; break; case 0x28: tradeRoutes[tradeRouteDemand].quotas[goodId] = 25; break; } if ( fun_isTradeRouteOpen(tradeRouteDemand) ) { message_usePopup = 1; if ( tradeRoutes[tradeRouteDemand].quotas[goodId] <= 0 ) { v1 = fun_getTradeRouteCityIndex(tradeRouteDemand); fun_postMessageToPlayer(76, v1, goodId); } else { v0 = fun_getTradeRouteCityIndex(tradeRouteDemand); fun_postMessageToPlayer(75, v0, goodId); } } } } } } } } } void fun_setPriceChangesMonths() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { fun_generateRandomness(); if ( scn_priceChanges_year[i] ) scn_priceChanges_month[i] = (random_7f_1 & 7) + 2; } } void fun_checkPriceChangesEvent() { int v0; // [sp+4Ch] [bp-Ch]@10 int v1; // [sp+50h] [bp-8h]@10 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { if ( scn_priceChanges_year[i] ) { if ( gametime_year == scn_priceChanges_year[i] + scn_settings_startYear ) { if ( gametime_month == scn_priceChanges_month[i] ) { v1 = scn_priceChanges_amount[i]; v0 = scn_priceChanges_good[i]; if ( scn_priceChanges_isRise[i] ) { tradeprices_buy[2 * v0] += v1; tradeprices_sell[2 * v0] += v1; message_usePopup = 1; fun_postMessageToPlayer(78, v1, v0); } else { if ( tradeprices_sell[2 * v0] > 0 ) { if ( tradeprices_sell[2 * v0] <= v1 ) { tradeprices_buy[2 * v0] = 2; tradeprices_sell[2 * v0] = 0; } else { tradeprices_buy[2 * v0] -= v1; tradeprices_sell[2 * v0] -= v1; } message_usePopup = 1; fun_postMessageToPlayer(79, v1, v0); } } } } } } } void sub_44B340() { signed int i; // [sp+4Ch] [bp-4h]@1 dword_98C028 = 0; game_ticks = 0; gametime_totalWeeks = 0; game_weeks = 0; gametime_month = 0; gametime_year = 2098; dword_98C064 = 0; dword_94A30C = 0; buildingId_highestInUseEver = 0; sub_469280(); for ( i = 0; i < 50; ++i ) { dword_94A320[i] = 0; dword_98C4C0[i] = 0; } } void fun_doGameTick() { if ( game_ticks ) { switch ( game_ticks ) { case 1: fun_calculateGodHappiness(1); break; case 2: fun_changeBackgroundMusic(); break; case 3: dword_608100 = 1; break; case 4: sub_4479A0(); break; case 5: sub_4BB990(0); break; case 6: sub_46F030(); break; case 7: sub_466880(); break; case 8: sub_45CAF0(); break; case 9: sub_44B8B0(); break; case 10: fun_updateHighestInUseBuildingId(); break; default: if ( game_ticks != 11 ) { switch ( game_ticks ) { case 12: decreaserWalkerServiceAccessForAll(); break; case 16: sub_458A80(); break; case 17: fun_updateAdvisorFoodAndSupplyRomeWheat(); break; case 18: sub_45DE60(); break; case 19: sub_452FD0(); break; case 20: sub_451770(); break; case 21: sub_453140(); break; case 22: fun_gameTick22_updatePopulationInHouses(); break; case 23: fun_gametick_population(); break; case 24: sub_455650(); break; case 25: fun_calculateWorkersNeededPerCategory(); fun_calculateUnemployment(); sub_456230(); sub_456910(); //j_empty_456B60(); sub_4563A0(); break; case 27: fun_recalculateReservoirAndFountainAccess(); break; case 28: sub_450F10(); break; case 29: sub_4BB990(1); break; case 30: dword_608100 = 1; break; case 31: fun_generateWalkersForBuildings(); break; case 32: fun_generateTraders(); break; case 33: fun_countBuildingTypes(); fun_calculateCultureCoverage(); break; case 34: fun_distributeTreasuryOverForumsAndSenates(); break; case 35: decayService_culture(); break; case 36: fun_determineHousingServicesForEvolve(); break; case 37: sub_469320(); sub_469470(); break; case 38: fun_calculateBuildingDesirability(); break; case 39: fun_evolveDevolveHouses(); break; case 40: sub_44BE70(); break; case 43: checkBurningRuins(); break; case 44: handleFireCollapseEvent(); break; case 45: checkCrimeAndGenerateCriminal(); break; case 46: sub_451AB0(); break; case 47: sub_4691F0(); break; case 48: fun_decayService_taxCollector(); break; case 49: gatherEntertainmentInfo(); break; } } break; } } else { fun_doGameTick_0_noop(); } ++game_ticks; if ( game_ticks >= 50 ) { game_ticks = 0; fun_doGameWeekTick(); } } void fun_doGameTick_0_noop() { ; } void sub_44B8B0() { dword_94BCF0 = 0; } void fun_doGameWeekTick() { ++gametime_totalWeeks; ++game_weeks; if ( game_weeks > 15 ) { game_weeks = 0; city_inform[ciid].newcomersThisMonth = 0; ++city_inform[ciid].monthsSinceFestival; fun_calculateHealthRate(); fun_handleRandomEvents(); fun_collectMonthlyTaxes(); fun_payMonthlyWages(); fun_payMonthlyInterest(); fun_payMonthlySalary(); sub_45DAE0(); fun_handleDistantBattleEvent(); fun_handleInvasionEvent(); fun_checkRequestsEvent(); fun_checkDemandChangesEvent(); fun_checkPriceChangesEvent(); fun_decreaseMonthsLeftToGovernAfterWin(); sub_4BBD90(); sub_4DE900(); sub_47F400(); sub_478CE0(0, 0, setting_map_width - 1, setting_map_height - 1); fun_determineGroundType(); fun_sortAndCompactPlayerMessages(); ++gametime_month; if ( gametime_month <= 11 ) { fun_updateRatings(0); } else { gametime_month = 0; fun_handleExpandEmpireEvent(); byte_660585 = 0; dword_8E1484 = 0; ++gametime_year; fun_gametick_requestBirthsDeaths_calculateHousingTypes(); fun_copyFinanceTaxesToLastYear(); fun_copyFinanceWagesToLastYear(); fun_copyFinanceImportExportToLastYear(); fun_copyFinanceConstructionToLastYear(); fun_copyFinanceInterestToLastYear(); fun_copyFinanceSalaryToLastYear(); fun_copyFinanceSundriesToLastYear(); fun_calculateTribute(); fun_resetTradeAmounts(); sub_4510E0(); fun_updateRatings(1); city_inform[ciid].dword_6544F0 = 0; } fun_recordMonthlyPopulation(); fun_holdFestival(); if ( setting_currentMissionId == 2 ) { if ( gametime_month == 5 ) { if ( !setting_isCustomScenario ) { if ( dword_65DEA4[0] <= 0 ) { message_usePopup = 1; dword_65DEA4[0] = 1200; fun_postMessageToPlayer(58, 0, 0); } } } } if ( !byte_660585 ) { if ( setting_monthy_autosave == 1 ) fun_writeSavedGame("last.sav"); } } if ( !game_weeks || game_weeks == 8 ) fun_calculateCityHappinessAndCrime(); if ( tutorial1_fire == 1 ) { if ( !city_inform[ciid].dword_654640 ) { city_inform[ciid].dword_654640 = 1; message_usePopup = 1; } } if ( tutorial2_disease == 1 ) { if ( !city_inform[ciid].dword_654644 ) { city_inform[ciid].dword_654644 = 1; message_usePopup = 1; fun_postMessageToPlayer(119, 0, 0); } } if ( tutorial2_granaryBuilt == 1 ) { if ( !tutorial2_population250reached ) { if ( city_inform[ciid].population >= 250 ) { tutorial2_population250reached = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(57, 0, 0); } } } if ( tutorial2_population250reached == 1 ) { if ( !tutorial2_population450reached ) { if ( city_inform[ciid].population >= 450 ) { tutorial2_population450reached = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(60, 0, 0); } } } if ( tutorial1_fire == 1 ) { if ( !tutorial1_senateEngineerBuilt ) { if ( !game_weeks || city_inform[ciid].population >= scn_win_population - 20 ) { if ( city_inform[ciid].word_652822 ) ++city_inform[ciid].dword_654514; if ( city_inform[ciid].dword_654514 >= 1 || city_inform[ciid].population >= scn_win_population - 20 ) { tutorial1_senateEngineerBuilt = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(59, 0, 0); } } } } } void sub_44BE70() { signed int v0; // [sp+4Ch] [bp-Ch]@1 signed int v1; // [sp+50h] [bp-8h]@1 int i; // [sp+54h] [bp-4h]@1 v1 = 0; v0 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 3 ) buildings[i].inUse = 1; if ( buildings[i].inUse != 1 || !buildings[i].house_size ) { if ( buildings[i].inUse != 2 && buildings[i].inUse != 6 ) { if ( buildings[i].inUse == 4 ) { if ( buildings[i].house_size ) sub_4E3800(ciid,buildings[i].house_population); fun_deleteBuilding(i); } else { if ( buildings[i].inUse == 5 ) fun_deleteBuilding(i); } } else { if ( buildings[i].type == B_Tower ) v0 = 1; if ( buildings[i].type == B_Gatehouse ) v0 = 1; sub_480FC0(i, buildings[i].x, buildings[i].y); v1 = 1; fun_deleteBuilding(i); } } } if ( v0 ) sub_47E590(); if ( v1 ) { fun_determineGroundType(); sub_4FFDF0(); } } void fun_evolveDevolveHouses() { fun_resetServiceRequiredCounters(); houseEvolveDevolve_hasExpanded = false; for ( buildingId = 1; buildingId < 2000; ++buildingId ) { if ( buildings[buildingId].inUse == 1 ) { if ( buildings[buildingId].type >= B_HouseVacantLot ) { if ( buildings[buildingId].type <= B_HouseLuxuryPalace ) { sub_46A900(buildingId); houseEvolve_status = 0; (*(&houseEvolveCheckFuncs + buildings[buildingId].type))(); if ( !game_weeks ) fun_houseConsumeGoods(buildingId); if ( game_weeks == 7 ) fun_houseConsumeGoods(buildingId); } } } } if ( houseEvolveDevolve_hasExpanded ) { fun_determineGroundType(); sub_4FFDF0(); } } void fun_checkEvolveSmallTent() { if ( buildings[buildingId].house_population > 0 ) { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status ) { if ( houseEvolve_status != -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeTent); } } } } void fun_checkEvolveLargeTent() { if ( buildings[buildingId].house_population > 0 ) { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir)+1; return; } buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir & 0xffffff00; } else { buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir & 0xffffff00; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseVacantLot); else fun_evolveHouseTo(buildingId, B_HouseSmallShack); } } } } void fun_checkEvolveSmallShack() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir)+1; return; } buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir & 0xffffff00; } else { buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir & 0xffffff00; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeTent); else fun_evolveHouseTo(buildingId, B_HouseLargeShack); } } } void fun_checkEvolveLargeShack() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir)+1; return; } buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir & 0xffffff00; } else { buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir = buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir & 0xffffff00; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseSmallShack); else fun_evolveHouseTo(buildingId, B_HouseSmallHovel); } } } void fun_checkEvolveSmallHovel() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeShack); else fun_evolveHouseTo(buildingId, B_HouseLargeHovel); } } } void fun_checkEvolveLargeHovel() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseSmallHovel); else fun_evolveHouseTo(buildingId, B_HouseSmallCasa); } } } void fun_checkEvolveSmallCasa() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeHovel); else fun_evolveHouseTo(buildingId, B_HouseLargeCasa); } } } void fun_checkEvolveLargeCasa() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseSmallCasa); else fun_evolveHouseTo(buildingId, B_HouseSmallInsula); } } } void fun_checkEvolveSmallInsula() { sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeCasa); else fun_evolveHouseTo(buildingId, B_HouseMediumInsula); } } } void fun_checkEvolveMediumInsula() { short v0; // ST54_2@17 sub_46AAC0(buildingId); if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) { fun_evolveHouseTo(buildingId, B_HouseSmallInsula); } else { if ( houseCanExpand(buildingId, 4) ) { buildings[buildingId].house_isMerged = 0; updateHouseToXArea(buildingId, 4); v0 = calculatePopulation4HouseMerging(buildingId, 4); sub_46AFA0(buildingId, v0); houseEvolveDevolve_hasExpanded = true; sub_479240(); } } } } } void fun_checkEvolveLargeInsula() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_devolveHouse2x2ToMediumInsula(buildingId); else fun_evolveHouseTo(buildingId, B_HouseGrandInsula); } } } void fun_checkEvolveGrandInsula() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeInsula); else fun_evolveHouseTo(buildingId, B_HouseSmallVilla); } } } void fun_checkEvolveSmallVilla() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseGrandInsula); else fun_evolveHouseTo(buildingId, B_HouseMediumVilla); } } } void fun_checkEvolveMediumVilla() { __int16 v0; // ST54_2@17 if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) { fun_evolveHouseTo(buildingId, B_HouseSmallVilla); } else { if ( houseCanExpand(buildingId, 9) ) { updateHouseToXArea(buildingId, 9); v0 = calculatePopulation4HouseMerging(buildingId, 9); sub_46B1F0(buildingId, v0); houseEvolveDevolve_hasExpanded = true; sub_479240(); } } } } } void fun_checkEvolveLargeVilla() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_devolveHouse3x3To2x2(buildingId); else fun_evolveHouseTo(buildingId, B_HouseGrandVilla); } } } void fun_checkEvolveGrandVilla() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseLargeVilla); else fun_evolveHouseTo(buildingId, B_HouseSmallPalace); } } } void fun_checkEvolveSmallPalace() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_evolveHouseTo(buildingId, B_HouseGrandVilla); else fun_evolveHouseTo(buildingId, B_HouseMediumPalace); } } } void fun_checkEvolveMediumPalace() { __int16 v0; // ST54_2@17 if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) { fun_evolveHouseTo(buildingId, B_HouseSmallPalace); } else { if ( houseCanExpand(buildingId, 16) ) { updateHouseToXArea(buildingId, 16); v0 = calculatePopulation4HouseMerging(buildingId, 16); sub_46B410(buildingId, v0); houseEvolveDevolve_hasExpanded = true; sub_479240(); } } } } } void fun_checkEvolveLargePalace() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) { if ( houseEvolve_status == 1 ) houseEvolve_status = fun_houseHasGoodsAndServicesForLevel(buildingId, 1); } else { houseEvolve_status = -1; } if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) { if ( houseEvolve_status == -1 ) fun_devolveHouse4x4To3x3(buildingId); else fun_evolveHouseTo(buildingId, B_HouseLuxuryPalace); } } } void fun_checkEvolveLuxuryPalace() { if ( !fun_preventHouseEvolution() ) { houseEvolve_status = fun_checkEvolveDesirability(buildingId); if ( !fun_houseHasGoodsAndServicesForLevel(buildingId, 0) ) houseEvolve_status = -1; if ( houseEvolve_status == -1 ) { if ( LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) <= 1 ) { ++_LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir); return; } _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } else { _LOBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = 0; } if ( houseEvolve_status ) fun_evolveHouseTo(buildingId, B_HouseLargePalace); } } signed int fun_preventHouseEvolution() { signed int result; // eax@2 if ( debug_houseEvolution ) { if ( buildings[buildingId].house_isMerged ) { result = 1; } else { fun_evolveHouseTo(buildingId, buildings[buildingId].type); result = 1; } } else { result = 0; } return result; } void fun_calculateBuildingDesirability() { signed int elevationLevel; // [sp+4Ch] [bp-20h]@19 signed int maxDesirability; // [sp+50h] [bp-1Ch]@8 int size; // [sp+54h] [bp-18h]@6 int j; // [sp+58h] [bp-14h]@8 int k; // [sp+5Ch] [bp-10h]@10 int offset; // [sp+60h] [bp-Ch]@6 int v6; // [sp+64h] [bp-8h]@12 signed int i; // [sp+68h] [bp-4h]@1 for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { offset = buildings[i].gridOffset; size = buildings[i].size; if ( size == 1 ) { buildings[i].desirability = grid_desirability[offset]; } else { maxDesirability = -9999; for ( j = 0; j < size; ++j ) { for ( k = 0; k < size; ++k ) { v6 = multipleTileBuildingGridOffset[j][k] + offset; if ( grid_desirability[v6] > maxDesirability ) maxDesirability = grid_desirability[v6]; } } buildings[i].desirability = maxDesirability; } if ( buildings[i].adjacentToWater ) buildings[i].desirability += 10; elevationLevel = grid_elevation[offset]; switch ( elevationLevel ) { case 1: buildings[i].desirability += 10; break; case 2: buildings[i].desirability += 12; break; case 3: buildings[i].desirability += 14; break; case 4: buildings[i].desirability += 16; break; default: if ( elevationLevel >= 5 ) buildings[i].desirability += 18; break; } } } } bool fun_checkEvolveDesirability(int buildingId) { bool v2; // [sp+4Ch] [bp-14h]@4 int currentDes; // [sp+50h] [bp-10h]@3 int evolveDes; // [sp+54h] [bp-Ch]@1 signed int housingType; // [sp+5Ch] [bp-4h]@1 housingType = buildings[buildingId].level_resourceId; evolveDes = model_houses[housingType].des_evolve; if ( housingType >= 19 ) evolveDes = 1000; currentDes = buildings[buildingId].desirability; if ( currentDes > model_houses[housingType].des_evolve ) v2 = currentDes >= evolveDes; else v2 = -1; _HIBYTE(buildings[buildingId].wharf_hasBoat_house_evolveStatusDesir) = v2; return v2; } signed int fun_houseHasGoodsAndServicesForLevel(int buildingId, int forUpgrade) { signed int result; // eax@5 int numFoods; // [sp+4Ch] [bp-3Ch]@45 signed int i; // [sp+50h] [bp-38h]@45 int wine; // [sp+54h] [bp-34h]@3 signed int furniture; // [sp+58h] [bp-30h]@3 signed int oil; // [sp+5Ch] [bp-2Ch]@3 signed int pottery; // [sp+60h] [bp-28h]@3 int foodtypes; // [sp+64h] [bp-24h]@3 signed int health; // [sp+68h] [bp-20h]@3 signed int bathhouse; // [sp+6Ch] [bp-1Ch]@3 signed int barber; // [sp+70h] [bp-18h]@3 signed int religion; // [sp+74h] [bp-14h]@3 signed int education; // [sp+78h] [bp-10h]@3 int water; // [sp+80h] [bp-8h]@3 int type; // [sp+84h] [bp-4h]@1 type = buildings[buildingId].level_resourceId; if ( forUpgrade ) ++type; water = model_houses[type].water; education = model_houses[type].education; religion = model_houses[type].religion; barber = model_houses[type].barber; bathhouse = model_houses[type].bathhouse; health = model_houses[type].health; foodtypes = model_houses[type].foodtypes; pottery = model_houses[type].pottery; oil = model_houses[type].oil; furniture = model_houses[type].furniture; wine = model_houses[type].wine; if ( !buildings[buildingId].hasFountain ) { if ( water >= 2 ) { ++city_inform[ciid].evolveFountainRequired; return 0; } if ( water == 1 && !buildings[buildingId].house_hasWell ) { ++city_inform[ciid].evolveWaterRequired; return 0; } } if ( model_houses[type].entertainment <= buildings[buildingId].house_entertainment ) { if ( education <= buildings[buildingId].house_education ) { if ( education == 2 ) { ++city_inform[ciid].serviceSchoolRequired; ++city_inform[ciid].serviceLibraryRequired; } else { if ( education == 1 ) ++city_inform[ciid].serviceSchoolRequired; } if ( religion <= buildings[buildingId].house_numGods ) { if ( religion >= 1 ) ++city_inform[ciid].serviceReligionRequired; } else // not enough religion { if ( religion == 1 ) { ++city_inform[ciid].evolveReligionRequired; return 0; } if ( religion == 2 ) { ++city_inform[ciid].evolveMoreReligionRequired; return 0; } if ( religion == 3 ) { ++city_inform[ciid].evolveEvenMoreReligionRequired; return 0; } } if ( barber <= HIBYTE(buildings[buildingId].house_academy_barber) ) { if ( barber == 1 ) ++city_inform[ciid].serviceBarberRequired; if ( bathhouse <= buildings[buildingId].house_bathhouse_dock_numships_entert_days ) { if ( bathhouse == 1 ) ++city_inform[ciid].serviceBathhouseRequired; if ( health <= buildings[buildingId].house_health ) { if ( health >= 1 ) ++city_inform[ciid].serviceClinicRequired; numFoods = 0; for ( i = 0; i < 4; ++i ) { if ( buildings[buildingId].grow_value_house_foodstocks[i] ) ++numFoods; } if ( foodtypes <= numFoods ) { if ( pottery <= buildings[buildingId].house_pottery ) { if ( oil <= buildings[buildingId].house_oil ) { if ( furniture <= buildings[buildingId].house_furniture ) { if ( wine && buildings[buildingId].house_wine <= 0 ) { result = 0; } else { if ( wine < 2 || city_inform[ciid].numWineTypesAvailable[0] >= 2 ) { result = 1; } else { ++city_inform[ciid].evolveSecondWineRequired; result = 0; } } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { ++city_inform[ciid].evolveFoodsRequired; result = 0; } } else { if ( health < 2 ) { ++city_inform[ciid].evolveClinicRequired; result = 0; } else { ++city_inform[ciid].evolveHospitalRequired; result = 0; } } } else { ++city_inform[ciid].evolveBathhouseRequired; result = 0; } } else { ++city_inform[ciid].evolveBarberRequired; result = 0; } } else // not enough education { if ( buildings[buildingId].house_education ) { ++city_inform[ciid].evolveMoreEducationRequired; result = 0; } else { ++city_inform[ciid].evolveEducationRequired; result = 0; } } } else // not enough entertainment { if ( buildings[buildingId].house_entertainment ) { ++city_inform[ciid].evolveMoreEntertainmentRequired; result = 0; } else { ++city_inform[ciid].evolveEntertainmentRequired; result = 0; } } return result; } void fun_houseConsumeGoods(int buildingId) { int level; // ST5C_4@1 signed int wine; // [sp+4Ch] [bp-14h]@1 signed int furniture; // [sp+50h] [bp-10h]@1 signed int oil; // [sp+54h] [bp-Ch]@1 signed int pottery; // [sp+58h] [bp-8h]@1 level = buildings[buildingId].level_resourceId; pottery = model_houses[level].pottery; oil = model_houses[level].oil; furniture = model_houses[level].furniture; wine = model_houses[level].wine; if ( pottery > 0 ) { if ( pottery <= buildings[buildingId].house_pottery ) buildings[buildingId].house_pottery -= pottery; else buildings[buildingId].house_pottery = 0; } if ( furniture > 0 ) { if ( furniture <= buildings[buildingId].house_furniture ) buildings[buildingId].house_furniture -= furniture; else buildings[buildingId].house_furniture = 0; } if ( oil > 0 ) { if ( oil <= buildings[buildingId].house_oil ) buildings[buildingId].house_oil -= oil; else buildings[buildingId].house_oil = 0; } if ( wine > 0 ) { if ( wine <= buildings[buildingId].house_wine ) buildings[buildingId].house_wine -= wine; else buildings[buildingId].house_wine = 0; } } void fun_resetServiceRequiredCounters() { city_inform[ciid].evolveRequired_unknown1 = 0; city_inform[ciid].evolveRequired_unknown2 = 0; city_inform[ciid].evolveRequired_unknown3 = 0; city_inform[ciid].evolveRequired_unknown4 = 0; city_inform[ciid].evolveFountainRequired = 0; city_inform[ciid].evolveWaterRequired = 0; city_inform[ciid].evolveMoreEntertainmentRequired = 0; city_inform[ciid].evolveEntertainmentRequired = 0; city_inform[ciid].evolveMoreEducationRequired = 0; city_inform[ciid].evolveEducationRequired = 0; city_inform[ciid].evolveReligionRequired = 0; city_inform[ciid].evolveMoreReligionRequired = 0; city_inform[ciid].evolveEvenMoreReligionRequired = 0; city_inform[ciid].evolveRequired_unknown5 = 0; city_inform[ciid].evolveBarberRequired = 0; city_inform[ciid].evolveBathhouseRequired = 0; city_inform[ciid].evolveClinicRequired = 0; city_inform[ciid].evolveHospitalRequired = 0; city_inform[ciid].evolveFoodsRequired = 0; city_inform[ciid].serviceSchoolRequired = 0; city_inform[ciid].serviceLibraryRequired = 0; city_inform[ciid].serviceBarberRequired = 0; city_inform[ciid].serviceBathhouseRequired = 0; city_inform[ciid].serviceClinicRequired = 0; city_inform[ciid].serviceReligionRequired = 0; } void fun_determineHousingServicesForEvolve() { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { buildings[i].house_entertainment = 0; buildings[i].house_education = 0; buildings[i].house_health = 0; buildings[i].house_numGods = 0; buildings[i].house_entertainment = (pctHippodromeCoverage + pctColosseumCoverage + pctAmphitheaterCoverage + pctTheaterCoverage) / 4 / 5; if ( LOBYTE(buildings[i].house_theater_amphi_wine) ) buildings[i].house_entertainment += 10; if ( HIBYTE(buildings[i].house_theater_amphi_wine) ) { if ( LOBYTE(buildings[i].house_amphiGlad_colo) ) buildings[i].house_entertainment += 15; else buildings[i].house_entertainment += 10; } if ( HIBYTE(buildings[i].house_amphiGlad_colo) ) { if ( LOBYTE(buildings[i].house_coloLion_hippo) ) buildings[i].house_entertainment += 25; else buildings[i].house_entertainment += 15; } if ( HIBYTE(buildings[i].house_coloLion_hippo) ) buildings[i].house_entertainment += 30; if ( LOBYTE(buildings[i].house_school_library) || HIBYTE(buildings[i].house_school_library) ) { buildings[i].house_education = 1; if ( LOBYTE(buildings[i].house_school_library) ) { if ( HIBYTE(buildings[i].house_school_library) ) { buildings[i].house_education = 2; if ( LOBYTE(buildings[i].house_academy_barber) ) buildings[i].house_education = 3; } } } if ( buildings[i].house_ceres ) ++buildings[i].house_numGods; if ( buildings[i].house_neptune ) ++buildings[i].house_numGods; if ( buildings[i].house_mercury ) ++buildings[i].house_numGods; if ( buildings[i].house_mars ) ++buildings[i].house_numGods; if ( buildings[i].house_venus ) ++buildings[i].house_numGods; if ( buildings[i].house_clinic ) ++buildings[i].house_health; if ( buildings[i].house_hospital_entert_days2 ) ++buildings[i].house_health; } } } } void gatherEntertainmentInfo() { int needShowsMax; // [sp+4Ch] [bp-Ch]@42 signed int numHouses; // [sp+50h] [bp-8h]@1 signed int v2; // [sp+54h] [bp-4h]@1 signed int i; // [sp+54h] [bp-4h]@11 city_inform[ciid].entertainment_needsMet = 0; city_inform[ciid].theaterShows = 0; city_inform[ciid].theatersWithoutShowsWeighted = 0; city_inform[ciid].amphitheaterShows = 0; city_inform[ciid].amphitheatersWithoutShowsWeighted = 0; city_inform[ciid].colosseumShows = 0; city_inform[ciid].colosseumsWithoutShowsWeighted = 0; city_inform[ciid].hippodromeShows = 0; city_inform[ciid].hippodromeWithoutShowsWeighted = 0; city_inform[ciid].entertainmentNeedingShowsMost = 0; city_inform[ciid].religion_needsMet = 0; city_inform[ciid].education_needsMet = 0; city_inform[ciid].health_needsMet = 0; v2 = 1; numHouses = 0; while ( v2 < MAX_BUILDINGS ) { if ( buildings[v2].inUse == 1 ) { if ( buildings[v2].house_size ) { ++numHouses; city_inform[ciid].entertainment_needsMet += buildings[v2].house_entertainment; city_inform[ciid].religion_needsMet += buildings[v2].house_numGods; city_inform[ciid].education_needsMet += buildings[v2].house_education; city_inform[ciid].health_needsMet += buildings[v2].house_health; } } ++v2; } if ( numHouses ) { city_inform[ciid].entertainment_needsMet /= numHouses; city_inform[ciid].religion_needsMet /= numHouses; city_inform[ciid].education_needsMet /= numHouses; city_inform[ciid].health_needsMet /= numHouses; } for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { switch ( buildings[i].type ) { case B_Theater: if ( buildings[i].house_bathhouse_dock_numships_entert_days ) ++city_inform[ciid].theaterShows; else ++city_inform[ciid].theatersWithoutShowsWeighted; break; case B_Amphitheater: if ( buildings[i].house_bathhouse_dock_numships_entert_days ) ++city_inform[ciid].amphitheaterShows; else city_inform[ciid].amphitheatersWithoutShowsWeighted += 2; if ( buildings[i].house_hospital_entert_days2 ) ++city_inform[ciid].amphitheaterShows; else city_inform[ciid].amphitheatersWithoutShowsWeighted += 2; break; case B_Colosseum: if ( buildings[i].house_bathhouse_dock_numships_entert_days ) ++city_inform[ciid].colosseumShows; else city_inform[ciid].colosseumsWithoutShowsWeighted += 3; if ( buildings[i].house_hospital_entert_days2 ) ++city_inform[ciid].colosseumShows; else city_inform[ciid].colosseumsWithoutShowsWeighted += 3; break; case B_Hippodrome: if ( buildings[i].house_bathhouse_dock_numships_entert_days ) ++city_inform[ciid].hippodromeShows; else city_inform[ciid].hippodromeWithoutShowsWeighted += 100; break; } } } needShowsMax = 0; if ( city_inform[ciid].theatersWithoutShowsWeighted > 0 ) { needShowsMax = city_inform[ciid].theatersWithoutShowsWeighted; city_inform[ciid].entertainmentNeedingShowsMost = 1; } if ( city_inform[ciid].amphitheatersWithoutShowsWeighted > needShowsMax ) { needShowsMax = city_inform[ciid].amphitheatersWithoutShowsWeighted; city_inform[ciid].entertainmentNeedingShowsMost = 2; } if ( city_inform[ciid].colosseumsWithoutShowsWeighted > needShowsMax ) { needShowsMax = city_inform[ciid].colosseumsWithoutShowsWeighted; city_inform[ciid].entertainmentNeedingShowsMost = 3; } if ( city_inform[ciid].hippodromeWithoutShowsWeighted > needShowsMax ) city_inform[ciid].entertainmentNeedingShowsMost = 4; city_inform[ciid].smallFestivalCost = city_inform[ciid].population / 20 + 10; city_inform[ciid].largeFestivalCost = city_inform[ciid].population / 10 + 20; city_inform[ciid].grandFestivalCost = city_inform[ciid].population / 5 + 40; city_inform[ciid].grandFestivalWine = city_inform[ciid].population / 500 + 1; city_inform[ciid].grandFestivalWineUnavailable = 0; if ( city_inform[ciid].stock_wine < city_inform[ciid].grandFestivalWine ) { city_inform[ciid].grandFestivalWineUnavailable = 1; if ( city_inform[ciid].festivalSize == 3 ) city_inform[ciid].festivalSize = 2; } } void sub_450F10() { int v0; // ST5C_4@19 signed int i; // [sp+4Ch] [bp-4h]@1 dword_98BF38 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == B_Well ) { word_949F00[dword_98BF38++] = i; if ( dword_98BF38 >= 500 ) dword_98BF38 = 499; } else { if ( buildings[i].house_size ) { buildings[i].hasFountain = 0; buildings[i].house_hasWell = 0; if ( fun_mapAreaContainsTerrain( buildings[i].x, buildings[i].y, buildings[i].size, T_FountainRange) ) buildings[i].hasFountain = 1; } } } } if ( dword_98BF38 > 0 ) { dword_98BF14 = 0; while ( dword_98BF14 < dword_98BF38 ) { v0 = word_949F00[dword_98BF14++]; sub_4880A0(v0, 2); } } } void sub_4510E0() { dword_94BD38 = random_7f_1 & 7; } void fun_recalculateReservoirAndFountainAccess() { __int16 terrain; // dx@41 signed int change; // [sp+4Ch] [bp-10h]@1 int offset; // [sp+50h] [bp-Ch]@34 signed int j; // [sp+54h] [bp-8h]@17 signed int i; // [sp+58h] [bp-4h]@1 int v5; // [sp+58h] [bp-4h]@15 int v6; // [sp+58h] [bp-4h]@24 signed int k; // [sp+58h] [bp-4h]@27 change = 1; fun_memAndWithShort(grid_terrain, 26244, 0xDF7Fu);// everything but: // - fountain range (0x2000) // - reservoir range (0x0080) fun_setAqueductGraphicIdsToNoWater(); fun_memset(gametick_tmpBuildingList, 4000, 0); gametick_tmpBuildingList_ctr = 0; gametick_tmpBuildingList_size = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == B_Reservoir ) { gametick_tmpBuildingList[gametick_tmpBuildingList_size++] = i; if ( fun_mapAreaContainsTerrain(buildings[i].x - 1, buildings[i].y - 1, 5, T_Water) ) buildings[i].hasFountain = 2; else buildings[i].hasFountain = 0; } } } while ( change == 1 ) { change = 0; gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size ) { v5 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v5].hasFountain == 2 ) { buildings[v5].hasFountain = 1; change = 1; for ( j = 0; j < 4; ++j ) fun_setAqueductGraphicIdsToWaterFromOffset(reservoir_connectorGridOffsets[j] + buildings[v5].gridOffset); } } } gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size ) { v6 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v6].hasFountain ) fun_setMapAreaRangeTerrain(buildings[v6].x, buildings[v6].y, 3, 10, T_ReservoirRange); } for ( k = 1; k < 2000; ++k ) { if ( buildings[k].inUse == 1 ) { if ( buildings[k].type == B_Fountain ) { offset = buildings[k].gridOffset; if ( grid_desirability[offset] <= 60 ) { if ( grid_desirability[offset] <= 40 ) { if ( grid_desirability[offset] <= 20 ) fun_putBuildingOnTerrainAndGraphicGrids( k, buildings[k].x, buildings[k].y, 1, 1, graphic_fountain1, 8); else fun_putBuildingOnTerrainAndGraphicGrids( k, buildings[k].x, buildings[k].y, 1, 1, graphic_fountain2, 8); } else { fun_putBuildingOnTerrainAndGraphicGrids( k, buildings[k].x, buildings[k].y, 1, 1, graphic_fountain3, 8); } } else { fun_putBuildingOnTerrainAndGraphicGrids( k, buildings[k].x, buildings[k].y, 1, 1, graphic_fountain4, 8); } terrain = grid_terrain[buildings[k].gridOffset]; if ( (terrain & 0x80) && buildings[k].num_workers )// 0x80 = reservoir { buildings[k].hasFountain = 1; if ( scn_climate == Climate_Desert ) fun_setMapAreaRangeTerrain(buildings[k].x, buildings[k].y, 1, 3, T_FountainRange); else fun_setMapAreaRangeTerrain(buildings[k].x, buildings[k].y, 1, 4, T_FountainRange); } else { buildings[k].hasFountain = 0; } } } } } void decreaserWalkerServiceAccessForAll() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse ) { if ( buildings[i].type != B_Tower ) { if ( buildings[i].walkerServiceAccess <= 1 ) buildings[i].walkerServiceAccess = 0; else --buildings[i].walkerServiceAccess; } } } } void sub_451770() { signed int v0; // [sp+4Ch] [bp-8h]@24 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].industry_outputGood ) { buildings[i].house_mercury = 0; if ( buildings[i].walkerServiceAccess >= 1 ) { if ( buildings[i].num_workers > 0 ) { if ( !buildings[i].level_resourceId || buildings[i].industry_unitsStored > 0 ) { if ( buildings[i].house_venus ) { --buildings[i].house_venus; } else { if ( buildings[i].house_ceres ) --buildings[i].house_ceres; if ( buildings[i].type == B_MarbleQuarry ) buildings[i].grow_value_house_foodstocks[0] += buildings[i].num_workers / 2; else buildings[i].grow_value_house_foodstocks[0] += buildings[i].num_workers; if ( buildings[i].house_ceres ) { if ( buildings[i].type <= B_PigFarm ) buildings[i].grow_value_house_foodstocks[0] += buildings[i].num_workers; } if ( buildings[i].level_resourceId ) v0 = 400; else v0 = 200; if ( buildings[i].grow_value_house_foodstocks[0] > v0 ) buildings[i].grow_value_house_foodstocks[0] = v0; if ( buildings[i].type >= B_WheatFarm ) { if ( buildings[i].type <= B_PigFarm ) sub_480460( i, buildings[i].x, buildings[i].y, 5 * (buildings[i].industry_outputGood - 1) + graphic_nativeCrops, buildings[i].grow_value_house_foodstocks[0]); } } } } } } } } } void sub_451AB0() { signed int i; // [sp+50h] [bp-4h]@3 if ( scn_climate != 1 ) { for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].industry_outputGood ) { if ( buildings[i].walkerServiceAccess >= 1 ) { if ( buildings[i].num_workers > 0 ) { if ( buildings[i].type == B_WheatFarm ) { if ( !buildings[i].house_venus ) { buildings[i].grow_value_house_foodstocks[0] += buildings[i].num_workers; if ( buildings[i].house_ceres ) buildings[i].grow_value_house_foodstocks[0] += buildings[i].num_workers; if ( buildings[i].grow_value_house_foodstocks[0] > 200 ) buildings[i].grow_value_house_foodstocks[0] = 200; sub_480460( i, buildings[i].x, buildings[i].y, 5 * (buildings[i].industry_outputGood - 1) + graphic_nativeCrops, buildings[i].grow_value_house_foodstocks[0]); } } } } } } } } } void ceresWitherCrops(int bigCurse) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].industry_outputGood ) { if ( buildings[i].type >= B_WheatFarm ) { if ( buildings[i].type <= B_PigFarm ) { buildings[i].grow_value_house_foodstocks[0] = 0; buildings[i].house_ceres = 0; if ( bigCurse == 1 ) buildings[i].house_venus = 48; else buildings[i].house_venus = 4; sub_480460( i, buildings[i].x, buildings[i].y, 5 * (buildings[i].industry_outputGood - 1) + graphic_nativeCrops, buildings[i].grow_value_house_foodstocks[0]); } } } } } } void ceresBlessingCrops() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].industry_outputGood ) { if ( buildings[i].type >= B_WheatFarm ) { if ( buildings[i].type <= B_PigFarm ) { buildings[i].grow_value_house_foodstocks[0] = 200; buildings[i].house_venus = 0; buildings[i].house_ceres = 16; sub_480460( i, buildings[i].x, buildings[i].y, 5 * (buildings[i].industry_outputGood - 1) + graphic_nativeCrops, buildings[i].grow_value_house_foodstocks[0]); } } } } } } bool gStockCapacity(int a1) { signed int v2; // [sp+50h] [bp-8h]@2 if ( buildings[a1].level_resourceId > 0 ) v2 = 400; else v2 = 200; return buildings[a1].grow_value_house_foodstocks[0] >= v2; } void sub_4520A0(int a1) { buildings[a1].grow_value_house_foodstocks[0] = 0; if ( buildings[a1].level_resourceId ) { if ( buildings[a1].industry_unitsStored ) { if ( buildings[a1].industry_unitsStored > 1 ) buildings[a1].house_mercury = 1; --buildings[a1].industry_unitsStored; } } if ( buildings[a1].type <= B_PigFarm ) sub_480460( a1, buildings[a1].x, buildings[a1].y, 5 * (buildings[a1].industry_outputGood - 1) + graphic_nativeCrops, buildings[a1].grow_value_house_foodstocks[0]); } int marketDetermineDestinationGranaryWarehouse(int buildingId) { int result; // eax@83 signed int v2; // [sp+4Ch] [bp-78h]@108 signed int v3; // [sp+50h] [bp-74h]@108 int distanceGranary; // [sp+54h] [bp-70h]@24 int distanceWarehouse; // [sp+54h] [bp-70h]@46 int granaryWarehouseId[8]; // [sp+58h] [bp-6Ch]@9 int distances[8]; // [sp+78h] [bp-4Ch]@6 int numGranaryWarehouse[8]; // [sp+98h] [bp-2Ch]@3 int v9; // [sp+B8h] [bp-Ch]@77 int i; // [sp+BCh] [bp-8h]@1 int j; // [sp+C0h] [bp-4h]@10 for ( i = 0; i < 8; ++i ) numGranaryWarehouse[i] = 0; for ( i = 0; i < 8; ++i ) distances[i] = 40; for ( i = 0; i < 8; ++i ) granaryWarehouseId[i] = 0; for ( j = 1; j < MAX_BUILDINGS; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Granary ) { if ( !scn_romeSuppliesWheat ) { if ( buildings[j].hasRoadAccess ) { if ( buildings[j].haveRomeroad > 0 ) { if ( buildings[j].haveRoadnet == buildings[buildingId].haveRoadnet ) { distanceGranary = fun_getDistanceMaximum( buildings[buildingId].x, buildings[buildingId].y, buildings[j].x, buildings[j].y); if ( distanceGranary < 40 ) { if ( buildings[j].house_wheat ) { ++numGranaryWarehouse[0]; if ( distanceGranary < distances[0] ) { distances[0] = distanceGranary; granaryWarehouseId[0] = j; } } if ( buildings[j].house_vegetables ) { ++numGranaryWarehouse[1]; if ( distanceGranary < distances[1] ) { distances[1] = distanceGranary; granaryWarehouseId[1] = j; } } if ( buildings[j].house_wine ) { ++numGranaryWarehouse[2]; if ( distanceGranary < distances[2] ) { distances[2] = distanceGranary; granaryWarehouseId[2] = j; } } if ( buildings[j].house_pottery ) { ++numGranaryWarehouse[3]; if ( distanceGranary < distances[3] ) { distances[3] = distanceGranary; granaryWarehouseId[3] = j; } } } } } } } } else { if ( buildings[j].type == B_Warehouse ) { if ( buildings[j].hasRoadAccess ) { if ( buildings[j].haveRomeroad > 0 ) { if ( buildings[j].haveRoadnet == buildings[buildingId].haveRoadnet ) { distanceWarehouse = fun_getDistanceMaximum( buildings[buildingId].x, buildings[buildingId].y, buildings[j].x, buildings[j].y); if ( distanceWarehouse < 40 ) { if ( !city_inform[ciid].stockpile_wine ) { if ( fun_getGoodAmountStoredInWarehouse(j, G_Wine) > 0 ) { ++numGranaryWarehouse[4]; if ( distanceWarehouse < distances[4] ) { distances[4] = distanceWarehouse; granaryWarehouseId[4] = j; } } } if ( !city_inform[ciid].stockpile_oil ) { if ( fun_getGoodAmountStoredInWarehouse(j, G_Oil) > 0 ) { ++numGranaryWarehouse[5]; if ( distanceWarehouse < distances[5] ) { distances[5] = distanceWarehouse; granaryWarehouseId[5] = j; } } } if ( !city_inform[ciid].stockpile_pottery ) { if ( fun_getGoodAmountStoredInWarehouse(j, G_Pottery) > 0 ) { ++numGranaryWarehouse[7]; if ( distanceWarehouse < distances[7] ) { distances[7] = distanceWarehouse; granaryWarehouseId[7] = j; } } } if ( !city_inform[ciid].stockpile_furniture ) { if ( fun_getGoodAmountStoredInWarehouse(j, G_Furniture) > 0 ) { ++numGranaryWarehouse[6]; if ( distanceWarehouse < distances[6] ) { distances[6] = distanceWarehouse; granaryWarehouseId[6] = j; } } } } } } } } } } } if ( buildings[buildingId].house_amphiGlad_colo > 0 ) --buildings[buildingId].house_amphiGlad_colo; else numGranaryWarehouse[7] = 0; if ( buildings[buildingId].house_coloLion_hippo > 0 ) --buildings[buildingId].house_coloLion_hippo; else numGranaryWarehouse[6] = 0; if ( buildings[buildingId].house_school_library > 0 ) --buildings[buildingId].house_school_library; else numGranaryWarehouse[5] = 0; if ( buildings[buildingId].house_academy_barber > 0 ) --buildings[buildingId].house_academy_barber; else numGranaryWarehouse[4] = 0; i = 0; v9 = 0; while ( i < 8 ) { if ( numGranaryWarehouse[i] ) ++v9; ++i; } if ( v9 > 0 ) { if ( buildings[buildingId].granary_capacity[0] || !numGranaryWarehouse[0] ) { if ( buildings[buildingId].house_wheat || !numGranaryWarehouse[1] ) { if ( buildings[buildingId].house_vegetables || !numGranaryWarehouse[2] ) { if ( buildings[buildingId].house_wine || !numGranaryWarehouse[3] ) { if ( buildings[buildingId].house_theater_amphi_wine || !numGranaryWarehouse[7] ) { if ( buildings[buildingId].house_pottery || !numGranaryWarehouse[6] ) { if ( buildings[buildingId].house_furniture || !numGranaryWarehouse[5] ) { if ( buildings[buildingId].house_oil || !numGranaryWarehouse[4] ) { v3 = 50; v2 = -1; if ( numGranaryWarehouse[0] ) { if ( buildings[buildingId].granary_capacity[0] < 50 ) { v3 = buildings[buildingId].granary_capacity[0] ; v2 = 0; } } if ( numGranaryWarehouse[1] ) { if ( buildings[buildingId].house_wheat < v3 ) { v3 = buildings[buildingId].house_wheat; v2 = 1; } } if ( numGranaryWarehouse[2] ) { if ( buildings[buildingId].house_vegetables < v3 ) { v3 = buildings[buildingId].house_vegetables; v2 = 2; } } if ( numGranaryWarehouse[3] ) { if ( buildings[buildingId].house_wine < v3 ) { v3 = buildings[buildingId].house_wine; v2 = 3; } } if ( numGranaryWarehouse[7] ) { if ( buildings[buildingId].house_theater_amphi_wine < v3 ) { v3 = buildings[buildingId].house_theater_amphi_wine; v2 = 7; } } if ( numGranaryWarehouse[6] ) { if ( buildings[buildingId].house_pottery < v3 ) { v3 = buildings[buildingId].house_pottery; v2 = 6; } } if ( numGranaryWarehouse[5] ) { if ( buildings[buildingId].house_furniture < v3 ) { v3 = buildings[buildingId].house_furniture; v2 = 5; } } if ( numGranaryWarehouse[4] ) { if ( buildings[buildingId].house_oil < v3 ) v2 = 4; } if ( v2 == -1 ) { if ( numGranaryWarehouse[0] ) { if ( buildings[buildingId].granary_capacity[0] < 600 ) v2 = 0; } if ( numGranaryWarehouse[1] ) { if ( buildings[buildingId].house_wheat < 400 ) v2 = 1; } if ( numGranaryWarehouse[2] ) { if ( buildings[buildingId].house_vegetables < 400 ) v2 = 2; } if ( numGranaryWarehouse[3] ) { if ( buildings[buildingId].house_wine < 400 ) v2 = 3; } } if ( v2 ) { switch ( v2 ) { case 1: buildings[buildingId].house_mars = 1; result = granaryWarehouseId[1]; break; case 2: buildings[buildingId].house_mars = 2; result = granaryWarehouseId[2]; break; case 3: buildings[buildingId].house_mars = 3; result = granaryWarehouseId[3]; break; case 7: buildings[buildingId].house_mars = 7; result = granaryWarehouseId[7]; break; case 6: buildings[buildingId].house_mars = 6; result = granaryWarehouseId[6]; break; case 5: buildings[buildingId].house_mars = 5; result = granaryWarehouseId[5]; break; case 4: buildings[buildingId].house_mars = 4; result = granaryWarehouseId[4]; break; default: result = 0; break; } } else { buildings[buildingId].house_mars = 0; result = granaryWarehouseId[0]; } } else { buildings[buildingId].house_mars = 4; result = granaryWarehouseId[4]; } } else { buildings[buildingId].house_mars = 5; result = granaryWarehouseId[5]; } } else { buildings[buildingId].house_mars = 6; result = granaryWarehouseId[6]; } } else { buildings[buildingId].house_mars = 7; result = granaryWarehouseId[7]; } } else { buildings[buildingId].house_mars = 3; result = granaryWarehouseId[3]; } } else { buildings[buildingId].house_mars = 2; result = granaryWarehouseId[2]; } } else { buildings[buildingId].house_mars = 1; result = granaryWarehouseId[1]; } } else { buildings[buildingId].house_mars = 0; result = granaryWarehouseId[0]; } } else { result = 0; } return result; } signed int sub_452DD0(int buildingId) { signed int result; // eax@2 signed int v2; // [sp+4Ch] [bp-4h]@1 v2 = 0; if ( buildingId > 0 ) { if ( buildings[buildingId].type == B_Market ) { if ( buildings[buildingId].granary_capacity[0] > 0 ) v2 = buildings[buildingId].granary_capacity[0]; if ( buildings[buildingId].house_wheat > v2 ) v2 = buildings[buildingId].house_wheat; if ( buildings[buildingId].house_vegetables > v2 ) v2 = buildings[buildingId].house_vegetables; if ( buildings[buildingId].house_wine > v2 ) v2 = buildings[buildingId].house_wine; result = v2; } else { result = 0; } } else { result = 0; } return result; } signed int sub_452ED0(int buildingId) { signed int result; // eax@2 signed int v2; // [sp+4Ch] [bp-4h]@1 v2 = 0; if ( buildingId > 0 ) { if ( buildings[buildingId].type == B_Market ) { if ( buildings[buildingId].house_oil > 0 ) v2 = buildings[buildingId].house_oil; if ( buildings[buildingId].house_furniture > v2 ) v2 = buildings[buildingId].house_furniture; if ( buildings[buildingId].house_pottery > v2 ) v2 = buildings[buildingId].house_pottery; if ( buildings[buildingId].house_theater_amphi_wine > v2 ) v2 = buildings[buildingId].house_theater_amphi_wine; result = v2; } else { result = 0; } } else { result = 0; } return result; } void sub_452FD0() { signed int i; // [sp+5Ch] [bp-4h]@1 fun_determineOpenWaterTiles(scn_riverEntry_x, scn_riverEntry_y); for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 && buildings[i].house_size > 0 && buildings[i].type == B_Dock ) { if ( fun_isAdjacentToOpenWater(buildings[i].x, buildings[i].y, 3) ) buildings[i].hasFountain = 1; else buildings[i].hasFountain = 0; } } } int fun_dockIsConnectedToOpenWater(int x, int y) { signed int result; // eax@2 fun_determineOpenWaterTiles(scn_riverEntry_x, scn_riverEntry_y); if ( fun_isAdjacentToOpenWater(x, y, 3) ) result = 1; else result = 0; return result; } void sub_453140() { int v0; // eax@35 int gridOffset; // [sp+4Ch] [bp-18h]@1 int v2; // [sp+58h] [bp-Ch]@27 int v3; // [sp+58h] [bp-Ch]@31 int v4; // [sp+58h] [bp-Ch]@36 signed int j; // [sp+5Ch] [bp-8h]@45 int i; // [sp+60h] [bp-4h]@1 gridOffset = 0; sub_5007F0(city_inform[ciid].entry_x, city_inform[ciid].entry_y, -2, -2); for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { if ( sub_489070(buildings[i].x, buildings[i].y, buildings[i].size, 2) ) { if ( grid_pathingDistance[walkerBaseGridOffset] ) { buildings[i].haveRomeroad = grid_pathingDistance[walkerBaseGridOffset]; buildings[i].noContactWithRome = 0; } else { if ( sub_4890E0( buildings[i].x, buildings[i].y, buildings[i].size, 2) ) { buildings[i].haveRomeroad = grid_pathingDistance[walkerBaseGridOffset]; buildings[i].noContactWithRome = 0; } else { if ( !buildings[i].noContactWithRome ) gridOffset = buildings[i].gridOffset; ++buildings[i].noContactWithRome; if ( buildings[i].noContactWithRome > 8 ) { buildings[i].haveRomeroad = 0; buildings[i].noContactWithRome = 0; buildings[i].inUse = 2; } } } } else { buildings[i].haveRomeroad = 0; ++buildings[i].noContactWithRome; if ( buildings[i].noContactWithRome > 4 ) { if (buildings[i].house_population ) { fun_spawnWalker_homeless( ciid, buildings[i].x, buildings[i].y, buildings[i].house_population); buildings[i].house_population = 0; buildings[i].noContactWithRome = 0; } buildings[i].inUse = 2; } } } else { switch ( buildings[i].type ) { case B_Warehouse: if ( !city_inform[ciid].tradeCenterId ) city_inform[ciid].tradeCenterId = i; buildings[i].haveRomeroad = 0; v2 = sub_48B030(buildings[i].x, buildings[i].y, 3); if ( v2 ) { buildings[i].haveRoadnet = byte_91C920[v2 - 1]; buildings[i].haveRomeroad = grid_pathingDistance[v2 - 1]; buildings[i].enter_x = walkerGridX; buildings[i].enter_y = walkerGridY; } break; case B_Hippodrome: buildings[i].haveRomeroad = 0; v3 = sub_48B2F0(buildings[i].x, buildings[i].y, 5); if ( v3 ) { buildings[i].haveRoadnet = byte_91C920[v3 - 1]; buildings[i].haveRomeroad = grid_pathingDistance[v3 - 1]; buildings[i].enter_x = walkerGridX; buildings[i].enter_y = walkerGridY; } break; case B_WarehouseSpace: buildings[i].haveRomeroad = 0; v0 = sub_4789E0(i); buildings[i].haveRoadnet = buildings[v0].haveRoadnet; buildings[i].haveRomeroad = buildings[v0].haveRomeroad; buildings[i].enter_x = buildings[v0].enter_x; buildings[i].enter_y = buildings[v0].enter_y; break; default: buildings[i].haveRomeroad = 0; v4 = sub_48B030(buildings[i].x, buildings[i].y, buildings[i].size); if ( v4 ) { buildings[i].haveRoadnet = byte_91C920[v4 - 1]; buildings[i].haveRomeroad = grid_pathingDistance[v4 - 1]; buildings[i].enter_x = walkerGridX; buildings[i].enter_y = walkerGridY; } break; } } } } if ( grid_pathingDistance[city_inform[ciid].exit_gridOffset] ) { if ( gridOffset ) { showWarning(63); // parts of city disconnected showWarning(64); fun_gotoGridOffset(gridOffset); } } else { if ( city_inform[ciid].population > 0 ) { for ( j = 0; j < 15; ++j ) { sub_500B60( city_inform[ciid].entry_x, city_inform[ciid].entry_y, -2, -2); sub_500B60( city_inform[ciid].exit_x, city_inform[ciid].exit_y, -2, -2); sub_5007F0( city_inform[ciid].entry_x, city_inform[ciid].entry_y, -2, -2); sub_47E590(); sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); sub_479720(0, 0, setting_map_width - 1, setting_map_height - 1); sub_479F40(0, 0, setting_map_width - 1, setting_map_height - 1); fun_determineGroundType(); sub_4FFDF0(); sub_500420(); if ( grid_pathingDistance[city_inform[ciid].exit_gridOffset] ) { message_usePopup = 1; fun_postMessageToPlayer(116, 0, 0); dword_8E1484 = 0; return; } } sub_453AA0(); } } } void sub_453AA0() { int buildingId; // [sp+4Ch] [bp-Ch]@1 signed int lastPlaced; // [sp+50h] [bp-8h]@1 signed int i; // [sp+54h] [bp-4h]@1 lastPlaced = 0; buildingId = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 || buildings[i].inUse == 3 ) { if ( buildings[i].placedSequenceNumber > lastPlaced ) { lastPlaced = buildings[i].placedSequenceNumber; buildingId = i; } } } if ( buildingId ) { message_usePopup = 1; fun_postMessageToPlayer(80, 0, buildings[buildingId].gridOffset); dword_8E1484 = 0; buildings[buildingId].inUse = 4; collapseBuildingToRubble( buildingId, buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, buildings[buildingId].size); fun_createDustCloud( buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size); sub_467A70(buildingId, 0); fun_determineGroundType(); sub_4FFDF0(); } } // return value in gametick_tmpBuildingList void fun_getListOfAllHouses() { signed int i; // [sp+4Ch] [bp-4h]@1 gametick_tmpBuildingList_size = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) gametick_tmpBuildingList[gametick_tmpBuildingList_size++] = i; } } } void fun_gameTick22_updatePopulationInHouses() { int maxPop; // [sp+4Ch] [bp-10h]@8 int ciid; // [sp+50h] [bp-Ch]@1 int buildingId; // [sp+58h] [bp-4h]@3 fun_resetPopulationMax(); fun_getListOfAllHouses(); ciid = ::ciid; gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size ) { buildingId = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; buildings[buildingId].house_roomForPeople = 0; if ( buildings[buildingId].haveRomeroad > 0 ) { if ( buildings[buildingId].house_isMerged ) maxPop = 4 * model_houses[buildings[buildingId].level_resourceId].numPeople; else maxPop = model_houses[buildings[buildingId].level_resourceId].numPeople; city_inform[ciid].populationRoomForMax += maxPop; city_inform[ciid].populationCanImmigrate += maxPop - buildings[buildingId].house_population; buildings[buildingId].house_roomForPeople = maxPop - buildings[buildingId].house_population; if ( buildings[buildingId].house_population > buildings[buildingId].house_maxPopEver ) buildings[buildingId].house_maxPopEver = buildings[buildingId].house_population; } else { if ( buildings[buildingId].house_population ) buildings[buildingId].house_roomForPeople = -buildings[buildingId].house_population; } } } void fun_gametick_population() { fun_determineHappinessEmigrationImmigration(ciid); city_inform[ciid].numImmigrantsThisMonth = 0; city_inform[ciid].numEmigrantsThisMonth = 0; city_inform[ciid].wantedImmigrantsNoHousing = 0; if ( city_inform[ciid].happiness_immigrationAmount > 0 ) { if ( city_inform[ciid].happiness_immigrationAmount < 4 ) { if ( city_inform[ciid].immigrationQueueSize + city_inform[ciid].happiness_immigrationAmount < 4 ) { city_inform[ciid].immigrationQueueSize += city_inform[ciid].happiness_immigrationAmount; } else { fun_immigratePeople( city_inform[ciid].immigrationQueueSize + city_inform[ciid].happiness_immigrationAmount); city_inform[ciid].immigrationQueueSize = 0; } } else { fun_immigratePeople(city_inform[ciid].happiness_immigrationAmount); } } if ( city_inform[ciid].happiness_emigrationValue > 0 ) { if ( city_inform[ciid].happiness_emigrationValue < 4 ) { if ( city_inform[ciid].emigrationQueueSize + city_inform[ciid].happiness_emigrationValue < 4 ) { city_inform[ciid].emigrationQueueSize += city_inform[ciid].happiness_emigrationValue; } else { fun_emigratePeople( city_inform[ciid].emigrationQueueSize + city_inform[ciid].happiness_emigrationValue); city_inform[ciid].emigrationQueueSize = 0; if ( !city_inform[ciid].emigrationMessageShown ) { city_inform[ciid].emigrationMessageShown = 1; message_usePopup = 1; fun_postMessageToPlayer(111, 0, 0); } } } else { fun_emigratePeople(city_inform[ciid].happiness_emigrationValue); } } city_inform[ciid].happiness_immigrationAmount = 0; city_inform[ciid].happiness_emigrationValue = 0; if ( city_inform[ciid].populationYearlyBirthsDeathsCalculationNeeded ) { fun_populationAdvanceAgesOneYear(); fun_populationBirths(); fun_updatePopulationAfterBirthsDeaths(ciid); } fun_calculateNumberOfWorkers(); if ( city_inform[ciid].population >= 500 ) { if ( !populationMessage_500_shown ) { message_usePopup = 1; fun_postMessageToPlayer(2, 0, 0); populationMessage_500_shown = 1; } } if ( city_inform[ciid].population >= 1000 ) { if ( !populationMessage_1000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(3, 0, 0); populationMessage_1000_shown = 1; } } if ( city_inform[ciid].population >= 2000 ) { if ( !populationMessage_2000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(4, 0, 0); populationMessage_2000_shown = 1; } } if ( city_inform[ciid].population >= 3000 ) { if ( !populationMessage_3000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(5, 0, 0); populationMessage_3000_shown = 1; } } if ( city_inform[ciid].population >= 5000 ) { if ( !populationMessage_5000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(6, 0, 0); populationMessage_5000_shown = 1; } } if ( city_inform[ciid].population >= 10000 ) { if ( !populationMessage_10000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(7, 0, 0); populationMessage_10000_shown = 1; } } if ( city_inform[ciid].population >= 15000 ) { if ( !populationMessage_15000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(8, 0, 0); populationMessage_15000_shown = 1; } } if ( city_inform[ciid].population >= 20000 ) { if ( !populationMessage_20000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(9, 0, 0); populationMessage_20000_shown = 1; } } if ( city_inform[ciid].population >= 25000 ) { if ( !populationMessage_25000_shown ) { message_usePopup = 1; fun_postMessageToPlayer(10, 0, 0); populationMessage_25000_shown = 1; } } } void fun_calculateNumberOfWorkers() { int numPats; // [sp+4Ch] [bp-Ch]@1 int numPlebs; // [sp+50h] [bp-8h]@1 int buildingId; // [sp+54h] [bp-4h]@3 numPats = 0; numPlebs = 0; gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size ) { buildingId = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[buildingId].house_population > 0 ) { if ( buildings[buildingId].level_resourceId < 12 ) numPlebs += buildings[buildingId].house_population; else numPats += buildings[buildingId].house_population; } } city_inform[ciid].percentagePlebs = getPercentage(numPlebs, numPlebs + numPats); city_inform[ciid].numPeopleOfWorkingAgeMen = fun_getNumPeopleOfWorkingAge(); city_inform[ciid].numPeopleOfWorkingAgeMen = fun_adjustWithPercentage( city_inform[ciid].numPeopleOfWorkingAgeMen, 60); city_inform[ciid].numAvailableWorkers = fun_adjustWithPercentage( city_inform[ciid].numPeopleOfWorkingAgeMen, city_inform[ciid].percentagePlebs); } void fun_immigratePeople(signed int immigrantsToGo) { signed int totalToImmigrate; // [sp+4Ch] [bp-10h]@1 int room; // [sp+54h] [bp-8h]@42 int v3; // [sp+58h] [bp-4h]@4 int v4; // [sp+58h] [bp-4h]@10 int v5; // [sp+58h] [bp-4h]@23 int v6; // [sp+58h] [bp-4h]@36 totalToImmigrate = immigrantsToGo; gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size && immigrantsToGo > 0 ) { v3 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v3].immigrantId ) { if ( walkers[buildings[v3].immigrantId].state != 1 ) buildings[v3].immigrantId = 0; } } while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size && immigrantsToGo > 0 ) { // empty homes v4 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v4].haveRomeroad > 0 ) { if ( !buildings[v4].house_population ) { if ( !buildings[v4].immigrantId ) { if ( immigrantsToGo <= 4 ) { fun_immigratePeopleToHouse(v4, immigrantsToGo); immigrantsToGo = 0; } else { fun_immigratePeopleToHouse(v4, 4); immigrantsToGo -= 4; } } } } } gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size && immigrantsToGo > 0 ) { // homes with plenty of room v5 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v5].haveRomeroad > 0 ) { if ( buildings[v5].house_roomForPeople >= 8 ) { if ( !buildings[v5].immigrantId ) { if ( immigrantsToGo <= 4 ) { fun_immigratePeopleToHouse(v5, immigrantsToGo); immigrantsToGo = 0; } else { fun_immigratePeopleToHouse(v5, 4); immigrantsToGo -= 4; } } } } } gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size && immigrantsToGo > 0 ) { // almost full homes v6 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v6].haveRomeroad > 0 ) { if ( buildings[v6].house_roomForPeople > 0 ) { if ( !buildings[v6].immigrantId ) { room = buildings[v6].house_roomForPeople; if ( immigrantsToGo <= room ) { fun_immigratePeopleToHouse(v6, immigrantsToGo); immigrantsToGo = 0; } else { fun_immigratePeopleToHouse(v6, room); immigrantsToGo -= room; } } } } } city_inform[ciid].numImmigrantsThisMonth += totalToImmigrate - immigrantsToGo; city_inform[ciid].newcomersThisMonth += city_inform[ciid].numImmigrantsThisMonth; if ( immigrantsToGo ) { if ( totalToImmigrate == immigrantsToGo ) city_inform[ciid].wantedImmigrantsNoHousing += immigrantsToGo; } } void fun_emigratePeople(int emigrantsToGo) { int totalToEmigrate; // [sp+4Ch] [bp-10h]@1 signed int numEmigrantsThisHouse; // [sp+50h] [bp-Ch]@12 signed int i; // [sp+54h] [bp-8h]@1 int buildingId; // [sp+58h] [bp-4h]@7 totalToEmigrate = emigrantsToGo; for ( i = 0; emigrantsToGo > 0 && i < 10; ++i ) { gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size && emigrantsToGo > 0 ) { buildingId = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[buildingId].house_population > 0 ) { if ( buildings[buildingId].level_resourceId == i ) { if ( buildings[buildingId].house_population >= 4 ) numEmigrantsThisHouse = 4; else numEmigrantsThisHouse = buildings[buildingId].house_population; if ( emigrantsToGo <= numEmigrantsThisHouse ) { emigratePeopleFromHouse(buildingId, emigrantsToGo); emigrantsToGo = 0; } else { emigratePeopleFromHouse(buildingId, numEmigrantsThisHouse); emigrantsToGo -= numEmigrantsThisHouse; } } } } } city_inform[ciid].numEmigrantsThisMonth += totalToEmigrate - emigrantsToGo; } int sub_454D40(int a1, int a2) { signed int v3; // [sp+4Ch] [bp-10h]@1 signed int v4; // [sp+50h] [bp-Ch]@1 int v5; // [sp+54h] [bp-8h]@14 signed int i; // [sp+58h] [bp-4h]@1 v4 = 1000; v3 = 0; for ( i = 1; i <= buildingId_highestInUse; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { if ( buildings[i].haveRomeroad > 0 ) { if ( buildings[i].house_roomForPeople > 0 ) { if ( !buildings[i].immigrantId ) { v5 = fun_getDistanceMaximum(a1, a2, buildings[i].x, buildings[i].y); if ( v5 < v4 ) { v4 = v5; v3 = i; } } } } } } } return v3; } void fun_immigratePeopleToHouse(int buildingId, char numPeople) { int walkerId; // eax@1 walkerId = spawnWalker( ciid, Walker_Immigrant, city_inform[ciid].entry_x, city_inform[ciid].entry_y, 0); walkers[walkerId].actionState = 1; walkers[walkerId].migrantDestinationHome = buildingId; buildings[buildingId].immigrantId = walkerId; walkers[walkerId].word_7FA366 = (buildings[buildingId].byte_94BD85 & 0x7F) + 10; walkers[walkerId].migrantNumPeopleCarried = numPeople; } void emigratePeopleFromHouse(int buildingId, signed int numEmigrants) { int emigrant; // eax@4 fun_addPeopleToCityAndCensus(ciid, -numEmigrants); if ( numEmigrants < buildings[buildingId].house_population ) { buildings[buildingId].house_population -= numEmigrants; } else { buildings[buildingId].house_population = 0; fun_revertHouseToVacantLot(buildingId); } emigrant = spawnWalker(ciid, Walker_Emigrant, buildings[buildingId].x, buildings[buildingId].y, 0); walkers[emigrant].actionState = 4; walkers[emigrant].word_7FA366 = 0; walkers[emigrant].migrantNumPeopleCarried = numEmigrants; } int fun_addBirthsToHouses(int ciid, int a2) { int maxPeople; // [sp+50h] [bp-10h]@16 int newbornsAdded; // [sp+54h] [bp-Ch]@1 signed int i; // [sp+58h] [bp-8h]@1 signed int buildingId; // [sp+5Ch] [bp-4h]@1 newbornsAdded = 0; buildingId = city_inform[ciid].lastBirthHouseBuildingId; for ( i = 1; i < 2000 && newbornsAdded < a2; ++i ) { ++buildingId; if ( buildingId >= 2000 ) buildingId = 1; if ( buildings[buildingId].inUse == 1 ) { if ( buildings[buildingId].house_size ) { if ( buildings[buildingId].haveRomeroad > 0 ) { if ( buildings[buildingId].house_population > 0 ) { city_inform[ciid].lastBirthHouseBuildingId = buildingId; maxPeople = model_houses[buildings[buildingId].level_resourceId].numPeople; if ( buildings[buildingId].house_isMerged ) maxPeople *= 4; if ( maxPeople - buildings[buildingId].house_population > 0 ) { ++newbornsAdded; ++buildings[buildingId].house_population; buildings[buildingId].house_roomForPeople = maxPeople - buildings[buildingId].house_population; } } } } } } return newbornsAdded; } int fun_removePeopleFromCity(int ciid, int amount) { int removed; // [sp+4Ch] [bp-Ch]@1 signed int i; // [sp+50h] [bp-8h]@1 signed int buildingId; // [sp+54h] [bp-4h]@1 removed = 0; //buildingId = cityinfo_lastHousePeopleRemovedFrom[9034 * ciid]; buildingId = city_inform[ciid].lastHousePeopleRemovedFrom; for ( i = 1; i < 8000 && removed < amount; ++i ) { ++buildingId; if ( buildingId >= 2000 ) buildingId = 1; if ( buildings[buildingId].inUse == 1 ) { if ( buildings[buildingId].house_size ) { city_inform[ciid].lastHousePeopleRemovedFrom = buildingId; if ( buildings[buildingId].house_population > 0 ) { ++removed; --buildings[buildingId].house_population; } } } } return removed; } int fun_calculatePeopleInHousingTypes(int ciid) { int totalPop; // [sp+4Ch] [bp-Ch]@1 int pop; // [sp+50h] [bp-8h]@14 signed int i; // [sp+54h] [bp-4h]@1 city_inform[ciid].peopleInTentsAndShacks = 0; city_inform[ciid].peopleInVillasAndPalaces = 0; city_inform[ciid].peopleInTents = 0; city_inform[ciid].peopleInLargeInsulaAndAbove = 0; totalPop = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse ) { if ( buildings[i].inUse != 5 ) { if ( buildings[i].inUse != 2 ) { if ( buildings[i].inUse != 6 ) { if ( buildings[i].house_size ) { pop =buildings[i].house_population; totalPop +=buildings[i].house_population; if ( buildings[i].level_resourceId <= 1 ) city_inform[ciid].peopleInTents += pop; if ( buildings[i].level_resourceId <= 3 ) city_inform[ciid].peopleInTentsAndShacks += pop; if ( buildings[i].level_resourceId >= 10 ) city_inform[ciid].peopleInLargeInsulaAndAbove += pop; if ( buildings[i].level_resourceId >= 12 ) city_inform[ciid].peopleInVillasAndPalaces += pop; } } } } } } return totalPop; } void fun_spawnWalker_homeless(int ciid, __int16 x, __int16 y, int numPeople) { int walkerId; // eax@1 walkerId = spawnWalker(ciid, Walker_Homeless, x, y, 0); walkers[walkerId].actionState = 7; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].migrantNumPeopleCarried = numPeople; sub_4E3A40(ciid, numPeople); } void sub_455650() { int v0; // [sp+4Ch] [bp-8h]@4 int v1; // [sp+50h] [bp-4h]@3 gametick_tmpBuildingList_ctr = 0; while ( gametick_tmpBuildingList_ctr < gametick_tmpBuildingList_size ) { v1 = gametick_tmpBuildingList[gametick_tmpBuildingList_ctr++]; if ( buildings[v1].house_roomForPeople < 0 ) { v0 = -buildings[v1].house_roomForPeople; fun_spawnWalker_homeless( ciid, buildings[v1].x, buildings[v1].y, -buildings[v1].house_roomForPeople); if ( v0 < buildings[v1].house_population ) buildings[v1].house_population -= v0; else buildings[v1].inUse = 2; } } } void fun_calculateWorkersNeededPerCategory() { int category; // [sp+4Ch] [bp-Ch]@9 signed int i; // [sp+50h] [bp-8h]@1 int buildingId; // [sp+54h] [bp-4h]@4 for ( i = 0; i < 10; ++i ) { city_inform[ciid].labor_category_priority[i].numBuildings= 0; city_inform[ciid].labor_category_priority[i].relatedToEmployeeAccess = 0; city_inform[ciid].labor_category_priority[i].workersAllocated = 0; city_inform[ciid].labor_category_priority[i].numWorkersNeeded = 0; } for ( buildingId = 1; buildingId < MAX_BUILDINGS; ++buildingId ) { if ( buildings[buildingId].inUse == 1 ) { category = laborCategoryForBuildingId[buildings[buildingId].type]; buildings[buildingId].laborCategory = category; if ( category >= 0 ) { if ( category == 2 ) goto LABEL_31; if ( category == 6 ) { if ( (buildings[buildingId].type != B_Hippodrome || !buildings[buildingId].warehouse_prevStorage) && buildings[buildingId].walkerServiceAccess > 0 ) goto LABEL_31; } else { if ( category == 3 ) goto LABEL_31; if ( category && category != 1 ) { if ( buildings[buildingId].walkerServiceAccess > 0 ) goto LABEL_31; } else { if ( !fun_isIndustryForBuildingEnabled(buildingId) && buildings[buildingId].walkerServiceAccess > 0 ) { LABEL_31: city_inform[ciid].labor_category_priority[category].numWorkersNeeded += model_buildings[buildings[buildingId].type].laborers; city_inform[ciid].labor_category_priority[category].relatedToEmployeeAccess += buildings[buildingId].walkerServiceAccess; ++city_inform[ciid].labor_category_priority[category].numBuildings; continue; } } } } } } } signed int fun_isIndustryForBuildingEnabled(int buildingId) { signed int result; // eax@2 if ( buildings[buildingId].type >= B_WheatFarm ) { if ( buildings[buildingId].type <= B_PotteryWorkshop ) { if ( city_inform[ciid].industryMothballed[buildings[buildingId].industry_outputGood] ) result = 1; else result = 0; } else { result = 0; } } else { result = 0; } return result; } void fun_calculateUnemployment() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = city_inform[ciid].numWorkersNeeded; fun_reallocateWorkersPerCategory(); if ( city_inform[ciid].unemploymentPercentage >= city_inform[ciid].unemploymentForSenateDrawing ) { if ( city_inform[ciid].unemploymentPercentage - 5 >= city_inform[ciid].unemploymentForSenateDrawing ) city_inform[ciid].unemploymentForSenateDrawing += 5; else city_inform[ciid].unemploymentForSenateDrawing = city_inform[ciid].unemploymentPercentage; } else { city_inform[ciid].unemploymentForSenateDrawing = city_inform[ciid].unemploymentPercentage; } if ( city_inform[ciid].unemploymentForSenateDrawing > 100 ) city_inform[ciid].unemploymentForSenateDrawing = 100; if ( !v0 ) { if ( city_inform[ciid].numWorkersNeeded > 0 ) { if ( gametime_year >= scn_settings_startYear ) { if ( workersNeededMessageDelay <= 0 ) { workersNeededMessageDelay = 6; fun_postMessageToPlayer(37, 0, 0); } } } } } void fun_reallocateWorkersPerCategory() { int workersNeeded; // [sp+4Ch] [bp-20h]@1 int workersStillNeededForCat; // [sp+50h] [bp-1Ch]@33 int neededForCategory; // [sp+54h] [bp-18h]@19 int workersToAssign; // [sp+54h] [bp-18h]@35 int cate; // [sp+58h] [bp-14h]@31 int workersAvailable; // [sp+5Ch] [bp-10h]@12 int v6; // [sp+60h] [bp-Ch]@1 signed int category; // [sp+64h] [bp-8h]@14 signed int i; // [sp+68h] [bp-4h]@1 signed int j; // [sp+68h] [bp-4h]@4 signed int m; // [sp+68h] [bp-4h]@8 signed int priority; // [sp+68h] [bp-4h]@12 signed int k; // [sp+68h] [bp-4h]@28 signed int l; // [sp+68h] [bp-4h]@45 v6 = 0; workersNeeded = 0; for ( i = 0; i < 10; ++i ) city_inform[ciid].labor_category_priority[i].workersAllocated = 0; for ( j = 0; j < 10; ++j ) workersNeeded += city_inform[ciid].labor_category_priority[j].numWorkersNeeded; city_inform[ciid].numWorkersNeeded = 0; if ( workersNeeded > city_inform[ciid].numAvailableWorkers ) { workersAvailable = city_inform[ciid].numAvailableWorkers; for ( priority = 1; ; ++priority ) { if ( priority <= 9 ) { for ( category = 0; category < 9; ++category ) { if( city_inform[ciid].labor_category_priority[ category ].priority == priority ) { neededForCategory = city_inform[ciid].labor_category_priority[category].numWorkersNeeded; if ( neededForCategory > workersAvailable ) neededForCategory = workersAvailable; city_inform[ciid].labor_category_priority[category].workersAllocated = neededForCategory; workersAvailable -= neededForCategory; break; } } if ( workersAvailable > 0 ) continue; } break; } do // round robin distribute workers over unprioritized categories { ++v6; if ( v6 >= city_inform[ciid].numAvailableWorkers ) break; if ( workersAvailable <= 0 ) break; for ( k = 0; k < 9; ++k ) { cate = laberCategory_builtInPriority[2 * k]; if( !city_inform[ciid].labor_category_priority[ cate ].priority ) { workersStillNeededForCat = city_inform[ciid].labor_category_priority[cate].numWorkersNeeded - city_inform[ciid].labor_category_priority[cate].workersAllocated; if ( workersStillNeededForCat > 0 ) { workersToAssign = laberCategory_workersPerBuiltInPriority[2 * k]; if ( workersToAssign > workersAvailable ) workersToAssign = workersAvailable; if ( workersToAssign > workersStillNeededForCat ) workersToAssign = city_inform[ciid].labor_category_priority[cate].numWorkersNeeded - city_inform[ciid].labor_category_priority[cate].workersAllocated; city_inform[ciid].labor_category_priority[cate].workersAllocated += workersToAssign; workersAvailable -= workersToAssign; if ( workersAvailable <= 0 ) break; } } } } while ( workersAvailable > 0 ); city_inform[ciid].numEmployedWorkers = city_inform[ciid].numAvailableWorkers; for ( l = 0; l < 9; ++l ) city_inform[ciid].numWorkersNeeded += city_inform[ciid].labor_category_priority[l].numWorkersNeeded - city_inform[ciid].labor_category_priority[l].workersAllocated; } else // enough workers to staff all jobs { for ( m = 0; m < 10; ++m ) city_inform[ciid].labor_category_priority[m].workersAllocated = city_inform[ciid].labor_category_priority[m].numWorkersNeeded; city_inform[ciid].numEmployedWorkers = workersNeeded; } city_inform[ciid].numUnemployedWorkers = city_inform[ciid].numAvailableWorkers - city_inform[ciid].numEmployedWorkers; city_inform[ciid].unemploymentPercentage = getPercentage( city_inform[ciid].numUnemployedWorkers, city_inform[ciid].numAvailableWorkers); } void sub_456230() { int category; // [sp+58h] [bp-8h]@6 signed int i; // [sp+5Ch] [bp-4h]@1 short effectivity = getPercentage(100, city_inform[ciid].labor_categoryWater_priority); getPercentage(100, city_inform[ciid].dword_652AF8 ); for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { category = laborCategoryForBuildingId[buildings[i].type]; if ( category >= 0 ) { if ( category == LaborCategory_Water ) { buildings[i].workersEffectivity = effectivity; } else { buildings[i].workersEffectivity = 0; if ( buildings[i].walkerServiceAccess ) buildings[i].workersEffectivity = getPercentage( 100 * buildings[i].walkerServiceAccess, city_inform[ciid].labor_category_priority[category].relatedToEmployeeAccess); } } } } } void sub_4563A0() { int v0; // [sp+4Ch] [bp-40h]@70 int v1; // [sp+50h] [bp-3Ch]@29 int v2[10]; // [sp+58h] [bp-34h]@4 int v3; // [sp+80h] [bp-Ch]@12 int i; // [sp+84h] [bp-8h]@1 int buildingId; // [sp+88h] [bp-4h]@7 for ( i = 0; i < 10; ++i ) v2[i] = city_inform[ciid].labor_category_priority[i].workersAllocated < city_inform[ciid].labor_category_priority[i].numWorkersNeeded; for ( buildingId = 1; buildingId < 2000; ++buildingId ) { if ( buildings[buildingId].inUse == 1 ) { v3 = laborCategoryForBuildingId[buildings[buildingId].type]; if ( v3 >= 0 ) { if ( v3 != 3 ) { buildings[buildingId].num_workers = 0; if ( !v3 || v3 == 1 ) { if ( fun_isIndustryForBuildingEnabled(buildingId) ) continue; LABEL_25: if ( buildings[buildingId].workersEffectivity > 0 ) { if ( v2[v3] ) { v1 = fun_adjustWithPercentage( city_inform[ciid].labor_category_priority[v3].workersAllocated, buildings[buildingId].workersEffectivity) / 100; if ( v1 >= model_buildings[buildings[buildingId].type].laborers ) v1 = model_buildings[buildings[buildingId].type].laborers; buildings[buildingId].num_workers = v1; v2[v3] += v1; } else { buildings[buildingId].num_workers = model_buildings[ buildings[buildingId].type].laborers; } } continue; } if ( v3 != 6 || buildings[buildingId].type != 32 || !buildings[buildingId].warehouse_prevStorage ) goto LABEL_25; } } } } for ( i = 0; i < 10; ++i ) { if ( v2[i] ) --v2[i]; } for ( i = 0; i < 10; ++i ) { if ( v2[i] >= city_inform[ciid].labor_category_priority[i].workersAllocated ) v2[i] = 0; else v2[i] = city_inform[ciid].labor_category_priority[i].workersAllocated - v2[i]; } buildingId = 1; while ( 2 ) { if ( buildingId < 2000 ) { if ( buildings[buildingId].inUse != 1 || (v3 = laborCategoryForBuildingId[buildings[buildingId].type], v3 < 0) || v3 == 3 || v3 == 5 ) goto LABEL_45; if ( v3 && v3 != 1 ) { if ( v3 == 6 && buildings[buildingId].type == 32 && buildings[buildingId].warehouse_prevStorage ) goto LABEL_45; } else { if ( fun_isIndustryForBuildingEnabled(buildingId) ) { LABEL_45: ++buildingId; continue; } } if ( buildings[buildingId].workersEffectivity > 0 ) { if ( v2[v3] ) { if ( buildings[buildingId].num_workers < model_buildings[buildings[buildingId].type].laborers ) { v0 = model_buildings[buildings[buildingId].type].laborers - buildings[buildingId].num_workers; if ( v0 > v2[v3] ) { buildings[buildingId].num_workers += LOWORD(v2[v3]); v2[v3] = 0; } else { buildings[buildingId].num_workers = model_buildings[buildings[buildingId].type].laborers; v2[v3] -= v0; } } } } goto LABEL_45; } break; } } void sub_456910() { int v0; // [sp+4Ch] [bp-1Ch]@2 int v1; // [sp+54h] [bp-14h]@1 int v2; // [sp+58h] [bp-10h]@1 signed int v3; // [sp+60h] [bp-8h]@4 signed int v4; // [sp+64h] [bp-4h]@4 v2 = 100 - getPercentage( city_inform[ciid].labor_categoryWater_workersAllocated, city_inform[ciid].labor_categoryWater_numWorkersNeeded ); v1 = fun_adjustWithPercentage(city_inform[ciid].labor_categoryWater_priority, v2); if ( city_inform[ciid].labor_categoryWater_priority == v1 ) _LOWORD(v0) = 1; else v0 = city_inform[ciid].labor_categoryWater_workersAllocated / (city_inform[ciid].labor_categoryWater_priority - v1); v4 = dword_5F998C; dword_5F998C = 0; v3 = 1; while ( v3 < 2000 ) { if ( v4 >= 2000 ) v4 = 1; if ( buildings[v4].inUse == 1 ) { if ( laborCategoryForBuildingId[buildings[v4].type] == 3 ) { buildings[v4].num_workers = 0; if ( buildings[v4].workersEffectivity > 0 ) { if ( v2 > 0 ) { if ( v1 ) { --v1; } else { if ( dword_5F998C ) { buildings[v4].num_workers = v0; } else { dword_5F998C = v4; buildings[v4].num_workers = v0; } } } else { buildings[v4].num_workers = model_buildings[buildings[v4].type].laborers; } } } } ++v3; ++v4; } if ( !dword_5F998C ) dword_5F998C = 1; } void empty_456B60() { ; } void fun_decayService_taxCollector() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_taxcollector ) --buildings[i].house_taxcollector; } } } void fun_collectMonthlyTaxes() { int collectedPatricians; // eax@29 int collectedPatricians2; // ST54_4@29 int collectedPlebs; // eax@29 int totalCollectedTax; // ST54_4@29 int tax; // [sp+4Ch] [bp-14h]@18 int trm; // [sp+50h] [bp-10h]@14 bool isPatrician; // [sp+54h] [bp-Ch]@12 signed int i; // [sp+58h] [bp-8h]@1 signed int j; // [sp+5Ch] [bp-4h]@4 city_inform[ciid].numPlebsTaxed = 0; city_inform[ciid].numPatriciansTaxed= 0; city_inform[ciid].numPlebsNotTaxed = 0; city_inform[ciid].numPatriciansNotTaxed = 0; city_inform[ciid].uncollectedTaxFromPlebs = 0; city_inform[ciid].collectedTaxFromPlebs = 0; city_inform[ciid].uncollectedTaxFromPatricians = 0; city_inform[ciid].collectedTaxFromPatricians = 0; for ( i = 0; i < 20; ++i ) city_inform[ciid].societyGraph[i] = 0; for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].house_size ) { isPatrician = buildings[j].level_resourceId >= 12; trm = fun_adjustWithPercentage( model_houses[buildings[j].level_resourceId].tax, difficulty_moneypct[setting_difficulty]); city_inform[ciid].societyGraph[ buildings[j].level_resourceId] += buildings[j].house_population; if ( buildings[j].house_taxcollector ) { if ( isPatrician ) city_inform[ciid].numPatriciansTaxed+= buildings[j].house_population; else city_inform[ciid].numPlebsTaxed += buildings[j].house_population; tax = buildings[j].house_population * trm; building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * j] += tax; if ( isPatrician ) city_inform[ciid].collectedTaxFromPatricians += tax; else city_inform[ciid].collectedTaxFromPlebs += tax; } else { if ( isPatrician ) city_inform[ciid].numPatriciansNotTaxed += buildings[j].house_population; else city_inform[ciid].numPlebsNotTaxed += buildings[j].house_population; if ( isPatrician ) city_inform[ciid].uncollectedTaxFromPatricians += buildings[j].house_population * trm; else city_inform[ciid].uncollectedTaxFromPlebs += buildings[j].house_population * trm; } } } } collectedPatricians = fun_adjustWithPercentage( city_inform[ciid].collectedTaxFromPatricians / 2, city_inform[ciid].taxrate); city_inform[ciid].yearlyTaxFromPatricians += collectedPatricians; collectedPatricians2 = collectedPatricians; collectedPlebs = fun_adjustWithPercentage( city_inform[ciid].collectedTaxFromPlebs / 2, city_inform[ciid].taxrate); city_inform[ciid].yearlyTaxFromPlebs += collectedPlebs; totalCollectedTax = collectedPlebs + collectedPatricians2; city_inform[ciid].yearlyUncollectedTaxFromPatricians += fun_adjustWithPercentage( city_inform[ciid].uncollectedTaxFromPatricians / 2, city_inform[ciid].taxrate); city_inform[ciid].yearlyUncollectedTaxFromPlebs += fun_adjustWithPercentage( city_inform[ciid].uncollectedTaxFromPlebs / 2, city_inform[ciid].taxrate); city_inform[ciid].treasury += totalCollectedTax; city_inform[ciid].percentagePlebsRegisteredForTax = getPercentage( city_inform[ciid].numPlebsTaxed, city_inform[ciid].numPlebsNotTaxed + city_inform[ciid].numPlebsTaxed); city_inform[ciid].percentagePatriciansRegisteredForTax = getPercentage( city_inform[ciid].numPatriciansTaxed, city_inform[ciid].numPatriciansNotTaxed + city_inform[ciid].numPatriciansTaxed); city_inform[ciid].percentageRegisteredForTax = getPercentage( city_inform[ciid].numPlebsTaxed + city_inform[ciid].numPatriciansTaxed, city_inform[ciid].numPlebsNotTaxed + city_inform[ciid].numPlebsTaxed + city_inform[ciid].numPatriciansNotTaxed + city_inform[ciid].numPatriciansTaxed); } void fun_updateFinanceTaxes() { int v0; // ST5C_4@16 int v1; // ST5C_4@16 int v2; // [sp+54h] [bp-Ch]@11 bool v3; // [sp+58h] [bp-8h]@9 signed int i; // [sp+5Ch] [bp-4h]@1 city_inform[ciid].collectedTaxFromPlebs = 0; city_inform[ciid].collectedTaxFromPatricians = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { v3 = buildings[i].level_resourceId >= 12; v2 = fun_adjustWithPercentage( model_houses[buildings[i].level_resourceId].tax, difficulty_moneypct[setting_difficulty]); if ( buildings[i].house_taxcollector ) { if ( v3 ) city_inform[ciid].collectedTaxFromPatricians +=buildings[i].house_population * v2; else city_inform[ciid].collectedTaxFromPlebs +=buildings[i].house_population * v2; } } } } v0 = fun_adjustWithPercentage(city_inform[ciid].collectedTaxFromPatricians / 2, city_inform[ciid].taxrate); v1 = (11 - gametime_month + 1) * (fun_adjustWithPercentage(city_inform[ciid].collectedTaxFromPlebs / 2, city_inform[ciid].taxrate) + v0); city_inform[ciid].finance_taxes_thisyear = city_inform[ciid].yearlyTaxFromPlebs + city_inform[ciid].yearlyTaxFromPatricians; city_inform[ciid].estimatedTaxIncome = v1 + city_inform[ciid].finance_taxes_thisyear; } void fun_copyFinanceTaxesToLastYear() { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].finance_taxes_lastyear = city_inform[ciid].yearlyTaxFromPlebs + city_inform[ciid].yearlyTaxFromPatricians; city_inform[ciid].yearlyTaxFromPlebs = 0; city_inform[ciid].yearlyTaxFromPatricians = 0; city_inform[ciid].yearlyUncollectedTaxFromPlebs = 0; city_inform[ciid].yearlyUncollectedTaxFromPatricians = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = 0; } } } void fun_payMonthlyWages() { int wagesThisMonth; // ST4C_4@1 wagesThisMonth = city_inform[ciid].wages * city_inform[ciid].numEmployedWorkers / 10 / 12; city_inform[ciid].treasury -= wagesThisMonth; city_inform[ciid].finance_wages_sofar_thisyear += wagesThisMonth; city_inform[ciid].wageTotal_thisyear += city_inform[ciid].wages; } void fun_payMonthlyInterest() { signed int interest; // eax@3 if ( city_inform[ciid].treasury < 0 ) { interest = fun_adjustWithPercentage(-city_inform[ciid].treasury, 10); city_inform[ciid].treasury -= interest / 12; city_inform[ciid].finance_interest_sofar_thisyear += interest / 12; } } void fun_payMonthlySalary() { if ( city_inform[ciid].treasury > -5000 ) { city_inform[ciid].finance_salary_sofar_thisyear += city_inform[ciid].salary_amount; city_inform[ciid].personalSavings += city_inform[ciid].salary_amount; city_inform[ciid].treasury -= city_inform[ciid].salary_amount; } } void fun_copyFinanceWagesToLastYear() { city_inform[ciid].finance_wages_lastyear = city_inform[ciid].finance_wages_sofar_thisyear; city_inform[ciid].finance_wages_sofar_thisyear = 0; city_inform[ciid].wageTotal_lastyear = city_inform[ciid].wageTotal_thisyear; city_inform[ciid].wageTotal_thisyear = 0; } void fun_copyFinanceImportExportToLastYear() { city_inform[ciid].finance_exports_lastyear = city_inform[ciid].finance_exports_thisyear; city_inform[ciid].finance_exports_thisyear = 0; city_inform[ciid].finance_imports_lastyear = city_inform[ciid].finance_imports_thisyear; city_inform[ciid].finance_imports_thisyear = 0; } void fun_copyFinanceConstructionToLastYear() { city_inform[ciid].finance_construction_lastyear = city_inform[ciid].finance_construction_thisyear; city_inform[ciid].finance_construction_thisyear = 0; } void fun_copyFinanceInterestToLastYear() { city_inform[ciid].finance_interest_lastyear = city_inform[ciid].finance_interest_sofar_thisyear; city_inform[ciid].finance_interest_sofar_thisyear = 0; } void fun_copyFinanceSalaryToLastYear() { city_inform[ciid].finance_salary_lastyear = city_inform[ciid].finance_salary_sofar_thisyear; city_inform[ciid].finance_salary_sofar_thisyear = 0; } void fun_copyFinanceSundriesToLastYear() { city_inform[ciid].finance_sundries_lastyear = city_inform[ciid].finance_sundries_thisyear; city_inform[ciid].finance_sundries_thisyear = 0; city_inform[ciid].moneyStolenLastYear = city_inform[ciid].moneyStolenThisYear; city_inform[ciid].moneyStolenThisYear = 0; } void fun_calculateTribute() { int v0; // ST5C_4@23 int v1; // [sp+4Ch] [bp-10h]@21 int expenses; // [sp+54h] [bp-8h]@1 int income; // [sp+58h] [bp-4h]@1 city_inform[ciid].finance_donated_lastyear = city_inform[ciid].finance_donated_thisyear; city_inform[ciid].finance_donated_thisyear = 0; city_inform[ciid].tributeNotPaid = 0; income = city_inform[ciid].finance_donated_lastyear + city_inform[ciid].finance_taxes_lastyear + city_inform[ciid].finance_exports_lastyear; expenses = city_inform[ciid].finance_sundries_lastyear + city_inform[ciid].finance_salary_lastyear + city_inform[ciid].finance_interest_lastyear + city_inform[ciid].finance_construction_lastyear + city_inform[ciid].finance_wages_lastyear + city_inform[ciid].finance_imports_lastyear; if ( city_inform[ciid].treasury > 0 ) { if ( income > expenses ) { city_inform[ciid].tributeNotPaidYears = 0; if ( city_inform[ciid].population < 5001 ) { if ( city_inform[ciid].population < 3001 ) { if ( city_inform[ciid].population < 2001 ) { if ( city_inform[ciid].population < 1001 ) { if ( city_inform[ciid].population < 501 ) city_inform[ciid].finance_tribute_lastyear = 50; else city_inform[ciid].finance_tribute_lastyear = 150; } else { city_inform[ciid].finance_tribute_lastyear = 225; } } else { city_inform[ciid].finance_tribute_lastyear = 300; } } else { city_inform[ciid].finance_tribute_lastyear= 400; } } else { city_inform[ciid].finance_tribute_lastyear = 500; } v1 = fun_adjustWithPercentage(income - expenses, 25); if ( v1 > city_inform[ciid].finance_tribute_lastyear ) city_inform[ciid].finance_tribute_lastyear = v1; } else { city_inform[ciid].tributeNotPaidYears = 0; if ( city_inform[ciid].population < 2001 ) { if ( city_inform[ciid].population < 1001 ) city_inform[ciid].finance_tribute_lastyear = 0; else city_inform[ciid].finance_tribute_lastyear = 100; } else { city_inform[ciid].finance_tribute_lastyear = 200; } } } else { city_inform[ciid].tributeNotPaid = 1; ++city_inform[ciid].tributeNotPaidYears; city_inform[ciid].finance_tribute_lastyear = 0; } city_inform[ciid].treasury -= city_inform[ciid].finance_tribute_lastyear; v0 = city_inform[ciid].finance_tribute_lastyear + expenses; fun_calculateTributeThisYear(); city_inform[ciid].finance_balance_lastyear = city_inform[ciid].treasury; city_inform[ciid].finance_totalIncome_lastyear = income; city_inform[ciid].finance_totalExpenses_lastyear = v0; } void fun_calculateTributeThisYear() { int v0; // [sp+4Ch] [bp-4h]@21 if ( city_inform[ciid].treasury > 0 ) { if ( city_inform[ciid].finance_netInOut_thisyear > 0 ) { if ( city_inform[ciid].population < 5001 ) { if ( city_inform[ciid].population < 3001 ) { if ( city_inform[ciid].population < 2001 ) { if ( city_inform[ciid].population < 1001 ) { if ( city_inform[ciid].population < 501 ) city_inform[ciid].finance_tribute_thisyear = 50; else city_inform[ciid].finance_tribute_thisyear = 150; } else { city_inform[ciid].finance_tribute_thisyear = 225; } } else { city_inform[ciid].finance_tribute_thisyear = 300; } } else { city_inform[ciid].finance_tribute_thisyear = 400; } } else { city_inform[ciid].finance_tribute_thisyear = 500; } v0 = fun_adjustWithPercentage(city_inform[ciid].finance_netInOut_thisyear, 25); if ( v0 > city_inform[ciid].finance_tribute_thisyear ) city_inform[ciid].finance_tribute_thisyear = v0; } else { if ( city_inform[ciid].population < 2001 ) { if ( city_inform[ciid].population < 1001 ) city_inform[ciid].finance_tribute_thisyear = 0; else city_inform[ciid].finance_tribute_thisyear = 100; } else { city_inform[ciid].finance_tribute_thisyear = 200; } } } else { city_inform[ciid].finance_tribute_thisyear = 0; } city_inform[ciid].finance_tribute_thisyear = 0; } void fun_updateWageCostsAndEstimate() { int v0; // ST50_4@1 v0 = city_inform[ciid].wages * city_inform[ciid].numEmployedWorkers / 10 / 12; city_inform[ciid].finance_wages_thisyear = city_inform[ciid].finance_wages_sofar_thisyear; city_inform[ciid].estimatedWageCost = (11 - gametime_month + 1) * v0 + city_inform[ciid].finance_wages_sofar_thisyear; } void fun_updateFinanceInterest() { city_inform[ciid].finance_interest_thisyear = city_inform[ciid].finance_interest_sofar_thisyear; } void fun_updateFinanceSalary() { city_inform[ciid].finance_salary_thisyear = city_inform[ciid].finance_salary_sofar_thisyear; } void fun_calculateFinanceTotals() { city_inform[ciid].finance_totalIncome_thisyear = city_inform[ciid].finance_donated_thisyear + city_inform[ciid].finance_taxes_thisyear + city_inform[ciid].finance_exports_thisyear; city_inform[ciid].finance_totalExpenses_thisyear = city_inform[ciid].finance_sundries_thisyear + city_inform[ciid].finance_salary_thisyear + city_inform[ciid].finance_interest_thisyear + city_inform[ciid].finance_construction_thisyear + city_inform[ciid].finance_wages_thisyear + city_inform[ciid].finance_imports_thisyear; city_inform[ciid].finance_netInOut_lastyear = city_inform[ciid].finance_totalIncome_lastyear - city_inform[ciid].finance_totalExpenses_lastyear; city_inform[ciid].finance_netInOut_thisyear = city_inform[ciid].finance_totalIncome_thisyear - city_inform[ciid].finance_totalExpenses_thisyear; city_inform[ciid].finance_balance_thisyear = city_inform[ciid].finance_netInOut_thisyear + city_inform[ciid].finance_balance_lastyear; } void fun_updateHighestInUseBuildingId() { signed int i; // [sp+4Ch] [bp-4h]@1 buildingId_highestInUse = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse ) buildingId_highestInUse = i; } if ( buildingId_highestInUse > buildingId_highestInUseEver ) buildingId_highestInUseEver = buildingId_highestInUse; } void unused_458A40() { ; } int unused_458A60() { return 0; } void sub_458A80() { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= 1; ++i ) { if ( city_inform[ciid].byte_6500A2_always1 ) sub_458B40(i); } } signed int sub_458AE0(int ciid, int resourceId) { signed int result; // eax@2 if ( city_inform[ciid].resourceAmountExported[ resourceId ] ) { result = 1; } else { if ( city_inform[ciid].resourceAmountExported[0] ) result = 1; else result = 0; } return result; } void sub_458B40(int ciid) { __int16 v1; // ST5C_2@22 int v2; // [sp+4Ch] [bp-10h]@18 signed int i; // [sp+54h] [bp-8h]@1 signed int j; // [sp+58h] [bp-4h]@4 signed int k; // [sp+58h] [bp-4h]@13 for ( i = 0; i < 16; ++i ) { city_inform[ciid].resourceAmountExported[ i] = 0; city_inform[ciid].resourceInStock[i] = 0; } for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Warehouse ) { buildings[j].hasRoadAccess = 0; if ( determineAccessRoad( buildings[j].x, buildings[j].y, buildings[j].size) ) { buildings[j].hasRoadAccess = 1; } else { if ( determineAccessRoad(buildings[j].x, buildings[j].y, 3) ) buildings[j].hasRoadAccess = 2; } } } } for ( k = 1; k < MAX_BUILDINGS; ++k ) { if ( buildings[k].inUse == 1 ) { if ( buildings[k].type == B_WarehouseSpace ) { v2 = sub_4789E0(k); if ( buildings[v2].hasRoadAccess ) { buildings[k].hasRoadAccess = buildings[v2].hasRoadAccess; if ( buildings[k].level_resourceId ) { v1 = buildings[k].industry_unitsStored; city_inform[ciid].resourceAmountExported[ buildings[k].level_resourceId] += 4 - v1; city_inform[ciid].resourceInStock[ buildings[k].level_resourceId] += v1; } else { city_inform[ciid].resourceAmountExported[0] += 4; } } } } } } signed int sub_458E80(int a1, int a2, int a3, int a4, int a5, int a6) { int v7; // [sp+4Ch] [bp-20h]@14 signed int v8; // [sp+50h] [bp-1Ch]@1 signed int v9; // [sp+54h] [bp-18h]@1 signed int v10; // [sp+58h] [bp-14h]@21 int v11; // [sp+60h] [bp-Ch]@12 int v12; // [sp+64h] [bp-8h]@31 signed int i; // [sp+68h] [bp-4h]@1 v9 = 10000; v8 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == B_WarehouseSpace ) { if ( buildings[i].hasRoadAccess ) { if ( buildings[i].haveRomeroad > 0 ) { if ( buildings[i].haveRoadnet == a6 ) { v11 = sub_4789E0(i); if ( a1 != v11 ) { v7 = buildings[v11].storageId; if ( storages[v7].resourceState[a4] != 1 ) { if ( !storages[v7].emptyAll ) { if ( getPercentage( buildings[v11].num_workers, model_buildings[buildings[v11].type].laborers ) >= 100 ) { if ( buildings[i].level_resourceId ) { if ( buildings[i].level_resourceId != a4 || buildings[i].industry_unitsStored >= 4 ) v10 = 0; else v10 = sub_45C3E0( buildings[i].x, buildings[i].y, a2, a3, a5, buildings[i].haveRomeroad); } else { v10 = sub_45C3E0( buildings[i].x, buildings[i].y, a2, a3, a5, buildings[i].haveRomeroad); } if ( v10 > 0 ) { if ( v10 < v9 ) { v9 = v10; v8 = i; } } } else { ++dword_862D40; } } } } } } } } } } v12 = sub_4789E0(v8); if ( buildings[v12].hasRoadAccess == 1 ) { walkerGridX = buildings[v12].x; walkerGridY = buildings[v12].y; } else { if ( !determineAccessRoad(buildings[v12].x, buildings[v12].y, 3) ) return 0; } return v8; } signed int fun_addGoodToWarehouse(int ciid, int buildingId, int resourceId) { signed int result; // eax@2 signed int v4; // [sp+4Ch] [bp-10h]@1 signed int i; // [sp+50h] [bp-Ch]@11 v4 = 0; if ( buildingId > 0 ) { if ( buildings[buildingId].level_resourceId ) { if ( buildings[buildingId].level_resourceId != resourceId ) v4 = 1; } if ( buildings[buildingId].industry_unitsStored >= 4 ) v4 = 1; if ( buildings[buildingId].type == B_Warehouse ) v4 = 1; if ( !v4 ) goto LABEL_31; buildingId = sub_4789E0(buildingId); for ( i = 0; ; ++i ) { if ( i < 8 ) { buildingId = buildings[buildingId].warehouse_nextStorage; if ( buildingId <= 0 ) return 0; if ( buildings[buildingId].level_resourceId && buildings[buildingId].level_resourceId != resourceId || buildings[buildingId].industry_unitsStored >= 4 ) continue; } break; } if ( i >= 8 ) { result = 0; } else { LABEL_31: --city_inform[ciid].resourceAmountExported[ resourceId ]; ++city_inform[ciid].resourceInStock[ resourceId]; buildings[buildingId].level_resourceId = resourceId; ++buildings[buildingId].industry_unitsStored; if ( city_inform[ciid].stock_pottery >= 1 ) { if ( !tutorial2_potteryMade ) { tutorial2_potteryMade = 1; tutorial2_potteryMadeYear = gametime_year; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(61, 0, 0); // trade } } grid_graphicIds[buildings[buildingId].gridOffset] = fun_getResourceGraphicIdOffset(resourceId, 0) + word_6E6C58 + 4 * resourceId - 4 + buildings[buildingId].industry_unitsStored - 1; result = 1; } } else { result = 0; } return result; } void fun_refundGoods(int ciid, int resourceId, int amount) { signed int i; // [sp+4Ch] [bp-8h]@1 int buildingId; // [sp+50h] [bp-4h]@1 buildingId = city_inform[ciid].warehouse_nextTakeGoods; for ( i = 1; i < 2000 && amount > 0; ++i ) { ++buildingId; if ( buildingId >= 2000 ) buildingId = 1; if ( buildings[buildingId].inUse == 1 ) { if ( buildings[buildingId].type == B_Warehouse ) { city_inform[ciid].warehouse_nextTakeGoods = buildingId; while ( amount && fun_addGoodToWarehouse(ciid, buildingId, resourceId) ) --amount; } } } } int fun_removeGoodsFromCityStorage(int ciid, int goodId, int amount) { int requestedAmount; // [sp+50h] [bp-Ch]@1 signed int i; // [sp+54h] [bp-8h]@1 signed int j; // [sp+54h] [bp-8h]@15 signed int buildingId; // [sp+58h] [bp-4h]@1 requestedAmount = amount; buildingId = city_inform[ciid].warehouse_nextTakeGoods; for ( i = 1; i < 2000 && amount > 0; ++i ) { ++buildingId; if ( buildingId >= 2000 ) buildingId = 1; if ( buildings[buildingId].inUse == 1 ) { if ( buildings[buildingId].type == B_Warehouse ) { if ( storages[buildings[buildingId].storageId].resourceState[goodId] != 2 ) { city_inform[ciid].warehouse_nextTakeGoods = buildingId; amount = fun_removeGoodFromWarehouse(ciid, buildingId, goodId, amount); } } } } for ( j = 1; j < 2000 && amount > 0; ++j ) { ++buildingId; if ( buildingId >= 2000 ) buildingId = 1; if ( buildings[buildingId].inUse == 1 ) { if ( buildings[buildingId].type == B_Warehouse ) { city_inform[ciid].warehouse_nextTakeGoods = buildingId; amount = fun_removeGoodFromWarehouse(ciid, buildingId, goodId, amount); } } } return requestedAmount - amount; } signed int fun_removeGoodFromWarehouse(int ciid, int buildingId, int resourceId, signed int amount) { signed int result; // eax@2 int graphicId; // [sp+4Ch] [bp-Ch]@18 int v6; // [sp+50h] [bp-8h]@17 signed int i; // [sp+54h] [bp-4h]@3 if ( buildings[buildingId].type == B_Warehouse ) { for ( i = 0; i < 8; ++i ) { if ( amount <= 0 ) return 0; buildingId = buildings[buildingId].warehouse_nextStorage; if ( buildingId > 0 ) { if ( buildings[buildingId].level_resourceId == resourceId ) { if ( buildings[buildingId].industry_unitsStored > 0 ) { if ( buildings[buildingId].industry_unitsStored > amount ) { city_inform[ciid].resourceAmountExported[resourceId] += amount; city_inform[ciid].resourceInStock[ resourceId] -= amount; buildings[buildingId].industry_unitsStored -= amount; amount = 0; } else { city_inform[ciid].resourceAmountExported[resourceId] += buildings[buildingId].industry_unitsStored; city_inform[ciid].resourceInStock[ resourceId] -= buildings[buildingId].industry_unitsStored; amount -= buildings[buildingId].industry_unitsStored; buildings[buildingId].industry_unitsStored = 0; buildings[buildingId].level_resourceId = 0; } v6 = buildings[buildingId].gridOffset; if ( buildings[buildingId].industry_unitsStored <= 0 ) _LOWORD(graphicId) = graphic_emptyWarehouseTile; else graphicId = fun_getResourceGraphicIdOffset(resourceId, 0) + word_6E6C58 + 4 * resourceId - 4 + buildings[buildingId].industry_unitsStored - 1; grid_graphicIds[v6] = graphicId; } } } } result = amount; } else { result = amount; } return result; } void fun_removeGoodsFromWarehouseForMercury(int buildingId, signed int amount) { int v2; // [sp+4Ch] [bp-10h]@16 int v3; // [sp+50h] [bp-Ch]@15 int v4; // [sp+54h] [bp-8h]@12 signed int i; // [sp+58h] [bp-4h]@3 if ( buildings[buildingId].type == B_Warehouse ) { for ( i = 0; i < 8 && amount > 0; ++i ) { buildingId = buildings[buildingId].warehouse_nextStorage; if ( buildingId > 0 ) { if ( buildings[buildingId].industry_unitsStored > 0 ) { v4 = buildings[buildingId].level_resourceId; if ( buildings[buildingId].industry_unitsStored > amount ) { city_inform[ciid].resourceAmountExported[ v4] += amount; city_inform[ciid].resourceInStock[ v4] -= amount; buildings[buildingId].industry_unitsStored -= amount; amount = 0; } else { city_inform[ciid].resourceAmountExported[ v4] += buildings[buildingId].industry_unitsStored; city_inform[ciid].resourceInStock[v4] -= buildings[buildingId].industry_unitsStored; amount -= buildings[buildingId].industry_unitsStored; buildings[buildingId].industry_unitsStored = 0; buildings[buildingId].level_resourceId = 0; } v3 = buildings[buildingId].gridOffset; if ( buildings[buildingId].industry_unitsStored <= 0 ) _LOWORD(v2) = graphic_emptyWarehouseTile; else v2 = fun_getResourceGraphicIdOffset(v4, 0) + word_6E6C58 + 4 * v4 - 4 + buildings[buildingId].industry_unitsStored - 1; grid_graphicIds[v3] = v2; } } } } } signed int sub_459DD0(int a1, int a2) { signed int result; // eax@26 int v3; // [sp+4Ch] [bp-24h]@8 signed int v4; // [sp+50h] [bp-20h]@1 signed int v5; // [sp+54h] [bp-1Ch]@1 int v6; // [sp+58h] [bp-18h]@20 int v7; // [sp+58h] [bp-18h]@22 int v8; // [sp+5Ch] [bp-14h]@8 signed int v9; // [sp+60h] [bp-10h]@8 signed int j; // [sp+64h] [bp-Ch]@8 signed int i; // [sp+6Ch] [bp-4h]@1 v5 = 10000; v4 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == B_Warehouse ) { if ( i != a1 ) { v8 = 0; v9 = i; v3 = buildings[i].storageId; for ( j = 0; j < 8; ++j ) { v9 = buildings[v9].warehouse_nextStorage; if ( v9 > 0 ) { if ( buildings[v9].industry_unitsStored > 0 ) { if ( buildings[v9].level_resourceId == a2 ) v8 += buildings[v9].industry_unitsStored; } } } if ( v8 > 0 ) { v6 = sub_45C3E0( buildings[i].x, buildings[i].y, buildings[a1].x, buildings[a1].y, buildings[a1].haveRomeroad, buildings[i].haveRomeroad); if ( storages[v3].resourceState[a2] != 2 ) { v7 = v6 - 4 * v8; if ( v7 < v5 ) { v5 = v7; v4 = i; } } } } } } } if ( v4 > 0 ) { walkerGridX = buildings[v4].enter_x; walkerGridY = buildings[v4].enter_y; result = v4; } else { result = 0; } return result; } signed int sub_45A040(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-24h]@1 signed int v3; // [sp+50h] [bp-20h]@20 signed int v4; // [sp+54h] [bp-1Ch]@10 int v5; // [sp+5Ch] [bp-14h]@10 int whNextStorId; // [sp+5Ch] [bp-14h]@20 int v7; // [sp+5Ch] [bp-14h]@39 int v8; // [sp+5Ch] [bp-14h]@51 int v9; // [sp+5Ch] [bp-14h]@77 int v10; // [sp+5Ch] [bp-14h]@103 int v11; // [sp+5Ch] [bp-14h]@125 signed int j; // [sp+60h] [bp-10h]@10 signed int k; // [sp+60h] [bp-10h]@20 signed int jj; // [sp+60h] [bp-10h]@125 signed int i; // [sp+64h] [bp-Ch]@3 signed int l; // [sp+64h] [bp-Ch]@39 signed int m; // [sp+64h] [bp-Ch]@51 signed int n; // [sp+64h] [bp-Ch]@77 signed int ii; // [sp+64h] [bp-Ch]@103 signed int v20; // [sp+68h] [bp-8h]@61 signed int v21; // [sp+6Ch] [bp-4h]@98 v2 = buildings[a1].storageId; if ( getPercentage(buildings[a1].num_workers, model_buildings[buildings[a1].type].laborers) >= 50 ) { for ( i = 1; i < 16; ++i ) { if ( storages[v2].resourceState[i] == 2 ) { if ( !city_inform[ciid].resourceStockpile[ i ] ) { v4 = 0; v5 = a1; for ( j = 0; j < 8; ++j ) { v5 = buildings[v5].warehouse_nextStorage; if ( v5 > 0 ) { if ( buildings[v5].industry_unitsStored > 0 ) { if ( buildings[v5].level_resourceId == i ) v4 += buildings[v5].industry_unitsStored; } } } v3 = 0; whNextStorId = a1; for ( k = 0; k < 8; ++k ) { whNextStorId = buildings[whNextStorId].warehouse_nextStorage; if ( whNextStorId > 0 ) { if ( buildings[whNextStorId].industry_unitsStored <= 0 ) v3 += 4; if ( buildings[whNextStorId].level_resourceId == i ) v3 += 4 - buildings[whNextStorId].industry_unitsStored; } } if ( v3 >= 8 && v4 <= 4 && city_inform[ciid].resourceInStock[ i] - v4 > 4 ) { dword_94A318 = i; return 0; } } } } if ( numWorkingBarracks > 0 && buildings[city_inform[ciid].barracksBuildingId ].industry_unitsStored < 4 && city_inform[ciid].numLegionaryForts > 0 && buildings[a1].haveRoadnet == buildings[city_inform[ciid].barracksBuildingId].haveRoadnet ) { v7 = a1; for ( l = 0; l < 8; ++l ) { v7 = buildings[v7].warehouse_nextStorage; if ( v7 > 0 && buildings[v7].industry_unitsStored > 0 && !city_inform[ciid].resourceStockpile[ buildings[v7].level_resourceId ] && buildings[v7].level_resourceId == 13 ) return 13; } } v8 = a1; for ( m = 0; m < 8; ++m ) { v8 = buildings[v8].warehouse_nextStorage; if ( v8 > 0 ) { if ( buildings[v8].industry_unitsStored > 0 ) { if ( !city_inform[ciid].resourceStockpile[ buildings[v8].level_resourceId ] ) { switch ( buildings[v8].level_resourceId ) { case 4: v20 = 1; break; case 5: v20 = 2; break; case 9: v20 = 3; break; case 10: v20 = 4; break; default: v20 = buildings[v8].level_resourceId == 11 ? 5 : 0; break; } if ( v20 > 0 && city_inform[ciid].x_cityinfo_dword_652900[v20] > 0 ) return buildings[v8].level_resourceId; } } } } if ( sub_45D1F0() ) { v9 = a1; for ( n = 0; n < 8; ++n ) { v9 = buildings[v9].warehouse_nextStorage; if ( v9 > 0 && buildings[v9].industry_unitsStored > 0 && !city_inform[ciid].resourceStockpile[ buildings[v9].level_resourceId ] && buildings[v9].level_resourceId != 4 && buildings[v9].level_resourceId != 5 && buildings[v9].level_resourceId >= 1 && buildings[v9].level_resourceId <= 6 && dword_98C040[buildings[v9].level_resourceId] > 0 ) return buildings[v9].level_resourceId; } } if ( sub_45D000() ) v21 = 1; else v21 = 0; if ( scn_romeSuppliesWheat ) v21 = 0; if ( v21 ) { v10 = a1; for ( ii = 0; ii < 8; ++ii ) { v10 = buildings[v10].warehouse_nextStorage; if ( v10 > 0 && buildings[v10].industry_unitsStored > 0 && !city_inform[ciid].resourceStockpile[ buildings[v10].level_resourceId ] && buildings[v10].level_resourceId != 4 && buildings[v10].level_resourceId != 5 && buildings[v10].level_resourceId >= 1 && buildings[v10].level_resourceId <= 6 && dword_94BCC0[buildings[v10].level_resourceId] > 0 ) return buildings[v10].level_resourceId; } } if ( storages[v2].emptyAll ) { v11 = a1; for ( jj = 0; jj < 8; ++jj ) { v11 = buildings[v11].warehouse_nextStorage; if ( v11 > 0 && buildings[v11].industry_unitsStored > 0 ) return buildings[v11].level_resourceId; } result = -1; } else { result = -1; } } else { result = -1; } return result; } signed int sub_45A8D0(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-Ch]@1 signed int i; // [sp+54h] [bp-4h]@4 v2 = buildings[a1].storageId; if ( getPercentage(buildings[a1].num_workers, model_buildings[buildings[a1].type].laborers) >= 50 ) { if ( storages[v2].emptyAll ) { for ( i = 1; i < 7; ++i ) { if ( buildings[a1].granary_capacity[i] ) return i; } result = -1; } else { if ( buildings[a1].granary_capacity[0] > 0 ) { if ( storages[v2].stateWheat != 2 || dword_98BF84 <= 100 ) { if ( storages[v2].stateVegetables != 2 || dword_98BF88 <= 100 ) { if ( storages[v2].stateFruit != 2 || dword_98BF8C <= 100 ) { if ( storages[v2].stateMeatFish != 2 || dword_98BF98 <= 100 ) result = -1; else result = 0; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = -1; } } } else { result = -1; } return result; } signed int sub_45AA70(int a1, int a2, int a3, int a4) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-4h]@5 if ( buildings[a3].type == B_Warehouse ) { if ( walkers[a1].byte_7FA39F < 8 ) { for ( i = 0; i < 8; ++i ) { a3 = buildings[a3].warehouse_nextStorage; if ( a3 > 0 && buildings[a3].industry_unitsStored > 0 && fun_canExportGoodToCity(a2, a4, buildings[a3].level_resourceId) ) return 1; } result = 0; } else { result = 0; } } else { result = 0; } return result; } int sub_45AB50(int a1, int a2, int a3) { int result; // eax@1 int v4; // [sp+4Ch] [bp-10h]@17 int v5; // [sp+50h] [bp-Ch]@16 int v6; // [sp+54h] [bp-8h]@12 signed int i; // [sp+58h] [bp-4h]@3 result = a2 << 7; if ( buildings[a2].type == B_Warehouse ) { for ( i = 0; i < 8; ++i ) { result = a2 << 7; a2 = buildings[a2].warehouse_nextStorage; if ( a2 > 0 ) { result = buildings[a2].industry_unitsStored; if ( result > 0 ) { result = fun_canExportGoodToCity(a1, a3, buildings[a2].level_resourceId); if ( result ) { v6 = buildings[a2].level_resourceId; ++city_inform[2 * a1].resourceAmountExported[buildings[a2].level_resourceId]; --city_inform[2 * a1].resourceInStock[ buildings[a2].level_resourceId]; --buildings[a2].industry_unitsStored; if ( buildings[a2].industry_unitsStored <= 0 ) buildings[a2].level_resourceId = 0; city_inform[a1].treasury += tradeprices_sell[2 * v6]; city_inform[a1].finance_exports_thisyear += tradeprices_sell[2 * v6]; if ( city_inform[ciid].dword_6544F0 ) { city_inform[a1].treasury += tradeprices_sell[2 * v6]; city_inform[a1].finance_exports_thisyear += tradeprices_sell[2 * v6]; } v5 = buildings[a2].gridOffset; if ( buildings[a2].industry_unitsStored <= 0 ) _LOWORD(v4) = graphic_emptyWarehouseTile; else v4 = fun_getResourceGraphicIdOffset(buildings[a2].level_resourceId, 0) + word_6E6C58 + 4 * buildings[a2].level_resourceId - 4 + buildings[a2].industry_unitsStored - 1; grid_graphicIds[v5] = v4; return v6; } } } } } else { result = 0; } return result; } signed int sub_45AEB0(int a1, int a2, int a3, int a4) { signed int result; // eax@2 int v5; // [sp+4Ch] [bp-14h]@7 int v6; // [sp+50h] [bp-10h]@5 bool v7; // [sp+54h] [bp-Ch]@17 signed int v8; // [sp+54h] [bp-Ch]@19 signed int i; // [sp+5Ch] [bp-4h]@7 signed int j; // [sp+5Ch] [bp-4h]@19 signed int k; // [sp+5Ch] [bp-4h]@31 if ( buildings[a3].type == 72 ) { getPercentage(buildings[a3].num_workers, model_buildings[buildings[a3].type].laborers); if ( walkers[a1].byte_7FA3A3 < 8 ) { v6 = buildings[a3].storageId; if ( storages[v6].emptyAll ) { result = 0; } else { v5 = 0; for ( i = 1; i <= 15; ++i ) { if ( storages[v6].resourceState[i] != 1 ) { if ( canImportGoodFromCity(a2, a4, i) ) ++v5; } } if ( v5 > 0 ) { v7 = canImportGoodFromCity(a2, a4, city_inform[a2].dword_654220); if ( storages[v6].resourceState[city_inform[ciid].dword_654220] != 1 && v7 ) goto LABEL_46; v8 = 0; for ( j = 1; j <= 15; ++j ) { ++city_inform[a2].dword_654220; if ( city_inform[a2].dword_654220 > 15 ) city_inform[a2].dword_654220 = 1; if ( storages[v6].resourceState[city_inform[ciid].dword_654220] != 1 && canImportGoodFromCity(a2, a4, city_inform[a2].dword_654220) ) { v8 = 1; break; } } if ( v8 ) { LABEL_46: for ( k = 0; k < 8; ++k ) { a3 = buildings[a3].warehouse_nextStorage; if ( a3 > 0 && buildings[a3].industry_unitsStored < 4 ) { if ( !buildings[a3].industry_unitsStored ) return 1; if ( canImportGoodFromCity(a2, a4, buildings[a3].level_resourceId) ) return 1; } } result = 0; } else { result = 0; } } else { result = 0; } } } else { result = 0; } } else { result = 0; } return result; } int sub_45B220(int a1, int a2, int a3) { int result; // eax@2 int v4; // [sp+50h] [bp-Ch]@1 int v5; // [sp+54h] [bp-8h]@23 int v6; // [sp+54h] [bp-8h]@33 signed int i; // [sp+58h] [bp-4h]@3 signed int j; // [sp+58h] [bp-4h]@12 signed int k; // [sp+58h] [bp-4h]@26 signed int l; // [sp+58h] [bp-4h]@36 int v11; // [sp+68h] [bp+Ch]@26 int v12; // [sp+68h] [bp+Ch]@41 v4 = a2; if ( buildings[a2].type == 72 ) { for ( i = 1; i <= 15 && !canImportGoodFromCity(a1, a3, city_inform[a1].dword_654220); ++i ) { ++city_inform[a1].dword_654220; if ( city_inform[a1].dword_654220 > 15 ) city_inform[a1].dword_654220 = 1; } if ( i < 16 ) { for ( j = 0; j < 8; ++j ) { a2 = buildings[a2].warehouse_nextStorage; if ( a2 > 0 && buildings[a2].industry_unitsStored && buildings[a2].industry_unitsStored < 4 && buildings[a2].level_resourceId == city_inform[a1].dword_654220 ) { fun_importGoodAndAddToWarehouse(a1, a2, city_inform[a1].dword_654220); v5 = city_inform[a1].dword_654220++; if ( city_inform[a1].dword_654220 > 15 ) city_inform[a1].dword_654220 = 1; return v5; } } v11 = v4; for ( k = 0; k < 8; ++k ) { v11 = buildings[v11].warehouse_nextStorage; if ( v11 > 0 && !buildings[v11].industry_unitsStored ) { fun_importGoodAndAddToWarehouse(a1, v11, city_inform[a1].dword_654220); v6 = city_inform[a1].dword_654220++; if ( city_inform[a1].dword_654220 > 15 ) city_inform[a1].dword_654220 = 1; return v6; } } for ( l = 1; l <= 15; ++l ) { ++city_inform[a1].dword_654224; if ( city_inform[a1].dword_654224 > 15 ) city_inform[a1].dword_654224 = 1; if ( canImportGoodFromCity(a1, a3, city_inform[a1].dword_654224) ) { v12 = v4; for ( l = 0; l < 8; ++l ) { v12 = buildings[v12].warehouse_nextStorage; if ( v12 > 0 && buildings[v12].industry_unitsStored < 4 && buildings[v12].level_resourceId == city_inform[a1].dword_654224 ) { fun_importGoodAndAddToWarehouse(a1, v12, city_inform[a1].dword_654224); return city_inform[a1].dword_654224; } } } } result = 0; } else { result = 0; } } else { result = 0; } return result; } void fun_importGoodAndAddToWarehouse(int ciid, int buildingId, int resourceId) { --city_inform[ciid].resourceAmountExported[ resourceId]; ++city_inform[ciid].resourceInStock[resourceId]; ++buildings[buildingId].industry_unitsStored; buildings[buildingId].level_resourceId = resourceId; city_inform[ciid].treasury -= tradeprices_buy[2 * resourceId]; city_inform[ciid].finance_imports_thisyear += tradeprices_buy[2 * resourceId]; grid_graphicIds[buildings[buildingId].gridOffset] = fun_getResourceGraphicIdOffset(resourceId, 0) + word_6E6C58 + 4 * resourceId - 4 + buildings[buildingId].industry_unitsStored - 1; } int fun_getGoodAmountStoredInWarehouse(int buildingId, int good) { int units; // [sp+4Ch] [bp-8h]@1 signed int tiles; // [sp+50h] [bp-4h]@1 tiles = 0; units = 0; while ( tiles < 8 ) { buildingId = buildings[buildingId].warehouse_nextStorage; if ( buildingId <= 0 ) return 0; if ( buildings[buildingId].level_resourceId ) { if ( buildings[buildingId].level_resourceId == good ) units += buildings[buildingId].industry_unitsStored; } ++tiles; } return units; } signed int sub_45B920(int a1) { signed int result; // eax@5 int v2; // [sp+4Ch] [bp-Ch]@1 signed int v3; // [sp+50h] [bp-8h]@1 signed int v4; // [sp+54h] [bp-4h]@1 v4 = 0; v3 = 0; v2 = 0; while ( v4 < 8 ) { a1 = buildings[a1].warehouse_nextStorage; if ( a1 <= 0 ) return 0; if ( buildings[a1].level_resourceId ) v3 += buildings[a1].industry_unitsStored; else ++v2; ++v4; } if ( v2 <= 0 ) { if ( v3 < 32 ) result = 2; else result = 1; } else { result = 0; } return result; } signed int fun_getResourceGraphicIdOffset(int resourceId, int type) { signed int result; // eax@2 if ( resourceId == G_MeatFish ) { if ( scn_allow_wharves ) { if ( type ) { switch ( type ) { case 1: result = 648; break; case 2: result = 8; break; case 3: result = 11; break; default: result = 0; break; } } else { result = 40; } } else { result = 0; } } else { result = 0; } return result; } void fun_updateAdvisorFoodAndSupplyRomeWheat() { int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@6 for ( i = 1; i <= 1; ++i ) { if ( city_inform[ciid].byte_6500A2_always1 ) fun_gatherFoodInformation(i); } for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Market ) { if ( scn_romeSuppliesWheat ) buildings[j].granary_capacity[0] = 200; } } } } void fun_gatherFoodInformation(int ciid) { int v1; // [sp+4Ch] [bp-10h]@14 signed int v2; // [sp+4Ch] [bp-10h]@20 int percentageGranaryWorkers; // [sp+50h] [bp-Ch]@11 signed int i; // [sp+54h] [bp-8h]@1 signed int m; // [sp+54h] [bp-8h]@14 signed int k; // [sp+54h] [bp-8h]@20 signed int l; // [sp+54h] [bp-8h]@23 signed int n; // [sp+54h] [bp-8h]@32 signed int j; // [sp+58h] [bp-4h]@4 for ( i = 0; i < 7; ++i ) city_inform[ciid].foodInGranaries_wheat[i] = 0; city_inform[ciid].totalFoodStoredInGranaries = 0; city_inform[ciid].foodtypesEaten = 0; city_inform[ciid].foodSupplyMonths = 0; city_inform[ciid].granaries_3orMoreWorkers = 0; city_inform[ciid].granaries_understaffed = 0; city_inform[ciid].granaries_lessThan3Workers = 0; city_inform[ciid].granaries_lessThan3WorkersWithFoodStored = 0; for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Granary ) { buildings[j].hasRoadAccess = 0; if ( fun_granaryHasRoadAccess(buildings[j].x, buildings[j].y) ) { buildings[j].hasRoadAccess = 1; percentageGranaryWorkers = getPercentage( buildings[j].num_workers, model_buildings[buildings[j].type].laborers); if ( percentageGranaryWorkers < 100 ) ++city_inform[ciid].granaries_understaffed; if ( percentageGranaryWorkers >= 50 ) { v2 = 0; for ( k = 0; k < 7; ++k ) city_inform[ciid].foodInGranaries_wheat[k] += buildings[j].granary_capacity[k]; for ( l = 1; l < 7; ++l ) v2 += buildings[j].granary_capacity[l]; ++city_inform[ciid].granaries_3orMoreWorkers; if ( v2 > 400 ) { if ( !tutorial2_granaryBuilt ) { tutorial2_granaryBuilt = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(56, 0, 0);// providing water } } } else { v1 = 0; for ( m = 1; m < 7; ++m ) v1 += buildings[j].granary_capacity[m]; ++city_inform[ciid].granaries_lessThan3Workers; if ( v1 > 0 ) ++city_inform[ciid].granaries_lessThan3WorkersWithFoodStored; } } } } } for ( n = 1; n < 7; ++n ) { if ( city_inform[ciid].foodInGranaries_wheat[n] ) { city_inform[ciid].totalFoodStoredInGranaries += city_inform[ciid].foodInGranaries_wheat[n]; ++city_inform[ciid].foodtypesEaten; } } city_inform[ciid].unitsOfFoodNeededPerMonth = fun_adjustWithPercentage(city_inform[ciid].population, 50); if ( city_inform[ciid].unitsOfFoodNeededPerMonth > 0 ) city_inform[ciid].foodSupplyMonths = city_inform[ciid].totalFoodStoredInGranaries / city_inform[ciid].unitsOfFoodNeededPerMonth; else city_inform[ciid].foodSupplyMonths = city_inform[ciid].totalFoodStoredInGranaries > 0; if ( scn_romeSuppliesWheat ) { city_inform[ciid].foodtypesEaten = 1; city_inform[ciid].foodSupplyMonths = 12; } } int sub_45C100(int a1, int a2, int a3, signed int a4, int a5, int a6) { signed int result; // eax@2 int v7; // [sp+4Ch] [bp-1Ch]@26 signed int v8; // [sp+54h] [bp-14h]@13 signed int v9; // [sp+58h] [bp-10h]@13 signed int v10; // [sp+5Ch] [bp-Ch]@31 signed int i; // [sp+64h] [bp-4h]@13 if ( scn_romeSuppliesWheat ) { result = 0; } else { if ( a4 >= 1 && a4 <= 6 ) { if ( a4 == 4 ) { result = 0; } else { if ( a4 == 5 ) { result = 0; } else { if( !city_inform[ciid].resourceStockpile[ a4 ] || a1 ) { v9 = 10000; v8 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == 71 ) { if ( buildings[i].hasRoadAccess ) { if ( buildings[i].haveRomeroad > 0 ) { if ( buildings[i].haveRoadnet == a6 ) { if ( getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers) >= 100 ) { v7 = buildings[i].storageId; if ( storages[v7].resourceState[a4] != 1 ) { if ( !storages[v7].emptyAll ) { if ( buildings[i].granary_capacity[0] >= 100 ) { v10 = sub_45C3E0( buildings[i].x + 1, buildings[i].y + 1, a2, a3, a5, buildings[i].haveRomeroad); if ( v10 < v9 ) { v9 = v10; v8 = i; } } } } } else { ++dword_862D40; } } } } } } } walkerGridX = buildings[v8].x + 1; walkerGridY =buildings[v8].y + 1; result = v8; } else { result = 0; } } } } else { result = 0; } } return result; } int sub_45C3E0(int a1, int a2, int a3, int a4, int a5, int a6) { int v7; // [sp+4Ch] [bp-8h]@2 if ( a5 <= a6 ) v7 = a6 - a5; else v7 = a5 - a6; if ( a5 == -1 ) v7 = 0; return v7 + fun_getDistanceMaximum(a1, a2, a3, a4); } signed int sub_45C460(int a1, int a2, signed int a3, int a4, int a5) { signed int result; // eax@2 int v6; // [sp+4Ch] [bp-1Ch]@25 signed int v7; // [sp+54h] [bp-14h]@12 signed int v8; // [sp+58h] [bp-10h]@12 signed int v9; // [sp+5Ch] [bp-Ch]@30 signed int i; // [sp+64h] [bp-4h]@12 if ( scn_romeSuppliesWheat ) { result = 0; } else { if ( a3 >= 1 && a3 <= 6 ) { if ( a3 == 4 ) { result = 0; } else { if ( a3 == 5 ) { result = 0; } else { if ( city_inform[ciid].resourceStockpile[ a3 ] ) { result = 0; } else { v8 = 10000; v7 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == 71 ) { if ( buildings[i].hasRoadAccess ) { if ( buildings[i].haveRomeroad > 0 ) { if ( buildings[i].haveRoadnet == a5 ) { if ( getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers) >= 100 ) { v6 = buildings[i].storageId; if ( storages[v6].resourceState[a3] == 2 ) { if ( !storages[v6].emptyAll ) { if ( buildings[i].granary_capacity[0] > 100 ) { v9 = sub_45C3E0( buildings[i].x + 1, buildings[i].y + 1, a1, a2, a4, buildings[i].haveRomeroad); if ( v9 < v8 ) { v8 = v9; v7 = i; } } } } } } } } } } } walkerGridX = buildings[v7].x + 1; walkerGridY = buildings[v7].y + 1; result = v7; } } } } else { result = 0; } } return result; } int sub_45C720(int buildingId) { int result; // eax@10 signed int v2; // [sp+4Ch] [bp-24h]@1 int v3; // [sp+50h] [bp-20h]@15 signed int v4; // [sp+54h] [bp-1Ch]@15 signed int v5; // [sp+58h] [bp-18h]@34 signed int v6; // [sp+5Ch] [bp-14h]@20 int v7; // [sp+60h] [bp-10h]@20 int storageId; // [sp+64h] [bp-Ch]@1 int i; // [sp+68h] [bp-8h]@15 int v10; // [sp+6Ch] [bp-4h]@18 v2 = 0; storageId = buildings[buildingId].storageId; if ( storages[storageId].stateWheat == 2 ) v2 = 1; if ( storages[storageId].stateVegetables == 2 ) ++v2; if ( storages[storageId].stateFruit == 2 ) ++v2; if ( storages[storageId].stateMeatFish == 2 ) ++v2; if ( storages[storageId].emptyAll ) { result = 0; } else { if ( scn_romeSuppliesWheat ) { result = 0; } else { if ( v2 > 0 ) { v4 = 10000; v3 = 0; for ( i = 0; i < dword_94B3A0; ++i ) { v10 = word_94BBA0[i]; if ( buildings[v10].haveRoadnet == buildings[buildingId].haveRoadnet ) { v7 = buildings[v10].storageId; v6 = 0; if ( storages[storageId].stateWheat == 2 ) { if ( storages[v7].stateWheat != 2 ) v6 = buildings[v10].house_wheat; } if ( storages[storageId].stateVegetables == 2 ) { if ( storages[v7].stateVegetables != 2 ) v6 += buildings[v10].house_vegetables; } if ( storages[storageId].stateFruit == 2 ) { if ( storages[v7].stateFruit != 2 ) v6 += buildings[v10].house_wine; } if ( storages[storageId].stateMeatFish == 2 ) { if (storages[v7].stateMeatFish != 2 ) v6 += buildings[v10].house_pottery; } if ( v6 > 0 ) { v5 = sub_45C3E0( buildings[v10].x + 1, buildings[v10].y + 1, buildings[buildingId].x + 1, buildings[buildingId].x + 1, buildings[buildingId].haveRomeroad, buildings[v10].haveRomeroad); if ( v6 <= 400 ) v5 *= 2; if ( v5 < v4 ) { v4 = v5; v3 = v10; } } } } walkerGridX = buildings[v3].x + 1; walkerGridY = buildings[v3].y + 1; result = v3; } else { result = 0; } } } return result; } __int16 sub_45CAF0() { int v0; // eax@3 signed int v2; // [sp+4Ch] [bp-28h]@16 int v3; // [sp+58h] [bp-1Ch]@16 signed int i; // [sp+6Ch] [bp-8h]@1 signed int j; // [sp+6Ch] [bp-8h]@4 signed int k; // [sp+70h] [bp-4h]@7 dword_94B3A0 = 0; for ( i = 0; i < 100; ++i ) { word_94BBA0[i] = 0; v0 = i + 1; } for ( j = 0; j < GoodCount; ++j ) { _LOWORD(v0) = j; dword_98BF80[j] = 0; } for ( k = 1; k < 2000; ++k ) { v0 = buildings[k].inUse; if ( v0 == 1 ) { if ( buildings[k].type == B_Granary ) { _LOWORD(v0) = (_WORD)k << 7; if ( buildings[k].hasRoadAccess ) { v0 = buildings[k].haveRomeroad; if ( v0 > 0 ) { v3 = buildings[k].storageId; v2 = 0; if ( storages[v3].stateWheat != 2 ) { v2 = buildings[k].house_wheat; dword_98BF84 += buildings[k].house_wheat; } if ( storages[v3].stateVegetables != 2 ) { v2 += buildings[k].house_vegetables; dword_98BF88 += buildings[k].house_vegetables; } if ( storages[v3].stateFruit != 2 ) { v2 += buildings[k].house_wine; dword_98BF8C += buildings[k].house_wine; } _LOWORD(v0) = 32 * v3; if ( storages[v3].stateMeatFish != 2 ) { v2 += buildings[k].house_pottery; v0 = buildings[k].house_pottery; dword_98BF98 += v0; } if ( v2 > 100 ) { _LOWORD(v0) = k; word_94BBA0[dword_94B3A0] = k; if ( dword_94B3A0 < 98 ) ++dword_94B3A0; } } } } } } return v0; } int sub_45CDC0(int a1, int a2) { signed int buildingGoodCapacity; // [sp+4Ch] [bp-14h]@1 GoodType resourceId; // [sp+54h] [bp-Ch]@1 int v5; // [sp+58h] [bp-8h]@1 int v6; // [sp+5Ch] [bp-4h]@1 v6 = buildings[a1].storageId; v5 = buildings[a2].storageId; buildingGoodCapacity = 0; resourceId = (GoodType)0; if ( storages[v6].stateWheat == 2 ) { if ( storages[v5].stateWheat != 2 ) { if ( buildings[a2].house_wheat > 0 ) { buildingGoodCapacity = buildings[a2].house_wheat; resourceId = G_Wheat; } } } if ( storages[v6].stateVegetables == 2 ) { if ( storages[v5].stateVegetables != 2 ) { if ( buildings[a2].house_vegetables > buildingGoodCapacity ) { buildingGoodCapacity = buildings[a2].house_vegetables; resourceId = G_Vegetables; } } } if ( storages[v6].stateFruit == 2 ) { if ( storages[v5].stateFruit != 2 ) { if ( buildings[a2].house_wine > buildingGoodCapacity ) { buildingGoodCapacity = buildings[a2].house_wine; resourceId = G_Fruit; } } } if ( storages[v6].stateMeatFish == 2 ) { if ( storages[v5].stateMeatFish != 2 ) { if ( buildings[a2].house_pottery > buildingGoodCapacity ) { buildingGoodCapacity = buildings[a2].house_pottery; resourceId = G_MeatFish; } } } if ( buildingGoodCapacity > 800 ) buildingGoodCapacity = 800; if ( buildingGoodCapacity > buildings[a1].granary_capacity[0] ) buildingGoodCapacity = buildings[a1].granary_capacity[0]; sub_45D7B0(ciid, a2, resourceId, buildingGoodCapacity); dword_94B3B0 = resourceId; return buildingGoodCapacity / 100; } signed int sub_45D000() { signed int result; // eax@5 signed int v1; // [sp+4Ch] [bp-14h]@1 int v2; // [sp+50h] [bp-10h]@15 signed int i; // [sp+58h] [bp-8h]@1 signed int k; // [sp+58h] [bp-8h]@19 signed int j; // [sp+5Ch] [bp-4h]@6 v1 = 0; for ( i = 0; i <= 6; ++i ) dword_94BCC0[i] = 0; if ( scn_romeSuppliesWheat ) { result = 0; } else { for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Granary ) { if ( buildings[j].hasRoadAccess ) { if ( getPercentage( buildings[j].num_workers, model_buildings[buildings[j].type].laborers) >= 100 ) { v2 = buildings[j].storageId; if ( buildings[j].granary_capacity[0] >= 1200 ) { if ( !storages[v2].emptyAll ) { for ( k = 0; k <= 6; ++k ) { if ( storages[v2].resourceState[k] != 1 ) { ++dword_94BCC0[k]; v1 = 1; } } } } } } } } } result = v1; } return result; } signed int sub_45D1F0() { signed int result; // eax@5 signed int v1; // [sp+4Ch] [bp-14h]@6 int v2; // [sp+50h] [bp-10h]@15 signed int i; // [sp+58h] [bp-8h]@1 signed int k; // [sp+58h] [bp-8h]@19 signed int j; // [sp+5Ch] [bp-4h]@6 for ( i = 0; i <= 6; ++i ) dword_98C040[i] = 0; if ( scn_romeSuppliesWheat ) { result = 0; } else { v1 = 0; for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_Granary ) { if ( buildings[j].hasRoadAccess ) { if ( getPercentage( buildings[j].num_workers, model_buildings[buildings[j].type].laborers) >= 100 ) { v2 = buildings[j].storageId; if ( buildings[j].granary_capacity[0] > 100 ) { if ( !storages[v2].emptyAll ) { for ( k = 0; k <= 6; ++k ) { if ( storages[v2].resourceState[k] == 2 ) { ++dword_98C040[k]; v1 = 1; } } } } } } } } } result = v1; } return result; } signed int sub_45D3D0(int a1, signed int a2, int a3) { signed int result; // eax@2 if ( a1 > 0 ) { if ( buildings[a1].type == B_Granary ) { if ( a2 <= 6 ) { if ( a2 == 4 ) { result = 0; } else { if ( a2 == 5 ) { result = 0; } else { if ( buildings[a1].granary_capacity[0] > 0 ) { if ( a3 ) { switch ( a2 ) { case G_Wheat: city_inform[ciid].plebsFoodInCity += 100; break; case G_Fruit: city_inform[ciid].plebsFoodInCity += 100; break; case G_MeatFish: city_inform[ciid].plebsFoodInCity += 100; break; case G_Vegetables: city_inform[ciid].plebsFoodInCity += 100; break; } } if ( buildings[a1].granary_capacity[0] <= 100 ) { buildings[a1].granary_capacity[ a2 ] += buildings[a1].granary_capacity[0]; buildings[a1].granary_capacity[0] = 0; } else { buildings[a1].granary_capacity[ a2 ] += 100; buildings[a1].granary_capacity[0] -= 100; } result = 1; } else { result = 0; } } } } else { result = 0; } } else { result = 0; } } else { result = 1; } return result; } int sub_45D620(int a1, signed int a2) { int result; // eax@2 if ( a1 > 0 ) { if ( buildings[a1].type == 71 ) { if ( a2 <= 6 ) { if ( a2 == 4 ) { result = 0; } else { if ( a2 == 5 ) result = 0; else result = buildings[a1].granary_capacity[a2]; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } int sub_45D6A0(int a1, int a2, int a3) { int v4; // [sp+4Ch] [bp-Ch]@1 signed int i; // [sp+50h] [bp-8h]@1 signed int v6; // [sp+54h] [bp-4h]@1 v4 = a3; v6 = city_inform[ciid].word_6527E4[a2]; for ( i = 1; i < 2000 && a3 > 0; ++i ) { ++v6; if ( v6 >= 2000 ) v6 = 1; if ( buildings[v6].inUse == 1 ) { if ( buildings[v6].type == B_Granary ) { city_inform[ciid].word_6527E4[ a2] = v6; a3 = sub_45D7B0(a1, v6, a2, a3); } } } return v4 - a3; } int sub_45D7B0(int a1, int a2, int a3, signed int a4) { int result; // eax@2 int v5; // [sp+60h] [bp+14h]@4 if ( a4 > 0 ) { if ( buildings[a2].granary_capacity[a3] > a4 ) { city_inform[ciid].foodInGranaries_wheat[a3] -= a4; buildings[a2].granary_capacity[a3] -= a4; buildings[a2].granary_capacity[0] += a4; v5 = 0; } else { city_inform[ciid].foodInGranaries_wheat[a3] -= buildings[a2].granary_capacity[a3]; v5 = a4 - buildings[a2].granary_capacity[a3]; buildings[a2].granary_capacity[0] += buildings[a2].granary_capacity[a3]; buildings[a2].granary_capacity[a3] = 0; } result = v5; } else { result = 0; } return result; } int fun_removeFoodFromGranaryForMercury(int buildingId, int resourceId, signed int amount) { int result; // eax@2 int removed; // [sp+5Ch] [bp+10h]@4 if ( amount > 0 ) { if ( buildings[buildingId].granary_capacity[resourceId] >= amount ) { city_inform[ciid].foodInGranaries_wheat[resourceId] -= amount; buildings[buildingId].granary_capacity[resourceId] -= amount; buildings[buildingId].granary_capacity[0] += amount; removed = 0; } else { city_inform[ciid].foodInGranaries_wheat[resourceId] -= buildings[buildingId].granary_capacity[resourceId]; removed = amount - *(__int16 *)((char *)&buildings[buildingId].granary_capacity + 2 * resourceId); buildings[buildingId].granary_capacity[0] += buildings[buildingId].granary_capacity[resourceId]; buildings[buildingId].granary_capacity[resourceId] = 0; } result = removed; } else { result = 0; } return result; } void sub_45DAE0() { int v0; // [sp+4Ch] [bp-14h]@1 signed int v1; // [sp+50h] [bp-10h]@8 signed int foodTypesCount; // [sp+54h] [bp-Ch]@8 signed int j; // [sp+58h] [bp-8h]@14 signed int i; // [sp+5Ch] [bp-4h]@1 fun_gatherFoodInformation(ciid); city_inform[ciid].foodTypesEaten = 0; city_inform[ciid].dword_6500C0_always3or0 = 0; v0 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { foodTypesCount = model_houses[buildings[i].level_resourceId].foodtypes; v1 = fun_adjustWithPercentage(buildings[i].house_population, 50); if ( foodTypesCount > 1 ) v1 /= foodTypesCount; _HIBYTE(buildings[i].word_94BDAC) = 0; if ( scn_romeSuppliesWheat ) { city_inform[ciid].foodTypesEaten = 1; city_inform[ciid].foodTypesEaten = 1; buildings[i].grow_value_house_foodstocks[0] = v1; _HIBYTE(buildings[i].word_94BDAC) = 1; } else { if ( foodTypesCount > 0 ) { for ( j = 0; ; ++j ) { if ( j < 4 ) { if ( *(__int16 *)((char *)&buildings[i].grow_value_house_foodstocks[0] + 2 * j) < v1 ) { if ( *(__int16 *)((char *)&buildings[i].grow_value_house_foodstocks[0] + 2 * j) ) { *(__int16 *)((char *)&buildings[i].grow_value_house_foodstocks[0] + 2 * j) = 0; ++_HIBYTE(buildings[i].word_94BDAC); v0 += v1; } } else { *(__int16 *)((char *)&buildings[i].grow_value_house_foodstocks[0] + 2 * j) -= v1; ++_HIBYTE(buildings[i].word_94BDAC); v0 += v1; } if ( HIBYTE(buildings[i].word_94BDAC) > city_inform[ciid].foodTypesEaten ) city_inform[ciid].foodTypesEaten = HIBYTE(buildings[i].word_94BDAC); if ( HIBYTE(buildings[i].word_94BDAC) < foodTypesCount ) continue; } break; } } } } } } city_inform[ciid].dword_654500 = v0; city_inform[ciid].plebsFoodInCityLastYear = city_inform[ciid].plebsFoodInCity; city_inform[ciid].plebsFoodInCity = 0; } void sub_45DE60() { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= 1; ++i ) { if ( city_inform[ciid].byte_6500A2_always1 ) sub_45DEC0(i); } } void sub_45DEC0(int a1) { int v1; // [sp+4Ch] [bp-Ch]@12 signed int i; // [sp+50h] [bp-8h]@1 signed int j; // [sp+54h] [bp-4h]@4 for ( i = 0; i < 6; ++i ) { city_inform[ciid].x_cityinfo_dword_652900[i] = 0; city_inform[ciid].x_cityinfo_dword_6528E8[i] = 0; } for ( j = 1; j < MAX_BUILDINGS; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type >= B_WineWorkshop ) { if ( buildings[j].type <= B_PotteryWorkshop ) { buildings[j].hasRoadAccess = 0; if ( determineAccessRoad( buildings[j].x, buildings[j].y, buildings[j].size) ) { buildings[j].hasRoadAccess = 1; v1 = 2 - buildings[j].industry_unitsStored; if ( v1 < 0 ) v1 = 0; city_inform[a1].x_cityinfo_dword_652900[ buildings[j].level_resourceId] += v1; city_inform[a1].x_cityinfo_dword_6528E8[ buildings[j].level_resourceId] += buildings[j].industry_unitsStored; } } } } } } signed int sub_45E100(int a1, int a2, int a3, int a4, int a5) { signed int v6; // [sp+4Ch] [bp-18h]@4 signed int v7; // [sp+50h] [bp-14h]@14 signed int v8; // [sp+54h] [bp-10h]@14 signed int v9; // [sp+58h] [bp-Ch]@30 signed int i; // [sp+60h] [bp-4h]@14 if ( city_inform[ciid].resourceStockpile[ a3 ] ) return 0; switch ( a3 ) { case 4: v6 = 1; break; case 5: v6 = 2; break; case 9: v6 = 3; break; case 10: v6 = 4; break; default: if ( a3 != 11 ) return 0; v6 = 5; break; } v8 = 10000; v7 = 0; for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type >= B_WineWorkshop ) { if ( buildings[i].type <= B_PotteryWorkshop ) { if ( buildings[i].hasRoadAccess ) { if ( buildings[i].haveRomeroad > 0 ) { if ( buildings[i].level_resourceId == v6 ) { if ( buildings[i].haveRoadnet == a5 ) { if ( buildings[i].industry_unitsStored < 2 ) { v9 = sub_45C3E0( buildings[i].x, buildings[i].y, a1, a2, a4, buildings[i].haveRomeroad); if ( buildings[i].industry_unitsStored > 0 ) v9 += 20; if ( v9 < v8 ) { v8 = v9; v7 = i; } } } } } } } } } } walkerGridX = buildings[v7].enter_x; walkerGridY = buildings[v7].enter_y; return v7; } signed int sub_45E390(int a1, int a2, int a3, int a4, int a5) { signed int v6; // [sp+4Ch] [bp-18h]@4 signed int v7; // [sp+50h] [bp-14h]@14 signed int v8; // [sp+54h] [bp-10h]@14 int v9; // [sp+58h] [bp-Ch]@28 signed int i; // [sp+60h] [bp-4h]@14 if ( city_inform[ciid].resourceStockpile[ a3 ] ) return 0; switch ( a3 ) { case 4: v6 = 1; break; case 5: v6 = 2; break; case 9: v6 = 3; break; case 10: v6 = 4; break; default: if ( a3 != 11 ) return 0; v6 = 5; break; } v8 = 10000; v7 = 0; for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type >= B_WineWorkshop ) { if ( buildings[i].type <= B_PotteryWorkshop ) { if ( buildings[i].hasRoadAccess ) { if ( buildings[i].haveRomeroad > 0 ) { if ( buildings[i].level_resourceId == v6 ) { if ( buildings[i].haveRoadnet == a5 ) { v9 = 10 * buildings[i].industry_unitsStored + sub_45C3E0( buildings[i].x, buildings[i].y, a1, a2, a4, buildings[i].haveRomeroad); if ( v9 < v8 ) { v8 = v9; v7 = i; } } } } } } } } } walkerGridX = buildings[v7].enter_x; walkerGridY = buildings[v7].enter_y; return v7; } int sub_45E600(int a1, int a2, int a3, int a4) { int result; // eax@2 int v5; // [sp+4Ch] [bp-4h]@11 if ( a3 == 13 ) { if( city_inform[ciid].resourceStockpile[ 13 ] ) { result = 0; } else { if ( numWorkingBarracks > 0 ) { if ( buildings[city_inform[ciid].barracksBuildingId].industry_unitsStored < 5 ) { if ( city_inform[ciid].numLegionaryForts > 0 ) { v5 = city_inform[ciid].barracksBuildingId; if ( determineAccessRoad( buildings[v5].x, buildings[v5].y, buildings[v5].size) ) { if ( buildings[v5].haveRoadnet == a4 ) result = v5; else result = 0; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } } else { result = 0; } return result; } signed int sub_45E740(int a1) { signed int result; // eax@2 if ( a1 > 0 ) { if ( buildings[a1].type >= B_WineWorkshop && buildings[a1].type <= B_PotteryWorkshop ) { ++buildings[a1].industry_unitsStored; result = 1; } else { result = 1; } } else { result = 1; } return result; } signed int sub_45E7D0(int a1) { signed int result; // eax@2 if ( a1 > 0 ) { ++buildings[a1].industry_unitsStored; result = 1; } else { result = 1; } return result; } void fun_generateWalkersForBuildings() { int v0; // eax@20 int v1; // eax@33 int v2; // eax@65 int sentryId; // eax@77 int engineerId; // eax@103 int prefectId; // eax@126 int taxCollectorId; // eax@152 int actorColonyId; // eax@173 int gladiatorSchoolId; // eax@194 int lionHouseId; // eax@215 int chariotMakerId; // eax@236 int theaterId; // eax@288 int hippodromeId; // eax@319 int v13; // eax@321 int v14; // eax@321 int marketLadyId; // eax@380 int bathhouseWorkerId; // eax@421 int priestId; // eax@447 __int16 childX; // ST6C_2@470 __int16 childY; // ST68_2@470 int child1Id; // eax@470 int child2Id; // eax@470 int child3Id; // eax@470 int child4Id; // eax@470 int librarianId; // eax@493 int teacherId; // eax@516 int barberId; // eax@539 int doctorId; // eax@562 int surgeonId; // eax@585 int missionaryId; // eax@595 int v30; // eax@646 int v31; // eax@671 int v32; // eax@681 int v33; // eax@691 int engineerEmployment; // [sp+54h] [bp-30h]@90 int prefectEmployment; // [sp+54h] [bp-30h]@113 int taxCollectorEmployment; // [sp+54h] [bp-30h]@139 int actorColonyEmployment; // [sp+54h] [bp-30h]@160 int gladiatorSchoolEmployment; // [sp+54h] [bp-30h]@181 int lionHouseEmployment; // [sp+54h] [bp-30h]@202 int chariotMakerEmployment; // [sp+54h] [bp-30h]@223 int amphitheaterEmployment; // [sp+54h] [bp-30h]@248 int theaterEmployment; // [sp+54h] [bp-30h]@275 int hippodromeEmployment; // [sp+54h] [bp-30h]@306 int colosseumEmployment; // [sp+54h] [bp-30h]@337 int marketEmployment; // [sp+54h] [bp-30h]@366 int bathhouseEmployment; // [sp+54h] [bp-30h]@408 int templeEmployment; // [sp+54h] [bp-30h]@432 int schoolEmployment; // [sp+54h] [bp-30h]@457 int libraryEmployment; // [sp+54h] [bp-30h]@480 int academyEmployment; // [sp+54h] [bp-30h]@503 int barberEmployment; // [sp+54h] [bp-30h]@526 int doctorEmployment; // [sp+54h] [bp-30h]@549 int hospitalEmployment; // [sp+54h] [bp-30h]@572 int dockEmployment; // [sp+54h] [bp-30h]@603 int v55; // [sp+54h] [bp-30h]@656 int v56; // [sp+54h] [bp-30h]@703 signed int j; // [sp+58h] [bp-2Ch]@37 signed int k; // [sp+58h] [bp-2Ch]@294 signed int v59; // [sp+58h] [bp-2Ch]@610 signed int m; // [sp+58h] [bp-2Ch]@618 signed int l; // [sp+58h] [bp-2Ch]@625 signed int engineerSpawnDelay; // [sp+5Ch] [bp-28h]@91 signed int prefectSpawnDelay; // [sp+5Ch] [bp-28h]@114 signed int taxCollectorSpawnDelay; // [sp+5Ch] [bp-28h]@140 signed int actorColonySpawnDelay; // [sp+5Ch] [bp-28h]@161 signed int gladiatorSchoolSpawnDelay; // [sp+5Ch] [bp-28h]@182 signed int lionHouseSpawnDelay; // [sp+5Ch] [bp-28h]@203 signed int chariotMakerSpawnDelay; // [sp+5Ch] [bp-28h]@224 signed int amphitheaterSpawnDelay; // [sp+5Ch] [bp-28h]@249 signed int theaterSpawnDelay; // [sp+5Ch] [bp-28h]@276 signed int hippodromeSpawnDelay; // [sp+5Ch] [bp-28h]@307 signed int colosseumSpawnDelay; // [sp+5Ch] [bp-28h]@338 signed int marketSpawnDelay; // [sp+5Ch] [bp-28h]@367 signed int bathhouseSpawnDelay; // [sp+5Ch] [bp-28h]@409 signed int templeSpawnDelay; // [sp+5Ch] [bp-28h]@433 signed int schoolSpawnDelay; // [sp+5Ch] [bp-28h]@458 signed int librarySpawnDelay; // [sp+5Ch] [bp-28h]@481 signed int academySpawnDelay; // [sp+5Ch] [bp-28h]@504 signed int barberSpawnDelay; // [sp+5Ch] [bp-28h]@527 signed int doctorSpawnDelay; // [sp+5Ch] [bp-28h]@550 signed int hospitalSpawnDelay; // [sp+5Ch] [bp-28h]@573 signed int v82; // [sp+5Ch] [bp-28h]@704 signed int dockSpawnDelay; // [sp+60h] [bp-24h]@604 signed int v84; // [sp+64h] [bp-20h]@610 signed int v85; // [sp+68h] [bp-1Ch]@37 signed int v86; // [sp+68h] [bp-1Ch]@294 int v87; // [sp+68h] [bp-1Ch]@382 int v88; // [sp+6Ch] [bp-18h]@51 int v89; // [sp+6Ch] [bp-18h]@262 int colosseumId; // [sp+6Ch] [bp-18h]@351 int v91; // [sp+6Ch] [bp-18h]@383 int v92; // [sp+6Ch] [bp-18h]@390 int v93; // [sp+6Ch] [bp-18h]@625 int v94; // [sp+6Ch] [bp-18h]@635 signed int v95; // [sp+7Ch] [bp-8h]@49 signed int v96; // [sp+7Ch] [bp-8h]@63 signed int i; // [sp+80h] [bp-4h]@3 dword_98C58C = 0; if ( dword_7FA224 > 0 ) --dword_7FA224; for ( i = 1; i <= buildingId_highestInUse; ++i ) { if ( buildings[i].inUse == 1 && buildings[i].type != B_WarehouseSpace && (buildings[i].type != B_Hippodrome || !buildings[i].warehouse_nextStorage) ) { buildings[i].haveProblems = 0; if ( buildings[i].type < B_HouseSmallVilla || buildings[i].type > B_HouseLuxuryPalace ) { if ( buildings[i].type < B_WheatFarm || buildings[i].type > B_PotteryWorkshop ) { switch ( buildings[i].type ) { case B_Warehouse: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; v85 = i; for ( j = 0; j < 8; ++j ) { v85 = buildings[v85].warehouse_nextStorage; if ( v85 ) buildings[v85].haveProblems = buildings[i].haveProblems; } if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) || determineAccessRoad(buildings[i].x, buildings[i].y, 3) ) { if ( buildings[i].walkerServiceAccess <= 100 ) fun_generateLaborSeeker(i); if ( !fun_buildingHasWalkerOfType(i, Walker_Warehouseman, 0) ) { v95 = sub_45A040(i); if ( v95 > -1 ) { v88 = spawnWalker( buildings[i].cityId, Walker_Warehouseman, walkerGridX, walkerGridY, 4); walkers[v88].actionState = 50; walkers[v88].cartPusherGoodType = v95; if ( !v95 ) walkers[v88].itemCollecting = dword_94A318; buildings[i].walkerId = v88; walkers[v88].buildingId = i; } } } break; case B_Granary: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( fun_granaryHasRoadAccess(buildings[i].x, buildings[i].y) ) { if ( buildings[i].walkerServiceAccess <= 100 ) fun_generateLaborSeeker(i); if ( !fun_buildingHasWalkerOfType(i, 9, 0) ) { v96 = sub_45A8D0(i); if ( v96 > -1 ) { v2 = spawnWalker(buildings[i].cityId, Walker_Warehouseman, walkerGridX, walkerGridY, 4); walkers[v2].actionState = 50; walkers[v2].cartPusherGoodType = v96; buildings[i].walkerId = v2; walkers[v2].buildingId = i; } } } break; case B_Tower: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); if ( buildings[i].num_workers > 0 ) { if ( !buildings[i].towerBallistaId ) { if ( buildings[i].walkerId ) { sentryId = spawnWalker( buildings[i].cityId, Walker_Ballista, buildings[i].x, buildings[i].y, 0); buildings[i].towerBallistaId = sentryId; walkers[sentryId].buildingId = i; walkers[sentryId].actionState = -76; } } fun_buildingHasWalkerOfType(i, 42, 0); if ( buildings[i].walkerId <= 0 ) dword_7FA224 = 2; } } break; case B_EngineersPost: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Engineer, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 100 ) fun_generateLaborSeeker(i); engineerEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( engineerEmployment < 100 ) { if ( engineerEmployment < 75 ) { if ( engineerEmployment < 50 ) { if ( engineerEmployment < 25 ) { if ( engineerEmployment < 1 ) continue; engineerSpawnDelay = 15; } else { engineerSpawnDelay = 7; } } else { engineerSpawnDelay = 3; } } else { engineerSpawnDelay = 1; } } else { engineerSpawnDelay = 0; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > engineerSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; engineerId = spawnWalker( buildings[i].cityId, Walker_Engineer, walkerGridX, walkerGridY, 0); walkers[engineerId].actionState = 60; buildings[i].walkerId = engineerId; walkers[engineerId].buildingId = i; } } break; case B_Prefecture: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, 10, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 100 ) fun_generateLaborSeeker(i); prefectEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( prefectEmployment < 100 ) { if ( prefectEmployment < 75 ) { if ( prefectEmployment < 50 ) { if ( prefectEmployment < 25 ) { if ( prefectEmployment < 1 ) continue; prefectSpawnDelay = 15; } else { prefectSpawnDelay = 7; } } else { prefectSpawnDelay = 3; } } else { prefectSpawnDelay = 1; } } else { prefectSpawnDelay = 0; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > prefectSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; prefectId = spawnWalker(buildings[i].cityId, Walker_Prefect, walkerGridX, walkerGridY, 0); walkers[prefectId].actionState = 70; buildings[i].walkerId = prefectId; walkers[prefectId].buildingId = i; } } break; default: if ( buildings[i].type < B_Senate || buildings[i].type > B_ForumUpgraded ) { switch ( buildings[i].type ) { case B_ActorColony: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); actorColonyEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( actorColonyEmployment < 100 ) { if ( actorColonyEmployment < 75 ) { if ( actorColonyEmployment < 50 ) { if ( actorColonyEmployment < 25 ) { if ( actorColonyEmployment < 1 ) continue; actorColonySpawnDelay = 44; } else { actorColonySpawnDelay = 29; } } else { actorColonySpawnDelay = 15; } } else { actorColonySpawnDelay = 7; } } else { actorColonySpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > actorColonySpawnDelay ) { buildings[i].walkerSpawnDelay = 0; actorColonyId = spawnWalker( buildings[i].cityId, Walker_Actor, walkerGridX, walkerGridY, 0); walkers[actorColonyId].actionState = 90; buildings[i].walkerId = actorColonyId; walkers[actorColonyId].buildingId = i; } } break; case B_GladiatorSchool: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); gladiatorSchoolEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( gladiatorSchoolEmployment < 100 ) { if ( gladiatorSchoolEmployment < 75 ) { if ( gladiatorSchoolEmployment < 50 ) { if ( gladiatorSchoolEmployment < 25 ) { if ( gladiatorSchoolEmployment < 1 ) continue; gladiatorSchoolSpawnDelay = 44; } else { gladiatorSchoolSpawnDelay = 29; } } else { gladiatorSchoolSpawnDelay = 15; } } else { gladiatorSchoolSpawnDelay = 7; } } else { gladiatorSchoolSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > gladiatorSchoolSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; gladiatorSchoolId = spawnWalker( buildings[i].cityId, Walker_Gladiator, walkerGridX, walkerGridY, 0); walkers[gladiatorSchoolId].actionState = 90; buildings[i].walkerId = gladiatorSchoolId; walkers[gladiatorSchoolId].buildingId= i; } } break; case B_LionHouse: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); lionHouseEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( lionHouseEmployment < 100 ) { if ( lionHouseEmployment < 75 ) { if ( lionHouseEmployment < 50 ) { if ( lionHouseEmployment < 25 ) { if ( lionHouseEmployment < 1 ) continue; lionHouseSpawnDelay = 60; } else { lionHouseSpawnDelay = 35; } } else { lionHouseSpawnDelay = 20; } } else { lionHouseSpawnDelay = 10; } } else { lionHouseSpawnDelay = 5; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > lionHouseSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; lionHouseId = spawnWalker(buildings[i].cityId, Walker_LionTamer, walkerGridX, walkerGridY, 0); walkers[lionHouseId].actionState = 90; buildings[i].walkerId = lionHouseId; walkers[lionHouseId].buildingId = i; } } break; case B_ChariotMaker: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); chariotMakerEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( chariotMakerEmployment < 100 ) { if ( chariotMakerEmployment < 75 ) { if ( chariotMakerEmployment < 50 ) { if ( chariotMakerEmployment < 25 ) { if ( chariotMakerEmployment < 1 ) continue; chariotMakerSpawnDelay = 90; } else { chariotMakerSpawnDelay = 60; } } else { chariotMakerSpawnDelay = 30; } } else { chariotMakerSpawnDelay = 15; } } else { chariotMakerSpawnDelay = 7; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > chariotMakerSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; chariotMakerId = spawnWalker( buildings[i].cityId, Walker_Charioteer, walkerGridX, walkerGridY, 0); walkers[chariotMakerId].actionState = 90; buildings[i].walkerId = chariotMakerId; walkers[chariotMakerId].buildingId = i; } } break; case B_Amphitheater: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Actor, Walker_Gladiator) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 || buildings[i].house_bathhouse_dock_numships_entert_days <= 0 && buildings[i].house_hospital_entert_days2 <= 0 ) fun_generateLaborSeeker(i); amphitheaterEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( amphitheaterEmployment < 100 ) { if ( amphitheaterEmployment < 75 ) { if ( amphitheaterEmployment < 50 ) { if ( amphitheaterEmployment < 25 ) { if ( amphitheaterEmployment < 1 ) continue; amphitheaterSpawnDelay = 44; } else { amphitheaterSpawnDelay = 29; } } else { amphitheaterSpawnDelay = 15; } } else { amphitheaterSpawnDelay = 7; } } else { amphitheaterSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > amphitheaterSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; if ( buildings[i].house_bathhouse_dock_numships_entert_days > 0 ) v89 = spawnWalker( buildings[i].cityId, Walker_Gladiator, walkerGridX, walkerGridY, 0); else v89 = spawnWalker(buildings[i].cityId, Walker_Actor, walkerGridX, walkerGridY, 0); walkers[v89].actionState = 94; buildings[i].walkerId = v89; walkers[v89].buildingId = i; fun_roamWalker(v89); } } break; case B_Theater: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Actor, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 || buildings[i].house_bathhouse_dock_numships_entert_days <= 0 ) fun_generateLaborSeeker(i); theaterEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( theaterEmployment < 100 ) { if ( theaterEmployment < 75 ) { if ( theaterEmployment < 50 ) { if ( theaterEmployment < 25 ) { if ( theaterEmployment < 1 ) continue; theaterSpawnDelay = 44; } else { theaterSpawnDelay = 29; } } else { theaterSpawnDelay = 15; } } else { theaterSpawnDelay = 7; } } else { theaterSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > theaterSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; theaterId = spawnWalker( buildings[i].cityId, Walker_Actor, walkerGridX, walkerGridY, 0); walkers[theaterId].actionState = 94; buildings[i].walkerId = theaterId; walkers[theaterId].buildingId = i; fun_roamWalker(theaterId); } } break; case B_Hippodrome: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !buildings[i].warehouse_nextStorage ) { v86 = i; for ( k = 0; k < 2; ++k ) { v86 = buildings[v86].warehouse_nextStorage; if ( v86 ) buildings[v86].haveProblems = buildings[i].haveProblems; } if ( !fun_buildingHasWalkerOfType(i, Walker_Charioteer, 0) && sub_4898D0(buildings[i].x, buildings[i].y) ) { if ( buildings[i].walkerServiceAccess <= 50 || buildings[i].house_bathhouse_dock_numships_entert_days <= 0 ) fun_generateLaborSeeker(i); hippodromeEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( hippodromeEmployment < 100 ) { if ( hippodromeEmployment < 75 ) { if ( hippodromeEmployment < 50 ) { if ( hippodromeEmployment < 25 ) { if ( hippodromeEmployment < 1 ) continue; hippodromeSpawnDelay = 80; } else { hippodromeSpawnDelay = 50; } } else { hippodromeSpawnDelay = 30; } } else { hippodromeSpawnDelay = 15; } } else { hippodromeSpawnDelay = 7; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > hippodromeSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; hippodromeId = spawnWalker( buildings[i].cityId, Walker_Charioteer, walkerGridX, walkerGridY, 0); walkers[hippodromeId].actionState = 94; buildings[i].walkerId = hippodromeId; walkers[hippodromeId].buildingId = i; fun_roamWalker(hippodromeId); if ( !city_inform[ciid].dword_654624 ) { v13 = spawnWalker( buildings[i].cityId, Walker_HippodromeMiniHorses, buildings[i].x + 2, buildings[i].y + 1, 2); walkers[v13].actionState = -56; walkers[v13].buildingId = i; walkers[v13].cartPusherGoodType = G_None; walkers[v13].byte_7FA389 = 3; v14 = spawnWalker( buildings[i].cityId, Walker_HippodromeMiniHorses, buildings[i].x + 2, buildings[i].y + 2, 2); walkers[v14].actionState = -56; walkers[v14].buildingId = i; walkers[v14].cartPusherGoodType = G_Wheat; walkers[v14].byte_7FA389 = 2; if ( buildings[i].house_bathhouse_dock_numships_entert_days > 0 ) { if ( !city_inform[ciid].entertainmentMessage_hippodromeShown ) { city_inform[ciid].entertainmentMessage_hippodromeShown = 1; message_usePopup = 1; fun_postMessageToPlayer(109, 0, 0); } } } } } } break; case B_Colosseum: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Gladiator, Walker_LionTamer) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 || buildings[i].house_bathhouse_dock_numships_entert_days <= 0 && buildings[i].house_hospital_entert_days2 <= 0 ) fun_generateLaborSeeker(i); colosseumEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( colosseumEmployment < 100 ) { if ( colosseumEmployment < 75 ) { if ( colosseumEmployment < 50 ) { if ( colosseumEmployment < 25 ) { if ( colosseumEmployment < 1 ) continue; colosseumSpawnDelay = 70; } else { colosseumSpawnDelay = 40; } } else { colosseumSpawnDelay = 20; } } else { colosseumSpawnDelay = 12; } } else { colosseumSpawnDelay = 6; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > colosseumSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; if ( buildings[i].house_bathhouse_dock_numships_entert_days > 0 ) colosseumId = spawnWalker( buildings[i].cityId, Walker_LionTamer, walkerGridX, walkerGridY, 0); else colosseumId = spawnWalker( buildings[i].cityId, Walker_Gladiator, walkerGridX, walkerGridY, 0); walkers[colosseumId].actionState = 94; buildings[i].walkerId = colosseumId; walkers[colosseumId].buildingId = i; fun_roamWalker(colosseumId); if ( buildings[i].house_bathhouse_dock_numships_entert_days > 0 || buildings[i].house_hospital_entert_days2 > 0 ) { if ( !city_inform[ciid].entertainmentMessage_colosseumShown ) { city_inform[ciid].entertainmentMessage_colosseumShown = 1; message_usePopup = 1; fun_postMessageToPlayer(110, 0, 0); } } } } break; case B_Market: sub_463C80(i); if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); marketEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( marketEmployment < 100 ) { if ( marketEmployment < 75 ) { if ( marketEmployment < 50 ) { if ( marketEmployment < 25 ) { if ( marketEmployment < 1 ) continue; marketSpawnDelay = 30; } else { marketSpawnDelay = 20; } } else { marketSpawnDelay = 10; } } else { marketSpawnDelay = 5; } } else { marketSpawnDelay = 2; } if ( !fun_buildingHasWalkerOfType(i, Walker_MarketTrader, 0) ) { ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay <= marketSpawnDelay ) continue; buildings[i].walkerSpawnDelay = 0; marketLadyId = spawnWalker( buildings[i].cityId, Walker_MarketTrader, walkerGridX, walkerGridY, 0); walkers[marketLadyId].actionState = 125; buildings[i].walkerId = marketLadyId; walkers[marketLadyId].buildingId = i; fun_roamWalker(marketLadyId); } if ( buildings[i].laborSeekerId ) { v92 = buildings[i].laborSeekerId; if ( walkers[v92].state != 1 || walkers[v92].type != Walker_MarketBuyer && walkers[v92].type != 5 ) buildings[i].laborSeekerId = 0; } else { determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size); v87 = marketDetermineDestinationGranaryWarehouse(i); if ( v87 > 0 ) { v91 = spawnWalker( buildings[i].cityId, Walker_MarketBuyer, walkerGridX, walkerGridY, 0); walkers[v91].actionState = -111; buildings[i].laborSeekerId = v91; walkers[v91].buildingId = i; walkers[v91].baseWorkingBuildingId = v87; walkers[v91].itemCollecting = buildings[i].house_mars; if ( determineAccessRoad( buildings[v87].x, buildings[v87].y, buildings[v87].size) ) { walkers[v91].destination_x = walkerGridX; walkers[v91].destination_y = walkerGridY; } else { if ( determineAccessRoad(buildings[v87].x, buildings[v87].y, 3) ) { walkers[v91].destination_x = walkerGridX; walkers[v91].destination_y = walkerGridY; } else { walkers[v91].actionState = -110; walkers[v91].destination_x = walkers[v91].x; walkers[v91].destination_y = walkers[v91].y; } } } } } break; case B_Bathhouse: sub_4639D0(i); if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !buildings[i].hasFountain ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_BathhouseWorker, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) && buildings[i].hasFountain ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); bathhouseEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( bathhouseEmployment < 100 ) { if ( bathhouseEmployment < 75 ) { if ( bathhouseEmployment < 50 ) { if ( bathhouseEmployment < 25 ) { if ( bathhouseEmployment < 1 ) continue; bathhouseSpawnDelay = 44; } else { bathhouseSpawnDelay = 29; } } else { bathhouseSpawnDelay = 15; } } else { bathhouseSpawnDelay = 7; } } else { bathhouseSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > bathhouseSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; bathhouseWorkerId = spawnWalker( buildings[i].cityId, Walker_BathhouseWorker, walkerGridX, walkerGridY, 0); walkers[bathhouseWorkerId].actionState = 125; buildings[i].walkerId = bathhouseWorkerId; walkers[bathhouseWorkerId].buildingId = i; fun_roamWalker(bathhouseWorkerId); } } break; default: if ( buildings[i].type < B_SmallTempleCeres || buildings[i].type > B_LargeTempleVenus ) { switch ( buildings[i].type ) { case B_School: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_SchoolChild, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); schoolEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( schoolEmployment < 100 ) { if ( schoolEmployment < 75 ) { if ( schoolEmployment < 50 ) { if ( schoolEmployment < 25 ) { if ( schoolEmployment < 1 ) continue; schoolSpawnDelay = 44; } else { schoolSpawnDelay = 29; } } else { schoolSpawnDelay = 15; } } else { schoolSpawnDelay = 7; } } else { schoolSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > schoolSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; childX = walkerGridX; childY = walkerGridY; child1Id = spawnWalker( buildings[i].cityId, Walker_SchoolChild, walkerGridX, walkerGridY, 0); walkers[child1Id].actionState = 125; buildings[i].walkerId = child1Id; walkers[child1Id].buildingId = i; fun_roamWalker(child1Id); child2Id = spawnWalker( buildings[i].cityId, Walker_SchoolChild, childX, childY, 0); walkers[child2Id].actionState = 125; walkers[child2Id].buildingId = i; fun_roamWalker(child2Id); child3Id = spawnWalker( buildings[i].cityId, Walker_SchoolChild, childX, childY, 0); walkers[child3Id].actionState = 125; walkers[child3Id].buildingId = i; fun_roamWalker(child3Id); child4Id = spawnWalker( buildings[i].cityId, Walker_SchoolChild, childX, childY, 0); walkers[child4Id].actionState = 125; walkers[child4Id].buildingId = i; fun_roamWalker(child4Id); } } break; case B_Library: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Librarian, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); libraryEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( libraryEmployment < 100 ) { if ( libraryEmployment < 75 ) { if ( libraryEmployment < 50 ) { if ( libraryEmployment < 25 ) { if ( libraryEmployment < 1 ) continue; librarySpawnDelay = 44; } else { librarySpawnDelay = 29; } } else { librarySpawnDelay = 15; } } else { librarySpawnDelay = 7; } } else { librarySpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > librarySpawnDelay ) { buildings[i].walkerSpawnDelay = 0; librarianId = spawnWalker( buildings[i].cityId, Walker_Librarian, walkerGridX, walkerGridY, 0); walkers[librarianId].actionState = 125; buildings[i].walkerId = librarianId; walkers[librarianId].buildingId = i; fun_roamWalker(librarianId); } } break; case B_Academy: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Teacher, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); academyEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( academyEmployment < 100 ) { if ( academyEmployment < 75 ) { if ( academyEmployment < 50 ) { if ( academyEmployment < 25 ) { if ( academyEmployment < 1 ) continue; academySpawnDelay = 44; } else { academySpawnDelay = 29; } } else { academySpawnDelay = 15; } } else { academySpawnDelay = 7; } } else { academySpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > academySpawnDelay ) { buildings[i].walkerSpawnDelay = 0; teacherId = spawnWalker(buildings[i].cityId, Walker_Teacher, walkerGridX, walkerGridY, 0); walkers[teacherId].actionState = 125; buildings[i].walkerId = teacherId; walkers[teacherId].buildingId = i; fun_roamWalker(teacherId); } } break; case B_Barber: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, Walker_Barber, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); barberEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( barberEmployment < 100 ) { if ( barberEmployment < 75 ) { if ( barberEmployment < 50 ) { if ( barberEmployment < 25 ) { if ( barberEmployment < 1 ) continue; barberSpawnDelay = 44; } else { barberSpawnDelay = 29; } } else { barberSpawnDelay = 15; } } else { barberSpawnDelay = 7; } } else { barberSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > barberSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; barberId = spawnWalker( buildings[i].cityId, Walker_Barber, walkerGridX, walkerGridY, 0); walkers[barberId].actionState = 125; buildings[i].walkerId = barberId; walkers[barberId].buildingId = i; fun_roamWalker(barberId); } } break; case B_Doctor: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, 33, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); doctorEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( doctorEmployment < 100 ) { if ( doctorEmployment < 75 ) { if ( doctorEmployment < 50 ) { if ( doctorEmployment < 25 ) { if ( doctorEmployment < 1 ) continue; doctorSpawnDelay = 44; } else { doctorSpawnDelay = 29; } } else { doctorSpawnDelay = 15; } } else { doctorSpawnDelay = 7; } } else { doctorSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > doctorSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; doctorId = spawnWalker( buildings[i].cityId, Walker_Doctor, walkerGridX, walkerGridY, 0); walkers[doctorId].actionState = 125; buildings[i].walkerId = doctorId; walkers[doctorId].buildingId = i; fun_roamWalker(doctorId); } } break; case B_Hospital: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, 34, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); hospitalEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( hospitalEmployment < 100 ) { if ( hospitalEmployment < 75 ) { if ( hospitalEmployment < 50 ) { if ( hospitalEmployment < 25 ) { if ( hospitalEmployment < 1 ) continue; hospitalSpawnDelay = 44; } else { hospitalSpawnDelay = 29; } } else { hospitalSpawnDelay = 15; } } else { hospitalSpawnDelay = 7; } } else { hospitalSpawnDelay = 3; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > hospitalSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; surgeonId = spawnWalker( buildings[i].cityId, Walker_Surgeon, walkerGridX, walkerGridY, 0); walkers[surgeonId].actionState = 125; buildings[i].walkerId = surgeonId; walkers[surgeonId].buildingId = i; fun_roamWalker(surgeonId); } } break; case B_MissionPost: if ( !fun_buildingHasWalkerOfType(i, 64, 0) ) { if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( city_inform[ciid].population > 0 ) { city_inform[ciid].dword_6544C0 = 1; ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > 1 ) { buildings[i].walkerSpawnDelay = 0; missionaryId = spawnWalker( buildings[i].cityId, Walker_Missionary, walkerGridX, walkerGridY, 0); walkers[missionaryId].actionState = 125; buildings[i].walkerId = missionaryId; walkers[missionaryId].buildingId = i; fun_roamWalker(missionaryId); } } } } break; case B_Dock: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); dockEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( dockEmployment > 0 ) { if ( dockEmployment >= 50 ) { if ( dockEmployment >= 75 ) dockSpawnDelay = 3; else dockSpawnDelay = 2; } else { dockSpawnDelay = 1; } } else { dockSpawnDelay = 0; } v59 = 0; v84 = 0; while ( v59 < 3 ) { if ( *(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * v59) ) { if ( walkers[ *(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * v59)].type == 38 ) ++v84; else *(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * v59) = 0; } ++v59; } if ( v84 <= dockSpawnDelay ) { if ( v84 < dockSpawnDelay ) { v93 = spawnWalker(buildings[i].cityId, Walker_Dockman, walkerGridX, walkerGridY, 4); walkers[v93].actionState = -124; walkers[v93].buildingId = i; for ( l = 0; l < 3; ++l ) { if ( !*(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * l) ) { *(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * l) = v93; goto LABEL_4; } } } } else { for ( m = 2; m >= 0; --m ) { if ( *(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * m) ) { walkers[*(__int16 *)((char *)&buildings[i].word_94BDAC + 2 * m)].state = 2; goto LABEL_4; } } } } break; case B_Wharf: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( buildings[i].wharf_hasBoat_house_evolveStatusDesir ) { v94 = buildings[i].wharf_hasBoat_house_evolveStatusDesir; if ( walkers[v94].state != 1 || walkers[v94].type != 25 ) buildings[i].wharf_hasBoat_house_evolveStatusDesir = 0; } if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); if ( !fun_buildingHasWalkerOfType(i, 4, 0) ) { if ( buildings[i].walkerSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; buildings[i].house_pottery= 0; buildings[i].industry_outputGood = 6; v30 = spawnWalker(buildings[i].cityId, Walker_CartPusher, walkerGridX, walkerGridY, 4); walkers[v30].actionState = 20; walkers[v30].cartPusherGoodType = G_MeatFish; buildings[i].walkerId = v30; walkers[v30].buildingId = i; walkers[v30].word_7FA366 = 30; } } } break; case B_Shipyard: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); if ( !fun_buildingHasWalkerOfType(i, 25, 0) ) { v55 = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( v55 < 100 ) { if ( v55 < 75 ) { if ( v55 < 50 ) { if ( v55 < 25 ) { if ( v55 <= 0 ) buildings[i].grow_value_house_foodstocks[0] = buildings[i].grow_value_house_foodstocks[0]; else buildings[i].grow_value_house_foodstocks[0] += 2; } else { buildings[i].grow_value_house_foodstocks[0] += 4; } } else { buildings[i].grow_value_house_foodstocks[0] += 6; } } else { buildings[i].grow_value_house_foodstocks[0] += 8; } } else { buildings[i].grow_value_house_foodstocks[0] += 10; } if ( buildings[i].grow_value_house_foodstocks[0] >= 160 ) { buildings[i].grow_value_house_foodstocks[0] = 0; if ( sub_489E70( buildings[i].x, buildings[i].y, buildings[i].size) ) { v31 = spawnWalker(buildings[i].cityId, Walker_FishingBoat, walkerGridX, walkerGridY, 0); walkers[v31].actionState = -66; buildings[i].walkerId = v31; walkers[v31].buildingId = i; } } } } break; case B_NativeHut: grid_graphicIds[buildings[i].gridOffset] = (grid_random[buildings[i].gridOffset] & 1) + graphic_nativeBuilding; if ( !fun_buildingHasWalkerOfType(i, 41, 0) ) { if ( buildings[i].level_resourceId > 0 ) { if ( sub_48A050( buildings[i].x, buildings[i].y, buildings[i].size) ) { ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > 4 ) { buildings[i].walkerSpawnDelay = 0; v32 = spawnWalker(buildings[i].cityId, Walker_IndigenousNative, walkerGridX, walkerGridY, 0); walkers[v32].actionState = -98; buildings[i].walkerId = v32; walkers[v32].buildingId = i; } } } } break; case B_NativeMeeting: fun_putBuildingOnTerrainAndGraphicGrids( i, buildings[i].x, buildings[i].y, 2, 2, graphic_nativeBuilding + 2, 8); if ( city_inform[ciid].dword_6544C0 > 0 ) { if ( !fun_buildingHasWalkerOfType(i, 58, 0) ) { if ( sub_48A050( buildings[i].x, buildings[i].y, buildings[i].size) ) { ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > 8 ) { buildings[i].walkerSpawnDelay = 0; v33 = spawnWalker(buildings[i].cityId, Walker_NativeTrader, walkerGridX, walkerGridY, 0); walkers[v33].actionState = -94; buildings[i].walkerId = v33; walkers[v33].buildingId = i; } } } } break; case B_NativeCrops: sub_480C60(i); break; case B_FortGround__: sub_4BB790(i); break; case B_Barracks: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 100 ) fun_generateLaborSeeker(i); v56 = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( v56 < 100 ) { if ( v56 < 75 ) { if ( v56 < 50 ) { if ( v56 < 25 ) { if ( v56 < 1 ) continue; v82 = 48; } else { v82 = 32; } } else { v82 = 16; } } else { v82 = 12; } } else { v82 = 8; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > v82 ) { buildings[i].walkerSpawnDelay = 0; determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size); if ( !fun_generateTowerSentryFromBarracks(i) ) fun_generateSoldierFromBarracks(i); } } break; case B_MilitaryAcademy: if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 100 ) fun_generateLaborSeeker(i); } break; } } else // small or large temple { if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, 27, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); templeEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( model_buildings[buildings[i].type].laborers > 0 ) { if ( templeEmployment < 100 ) { if ( templeEmployment < 75 ) { if ( templeEmployment < 50 ) { if ( templeEmployment < 25 ) { if ( templeEmployment < 1 ) continue; templeSpawnDelay = 20; } else { templeSpawnDelay = 15; } } else { templeSpawnDelay = 10; } } else { templeSpawnDelay = 7; } } else { templeSpawnDelay = 3; } } else { templeSpawnDelay = 7; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > templeSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; priestId = spawnWalker( buildings[i].cityId, Walker_Priest, walkerGridX, walkerGridY, 0); walkers[priestId].actionState = 125; buildings[i].walkerId = priestId; walkers[priestId].buildingId = i; fun_roamWalker(priestId); } } } break; } } else // senate or forum { if ( buildings[i].type == B_SenateUpgraded ) sub_463DB0(i); if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( !fun_buildingHasWalkerOfType(i, 7, 0) && determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); taxCollectorEmployment = getPercentage( buildings[i].num_workers, model_buildings[buildings[i].type].laborers); if ( taxCollectorEmployment < 100 ) { if ( taxCollectorEmployment < 75 ) { if ( taxCollectorEmployment < 50 ) { if ( taxCollectorEmployment < 25 ) { if ( taxCollectorEmployment < 1 ) continue; taxCollectorSpawnDelay = 15; } else { taxCollectorSpawnDelay = 7; } } else { taxCollectorSpawnDelay = 3; } } else { taxCollectorSpawnDelay = 1; } } else { taxCollectorSpawnDelay = 0; } ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > taxCollectorSpawnDelay ) { buildings[i].walkerSpawnDelay = 0; taxCollectorId = spawnWalker(buildings[i].cityId, Walker_TaxCollector, walkerGridX, walkerGridY, 0); walkers[taxCollectorId].actionState = 40; buildings[i].walkerId = taxCollectorId; walkers[taxCollectorId].buildingId = i; } } } break; } } else { if ( buildings[i].walkerServiceAccess <= 0 ) buildings[i].haveProblems = 2; if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { if ( buildings[i].walkerServiceAccess <= 50 ) fun_generateLaborSeeker(i); if ( !fun_buildingHasWalkerOfType(i, 4, 0) ) { if ( gStockCapacity(i) ) { sub_4520A0(i); v1 = spawnWalker(buildings[i].cityId, Walker_CartPusher, walkerGridX, walkerGridY, 4); walkers[v1].actionState = 20; walkers[v1].cartPusherGoodType = buildings[i].industry_outputGood; buildings[i].walkerId = v1; walkers[v1].buildingId = i; walkers[v1].word_7FA366 = 30; } } } } } else // house { if ( determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) { ++buildings[i].walkerSpawnDelay; if ( buildings[i].walkerSpawnDelay > 40 ) { if ( !dword_98C58C ) { dword_98C58C = 1; buildings[i].walkerSpawnDelay = 0; v0 = spawnWalker(buildings[i].cityId, Walker_Patrician, walkerGridX, walkerGridY, 4); walkers[v0].actionState = 125; walkers[v0].buildingId = i; fun_roamWalker(v0); } } } } } LABEL_4: ; } } signed int fun_buildingHasWalkerOfType(int buildingId, int walkerType1, int walkerType2) { signed int result; // eax@2 int walkerId; // [sp+4Ch] [bp-4h]@3 if ( buildings[buildingId].walkerId > 0 ) { walkerId = buildings[buildingId].walkerId; if ( walkers[walkerId].state ) { if ( walkers[walkerId].type == walkerType1 || walkers[walkerId].type == walkerType2 ) { if ( walkers[walkerId].buildingId == buildingId ) { result = 1; } else { buildings[buildingId].walkerId = 0; result = 0; } } else { buildings[buildingId].walkerId = 0; result = 0; } } else { buildings[buildingId].walkerId = 0; result = 0; } } else { result = 0; } return result; } void fun_generateLaborSeeker(int buildingId) { int x; // ST64_4@11 int y; // ST60_4@11 int walkerId; // eax@11 int seekerId; // [sp+54h] [bp-4h]@4 if ( city_inform[ciid].population > 0 ) { if ( buildings[buildingId].laborSeekerId ) { seekerId = buildings[buildingId].laborSeekerId; if ( !walkers[seekerId].state ) buildings[buildingId].laborSeekerId = 0; if ( walkers[seekerId].type != Walker_LaborSeeker ) buildings[buildingId].laborSeekerId = 0; if ( walkers[seekerId].buildingId != buildingId ) buildings[buildingId].laborSeekerId = 0; } else { x = walkerGridX; y = walkerGridY; walkerId = spawnWalker( buildings[buildingId].cityId, Walker_LaborSeeker, walkerGridX, walkerGridY, 0); walkers[walkerId].actionState = 125; buildings[buildingId].laborSeekerId = walkerId; walkers[walkerId].buildingId = buildingId; fun_roamWalker(walkerId); walkerGridX = x; walkerGridY = y; } } } void sub_4639D0(int a1) { int v1; // [sp+4Ch] [bp-4h]@3 if ( buildings[a1].inUse == 1 ) { v1 = buildings[a1].gridOffset; if ( fun_mapAreaContainsTerrain(buildings[a1].x, buildings[a1].y, 2, T_ReservoirRange) ) buildings[a1].hasFountain = 1; else buildings[a1].hasFountain = 0; if ( buildings[a1].num_workers && buildings[a1].hasFountain ) { if ( grid_desirability[v1] <= 30 ) fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6C3A, 8); else fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6D56, 8); } else { if ( grid_desirability[v1] <= 30 ) fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6D22, 8); else fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6D58, 8); } } } void sub_463C80(int a1) { if ( buildings[a1].inUse == 1 ) { if ( grid_desirability[buildings[a1].gridOffset] <= 30 ) fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, graphic_market, 8); else fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6D54, 8); } } void sub_463DB0(int a1) { if ( buildings[a1].inUse == 1 ) { if ( grid_desirability[buildings[a1].gridOffset] <= 30 ) fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6C2C, 8); else fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, word_6E6D6A, 8); } } int fun_determineEntertainerDestination(int x, int y, int buildingType1, int buildingType2) { int result; // eax@20 int v5; // [sp+4Ch] [bp-1Ch]@1 int v6; // [sp+54h] [bp-14h]@24 signed int v7; // [sp+58h] [bp-10h]@21 int v8; // [sp+5Ch] [bp-Ch]@28 int v9; // [sp+60h] [bp-8h]@21 signed int i; // [sp+64h] [bp-4h]@1 int v11; // [sp+64h] [bp-4h]@23 v5 = *(&byte_91C920[162 * y] + x + setting_map_startGridOffset); dword_98BF38 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == buildingType1 || buildings[i].type == buildingType2 ) { if ( buildings[i].haveRomeroad ) { if ( buildings[i].haveRoadnet == v5 ) { if ( buildings[i].type != 32 || !buildings[i].warehouse_nextStorage ) { word_949F00[dword_98BF38++] = i; if ( dword_98BF38 >= 500 ) dword_98BF38 = 499; } } } } } } if ( dword_98BF38 > 0 ) { v9 = 0; v7 = 10000; dword_98BF14 = 0; while ( dword_98BF14 < dword_98BF38 ) { v11 = word_949F00[dword_98BF14++]; if ( buildings[v11].type == buildingType1 ) { v6 = buildings[v11].house_bathhouse_dock_numships_entert_days; } else { if ( buildings[v11].type == buildingType2 ) v6 = buildings[v11].house_hospital_entert_days2; else v6 = 0; } v8 = v6 + fun_getDistanceMaximum(x, y, buildings[v11].x, buildings[v11].y); if ( v8 < v7 ) { v7 = v8; v9 = v11; } } if ( v9 ) result = v9; else result = 0; } else { result = 0; } return result; } void fun_countBuildingTypes() { signed int v0; // [sp+4Ch] [bp-10h]@229 int v1; // [sp+50h] [bp-Ch]@225 signed int i; // [sp+54h] [bp-8h]@1 signed int j; // [sp+54h] [bp-8h]@4 int k; // [sp+58h] [bp-4h]@7 numWorkingAmphitheaters = 0; numAmphitheaters = numWorkingAmphitheaters; numWorkingTheaters = numAmphitheaters; numTheaters = numWorkingTheaters; numWorkingHippodromes = 0; numHippodromes = numWorkingHippodromes; numWorkingColosseums = numHippodromes; numColosseums = numWorkingColosseums; numWorkingLibraries = 0; numLibraries = numWorkingLibraries; numWorkingSchools = numLibraries; numSchools = numWorkingSchools; numWorkingBarbers = 0; numBarbers = numWorkingBarbers; numWorkingAcademies = numBarbers; numAcademies = numWorkingAcademies; numWorkingClinics = 0; numClinics = numWorkingClinics; numWorkingBathhouses = numClinics; numBathhouses = numWorkingBathhouses; numWorkingHospitals = 0; numHospitals = numWorkingHospitals; numWorkingForums = 0; numForums = numWorkingForums; numWorkingUpgradedForums = 0; numUpgradedForums = numWorkingUpgradedForums; numWorkingSenates = 0; numSenates = numWorkingSenates; numWorkingUpgradedSenates = 0; numUpgradedSenates = numWorkingUpgradedSenates; numWorkingActorColonies = 0; numActorColonies = numWorkingActorColonies; numWorkingGladiatorSchools = 0; numGladiatorSchools = numWorkingGladiatorSchools; numWorkingLionHouses = 0; numLionHouses = numWorkingLionHouses; numWorkingChariotMakers = 0; numChariotMakers = numWorkingChariotMakers; numWorkingMarkets = 0; numMarkets = numWorkingMarkets; numWorkingReservoirs = 0; numReservoirs = numWorkingReservoirs; numWorkingFountains = 0; numFountains = numWorkingFountains; numWorkingMilitaryAcademies = 0; numMilitaryAcademies = numWorkingMilitaryAcademies; numWorkingBarracks = 0; numBarracks = numWorkingBarracks; for ( i = 0; i < 16; ++i ) { numIndustries[i] = 0; numWorkingIndustries[i] = 0; } city_inform[ciid].numWorkingWharfs = 0; city_inform[ciid].shipyardBoatsRequested = 0; for ( j = 0; j < 8; ++j ) city_inform[ciid].word_654388[j] = 0; city_inform[ciid].numWorkingDocks = 0; city_inform[ciid].numHospitalWorkers = 0; numSmallTemplesVenus = 0; numSmallTemplesMars = numSmallTemplesVenus; numSmallTemplesMercury = numSmallTemplesMars; numSmallTemplesNeptune = numSmallTemplesMercury; numSmallTemplesCeres = numSmallTemplesNeptune; numLargeTemplesVenus = 0; numLargeTemplesMars = numLargeTemplesVenus; numLargeTemplesMercury = numLargeTemplesMars; numLargeTemplesNeptune = numLargeTemplesMercury; numLargeTemplesCeres = numLargeTemplesNeptune; numWorkingSmallTemplesVenus = 0; numWorkingSmallTemplesMars = numWorkingSmallTemplesVenus; numWorkingSmallTemplesMercury = numWorkingSmallTemplesMars; numWorkingSmallTemplesNeptune = numWorkingSmallTemplesMercury; numWorkingSmallTemplesCeres = numWorkingSmallTemplesNeptune; numWorkingLargeTemplesVenus = 0; numWorkingLargeTemplesMars = numWorkingLargeTemplesVenus; numWorkingLargeTemplesMercury = numWorkingLargeTemplesMars; numWorkingLargeTemplesNeptune = numWorkingLargeTemplesMercury; numWorkingLargeTemplesCeres = numWorkingLargeTemplesNeptune; numOracles = 0; for ( k = 1; k < MAX_BUILDINGS; ++k ) { if ( buildings[k].inUse == 1 && !buildings[k].house_size ) { switch ( buildings[k].type ) { case B_Theater: v0 = 1; ++numTheaters; if ( buildings[k].num_workers > 0 ) ++numWorkingTheaters; break; case B_Amphitheater: v0 = 1; ++numAmphitheaters; if ( buildings[k].num_workers > 0 ) ++numWorkingAmphitheaters; break; case B_Colosseum: v0 = 1; ++numColosseums; if ( buildings[k].num_workers > 0 ) ++numWorkingColosseums; break; case B_Hippodrome: v0 = 1; ++numHippodromes; if ( buildings[k].num_workers > 0 ) ++numWorkingHippodromes; break; case B_School: ++numSchools; if ( buildings[k].num_workers > 0 ) ++numWorkingSchools; break; case B_Library: ++numLibraries; if ( buildings[k].num_workers > 0 ) ++numWorkingLibraries; break; case B_Academy: ++numAcademies; if ( buildings[k].num_workers > 0 ) ++numWorkingAcademies; break; case B_Barber: ++numBarbers; if ( buildings[k].num_workers > 0 ) ++numWorkingBarbers; break; case B_Bathhouse: ++numBathhouses; if ( buildings[k].num_workers > 0 ) ++numWorkingBathhouses; break; case B_Doctor: ++numClinics; if ( buildings[k].num_workers > 0 ) ++numWorkingClinics; break; case B_Hospital: ++numHospitals; if ( buildings[k].num_workers > 0 ) ++numWorkingHospitals; city_inform[ciid].numHospitalWorkers += buildings[k].num_workers; break; case B_Senate: ++numSenates; if ( buildings[k].num_workers > 0 ) ++numWorkingSenates; break; case B_SenateUpgraded: ++numUpgradedSenates; if ( buildings[k].num_workers > 0 ) ++numWorkingUpgradedSenates; break; case B_Forum: ++numForums; if ( buildings[k].num_workers > 0 ) ++numWorkingForums; break; case B_ForumUpgraded: ++numUpgradedForums; if ( buildings[k].num_workers > 0 ) ++numWorkingUpgradedForums; break; case B_GladiatorSchool: ++numGladiatorSchools; if ( buildings[k].num_workers > 0 ) ++numWorkingGladiatorSchools; break; case B_LionHouse: ++numLionHouses; if ( buildings[k].num_workers > 0 ) ++numWorkingLionHouses; break; case B_ActorColony: ++numActorColonies; if ( buildings[k].num_workers > 0 ) ++numWorkingActorColonies; break; case B_ChariotMaker: ++numChariotMakers; if ( buildings[k].num_workers > 0 ) ++numWorkingChariotMakers; break; case B_Market: ++numMarkets; if ( buildings[k].num_workers > 0 ) ++numWorkingMarkets; break; case B_MilitaryAcademy: ++numMilitaryAcademies; if ( buildings[k].num_workers > 0 ) ++numWorkingMilitaryAcademies; break; case B_Barracks: city_inform[ciid].barracksBuildingId = k; ++numBarracks; if ( buildings[k].num_workers > 0 ) ++numWorkingBarracks; break; case B_SmallTempleCeres: ++numSmallTemplesCeres; if ( buildings[k].num_workers > 0 ) ++numWorkingSmallTemplesCeres; break; case B_SmallTempleNeptune: ++numSmallTemplesNeptune; if ( buildings[k].num_workers > 0 ) ++numWorkingSmallTemplesNeptune; break; case B_SmallTempleMercury: ++numSmallTemplesMercury; if ( buildings[k].num_workers > 0 ) ++numWorkingSmallTemplesMercury; break; case B_SmallTempleMars: ++numSmallTemplesMars; if ( buildings[k].num_workers > 0 ) ++numWorkingSmallTemplesMars; break; case B_SmallTempleVenus: ++numSmallTemplesVenus; if ( buildings[k].num_workers > 0 ) ++numWorkingSmallTemplesVenus; break; case B_LargeTempleCeres: ++numLargeTemplesCeres; if ( buildings[k].num_workers > 0 ) ++numWorkingLargeTemplesCeres; break; case B_LargeTempleNeptune: ++numLargeTemplesNeptune; if ( buildings[k].num_workers > 0 ) ++numWorkingLargeTemplesNeptune; break; case B_LargeTempleMercury: ++numLargeTemplesMercury; if ( buildings[k].num_workers > 0 ) ++numWorkingLargeTemplesMercury; break; case B_LargeTempleMars: ++numLargeTemplesMars; if ( buildings[k].num_workers > 0 ) ++numWorkingLargeTemplesMars; break; case B_LargeTempleVenus: ++numLargeTemplesVenus; if ( buildings[k].num_workers > 0 ) ++numWorkingLargeTemplesVenus; break; case B_Oracle: ++numOracles; break; case B_Reservoir: ++numReservoirs; if ( buildings[k].hasFountain > 0 ) ++numWorkingReservoirs; break; case B_Fountain: ++numFountains; if ( buildings[k].hasFountain > 0 ) ++numWorkingFountains; break; case B_WheatFarm: ++numWheatFarms; if ( buildings[k].num_workers > 0 ) ++numWorkingWheatFarms; break; case B_VegetableFarm: ++numVegetableFarms; if ( buildings[k].num_workers > 0 ) ++numWorkingVegetableFarms; break; case B_FruitFarm: ++numFruitFarms; if ( buildings[k].num_workers > 0 ) ++numWorkingFruitFarms; break; case B_OliveFarm: ++numOliveFarms; if ( buildings[k].num_workers > 0 ) ++numWorkingOliveFarms; break; case B_VinesFarm: ++numVinesFarms; if ( buildings[k].num_workers > 0 ) ++numWorkingVinesFarms; break; case B_PigFarm: ++numPigFarms; if ( buildings[k].num_workers > 0 ) ++numWorkingPigFarms; break; case B_MarbleQuarry: ++numMarbleQuarries; if ( buildings[k].num_workers > 0 ) ++numWorkingMarbleQuarries; break; case B_IronMine: ++numIronMines; if ( buildings[k].num_workers > 0 ) ++numWorkingIronMines; break; case B_TimberYard: ++numTimberYards; if ( buildings[k].num_workers > 0 ) ++numWorkingTimberYards; break; case B_ClayPit: ++numClayPits; if ( buildings[k].num_workers > 0 ) ++numWorkingClayPits; break; case B_WineWorkshop: ++numWineWorkshops; if ( buildings[k].num_workers > 0 ) ++numWorkingWineWorkshops; break; case B_OilWorkshop: ++numOilWorkshops; if ( buildings[k].num_workers > 0 ) ++numWorkingOilWorkshops; break; case B_WeaponsWorkshop: ++numWeaponsWorkshops; if ( buildings[k].num_workers > 0 ) ++numWorkingWeaponsWorkshops; break; case B_FurnitureWorkshop: ++numFurnitureWorkshops; if ( buildings[k].num_workers > 0 ) ++numWorkingFurnitureWorkshops; break; case B_PotteryWorkshop: ++numPotteryWorkshops; if ( buildings[k].num_workers > 0 ) ++numWorkingPotteryWorkshops; break; case B_Wharf: if ( buildings[k].num_workers > 0 ) { ++city_inform[ciid].numWorkingWharfs; if ( !buildings[k].wharf_hasBoat_house_evolveStatusDesir ) ++city_inform[ciid].shipyardBoatsRequested; } break; default: if ( buildings[k].type != B_Dock ) continue; if ( buildings[k].num_workers > 0 ) { if ( buildings[k].hasFountain ) { if ( city_inform[ciid].numWorkingDocks < 10 ) city_inform[ciid].word_654388[city_inform[ciid].numWorkingDocks] = k; ++city_inform[ciid].numWorkingDocks; } } break; } v1 = buildings[k].immigrantId; if ( buildings[k].immigrantId ) { if ( walkers[v1].state != 1 || walkers[v1].baseWorkingBuildingId != k ) buildings[k].immigrantId = 0; } if ( v0 ) { v0 = 0; if( buildings[k].house_bathhouse_dock_numships_entert_days > 0 ) { --buildings[k].house_bathhouse_dock_numships_entert_days; v0 = 1; } if ( buildings[k].house_hospital_entert_days2 > 0 ) { --buildings[k].house_hospital_entert_days2; ++v0; } buildings[k].house_clinic = v0; } } } if ( numHippodromes > 1 ) numHippodromes = 1; if ( numWorkingHippodromes > 1 ) numWorkingHippodromes = 1; } void fun_calculateCultureCoverage() { pctTheaterCoverage = getPercentage(500 * numWorkingTheaters, city_inform[ciid].population); pctAmphitheaterCoverage = getPercentage(800 * numWorkingAmphitheaters, city_inform[ciid].population); pctColosseumCoverage = getPercentage(1500 * numWorkingColosseums, city_inform[ciid].population); if ( numWorkingHippodromes < 1 ) pctHippodromeCoverage = 0; else pctHippodromeCoverage = 100; if ( pctTheaterCoverage > 100 ) pctTheaterCoverage = 100; if ( pctAmphitheaterCoverage > 100 ) pctAmphitheaterCoverage = 100; if ( pctColosseumCoverage > 100 ) pctColosseumCoverage = 100; pctReligionCoverageCeres = getPercentage( 500 * numOracles + 1500 * numWorkingLargeTemplesCeres + 750 * numWorkingSmallTemplesCeres, city_inform[ciid].population); pctReligionCoverageNeptune = getPercentage( 500 * numOracles + 1500 * numWorkingLargeTemplesNeptune + 750 * numWorkingSmallTemplesNeptune, city_inform[ciid].population); pctReligionCoverageMercury = getPercentage( 500 * numOracles + 1500 * numWorkingLargeTemplesMercury + 750 * numWorkingSmallTemplesMercury, city_inform[ciid].population); pctReligionCoverageMars = getPercentage( 500 * numOracles + 1500 * numWorkingLargeTemplesMars + 750 * numWorkingSmallTemplesMars, city_inform[ciid].population); pctReligionCoverageVenus = getPercentage( 500 * numOracles + 1500 * numWorkingLargeTemplesVenus + 750 * numWorkingSmallTemplesVenus, city_inform[ciid].population); pctReligionCoverageOracles = getPercentage(500 * numOracles, city_inform[ciid].population); if ( pctReligionCoverageCeres > 100 ) pctReligionCoverageCeres = 100; if ( pctReligionCoverageNeptune > 100 ) pctReligionCoverageNeptune = 100; if ( pctReligionCoverageMercury > 100 ) pctReligionCoverageMercury = 100; if ( pctReligionCoverageMars > 100 ) pctReligionCoverageMars = 100; if ( pctReligionCoverageVenus > 100 ) pctReligionCoverageVenus = 100; if ( pctReligionCoverageOracles > 100 ) pctReligionCoverageOracles = 100; city_inform[ciid].pctReligionCoverage = pctReligionCoverageVenus + pctReligionCoverageMars + pctReligionCoverageMercury + pctReligionCoverageNeptune + pctReligionCoverageCeres; city_inform[ciid].pctReligionCoverage /= 5; city_inform[ciid].schoolAgeChildren = fun_getNumberOfSchoolAgeChildren(ciid); city_inform[ciid].academyAgeChildren = fun_getNumberOfAcademyAgeChildren(ciid); pctSchoolCoverage = getPercentage(75 * numWorkingSchools, city_inform[ciid].schoolAgeChildren); pctLibraryCoverage = getPercentage(800 * numWorkingLibraries, city_inform[ciid].population); pctAcademyCoverage = getPercentage(100 * numWorkingAcademies, city_inform[ciid].academyAgeChildren); if ( pctSchoolCoverage > 100 ) pctSchoolCoverage = 100; if ( pctLibraryCoverage > 100 ) pctLibraryCoverage = 100; if ( pctAcademyCoverage > 100 ) pctAcademyCoverage = 100; pctHospitalCoverage = getPercentage(1000 * numWorkingHospitals, city_inform[ciid].population); if ( pctHospitalCoverage > 100 ) pctHospitalCoverage = 100; } void fun_distributeTreasuryOverForumsAndSenates() { int remainder; // [sp+4Ch] [bp-10h]@2 int share; // [sp+50h] [bp-Ch]@2 signed int units; // [sp+54h] [bp-8h]@1 signed int i; // [sp+58h] [bp-4h]@6 units = 5 * numWorkingSenates + numWorkingForums + 8 * numWorkingUpgradedSenates + 2 * numWorkingUpgradedForums; if ( city_inform[ciid].treasury > 0 ) { if ( units > 0 ) { share = city_inform[ciid].treasury / units; remainder = city_inform[ciid].treasury - share * units; } else { share = 0; remainder = 0; } } else { share = 0; remainder = 0; } for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( !buildings[i].house_size ) { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = 0; if ( buildings[i].num_workers > 0 ) { if ( buildings[i].type == B_SenateUpgraded ) { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = remainder + 8 * share; remainder = 0; } switch ( buildings[i].type ) { case B_Senate: if ( remainder ) { if ( numWorkingUpgradedSenates ) { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = 5 * share; } else { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = remainder + 5 * share; remainder = 0; } } else { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = 5 * share; } break; case B_Forum: if ( remainder ) { if ( numWorkingSenates || numWorkingUpgradedSenates || numWorkingUpgradedForums ) { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = share; } else { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = remainder + share; remainder = 0; } } else { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = share; } break; case B_ForumUpgraded: if ( remainder ) { if ( numWorkingSenates || numWorkingUpgradedSenates ) { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = 2 * share; } else { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = remainder + 2 * share; remainder = 0; } } else { building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * i] = 2 * share; } break; } } } } } } void sub_466330(int a1) { int v1; // [sp+4Ch] [bp-4h]@1 v1 = walkers[a1].baseWorkingBuildingId; switch ( walkers[walkerId].type ) { case Walker_LionTamer: buildings[v1].house_bathhouse_dock_numships_entert_days = 32; break; case Walker_Charioteer: buildings[v1].house_bathhouse_dock_numships_entert_days = 32; break; case Walker_Actor: ++buildings[v1].house_ceres; if ( buildings[v1].house_ceres >= 5 ) buildings[v1].house_ceres = 0; if ( buildings[v1].type == B_Theater ) buildings[v1].house_bathhouse_dock_numships_entert_days = 32; else buildings[v1].house_hospital_entert_days2 = 32; break; case Walker_Gladiator: if ( buildings[v1].type == B_Amphitheater ) buildings[v1].house_bathhouse_dock_numships_entert_days = 32; else buildings[v1].house_hospital_entert_days2 = 32; break; } } void fun_setAqueductGraphicIdsToWaterFromOffset(int gridOffset) { signed int v1; // eax@4 int v2; // [sp+4Ch] [bp-1Ch]@1 int graphicWithoutWater; // [sp+50h] [bp-18h]@3 int tileOfBuilding; // [sp+54h] [bp-14h]@12 int buildingId; // [sp+58h] [bp-10h]@10 int nextOffset; // [sp+5Ch] [bp-Ch]@7 int newOffset; // [sp+60h] [bp-8h]@10 signed int i; // [sp+64h] [bp-4h]@7 v2 = 0; if ( grid_terrain[gridOffset] & 0x100 ) { graphicWithoutWater = graphic_aqueduct + 15; fun_memset(word_94B3C0, 2000, 0); dword_98C490 = 0; dword_94A310 = 0; do { v1 = v2++; if ( v1 >= 26244 ) break; grid_aqueducts[gridOffset] = 1; if ( grid_graphicIds[gridOffset] >= graphicWithoutWater ) grid_graphicIds[gridOffset] -= 15; // set graphic to 'with water' nextOffset = -1; for ( i = 0; i < 4; ++i ) { newOffset = tile_adjacentGridOffsets[i] + gridOffset; buildingId = grid_buildingIds[newOffset]; if ( grid_buildingIds[newOffset] && buildings[buildingId].type == B_Reservoir ) { tileOfBuilding = grid_edge[newOffset] & 0x3F; if ( grid_edge[newOffset] & 0x3F ) // not top left corner { if ( tileOfBuilding != 2 ) // not top right corner { if ( tileOfBuilding != 16 ) // not bottom left corner { if ( tileOfBuilding != 18 ) // not bottom right corner { if ( !buildings[buildingId].hasFountain ) buildings[buildingId].hasFountain = 2; } } } } } else { if ( grid_terrain[newOffset] & T_Aqueduct ) { if ( !grid_aqueducts[newOffset] ) { if ( nextOffset == -1 ) { nextOffset = tile_adjacentGridOffsets[i] + gridOffset; } else { word_94B3C0[dword_94A310++] = newOffset; if ( dword_94A310 >= 1000 ) dword_94A310 = 0; } } } } } if ( nextOffset == -1 ) { if ( dword_98C490 == dword_94A310 ) return; nextOffset = word_94B3C0[dword_98C490++]; if ( dword_98C490 >= 1000 ) dword_98C490 = 0; } gridOffset = nextOffset; } while ( nextOffset > -1 ); } } void fun_setAqueductGraphicIdsToNoWater() { int offset; // [sp+4Ch] [bp-10h]@1 int y; // [sp+50h] [bp-Ch]@1 int x; // [sp+54h] [bp-8h]@3 int graphicId; // [sp+58h] [bp-4h]@1 offset = setting_map_startGridOffset; graphicId = graphic_aqueduct + 15; y = 0; while ( y < setting_map_height ) { x = 0; while ( x < setting_map_width ) { if ( grid_terrain[offset] & T_Aqueduct ) { grid_aqueducts[offset] = 0; if ( grid_graphicIds[offset] < graphicId ) grid_graphicIds[offset] += 15; } ++x; ++offset; } ++y; offset += setting_map_gridBorderSize; } } void sub_466880() { __int16 v0; // cx@9 int v1; // [sp+4Ch] [bp-14h]@1 int v2; // [sp+50h] [bp-10h]@4 int v3; // [sp+54h] [bp-Ch]@6 signed int k; // [sp+58h] [bp-8h]@16 signed int i; // [sp+5Ch] [bp-4h]@1 signed int j; // [sp+5Ch] [bp-4h]@13 v1 = 1; for ( i = 0; i < 10; ++i ) { city_inform[ciid].dword_6545CC[i] = 0; city_inform[ciid].dword_6545D0[i] = 0; } fun_memset(byte_91C920, 26244, 0); fun_memset(byte_8ADF60, 26244, 0); dword_94BC6C = 1; dword_94A304 = 0; walkerBaseGridOffset = setting_map_startGridOffset; v2 = 0; while ( v2 < setting_map_height ) { v3 = 0; while ( v3 < setting_map_width ) { v0 = grid_terrain[walkerBaseGridOffset]; if ( v0 & 0x40 && !byte_91C920[walkerBaseGridOffset] ) { dword_98BED8 = 1; sub_466B70(walkerBaseGridOffset, v1); for ( j = 0; j < 10; ++j ) { if ( dword_98BED8 > city_inform[ciid].dword_6545D0[j] ) { for ( k = 9; k > j; --k ) { city_inform[ciid].dword_6545CC[k] = city_inform[ciid].numWineTypesAvailable[k]; city_inform[ciid].dword_6545D0[k] = city_inform[ciid].maxProsperity[k]; } city_inform[ciid].dword_6545CC[j] = v1; city_inform[ciid].dword_6545D0[j] = dword_98BED8; break; } } ++v1; } ++v3; ++walkerBaseGridOffset; } ++v2; walkerBaseGridOffset += setting_map_gridBorderSize; } } char sub_466B70(signed int a1, char a2) { int v2; // eax@2 int v4; // [sp+4Ch] [bp-1Ch]@1 signed int v5; // [sp+5Ch] [bp-Ch]@3 int v6; // [sp+60h] [bp-8h]@6 signed int i; // [sp+64h] [bp-4h]@3 v4 = 0; fun_memset(word_94B3C0, 2000, 0); dword_98C490 = 0; dword_94A310 = 0; do { v2 = v4++; if ( v2 >= 26244 ) break; _LOBYTE(v2) = a2; byte_91C920[a1] = a2; byte_8ADF60[a1] = dword_94BC6C; v5 = -1; for ( i = 0; i < 4; ++i ) { v6 = tile_adjacentGridOffsets[i] + a1; if ( grid_groundType[v6] >= 0 ) { if ( grid_groundType[v6] <= 2 ) { if ( grid_groundType[v6] != 2 || grid_terrain[v6] & T_AccessRamp ) { if ( !byte_91C920[v6] ) { byte_91C920[v6] = a2; byte_8ADF60[v6] = dword_94BC6C; ++dword_98BED8; if ( v5 == -1 ) { v5 = v6; ++dword_94A304; } else { word_94B3C0[dword_94A310++] = v6; if ( dword_94A310 >= 1000 ) dword_94A310 = 0; } } } } } v2 = i + 1; } if ( v5 == -1 ) { if ( dword_98C490 == dword_94A310 ) return v2; _LOBYTE(v2) = dword_98C490; v5 = word_94B3C0[dword_98C490++]; if ( dword_98C490 >= 1000 ) dword_98C490 = 0; } if ( dword_94A304 > 30 ) { v2 = dword_94BC6C++ + 1; dword_94A304 = 0; } a1 = v5; } while ( v5 > -1 ); return v2; } void unused_466DF0() { ; } void unused_466E10() { ; } void handleFireCollapseEvent() { signed int v0; // [sp+4Ch] [bp-14h]@1 int v1; // [sp+50h] [bp-10h]@13 int v2; // [sp+54h] [bp-Ch]@3 int i; // [sp+5Ch] [bp-4h]@3 v0 = 0; city_inform[ciid].dword_65433C = 0; city_inform[ciid].crimeRate = 0; if ( debug_houseEvolution != 1 ) { v2 = random_7f_1 & 7; for ( i = 1; i <= buildingId_highestInUse; ++i ) { if ( buildings[i].inUse == 1 ) { if ( !buildings[i].byte_94BD84 ) { if ( buildings[i].type != 32 || !buildings[i].warehouse_nextStorage ) { v1 = (i + grid_random[buildings[i].gridOffset]) & 7; if ( v1 == v2 ) buildings[i].damageRisk += 3; else ++buildings[i].damageRisk; if ( tutorial1_fire == 1 ) { if ( !tutorial1_prefectureBuilt ) buildings[i].damageRisk += 5; } if ( buildings[i].house_size ) { if ( buildings[i].level_resourceId <= 1 ) buildings[i].damageRisk = 0; } if ( buildings[i].damageRisk <= 200 ) { if ( v1 == v2 ) { if ( buildings[i].house_size ) { if (buildings[i].house_population > 0 ) { if ( buildings[i].level_resourceId > 3 ) { if ( buildings[i].level_resourceId >= 12 ) buildings[i].fireRisk += 2; else buildings[i].fireRisk += 5; } else { buildings[i].fireRisk += 10; } } else { buildings[i].fireRisk = 0; } } else { buildings[i].fireRisk += 5; } if ( !tutorial1_fire ) buildings[i].fireRisk += 5; if ( scn_climate == 1 ) buildings[i].fireRisk = 0; if ( scn_climate == 2 ) buildings[i].fireRisk += 3; } if ( buildings[i].fireRisk > 100 ) { if ( time_current - dword_659B68 <= 15000 ) dword_65DED0 = 0; else dword_659B68 = time_current; if ( tutorial1_fire ) { if ( dword_65DE84 <= 0 ) { message_usePopup = 1; dword_65DE84 = 12; } fun_postMessageToPlayer(12, buildings[i].type, buildings[i].gridOffset); ++dword_65DE24; } else { tutorial1_fire = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(53, 0, 0); } sub_46E3D0(i, 0); sub_467A70(i, 1); sound_playChannel(5); v0 = 1; } } else { if ( time_current - dword_65DE10 <= 15000 ) dword_65DED0 = 0; else dword_65DE10 = time_current; if ( tutorial1_prefectureBuilt ) { if ( dword_65DE88[0] <= 0 ) { message_usePopup = 1; dword_65DE88[0] = 12; } // building collapsed fun_postMessageToPlayer(13, buildings[i].type, buildings[i].gridOffset); ++dword_65DE28; } else { tutorial1_prefectureBuilt = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); message_usePopup = 1; fun_postMessageToPlayer(54, 0, 0);// first collapse } dword_8E1484 = 0; buildings[i].inUse = 4; collapseBuildingToRubble( i, buildings[i].x, buildings[i].y, buildings[i].size, buildings[i].size); fun_createDustCloud( buildings[i].x, buildings[i].y, buildings[i].size); sub_467A70(i, 0); v0 = 1; } } } } } if ( v0 ) { fun_determineGroundType(); sub_4FFDF0(); } } } void fun_enemyHitBuilding(int gridOffset, signed int maxDamage) { ++grid_buildingDamage[gridOffset]; if ( grid_buildingDamage[gridOffset] > maxDamage ) fun_destroyBuildingByEnemyAt( (gridOffset - setting_map_startGridOffset) % 162, (gridOffset - setting_map_startGridOffset) / 162, gridOffset); } void fun_destroyBuildingByEnemyAt(int x, int y, int mapOffset) { int buildingId; // [sp+4Ch] [bp-4h]@1 buildingId = grid_buildingIds[mapOffset]; if ( buildingId > 0 ) { collapseBuildingToRubble( buildingId, buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, buildings[buildingId].size); if ( buildings[buildingId].inUse == 1 ) { switch ( buildings[buildingId].type ) { case B_HouseVacantLot: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_HouseLargeTent: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_Prefecture: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_EngineersPost: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_Well: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_FortGround__: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_FortGround: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_Gatehouse: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; case B_Tower: city_inform[ciid].numDestroyedBuildingsByEnemies = city_inform[ciid].numDestroyedBuildingsByEnemies; break; default: ++city_inform[ciid].numDestroyedBuildingsByEnemies; break; } if ( city_inform[ciid].numDestroyedBuildingsByEnemies >= 12 ) city_inform[ciid].numDestroyedBuildingsByEnemies = 12; buildings[buildingId].inUse = 4; fun_createDustCloud( buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size); sub_467A70(buildingId, 0); } } else { if ( grid_terrain[mapOffset] & T_Wall ) fun_removeTowerSentry(x, y); collapseBuildingToRubble(0, x, y, 1, 1); } sub_4A7A70(); sub_47E2B0(x, y, 3); sub_47FAF0(x - 2, y - 2, x + 2, y + 2, 0); fun_determineGroundType(); sub_4FFDF0(); sub_500420(); } void sub_467A70(int a1, int a2) { int v2; // [sp+4Ch] [bp-8h]@1 int v3; // [sp+4Ch] [bp-8h]@8 signed int v4; // [sp+50h] [bp-4h]@1 signed int v5; // [sp+50h] [bp-4h]@8 v4 = 0; v2 = a1; while ( v4 < 9 ) { v2 = buildings[v2].warehouse_prevStorage; if ( v2 <= 0 ) break; if ( a2 ) { sub_46E3D0(v2, 0); } else { collapseBuildingToRubble( v2, buildings[v2].x, buildings[v2].y, buildings[v2].size, buildings[v2].size); buildings[v2].inUse = 4; } ++v4; } v5 = 0; v3 = a1; while ( v5 < 9 ) { v3 = buildings[v3].warehouse_prevStorage; if ( v3 <= 0 ) break; if ( a2 ) { sub_46E3D0(v3, 0); } else { collapseBuildingToRubble( v3, buildings[v3].x, buildings[v3].y, buildings[v3].size, buildings[v3].size); buildings[v3].inUse = 4; } ++v5; } } void checkBurningRuins() { __int16 v0; // cx@17 __int16 v1; // ax@20 int v2; // edx@34 signed int v3; // [sp+4Ch] [bp-18h]@1 int v4; // [sp+50h] [bp-14h]@28 int v5; // [sp+50h] [bp-14h]@31 int v6; // [sp+50h] [bp-14h]@34 int v7; // [sp+54h] [bp-10h]@28 int v8; // [sp+58h] [bp-Ch]@26 int v9; // [sp+5Ch] [bp-8h]@24 int i; // [sp+60h] [bp-4h]@1 v3 = 0; dword_98C020 = 0; dword_98C024 = 0; dword_98BF18 = 0; for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 && buildings[i].type == B_BurningRuin ) { if ( buildings[i].burningRuinStep< 0 ) buildings[i].burningRuinStep= 0; ++buildings[i].burningRuinStep; if ( buildings[i].burningRuinStep> 32 ) { dword_8E1484 = 0; buildings[i].inUse = 4; collapseBuildingToRubble( i, buildings[i].x, buildings[i].y, buildings[i].size, buildings[i].size); v3 = 1; continue; } if ( !buildings[i].byte_94BDB9 ) { ++dword_98BF18; word_98C080[dword_98C024++] = i; if ( dword_98C024 >= 500 ) dword_98C024 = 499; if ( scn_climate == 2 ) { v0 = buildings[i].burningRuinStep; if ( v0 & 3 ) continue; } else { v1 = buildings[i].burningRuinStep; if ( v1 & 7 ) continue; } if ( (buildings[i].byte_94BD85 & 3) == (random_7f_1 & 3) ) { v9 = dword_94BD38 - 1; if ( dword_94BD38 - 1 < 0 ) v9 = 7; v8 = dword_94BD38 + 1; if ( dword_94BD38 + 1 > 7 ) v8 = 0; v7 = buildings[i].gridOffset; v4 = grid_buildingIds[dword_5FFE4C[dword_94BD38] + v7]; if ( !grid_buildingIds[dword_5FFE4C[dword_94BD38] + v7] || buildings[v4].byte_94BD84 ) { v5 = grid_buildingIds[dword_5FFE4C[v9] + v7]; if ( !grid_buildingIds[dword_5FFE4C[v9] + v7] || buildings[v5].byte_94BD84 ) { v2 = dword_5FFE4C[v8] + v7; v6 = grid_buildingIds[v2]; if ( grid_buildingIds[v2] ) { if ( !buildings[v6].byte_94BD84 ) { sub_46E3D0(v6, 0); sub_467A70(v6, 1); sound_playChannel(5); v3 = 1; } } } else { sub_46E3D0(v5, 0); sub_467A70(v5, 1); sound_playChannel(5); v3 = 1; } } else { sub_46E3D0(v4, 0); sub_467A70(v4, 1); sound_playChannel(5); v3 = 1; } } } } } if ( v3 ) { fun_determineGroundType(); sub_4FFDF0(); } } int sub_4680A0(int a1, int a2) { signed int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@20 int v5; // [sp+54h] [bp-Ch]@11 int v6; // [sp+58h] [bp-8h]@1 int v7; // [sp+5Ch] [bp-4h]@3 v6 = 0; dword_94A2F8 = 10000; v3 = 10000; dword_98C020 = 0; while ( dword_98C020 < dword_98C024 ) { v7 = word_98C080[dword_98C020++]; if ( buildings[v7].inUse == 1 ) { if ( buildings[v7].type == B_BurningRuin ) { if ( !buildings[v7].byte_94BDB9 ) { if ( buildings[v7].haveRomeroad ) { v5 = fun_getDistanceMaximum(a1, a2, buildings[v7].x, buildings[v7].y); if ( buildings[v7].towerBallistaId ) { if ( v5 < v3 ) { v3 = v5; v4 = v7; } } else { if ( v5 < dword_94A2F8 ) { dword_94A2F8 = v5; v6 = v7; } } } } } } } if ( !v6 ) { if ( v3 <= 2 ) { v6 = v4; dword_94A2F8 = 2; } } return v6; } void checkCrimeAndGenerateCriminal() { signed int i; // [sp+64h] [bp-4h]@1 int minCrimeRiskHIndex = 0; int minCrimeRiskValue = 50; for ( i = 1; i <= buildingId_highestInUse; ++i ) { if ( buildings[i].inUse == 1 && buildings[i].house_size > 0) { if ( buildings[i].house_crimeRisk < 50 ) { if ( buildings[i].house_crimeRisk < minCrimeRiskValue ) { minCrimeRiskValue = buildings[i].house_crimeRisk; minCrimeRiskHIndex = i; } } else { buildings[i].byte_94BD7D = 0; } } } if ( minCrimeRiskHIndex ) { if ( setting_currentMissionId >= 2 || setting_isCustomScenario ) { if ( city_inform[ciid].hapinessCity >= 30 ) { if ( city_inform[ciid].hapinessCity >= 60 ) { if ( random_7f_1 >= city_inform[ciid].hapinessCity + 20 ) { if ( minCrimeRiskValue < 50 ) fun_generateProtester(minCrimeRiskHIndex); } } else { if ( random_7f_1 >= city_inform[ciid].hapinessCity + 40 ) { if ( minCrimeRiskValue >= 30 ) { if ( minCrimeRiskValue < 50 ) fun_generateProtester(minCrimeRiskHIndex); } else { generateMugger(minCrimeRiskHIndex); } } } } else { if ( random_7f_1 >= city_inform[ciid].hapinessCity + 50 ) { if ( minCrimeRiskValue > 10 ) { if ( minCrimeRiskValue >= 30 ) { if ( minCrimeRiskValue < 50 ) fun_generateProtester(minCrimeRiskHIndex); } else { generateMugger(minCrimeRiskHIndex); } } else { fun_generateRioter(minCrimeRiskHIndex); } } } } } } void fun_generateRioter(int buildingId) { int walkerId; // [sp+4Ch] [bp-18h]@28 __int16 v2; // [sp+50h] [bp-14h]@3 __int16 v3; // [sp+54h] [bp-10h]@3 int v4; // [sp+58h] [bp-Ch]@14 signed int v5; // [sp+5Ch] [bp-8h]@4 signed int i; // [sp+60h] [bp-4h]@14 if ( sub_489070( buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, 4) ) { ++city_inform[ciid].crimeRate; v3 = walkerGridX; v2 = walkerGridY; if ( city_inform[ciid].population > 150 ) { if ( city_inform[ciid].population > 300 ) { if ( city_inform[ciid].population > 800 ) { if ( city_inform[ciid].population > 1200 ) { if ( city_inform[ciid].population > 2000 ) v5 = 6; else v5 = 5; } else { v5 = 4; } } else { v5 = 3; } } else { v5 = 2; } } else { v5 = 1; } sub_4C1100(); for ( i = 0; i < v5; ++i ) { walkerId = spawnWalker(ciid, Walker_Rioter, v3, v2, 4); walkers[walkerId].actionState = 120; walkers[walkerId].word_7FA374 = 0; walkers[walkerId].word_7FA366 = 4 * i + 10; if ( v4 ) { walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].baseWorkingBuildingId = v4; } else { walkers[walkerId].state = 2; } } sub_46E3D0(buildingId, 0); ++city_inform[ciid].dword_654264; city_inform[ciid].dword_65450C = city_inform[ciid].dword_654464; fun_decreaseCrimeRisk(20); if ( !tutorial1_crime ) { tutorial1_crime = 1; fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); if ( window_id == 1 ) fun_drawCityScreenForeground(); } if ( time_current - dword_659F70 <= 15000 ) dword_65DED0 = 0; else dword_659F70 = time_current; if ( dword_65DE80[0] <= 0 ) { message_usePopup = 1; dword_65DE80[0] = 12; } fun_postMessageToPlayer(11, buildings[buildingId].type, walkers[walkerId].gridOffset); ++dword_65DE20[0]; } } void generateMugger(int buildingId) { int v1; // [sp+4Ch] [bp-8h]@5 int moneyStolen; // [sp+50h] [bp-4h]@7 ++city_inform[ciid].crimeRate; if ( buildings[buildingId].byte_94BD7D < 2 ) { buildings[buildingId].byte_94BD7D = 2; if ( sub_489070( buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, 2) ) { v1 = spawnWalker(buildings[buildingId].cityId, Walker_Criminal, walkerGridX, walkerGridY, 4); walkers[v1].word_7FA366 = (buildings[buildingId].byte_94BD85 & 0xF) + 10; ++city_inform[ciid].dword_654260; if ( city_inform[ciid].finance_taxes_thisyear > 20 ) { moneyStolen = city_inform[ciid].finance_taxes_thisyear / 4; if ( moneyStolen > 400 ) moneyStolen = 400 - random_7f_1 / 2; message_usePopup = 1; fun_postMessageToPlayer(52, moneyStolen, walkers[v1].gridOffset ); city_inform[ciid].moneyStolenThisYear += moneyStolen; city_inform[ciid].treasury -= moneyStolen; city_inform[ciid].finance_sundries_thisyear += moneyStolen; } } } } void fun_generateProtester(int buildingId) { ++city_inform[ciid].dword_65433C; if ( buildings[buildingId].byte_94BD7D < 1 ) { buildings[buildingId].byte_94BD7D = 1; if ( sub_489070( buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, 2) ) { walkers[ spawnWalker(buildings[buildingId].cityId, Walker_Protestor, walkerGridX, walkerGridY, 4)].word_7FA366 = (buildings[buildingId].byte_94BD85 & 0xF) + 10; ++city_inform[ciid].dword_654260; } } } void fun_removeGoodsFromStorageForMercury(int bigCurse) { signed int v1; // eax@26 signed int v2; // eax@26 signed int v3; // eax@26 signed int v4; // [sp+4Ch] [bp-18h]@1 int buildingId; // [sp+50h] [bp-14h]@1 signed int v6; // [sp+58h] [bp-Ch]@6 int j; // [sp+5Ch] [bp-8h]@7 signed int k; // [sp+5Ch] [bp-8h]@12 int i; // [sp+60h] [bp-4h]@1 v4 = 0; buildingId = 0; for ( i = 1; i < MAX_BUILDINGS; ++i ) // find building with most goods { if ( buildings[i].inUse != 1 ) continue; v6 = 0; if ( buildings[i].type == B_Warehouse ) { for ( j = 1; j <= 15; ++j ) v6 += fun_getGoodAmountStoredInWarehouse(i, j); } else { if ( buildings[i].type != B_Granary ) continue; for ( k = 1; k <= 6; ++k ) v6 += sub_45D620(i, k); v6 /= 100; } if ( v6 > v4 ) { v4 = v6; buildingId = i; } } if ( buildingId ) { if ( bigCurse == 1 ) { dword_65DED0 = 0; fun_postMessageToPlayer(12, buildings[buildingId].type, buildings[buildingId].gridOffset); sub_46E3D0(buildingId, 0); sub_467A70(buildingId, 1); sound_playChannel(5); fun_determineGroundType(); sub_4FFDF0(); } else { if ( buildings[buildingId].type == B_Warehouse ) { fun_removeGoodsFromWarehouseForMercury(buildingId, 16); } else { if ( buildings[buildingId].type == B_Granary ) { v1 = fun_removeFoodFromGranaryForMercury(buildingId, G_Wheat, 1600); v2 = fun_removeFoodFromGranaryForMercury(buildingId, G_Vegetables, v1); v3 = fun_removeFoodFromGranaryForMercury(buildingId, G_Fruit, v2); fun_removeFoodFromGranaryForMercury(buildingId, G_MeatFish, v3); } } } } } void sub_468F00() { signed int v0; // [sp+4Ch] [bp-14h]@1 signed int v1; // [sp+50h] [bp-10h]@1 signed int v2; // [sp+54h] [bp-Ch]@6 signed int j; // [sp+58h] [bp-8h]@7 signed int k; // [sp+58h] [bp-8h]@16 signed int l; // [sp+58h] [bp-8h]@19 signed int m; // [sp+58h] [bp-8h]@22 signed int n; // [sp+58h] [bp-8h]@25 signed int i; // [sp+5Ch] [bp-4h]@1 v0 = 10000; v1 = 0; for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { v2 = 0; if ( buildings[i].type == B_Granary ) { for ( j = 1; j <= 6; ++j ) v2 += sub_45D620(i, j); if ( v2 < v0 ) { v0 = v2; v1 = i; } } } } if ( v1 ) { for ( k = 0; k < 6; ++k ) sub_45D3D0(v1, 1, 0); for ( l = 0; l < 6; ++l ) sub_45D3D0(v1, 2, 0); for ( m = 0; m < 6; ++m ) sub_45D3D0(v1, 3, 0); for ( n = 0; n < 6; ++n ) sub_45D3D0(v1, 6, 0); } } int destroyFirstBuildingOfType(int buildingType) { int gridOffset; // ST60_4@8 int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 && buildings[i].type == buildingType ) { gridOffset = buildings[i].gridOffset; dword_8E1484 = 0; buildings[i].inUse = 4; collapseBuildingToRubble( i, buildings[i].x, buildings[i].y, buildings[i].size, buildings[i].size); sound_playChannel(5); fun_determineGroundType(); sub_4FFDF0(); return gridOffset; } } return 0; } void sub_4691F0() { signed int i; // [sp+4Ch] [bp-4h]@1 dword_98BF40 = 0; dword_98BF6C = 0; dword_98BEE8 = 0; dword_98BEC4 = 0; for ( i = 1; i <= buildingId_highestInUse; ++i ) ; } void sub_469280() { dword_94A2FC = 0; dword_98C468 = 0; dword_98C00C = 0; dword_98BF40 = 0; dword_98BF6C = 0; dword_98C48C = 0; dword_98C05C = 0; dword_98BF74 = 0; dword_98BEE8 = 0; dword_98BEC4 = 0; } int sub_469320() { int result; // eax@1 signed int i; // [sp+5Ch] [bp-4h]@1 result = fun_memset(grid_desirability, 26244, 0); for ( i = 1; i <= buildingId_highestInUse; ++i ) { if ( buildings[i].inUse == 1 ) sub_48BCD0( buildings[i].x, buildings[i].y, buildings[i].size, model_buildings[buildings[i].type].desirability, model_buildings[buildings[i].type].des_step, model_buildings[buildings[i].type].des_stepSize, model_buildings[buildings[i].type].des_range); result = i + 1; } return result; } int sub_469470() { int result; // eax@2 __int16 v1; // cx@13 __int16 v2; // [sp+5Ch] [bp-14h]@7 signed int v3; // [sp+60h] [bp-10h]@8 int v4; // [sp+64h] [bp-Ch]@1 int v5; // [sp+68h] [bp-8h]@3 int v6; // [sp+6Ch] [bp-4h]@1 v6 = setting_map_startGridOffset; v4 = 0; LABEL_2: result = v4; if ( v4 < setting_map_height ) { v5 = 0; while ( 1 ) { if ( v5 >= setting_map_width ) { ++v4; v6 += setting_map_gridBorderSize; goto LABEL_2; } if ( grid_bitfields[v6] & 0x80 ) { v2 = grid_terrain[v6]; if ( v2 & 0x40 ) { v3 = 38; } else { if ( !(v2 & 2) ) { grid_bitfields[v6] &= 0x7Fu; goto LABEL_4; } v3 = 10; } sub_48BCD0( v5, v4, 1, model_buildings[v3].desirability, model_buildings[v3].des_step, model_buildings[v3].des_stepSize, model_buildings[v3].des_range); } else { v1 = grid_terrain[v6]; if ( v1 & 0x20 ) { sub_48BCD0( v5, v4, 1, model_buildings[312].desirability, model_buildings[312].des_step, model_buildings[312].des_stepSize, model_buildings[312].des_range); } else { if ( grid_terrain[v6] & 0x1000 ) sub_48BCD0(v5, v4, 1, -2, 1, 1, 2); } } LABEL_4: ++v5; ++v6; } } return result; } void fun_clearBuildings() { fun_memset(buildings, sizeof(buildings), 0); buildingId_highestInUseEver = 0; buildingId_placedSequence = 0; } int fun_createBuilding(int ciid, BuildingType type, int x, int y) { signed int buildingId; // [sp+4Ch] [bp-4h]@1 for ( buildingId = 1; ; ++buildingId ) { if ( buildingId >= MAX_BUILDINGS ) { showWarning( messageBildingLimitReach ); // data limit reached return 0; } if ( !buildings[buildingId].inUse && !sub_490F30(buildingId) ) break; } buildings[buildingId].inUse = 3; buildings[buildingId].cityId = ciid; buildings[buildingId].byte_always0 = city_inform[ciid].byte_6500A5_always0; buildings[buildingId].type = type; buildings[buildingId].size = LOBYTE(buildingSizes[4 * type]); buildings[buildingId].placedSequenceNumber = buildingId_placedSequence++; buildings[buildingId].house_crimeRisk = 50; buildings[buildingId].haveRomeroad = 0; buildings[buildingId].house_size = 0; if ( buildings[buildingId].type < B_HouseVacantLot || buildings[buildingId].type > B_HouseMediumInsula ) { if ( buildings[buildingId].type < B_HouseLargeInsula || buildings[buildingId].type > B_HouseMediumVilla ) { if ( buildings[buildingId].type < B_HouseLargeVilla || buildings[buildingId].type > B_HouseMediumPalace ) { if ( buildings[buildingId].type >= B_HouseLargePalace ) { if ( buildings[buildingId].type <= B_HouseLuxuryPalace ) buildings[buildingId].house_size = 4; } } else { buildings[buildingId].house_size = 3; } } else { buildings[buildingId].house_size = 2; } } else { buildings[buildingId].house_size = 1; } if ( buildings[buildingId].type < B_HouseVacantLot || buildings[buildingId].type > B_HouseLuxuryPalace ) buildings[buildingId].level_resourceId = 0; else buildings[buildingId].level_resourceId = type - 10; switch ( buildings[buildingId].type ) { case B_WheatFarm: buildings[buildingId].industry_outputGood = G_Wheat; break; case B_VegetableFarm: buildings[buildingId].industry_outputGood = G_Vegetables; break; case B_FruitFarm: buildings[buildingId].industry_outputGood = G_Fruit; break; case B_OliveFarm: buildings[buildingId].industry_outputGood = G_Olives; break; case B_VinesFarm: buildings[buildingId].industry_outputGood = G_Vines; break; case B_PigFarm: buildings[buildingId].industry_outputGood = G_MeatFish; break; case B_MarbleQuarry: buildings[buildingId].industry_outputGood = G_Marble; break; case B_IronMine: buildings[buildingId].industry_outputGood = G_Iron; break; case B_TimberYard: buildings[buildingId].industry_outputGood = G_Timber; break; case B_ClayPit: buildings[buildingId].industry_outputGood = G_Clay; break; case B_WineWorkshop: buildings[buildingId].industry_outputGood = G_Wine; buildings[buildingId].level_resourceId = 2; break; case B_OilWorkshop: buildings[buildingId].industry_outputGood = G_Oil; buildings[buildingId].level_resourceId = 1; break; case B_WeaponsWorkshop: buildings[buildingId].industry_outputGood = G_Weapons; buildings[buildingId].level_resourceId = 3; break; case B_FurnitureWorkshop: buildings[buildingId].industry_outputGood = G_Furniture; buildings[buildingId].level_resourceId = 4; break; case B_PotteryWorkshop: buildings[buildingId].industry_outputGood = G_Pottery; buildings[buildingId].level_resourceId = 5; break; default: buildings[buildingId].industry_outputGood = G_None; break; } if ( buildings[buildingId].type == B_Granary ) buildings[buildingId].granary_capacity[0] = 2400; buildings[buildingId].x = x; buildings[buildingId].y = y; buildings[buildingId].gridOffset = 162 * y + x + (_WORD)setting_map_startGridOffset; buildings[buildingId].byte_94BD85 = grid_random[buildings[buildingId].gridOffset] & 0x7F; buildings[buildingId].byte_94BD6C = buildings[buildingId].byte_94BD85 & 6; buildings[buildingId].byte_94BD84 = byte_5F6418[16 * type]; buildings[buildingId].adjacentToWater = isAdjacentToWater(x,y,buildings[buildingId].size); return buildingId; } void fun_deleteBuilding(int buildingId) { deleteBuildingEvent(buildingId); memset( &buildings[buildingId], 0, sizeof(Building) ); } void deleteBuildingEvent(int buildingId) { if ( buildings[buildingId].storageId ) storages[buildings[buildingId].storageId].inUse = 0; if ( buildings[buildingId].type == B_SenateUpgraded ) { if ( buildings[buildingId].gridOffset == city_inform[ciid].word_652822 ) { city_inform[ciid].word_652822 = 0; city_inform[ciid].byte_652820 = 0; city_inform[ciid].byte_652821 = 0; city_inform[ciid].word_6543AE = 0; } } if ( buildings[buildingId].type == B_Dock ) --city_inform[ciid].numWorkingDocks; if ( buildings[buildingId].type == B_Barracks ) { if ( buildings[buildingId].gridOffset == city_inform[ciid].word_6543CE ) { city_inform[ciid].word_6543CE = 0; city_inform[ciid].byte_6543CC= 0; city_inform[ciid].byte_6543CD = 0; city_inform[ciid].dword_6543D4 = 0; } } if ( buildings[buildingId].type == B_DistributionCenter_Unused ) { if ( buildings[buildingId].gridOffset == city_inform[ciid].word_65451A ) { city_inform[ciid].word_65451A = 0; city_inform[ciid].byte_654518 = 0; city_inform[ciid].byte_654519 = 0; city_inform[ciid].dword_654520 = 0; } } if ( buildings[buildingId].type == B_FortGround__ ) deleteFormation(buildings[buildingId].formationId); if ( buildings[buildingId].type == B_Hippodrome ) city_inform[ciid].hippodromeBuiltInCity = 0; } void fun_clearStorages() { fun_memset(storage_start, 6400, 0); } signed int fun_createStorage() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 200; ++i ) { if ( !storages[i].inUse ) { fun_memset(&storage_start[8 * i], 32, 0); storages[i].inUse = 1; return i; } } return 0; } void fun_setStorageBuildingIds() { int storageId; // [sp+4Ch] [bp-8h]@15 signed int i; // [sp+50h] [bp-4h]@1 signed int j; // [sp+50h] [bp-4h]@4 for ( i = 1; i < 200; ++i ) storage_buildingId[16 * i] = 0; for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse ) { if ( buildings[j].type == B_Granary || buildings[j].type == B_Warehouse ) { if ( buildings[j].storageId ) { storageId = buildings[j].storageId; if ( storage_buildingId[16 * storageId] ) buildings[j].storageId = fun_createStorage(); else storage_buildingId[16 * storageId] = j; } } } } } int houseCanExpand(int buildingId, int numTiles) { int v3; // [sp+4Ch] [bp-1Ch]@3 int v4; // [sp+4Ch] [bp-1Ch]@18 int v5; // [sp+4Ch] [bp-1Ch]@35 int v6; // [sp+50h] [bp-18h]@5 int v7; // [sp+50h] [bp-18h]@20 int v8; // [sp+50h] [bp-18h]@37 int gridOffset; // [sp+54h] [bp-14h]@3 int v10; // [sp+54h] [bp-14h]@18 int v11; // [sp+54h] [bp-14h]@35 int j; // [sp+58h] [bp-10h]@3 int l; // [sp+58h] [bp-10h]@18 int n; // [sp+58h] [bp-10h]@35 signed int i; // [sp+5Ch] [bp-Ch]@1 signed int k; // [sp+5Ch] [bp-Ch]@16 signed int m; // [sp+5Ch] [bp-Ch]@33 int v18; // [sp+60h] [bp-8h]@6 int v19; // [sp+60h] [bp-8h]@23 int v20; // [sp+60h] [bp-8h]@40 __int16 v21; // [sp+64h] [bp-4h]@20 __int16 v22; // [sp+64h] [bp-4h]@37 for ( i = 0; i < 4; ++i ) // directions { gridOffset = houseExpand_gridOffsetForDirection[i] + buildings[buildingId].gridOffset; v3 = 0; for ( j = 0; j < numTiles; ++j ) { v6 = dword_5F99C0[j]; if ( grid_terrain[v6 + gridOffset] & T_Building ) { v18 = grid_buildingIds[v6 + gridOffset]; if ( v18 == buildingId ) { ++v3; } else { if ( buildings[v18].inUse == 1 ) { if ( buildings[v18].house_size ) { if ( buildings[v18].level_resourceId <= buildings[buildingId].level_resourceId ) ++v3; } } } } } if ( v3 == numTiles ) { dword_98BF08 = dword_5F9990[2 * i] + buildings[buildingId].x; dword_98BF10 = dword_5F9994[2 * i] + buildings[buildingId].y; return 1; } } for ( k = 0; k < 4; ++k ) { v10 = houseExpand_gridOffsetForDirection[k] + buildings[buildingId].gridOffset; v4 = 0; for ( l = 0; l < numTiles; ++l ) { v7 = dword_5F99C0[l]; v21 = grid_terrain[v7 + v10] & 0xD77F; if ( !(grid_terrain[v7 + v10] & 0xD77F) ) ++v4; if ( v21 & 8 ) { v19 = grid_buildingIds[v7 + v10]; if ( v19 == buildingId ) { ++v4; } else { if ( buildings[v19].inUse == 1 ) { if ( buildings[v19].house_size ) { if ( buildings[v19].level_resourceId <= buildings[buildingId].level_resourceId ) ++v4; } } } } } if ( v4 == numTiles ) { dword_98BF08 = dword_5F9990[2 * k] + buildings[buildingId].x; dword_98BF10 = dword_5F9994[2 * k] + buildings[buildingId].y; return 1; } } for ( m = 0; m < 4; ++m ) { v11 = houseExpand_gridOffsetForDirection[m] + buildings[buildingId].gridOffset; v5 = 0; for ( n = 0; n < numTiles; ++n ) { v8 = dword_5F99C0[n]; v22 = grid_terrain[v8 + v11] & 0xD77F; if ( !(grid_terrain[v8 + v11] & 0xD77F) ) ++v5; if ( v22 & 8 ) { v20 = grid_buildingIds[v8 + v11]; if ( v20 == buildingId ) { ++v5; } else { if ( buildings[v20].inUse == 1 ) { if ( buildings[v20].house_size ) { if ( buildings[v20].level_resourceId <= buildings[buildingId].level_resourceId ) ++v5; } } } } else { if ( v22 & 0x20 ) ++v5; } } if ( v5 == numTiles ) { dword_98BF08 = dword_5F9990[2 * m] + buildings[buildingId].x; dword_98BF10 = dword_5F9994[2 * m] + buildings[buildingId].y; return 1; } } _LOBYTE(buildings[buildingId].word_94BDAC) = 1; return 0; } void sub_46A900(int a1) { int v1; // ST50_4@1 int v2; // [sp+54h] [bp-Ch]@1 int v3; // [sp+54h] [bp-Ch]@4 int v4; // [sp+58h] [bp-8h]@4 int v5; // [sp+5Ch] [bp-4h]@6 v2 = buildings[a1].gridOffset; v1 = 162 * buildings[a1].y + buildings[a1].x + setting_map_startGridOffset; _LOBYTE(buildings[a1].word_94BDAC[0]) = 0; if ( v2 != v1 || grid_buildingIds[v2] != a1 ) { ++dword_98C064; v3 = setting_map_startGridOffset; v4 = 0; while ( v4 < setting_map_height ) { v5 = 0; while ( v5 < setting_map_width ) { if ( grid_buildingIds[v3] == a1 ) { buildings[a1].gridOffset = v3; buildings[a1].x = (v3 - setting_map_startGridOffset) % 162; buildings[a1].y = (v3 - setting_map_startGridOffset) / 162; return; } ++v5; ++v3; } ++v4; v3 += setting_map_gridBorderSize; } ++dword_94A30C; buildings[a1].inUse = 4; } } signed int sub_46AAC0(int buildingId) { signed int result; // eax@2 int v5; // [sp+54h] [bp-14h]@7 int v6; // [sp+58h] [bp-10h]@3 signed int i; // [sp+5Ch] [bp-Ch]@5 if ( buildings[buildingId].house_isMerged ) { result = 0; } else { v6 = buildings[buildingId].gridOffset; if ( (grid_random[v6] & 7) < 5 ) { int aloneHoueCount = 0; for ( i = 0; i < 4; ++i ) { v5 = dword_5F99C0[i]; int rndValueHsMrg = grid_terrain[v5 + v6]; if ( rndValueHsMrg & 0x8 ) { int bldIdOnTile = grid_buildingIds[v5 + v6]; if ( bldIdOnTile == buildingId ) { ++aloneHoueCount; } else { if ( buildings[bldIdOnTile].inUse == 1 ) { if ( buildings[bldIdOnTile].house_size ) { if ( buildings[bldIdOnTile].level_resourceId == buildings[buildingId].level_resourceId ) { if ( !buildings[bldIdOnTile].house_isMerged ) ++aloneHoueCount; } } } } } } if ( aloneHoueCount == 4 ) { dword_98BF08 = dword_5F9990[0] + buildings[buildingId].x; dword_98BF10 = dword_5F9994[0] + buildings[buildingId].y; int addictivePopulation = calculatePopulation4HouseMerging(buildingId, 4); merge4aloneHouses(buildingId, addictivePopulation); result = 1; } else { result = 0; } } else { result = 0; } } return result; } void updateHouseToXArea(int crntBldId, int newAreaSize) { __int16 v2; // cx@4 int v3; // [sp+4Ch] [bp-10h]@4 int v4; // [sp+50h] [bp-Ch]@1 int i; // [sp+54h] [bp-8h]@1 v4 = 162 * dword_98BF10 + dword_98BF08 + setting_map_startGridOffset; for ( i = 0; i < newAreaSize; ++i ) { v3 = dword_5F99C0[i]; v2 = grid_terrain[v3 + v4]; if ( v2 & 8 ) { int bldId_ongrid = grid_buildingIds[v3 + v4]; if ( bldId_ongrid != crntBldId ) { if ( buildings[bldId_ongrid].house_size ) { if ( buildings[bldId_ongrid].house_isMerged == 1 ) { fun_splitHouse2x2(bldId_ongrid); } else { if ( buildings[bldId_ongrid].size == 2 ) { fun_devolveHouse2x2ToMediumInsula(bldId_ongrid); } else { if ( buildings[bldId_ongrid].size == 3 ) fun_devolveHouse3x3ToMediumInsula(bldId_ongrid); } } } } } } } int calculatePopulation4HouseMerging(int buildingId, int a2) { __int16 v2; // ax@7 int v4; // [sp+4Ch] [bp-18h]@4 int v5; // [sp+50h] [bp-14h]@7 int v6; // [sp+54h] [bp-10h]@4 int j; // [sp+58h] [bp-Ch]@4 signed int i; // [sp+5Ch] [bp-8h]@1 signed int k; // [sp+5Ch] [bp-8h]@13 int v10; // [sp+60h] [bp-4h]@9 for ( i = 0; i < 8; ++i ) *(_DWORD *)&dword_94BC80[2 * i] = 0; v4 = 0; v6 = 162 * dword_98BF10 + dword_98BF08 + setting_map_startGridOffset; for ( j = 0; j < a2; ++j ) { v5 = dword_5F99C0[j]; v2 = grid_terrain[v5 + v6]; if ( v2 & 8 ) { v10 = grid_buildingIds[v5 + v6]; if ( v10 != buildingId ) { if ( buildings[v10].house_size ) { v4 += buildings[v10].house_population; for ( k = 0; k < 8; ++k ) *(_DWORD *)&dword_94BC80[2 * k] += buildings[v10].grow_value_house_foodstocks[k]; buildings[v10].house_population = 0; buildings[v10].inUse = 5; } } } } return v4; } void sub_46AFA0(int a1, __int16 a2) { int v2; // ST68_4@4 signed int i; // [sp+50h] [bp-4h]@1 buildings[a1].type = B_HouseLargeInsula; buildings[a1].level_resourceId = 10; buildings[a1].size = 2; buildings[a1].house_size = 2; buildings[a1].house_population += a2; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] += dword_94BC80[2 * i]; v2 = (grid_random[buildings[a1].gridOffset] & 1) + dword_5F5E54[buildings[a1].level_resourceId] + graphic_id_start[dword_5F5E04[buildings[a1].level_resourceId]]; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].x = dword_98BF08; buildings[a1].y = dword_98BF10; buildings[a1].gridOffset = 162 * dword_98BF10 + dword_98BF08 + (_WORD)setting_map_startGridOffset; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, v2, 8); } void sub_46B1F0(int a1, __int16 a2) { int v2; // ST68_4@4 signed int i; // [sp+50h] [bp-4h]@1 buildings[a1].type = B_HouseLargeVilla; buildings[a1].level_resourceId = 14; buildings[a1].size = 3; buildings[a1].house_size = 3; buildings[a1].house_population += a2; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] += dword_94BC80[2 * i]; v2 = dword_5F5E54[buildings[a1].level_resourceId] + graphic_id_start[dword_5F5E04[buildings[a1].level_resourceId]]; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].x = dword_98BF08; buildings[a1].y = dword_98BF10; buildings[a1].gridOffset = 162 * dword_98BF10 + dword_98BF08 + (_WORD)setting_map_startGridOffset; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, v2, 8); } void sub_46B410(int a1, __int16 a2) { int v2; // ST68_4@4 signed int i; // [sp+50h] [bp-4h]@1 buildings[a1].type = B_HouseLargePalace; buildings[a1].level_resourceId = 18; buildings[a1].size = 4; buildings[a1].house_size = 4; buildings[a1].house_population += a2; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] += dword_94BC80[2 * i]; v2 = dword_5F5E54[buildings[a1].level_resourceId] + graphic_id_start[dword_5F5E04[buildings[a1].level_resourceId]]; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].x = dword_98BF08; buildings[a1].y = dword_98BF10; buildings[a1].gridOffset = 162 * dword_98BF10 + dword_98BF08 + (_WORD)setting_map_startGridOffset; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, buildings[a1].size, buildings[a1].size, v2, 8); } void merge4aloneHouses(int curBlfId, short addictivePop) { int v2; // [sp+4Ch] [bp-8h]@4 signed int i; // [sp+50h] [bp-4h]@1 buildings[curBlfId].size = 2; buildings[curBlfId].house_size = 2; buildings[curBlfId].house_population += addictivePop; for ( i = 0; i < 8; ++i ) buildings[curBlfId].grow_value_house_foodstocks[i] += dword_94BC80[2 * i]; v2 = graphic_id_start[dword_5F5E04[buildings[curBlfId].level_resourceId]] + 4; if ( dword_5F5E54[buildings[curBlfId].level_resourceId] ) v2 = graphic_id_start[dword_5F5E04[buildings[curBlfId].level_resourceId]] + 5; sub_480FC0(curBlfId, buildings[curBlfId].x, buildings[curBlfId].y); buildings[curBlfId].x = dword_98BF08; buildings[curBlfId].y = dword_98BF10; buildings[curBlfId].gridOffset = 162 * dword_98BF10 + dword_98BF08 + (_WORD)setting_map_startGridOffset; buildings[curBlfId].house_isMerged = 1; fun_putBuildingOnTerrainAndGraphicGrids(curBlfId, buildings[curBlfId].x, buildings[curBlfId].y, 2, 2, v2, 8); } void fun_splitHouse2x2(int buildingId) { __int64 v1; // qax@3 signed int v2; // [sp+4Ch] [bp-60h]@7 signed int v3; // [sp+4Ch] [bp-60h]@10 signed int v4; // [sp+4Ch] [bp-60h]@13 int v5; // [sp+50h] [bp-5Ch]@7 int v6; // [sp+54h] [bp-58h]@7 int v7[8]; // [sp+58h] [bp-54h]@3 int v8[8]; // [sp+78h] [bp-34h]@3 int popRemainder; // [sp+98h] [bp-14h]@4 int popPerTile; // [sp+9Ch] [bp-10h]@4 int pop; // [sp+A0h] [bp-Ch]@1 int v12; // [sp+A4h] [bp-8h]@7 int i; // [sp+A8h] [bp-4h]@1 pop = buildings[buildingId].house_population; for ( i = 0; i < 8; ++i ) { v1 = buildings[buildingId].grow_value_house_foodstocks[i]; v8[i] = ((BYTE4(v1) & 3) + (_DWORD)v1) >> 2; v7[i] = buildings[buildingId].grow_value_house_foodstocks[i] % 4; } popPerTile = pop / 4; popRemainder = pop % 4; sub_480FC0(buildingId, buildings[buildingId].x, buildings[buildingId].y); buildings[buildingId].size = 1; buildings[buildingId].house_size = 1; buildings[buildingId].house_isMerged = 0; buildings[buildingId].house_population = popRemainder + popPerTile; for ( i = 0; i < 8; ++i ) buildings[buildingId].grow_value_house_foodstocks[i] = LOWORD(v7[i]) + LOWORD(v8[i]); buildings[buildingId].haveRomeroad = 0; v12 = dword_5F5E04[buildings[buildingId].level_resourceId]; v12 = graphic_id_start[v12]; v12 += dword_5F5E54[buildings[buildingId].level_resourceId]; fun_putBuildingOnTerrainAndGraphicGrids( buildingId, buildings[buildingId].x, buildings[buildingId].y, 1, 1, (grid_random[buildings[buildingId].gridOffset] & 1) + v12, 8); v6 = buildings[buildingId].x; v5 = buildings[buildingId].y; v2 = fun_createBuilding(ciid, buildings[buildingId].type, v6 + 1, v5); buildings[v2].house_population = popPerTile; for ( i = 0; i < 8; ++i ) buildings[v2].grow_value_house_foodstocks[i] = LOWORD(v8[i]); buildings[v2].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v2, buildings[v2].x, buildings[v2].y, 1, 1, (grid_random[ buildings[v2].gridOffset ] & 1) + v12, 8); v3 = fun_createBuilding(ciid, buildings[buildingId].type, v6, v5 + 1); buildings[v3].house_population = popPerTile; for ( i = 0; i < 8; ++i ) buildings[v3].grow_value_house_foodstocks[i] = LOWORD(v8[i]); buildings[v3].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v3, buildings[v3].x, buildings[v3].y, 1, 1, (grid_random[buildings[v3].gridOffset] & 1) + v12, 8); v4 = fun_createBuilding(ciid, buildings[buildingId].type, v6 + 1, v5 + 1); buildings[v4].house_population = popPerTile; for ( i = 0; i < 8; ++i ) buildings[v4].grow_value_house_foodstocks[i] = LOWORD(v8[i]); buildings[v4].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v4, buildings[v4].x, buildings[v4].y, 1, 1, (grid_random[buildings[v4].gridOffset] & 1) + v12, 8); } void fun_devolveHouse2x2ToMediumInsula(int a1) { __int64 v1; // qax@3 signed int v2; // [sp+4Ch] [bp-60h]@7 signed int v3; // [sp+4Ch] [bp-60h]@10 signed int v4; // [sp+4Ch] [bp-60h]@13 int v5; // [sp+50h] [bp-5Ch]@7 int v6; // [sp+54h] [bp-58h]@7 int v7[8]; // [sp+58h] [bp-54h]@3 int v8[8]; // [sp+78h] [bp-34h]@3 int v9; // [sp+98h] [bp-14h]@4 int v10; // [sp+9Ch] [bp-10h]@4 int v11; // [sp+A0h] [bp-Ch]@1 int v12; // [sp+A4h] [bp-8h]@7 int i; // [sp+A8h] [bp-4h]@1 v11 = buildings[a1].house_population; for ( i = 0; i < 8; ++i ) { v1 = buildings[a1].grow_value_house_foodstocks[i]; v8[i] = ((BYTE4(v1) & 3) + (_DWORD)v1) >> 2; v7[i] = buildings[a1].grow_value_house_foodstocks[i] % 4; } v10 = v11 / 4; v9 = v11 % 4; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].type = B_HouseMediumInsula; buildings[a1].level_resourceId = buildings[a1].type - 10; buildings[a1].size = 1; buildings[a1].house_size = 1; buildings[a1].house_isMerged = 0; buildings[a1].house_population = v9 + v10; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] = LOWORD(v7[i]) + LOWORD(v8[i]); buildings[a1].haveRomeroad = 0; v12 = dword_5F5E04[buildings[a1].level_resourceId]; v12 = graphic_id_start[v12]; v12 += dword_5F5E54[buildings[a1].level_resourceId]; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, 1, 1, (grid_random[buildings[a1].gridOffset] & 1) + v12, 8); v6 = buildings[a1].x; v5 = buildings[a1].y; v2 = fun_createBuilding(ciid, buildings[a1].type, v6 + 1, v5); buildings[v2].house_population = v10; for ( i = 0; i < 8; ++i ) buildings[v2].grow_value_house_foodstocks[i] = LOWORD(v8[i]); buildings[v2].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v2, buildings[v2].x, buildings[v2].y, 1, 1, (grid_random[buildings[v2].gridOffset] & 1) + v12, 8); v3 = fun_createBuilding(ciid, buildings[a1].type, v6, v5 + 1); buildings[v3].house_population = v10; for ( i = 0; i < 8; ++i ) buildings[v3].grow_value_house_foodstocks[i] = LOWORD(v8[i]); buildings[v3].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v3, buildings[v3].x, buildings[v3].y, 1, 1, (grid_random[buildings[v3].gridOffset] & 1) + v12, 8); v4 = fun_createBuilding(ciid, buildings[a1].type, v6 + 1, v5 + 1); buildings[v4].house_population = v10; for ( i = 0; i < 8; ++i ) buildings[v4].grow_value_house_foodstocks[i] = LOWORD(v8[i]); buildings[v4].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v4, buildings[v4].x, buildings[v4].y, 1, 1, (grid_random[buildings[v4].gridOffset] & 1) + v12, 8); } void fun_devolveHouse3x3ToMediumInsula(int a1) { signed int v1; // [sp+4Ch] [bp-60h]@7 signed int v2; // [sp+4Ch] [bp-60h]@10 signed int v3; // [sp+4Ch] [bp-60h]@13 signed int v4; // [sp+4Ch] [bp-60h]@16 signed int v5; // [sp+4Ch] [bp-60h]@19 signed int v6; // [sp+4Ch] [bp-60h]@22 signed int v7; // [sp+4Ch] [bp-60h]@25 signed int v8; // [sp+4Ch] [bp-60h]@28 int v9; // [sp+50h] [bp-5Ch]@7 int v10; // [sp+54h] [bp-58h]@7 int v11[8]; // [sp+58h] [bp-54h]@3 int v12[8]; // [sp+78h] [bp-34h]@3 int v13; // [sp+98h] [bp-14h]@4 int v14; // [sp+9Ch] [bp-10h]@4 int v15; // [sp+A0h] [bp-Ch]@1 int v16; // [sp+A4h] [bp-8h]@7 int i; // [sp+A8h] [bp-4h]@1 v15 = buildings[a1].house_population; for ( i = 0; i < 8; ++i ) { v12[i] = buildings[a1].grow_value_house_foodstocks[i] / 9; v11[i] = buildings[a1].grow_value_house_foodstocks[i] % 9; } v14 = v15 / 9; v13 = v15 % 9; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].type = B_HouseMediumInsula; buildings[a1].level_resourceId = buildings[a1].type - 10; buildings[a1].size = 1; buildings[a1].house_size = 1; buildings[a1].house_isMerged = 0; buildings[a1].house_population = v13 + v14; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] = LOWORD(v11[i]) + LOWORD(v12[i]); buildings[a1].haveRomeroad = 0; v16 = dword_5F5E04[buildings[a1].level_resourceId]; v16 = graphic_id_start[v16]; v16 += dword_5F5E54[buildings[a1].level_resourceId]; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, 1, 1, (grid_random[buildings[a1].gridOffset] & 1) + v16, 8); v10 = buildings[a1].x; v9 = buildings[a1].y; v1 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 1, v9); buildings[v1].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v1].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v1].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v1, buildings[v1].x, buildings[v1].y, 1, 1, (grid_random[buildings[v1].gridOffset] & 1) + v16, 8); v2 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 2, v9); buildings[v2].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v2].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v2].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v2, buildings[v2].x, buildings[v2].y, 1, 1, (grid_random[buildings[v2].gridOffset] & 1) + v16, 8); v3 = fun_createBuilding(ciid, B_HouseMediumInsula, v10, v9 + 1); buildings[v3].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v3].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v3].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v3, buildings[v3].x, buildings[v3].y, 1, 1, (grid_random[buildings[v3].gridOffset] & 1) + v16, 8); v4 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 1, v9 + 1); buildings[v4].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v4].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v4].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v4, buildings[v4].x, buildings[v4].y, 1, 1, (grid_random[buildings[v4].gridOffset] & 1) + v16, 8); v5 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 2, v9 + 1); buildings[v5].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v5].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v5].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v5, buildings[v5].x, buildings[v5].y, 1, 1, (grid_random[buildings[v5].gridOffset] & 1) + v16, 8); v6 = fun_createBuilding(ciid, B_HouseMediumInsula, v10, v9 + 2); buildings[v6].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v6].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v6].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v6, buildings[v6].x, buildings[v6].y, 1, 1, (grid_random[buildings[v6].gridOffset] & 1) + v16, 8); v7 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 1, v9 + 2); buildings[v7].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v7].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v7].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v7, buildings[v7].x, buildings[v7].y, 1, 1, (grid_random[buildings[v7].gridOffset] & 1) + v16, 8); v8 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 2, v9 + 2); buildings[v8].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v8].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v8].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v8, buildings[v8].x, buildings[v8].y, 1, 1, (grid_random[buildings[v8].gridOffset] & 1) + v16, 8); } void fun_devolveHouse3x3To2x2(int a1) { signed int v1; // [sp+4Ch] [bp-60h]@7 signed int v2; // [sp+4Ch] [bp-60h]@10 signed int v3; // [sp+4Ch] [bp-60h]@13 signed int v4; // [sp+4Ch] [bp-60h]@16 signed int v5; // [sp+4Ch] [bp-60h]@19 int v6; // [sp+50h] [bp-5Ch]@7 int v7; // [sp+54h] [bp-58h]@7 int v8[8]; // [sp+58h] [bp-54h]@3 int v9[8]; // [sp+78h] [bp-34h]@3 int v10; // [sp+98h] [bp-14h]@4 int v11; // [sp+9Ch] [bp-10h]@4 int v12; // [sp+A0h] [bp-Ch]@1 int v13; // [sp+A4h] [bp-8h]@7 int i; // [sp+A8h] [bp-4h]@1 v12 = buildings[a1].house_population; for ( i = 0; i < 8; ++i ) { v9[i] = buildings[a1].grow_value_house_foodstocks[i] / 6; v8[i] = buildings[a1].grow_value_house_foodstocks[i] % 6; } v11 = v12 / 6; v10 = v12 % 6; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].type = B_HouseMediumVilla; buildings[a1].level_resourceId = buildings[a1].type - 10; buildings[a1].size = 2; buildings[a1].house_size = 2; buildings[a1].house_isMerged = 0; buildings[a1].house_population = v10 + v11; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] = LOWORD(v8[i]) + LOWORD(v9[i]); buildings[a1].haveRomeroad = 0; v13 = dword_5F5E04[buildings[a1].level_resourceId]; v13 = graphic_id_start[v13]; v13 += dword_5F5E54[buildings[a1].level_resourceId]; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, 2, 2, (grid_random[buildings[a1].gridOffset] & 1) + v13, 8); v7 = buildings[a1].x; v6 = buildings[a1].y; v13 = dword_5F5E28; v13 = graphic_id_start[dword_5F5E28]; v13 += dword_5F5E54[buildings[a1].level_resourceId]; v1 = fun_createBuilding(ciid, B_HouseMediumInsula, v7 + 2, v6); buildings[v1].house_population = v11; for ( i = 0; i < 8; ++i ) buildings[v1].grow_value_house_foodstocks[i] = LOWORD(v9[i]); buildings[v1].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v1, buildings[v1].x, buildings[v1].y, 1, 1, (grid_random[buildings[v1].gridOffset] & 1) + v13, 8); v2 = fun_createBuilding(ciid, B_HouseMediumInsula, v7 + 2, v6 + 1); buildings[v2].house_population = v11; for ( i = 0; i < 8; ++i ) buildings[v2].grow_value_house_foodstocks[i] = LOWORD(v9[i]); buildings[v2].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v2, buildings[v2].x, buildings[v2].y, 1, 1, (grid_random[buildings[v2].gridOffset] & 1) + v13, 8); v3 = fun_createBuilding(ciid, B_HouseMediumInsula, v7, v6 + 2); buildings[v3].house_population = v11; for ( i = 0; i < 8; ++i ) buildings[v3].grow_value_house_foodstocks[i] = LOWORD(v9[i]); buildings[v3].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v3, buildings[v3].x, buildings[v3].y, 1, 1, (grid_random[buildings[v3].gridOffset] & 1) + v13, 8); v4 = fun_createBuilding(ciid, B_HouseMediumInsula, v7 + 1, v6 + 2); buildings[v4].house_population = v11; for ( i = 0; i < 8; ++i ) buildings[v4].grow_value_house_foodstocks[i] = LOWORD(v9[i]); buildings[v4].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v4, buildings[v4].x, buildings[v4].y, 1, 1, (grid_random[buildings[v4].gridOffset] & 1) + v13, 8); v5 = fun_createBuilding(ciid, B_HouseMediumInsula, v7 + 2, v6 + 2); buildings[v5].house_population = v11; for ( i = 0; i < 8; ++i ) buildings[v5].grow_value_house_foodstocks[i] = LOWORD(v9[i]); buildings[v5].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v5, buildings[v5].x, buildings[v5].y, 1, 1, (grid_random[buildings[v5].gridOffset] & 1) + v13, 8); } void fun_devolveHouse4x4To3x3(int a1) { __int64 v1; // qax@3 signed int v2; // [sp+4Ch] [bp-60h]@7 signed int v3; // [sp+4Ch] [bp-60h]@10 signed int v4; // [sp+4Ch] [bp-60h]@13 signed int v5; // [sp+4Ch] [bp-60h]@16 signed int v6; // [sp+4Ch] [bp-60h]@19 signed int v7; // [sp+4Ch] [bp-60h]@22 signed int v8; // [sp+4Ch] [bp-60h]@25 int v9; // [sp+50h] [bp-5Ch]@7 int v10; // [sp+54h] [bp-58h]@7 int v11[8]; // [sp+58h] [bp-54h]@3 int v12[8]; // [sp+78h] [bp-34h]@3 int v13; // [sp+98h] [bp-14h]@4 int v14; // [sp+9Ch] [bp-10h]@4 int v15; // [sp+A0h] [bp-Ch]@1 __int16 graphicId[2]; // [sp+A4h] [bp-8h]@7 int i; // [sp+A8h] [bp-4h]@1 v15 = buildings[a1].house_population; for ( i = 0; i < 8; ++i ) { v1 = buildings[a1].grow_value_house_foodstocks[i]; v12[i] = ((BYTE4(v1) & 7) + (_DWORD)v1) >> 3; v11[i] = buildings[a1].grow_value_house_foodstocks[i] % 8; } v14 = v15 / 8; v13 = v15 % 8; sub_480FC0(a1, buildings[a1].x, buildings[a1].y); buildings[a1].type = B_HouseMediumPalace; buildings[a1].level_resourceId = buildings[a1].type - 10; buildings[a1].size = 3; buildings[a1].house_size = 3; buildings[a1].house_isMerged = 0; buildings[a1].house_population = v13 + v14; for ( i = 0; i < 8; ++i ) buildings[a1].grow_value_house_foodstocks[i] = LOWORD(v11[i]) + LOWORD(v12[i]); buildings[a1].haveRomeroad = 0; *(_DWORD *)graphicId = dword_5F5E04[buildings[a1].level_resourceId]; *(_DWORD *)graphicId = graphic_id_start[*(_DWORD *)graphicId]; *(_DWORD *)graphicId += dword_5F5E54[buildings[a1].level_resourceId]; fun_putBuildingOnTerrainAndGraphicGrids( a1, buildings[a1].x, buildings[a1].y, 3, 3, graphicId[0], 8); v10 = buildings[a1].x; v9 = buildings[a1].y; *(_DWORD *)graphicId = dword_5F5E28; *(_DWORD *)graphicId = graphic_id_start[dword_5F5E28]; *(_DWORD *)graphicId += dword_5F5E54[buildings[a1].level_resourceId]; v2 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 3, v9); buildings[v2].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v2].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v2].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v2, buildings[v2].x, buildings[v2].y, 1, 1, (grid_random[buildings[v2].gridOffset] & 1) + graphicId[0], 8); v3 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 3, v9 + 1); buildings[v3].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v3].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v3].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v3, buildings[v3].x, buildings[v3].y, 1, 1, (grid_random[buildings[v3].gridOffset] & 1) + graphicId[0], 8); v4 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 3, v9 + 2); buildings[v4].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v4].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v4].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v4, buildings[v4].x, buildings[v4].y, 1, 1, (grid_random[buildings[v4].gridOffset] & 1) + graphicId[0], 8); v5 = fun_createBuilding(ciid, B_HouseMediumInsula, v10, v9 + 3); buildings[v5].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v5].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v5].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v5, buildings[v5].x, buildings[v5].y, 1, 1, (grid_random[buildings[v5].gridOffset] & 1) + graphicId[0], 8); v6 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 1, v9 + 3); buildings[v6].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v6].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v6].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v6, buildings[v6].x, buildings[v6].y, 1, 1, (grid_random[buildings[v6].gridOffset] & 1) + graphicId[0], 8); v7 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 2, v9 + 3); buildings[v7].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v7].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v7].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v7, buildings[v7].x, buildings[v7].y, 1, 1, (grid_random[buildings[v7].gridOffset] & 1) + graphicId[0], 8); v8 = fun_createBuilding(ciid, B_HouseMediumInsula, v10 + 3, v9 + 3); buildings[v8].house_population = v14; for ( i = 0; i < 8; ++i ) buildings[v8].grow_value_house_foodstocks[i] = LOWORD(v12[i]); buildings[v8].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids( v8, buildings[v8].x, buildings[v8].y, 1, 1, (grid_random[buildings[v8].gridOffset] & 1) + graphicId[0], 8); } void fun_evolveHouseTo(int buildingId, BuildingType type) { int v2; // [sp+4Ch] [bp-8h]@1 int v3; // [sp+50h] [bp-4h]@2 buildings[buildingId].type = type; buildings[buildingId].level_resourceId = type - 10; v2 = dword_5F5D64[buildings[buildingId].level_resourceId]; if ( buildings[buildingId].house_isMerged ) { v3 = graphic_id_start[dword_5F5E04[buildings[buildingId].level_resourceId]] + 4; if ( dword_5F5E54[buildings[buildingId].level_resourceId] ) v3 = graphic_id_start[dword_5F5E04[buildings[buildingId].level_resourceId]] + 5; } else { v3 = dword_5F5E54[buildings[buildingId].level_resourceId] + graphic_id_start[dword_5F5E04[buildings[buildingId].level_resourceId]]; if ( v2 ) v3 += (v2 - 1) & grid_random[buildings[buildingId].gridOffset]; } fun_putBuildingOnTerrainAndGraphicGrids( buildingId, buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, buildings[buildingId].size, v3, 8); } void fun_revertHouseToVacantLot(int buildingId) { int v1; // ST70_4@3 int v2; // ST6C_4@3 signed int v3; // eax@3 signed int v4; // eax@3 signed int v5; // eax@3 __int16 v6; // [sp+5Ch] [bp-4h]@1 buildings[buildingId].type = B_HouseVacantLot; buildings[buildingId].level_resourceId = buildings[buildingId].type - 10; v6 = graphic_housing_vacant; if ( buildings[buildingId].house_isMerged ) { sub_480FC0(buildingId, buildings[buildingId].x, buildings[buildingId].y); buildings[buildingId].house_isMerged = 0; buildings[buildingId].size = 1; buildings[buildingId].house_size = 1; fun_putBuildingOnTerrainAndGraphicGrids( buildingId, buildings[buildingId].x, buildings[buildingId].y, 1, 1, v6, 8); v1 = buildings[buildingId].x; v2 = buildings[buildingId].y; v3 = fun_createBuilding(ciid, buildings[buildingId].type, v1 + 1, v2); buildings[v3].house_population = 0; buildings[v3].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids(v3, buildings[v3].x, buildings[v3].y, 1, 1, v6, 8); v4 = fun_createBuilding(ciid, buildings[buildingId].type, v1, v2 + 1); buildings[v4].house_population = 0; buildings[v4].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids(v4, buildings[v4].x, buildings[v4].y, 1, 1, v6, 8); v5 = fun_createBuilding(ciid, buildings[buildingId].type, v1 + 1, v2 + 1); buildings[v5].house_population = 0; buildings[v5].haveRomeroad = 0; fun_putBuildingOnTerrainAndGraphicGrids(v5, buildings[v5].x, buildings[v5].y, 1, 1, v6, 8); } else { grid_graphicIds[buildings[buildingId].gridOffset] = graphic_housing_vacant; } } void sub_46E3D0(int buildingId, char a2) { __int16 v2; // cx@21 __int16 v3; // dx@35 signed int watersideBuilding; // [sp+4Ch] [bp-28h]@1 int v5; // [sp+54h] [bp-20h]@24 int v6; // [sp+54h] [bp-20h]@37 bool v7; // [sp+58h] [bp-1Ch]@10 int v8; // [sp+5Ch] [bp-18h]@23 int v9; // [sp+5Ch] [bp-18h]@36 signed int v10; // [sp+60h] [bp-14h]@36 int v11; // [sp+64h] [bp-10h]@35 int v12; // [sp+68h] [bp-Ch]@35 signed int i; // [sp+6Ch] [bp-8h]@33 signed int numTiles; // [sp+70h] [bp-4h]@13v7 watersideBuilding = 0; dword_8E1484 = 0; buildings[buildingId].fireRisk = 0; buildings[buildingId].damageRisk = 0; if ( buildings[buildingId].house_size ) { if ( buildings[buildingId].house_population ) sub_4E3800(ciid, buildings[buildingId].house_population); } buildings[buildingId].house_population = 0; buildings[buildingId].house_size = 0; buildings[buildingId].industry_outputGood = 0; buildings[buildingId].haveRomeroad = 0; deleteBuildingEvent(buildingId); if ( buildings[buildingId].type == B_Dock || buildings[buildingId].type == B_Wharf || buildings[buildingId].type == B_Shipyard ) watersideBuilding = 1; v7 = buildings[buildingId].house_size && buildings[buildingId].level_resourceId <= 1; switch ( buildings[buildingId].size ) { case 2: numTiles = 4; break; case 3: numTiles = 9; break; case 4: numTiles = 16; break; case 5: numTiles = 25; break; default: numTiles = 0; break; } sub_480FC0(buildingId, buildings[buildingId].x, buildings[buildingId].y); v2 = grid_terrain[buildings[buildingId].gridOffset]; if ( v2 & T_Water ) { buildings[buildingId].inUse = 5; } else { buildings[buildingId].type = B_BurningRuin; buildings[buildingId].towerBallistaId = 0; building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * buildingId] = 0; buildings[buildingId].burningRuinStep = (buildings[buildingId].byte_94BD85 & 7) + 1; buildings[buildingId].byte_94BD84 = 1; buildings[buildingId].size = 1; buildings[buildingId].byte_94BDB9 = a2; v8 = grid_random[buildings[buildingId].gridOffset] & 3; if ( v7 ) { _LOWORD(v5) = word_6E6C9E; } else { if ( grid_random[buildings[buildingId].gridOffset] & 3 ) { if ( v8 == 1 ) { v5 = word_6E6CA0 + 9; } else { if ( v8 == 2 ) v5 = word_6E6CA0 + 18; else v5 = word_6E6CA0 + 27; } } else { _LOWORD(v5) = word_6E6CA0; } } fun_putBuildingOnTerrainAndGraphicGrids( buildingId, buildings[buildingId].x, buildings[buildingId].y, 1, 1, v5, 8); } for ( i = 1; i < numTiles; ++i ) { v12 = dword_5F3580[2 * i] + buildings[buildingId].x; v11 = dword_5F3584[2 * i] + buildings[buildingId].y; v3 = grid_terrain[162 * v11 + v12 + setting_map_startGridOffset]; if ( !(v3 & 4) ) { v10 = fun_createBuilding(ciid, B_BurningRuin, v12, v11); v9 = grid_random[buildings[v10].gridOffset] & 3; if ( v7 ) { _LOWORD(v6) = word_6E6C9E; } else { if ( grid_random[buildings[v10].gridOffset] & 3 ) { if ( v9 == 1 ) { v6 = word_6E6CA0 + 9; } else { if ( v9 == 2 ) v6 = word_6E6CA0 + 18; else v6 = word_6E6CA0 + 27; } } else { _LOWORD(v6) = word_6E6CA0; } } fun_putBuildingOnTerrainAndGraphicGrids(v10, buildings[v10].x, buildings[v10].y, 1, 1, v6, 8); buildings[v10].burningRuinStep = (buildings[v10].byte_94BD85 & 7) + 1; buildings[v10].towerBallistaId = 0; buildings[v10].byte_94BD84 = 1; buildings[v10].byte_94BDB9 = a2; } } if ( watersideBuilding == 1 ) sub_5001A0(); } void sub_46E9E0() { __int16 v0; // dx@6 __int16 v1; // [sp+4Ch] [bp-28h]@10 __int16 v2; // [sp+50h] [bp-24h]@55 signed int v3; // [sp+54h] [bp-20h]@55 int v4; // [sp+58h] [bp-1Ch]@57 signed int i; // [sp+5Ch] [bp-18h]@36 signed int j; // [sp+5Ch] [bp-18h]@48 signed int v7; // [sp+60h] [bp-14h]@21 int v8; // [sp+60h] [bp-14h]@57 BuildingType buildingType; // [sp+64h] [bp-10h]@13 int v10; // [sp+68h] [bp-Ch]@1 int v11; // [sp+6Ch] [bp-8h]@1 int v12; // [sp+70h] [bp-4h]@3 v10 = setting_map_startGridOffset; v11 = 0; LABEL_2: if ( v11 < setting_map_height ) { v12 = 0; while ( 1 ) { if ( v12 >= setting_map_width ) { ++v11; v10 += setting_map_gridBorderSize; goto LABEL_2; } v0 = grid_terrain[v10]; if ( v0 & 8 && !grid_buildingIds[v10] ) { v1 = grid_random[v10] & 1; if ( mode_editor == 1 ) v1 = 0; if ( grid_graphicIds[v10] == map_graphic_nativeHut ) { buildingType = B_NativeHut; grid_graphicIds[v10] = graphic_nativeBuilding; } else { if ( grid_graphicIds[v10] == map_graphic_nativeHut + 1 ) { buildingType = B_NativeHut; grid_graphicIds[v10] = graphic_nativeBuilding + 1; } else { if ( grid_graphicIds[v10] == map_graphic_nativeMeeting ) { buildingType = B_NativeMeeting; grid_graphicIds[v10] = graphic_nativeBuilding + 2; } else { if ( grid_graphicIds[v10] != map_graphic_nativeCrops ) { sub_480FC0(0, v12, v11); goto LABEL_4; } buildingType = B_NativeCrops; grid_graphicIds[v10] = v1 + graphic_nativeCrops; } } } v7 = fun_createBuilding(1, buildingType, v12, v11); grid_buildingIds[v10] = v7; buildings[v7].inUse = 1; switch ( buildingType ) { case B_NativeCrops: buildings[v7].grow_value_house_foodstocks[0] = v1; break; case B_NativeMeeting: buildings[v7].house_crimeRisk = 100; word_8F61A2[v10] = v7; word_8F62E4[v10] = v7; word_8F62E6[v10] = v7; if ( mode_editor ) sub_48D910(buildings[v7].x, buildings[v7].y, 2, 8); else sub_48D780(buildings[v7].x, buildings[v7].y, 2, 6); if ( !city_inform[ciid].dword_6544C4 ) { city_inform[ciid].dword_6544C4 = buildings[v7].x; city_inform[ciid].dword_6544C8 = buildings[v7].y; } break; case B_NativeHut: buildings[v7].house_crimeRisk = 100; buildings[v7].walkerSpawnDelay = v1; if ( mode_editor ) sub_48D910(buildings[v7].x, buildings[v7].y, 1, 5); else sub_48D780(buildings[v7].x, buildings[v7].y, 1, 3); break; } } LABEL_4: ++v12; ++v10; } } dword_98BF38 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == B_NativeMeeting ) { word_949F00[dword_98BF38++] = i; if ( dword_98BF38 >= 500 ) dword_98BF38 = 499; } } } if ( dword_98BF38 > 0 ) { for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].type == B_NativeHut ) { v3 = 1000; v2 = 0; dword_98BF14 = 0; while ( dword_98BF14 < dword_98BF38 ) { v8 = word_949F00[dword_98BF14++]; v4 = fun_getDistanceMaximum( buildings[j].x, buildings[j].y, buildings[v8].x, buildings[v8].y); if ( v4 < v3 ) { v3 = v4; v2 = v8; } } buildings[j].level_resourceId = v2; } } } } } void sub_46F030() { signed int v0; // [sp+50h] [bp-Ch]@9 signed int v1; // [sp+54h] [bp-8h]@9 signed int i; // [sp+58h] [bp-4h]@3 fun_memAndWithByte(grid_edge, 26244, 0x7Fu); if ( city_inform[ciid].dword_6544B8 ) --city_inform[ciid].dword_6544B8; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse != 1 ) continue; if ( buildings[i].type == B_NativeHut ) { v1 = 1; v0 = 3; } else { if ( buildings[i].type != B_NativeMeeting ) continue; v1 = 2; v0 = 6; } if ( buildings[i].house_crimeRisk >= 100 ) { if ( !mode_editor ) sub_48D780(buildings[i].x, buildings[i].y, v1, v0); if ( sub_48DAA0(buildings[i].x, buildings[i].y, v1, v0) > 0 ) city_inform[ciid].dword_6544B8 = 2; } else { ++buildings[i].house_crimeRisk; } } if ( city_inform[ciid].dword_6544BC ) city_inform[ciid].dword_6544B8 = 2; } void sub_46F260() { int v0; // ST68_4@87 int v1; // ST68_4@89 int v2; // ST68_4@91 unsigned int v3; // [sp+4Ch] [bp-10h]@91 int v4; // [sp+54h] [bp-8h]@85 signed int i; // [sp+58h] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse ) { switch ( buildings[i].type ) { case B_Gatehouse: if ( buildings[i].level_resourceId == 1 ) { if ( setting_map_orientation && setting_map_orientation != 4 ) v4 = graphic_tower + 2; else v4 = graphic_tower + 1; } else { if ( setting_map_orientation && setting_map_orientation != 4 ) v4 = graphic_tower + 1; else v4 = graphic_tower + 2; } fun_putBuildingOnTerrainAndGraphicGrids( i, buildings[i].x, buildings[i].y, buildings[i].size, buildings[i].size, v4, -32760); sub_488B70(buildings[i].x, buildings[i].y, buildings[i].level_resourceId); break; case B_TriumphalArch: if ( buildings[i].level_resourceId == 1 ) { if ( setting_map_orientation && setting_map_orientation != 4 ) v4 = word_6E6D4A + 2; else _LOWORD(v4) = word_6E6D4A; } else { if ( setting_map_orientation && setting_map_orientation != 4 ) _LOWORD(v4) = word_6E6D4A; else v4 = word_6E6D4A + 2; } fun_putBuildingOnTerrainAndGraphicGrids( i, buildings[i].x, buildings[i].y, buildings[i].size, buildings[i].size, v4, 8); sub_488E00(buildings[i].x, buildings[i].y, buildings[i].level_resourceId); break; case B_Hippodrome: if ( setting_map_orientation ) { if ( setting_map_orientation == 4 ) { if ( buildings[i].level_resourceId ) { switch ( buildings[i].level_resourceId ) { case 1: v4 = word_6E6D5C + 2; break; case 2: _LOWORD(v4) = word_6E6D5C; break; case 3: v4 = word_6E6D5C + 4; break; case 4: v4 = word_6E6D5C + 2; break; case 5: _LOWORD(v4) = word_6E6D5C; break; } } else { v4 = word_6E6D5C + 4; } } else { if ( setting_map_orientation == 6 ) { if ( buildings[i].level_resourceId ) { switch ( buildings[i].level_resourceId ) { case 1: v4 = word_6E6D5A + 2; break; case 2: v4 = word_6E6D5A + 4; break; case 3: _LOWORD(v4) = word_6E6D5A; break; case 4: v4 = word_6E6D5A + 2; break; case 5: v4 = word_6E6D5A + 4; break; } } else { _LOWORD(v4) = word_6E6D5A; } } else { if ( buildings[i].level_resourceId ) { switch ( buildings[i].level_resourceId ) { case 1: v4 = word_6E6D5A + 2; break; case 2: _LOWORD(v4) = word_6E6D5A; break; case 3: v4 = word_6E6D5A + 4; break; case 4: v4 = word_6E6D5A + 2; break; case 5: _LOWORD(v4) = word_6E6D5A; break; } } else { v4 = word_6E6D5A + 4; } } } } else { if ( buildings[i].level_resourceId ) { switch ( buildings[i].level_resourceId ) { case 1: v4 = word_6E6D5C + 2; break; case 2: v4 = word_6E6D5C + 4; break; case 3: _LOWORD(v4) = word_6E6D5C; break; case 4: v4 = word_6E6D5C + 2; break; case 5: v4 = word_6E6D5C + 4; break; } } else { _LOWORD(v4) = word_6E6D5C; } } fun_putBuildingOnTerrainAndGraphicGrids( i, buildings[i].x, buildings[i].y, buildings[i].size, buildings[i].size, v4, 8); break; case B_Shipyard: v0 = buildings[i].house_neptune - setting_map_orientation / 2; sub_481E70(i, buildings[i].x, buildings[i].y, (_WORD)v0 + (v0 < 0 ? 4 : 0) + word_6E6C4A); break; case B_Wharf: v1 = buildings[i].house_neptune - setting_map_orientation / 2; sub_481E70(i, buildings[i].x, buildings[i].y, (_WORD)v1 + (v1 < 0 ? 4 : 0) + word_6E6C4E); break; case B_Dock: v2 = buildings[i].house_neptune - setting_map_orientation / 2; v3 = v2 + (v2 < 0 ? 4 : 0); if ( v3 ) { if ( v3 == 1 ) { _LOWORD(v4) = word_6E6D00; } else { if ( v3 == 2 ) _LOWORD(v4) = word_6E6D02; else _LOWORD(v4) = word_6E6D04; } } else { _LOWORD(v4) = word_6E6C4C; } sub_4824E0(i, buildings[i].x, buildings[i].y, v4); break; } } } } void fun_updateRatings(int yearlyUpdate) { fun_updateCultureRating(); fun_updateFavorRating(yearlyUpdate); fun_calculateMaxProsperity(); if ( yearlyUpdate ) fun_updateProsperityRating(); if ( yearlyUpdate ) fun_updatePeaceRating(); } void fun_updateCultureRating() { city_inform[ciid].cultureRating = 0; city_inform[ciid].cultureRatingExplanation = 0; if ( city_inform[ciid].population > 0 ) { if ( pctTheaterCoverage < 100 ) { if ( pctTheaterCoverage <= 85 ) { if ( pctTheaterCoverage <= 70 ) { if ( pctTheaterCoverage <= 50 ) { if ( pctTheaterCoverage <= 30 ) { city_inform[ciid].culture_theater = 0; } else { city_inform[ciid].cultureRating += 3; city_inform[ciid].culture_theater = 3; } } else { city_inform[ciid].cultureRating += 8; city_inform[ciid].culture_theater = 8; } } else { city_inform[ciid].cultureRating += 12; city_inform[ciid].culture_theater = 12; } } else { city_inform[ciid].cultureRating += 18; city_inform[ciid].culture_theater = 18; } } else { city_inform[ciid].cultureRating += 25; city_inform[ciid].culture_theater = 25; } if ( city_inform[ciid].pctReligionCoverage < 100 ) { if ( city_inform[ciid].pctReligionCoverage <= 85 ) { if ( city_inform[ciid].pctReligionCoverage <= 70 ) { if ( city_inform[ciid].pctReligionCoverage <= 50 ) { if ( city_inform[ciid].pctReligionCoverage <= 30 ) { city_inform[ciid].culture_religion = 0; } else { city_inform[ciid].cultureRating += 3; city_inform[ciid].culture_religion = 3; } } else { city_inform[ciid].cultureRating += 9; city_inform[ciid].culture_religion = 9; } } else { city_inform[ciid].cultureRating += 14; city_inform[ciid].culture_religion = 14; } } else { city_inform[ciid].cultureRating += 22; city_inform[ciid].culture_religion = 22; } } else { city_inform[ciid].cultureRating += 30; city_inform[ciid].culture_religion = 30; } if ( pctSchoolCoverage < 100 ) { if ( pctSchoolCoverage <= 85 ) { if ( pctSchoolCoverage <= 70 ) { if ( pctSchoolCoverage <= 50 ) { if ( pctSchoolCoverage <= 30 ) { city_inform[ciid].culture_school = 0; } else { ++city_inform[ciid].cultureRating; city_inform[ciid].culture_school = 1; } } else { city_inform[ciid].cultureRating += 4; city_inform[ciid].culture_school = 4; } } else { city_inform[ciid].cultureRating += 6; city_inform[ciid].culture_school = 6; } } else { city_inform[ciid].cultureRating += 10; city_inform[ciid].culture_school = 10; } } else { city_inform[ciid].cultureRating += 15; city_inform[ciid].culture_school = 15; } if ( pctAcademyCoverage < 100 ) { if ( pctAcademyCoverage <= 85 ) { if ( pctAcademyCoverage <= 70 ) { if ( pctAcademyCoverage <= 50 ) { if ( pctAcademyCoverage <= 30 ) { city_inform[ciid].culture_academy = 0; } else { ++city_inform[ciid].cultureRating; city_inform[ciid].culture_academy = 1; } } else { city_inform[ciid].cultureRating += 2; city_inform[ciid].culture_academy = 2; } } else { city_inform[ciid].cultureRating += 4; city_inform[ciid].culture_academy = 4; } } else { city_inform[ciid].cultureRating += 7; city_inform[ciid].culture_academy = 7; } } else { city_inform[ciid].cultureRating += 10; city_inform[ciid].culture_academy = 10; } if ( pctLibraryCoverage < 100 ) { if ( pctLibraryCoverage <= 85 ) { if ( pctLibraryCoverage <= 70 ) { if ( pctLibraryCoverage <= 50 ) { if ( pctLibraryCoverage <= 30 ) { city_inform[ciid].culture_library = 0; } else { city_inform[ciid].cultureRating += 2; city_inform[ciid].culture_library = 2; } } else { city_inform[ciid].cultureRating += 4; city_inform[ciid].culture_library = 4; } } else { city_inform[ciid].cultureRating += 8; city_inform[ciid].culture_library = 8; } } else { city_inform[ciid].cultureRating += 14; city_inform[ciid].culture_library = 14; } } else { city_inform[ciid].cultureRating += 20; city_inform[ciid].culture_library = 20; } if ( city_inform[ciid].cultureRating < 0 ) city_inform[ciid].cultureRating = 0; if ( city_inform[ciid].cultureRating > 100 ) city_inform[ciid].cultureRating = 100; fun_setCultureRatingExplanation(); } } void fun_setCultureRatingExplanation() { signed int reason; // [sp+4Ch] [bp-8h]@1 int minPercentage; // [sp+50h] [bp-4h]@1 minPercentage = 100; reason = 0; if ( city_inform[ciid].pctReligionCoverage < 100 ) { minPercentage = city_inform[ciid].pctReligionCoverage; reason = 3; } if ( pctTheaterCoverage < minPercentage ) { minPercentage = pctTheaterCoverage; reason = 4; } if ( pctLibraryCoverage < minPercentage ) { minPercentage = pctLibraryCoverage; reason = 1; } if ( pctSchoolCoverage < minPercentage ) { minPercentage = pctSchoolCoverage; reason = 0; } if ( pctAcademyCoverage < minPercentage ) reason = 2; city_inform[ciid].cultureRatingExplanation = reason + 1; } void fun_updateProsperityRating() { int poor; // ST60_4@14 int rich; // [sp+54h] [bp-18h]@14 int avgWage; // [sp+5Ch] [bp-10h]@10 signed int labor; // [sp+64h] [bp-8h]@1 int increase; // [sp+64h] [bp-8h]@6 labor = 0; if ( city_inform[ciid].unemploymentPercentage >= 5 ) { if ( city_inform[ciid].unemploymentPercentage >= 15 ) labor = -1; // -1 Unemployment rate is above 15% } else { labor = 1; // +1 Less than 5% unemployment } if ( city_inform[ciid].finance_construction_lastyear + city_inform[ciid].treasury <= city_inform[ciid].treasury_lastyear_prosperity ) increase = labor - 1; // -1 Losing money else increase = labor + 5; // +5 Making a profit city_inform[ciid].treasury_lastyear_prosperity = city_inform[ciid].treasury; if ( city_inform[ciid].foodTypesEaten >= 2 )// == grand insula or better ++increase; // +1 There is at least one Grand Insula or better avgWage = city_inform[ciid].wageTotal_lastyear / 12; if ( avgWage <= city_inform[ciid].wagesRome + 1 ) { if ( avgWage < city_inform[ciid].wagesRome ) --increase; // -1 Your wages are below Rome's } else { ++increase; // You pay at least 2 Dn more than Rome's wage } poor = getPercentage(city_inform[ciid].peopleInTentsAndShacks, city_inform[ciid].population); rich = getPercentage(city_inform[ciid].peopleInVillasAndPalaces, city_inform[ciid].population); if ( poor > 30 ) --increase; if ( rich > 10 ) ++increase; // +1 10% or more of your population lives in villas if ( city_inform[ciid].tributeNotPaid ) --increase; if ( city_inform[ciid].hippodromeShows > 0 ) ++increase; // +1 Active Hippodrome city_inform[ciid].prosperityRating += increase; if ( city_inform[ciid].prosperityRating > city_inform[ciid].maxProsperity[0] ) city_inform[ciid].prosperityRating = city_inform[ciid].maxProsperity[0]; if ( city_inform[ciid].prosperityRating < 0 ) city_inform[ciid].prosperityRating = 0; if ( city_inform[ciid].prosperityRating > 100 ) city_inform[ciid].prosperityRating = 100; fun_setProsperityRatingExplanation(); } void fun_setProsperityRatingExplanation() { signed int v0; // [sp+50h] [bp-1Ch]@6 int v1; // [sp+54h] [bp-18h]@14 int v2; // [sp+58h] [bp-14h]@14 int v3; // [sp+5Ch] [bp-10h]@10 signed int v4; // [sp+64h] [bp-8h]@1 int v5; // [sp+64h] [bp-8h]@6 v4 = 0; if ( city_inform[ciid].unemploymentPercentage >= 5 ) { if ( city_inform[ciid].unemploymentPercentage >= 15 ) v4 = -1; } else { v4 = 1; } if ( city_inform[ciid].finance_construction_lastyear + city_inform[ciid].treasury <= city_inform[ciid].treasury_lastyear_prosperity ) { v5 = v4 - 1; v0 = 0; } else { v5 = v4 + 5; v0 = 1; } if ( city_inform[ciid].foodTypesEaten >= 2 ) ++v5; v3 = city_inform[ciid].wageTotal_lastyear / 12; if ( v3 <= city_inform[ciid].wagesRome + 1 ) { if ( v3 < city_inform[ciid].wagesRome ) --v5; } else { ++v5; } v2 = getPercentage(city_inform[ciid].peopleInTentsAndShacks, city_inform[ciid].population); v1 = getPercentage(city_inform[ciid].peopleInVillasAndPalaces, city_inform[ciid].population); if ( v2 > 30 ) --v5; if ( v1 > 10 ) ++v5; if ( city_inform[ciid].tributeNotPaid ) --v5; if ( city_inform[ciid].hippodromeShows > 0 ) ++v5; if ( city_inform[ciid].prosperityRating > 0 || gametime_year != scn_settings_startYear ) { if ( city_inform[ciid].prosperityRating < city_inform[ciid].maxProsperity[0] ) { if ( v5 <= 0 ) { if ( v0 > 0 ) { if ( city_inform[ciid].unemploymentPercentage < 15 ) { if ( v3 >= city_inform[ciid].wagesRome ) { if ( v2 <= 30 ) { if ( city_inform[ciid].tributeNotPaid ) city_inform[ciid].prosperityRatingExplanation = 7; else city_inform[ciid].prosperityRatingExplanation = 9; } else { city_inform[ciid].prosperityRatingExplanation = 6; } } else { city_inform[ciid].prosperityRatingExplanation = 5; } } else { city_inform[ciid].prosperityRatingExplanation = 4; } } else { city_inform[ciid].prosperityRatingExplanation = 3; } } else { city_inform[ciid].prosperityRatingExplanation = 2; } } else { city_inform[ciid].prosperityRatingExplanation = 1; } } else { city_inform[ciid].prosperityRatingExplanation = 0; } } void fun_calculateMaxProsperity() { signed int v0; // [sp+4Ch] [bp-10h]@1 signed int v1; // [sp+50h] [bp-Ch]@1 int v2; // [sp+54h] [bp-8h]@10 signed int i; // [sp+58h] [bp-4h]@1 v1 = 0; v0 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse ) { if ( buildings[i].house_size ) { v1 += model_houses[buildings[i].level_resourceId].prosperity; ++v0; } } } if ( v0 > 0 ) v2 = v1 / v0; else v2 = 0; city_inform[ciid].maxProsperity[0] = v2; } void fun_reduceProsperityRatingBecauseOfBailout() { city_inform[ciid].prosperityRating -= 3; if ( city_inform[ciid].prosperityRating < 0 ) city_inform[ciid].prosperityRating = 0; city_inform[ciid].prosperityRatingExplanation = 8; } void fun_updatePeaceRating() { signed int increase; // [sp+4Ch] [bp-4h]@2 if ( city_inform[ciid].yearsSinceStartOfPeace < 2 ) increase = 2; else increase = 5; if ( city_inform[ciid].dword_654260 ) --increase; if ( city_inform[ciid].dword_654264 ) increase -= 5; if ( city_inform[ciid].numDestroyedBuildingsByEnemies ) increase -= city_inform[ciid].numDestroyedBuildingsByEnemies; if ( city_inform[ciid].dword_654264 || city_inform[ciid].numDestroyedBuildingsByEnemies ) city_inform[ciid].yearsSinceStartOfPeace = 0; else ++city_inform[ciid].yearsSinceStartOfPeace; city_inform[ciid].dword_654260 = 0; city_inform[ciid].dword_654264 = 0; city_inform[ciid].numDestroyedBuildingsByEnemies = 0; city_inform[ciid].dword_65446C = 0; city_inform[ciid].dword_654470 = 0; city_inform[ciid].dword_654474 = 0; city_inform[ciid].dword_654478 = 0; city_inform[ciid].peaceRating += increase; if ( city_inform[ciid].peaceRating < 0 ) city_inform[ciid].peaceRating = 0; if ( city_inform[ciid].peaceRating > 100 ) city_inform[ciid].peaceRating = 100; fun_setPeaceRatingExplanation(); } void fun_setPeaceRatingExplanation() { if ( city_inform[ciid].imperialArmyComing ) { city_inform[ciid].peaceRatingExplanation = 8; } else { if ( city_inform[ciid].enemyDestroyedBuildings ) { city_inform[ciid].peaceRatingExplanation = 7; } else { if ( city_inform[ciid].rioting ) { city_inform[ciid].peaceRatingExplanation = 6; } else { if ( city_inform[ciid].peaceRating >= 10 ) { if ( city_inform[ciid].peaceRating >= 30 ) { if ( city_inform[ciid].peaceRating >= 60 ) { if ( city_inform[ciid].peaceRating >= 90 ) { if ( city_inform[ciid].peaceRating >= 100 ) city_inform[ciid].peaceRatingExplanation = 5; else city_inform[ciid].peaceRatingExplanation = 4; } else { city_inform[ciid].peaceRatingExplanation = 3; } } else { city_inform[ciid].peaceRatingExplanation = 2; } } else { city_inform[ciid].peaceRatingExplanation = 1; } } else { city_inform[ciid].peaceRatingExplanation = 0; } } } } } void fun_updateFavorRating(int isYearlyUpdate) { int milestone; // [sp+4Ch] [bp-10h]@24 signed int milestoneBonus; // [sp+54h] [bp-8h]@31 int v3; // [sp+58h] [bp-4h]@15 if ( scn_isOpenPlay ) { city_inform[ciid].favorRating = 50; } else { ++city_inform[ciid].favor_monthsSinceGift; if ( city_inform[ciid].favor_monthsSinceGift >= 12 ) city_inform[ciid].favor_giftPenalty = 0; if ( isYearlyUpdate ) { city_inform[ciid].salaryDifferenceForFavor = 0; city_inform[ciid].milestoneMissed = 0; city_inform[ciid].ignoredRequestPoints = 0; if ( setting_currentMissionId >= 2 || setting_isCustomScenario ) city_inform[ciid].favorRating -= 2; if ( city_inform[ciid].tributeNotPaid ) { if ( city_inform[ciid].tributeNotPaidYears > 1 ) { if ( city_inform[ciid].tributeNotPaidYears > 2 ) city_inform[ciid].favorRating -= 8; else city_inform[ciid].favorRating -= 5; } else { city_inform[ciid].favorRating -= 3; } } v3 = city_inform[ciid].salary_rank - city_inform[ciid].player_rank; if ( city_inform[ciid].player_rank ) { if ( v3 <= 0 ) { if ( v3 < 0 ) ++city_inform[ciid].favorRating; } else { city_inform[ciid].favorRating -= v3; city_inform[ciid].salaryDifferenceForFavor = v3 + 1; } } else { if ( v3 > 0 ) { city_inform[ciid].favorRating -= v3; city_inform[ciid].salaryDifferenceForFavor = v3; } } if ( gametime_year == scn_milestone_25 + scn_settings_startYear ) { milestone = 25; } else { if ( gametime_year == scn_milestone_50 + scn_settings_startYear ) { milestone = 50; } else { if ( gametime_year == scn_milestone_75 + scn_settings_startYear ) milestone = 75; else milestone = 0; } } if ( milestone ) { milestoneBonus = 1; if ( scn_win_culture_on ) { if ( city_inform[ciid].cultureRating < fun_adjustWithPercentage(scn_win_culture, milestone) ) milestoneBonus = 0; } if ( scn_win_prosperity_on ) { if ( city_inform[ciid].prosperityRating < fun_adjustWithPercentage(scn_win_prosperity, milestone) ) milestoneBonus = 0; } if ( scn_win_peace_on ) { if ( city_inform[ciid].peaceRating < fun_adjustWithPercentage(scn_win_peace, milestone) ) milestoneBonus = 0; } if ( scn_win_favor_on ) { if ( city_inform[ciid].favorRating < fun_adjustWithPercentage(scn_win_favor, milestone) ) milestoneBonus = 0; } if ( scn_win_population_on ) { if ( city_inform[ciid].population < fun_adjustWithPercentage(scn_win_population, milestone) ) milestoneBonus = 0; } if ( milestoneBonus ) { city_inform[ciid].favorRating += 5; } else { city_inform[ciid].favorRating -= 2; city_inform[ciid].milestoneMissed = 2; } } if ( city_inform[ciid].favorRatingLastYear >= city_inform[ciid].favorRating ) { if ( city_inform[ciid].favorRatingLastYear == city_inform[ciid].favorRating ) { city_inform[ciid].favorRatingIncrease = 1; } else { if ( city_inform[ciid].favorRatingLastYear > city_inform[ciid].favorRating ) city_inform[ciid].favorRatingIncrease = 0; } } else { city_inform[ciid].favorRatingIncrease = 2; } city_inform[ciid].favorRatingLastYear = city_inform[ciid].favorRating; } if ( city_inform[ciid].favorRating < 0 ) city_inform[ciid].favorRating = 0; if ( city_inform[ciid].favorRating > 100 ) city_inform[ciid].favorRating = 100; fun_setFavorRatingExplanation(); } } void fun_setFavorRatingExplanation() { int salaryDifference; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].salaryDifferenceForFavor = 0; salaryDifference = city_inform[ciid].salary_rank - city_inform[ciid].player_rank; if ( city_inform[ciid].player_rank ) { if ( salaryDifference > 0 ) city_inform[ciid].salaryDifferenceForFavor = salaryDifference + 1; } else { if ( salaryDifference > 0 ) city_inform[ciid].salaryDifferenceForFavor = salaryDifference; } if ( city_inform[ciid].salaryDifferenceForFavor < 8 ) { if ( city_inform[ciid].tributeNotPaidYears < 3 ) { if ( city_inform[ciid].ignoredRequestPoints < 5 ) { if ( city_inform[ciid].salaryDifferenceForFavor < 5 ) { if ( city_inform[ciid].tributeNotPaidYears < 2 ) { if ( city_inform[ciid].ignoredRequestPoints < 3 ) { if ( city_inform[ciid].salaryDifferenceForFavor < 3 ) { if ( city_inform[ciid].tributeNotPaid ) { city_inform[ciid].favorRatingExplanation = 8; } else { if ( city_inform[ciid].salaryDifferenceForFavor < 2 ) { if ( city_inform[ciid].milestoneMissed ) { city_inform[ciid].favorRatingExplanation = 10; } else { if ( city_inform[ciid].salaryDifferenceForFavor ) { city_inform[ciid].favorRatingExplanation = 11; } else { if ( city_inform[ciid].favorRatingIncrease == 2 ) { city_inform[ciid].favorRatingExplanation = 12; } else { if ( city_inform[ciid].favorRatingIncrease == 1 ) city_inform[ciid].favorRatingExplanation = 13; else city_inform[ciid].favorRatingExplanation = 0; } } } } else { city_inform[ciid].favorRatingExplanation = 9; } } } else { city_inform[ciid].favorRatingExplanation = 7; } } else { city_inform[ciid].favorRatingExplanation = 6; } } else { city_inform[ciid].favorRatingExplanation = 5; } } else { city_inform[ciid].favorRatingExplanation = 4; } } else { city_inform[ciid].favorRatingExplanation = 3; } } else { city_inform[ciid].favorRatingExplanation = 2; } } else { city_inform[ciid].favorRatingExplanation = 1; } } void fun_sendGiftToCaesar() { int v0; // [sp+4Ch] [bp-4h]@7 if ( city_inform[ciid].giftToCaesarSize ) { if ( city_inform[ciid].giftToCaesarSize == 1 ) { v0 = city_inform[ciid].generousGiftCost; } else { if ( city_inform[ciid].giftToCaesarSize == 2 ) v0 = city_inform[ciid].lavishGiftCost; } } else { v0 = city_inform[ciid].modestGiftCost; } if ( v0 <= city_inform[ciid].personalSavings ) { if ( city_inform[ciid].favor_giftPenalty > 0 ) { switch ( city_inform[ciid].favor_giftPenalty ) { case 1: city_inform[ciid].favor_giftPenalty = 2; if ( city_inform[ciid].giftToCaesarSize ) { if ( city_inform[ciid].giftToCaesarSize == 1 ) { fun_increaseFavorRating(3); } else { if ( city_inform[ciid].giftToCaesarSize == 2 ) fun_increaseFavorRating(5); } } else { fun_increaseFavorRating(1); } break; case 2: city_inform[ciid].favor_giftPenalty = 3; if ( city_inform[ciid].giftToCaesarSize ) { if ( city_inform[ciid].giftToCaesarSize == 1 ) { fun_increaseFavorRating(1); } else { if ( city_inform[ciid].giftToCaesarSize == 2 ) fun_increaseFavorRating(3); } } else { fun_increaseFavorRating(0); } break; case 3: city_inform[ciid].favor_giftPenalty = 4; if ( city_inform[ciid].giftToCaesarSize ) { if ( city_inform[ciid].giftToCaesarSize == 1 ) { fun_increaseFavorRating(0); } else { if ( city_inform[ciid].giftToCaesarSize == 2 ) fun_increaseFavorRating(1); } } else { fun_increaseFavorRating(0); } break; } } else { city_inform[ciid].favor_giftPenalty = 1; if ( city_inform[ciid].giftToCaesarSize ) { if ( city_inform[ciid].giftToCaesarSize == 1 ) { fun_increaseFavorRating(5); } else { if ( city_inform[ciid].giftToCaesarSize == 2 ) fun_increaseFavorRating(10); } } else { fun_increaseFavorRating(3); } } city_inform[ciid].favor_monthsSinceGift = 0; if ( city_inform[ciid].giftToCaesarSize ) { if ( city_inform[ciid].giftToCaesarSize == 1 ) { ++city_inform[ciid].generousGiftType; } else { if ( city_inform[ciid].giftToCaesarSize == 2 ) ++city_inform[ciid].lavishGiftType; } } else { ++city_inform[ciid].modestGiftType; } if ( city_inform[ciid].modestGiftType >= 4 ) city_inform[ciid].modestGiftType = 0; if ( city_inform[ciid].generousGiftType >= 4 ) city_inform[ciid].generousGiftType = 0; if ( city_inform[ciid].lavishGiftType >= 4 ) city_inform[ciid].lavishGiftType = 0; city_inform[ciid].personalSavings -= v0; } } void fun_initNewScenarioMap() { fun_memset(grid_graphicIds, 52488, 0); fun_memset(grid_edge, 26244, 0); fun_memset(grid_buildingIds, 52488, 0); fun_memset(grid_terrain, 52488, 0); fun_memset(grid_aqueducts, 26244, 0); fun_memset(grid_walkerIds, 52488, 0); fun_memset(grid_bitfields, 26244, 0); fun_memset(grid_animation, 26244, 0); fun_memset(grid_random, 26244, 0); fun_memset(grid_desirability, 26244, 0); fun_memset(grid_elevation, 26244, 0); fun_memset(grid_buildingDamage, 26244, 0); fun_memset(rubble_originalBuildingType, 26244, 0); fun_memset(byte_902EC0, 26244, 0); fun_memset(byte_91C920, 26244, 0); fun_memset(byte_8ADF60, 26244, 0); fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F2550, 48); fun_setByte14Zero(byte_5F2850, 10); fun_setByte14Zero(byte_5F28F0, 14); fun_setByte14Zero(byte_5F29D0, 17); fun_setByte14Zero(byte_5F2AE0, 17); fun_setByte14Zero(byte_5F2BF0, 17); fun_setByte14Zero(byte_5F2D00, 48); fun_setByte14Zero(byte_5F3000, 16); fun_initTerrainGridEdge(); fun_initRandomGrid(); fun_initGraphicIdGrid(); } void fun_initTerrainGridEdge() { int v0; // [sp+4Ch] [bp-Ch]@1 int i; // [sp+50h] [bp-8h]@1 int v2; // [sp+54h] [bp-4h]@3 v0 = 0; for ( i = 0; i < 162; ++i ) { v2 = 0; while ( v2 < 162 ) { if ( v2 < (162 - setting_map_width) / 2 ) grid_terrain[v0] = 5; if ( v2 >= (162 - setting_map_width) / 2 + setting_map_width ) grid_terrain[v0] = 5; if ( i < (162 - setting_map_height) / 2 ) grid_terrain[v0] = 5; if ( i >= (162 - setting_map_height) / 2 + setting_map_height ) grid_terrain[v0] = 5; ++v2; ++v0; } } } void fun_initRandomGrid() { int v0; // [sp+4Ch] [bp-Ch]@1 signed int i; // [sp+50h] [bp-8h]@1 signed int v2; // [sp+54h] [bp-4h]@3 v0 = 0; for ( i = 0; i < 162; ++i ) { v2 = 0; while ( v2 < 162 ) { fun_generateRandomness(); grid_random[v0] = random_7fff_1; ++v2; ++v0; } } } void fun_initMapEdges() { int gridOffset; // [sp+4Ch] [bp-Ch]@1 int height; // [sp+50h] [bp-8h]@1 int width; // [sp+54h] [bp-4h]@3 gridOffset = setting_map_startGridOffset; height = 0; while ( height <= setting_map_height ) { width = 0; while ( width <= setting_map_width ) { if ( width != setting_map_width || height != setting_map_height ) { if ( width != setting_map_width || height ) { if ( width || height != setting_map_height ) { if ( width == setting_map_width ) { grid_graphicIds[gridOffset] = 2; } else { if ( height == setting_map_height ) grid_graphicIds[gridOffset] = 1; else grid_graphicIds[gridOffset] = 6; } } else { grid_graphicIds[gridOffset] = 3; } } else { grid_graphicIds[gridOffset] = 4; } } else { grid_graphicIds[gridOffset] = 5; } ++width; ++gridOffset; } ++height; gridOffset = gridOffset + setting_map_gridBorderSize - 1; } } void sub_472C90(int a1, int a2, int x, int y, int buildingType) { int v5; // [sp+4Ch] [bp-Ch]@1 int v6; // [sp+50h] [bp-8h]@52 int v7; // [sp+54h] [bp-4h]@52 v5 = setting_map_orientation / 2; dword_9363B4 = 0; if ( buildingType ) { if ( city_inform[ciid].treasury > -5000 ) { fun_memAndWithByte(grid_bitfields, 26244, 0xAFu); dword_9363B4 = model_buildings[buildingType].cost; width = buildingSizes[4 * buildingType]; switch ( buildingType ) { case B_ClearLand: sub_476EB0(1, a1, a2, x, y); if ( multipleConstruction_itemsPlaced >= 0 ) dword_9363B4 *= multipleConstruction_itemsPlaced; break; case B_ReservoirSimon: sub_486540(1, a1, a2, x, y); dword_607FA4 = 1; sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); dword_9DA7C8 = 0; break; case B_Wall: fun_buildConstructWall(1, a1, a2, x, y); if ( multipleConstruction_itemsPlaced >= 0 ) dword_9363B4 *= multipleConstruction_itemsPlaced; break; case B_Road: sub_4779D0(1, a1, a2, x, y); if ( multipleConstruction_itemsPlaced >= 0 ) dword_9363B4 *= multipleConstruction_itemsPlaced; break; case B_Plaza: sub_477DD0(1, a1, a2, x, y); if ( multipleConstruction_itemsPlaced >= 0 ) dword_9363B4 *= multipleConstruction_itemsPlaced; break; case B_Gardens: sub_4787A0(1, a1, a2, x, y); if ( multipleConstruction_itemsPlaced >= 0 ) dword_9363B4 *= multipleConstruction_itemsPlaced; break; case B_LowBridge: if ( bridge_something > 1 ) dword_9363B4 *= bridge_something; break; case B_ShipBridge: if ( bridge_something > 1 ) dword_9363B4 *= bridge_something; break; case B_Aqueduct: sub_486BC0(1, a1, a2, x, y); sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); break; case B_HouseVacantLot: sub_476BA0(1, a1, a2, x, y); if ( multipleConstruction_itemsPlaced >= 0 ) dword_9363B4 *= multipleConstruction_itemsPlaced; break; case B_Gatehouse: sub_482BD0(2, x, y, 0xFFBFu, 0); break; case B_TriumphalArch: sub_482BD0(3, x, y, 0xFFBFu, 0); break; case B_Warehouse: sub_482BD0(3, x, y, 0xFFFFu, 0); break; default: if ( buildingType != B_FortLegionaries && buildingType != B_FortJavelin && buildingType != B_FortMounted ) { if ( buildingType == B_Hippodrome ) { if ( fun_isTerrainFree(5, x, y, 0xFFFFu) ) { if ( fun_isTerrainFree(5, dword_5F4500[2 * v5] + x, dword_5F4504[2 * v5] + y, 0xFFFFu) ) { if ( fun_isTerrainFree(5, dword_5F4520[2 * v5] + x, dword_5F4524[2 * v5] + y, 0xFFFFu) ) sub_482BD0(5, x, y, 0xFFFFu, 0); } } } else { if ( buildingType != B_Shipyard && buildingType != B_Wharf ) { if ( buildingType == B_Dock ) { if ( !sub_482140(x, y, 1) ) dword_9DA7C8 = 1; } else { if ( dword_9DA800 ) { sub_48D300(x, y, 3, 1, 2048); } else { if ( dword_9DA8B4 ) { sub_48D300(x, y, 2, 1, 2); } else { if ( dword_9DA7C4 ) { sub_48D300(x, y, 2, 1, 17); } else { if ( dword_9DA828 ) { sub_48D300(x, y, 2, 3, 4); } else { if ( dword_9DA908 ) { sub_48D600(x, y, 2, 0, 0x4000u); } else { if ( buildingType != B_SenateUpgraded || !city_inform[ciid].word_6543AE ) { if ( buildingType != B_Barracks || numBarracks <= 0 ) { if ( buildingType != B_DistributionCenter_Unused || !city_inform[ciid].dword_654520 ) sub_482BD0(width, x, y, 0xFFFFu, 0); } } } } } } } } } else { if ( !sub_481A50(x, y, 1) ) dword_9DA7C8 = 1; } } } else { if ( numForts < 6 ) { v7 = dword_5F44C0[2 * v5]; v6 = dword_5F44C4[2 * v5]; if ( fun_isTerrainFree(3, x, y, 0xFFFFu) ) { if ( fun_isTerrainFree(4, v7 + x, v6 + y, 0xFFFFu) ) sub_482BD0(3, x, y, 0xFFFFu, 0); } } } break; } } } } void fun_placeBuilding(int ciid_, int orientation, signed int xMin, signed int yMin, signed int xPos, signed int yPos, BuildingType buildingId) { signed int v7; // ST88_4@53 signed int v8; // ST88_4@55 signed int v9; // ST88_4@327 signed int v10; // ST84_4@375 signed int v11; // ST88_4@375 signed int v12; // ST84_4@375 signed int v13; // ST88_4@375 signed int v14; // ST84_4@375 signed int v15; // ST88_4@375 signed int v16; // ST84_4@375 signed int v17; // ST88_4@375 signed int v18; // ST84_4@375 signed int v19; // ST88_4@375 signed int v20; // ST84_4@375 signed int v21; // ST88_4@375 signed int v22; // ST84_4@375 signed int v23; // ST88_4@375 signed int v24; // ST84_4@375 signed int v25; // ST88_4@375 signed int formationId; // [sp+4Ch] [bp-24h]@321 int v27; // [sp+54h] [bp-1Ch]@84 unsigned __int16 terrainMask; // [sp+58h] [bp-18h]@61 int size; // [sp+5Ch] [bp-14h]@61 int v30; // [sp+60h] [bp-10h]@349 __int16 v31; // [sp+60h] [bp-10h]@382 int v32; // [sp+64h] [bp-Ch]@52 int v33; // [sp+64h] [bp-Ch]@54 signed int v34; // [sp+68h] [bp-8h]@321 signed int v35; // [sp+68h] [bp-8h]@341 signed int v36; // [sp+68h] [bp-8h]@353 signed int v37; // [sp+6Ch] [bp-4h]@150 signed int v38; // [sp+6Ch] [bp-4h]@349 signed int v39; // [sp+6Ch] [bp-4h]@361 noShowWarnings = 0; amount = 0; if ( !buildingId ) return; if ( city_inform[ciid].treasury <= -5000 ) { fun_memAndWithByte(grid_bitfields, 26244, 0xAFu); showWarning(3); // out of money return; } if ( buildingId >= B_LargeTempleCeres && buildingId <= B_LargeTempleVenus && city_inform[ciid].stock_marble < 2 ) { fun_memAndWithByte(grid_bitfields, 26244, 0xAFu); showWarning(15); return; } if ( buildingId == B_Oracle && city_inform[ciid].stock_marble < 2 ) { fun_memAndWithByte(grid_bitfields, 26244, 0xAFu); showWarning(16); return; } if ( buildingId != B_ClearLand && fun_hasEnemyNear(xMin, yMin, xPos, yPos) ) { if ( buildingId != B_Wall && buildingId != B_Road && buildingId != B_Aqueduct ) { if ( buildingId != B_Plaza && buildingId != B_Gardens ) { if ( buildingId != B_LowBridge && buildingId != B_ShipBridge ) fun_memAndWithByte(grid_bitfields, 26244, 0xAFu); else bridge_something = 0; } else { memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); memcpy(undo_grid_bitfields, grid_bitfields, 26244); memcpy(undo_grid_edge, grid_edge, 26244); sub_4914E0(); } } else { memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); } showWarning(50); return; } amount = model_buildings[buildingId].cost; dword_9363B8 = 0; if ( buildingId == B_ClearLand ) { sub_476EB0(0, xMin, yMin, xPos, yPos); amount *= multipleConstruction_itemsPlaced; LABEL_390: if ( buildingId >= B_LargeTempleCeres && buildingId <= B_LargeTempleVenus || buildingId == B_Oracle ) fun_removeGoodsFromCityStorage(ciid, G_Marble, 2); sub_4BFCC0(xPos, yPos); fun_spendMoneyConstruction(ciid_, amount); if ( buildingId != B_TriumphalArch ) sub_490FD0(); return; } if ( buildingId == B_Wall ) { fun_buildConstructWall(0, xMin, yMin, xPos, yPos); amount *= multipleConstruction_itemsPlaced; goto LABEL_390; } if ( buildingId == B_Road ) { sub_4779D0(0, xMin, yMin, xPos, yPos); amount *= multipleConstruction_itemsPlaced; goto LABEL_390; } if ( buildingId == B_Plaza ) { sub_477DD0(0, xMin, yMin, xPos, yPos); amount *= multipleConstruction_itemsPlaced; goto LABEL_390; } if ( buildingId == B_Gardens ) { sub_4787A0(0, xMin, yMin, xPos, yPos); amount *= multipleConstruction_itemsPlaced; fun_determineGroundType(); sub_4FFDF0(); goto LABEL_390; } if ( buildingId == B_LowBridge ) { sub_4870D0(xPos, yPos, 0); if ( bridge_something <= 1 ) { showWarning(25); return; } amount *= bridge_something; goto LABEL_390; } if ( buildingId == B_ShipBridge ) { sub_4870D0(xPos, yPos, 1); if ( bridge_something <= 1 ) { showWarning(25); return; } amount *= bridge_something; goto LABEL_390; } if ( buildingId == B_Aqueduct ) { if ( !sub_486BC0(0, xMin, yMin, xPos, yPos) ) { showWarning(2); return; } amount = dword_9363B4; sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); fun_determineGroundType(); sub_4FFDF0(); goto LABEL_390; } if ( buildingId == B_ReservoirSimon ) { if ( !sub_486540(0, xMin, yMin, xPos, yPos) ) { showWarning(2); return; } v32 = xMin + setting_map_startGridOffset + 162 * (yMin - 1) - 1; if ( dword_89AA84 == 1 ) { v7 = fun_createBuilding(ciid_, B_Reservoir, xMin - 1, yMin - 1); sub_490DE0(v7); fun_putBuildingOnTerrainAndGraphicGrids(v7, xMin - 1, yMin - 1, 3, 3, graphic_reservoir, 8); grid_aqueducts[v32] = 0; } v33 = xPos + setting_map_startGridOffset + 162 * (yPos - 1) - 1; if ( dword_8E147C == 1 ) { v8 = fun_createBuilding(ciid_, B_Reservoir, xPos - 1, yPos - 1); sub_490DE0(v8); fun_putBuildingOnTerrainAndGraphicGrids(v8, xPos - 1, yPos - 1, 3, 3, graphic_reservoir, 8); grid_aqueducts[v33] = 0; if ( !fun_mapAreaContainsTerrain(xMin - 2, yMin - 2, 5, T_Water) ) { if ( !dword_89AA84 ) fun_showWarningNoWaterInReservoir(90); } } amount = dword_9363B4; sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); fun_determineGroundType(); sub_4FFDF0(); goto LABEL_390; } if ( buildingId == B_HouseVacantLot ) { sub_476BA0(0, xMin, yMin, xPos, yPos); amount *= multipleConstruction_itemsPlaced; goto LABEL_390; } terrainMask = 0xFFFFu; width = buildingSizes[4 * buildingId]; size = width; if ( buildingId == B_Gatehouse ) terrainMask = 0xFFBFu; if ( buildingId == B_Tower ) terrainMask = 0xBFFFu; if ( buildingId == 56 ) terrainMask = 0xFFBFu; if ( buildingId == B_Warehouse ) size = 3; if ( buildingId == B_Gatehouse ) v27 = sub_488430(xPos, yPos); if ( buildingId == 56 ) v27 = sub_488860(xPos, yPos); if ( orientation ) { switch ( orientation ) { case 6: yPos = yPos - size + 1; break; case 4: xPos = xPos - size + 1; yPos = yPos - size + 1; break; case 2: xPos = xPos - size + 1; break; } } if ( buildingId == B_Gatehouse ) { if ( !fun_terrainIsClear(xPos, yPos, size, size, terrainMask, 0) ) { showWarning(2); return; } if ( !v27 ) { if ( dword_9363AC == 1 ) v27 = 1; else v27 = 2; } } if ( buildingId == 56 ) { if ( !fun_terrainIsClear(xPos, yPos, size, size, terrainMask, 0) ) { showWarning(2); return; } if ( !v27 ) { if ( dword_9363AC == 1 ) v27 = 1; else v27 = 3; } } if ( buildingId != B_Shipyard && buildingId != B_Wharf ) { if ( buildingId == B_Dock ) { if ( sub_482140(xPos, yPos, 0) ) { showWarning(25); return; } if ( !fun_dockIsConnectedToOpenWater(xPos, yPos) ) { showWarning(56); return; } } else { if ( !fun_terrainIsClear(xPos, yPos, size, size, terrainMask, 0) ) { showWarning(2); return; } if ( dword_9DA800 ) { if ( !sub_48D300(xPos, yPos, 3, 1, 2048) ) { showWarning(20); return; } } else { if ( dword_9DA8B4 ) { if ( !sub_48D300(xPos, yPos, 2, 1, 2) ) { showWarning(22); return; } } else { if ( dword_9DA7C4 ) { if ( !sub_48D300(xPos, yPos, 2, 1, 17) ) { showWarning(23); return; } } else { if ( dword_9DA828 ) { if ( !sub_48D300(xPos, yPos, 2, 3, 4) ) { showWarning(21); return; } } else { if ( dword_9DA908 && !sub_48D600(xPos, yPos, 2, 0, 16384) ) { showWarning(49); return; } } } } } } } else { if ( sub_481A50(xPos, yPos, 0) ) { showWarning(25); return; } } if ( buildingId == B_FortLegionaries || buildingId == B_FortJavelin || buildingId == B_FortMounted ) { if ( !fun_terrainIsClear(xPos + 3, yPos - 1, 4, 4, terrainMask, 0) ) { showWarning(2); return; } if ( numForts >= 6 ) { showWarning(52); return; } } if ( buildingId == B_Hippodrome ) { if ( city_inform[ciid].hippodromeBuiltInCity ) { showWarning(4); return; } if ( !fun_terrainIsClear(xPos + 5, yPos, 5, 5, terrainMask, 0) ) { showWarning(2); return; } if ( !fun_terrainIsClear(xPos + 10, yPos, 5, 5, terrainMask, 0) ) { showWarning(2); return; } } if ( buildingId == B_SenateUpgraded && city_inform[ciid].word_6543AE ) { showWarning(4); return; } if ( buildingId == B_Barracks && numBarracks > 0 ) { showWarning(4); return; } fun_showWarningMoreFoodNeeded(buildingId); showWarningNoWorkers(buildingId); showWarningNoMarkets(buildingId); showWarningNoActors(buildingId); fun_showWarningNoGladiators(buildingId); fun_showWarningNoLions(buildingId); fun_showWarningNoChariots(buildingId); fun_showWarningNoBarracks(buildingId); fun_showWarningNoWeapons(buildingId); fun_showWarningNoWall(buildingId, xPos, yPos, size); fun_showWarningNoWaterAccess(buildingId, xPos, yPos); fun_showWarningNoIron(buildingId); fun_showWarningNoVines(buildingId); fun_showWarningNoOlives(buildingId); fun_showWarningNoTimber(buildingId); fun_showWarningNoClay(buildingId); fun_showWarningBuildingRoadAccess(buildingId, xPos, yPos, size); if ( buildingId != B_FortLegionaries && buildingId != B_FortJavelin && buildingId != B_FortMounted ) v37 = fun_createBuilding(ciid_, buildingId, xPos, yPos); else v37 = fun_createBuilding(ciid_, B_FortGround__, xPos, yPos); sub_490DE0(v37); if ( v37 > 0 ) { switch ( buildingId ) { case B_HouseLargeTent: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_tent + 2, 8); break; case B_HouseSmallShack: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_shack, 8); break; case B_HouseLargeShack: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_shack + 2, 8); break; case B_HouseSmallHovel: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_hovel, 8); break; case B_HouseLargeHovel: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_hovel + 2, 8); break; case B_HouseSmallCasa: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_casa, 8); break; case B_HouseLargeCasa: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_casa + 2, 8); break; case B_HouseSmallInsula: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_insula, 8); break; case B_HouseMediumInsula: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_insula + 2, 8); break; case B_HouseLargeInsula: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_insula2, 8); break; case B_HouseGrandInsula: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_insula2 + 2, 8); break; case B_HouseSmallVilla: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_villa, 8); break; case B_HouseMediumVilla: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_villa + 2, 8); break; case B_HouseLargeVilla: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_villa2, 8); break; case B_HouseGrandVilla: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_villa2 + 1, 8); break; case B_HouseSmallPalace: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_palace, 8); break; case B_HouseMediumPalace: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_palace + 1, 8); break; case B_HouseLargePalace: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_palace2, 8); break; case B_HouseLuxuryPalace: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_housing_palace2 + 1, 8); break; case B_Amphitheater: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_amphitheater, 8); break; case B_Theater: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_theater, 8); break; case B_Colosseum: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_colosseum, 8); break; case B_GladiatorSchool: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_gladiatorSchool, 8); break; case B_LionHouse: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_lionHouse, 8); break; case B_ActorColony: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_actorColony, 8); break; case B_ChariotMaker: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_chariotMaker, 8); break; case B_SmallStatue: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C2A, 8); break; case B_MediumStatue: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C2A + 1, 8); break; case B_LargeStatue: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C2A + 2, 8); break; case B_Doctor: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C38, 8); break; case B_Hospital: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C3C, 8); break; case B_Bathhouse: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6D22, 8); break; case B_Barber: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C36, 8); break; case B_School: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C02, 8); break; case B_Academy: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C06, 8); break; case B_Library: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C04, 8); break; case B_Prefecture: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C30, 8); break; case B_WheatFarm: sub_480460(v37, xPos, yPos, graphic_nativeCrops, 0); break; case B_VegetableFarm: sub_480460(v37, xPos, yPos, graphic_nativeCrops + 5, 0); break; case B_FruitFarm: sub_480460(v37, xPos, yPos, graphic_nativeCrops + 10, 0); break; case B_OliveFarm: sub_480460(v37, xPos, yPos, graphic_nativeCrops + 15, 0); break; case B_VinesFarm: sub_480460(v37, xPos, yPos, graphic_nativeCrops + 20, 0); break; case B_PigFarm: sub_480460(v37, xPos, yPos, graphic_nativeCrops + 25, 0); break; case B_MarbleQuarry: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_quarry, 8); break; case B_IronMine: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_ironMine, 8); break; case B_TimberYard: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_timberYard, 8); break; case B_ClayPit: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_clayPit, 8); break; case B_WineWorkshop: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_wineWorkshop, 8); break; case B_OilWorkshop: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_oilWorkshop, 8); break; case B_WeaponsWorkshop: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_weaponsWorkshop, 8); break; case B_FurnitureWorkshop: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_furnitureWorkshop, 8); break; case B_PotteryWorkshop: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_potteryWorkshop, 8); break; case B_Granary: buildings[v37].storageId = fun_createStorage(); fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_granary, 8); break; case B_Market: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_market, 8); break; case B_GovernorsHouse: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_governorsHouse, 8); break; case B_GovernorsVilla: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_governorsVilla, 8); break; case B_GovernorsPalace: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_governorsPalace, 8); break; case B_MissionPost: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_missionPost, 8); break; case B_EngineersPost: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_engineersPost, 8); break; case B_Forum: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_forum, 8); break; case B_Fountain: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_fountain1, 8); break; case B_Well: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_well, 8); break; case B_NativeHut: fun_putBuildingOnTerrainAndGraphicGrids( v37, xPos, yPos, width, width, (random_7f_1 & 1) + graphic_nativeBuilding, 8); break; case B_NativeMeeting: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_nativeBuilding + 2, 8); break; case B_NativeCrops: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_nativeCrops, 8); break; case B_MilitaryAcademy: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_militaryAcademy, 8); break; case B_SmallTempleCeres: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeCeres, 8); break; case B_SmallTempleNeptune: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeNeptune, 8); break; case B_SmallTempleMercury: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeMercury, 8); break; case B_SmallTempleMars: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeMars, 8); break; case B_SmallTempleVenus: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeVenus, 8); break; case B_LargeTempleCeres: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeCeres + 1, 8); break; case B_LargeTempleNeptune: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeNeptune + 1, 8); break; case B_LargeTempleMercury: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeMercury + 1, 8); break; case B_LargeTempleMars: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeMars + 1, 8); break; case B_LargeTempleVenus: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_templeVenus + 1, 8); break; case B_Oracle: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_oracle, 8); break; case B_Shipyard: buildings[v37].house_neptune = dword_8E1468; sub_481E70(v37, xPos, yPos, dword_89AA88 + word_6E6C4A); break; case B_Wharf: buildings[v37].house_neptune = dword_8E1468; sub_481E70(v37, xPos, yPos, dword_89AA88 + word_6E6C4E); break; case B_Tower: sub_48D170(xPos, yPos, 2, 0, 0xBFFFu); fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, graphic_tower, -32760); sub_47E2B0(xPos, yPos, 5); break; case B_Gatehouse: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, v27 + graphic_tower, -32760); buildings[v37].level_resourceId = v27; sub_46F260(); sub_488B70(xPos, yPos, v27); sub_47F200(xPos, yPos, 5); sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); sub_47E2B0(xPos, yPos, 5); break; case B_TriumphalArch: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6D4A + v27 - 1, 8); buildings[v37].level_resourceId = v27; sub_46F260(); sub_488E00(xPos, yPos, v27); sub_47F200(xPos, yPos, 5); sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); ++city_inform[ciid].placedTriumphalArches; fun_enableBuildingMenuItems(); toPlace_buildingType = B_none_building; break; default: if ( buildingId != B_FortLegionaries && buildingId != B_FortJavelin && buildingId != B_FortMounted ) { switch ( buildingId ) { case B_Barracks: fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6CFC, 8); if ( !city_inform[ciid].word_6543CE ) { city_inform[ciid].barracksBuildingId = v37; city_inform[ciid].byte_6543CC = xPos; city_inform[ciid].byte_6543CD = yPos; city_inform[ciid].word_6543CE = 162 * yPos + xPos + (_WORD)setting_map_startGridOffset; } break; case B_DistributionCenter_Unused: city_inform[ciid].dword_654520 = 1; fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6CFC, 8); if ( !city_inform[ciid].word_65451A ) { city_inform[ciid].dword_65451C = v37; city_inform[ciid].byte_654518 = xPos; city_inform[ciid].byte_654519 = yPos; city_inform[ciid].word_65451A = 162 * yPos + xPos + (_WORD)setting_map_startGridOffset; } break; case B_Hippodrome: city_inform[ciid].hippodromeBuiltInCity = 1; if ( setting_map_orientation && setting_map_orientation != 4 ) buildings[v37].level_resourceId = 3; else buildings[v37].level_resourceId = 0; buildings[v37].warehouse_prevStorage = 0; v35 = v37; if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 4: v30 = word_6E6D5C + 4; break; case 2: v30 = word_6E6D5A + 4; break; case 6: _LOWORD(v30) = word_6E6D5A; break; } } else { _LOWORD(v30) = word_6E6D5C; } fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, v30, 8); v38 = fun_createBuilding(ciid_, B_Hippodrome, xPos + 5, yPos); sub_490DE0(v38); if ( setting_map_orientation && setting_map_orientation != 4 ) buildings[v38].level_resourceId = 4; else buildings[v38].level_resourceId = 1; buildings[v38].warehouse_prevStorage = v35; buildings[v35].warehouse_nextStorage = v38; buildings[v38].warehouse_nextStorage = 0; v36 = v38; if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 4: v30 = word_6E6D5C + 2; break; case 2: v30 = word_6E6D5A + 2; break; case 6: v30 = word_6E6D5A + 2; break; } } else { v30 = word_6E6D5C + 2; } fun_putBuildingOnTerrainAndGraphicGrids(v38, xPos + 5, yPos, width, width, v30, 8); v39 = fun_createBuilding(ciid_, B_Hippodrome, xPos + 10, yPos); sub_490DE0(v39); if ( setting_map_orientation && setting_map_orientation != 4 ) buildings[v39].level_resourceId = 5; else buildings[v39].level_resourceId = 2; buildings[v39].warehouse_prevStorage = v36; buildings[v36].warehouse_nextStorage = v39; buildings[v39].warehouse_nextStorage = 0; if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 4: _LOWORD(v30) = word_6E6D5C; break; case 2: _LOWORD(v30) = word_6E6D5A; break; case 6: v30 = word_6E6D5A + 4; break; } } else { v30 = word_6E6D5C + 4; } fun_putBuildingOnTerrainAndGraphicGrids(v39, xPos + 10, yPos, width, width, v30, 8); break; case B_Warehouse: buildings[v37].storageId = fun_createStorage(); buildings[v37].warehouse_prevStorage = 0; v10 = v37; fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C54, 8); v11 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos + 1, yPos); sub_490DE0(v11); buildings[v11].warehouse_prevStorage = v10; buildings[v10].warehouse_nextStorage = v11; v12 = v11; fun_putBuildingOnTerrainAndGraphicGrids( v11, xPos + 1, yPos, width, width, graphic_emptyWarehouseTile, 8); v13 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos + 2, yPos); sub_490DE0(v13); buildings[v13].warehouse_prevStorage = v12; buildings[v12].warehouse_nextStorage = v13; v14 = v13; fun_putBuildingOnTerrainAndGraphicGrids( v13, xPos + 2, yPos, width, width, graphic_emptyWarehouseTile, 8); v15 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos, yPos + 1); sub_490DE0(v15); buildings[v15].warehouse_prevStorage = v14; buildings[v14].warehouse_nextStorage = v15; v16 = v15; fun_putBuildingOnTerrainAndGraphicGrids( v15, xPos, yPos + 1, width, width, graphic_emptyWarehouseTile, 8); v17 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos + 1, yPos + 1); sub_490DE0(v17); buildings[v17].warehouse_prevStorage = v16; buildings[v16].warehouse_nextStorage = v17; v18 = v17; fun_putBuildingOnTerrainAndGraphicGrids( v17, xPos + 1, yPos + 1, width, width, graphic_emptyWarehouseTile, 8); v19 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos + 2, yPos + 1); sub_490DE0(v19); buildings[v19].warehouse_prevStorage = v18; buildings[v18].warehouse_nextStorage = v19; v20 = v19; fun_putBuildingOnTerrainAndGraphicGrids( v19, xPos + 2, yPos + 1, width, width, graphic_emptyWarehouseTile, 8); v21 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos, yPos + 2); sub_490DE0(v21); buildings[v21].warehouse_prevStorage = v20; buildings[v20].warehouse_nextStorage = v21; v22 = v21; fun_putBuildingOnTerrainAndGraphicGrids( v21, xPos, yPos + 2, width, width, graphic_emptyWarehouseTile, 8); v23 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos + 1, yPos + 2); sub_490DE0(v23); buildings[v23].warehouse_prevStorage = v22; buildings[v22].warehouse_nextStorage = v23; v24 = v23; fun_putBuildingOnTerrainAndGraphicGrids( v23, xPos + 1, yPos + 2, width, width, graphic_emptyWarehouseTile, 8); v25 = fun_createBuilding(ciid_, B_WarehouseSpace, xPos + 2, yPos + 2); sub_490DE0(v25); buildings[v25].warehouse_prevStorage = v24; buildings[v24].warehouse_nextStorage = v25; buildings[v25].warehouse_nextStorage = 0; fun_putBuildingOnTerrainAndGraphicGrids( v25, xPos + 2, yPos + 2, width, width, graphic_emptyWarehouseTile, 8); break; case B_SenateUpgraded: city_inform[ciid].word_6543AE = 1; fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C2C, 8); if ( !city_inform[ciid].word_652822 ) { city_inform[ciid].dword_652824 = v37; city_inform[ciid].byte_652820 = xPos; city_inform[ciid].byte_652821 = yPos; city_inform[ciid].word_652822 = 162 * yPos + xPos + (_WORD)setting_map_startGridOffset; } break; case B_Dock: ++city_inform[ciid].numWorkingDocks; buildings[v37].house_neptune = dword_8E1468; if ( dword_89AA88 ) { if ( dword_89AA88 == 1 ) { v31 = word_6E6D00; } else { if ( dword_89AA88 == 2 ) v31 = word_6E6D02; else v31 = word_6E6D04; } } else { v31 = word_6E6C4C; } sub_4824E0(v37, xPos, yPos, v31); break; } } else { buildings[v37].warehouse_prevStorage = 0; v34 = v37; fun_putBuildingOnTerrainAndGraphicGrids(v37, xPos, yPos, width, width, word_6E6C34, 8); formationId = fun_createFortFormation(v37); buildings[v37].formationId = formationId; if ( buildingId == B_FortLegionaries ) { buildings[v37].level_resourceId = Walker_FortLegionary; formations[formationId].walkerType = Walker_FortLegionary; } if ( buildingId == B_FortJavelin ) { buildings[v37].level_resourceId = Walker_FortJavelin; formations[formationId].walkerType = Walker_FortJavelin; } if ( buildingId == B_FortMounted ) { buildings[v37].level_resourceId = Walker_FortMounted; formations[formationId].walkerType = Walker_FortMounted; } v9 = fun_createBuilding(ciid_, B_FortGround, xPos + 3, yPos - 1); sub_490DE0(v9); buildings[v9].formationId = formationId; buildings[v9].warehouse_prevStorage = v34; buildings[v34].warehouse_nextStorage = v9; buildings[v9].warehouse_nextStorage = 0; fun_putBuildingOnTerrainAndGraphicGrids(v9, xPos + 3, yPos - 1, 4, 4, word_6E6C34 + 1, 8); } break; } fun_determineGroundType(); sub_4FFDF0(); sub_500420(); goto LABEL_390; } } void sub_476BA0(int a1, int a2, int a3, int a4, int a5) { signed int v5; // [sp+4Ch] [bp-24h]@1 signed int v6; // [sp+58h] [bp-18h]@24 int v7; // [sp+60h] [bp-10h]@5 int v8; // [sp+64h] [bp-Ch]@5 int v9; // [sp+68h] [bp-8h]@2 int v10; // [sp+6Ch] [bp-4h]@2 v5 = 0; if ( a2 > a4 ) { v10 = a4; v9 = a2; } else { v10 = a2; v9 = a4; } if ( a3 > a5 ) { v8 = a5; v7 = a3; } else { v8 = a3; v7 = a5; } if ( v10 < 0 ) v10 = 0; if ( v9 >= setting_map_width ) v9 = setting_map_width - 1; if ( v8 < 0 ) v8 = 0; if ( v7 >= setting_map_height ) v7 = setting_map_height - 1; multipleConstruction_itemsPlaced = 0; sub_490D00(); walkerBaseGridOffset = 162 * v8 + v10 + setting_map_startGridOffset; dword_909548 = v8; while ( dword_909548 <= v7 ) { dword_909544 = v10; while ( dword_909544 <= v9 ) { if ( !(grid_terrain[walkerBaseGridOffset] & 0xD77F) ) { if ( a1 ) { grid_bitfields[walkerBaseGridOffset] |= 0x10u; ++multipleConstruction_itemsPlaced; } else { v6 = fun_createBuilding(ciid, B_HouseVacantLot, dword_909544, dword_909548); sub_490DE0(v6); if ( v6 > 0 ) { ++multipleConstruction_itemsPlaced; fun_putBuildingOnTerrainAndGraphicGrids(v6, dword_909544, dword_909548, 1, 1, graphic_housing_vacant, 8); if ( !sub_48D300(dword_909544, dword_909548, 1, 2, 64) ) v5 = 1; } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - (v9 - v10 + 1); } if ( !a1 ) { fun_showWarningMoreFoodNeeded(10); if ( v5 == 1 ) showWarning(62); // some plots too far from road fun_determineGroundType(); sub_4FFDF0(); window_redrawRequest = 1; } } void sub_476EB0(int a1, int a2, int a3, int x, int y) { __int16 terrain; // cx@21 signed int askConfirmationBridge; // [sp+4Ch] [bp-30h]@17 signed int askConfirmationFort; // [sp+50h] [bp-2Ch]@17 int buildingId; // [sp+5Ch] [bp-20h]@21 int v9; // [sp+6Ch] [bp-10h]@7 int v10; // [sp+70h] [bp-Ch]@7 int v11; // [sp+74h] [bp-8h]@4 int v12; // [sp+78h] [bp-4h]@4 deleteFort_confirmed = 0; deleteBridge_confirmed = 0; if ( a1 ) { sub_4771D0(a1, a2, a3, x, y); } else { if ( a2 > x ) { v12 = x; v11 = a2; } else { v12 = a2; v11 = x; } if ( a3 > y ) { v10 = y; v9 = a3; } else { v10 = a3; v9 = y; } if ( v12 < 0 ) v12 = 0; if ( v11 >= setting_map_width ) v11 = setting_map_width - 1; if ( v10 < 0 ) v10 = 0; if ( v9 >= setting_map_height ) v9 = setting_map_height - 1; walkerBaseGridOffset = 162 * v10 + v12 + setting_map_startGridOffset; askConfirmationFort = 0; askConfirmationBridge = 0; dword_909548 = v10; while ( dword_909548 <= v9 ) { dword_909544 = v12; while ( dword_909544 <= v11 ) { buildingId = grid_buildingIds[walkerBaseGridOffset]; terrain = grid_terrain[walkerBaseGridOffset]; if ( grid_buildingIds[walkerBaseGridOffset] ) { if ( buildings[buildingId].type == B_FortGround__ || buildings[buildingId].type == B_FortGround ) askConfirmationFort = 1; } if ( grid_animation[walkerBaseGridOffset] ) { if ( terrain & T_Water ) askConfirmationBridge = 1; } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - (v11 - v12 + 1); } deleteConfirm_a2 = a2; deleteConfirm_a3 = a3; deleteConfirm_x = x; deleteConfirm_y = y; if ( askConfirmationFort ) { fun_showConfirmDialog(14, fun_confirmdialog_deleteFort, 2); } else { if ( askConfirmationBridge ) fun_showConfirmDialog(18, fun_confirmdialog_deleteBridge, 2); else sub_4771D0(a1, a2, a3, x, y); } } } void sub_4771D0(int a2, int a3, int a4, int a5, int a6) { __int16 v5; // [sp+50h] [bp-2Ch]@20 signed int v6; // [sp+54h] [bp-28h]@50 signed int v7; // [sp+54h] [bp-28h]@54 int v8; // [sp+58h] [bp-24h]@50 int v9; // [sp+58h] [bp-24h]@54 int v10; // [sp+5Ch] [bp-20h]@23 int v11; // [sp+60h] [bp-1Ch]@81 int v12; // [sp+68h] [bp-14h]@15 int v13; // [sp+6Ch] [bp-10h]@5 int v14; // [sp+70h] [bp-Ch]@5 int v15; // [sp+74h] [bp-8h]@2 int v16; // [sp+78h] [bp-4h]@2 multipleConstruction_itemsPlaced = 0; sub_490D00(); memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); if ( a3 > a5 ) { v16 = a5; v15 = a3; } else { v16 = a3; v15 = a5; } if ( a4 > a6 ) { v14 = a6; v13 = a4; } else { v14 = a4; v13 = a6; } if ( v16 < 0 ) v16 = 0; if ( v15 >= setting_map_width ) v15 = setting_map_width - 1; if ( v14 < 0 ) v14 = 0; if ( v13 >= setting_map_height ) v13 = setting_map_height - 1; v12 = v15 - v16 + 1; walkerBaseGridOffset = 162 * v14 + v16 + setting_map_startGridOffset; dword_909548 = v14; while ( dword_909548 <= v13 ) { dword_909544 = v16; while ( dword_909544 <= v15 ) { v5 = grid_terrain[walkerBaseGridOffset] & 0xD77F; if ( !(grid_terrain[walkerBaseGridOffset] & 0x202) ) { if ( v5 & 8 ) { v10 = grid_buildingIds[walkerBaseGridOffset]; if ( grid_buildingIds[walkerBaseGridOffset] ) { if ( buildings[v10].type != B_BurningRuin ) { if ( buildings[v10].type != B_NativeHut ) { if ( buildings[v10].type != B_NativeMeeting ) { if ( buildings[v10].type != B_NativeCrops ) { if ( buildings[v10].inUse != 6 ) { if ( buildings[v10].type != B_FortGround__ && buildings[v10].type != B_FortGround || a2 || deleteFort_confirmed == 1 ) { if ( buildings[v10].type == B_FortGround__ || buildings[v10].type == B_FortGround ) { if ( !a2 ) { if ( deleteFort_confirmed == 1 ) dword_8E1484 = 0; } } if ( buildings[v10].house_size ) { if ( buildings[v10].house_population ) { if ( !a2 ) { fun_spawnWalker_homeless( ciid, buildings[v10].x, buildings[v10].y, buildings[v10].house_population); buildings[v10].house_population = 0; } } } if ( buildings[v10].inUse != 6 ) { ++multipleConstruction_itemsPlaced; sub_490DE0(v10); } buildings[v10].inUse = 6; buildings[v10].byte_94BDBB = 1; v6 = 0; v8 = v10; while ( v6 < 9 ) { v8 = buildings[v8].warehouse_prevStorage; if ( v8 <= 0 ) break; sub_490DE0(v8); buildings[v8].inUse = 6; ++v6; } v7 = 0; v9 = v10; while ( v7 < 9 ) { v9 = buildings[v9].warehouse_nextStorage; if ( v9 <= 0 ) break; sub_490DE0(v9); buildings[v9].inUse = 6; ++v7; } } } } } } } } } else { if ( grid_terrain[walkerBaseGridOffset] & 0x100 ) { grid_terrain[walkerBaseGridOffset] &= 0x2E80u; grid_aqueducts[walkerBaseGridOffset] = 0; ++multipleConstruction_itemsPlaced; if ( byte_8DAD3E[walkerBaseGridOffset] == 5 ) byte_8DAD3E[walkerBaseGridOffset] = 1; if ( byte_8DADE1[walkerBaseGridOffset] == 6 ) byte_8DADE1[walkerBaseGridOffset] = 2; if ( byte_8DAE82[walkerBaseGridOffset] == 5 ) byte_8DAE82[walkerBaseGridOffset] = 3; if ( byte_8DADDF[walkerBaseGridOffset] == 6 ) byte_8DADDF[walkerBaseGridOffset] = 4; } else { if ( v5 & 4 ) { if ( a2 || sub_4879A0(walkerBaseGridOffset) < 1 ) { if ( deleteBridge_confirmed == 1 ) { sub_487650(walkerBaseGridOffset, a2); ++multipleConstruction_itemsPlaced; } } else { showWarning(55); // can't delete bridge with people } } else { if ( grid_terrain[walkerBaseGridOffset] & 0xD77F ) { grid_terrain[walkerBaseGridOffset] &= 0x2E80u; ++multipleConstruction_itemsPlaced; } } } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - v12; } if ( v12 <= v13 - v14 + 1 ) v11 = v13 - v14 + 3; else v11 = v15 - v16 + 3; sub_479720(v16, v14, v15, v13); sub_479F40(v16, v14, v15, v13); sub_47A140(v16, v14, v15, v13); sub_479240(); sub_47F200(v16, v14, v11); sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); sub_47E2B0(v16, v14, v11); if ( !a2 ) { fun_determineGroundType(); sub_4FFDF0(); sub_500420(); sub_5001A0(); window_redrawRequest = 1; } } void sub_4779D0(int a1, int a2, int a3, int a4, int a5) { __int16 v5; // ax@1 __int16 v6; // dx@7 int v7; // [sp+4Ch] [bp-4h]@1 int v8; // [sp+4Ch] [bp-4h]@7 memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); multipleConstruction_itemsPlaced = 0; v7 = 162 * a3 + a2 + setting_map_startGridOffset; v5 = grid_terrain[162 * a3 + a2 + setting_map_startGridOffset]; if ( !(v5 & 8) ) { if ( !(grid_terrain[v7] & 0x1237) ) { if ( !(grid_terrain[v7] & 0x4000) ) { v8 = 162 * a5 + a4 + setting_map_startGridOffset; v6 = grid_terrain[162 * a5 + a4 + setting_map_startGridOffset]; if ( !(v6 & 8) ) { if ( !(grid_terrain[v8] & 0x1237) ) { if ( !(grid_terrain[v8] & 0x4000) ) { if ( sub_503000(0, a2, a3, 0) ) { if ( sub_5041C0(0, a2, a3, a4, a5, 0) ) { if ( !a1 ) { fun_determineGroundType(); sub_4FFDF0(); window_redrawRequest = 1; } } } } } } } } } } void fun_buildConstructWall(int a1, int a2, int a3, int a4, int a5) { __int16 v5; // ax@1 __int16 v6; // cx@5 __int16 v7; // ax@11 __int16 v8; // cx@15 int v9; // [sp+4Ch] [bp-4h]@1 int v10; // [sp+4Ch] [bp-4h]@11 memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); multipleConstruction_itemsPlaced = 0; v9 = 162 * a3 + a2 + setting_map_startGridOffset; v5 = grid_terrain[162 * a3 + a2 + setting_map_startGridOffset]; if ( !(v5 & 8) ) { if ( !(grid_terrain[v9] & 0x1237) ) { v6 = grid_terrain[v9]; if ( !(v6 & 0x40) ) { if ( !(grid_terrain[v9] & 0x100) ) { if ( !(grid_terrain[v9] & 0x400) ) { v10 = 162 * a5 + a4 + setting_map_startGridOffset; v7 = grid_terrain[162 * a5 + a4 + setting_map_startGridOffset]; if ( !(v7 & 8) ) { if ( !(grid_terrain[v10] & 0x1237) ) { v8 = grid_terrain[v10]; if ( !(v8 & 0x40) ) { if ( !(grid_terrain[v10] & 0x100) ) { if ( !(grid_terrain[v10] & 0x400) ) { if ( sub_503EA0(0, a2, a3) ) { if ( sub_5041C0(0, a2, a3, a4, a5, 1) ) { if ( !a1 ) { fun_determineGroundType(); sub_4FFDF0(); sub_500420(); window_redrawRequest = 1; } } } } } } } } } } } } } } int sub_477DD0(int a1, int a2, int a3, int a4, int a5) { int v5; // ST6C_4@2 int v6; // ST68_4@4 __int16 v7; // dx@18 __int16 v8; // ax@22 __int16 v9; // dx@24 int v11; // [sp+4Ch] [bp-10h]@13 int v12; // [sp+50h] [bp-Ch]@13 int v13; // [sp+54h] [bp-8h]@13 int v14; // [sp+58h] [bp-4h]@15 if ( a2 > a4 ) { v5 = a2; a2 = a4; a4 = v5; } if ( a3 > a5 ) { v6 = a3; a3 = a5; a5 = v6; } memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); memcpy(undo_grid_bitfields, grid_bitfields, 26244); memcpy(undo_grid_edge, grid_edge, 26244); sub_4914E0(); if ( a2 < 0 ) a2 = 0; if ( a3 < 0 ) a3 = 0; if ( a4 >= setting_map_width ) a4 = setting_map_width - 1; if ( a5 >= setting_map_height ) a5 = setting_map_height - 1; v12 = setting_map_width - (a4 - a2 + 1); v11 = 162 * a3 + a2 + setting_map_startGridOffset; multipleConstruction_itemsPlaced = 0; v13 = a3; while ( v13 <= a5 ) { v14 = a2; while ( v14 <= a4 ) { v7 = grid_terrain[v11]; if ( v7 & 0x40 ) { if ( !(grid_terrain[v11] & 0x100) ) { v8 = grid_terrain[v11]; if ( !(v8 & 4) ) { v9 = grid_terrain[v11]; if ( !(v9 & 8) ) { if ( !(grid_bitfields[v11] & 0x80) ) ++multipleConstruction_itemsPlaced; grid_graphicIds[v11] = 0; grid_bitfields[v11] |= 0x80u; grid_bitfields[v11] &= 0xF0u; grid_edge[v11] |= 0x40u; } } } } ++v14; ++v11; } ++v13; v11 += setting_map_gridBorderSize + v12; } return sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); } bool sub_4780E0(int a1) { __int16 v1; // cx@1 __int16 v2; // cx@5 __int16 v3; // cx@7 __int16 v4; // cx@11 __int16 v5; // cx@15 __int16 v6; // cx@17 __int16 v7; // cx@21 __int16 v8; // cx@25 __int16 v9; // cx@27 signed int v11; // [sp+4Ch] [bp-4h]@1 v11 = 0; v1 = grid_terrain_xPlusOne_y[a1]; if ( v1 & 0x40 ) v11 = 1; if ( !(byte_8E14A1[a1] & 0x80) ) --v11; v2 = grid_terrain_xPlusOne_y[a1]; if ( v2 & 4 ) --v11; v3 = grid_terrain_xPlusOne_y[a1]; if ( v3 & 8 ) --v11; if ( word_8B4622[a1] ) --v11; v4 = grid_terrain_x_yPlusOne[a1]; if ( v4 & 0x40 ) ++v11; if ( !(byte_8E1542[a1] & 0x80) ) --v11; v5 = grid_terrain_x_yPlusOne[a1]; if ( v5 & 4 ) --v11; v6 = grid_terrain_x_yPlusOne[a1]; if ( v6 & 8 ) --v11; if ( word_8B4764[a1] ) --v11; v7 = grid_terrain_xPlusOne_yPlusOne[a1]; if ( v7 & 0x40 ) ++v11; if ( !(byte_8E1543[a1] & 0x80) ) --v11; v8 = grid_terrain_xPlusOne_yPlusOne[a1]; if ( v8 & 4 ) --v11; v9 = grid_terrain_xPlusOne_yPlusOne[a1]; if ( v9 & 8 ) --v11; if ( word_8B4766[a1] ) --v11; return v11 == 3; } int sub_478310(int a1, int a2, int a3, int a4, int a5) { int v5; // ST7C_4@2 int v6; // ST78_4@4 __int16 v7; // dx@18 __int16 v8; // ax@22 __int16 v9; // ax@32 int result; // eax@39 __int16 v11; // ax@43 int v12; // [sp+4Ch] [bp-18h]@49 int v13; // [sp+50h] [bp-14h]@51 int v14; // [sp+54h] [bp-10h]@13 int v15; // [sp+54h] [bp-10h]@27 int v16; // [sp+54h] [bp-10h]@38 int v17; // [sp+58h] [bp-Ch]@38 int v18; // [sp+5Ch] [bp-8h]@13 int v19; // [sp+5Ch] [bp-8h]@27 int v20; // [sp+5Ch] [bp-8h]@38 int v21; // [sp+60h] [bp-4h]@15 int v22; // [sp+60h] [bp-4h]@29 int v23; // [sp+60h] [bp-4h]@40 if ( a1 > a3 ) { v5 = a1; a1 = a3; a3 = v5; } if ( a2 > a4 ) { v6 = a2; a2 = a4; a4 = v6; } if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v14 = setting_map_startGridOffset; v18 = 0; while ( v18 < setting_map_height ) { v21 = 0; while ( v21 < setting_map_width ) { v7 = grid_terrain[v14]; if ( v7 & 0x40 ) { if ( grid_bitfields[v14] & 0x80 ) { v8 = grid_terrain[v14]; if ( v8 & 8 ) grid_bitfields[v14] &= 0x7Fu; } } ++v21; ++v14; } ++v18; v14 += setting_map_gridBorderSize; } if ( a5 ) { v15 = setting_map_startGridOffset; v19 = 0; while ( v19 < setting_map_height ) { v22 = 0; while ( v22 < setting_map_width ) { v9 = grid_terrain[v15]; if ( v9 & 0x40 ) { if ( grid_bitfields[v15] & 0x80 ) { grid_graphicIds[v15] = 0; grid_bitfields[v15] &= 0xF0u; grid_edge[v15] |= 0x40u; } } ++v22; ++v15; } ++v19; v15 += setting_map_gridBorderSize; } } v17 = setting_map_width - (a3 - a1 + 1); v16 = 162 * a2 + a1 + setting_map_startGridOffset; v20 = a2; while ( 1 ) { result = v20; if ( v20 > a4 ) break; v23 = a1; while ( v23 <= a3 ) { v11 = grid_terrain[v16]; if ( v11 & 0x40 ) { if ( !grid_graphicIds[v16] ) { if ( grid_bitfields[v16] & 0x80 ) { v12 = grid_random[v16] & 1; if ( sub_4780E0(v16) ) { if ( v12 ) v13 = word_6E6C24 + 7; else v13 = word_6E6C24 + 6; fun_putBuildingOnTerrainAndGraphicGrids(0, v23, v20, 2, 2, v13, 64); } else { if ( v23 & 1 && v20 & 1 ) { grid_graphicIds[v16] = word_6E6C24 + 1; } else { if ( v23 & 1 || v20 & 1 ) grid_graphicIds[v16] = word_6E6C24 + 2; else grid_graphicIds[v16] = word_6E6C24; } } } } } ++v23; ++v16; } ++v20; v16 += setting_map_gridBorderSize + v17; } return result; } void sub_4787A0(int a1, int a2, int a3, int a4, int a5) { int v5; // ST68_4@2 int v6; // ST64_4@4 __int16 v7; // ax@20 int v8; // [sp+50h] [bp-10h]@13 int v9; // [sp+54h] [bp-Ch]@13 int v10; // [sp+58h] [bp-8h]@13 int v11; // [sp+5Ch] [bp-4h]@15 if ( a2 > a4 ) { v5 = a2; a2 = a4; a4 = v5; } if ( a3 > a5 ) { v6 = a3; a3 = a5; a5 = v6; } memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); memcpy(undo_grid_bitfields, grid_bitfields, 26244); memcpy(undo_grid_edge, grid_edge, 26244); sub_4914E0(); if ( a2 < 0 ) a2 = 0; if ( a3 < 0 ) a3 = 0; if ( a4 >= setting_map_width ) a4 = setting_map_width - 1; if ( a5 >= setting_map_height ) a5 = setting_map_height - 1; v9 = setting_map_width - (a4 - a2 + 1); v8 = 162 * a3 + a2 + setting_map_startGridOffset; multipleConstruction_itemsPlaced = 0; v10 = a3; while ( v10 <= a5 ) { v11 = a2; while ( v11 <= a4 ) { if ( !(grid_terrain[v8] & 0xD77F) ) { ++multipleConstruction_itemsPlaced; v7 = grid_terrain[v8]; _LOBYTE(v7) = v7 | 0x20; grid_terrain[v8] = v7; } ++v11; ++v8; } ++v10; v8 += setting_map_gridBorderSize + v9; } sub_479240(); } int sub_4789E0(int a1) { int v2; // [sp+4Ch] [bp-8h]@1 signed int v3; // [sp+50h] [bp-4h]@1 v3 = 0; v2 = a1; while ( v3 < 9 ) { if ( buildings[v2].warehouse_prevStorage <= 0 ) return v2; v2 = buildings[v2].warehouse_prevStorage; ++v3; } return 0; } void fun_initGraphicIdGrid() { int v0; // [sp+4Ch] [bp-Ch]@1 v0 = setting_map_startGridOffset; dword_909548 = 0; while ( dword_909548 < setting_map_height ) { dword_909544 = 0; while ( dword_909544 < setting_map_width ) { grid_graphicIds[v0] = (grid_random[v0] & 7) + graphic_terrain_uglygrass; if ( grid_random[v0] & 1 ) grid_bitfields[v0] |= 0x20u; ++dword_909544; ++v0; } ++dword_909548; v0 += setting_map_gridBorderSize; } } int sub_478B80(int a1, int a2, int a3, int a4) { int result; // eax@10 __int16 v5; // ax@14 int v6; // [sp+4Ch] [bp-10h]@9 int v7; // [sp+50h] [bp-Ch]@9 int v8; // [sp+54h] [bp-8h]@9 int v9; // [sp+58h] [bp-4h]@11 if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v7 = setting_map_width - (a3 - a1 + 1); v6 = 162 * a2 + a1 + setting_map_startGridOffset; v8 = a2; while ( 1 ) { result = v8; if ( v8 > a4 ) break; v9 = a1; while ( v9 <= a3 ) { v5 = grid_terrain[v6]; if ( v5 & 1 ) { if ( !(grid_terrain[v6] & 0x600) ) sub_47CDB0(v9, v8, 1); } ++v9; ++v6; } ++v8; v6 += setting_map_gridBorderSize + v7; } return result; } void sub_478CE0(int xStart, int yStart, int xEnd, int yEnd) { __int16 terrain; // ax@14 __int16 terrain2; // dx@16 int gridOffset; // [sp+4Ch] [bp-10h]@9 int xSkip; // [sp+50h] [bp-Ch]@9 int y; // [sp+54h] [bp-8h]@9 int x; // [sp+58h] [bp-4h]@11 if ( xStart < 0 ) xStart = 0; if ( yStart < 0 ) yStart = 0; if ( xEnd >= setting_map_width ) xEnd = setting_map_width - 1; if ( yEnd >= setting_map_height ) yEnd = setting_map_height - 1; xSkip = setting_map_width - (xEnd - xStart + 1); gridOffset = 162 * yStart + xStart + setting_map_startGridOffset; y = yStart; while ( y <= yEnd ) { x = xStart; while ( x <= xEnd ) { terrain = grid_terrain[gridOffset]; if ( terrain & T_Water ) { terrain2 = grid_terrain[gridOffset]; if ( !(terrain2 & T_Building) ) sub_47DA90(x, y, 1); } ++x; ++gridOffset; } ++y; gridOffset += setting_map_gridBorderSize + xSkip; } } int sub_478E40() { int result; // eax@2 __int16 v1; // dx@6 __int16 v2; // cx@19 int v3; // [sp+4Ch] [bp-10h]@29 int v4; // [sp+4Ch] [bp-10h]@34 int v5; // [sp+50h] [bp-Ch]@1 int v6; // [sp+50h] [bp-Ch]@14 int v7; // [sp+54h] [bp-8h]@1 int v8; // [sp+54h] [bp-8h]@14 int v9; // [sp+58h] [bp-4h]@3 int v10; // [sp+58h] [bp-4h]@16 v5 = setting_map_startGridOffset; v7 = 0; while ( 1 ) { result = v7; if ( v7 >= setting_map_height ) break; v9 = 0; while ( v9 < setting_map_width ) { v1 = grid_terrain[v5]; if ( v1 & 2 ) { if ( !(grid_bitfields[v5] & 0x80) ) { if ( !(grid_terrain[v5] & 0x600) ) { grid_graphicIds[v5] = 0; grid_bitfields[v5] &= 0xF0u; grid_edge[v5] |= 0x40u; } } } ++v9; ++v5; } ++v7; v5 += setting_map_gridBorderSize; } v6 = setting_map_startGridOffset; v8 = 0; while ( v8 < setting_map_height ) { v10 = 0; while ( v10 < setting_map_width ) { v2 = grid_terrain[v6]; if ( v2 & 2 ) { if ( !(grid_bitfields[v6] & 0x80) ) { if ( !(grid_terrain[v6] & 0x600) ) { if ( !grid_graphicIds[v6] ) { if ( sub_4818F0(v10, v8, 3, 3, 2, 1) ) { if ( sub_48D300(v10, v8, 3, 4, 512) ) v3 = graphic_terrain_rock + (grid_random[v6] & 1) + 12; else v3 = word_6E6D8E + (grid_random[v6] & 1) + 12; fun_putBuildingOnTerrainAndGraphicGrids(0, v10, v8, 3, 3, v3, 2); } else { if ( sub_4818F0(v10, v8, 2, 2, 2, 1) ) { if ( sub_48D300(v10, v8, 2, 4, 512) ) v4 = graphic_terrain_rock + (grid_random[v6] & 3) + 8; else v4 = word_6E6D8E + (grid_random[v6] & 3) + 8; fun_putBuildingOnTerrainAndGraphicGrids(0, v10, v8, 2, 2, v4, 2); } else { if ( sub_48D300(v10, v8, 1, 4, 512) ) grid_graphicIds[v6] = (grid_random[v6] & 7) + graphic_terrain_rock; else grid_graphicIds[v6] = (grid_random[v6] & 7) + word_6E6D8E; } } } } } } ++v10; ++v6; } result = v8++ + 1; v6 += setting_map_gridBorderSize; } return result; } void sub_479240() { __int16 v0; // dx@6 __int16 v1; // dx@17 int v2; // [sp+4Ch] [bp-14h]@24 int v3; // [sp+50h] [bp-10h]@25 int v4; // [sp+54h] [bp-Ch]@1 int v5; // [sp+54h] [bp-Ch]@12 int v6; // [sp+58h] [bp-8h]@1 int v7; // [sp+58h] [bp-8h]@12 int v8; // [sp+5Ch] [bp-4h]@3 int v9; // [sp+5Ch] [bp-4h]@14 v4 = setting_map_startGridOffset; v6 = 0; while ( v6 < setting_map_height ) { v8 = 0; while ( v8 < setting_map_width ) { v0 = grid_terrain[v4]; if ( v0 & 0x20 ) { if ( !(grid_terrain[v4] & 0x600) ) { grid_graphicIds[v4] = 0; grid_bitfields[v4] &= 0xF0u; grid_edge[v4] |= 0x40u; } } ++v8; ++v4; } ++v6; v4 += setting_map_gridBorderSize; } v5 = setting_map_startGridOffset; v7 = 0; while ( v7 < setting_map_height ) { v9 = 0; while ( v9 < setting_map_width ) { v1 = grid_terrain[v5]; if ( v1 & 0x20 ) { if ( !(grid_terrain[v5] & 0x600) ) { if ( !grid_graphicIds[v5] ) { if ( sub_4818F0(v9, v7, 2, 2, 32, 1) ) { v2 = grid_random[v5] & 3; if ( v2 > 1 ) { if ( v2 > 2 ) v3 = word_6E6C26 + 4; else v3 = word_6E6C26 + 5; } else { v3 = word_6E6C26 + 6; } fun_putBuildingOnTerrainAndGraphicGrids(0, v9, v7, 2, 2, v3, 32); } else { if ( v7 & 1 ) { if ( v9 & 3 ) { if ( (v9 & 3) == 1 ) { grid_graphicIds[v5] = word_6E6C26 + 3; } else { if ( (v9 & 3) == 2 ) grid_graphicIds[v5] = word_6E6C26 + 2; else grid_graphicIds[v5] = word_6E6C26 + 3; } } else { grid_graphicIds[v5] = word_6E6C26 + 2; } } else { if ( v9 & 3 ) { if ( (v9 & 3) == 1 ) { grid_graphicIds[v5] = word_6E6C26 + 1; } else { if ( (v9 & 3) == 2 ) grid_graphicIds[v5] = word_6E6C26; else grid_graphicIds[v5] = word_6E6C26 + 1; } } else { grid_graphicIds[v5] = word_6E6C26; } } } } } } ++v9; ++v5; } ++v7; v5 += setting_map_gridBorderSize; } } int sub_479600() { int result; // eax@1 __int16 v1; // dx@10 signed int v2; // [sp+4Ch] [bp-10h]@1 int v3; // [sp+50h] [bp-Ch]@1 int v4; // [sp+54h] [bp-8h]@1 int v5; // [sp+58h] [bp-4h]@3 result = word_6E6C26; v2 = word_6E6C26; v3 = setting_map_startGridOffset; v4 = 0; while ( v4 < setting_map_height ) { v5 = 0; while ( v5 < setting_map_width ) { if ( grid_graphicIds[v3] >= v2 ) { if ( grid_graphicIds[v3] <= v2 + 6 ) { v1 = grid_terrain[v3]; _LOBYTE(v1) = v1 | 0x20; grid_terrain[v3] = v1; grid_bitfields[v3] &= 0x7Fu; grid_aqueducts[v3] = 0; } } ++v5; ++v3; } ++v4; result = setting_map_gridBorderSize + v3; v3 += setting_map_gridBorderSize; } return result; } void sub_479720(int x, int y, int width, int height) { signed int v4; // [sp+4Ch] [bp-18h]@44 int gridOffset; // [sp+54h] [bp-10h]@9 int gridOffset_; // [sp+54h] [bp-10h]@18 int v7; // [sp+54h] [bp-10h]@34 int v8; // [sp+58h] [bp-Ch]@9 int iy; // [sp+5Ch] [bp-8h]@9 int jy; // [sp+5Ch] [bp-8h]@18 int v11; // [sp+5Ch] [bp-8h]@34 int ix; // [sp+60h] [bp-4h]@11 int jx; // [sp+60h] [bp-4h]@20 int v14; // [sp+60h] [bp-4h]@36 if ( x < 0 ) x = 0; if ( y < 0 ) y = 0; if ( width >= setting_map_width ) width = setting_map_width - 1; if ( height >= setting_map_height ) height = setting_map_height - 1; v8 = setting_map_width - (width - x + 1); gridOffset = 162 * y + x + setting_map_startGridOffset; iy = y; while ( iy <= height ) { ix = x; while ( ix <= width ) { if ( !(grid_terrain[gridOffset] & 0xD77F) ) { grid_graphicIds[gridOffset] = 0; grid_bitfields[gridOffset] &= 0xF0u; grid_edge[gridOffset] |= 0x40u; } ++ix; ++gridOffset; } ++iy; gridOffset += setting_map_gridBorderSize + v8; } gridOffset_ = 162 * y + x + setting_map_startGridOffset; jy = y; while ( jy <= height ) { jx = x; while ( jx <= width ) { if ( !(grid_terrain[gridOffset_] & 0xD77F) ) { if ( !grid_graphicIds[gridOffset_] ) { if ( !(grid_random[gridOffset_] & 0xF0) ) { if ( grid_bitfields[gridOffset_] & 0x20 ) sub_480260(0, jx, jy, 1, 1, (grid_random[gridOffset_] & 7) + graphic_terrain_grass2, 0); else sub_480260(0, jx, jy, 1, 1, (grid_random[gridOffset_] & 7) + graphic_terrain_grass1, 0); } } } ++jx; ++gridOffset_; } ++jy; gridOffset_ += setting_map_gridBorderSize + v8; } v7 = 162 * y + x + setting_map_startGridOffset; v11 = y; while ( v11 <= height ) { v14 = x; while ( v14 <= width ) { if ( !(grid_terrain[v7] & 0xD77F) ) { if ( !grid_graphicIds[v7] ) { if ( grid_bitfields[v7] & 0x20 ) v4 = 7; else v4 = 10; if ( fun_terrainIsClear(v14, v11, 4, 4, 0xFFFFu, 1) ) { sub_480260(0, v14, v11, 4, 4, graphic_id_start[v4] + 42, 0); } else { if ( fun_terrainIsClear(v14, v11, 3, 3, 0xFFFFu, 1) ) { sub_480260(0, v14, v11, 3, 3, graphic_id_start[v4] + 9 * (grid_random[v7] & 1) + 24, 0); } else { if ( fun_terrainIsClear(v14, v11, 2, 2, 0xFFFFu, 1) ) sub_480260(0, v14, v11, 2, 2, graphic_id_start[v4] + 4 * (grid_random[v7] & 3) + 8, 0); else sub_480260(0, v14, v11, 1, 1, (grid_random[v7] & 7) + graphic_id_start[v4], 0); } } } } ++v14; ++v7; } ++v11; v7 += setting_map_gridBorderSize + v8; } } void sub_479C80(int a1, int a2, int a3, int a4) { __int16 v4; // ax@14 int v5; // [sp+4Ch] [bp-10h]@9 int v6; // [sp+50h] [bp-Ch]@9 int v7; // [sp+54h] [bp-8h]@9 int v8; // [sp+58h] [bp-4h]@11 if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v6 = setting_map_width - (a3 - a1 + 1); v5 = 162 * a2 + a1 + setting_map_startGridOffset; v7 = a2; while ( v7 <= a4 ) { v8 = a1; while ( v8 <= a3 ) { v4 = grid_terrain[v5]; if ( v4 & T_Rock ) { if ( grid_bitfields[v5] & 0x80u ) sub_47D180(v8, v7, 1); } ++v8; ++v5; } ++v7; v5 += setting_map_gridBorderSize + v6; } } void sub_479DE0(int a1, int a2, int a3, int a4) { __int16 v4; // ax@14 int v5; // [sp+4Ch] [bp-10h]@9 int v6; // [sp+50h] [bp-Ch]@9 int v7; // [sp+54h] [bp-8h]@9 int v8; // [sp+58h] [bp-4h]@11 if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v6 = setting_map_width - (a3 - a1 + 1); v5 = 162 * a2 + a1 + setting_map_startGridOffset; v7 = a2; while ( v7 <= a4 ) { v8 = a1; while ( v8 <= a3 ) { v4 = grid_terrain[v5]; if ( v4 & 0x10 ) { if ( !(grid_terrain[v5] & 0x600) ) // elevation|access ramp sub_47D4B0(v8, v7, 1); } ++v8; ++v5; } ++v7; v5 += setting_map_gridBorderSize + v6; } } int sub_479F40(int a1, int a2, int a3, int a4) { int result; // eax@10 __int16 v5; // ax@20 __int16 v6; // cx@24 __int16 v7; // ax@26 int v8; // [sp+4Ch] [bp-10h]@9 int v9; // [sp+50h] [bp-Ch]@9 int v10; // [sp+54h] [bp-8h]@9 int v11; // [sp+58h] [bp-4h]@11 if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v9 = setting_map_width - (a3 - a1 + 1); v8 = 162 * a2 + a1 + setting_map_startGridOffset; v10 = a2; while ( 1 ) { result = v10; if ( v10 > a4 ) break; v11 = a1; while ( v11 <= a3 ) { if ( grid_terrain[v8] & 0x800 ) { if ( !(grid_terrain[v8] & 0x600) ) { if ( !(grid_terrain[v8] & 0x100) ) { v5 = grid_terrain[v8]; if ( !(v5 & 0x40) ) { if ( !(grid_terrain[v8] & 0x1000) ) { v6 = grid_terrain[v8]; if ( !(v6 & 8) ) { v7 = grid_terrain[v8]; if ( !(v7 & 0x20) ) sub_47D5B0(v11, v10, 1); } } } } } } ++v11; ++v8; } ++v10; v8 += setting_map_gridBorderSize + v9; } return result; } int sub_47A140(int a1, int a2, int a3, int a4) { int result; // eax@10 __int16 v5; // ax@20 __int16 v6; // dx@22 __int16 v7; // cx@24 int v8; // [sp+4Ch] [bp-10h]@9 int v9; // [sp+50h] [bp-Ch]@9 int v10; // [sp+54h] [bp-8h]@9 int v11; // [sp+58h] [bp-4h]@11 if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v9 = setting_map_width - (a3 - a1 + 1); v8 = 162 * a2 + a1 + setting_map_startGridOffset; v10 = a2; while ( 1 ) { result = v10; if ( v10 > a4 ) break; v11 = a1; while ( v11 <= a3 ) { if ( grid_terrain[v8] & 0x1000 ) { if ( !(grid_terrain[v8] & 0x600) ) { if ( !(grid_terrain[v8] & 0x100) ) { v5 = grid_terrain[v8]; if ( !(v5 & 0x40) ) { v6 = grid_terrain[v8]; if ( !(v6 & 8) ) { v7 = grid_terrain[v8]; if ( !(v7 & 0x20) ) sub_47D9D0(v11, v10); } } } } } ++v11; ++v8; } ++v10; v8 += setting_map_gridBorderSize + v9; } return result; } int sub_47A320(int a1, int a2) { int result; // eax@1 __int16 v3; // dx@3 __int16 v4; // dx@3 __int16 v5; // dx@3 __int16 v6; // dx@3 __int16 v7; // dx@3 __int16 v8; // dx@3 __int16 v9; // dx@3 __int16 v10; // dx@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; result = grid_terrain[walkerBaseGridOffset]; if ( grid_terrain[walkerBaseGridOffset] ) { v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 & 0xF7; grid_terrain[walkerBaseGridOffset] = v3; v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xFE; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xFB; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xDF; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xFD; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xEF; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xBF; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v10) &= 0xF7u; result = walkerBaseGridOffset; grid_terrain[walkerBaseGridOffset] = v10; dword_8E1470 = 1; } else { dword_8EFAE4 = 1; } return result; } void sub_47A4C0(int a1, int a2) { __int16 v2; // ax@1 __int16 v3; // dx@3 __int16 v4; // dx@3 __int16 v5; // dx@3 __int16 v6; // dx@3 __int16 v7; // dx@3 __int16 v8; // dx@3 __int16 v9; // dx@3 __int16 v10; // dx@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v2 = grid_terrain[walkerBaseGridOffset]; if ( v2 & 1 ) { dword_8EFAE4 = 1; } else { v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 | 1; grid_terrain[walkerBaseGridOffset] = v3; v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xF7; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xFB; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xDF; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xFD; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xEF; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xBF; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v10) &= 0xF7u; grid_terrain[walkerBaseGridOffset] = v10; dword_8E1470 = 1; } } int sub_47A660(int a1, int a2) { int result; // eax@1 __int16 v3; // ax@1 __int16 v4; // dx@3 __int16 v5; // dx@3 __int16 v6; // dx@3 __int16 v7; // dx@3 __int16 v8; // dx@3 __int16 v9; // dx@3 __int16 v10; // dx@3 __int16 v11; // dx@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[walkerBaseGridOffset]; result = v3 & 2; if ( result ) { dword_8EFAE4 = 1; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 | 2; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xF7; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xFE; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xFB; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xDF; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xEF; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v10) = v10 & 0xBF; grid_terrain[walkerBaseGridOffset] = v10; v11 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v11) &= 0xF7u; result = walkerBaseGridOffset; grid_terrain[walkerBaseGridOffset] = v11; dword_8E1470 = 1; } return result; } int sub_47A800(int a1, int a2) { int result; // eax@1 __int16 v3; // ax@1 __int16 v4; // dx@3 __int16 v5; // dx@3 __int16 v6; // dx@3 __int16 v7; // dx@3 __int16 v8; // dx@3 __int16 v9; // dx@3 __int16 v10; // dx@3 __int16 v11; // dx@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[walkerBaseGridOffset]; result = v3 & 0x10; if ( result ) { dword_8EFAE4 = 1; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 | 0x10; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xF7; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xFE; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xFB; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xDF; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xFD; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v10) = v10 & 0xBF; grid_terrain[walkerBaseGridOffset] = v10; v11 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v11) &= 0xF7u; result = walkerBaseGridOffset; grid_terrain[walkerBaseGridOffset] = v11; dword_8E1470 = 1; } return result; } int sub_47A9A0(int a1, int a2) { int result; // eax@1 __int16 v3; // ax@1 __int16 v4; // dx@3 __int16 v5; // dx@3 __int16 v6; // dx@3 __int16 v7; // dx@3 __int16 v8; // dx@3 __int16 v9; // dx@3 __int16 v10; // dx@3 __int16 v11; // dx@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[walkerBaseGridOffset]; result = v3 & 0x10; if ( result ) { dword_8EFAE4 = 1; } else { v4 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v4) |= 8u; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xF7; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xFE; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xFB; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xDF; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xFD; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v10) = v10 & 0xBF; grid_terrain[walkerBaseGridOffset] = v10; v11 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v11) = v11 & 0xEF; result = walkerBaseGridOffset; grid_terrain[walkerBaseGridOffset] = v11; dword_8E1470 = 1; } return result; } int sub_47AB40(int a1, int a2) { int result; // eax@1 __int16 v3; // dx@3 __int16 v4; // cx@5 __int16 v5; // cx@5 __int16 v6; // cx@5 __int16 v7; // cx@5 __int16 v8; // cx@5 __int16 v9; // cx@5 __int16 v10; // cx@5 __int16 v11; // cx@5 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; result = grid_elevation[walkerBaseGridOffset]; if ( !grid_elevation[walkerBaseGridOffset] ) { v3 = grid_terrain[walkerBaseGridOffset]; if ( v3 & 4 ) { dword_8EFAE4 = 1; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 | 4; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xF7; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xFE; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xDF; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xFD; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xEF; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v10) = v10 & 0xBF; grid_terrain[walkerBaseGridOffset] = v10; result = walkerBaseGridOffset; v11 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v11) &= 0xF7u; grid_terrain[walkerBaseGridOffset] = v11; dword_8E1470 = 1; } } return result; } int unused_47AD00(int a1, int a2) { int result; // eax@1 __int16 v3; // ax@1 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[walkerBaseGridOffset]; result = v3 & 2; if ( result ) dword_8EFAE4 = 1; return result; } int sub_47AD60(int a1, int a2) { int result; // eax@1 __int16 v3; // ax@1 __int16 v4; // dx@3 __int16 v5; // dx@3 __int16 v6; // dx@3 __int16 v7; // dx@3 __int16 v8; // dx@3 __int16 v9; // dx@3 __int16 v10; // dx@3 __int16 v11; // dx@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[walkerBaseGridOffset]; result = v3 & 0x40; if ( result ) { dword_8EFAE4 = 1; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 | 0x40; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xF7; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xFE; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v7) = v7 & 0xFB; grid_terrain[walkerBaseGridOffset] = v7; v8 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xDF; grid_terrain[walkerBaseGridOffset] = v8; v9 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v9) = v9 & 0xFD; grid_terrain[walkerBaseGridOffset] = v9; v10 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v10) = v10 & 0xEF; grid_terrain[walkerBaseGridOffset] = v10; v11 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v11) &= 0xF7u; result = walkerBaseGridOffset; grid_terrain[walkerBaseGridOffset] = v11; dword_8E1470 = 1; } return result; } void fun_placeEditorBuilding(int x, int y) { int v2; // ecx@96 int v3; // [sp+4Ch] [bp-20h]@96 __int16 v4; // [sp+54h] [bp-18h]@1 signed int v5; // [sp+58h] [bp-14h]@120 signed int v6; // [sp+5Ch] [bp-10h]@69 int v7; // [sp+60h] [bp-Ch]@88 int v8; // [sp+64h] [bp-8h]@88 signed int i; // [sp+68h] [bp-4h]@85 walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; v4 = grid_terrain[walkerBaseGridOffset] & 0xD73F; switch ( toPlace_buildingType ) { case 119: if ( !(grid_terrain[walkerBaseGridOffset] & 0xD73F) ) { map_earthquake_x = x; map_earthquake_y = y; } break; case 127: if ( !(grid_terrain[walkerBaseGridOffset] & 0xD73F) ) { if ( !x || x == setting_map_width - 1 || !y || y == setting_map_height - 1 ) { map_entry_x[0] = x; map_entry_y = y; } } break; case 128: if ( !(grid_terrain[walkerBaseGridOffset] & 0xD73F) ) { if ( !x || x == setting_map_width - 1 || !y || y == setting_map_height - 1 ) { map_exit_x = x; map_exit_y[0] = y; } } break; case 126: if ( !(grid_terrain[walkerBaseGridOffset] & 0xD73F) ) { if ( !x || x == setting_map_width - 1 || !y || y == setting_map_height - 1 ) { map_exit_y[toPlace_invasionPointId] = x; map_invasionPoints_x[toPlace_invasionPointId + 7] = y; } } break; case 132: if ( v4 & 4 ) { *((_WORD *)&map_event_clayPitFlooded + dword_9DA810 + 1) = x; map_fish_x[dword_9DA810 + 7] = y; } break; case 133: if ( !(grid_terrain[walkerBaseGridOffset] & 0xD73F) ) { map_playerRank[dword_9DA910] = x; map_herd_x[dword_9DA910 + 3] = y; } break; case 130: if ( !x || x == setting_map_width - 1 || !y || y == setting_map_height - 1 ) { if ( sub_4864B0(walkerBaseGridOffset) ) { map_riverEntry_x = x; map_riverEntry_y = y; fun_createFishHerdFlotsamWalkers(map_riverEntry_x, map_riverEntry_y, 1); } } break; case 131: if ( !x || x == setting_map_width - 1 || !y || y == setting_map_height - 1 ) { if ( sub_4864B0(walkerBaseGridOffset) ) { map_riverExit_x = x; map_riverExit_y = y; } } break; default: if ( dword_9DA87C ) { switch ( dword_9DA87C ) { case 1: v6 = 5; break; case 2: v6 = 13; break; case 3: v6 = 25; break; default: v6 = 41; break; } } else { v6 = 1; } if ( dword_9DA804 == 10 ) { v6 = 1; } else { switch ( toPlace_buildingType ) { case 123: v6 = 9; break; case 124: v6 = 9; break; case 129: v6 = 1; break; } } for ( i = 0; i < v6; ++i ) { v8 = dword_5F3100[2 * i] + x; v7 = dword_5F3104[2 * i] + y; if ( v8 >= 0 ) { if ( v8 < setting_map_width ) { if ( v7 >= 0 ) { if ( v7 < setting_map_height ) { v2 = 162 * v7 + v8 + setting_map_startGridOffset; v3 = grid_buildingIds[v2]; if ( grid_buildingIds[v2] ) { sub_480FC0(v3, v8, v7); fun_deleteBuilding(v3); } switch ( toPlace_buildingType ) { case 116: sub_47A320(v8, v7); break; case 117: sub_47A4C0(v8, v7); break; case 118: sub_47AB40(v8, v7); break; case 120: sub_47A800(v8, v7); break; case 121: sub_47A660(v8, v7); break; case 122: sub_47A9A0(v8, v7); break; case 125: sub_47AD60(v8, v7); break; case 123: sub_47BD60(v8, v7); break; case 124: sub_47BEF0(v8, v7); break; case 129: sub_47C0A0(v8, v7); break; } } } } } } if ( dword_9DA87C ) { switch ( dword_9DA87C ) { case 1: v5 = 2; break; case 2: v5 = 3; break; case 3: v5 = 4; break; default: v5 = 5; break; } } else { v5 = 1; } if ( dword_9DA804 == 10 ) v5 = 1; switch ( toPlace_buildingType ) { case 116: sub_47B8D0(x - v5, y - v5, v5 + x, v5 + y); break; case 117: sub_47B970(x - v5, y - v5, v5 + x, v5 + y); break; case 118: sub_47BA10(x - v5, y - v5, v5 + x, v5 + y); break; case 120: sub_47BB10(x - v5, y - v5, v5 + x, v5 + y); break; case 121: sub_47BBB0(x - v5, y - v5, v5 + x, v5 + y); break; case 122: sub_47BC30(x - v5, y - v5, v5 + x, v5 + y); break; case 125: sub_47BCD0(x - v5, y - v5, v5 + x, v5 + y); break; case 123: sub_47C2A0(x - v5, y - v5, v5 + x, v5 + y); break; case 124: sub_47C2A0(x - v5, y - v5, v5 + x, v5 + y); break; case 129: sub_47C2A0(x - v5, y - v5, v5 + x, v5 + y); break; } break; } } void sub_47B8D0(int xStart, int yStart, int xEnd, int yEnd) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_478CE0(xStart, yStart, xEnd, yEnd); sub_479C80(xStart, yStart, xEnd, yEnd); sub_478E40(); sub_479720(xStart, yStart, xEnd, yEnd); } //----- (0047B970) -------------------------------------------------------- int sub_47B970(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_478CE0(a1, a2, a3, a4); sub_479C80(a1, a2, a3, a4); sub_478E40(); return sub_478B80(a1, a2, a3, a4); } // 403058: using guessed type _DWORD sub_403058(_DWORD, _DWORD, _DWORD, _DWORD); //----- (0047BA10) -------------------------------------------------------- void sub_47BA10(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_479C80(a1, a2, a3, a4); sub_478E40(); sub_478CE0(a1, a2, a3, a4); } //----- (0047BA90) -------------------------------------------------------- void unused_47BA90(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_479C80(a1, a2, a3, a4); sub_478E40(); sub_478CE0(a1, a2, a3, a4); } //----- (0047BB10) -------------------------------------------------------- void sub_47BB10(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_478CE0(a1, a2, a3, a4); sub_479C80(a1, a2, a3, a4); sub_478E40(); sub_479DE0(a1, a2, a3, a4); } // 401F00: using guessed type _DWORD sub_401F00(_DWORD, _DWORD, _DWORD, _DWORD); //----- (0047BBB0) -------------------------------------------------------- int sub_47BBB0(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_478CE0(a1, a2, a3, a4); sub_479C80(a1, a2, a3, a4); return sub_478E40(); } //----- (0047BC30) -------------------------------------------------------- int sub_47BC30(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_478CE0(a1, a2, a3, a4); sub_479C80(a1, a2, a3, a4); sub_478E40(); return sub_479F40(a1, a2, a3, a4); } // 4019CE: using guessed type _DWORD sub_4019CE(_DWORD, _DWORD, _DWORD, _DWORD); //----- (0047BCD0) -------------------------------------------------------- void sub_47BCD0(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F29D0, 17); sub_478CE0(a1, a2, a3, a4); sub_479C80(a1, a2, a3, a4); sub_478E40(); sub_47F400(); } //----- (0047BD60) -------------------------------------------------------- int sub_47BD60(int a1, int a2) { int result; // eax@1 __int16 v3; // dx@9 __int16 v4; // dx@9 __int16 v5; // dx@9 __int16 v6; // dx@9 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; result = grid_elevation[walkerBaseGridOffset]; if ( result < 5 ) { if ( grid_elevation[walkerBaseGridOffset] == dword_8EFAE8 ) { result = walkerBaseGridOffset; if ( !(grid_terrain[walkerBaseGridOffset] & 0x400) ) { result = grid_terrain[walkerBaseGridOffset] & 0x200; if ( !(grid_terrain[walkerBaseGridOffset] & 0x200) ) { grid_bitfields[walkerBaseGridOffset] &= 0xF0u; v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 & 0xF7; grid_terrain[walkerBaseGridOffset] = v3; v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xFB; grid_terrain[walkerBaseGridOffset] = v4; v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xDF; grid_terrain[walkerBaseGridOffset] = v5; v6 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xBF; grid_terrain[walkerBaseGridOffset] = v6; result = walkerBaseGridOffset; ++grid_elevation[walkerBaseGridOffset]; } } } } return result; } char sub_47BEF0(int a1, int a2) { __int16 v2; // dx@2 __int16 v3; // dx@2 char result; // al@4 __int16 v5; // cx@4 __int16 v6; // ax@7 __int16 v7; // ax@7 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( grid_terrain[walkerBaseGridOffset] & 0x400 ) { v2 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v2) |= 2u; grid_terrain[walkerBaseGridOffset] = v2; v3 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v3) &= 0xFBu; grid_terrain[walkerBaseGridOffset] = v3; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; } if ( grid_elevation[walkerBaseGridOffset] > 0 ) { result = walkerBaseGridOffset; if ( grid_elevation[walkerBaseGridOffset] == dword_8EFAE8 ) { v6 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v6) &= 0xFDu; grid_terrain[walkerBaseGridOffset] = v6; v7 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v7) &= 0xFBu; grid_terrain[walkerBaseGridOffset] = v7; result = grid_elevation[walkerBaseGridOffset] - 1; grid_elevation[walkerBaseGridOffset] = result; } } else { result = walkerBaseGridOffset; v5 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v5) &= 0xFDu; grid_terrain[walkerBaseGridOffset] = v5; } return result; } void sub_47C0A0(int a1, int a2) { int v2; // ST68_4@5 __int16 v3; // dx@5 __int16 v4; // dx@5 __int16 v5; // dx@5 __int16 v6; // dx@5 __int16 v7; // dx@5 __int16 v8; // dx@5 signed int i; // [sp+50h] [bp-4h]@3 if ( !sub_4827B0(a1, a2, 0) ) { walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; i < 4; ++i ) { v2 = dword_5F3C50[i]; v3 = grid_terrain[v2 + walkerBaseGridOffset]; _LOBYTE(v3) = v3 & 0xF7; grid_terrain[v2 + walkerBaseGridOffset] = v3; v4 = grid_terrain[v2 + walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xFB; grid_terrain[v2 + walkerBaseGridOffset] = v4; v5 = grid_terrain[v2 + walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xDF; grid_terrain[v2 + walkerBaseGridOffset] = v5; v6 = grid_terrain[v2 + walkerBaseGridOffset]; _LOBYTE(v6) = v6 & 0xBF; grid_terrain[v2 + walkerBaseGridOffset] = v6; v7 = grid_terrain[v2 + walkerBaseGridOffset]; _HIBYTE(v7) &= 0xFEu; grid_terrain[v2 + walkerBaseGridOffset] = v7; v8 = grid_terrain[v2 + walkerBaseGridOffset]; _LOBYTE(v8) = v8 & 0xFD; grid_terrain[v2 + walkerBaseGridOffset] = v8; *(&grid_bitfields[v2] + walkerBaseGridOffset) &= 0xF0u; } fun_putBuildingOnTerrainAndGraphicGrids(0, a1, a2, 2, 2, dword_8B4604 + word_6E6D60, 1024); } } void sub_47C2A0(int a1, int a2, int a3, int a4) { fun_setByte14Zero(byte_5F2250, 48); fun_setByte14Zero(byte_5F28F0, 14); fun_setByte14Zero(byte_5F29D0, 17); sub_47C480(0, 0, setting_map_width - 1, setting_map_height - 1); sub_478CE0(a1, a2, a3, a4); sub_478B80(a1, a2, a3, a4); sub_479F40(a1, a2, a3, a4); sub_479DE0(a1, a2, a3, a4); sub_479C80(a1, a2, a3, a4); sub_478E40(); sub_479720(a1, a2, a3, a4); } int sub_47C3D0() { sub_47CA20(); sub_47CA20(); sub_47CA20(); sub_47CA20(); sub_47C480(0, 0, setting_map_width - 1, setting_map_height - 1); sub_478E40(); sub_479720(0, 0, setting_map_width - 1, setting_map_height - 1); return sub_479F40(0, 0, setting_map_width - 1, setting_map_height - 1); } int sub_47C480(int a1, int a2, int a3, int a4) { int result; // eax@17 __int16 v5; // dx@26 __int16 v6; // cx@27 __int16 v7; // cx@28 __int16 v8; // cx@33 __int16 v9; // cx@33 __int16 v10; // cx@35 __int16 v11; // dx@37 __int16 v12; // ax@39 __int16 v13; // ax@47 int v14; // [sp+4Ch] [bp-10h]@9 int v15; // [sp+4Ch] [bp-10h]@17 int v16; // [sp+50h] [bp-Ch]@9 int v17; // [sp+54h] [bp-8h]@9 int v18; // [sp+54h] [bp-8h]@17 int v19; // [sp+58h] [bp-4h]@11 int v20; // [sp+58h] [bp-4h]@19 if ( a1 < 0 ) a1 = 0; if ( a2 < 0 ) a2 = 0; if ( a3 >= setting_map_width ) a3 = setting_map_width - 1; if ( a4 >= setting_map_height ) a4 = setting_map_height - 1; v16 = setting_map_width - (a3 - a1 + 1); v14 = 162 * a2 + a1 + setting_map_startGridOffset; v17 = a2; while ( v17 <= a4 ) { v19 = a1; while ( v19 <= a3 ) { if ( grid_terrain[v14] & 0x400 ) grid_graphicIds[v14] = 0; ++v19; ++v14; } ++v17; v14 += setting_map_gridBorderSize + v16; } result = 162 * a2; v15 = 162 * a2 + a1 + setting_map_startGridOffset; v18 = a2; while ( v18 <= a4 ) { v20 = a1; while ( v20 <= a3 ) { if ( grid_terrain[v15] & 0x400 ) { if ( !grid_graphicIds[v15] ) { if ( sub_4827B0(v20, v18, 1) ) { v5 = grid_terrain[v15]; _HIBYTE(v5) &= 0xFBu; grid_terrain[v15] = v5; grid_bitfields[v15] &= 0xF0u; grid_edge[v15] |= 0x40u; if ( grid_elevation[v15] ) { v6 = grid_terrain[v15]; _HIBYTE(v6) |= 2u; grid_terrain[v15] = v6; } else { v7 = grid_terrain[v15]; _HIBYTE(v7) &= 0xFDu; grid_terrain[v15] = v7; grid_graphicIds[v15] = (grid_random[v15] & 7) + graphic_terrain_grass1; } } else { fun_putBuildingOnTerrainAndGraphicGrids(0, v20, v18, 2, 2, dword_8B4604 + word_6E6D60, 1024); } } } if ( grid_elevation[v15] ) { if ( !(grid_terrain[v15] & 0x400) ) { walkerBaseGridOffset = v15; sub_485450(grid_elevation[v15]); sub_490850(byte_5F28F0, 14); if ( dword_9363A8 == 44 ) { v8 = grid_terrain[v15]; _HIBYTE(v8) &= 0xFDu; grid_terrain[v15] = v8; v9 = grid_terrain[v15]; if ( !(v9 & 8) ) { grid_edge[v15] = 64; v10 = grid_terrain[v15]; if ( v10 & 0x10 ) { grid_graphicIds[v15] = (grid_random[v15] & 7) + graphic_terrain_trees; } else { v11 = grid_terrain[v15]; if ( v11 & 1 ) { grid_graphicIds[v15] = (grid_random[v15] & 7) + graphic_terrain_shrub; } else { v12 = grid_terrain[v15]; if ( v12 & 0x40 ) { sub_47EDE0(v20, v18, 1); } else { if ( grid_terrain[v15] & 0x100 ) { sub_47F8C0(v20, v18, 0); } else { if ( grid_terrain[v15] & 0x800 ) grid_graphicIds[v15] = (grid_random[v15] & 3) + word_6E6CC4; else grid_graphicIds[v15] = (grid_random[v15] & 7) + graphic_terrain_grass1; } } } } } } else { grid_edge[v15] = 64; v13 = grid_terrain[v15]; _HIBYTE(v13) |= 2u; grid_terrain[v15] = v13; grid_graphicIds[v15] = dword_8E7B28 + dword_9363A8 + graphic_terrain_cliff; } } } ++v20; ++v15; } ++v18; result = setting_map_gridBorderSize + v16; v15 += setting_map_gridBorderSize + v16; } return result; } int sub_47CA20() { int result; // eax@2 int v1; // [sp+4Ch] [bp-Ch]@8 int v2; // [sp+50h] [bp-8h]@1 int v3; // [sp+54h] [bp-4h]@3 walkerBaseGridOffset = setting_map_startGridOffset; v2 = 0; while ( 1 ) { result = v2; if ( v2 >= setting_map_height ) break; v3 = 0; while ( v3 < setting_map_width ) { if ( grid_elevation[walkerBaseGridOffset] > 0 ) { v1 = grid_elevation[walkerBaseGridOffset] - 1; if ( byte_8EFA5E[walkerBaseGridOffset] >= v1 ) { if ( byte_8EFB01[walkerBaseGridOffset] >= v1 ) { if ( byte_8EFBA2[walkerBaseGridOffset] >= v1 ) { if ( byte_8EFAFF[walkerBaseGridOffset] < v1 ) --grid_elevation[walkerBaseGridOffset]; } else { --grid_elevation[walkerBaseGridOffset]; } } else { --grid_elevation[walkerBaseGridOffset]; } } else { --grid_elevation[walkerBaseGridOffset]; } } ++v3; ++walkerBaseGridOffset; } ++v2; walkerBaseGridOffset += setting_map_gridBorderSize; } return result; } void unused_47CBF0() { __int16 v0; // cx@6 int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@3 walkerBaseGridOffset = setting_map_startGridOffset; v1 = 0; while ( v1 < setting_map_height ) { v2 = 0; while ( v2 < setting_map_width ) { if ( grid_terrain[walkerBaseGridOffset] & 0x400 ) { v0 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v0) &= 0xFDu; grid_terrain[walkerBaseGridOffset] = v0; } ++v2; ++walkerBaseGridOffset; } ++v1; walkerBaseGridOffset += setting_map_gridBorderSize; } } void unused_47CCD0() { __int16 v0; // cx@6 int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@3 walkerBaseGridOffset = setting_map_startGridOffset; v1 = 0; while ( v1 < setting_map_height ) { v2 = 0; while ( v2 < setting_map_width ) { if ( grid_terrain[walkerBaseGridOffset] & 0x400 ) { v0 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v0) |= 2u; grid_terrain[walkerBaseGridOffset] = v0; } ++v2; ++walkerBaseGridOffset; } ++v1; walkerBaseGridOffset += setting_map_gridBorderSize; } } int sub_47CDB0(int a1, int a2, int a3) { __int16 v3; // ax@2 __int16 v4; // ax@3 int result; // eax@12 __int16 v6; // cx@17 int v7; // [sp+4Ch] [bp-8h]@4 int v8; // [sp+50h] [bp-4h]@4 int v9; // [sp+5Ch] [bp+8h]@4 int v10; // [sp+60h] [bp+Ch]@4 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( a3 == 1 ) { v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 | 1; grid_terrain[walkerBaseGridOffset] = v3; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xFE; grid_terrain[walkerBaseGridOffset] = v4; } v9 = a1 - 1; v10 = a2 - 1; v7 = 3; v8 = 3; if ( v9 >= 0 ) { if ( v9 + 3 > setting_map_width ) v8 = 3 - (v9 + 3 - setting_map_width); } else { v8 = v9 + 3; v9 = 0; } if ( v10 >= 0 ) { if ( v10 + 3 > setting_map_height ) v7 = 3 - (v10 + 3 - setting_map_height); } else { v7 = v10 + 3; v10 = 0; } walkerBaseGridOffset = 162 * v10 + v9 + setting_map_startGridOffset; result = v10; dword_909548 = v10; while ( dword_909548 < v7 + v10 ) { dword_909544 = v9; while ( dword_909544 < v8 + v9 ) { v6 = grid_terrain[walkerBaseGridOffset]; if ( v6 & 1 ) { if ( !(grid_terrain[walkerBaseGridOffset] & 0x600) ) { if ( sub_48B700(dword_909544, dword_909548, 3) ) { grid_graphicIds[walkerBaseGridOffset] = graphic_terrain_shrub + (grid_random[walkerBaseGridOffset] & 7) + 24; } else { if ( sub_48B700(dword_909544, dword_909548, 2) ) { grid_graphicIds[walkerBaseGridOffset] = graphic_terrain_shrub + (grid_random[walkerBaseGridOffset] & 7) + 16; } else { if ( sub_48B700(dword_909544, dword_909548, 1) ) grid_graphicIds[walkerBaseGridOffset] = graphic_terrain_shrub + (grid_random[walkerBaseGridOffset] & 7) + 8; else grid_graphicIds[walkerBaseGridOffset] = (grid_random[walkerBaseGridOffset] & 7) + graphic_terrain_shrub; } } grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; grid_aqueducts[walkerBaseGridOffset] = 0; } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; result = 162 - v8 + walkerBaseGridOffset; walkerBaseGridOffset += 162 - v8; } return result; } void sub_47D180(int a1, int a2, int a3) { __int16 v3; // ax@2 __int16 v4; // ax@3 int v5; // ecx@17 __int16 v6; // cx@17 int v7; // eax@21 int v8; // [sp+50h] [bp-8h]@4 int v9; // [sp+54h] [bp-4h]@4 int v10; // [sp+60h] [bp+8h]@4 int v11; // [sp+64h] [bp+Ch]@4 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( a3 == 1 ) { v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 | 2; grid_terrain[walkerBaseGridOffset] = v3; grid_bitfields[walkerBaseGridOffset] |= 0x80u; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xFD; grid_terrain[walkerBaseGridOffset] = v4; grid_bitfields[walkerBaseGridOffset] &= 0x7Fu; } v10 = a1 - 1; v11 = a2 - 1; v8 = 3; v9 = 3; if ( v10 >= 0 ) { if ( v10 + 3 > setting_map_width ) v9 = 3 - (v10 + 3 - setting_map_width); } else { v9 = v10 + 3; v10 = 0; } if ( v11 >= 0 ) { if ( v11 + 3 > setting_map_height ) v8 = 3 - (v11 + 3 - setting_map_height); } else { v8 = v11 + 3; v11 = 0; } walkerBaseGridOffset = 162 * v11 + v10 + setting_map_startGridOffset; dword_909548 = v11; while ( dword_909548 < v8 + v11 ) { dword_909544 = v10; while ( dword_909544 < v9 + v10 ) { v6 = grid_terrain[walkerBaseGridOffset]; v5 = v6 & 2; if ( v5 ) { if ( grid_bitfields[walkerBaseGridOffset] & 0x80 ) { sub_483D00(/*v5, walkerBaseGridOffset*/); sub_490A70(); sub_490850(byte_5F29D0, 17); if ( v7 ) grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_terrain_quake; else grid_graphicIds[walkerBaseGridOffset] = graphic_terrain_quake; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - v9; } } void sub_47D4B0(int a1, int a2, int a3) { __int16 v3; // ax@2 __int16 v4; // ax@3 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( a3 == 1 ) { v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 | T_Scrub; grid_terrain[walkerBaseGridOffset] = v3; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xEF; grid_terrain[walkerBaseGridOffset] = v4; } if ( a3 == 1 ) { grid_graphicIds[walkerBaseGridOffset] = (grid_random[walkerBaseGridOffset] & 7) + graphic_terrain_trees; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; } } void sub_47D5B0(int a1, int a2, int a3) { __int16 v3; // ax@2 __int16 v4; // ax@3 __int16 v5; // cx@23 __int16 v6; // ax@25 __int16 v7; // dx@27 int v8; // [sp+4Ch] [bp-8h]@4 int v9; // [sp+50h] [bp-4h]@4 int v10; // [sp+5Ch] [bp+8h]@4 int v11; // [sp+60h] [bp+Ch]@4 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( a3 == 1 ) { v3 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v3) |= 8u; grid_terrain[walkerBaseGridOffset] = v3; } else { v4 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v4) &= 0xF7u; grid_terrain[walkerBaseGridOffset] = v4; } v10 = a1 - 1; v11 = a2 - 1; v8 = 3; v9 = 3; if ( v10 >= 0 ) { if ( v10 + 3 > setting_map_width ) v9 = 3 - (v10 + 3 - setting_map_width); } else { v9 = v10 + 3; v10 = 0; } if ( v11 >= 0 ) { if ( v11 + 3 > setting_map_height ) v8 = 3 - (v11 + 3 - setting_map_height); } else { v8 = v11 + 3; v11 = 0; } walkerBaseGridOffset = 162 * v11 + v10 + setting_map_startGridOffset; dword_909548 = v11; while ( dword_909548 < v8 + v11 ) { dword_909544 = v10; while ( dword_909544 < v9 + v10 ) { if ( grid_terrain[walkerBaseGridOffset] & 0x800 ) { if ( !(grid_terrain[walkerBaseGridOffset] & 0x600) ) { if ( !(grid_terrain[walkerBaseGridOffset] & 0x100) ) { v5 = grid_terrain[walkerBaseGridOffset]; if ( !(v5 & 0x40) ) { v6 = grid_terrain[walkerBaseGridOffset]; if ( !(v6 & 8) ) { v7 = grid_terrain[walkerBaseGridOffset]; if ( !(v7 & 0x20) ) { if ( !(grid_terrain[walkerBaseGridOffset] & 0x1000) ) { if ( sub_48B840(dword_909544, dword_909548, 2) ) { grid_graphicIds[walkerBaseGridOffset] = word_6E6CC4 + (grid_random[walkerBaseGridOffset] & 3) + 8; } else { if ( sub_48B840(dword_909544, dword_909548, 1) ) grid_graphicIds[walkerBaseGridOffset] = word_6E6CC4 + (grid_random[walkerBaseGridOffset] & 3) + 4; else grid_graphicIds[walkerBaseGridOffset] = (grid_random[walkerBaseGridOffset] & 3) + word_6E6CC4; } grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; grid_aqueducts[walkerBaseGridOffset] = 0; } } } } } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - v9; } } int sub_47D9D0(int a1, int a2) { int result; // eax@1 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; grid_graphicIds[walkerBaseGridOffset] = (grid_random[walkerBaseGridOffset] & 7) + word_6E6C94; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; result = walkerBaseGridOffset; grid_edge[walkerBaseGridOffset] |= 0x40u; grid_aqueducts[walkerBaseGridOffset] = 0; return result; } void sub_47DA90(int x, int y, int isWater) { __int16 v3; // ax@2 __int16 v4; // ax@3 __int16 v5; // cx@17 __int16 v6; // ax@19 int v7; // [sp+4Ch] [bp-10h]@21 int v8; // [sp+50h] [bp-Ch]@21 int v9; // [sp+54h] [bp-8h]@4 int v10; // [sp+58h] [bp-4h]@4 int v11; // [sp+64h] [bp+8h]@4 int v12; // [sp+68h] [bp+Ch]@4 walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; if ( isWater == 1 ) { v3 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v3) = v3 | T_Water; grid_terrain[walkerBaseGridOffset] = v3; } else { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 & 0xFB; grid_terrain[walkerBaseGridOffset] = v4; } v11 = x - 1; v12 = y - 1; v9 = 3; v10 = 3; if ( v11 >= 0 ) { if ( v11 + 3 > setting_map_width ) v10 = 3 - (v11 + 3 - setting_map_width); } else { v10 = v11 + 3; v11 = 0; } if ( v12 >= 0 ) { if ( v12 + 3 > setting_map_height ) v9 = 3 - (v12 + 3 - setting_map_height); } else { v9 = v12 + 3; v12 = 0; } walkerBaseGridOffset = 162 * v12 + v11 + setting_map_startGridOffset; dword_909548 = v12; while ( dword_909548 < v9 + v12 ) { dword_909544 = v11; while ( dword_909544 < v10 + v11 ) { v5 = grid_terrain[walkerBaseGridOffset]; if ( v5 & 4 ) { v6 = grid_terrain[walkerBaseGridOffset]; if ( !(v6 & 8) ) { sub_483BF0(4); sub_490A00(); sub_490850(byte_5F2250, 48); v8 = dword_8E7B28 + dword_9363A8 + graphic_terrain_water; v7 = walkerBaseGridOffset; if ( sub_48D300(dword_909544, dword_909548, 1, 2, 8) ) { switch ( dword_9363A8 ) { case 8: v8 = word_6E6D4E + 10; break; case 12: v8 = word_6E6D4E + 11; break; case 16: v8 = word_6E6D4E + 9; break; case 20: v8 = word_6E6D4E + 8; break; case 24: v8 = word_6E6D4E + 18; break; case 28: v8 = word_6E6D4E + 16; break; case 32: v8 = word_6E6D4E + 19; break; case 36: v8 = word_6E6D4E + 17; break; case 50: v8 = word_6E6D4E + 12; break; case 51: v8 = word_6E6D4E + 14; break; case 52: v8 = word_6E6D4E + 13; break; case 53: v8 = word_6E6D4E + 15; break; } } walkerBaseGridOffset = v7; grid_graphicIds[walkerBaseGridOffset] = v8; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - v10; } } int sub_47DF20(int a1, int a2, int a3) { __int16 v3; // cx@5 int result; // eax@14 __int16 v5; // cx@21 int v6; // ecx@23 int v7; // eax@24 int v8; // [sp+50h] [bp-8h]@6 int v9; // [sp+54h] [bp-4h]@6 int v10; // [sp+60h] [bp+8h]@6 int v11; // [sp+64h] [bp+Ch]@6 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( !(grid_terrain[walkerBaseGridOffset] & 0x4000) ) ++multipleConstruction_itemsPlaced; if ( a3 == 1 ) { grid_terrain[walkerBaseGridOffset] = 16384; } else { v3 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v3) &= 0xBFu; grid_terrain[walkerBaseGridOffset] = v3; } grid_bitfields[walkerBaseGridOffset] &= 0xEFu; v10 = a1 - 1; v11 = a2 - 1; v8 = 3; v9 = 3; if ( v10 >= 0 ) { if ( v10 + 3 > setting_map_width ) v9 = 3 - (v10 + 3 - setting_map_width); } else { v9 = v10 + 3; v10 = 0; } if ( v11 >= 0 ) { if ( v11 + 3 > setting_map_height ) v8 = 3 - (v11 + 3 - setting_map_height); } else { v8 = v11 + 3; v11 = 0; } result = 162 * v11; walkerBaseGridOffset = 162 * v11 + v10 + setting_map_startGridOffset; dword_909548 = v11; while ( dword_909548 < v8 + v11 ) { dword_909544 = v10; while ( dword_909544 < v9 + v10 ) { if ( grid_terrain[walkerBaseGridOffset] & 0x4000 ) { v5 = grid_terrain[walkerBaseGridOffset]; if ( !(v5 & 8) ) { sub_483BF0(16384); sub_490A00(); sub_490850(byte_5F2550, 48); grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_wall_top; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; v6 = walkerBaseGridOffset; grid_edge[walkerBaseGridOffset] |= 0x40u; if ( sub_483FB0() ) { sub_485390(); sub_490850(byte_5F2850, 10); if ( v7 ) grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_wall_top; else sub_47E7A0(1); } else { sub_47E7A0(0); } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; result = 162 - v9; walkerBaseGridOffset += 162 - v9; } return result; } void sub_47E2B0(int x, int y, int size) { __int16 v3; // dx@16 int v4; // ecx@18 int v5; // eax@19 int v6; // [sp+50h] [bp-8h]@1 int v7; // [sp+54h] [bp-4h]@1 int v8; // [sp+60h] [bp+8h]@1 int v9; // [sp+64h] [bp+Ch]@1 v8 = x - 1; v9 = y - 1; v6 = size; v7 = size; if ( v8 >= 0 ) { if ( size + v8 > setting_map_width ) v7 = size - (size + v8 - setting_map_width); } else { v7 = v8 + size; v8 = 0; } if ( v9 >= 0 ) { if ( size + v9 > setting_map_height ) v6 = size - (size + v9 - setting_map_height); } else { v6 = v9 + size; v9 = 0; } walkerBaseGridOffset = 162 * v9 + v8 + setting_map_startGridOffset; dword_909548 = v9; while ( dword_909548 < v6 + v9 ) { dword_909544 = v8; while ( dword_909544 < v7 + v8 ) { if ( grid_terrain[walkerBaseGridOffset] & 0x4000 ) { v3 = grid_terrain[walkerBaseGridOffset]; if ( !(v3 & 8) ) { sub_483BF0(16384); sub_490A00(); sub_490850(byte_5F2550, 48); grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_wall_top; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; v4 = walkerBaseGridOffset; grid_edge[walkerBaseGridOffset] |= 0x40u; if ( sub_483FB0() ) { sub_485390(); sub_490850(byte_5F2850, 10); if ( v5 ) grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_wall_top; else sub_47E7A0(1); } else { sub_47E7A0(0); } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - v7; } } int sub_47E590() { int result; // eax@2 __int16 v1; // cx@8 int v2; // ecx@10 int v3; // eax@11 walkerBaseGridOffset = setting_map_startGridOffset; dword_909548 = 0; while ( 1 ) { result = dword_909548; if ( dword_909548 >= setting_map_height ) break; dword_909544 = 0; while ( dword_909544 < setting_map_width ) { if ( grid_terrain[walkerBaseGridOffset] & 0x4000 ) { v1 = grid_terrain[walkerBaseGridOffset]; if ( !(v1 & 8) ) { sub_483BF0(16384); sub_490A00(); sub_490850(byte_5F2550, 48); grid_bitfields[walkerBaseGridOffset] &= 0xF0u; v2 = walkerBaseGridOffset; grid_edge[walkerBaseGridOffset] |= 0x40u; grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_wall_top; if ( sub_483FB0() ) { sub_485390(); sub_490850(byte_5F2850, 10); if ( v3 ) grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + graphic_wall_top; else sub_47E7A0(1); } else { sub_47E7A0(0); } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += setting_map_gridBorderSize; } return result; } void sub_47E7A0(int a1) { signed int v1; // [sp+4Ch] [bp-14h]@10 signed int v2; // [sp+4Ch] [bp-14h]@19 signed int v3; // [sp+4Ch] [bp-14h]@35 int v4; // [sp+4Ch] [bp-14h]@44 int v5; // [sp+4Ch] [bp-14h]@60 int v6; // [sp+4Ch] [bp-14h]@69 int v7; // [sp+4Ch] [bp-14h]@85 signed int v8; // [sp+4Ch] [bp-14h]@94 int v9; // [sp+50h] [bp-10h]@2 int v10; // [sp+54h] [bp-Ch]@2 int v11; // [sp+58h] [bp-8h]@2 int v12; // [sp+5Ch] [bp-4h]@2 if ( a1 ) { v12 = sub_484AD0(-162); v11 = sub_484AD0(-1); v10 = sub_484AD0(162); v9 = sub_484AD0(1); if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: if ( !v10 || !v11 ) { if ( v10 || v11 ) { if ( v10 ) { v3 = sub_484B20(162, v10); if ( v3 > 0 ) { if ( v3 > 2 ) { if ( v3 == 3 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 32; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; } else { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 30; } } } else { if ( v11 ) { v4 = sub_484B20(-1, v11); if ( v4 > 0 ) { if ( v4 == 1 ) { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 31; } else { if ( v4 == 2 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 29; } } } } } } break; case 4: if ( !v10 || !v9 ) { if ( v10 || v9 ) { if ( v10 ) { v5 = sub_484B20(162, v10); if ( v5 > 0 ) { if ( v5 == 1 ) { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 31; } else { if ( v5 == 2 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 29; } } } else { if ( v9 ) { v6 = sub_484B20(1, v9); if ( v6 > 0 ) { if ( v6 == 1 ) { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 32; } else { if ( v6 == 2 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 30; } } } } } } break; case 2: if ( !v12 || !v9 ) { if ( v12 || v9 ) { if ( v12 ) { v7 = sub_484B20(-162, v12); if ( v7 > 0 ) { if ( v7 == 1 ) { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 32; } else { if ( v7 == 2 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 30; } } } else { if ( v9 ) { v8 = sub_484B20(1, v9); if ( v8 > 0 ) { if ( v8 > 2 ) { if ( v8 == 3 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 31; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; } else { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 29; } } } } } } break; } } else { if ( !v12 || !v11 ) { if ( v12 || v11 ) { if ( v12 ) { v1 = sub_484B20(-162, v12); if ( v1 > 0 ) { if ( v1 > 2 ) { if ( v1 == 3 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 31; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; } else { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 29; } } } else { if ( v11 ) { v2 = sub_484B20(-1, v11); if ( v2 > 0 ) { if ( v2 > 2 ) { if ( v2 == 3 ) grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 32; else grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 33; } else { grid_graphicIds[walkerBaseGridOffset] = graphic_wall_top + 30; } } } } } } } } } int sub_47EDE0(int a1, int a2, int a3) { __int16 v3; // ax@1 __int16 v4; // ax@4 __int16 v5; // ax@5 int result; // eax@14 __int16 v7; // cx@19 __int16 v8; // ax@21 __int16 v9; // dx@23 int v10; // ecx@29 __int16 v11; // ax@30 signed __int16 v12; // [sp+4Ch] [bp-10h]@27 int v13; // [sp+54h] [bp-8h]@6 int v14; // [sp+58h] [bp-4h]@6 int v15; // [sp+64h] [bp+8h]@6 int v16; // [sp+68h] [bp+Ch]@6 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[walkerBaseGridOffset]; if ( !(v3 & 0x40) ) ++multipleConstruction_itemsPlaced; if ( a3 == 1 ) { v4 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v4) = v4 | 0x40; grid_terrain[walkerBaseGridOffset] = v4; } else { v5 = grid_terrain[walkerBaseGridOffset]; _LOBYTE(v5) = v5 & 0xBF; grid_terrain[walkerBaseGridOffset] = v5; } grid_bitfields[walkerBaseGridOffset] &= 0xEFu; v15 = a1 - 1; v16 = a2 - 1; v13 = 3; v14 = 3; if ( v15 >= 0 ) { if ( v15 + 3 > setting_map_width ) v14 = 3 - (v15 + 3 - setting_map_width); } else { v14 = v15 + 3; v15 = 0; } if ( v16 >= 0 ) { if ( v16 + 3 > setting_map_height ) v13 = 3 - (v16 + 3 - setting_map_height); } else { v13 = v16 + 3; v16 = 0; } walkerBaseGridOffset = 162 * v16 + v15 + setting_map_startGridOffset; result = v16; dword_909548 = v16; while ( dword_909548 < v13 + v16 ) { dword_909544 = v15; while ( dword_909544 < v14 + v15 ) { v7 = grid_terrain[walkerBaseGridOffset]; if ( v7 & 0x40 ) { v8 = grid_terrain[walkerBaseGridOffset]; if ( !(v8 & 4) ) { v9 = grid_terrain[walkerBaseGridOffset]; if ( !(v9 & 8) ) { if ( grid_terrain[walkerBaseGridOffset] & 0x100 ) { if ( grid_graphicIds[walkerBaseGridOffset] - graphic_aqueduct < 15 ) v12 = 0; else v12 = 15; sub_485A80(); sub_490850(byte_5F3000, 16); if ( !dword_89AA70 ) { v11 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; if ( v11 & 0x40 ) dword_9363A8 = 3; else dword_9363A8 = 2; } if ( sub_47F7B0() ) grid_graphicIds[walkerBaseGridOffset] = v12 + graphic_aqueduct + (_WORD)dword_9363A8 - 2; else grid_graphicIds[walkerBaseGridOffset] = v12 + graphic_aqueduct + (_WORD)dword_9363A8 + 6; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; } else { sub_483BF0(64); sub_484900(); sub_47F530(); } } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; result = 162 - v14 + walkerBaseGridOffset; walkerBaseGridOffset += 162 - v14; } return result; } int sub_47F200(int a1, int a2, int a3) { int result; // eax@10 __int16 v4; // ax@14 __int16 v5; // dx@16 __int16 v6; // cx@18 int v7; // [sp+4Ch] [bp-8h]@1 int v8; // [sp+50h] [bp-4h]@1 int v9; // [sp+5Ch] [bp+8h]@1 int v10; // [sp+60h] [bp+Ch]@1 v9 = a1 - 1; v10 = a2 - 1; v7 = a3; v8 = a3; if ( v9 >= 0 ) { if ( a3 + v9 > setting_map_width ) v8 = a3 - (a3 + v9 - setting_map_width); } else { v8 = v9 + a3; v9 = 0; } if ( v10 >= 0 ) { if ( a3 + v10 > setting_map_height ) v7 = a3 - (a3 + v10 - setting_map_height); } else { v7 = v10 + a3; v10 = 0; } walkerBaseGridOffset = 162 * v10 + v9 + setting_map_startGridOffset; dword_909548 = v10; while ( 1 ) { result = v7 + v10; if ( dword_909548 >= v7 + v10 ) break; dword_909544 = v9; while ( dword_909544 < v8 + v9 ) { v4 = grid_terrain[walkerBaseGridOffset]; if ( v4 & 0x40 ) { v5 = grid_terrain[walkerBaseGridOffset]; if ( !(v5 & 4) ) { v6 = grid_terrain[walkerBaseGridOffset]; if ( !(v6 & 8) ) { sub_483BF0(64); sub_484900(); sub_47F530(); } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - v8; } return result; } void sub_47F400() { __int16 v0; // dx@6 __int16 v1; // cx@8 __int16 v2; // ax@10 walkerBaseGridOffset = setting_map_startGridOffset; dword_909548 = 0; while ( dword_909548 < setting_map_height ) { dword_909544 = 0; while ( dword_909544 < setting_map_width ) { v0 = grid_terrain[walkerBaseGridOffset]; if ( v0 & 0x40 ) { v1 = grid_terrain[walkerBaseGridOffset]; if ( !(v1 & 4) ) { v2 = grid_terrain[walkerBaseGridOffset]; if ( !(v2 & 8) ) { sub_483BF0(64); sub_484900(); sub_47F530(); } } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += setting_map_gridBorderSize; } } int sub_47F530() { int result; // eax@1 int v1; // ecx@9 __int16 v2; // cx@10 signed __int16 v3; // [sp+4Ch] [bp-8h]@7 result = walkerBaseGridOffset; if ( !(grid_bitfields[walkerBaseGridOffset] & 0x80) ) { if ( debug_roadEvolution == 1 ) { sub_490850(byte_5F2D00, 48); sub_490A70(); grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + word_6E6C90; } else { if ( grid_terrain[walkerBaseGridOffset] & 0x100 ) { if ( grid_graphicIds[walkerBaseGridOffset] - graphic_aqueduct < 15 ) v3 = 0; else v3 = 15; sub_485A80(); sub_490850(byte_5F3000, 16); if ( !dword_89AA70 ) { v2 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; v1 = v2 & 0x40; if ( v1 ) dword_9363A8 = 3; else dword_9363A8 = 2; } if ( sub_47F7B0() ) grid_graphicIds[walkerBaseGridOffset] = v3 + graphic_aqueduct + (_WORD)dword_9363A8 - 2; else grid_graphicIds[walkerBaseGridOffset] = v3 + graphic_aqueduct + (_WORD)dword_9363A8 + 6; } else { if ( sub_47F7B0() ) { sub_490850(byte_5F2D00, 48); sub_490A70(); grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + dword_9363A8 + word_6E6C90; } else { sub_490850(byte_5F2BF0, 17); sub_490A70(); grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + word_6E6C90 + dword_9363A8 + 49; } } } grid_bitfields[walkerBaseGridOffset] &= 0xF0u; result = walkerBaseGridOffset; grid_edge[walkerBaseGridOffset] |= 0x40u; } return result; } signed int sub_47F7B0() { signed int result; // eax@2 if ( grid_desirability[walkerBaseGridOffset] <= 4 ) { if ( grid_desirability[walkerBaseGridOffset] > 0 ) { if ( grid_terrain[walkerBaseGridOffset] & 0x2000 ) result = 1; else result = 0; } else { result = 0; } } else { result = 1; } return result; } int sub_47F830(int a1, int a2) { int result; // eax@1 __int16 v3; // cx@1 walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; ++multipleConstruction_itemsPlaced; v3 = grid_terrain[walkerBaseGridOffset]; _HIBYTE(v3) |= 1u; grid_terrain[walkerBaseGridOffset] = v3; result = walkerBaseGridOffset; grid_bitfields[walkerBaseGridOffset] &= 0xEFu; return result; } void sub_47F8C0(int x, int y, int a3) { __int16 v3; // cx@3 __int16 v4; // cx@10 int v5; // ecx@11 __int16 v6; // ax@12 signed __int16 v7; // [sp+4Ch] [bp-8h]@6 walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; dword_909544 = x; dword_909548 = y; if ( grid_aqueducts[walkerBaseGridOffset] <= 15 ) { v3 = grid_terrain[walkerBaseGridOffset]; if ( !(v3 & 8) ) { if ( grid_graphicIds[walkerBaseGridOffset] - graphic_aqueduct >= 15 ) v7 = 15; else v7 = 0; if ( a3 ) v7 = 15; ++multipleConstruction_itemsPlaced; sub_485A80(); sub_490850(byte_5F3000, 16); v4 = grid_terrain[walkerBaseGridOffset]; if ( v4 & 0x40 ) { v5 = walkerBaseGridOffset; grid_bitfields[walkerBaseGridOffset] &= 0x7Fu; if ( !dword_89AA70 ) { v6 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; if ( v6 & 0x40 ) dword_9363A8 = 3; else dword_9363A8 = 2; } if ( sub_47F7B0() ) dword_9363A8 -= 2; else dword_9363A8 += 6; } grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + (_WORD)dword_9363A8 + v7 + graphic_aqueduct; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; grid_aqueducts[walkerBaseGridOffset] = dword_89AA70; } } } void sub_47FAF0(int a1, int a2, int a3, int a4, int a5) { int v5; // ecx@31 __int16 v6; // dx@31 __int16 v7; // cx@33 signed __int16 v8; // [sp+4Ch] [bp-1Ch]@25 int v9; // [sp+50h] [bp-18h]@24 int v10; // [sp+58h] [bp-10h]@5 int v11; // [sp+58h] [bp-10h]@7 int v12; // [sp+5Ch] [bp-Ch]@5 int v13; // [sp+5Ch] [bp-Ch]@7 int v14; // [sp+60h] [bp-8h]@2 int v15; // [sp+60h] [bp-8h]@7 int v16; // [sp+64h] [bp-4h]@2 int v17; // [sp+64h] [bp-4h]@7 if ( a1 > a3 ) { v16 = a3; v14 = a1; } else { v16 = a1; v14 = a3; } if ( a2 > a4 ) { v12 = a4; v10 = a2; } else { v12 = a2; v10 = a4; } v17 = v16 - 1; v15 = v14 + 1; v13 = v12 - 1; v11 = v10 + 1; if ( v17 < 0 ) v17 = 0; if ( v15 >= setting_map_width ) v15 = setting_map_width - 1; if ( v13 < 0 ) v13 = 0; if ( v11 >= setting_map_height ) v11 = setting_map_height - 1; walkerBaseGridOffset = 162 * v13 + v17 + setting_map_startGridOffset; dword_909548 = v13; while ( dword_909548 <= v11 ) { dword_909544 = v17; while ( dword_909544 <= v15 ) { if ( grid_terrain[walkerBaseGridOffset] & 0x100 ) { if ( grid_aqueducts[walkerBaseGridOffset] <= 15 ) { v9 = grid_graphicIds[walkerBaseGridOffset] - graphic_aqueduct; if ( v9 < 15 ) { if ( v9 >= 0 ) v8 = 0; else v8 = 15; } else { v8 = 15; } if ( a5 ) v8 = 15; sub_485A80(); sub_490850(byte_5F3000, 16); v5 = walkerBaseGridOffset; v6 = grid_terrain[walkerBaseGridOffset]; if ( v6 & 0x40 ) { _LOBYTE(v5) = grid_bitfields[walkerBaseGridOffset] & 0x7F; grid_bitfields[walkerBaseGridOffset] = v5; if ( !dword_89AA70 ) { v7 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; v5 = v7 & 0x40; if ( v5 ) dword_9363A8 = 3; else dword_9363A8 = 2; } if ( sub_47F7B0() ) dword_9363A8 -= 2; else dword_9363A8 += 6; } grid_graphicIds[walkerBaseGridOffset] = dword_8E7B28 + (_WORD)dword_9363A8 + v8 + graphic_aqueduct; grid_bitfields[walkerBaseGridOffset] &= 0xF0u; grid_edge[walkerBaseGridOffset] |= 0x40u; grid_aqueducts[walkerBaseGridOffset] = dword_89AA70; } } ++dword_909544; ++walkerBaseGridOffset; } ++dword_909548; walkerBaseGridOffset += 162 - (v15 - v17 + 1); } dword_607FA4 = 0; } void unused_47FEA0() { ; } void unused_47FEC0(int a1, int a2, __int16 a3, __int16 a4) { walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; grid_terrain[walkerBaseGridOffset] = a4; grid_graphicIds[walkerBaseGridOffset] = a3; } void fun_putBuildingOnTerrainAndGraphicGrids(__int16 buildingId, int x, int y, int width, int height, __int16 graphicId, __int16 terrain) { int v7; // [sp+4Ch] [bp-18h]@30 int v8; // [sp+50h] [bp-14h]@29 int i; // [sp+58h] [bp-Ch]@17 int j; // [sp+5Ch] [bp-8h]@19 int v11; // [sp+60h] [bp-4h]@21 if ( mapOrientation ) { switch ( mapOrientation ) { case 6: v8 = width - 1; v7 = height - 1; break; case 4: v8 = width - 1; v7 = 0; break; case 2: v8 = 0; v7 = 0; break; } } else { v8 = 0; v7 = height - 1; } if ( x >= 0 ) { if ( y >= 0 ) { if ( x + width - 1 < setting_map_width ) { if ( y + height - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < height; ++i ) { for ( j = 0; j < width; ++j ) { v11 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; grid_terrain[v11] &= 0x2E80u; grid_terrain[v11] |= terrain; grid_buildingIds[v11] = buildingId; grid_bitfields[v11] &= 0xEFu; grid_bitfields[v11] &= 0xF0u; switch ( width ) { case 2: grid_bitfields[v11] |= 1u; break; case 3: grid_bitfields[v11] |= 2u; break; case 4: grid_bitfields[v11] |= 4u; break; case 5: grid_bitfields[v11] |= 8u; break; } grid_graphicIds[v11] = graphicId; grid_edge[v11] = *(&byte_5F324C[40 * i] + 8 * j); if ( j == v8 ) { if ( i == v7 ) grid_edge[v11] |= 0x40u; } } } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } int sub_480260(__int16 a1, int a2, int a3, int a4, int a5, __int16 a6, __int16 a7) { int result; // eax@5 int v8; // ST58_4@13 int v9; // [sp+4Ch] [bp-10h]@1 int i; // [sp+50h] [bp-Ch]@9 int j; // [sp+54h] [bp-8h]@11 v9 = 0; if ( a2 >= 0 ) { if ( a3 >= 0 ) { result = a4; if ( a2 + a4 - 1 < setting_map_width ) { result = a5; if ( a3 + a5 - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; for ( i = 0; ; ++i ) { result = i; if ( i >= a5 ) break; for ( j = 0; j < a4; ++j ) { v8 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; grid_terrain[v8] &= 0x2E80u; grid_terrain[v8] |= a7; grid_buildingIds[v8] = a1; grid_bitfields[v8] &= 0xEFu; grid_bitfields[v8] &= 0xF0u; grid_edge[v8] |= 0x40u; grid_graphicIds[v8] = v9++ + a6; } } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } return result; } int sub_480460(__int16 a1, int a2, int a3, int a4, signed int a5) { int result; // eax@13 __int16 v6; // cx@21 __int16 v7; // ax@26 __int16 v8; // ax@31 __int16 v9; // ax@36 __int16 v10; // ax@41 __int16 v11; // ax@46 signed int v12; // [sp+4Ch] [bp-14h]@22 signed int v13; // [sp+50h] [bp-10h]@21 signed int i; // [sp+54h] [bp-Ch]@17 signed int j; // [sp+58h] [bp-8h]@19 int v16; // [sp+5Ch] [bp-4h]@21 int v17; // [sp+78h] [bp+18h]@26 int v18; // [sp+78h] [bp+18h]@29 int v19; // [sp+78h] [bp+18h]@34 int v20; // [sp+78h] [bp+18h]@39 int v21; // [sp+78h] [bp+18h]@44 if ( mapOrientation ) { switch ( mapOrientation ) { case 6: v13 = 1; v12 = 1; break; case 4: v13 = 1; v12 = 0; break; case 2: v13 = 0; v12 = 0; break; } } else { v13 = 0; v12 = 1; } if ( a2 >= 0 ) { if ( a3 >= 0 ) { result = a2 + 2; if ( a2 + 2 < setting_map_width ) { if ( a3 + 2 < setting_map_height ) { walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; for ( i = 0; i < 2; ++i ) { for ( j = 0; j < 2; ++j ) { v16 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; grid_terrain[v16] &= 0x2E80u; v6 = grid_terrain[v16]; _LOBYTE(v6) = v6 | 8; grid_terrain[v16] = v6; grid_buildingIds[v16] = a1; grid_bitfields[v16] &= 0xEFu; grid_bitfields[v16] |= 1u; grid_graphicIds[v16] = graphic_farm; grid_edge[v16] = *(&byte_5F324C[40 * i] + 8 * j); if ( j == v13 ) { if ( i == v12 ) grid_edge[v16] |= 0x40u; } } } walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; v17 = a5 / 10; word_9097E8[walkerBaseGridOffset] &= 0x2E80u; v7 = word_9097E8[walkerBaseGridOffset]; _LOBYTE(v7) = v7 | 8; word_9097E8[walkerBaseGridOffset] = v7; word_8F6428[walkerBaseGridOffset] = a1; byte_8E15E4[walkerBaseGridOffset] &= 0xEFu; byte_8C1484[walkerBaseGridOffset] = byte_5F329C; byte_8C1484[walkerBaseGridOffset] |= 0x40u; if ( v17 < 4 ) word_8B48A8[walkerBaseGridOffset] = v17 + a4; else word_8B48A8[walkerBaseGridOffset] = a4 + 4; v18 = v17 - 4; if ( v18 < 0 ) v18 = 0; word_9097EA[walkerBaseGridOffset] &= 0x2E80u; v8 = word_9097EA[walkerBaseGridOffset]; _LOBYTE(v8) = v8 | 8; word_9097EA[walkerBaseGridOffset] = v8; word_8F642A[walkerBaseGridOffset] = a1; byte_8E15E5[walkerBaseGridOffset] &= 0xEFu; byte_8C1485[walkerBaseGridOffset] = byte_5F32A4; byte_8C1485[walkerBaseGridOffset] |= 0x40u; if ( v18 < 4 ) word_8B48AA[walkerBaseGridOffset] = v18 + a4; else word_8B48AA[walkerBaseGridOffset] = a4 + 4; v19 = v18 - 4; if ( v19 < 0 ) v19 = 0; word_9097EC[walkerBaseGridOffset] &= 0x2E80u; v9 = word_9097EC[walkerBaseGridOffset]; _LOBYTE(v9) = v9 | 8; word_9097EC[walkerBaseGridOffset] = v9; word_8F642C[walkerBaseGridOffset] = a1; byte_8E15E6[walkerBaseGridOffset] &= 0xEFu; byte_8C1486[walkerBaseGridOffset] = byte_5F32AC; byte_8C1486[walkerBaseGridOffset] |= 0x40u; if ( v19 < 4 ) word_8B48AC[walkerBaseGridOffset] = v19 + a4; else word_8B48AC[walkerBaseGridOffset] = a4 + 4; v20 = v19 - 4; if ( v20 < 0 ) v20 = 0; grid_terrain_xPlusTwo_yPlusOne[walkerBaseGridOffset] &= 0x2E80u; v10 = grid_terrain_xPlusTwo_yPlusOne[walkerBaseGridOffset]; _LOBYTE(v10) = v10 | 8; grid_terrain_xPlusTwo_yPlusOne[walkerBaseGridOffset] = v10; word_8F62E8[walkerBaseGridOffset] = a1; byte_8E1544[walkerBaseGridOffset] &= 0xEFu; byte_8C13E4[walkerBaseGridOffset] = byte_5F3284; byte_8C13E4[walkerBaseGridOffset] |= 0x40u; if ( v20 < 4 ) word_8B4768[walkerBaseGridOffset] = v20 + a4; else word_8B4768[walkerBaseGridOffset] = a4 + 4; v21 = v20 - 4; if ( v21 < 0 ) v21 = 0; grid_terrain_xPlusTwo_y[walkerBaseGridOffset] &= 0x2E80u; v11 = grid_terrain_xPlusTwo_y[walkerBaseGridOffset]; _LOBYTE(v11) = v11 | 8; grid_terrain_xPlusTwo_y[walkerBaseGridOffset] = v11; word_8F61A4[walkerBaseGridOffset] = a1; byte_8E14A2[walkerBaseGridOffset] &= 0xEFu; byte_8C1342[walkerBaseGridOffset] = byte_5F325C; byte_8C1342[walkerBaseGridOffset] |= 0x40u; if ( v21 < 4 ) { result = walkerBaseGridOffset; word_8B4624[walkerBaseGridOffset] = v21 + a4; } else { result = a4 + 4; word_8B4624[walkerBaseGridOffset] = a4 + 4; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } return result; } int sub_480C60(int a1) { int result; // eax@3 int v2; // [sp+4Ch] [bp-4h]@1 v2 = buildings[a1].gridOffset; ++buildings[a1].grow_value_house_foodstocks[0]; if ( buildings[a1].grow_value_house_foodstocks[0] >= 5 ) buildings[a1].grow_value_house_foodstocks[0] = 0; result = v2; grid_graphicIds[v2] = buildings[a1].grow_value_house_foodstocks[0] + graphic_nativeCrops; return result; } void collapseBuildingToRubble(int buildingId, int x, int y, int width, int height) { __int16 v5; // cx@19 __int16 v6; // dx@21 int i; // [sp+4Ch] [bp-10h]@9 int j; // [sp+50h] [bp-Ch]@11 int mapOffset; // [sp+54h] [bp-8h]@14 int v10; // [sp+58h] [bp-4h]@9 if ( x >= 0 ) { if ( y >= 0 ) { if ( x + width - 1 < setting_map_width ) { if ( y + height - 1 < setting_map_height ) { v10 = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < height; ++i ) { for ( j = 0; j < width; ++j ) { mapOffset = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + v10; if ( grid_buildingIds[mapOffset] == buildingId ) { if ( buildingId ) { if ( buildings[buildingId].type != B_BurningRuin ) rubble_originalBuildingType[mapOffset] = LOBYTE(buildings[buildingId].type); } grid_bitfields[mapOffset] &= 0xEFu; grid_bitfields[mapOffset] &= 0xF0u; grid_aqueducts[mapOffset] = 0; grid_buildingIds[mapOffset] = 0; grid_buildingDamage[mapOffset] = 0; grid_animation[mapOffset] = 0; grid_edge[mapOffset] = 0x40u; v5 = grid_terrain[mapOffset]; if ( v5 & 4 ) { grid_terrain[mapOffset] &= 4u; sub_47DA90(j + x, i + y, 1); } else { grid_terrain[mapOffset] &= 0x2E80u; v6 = grid_terrain[mapOffset]; _HIBYTE(v6) |= 0x10u; grid_terrain[mapOffset] = v6; grid_graphicIds[mapOffset] = (grid_random[mapOffset] & 7) + word_6E6C94; } } } } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } void sub_480FC0(int a1, int a2, int a3) { __int16 v3; // ax@26 int i; // [sp+4Ch] [bp-10h]@15 int j; // [sp+50h] [bp-Ch]@17 int v6; // [sp+54h] [bp-8h]@20 int v7; // [sp+58h] [bp-4h]@9 if ( a2 >= 0 ) { if ( a3 >= 0 ) { if ( a2 < setting_map_width ) { if ( a3 < setting_map_height ) { v7 = sub_481370(a2, a3); if ( grid_terrain[v7] != 2 ) { if ( a1 ) { if ( buildings[a1].type >= 100 ) { if ( buildings[a1].type <= 105 ) { dword_8B45E4 = 3; dword_8B4608 = 3; } } } for ( i = 0; i < dword_8B4608; ++i ) { for ( j = 0; j < dword_8B45E4; ++j ) { v6 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + v7; if ( !a1 || grid_buildingIds[v6] == a1 ) { if ( a1 ) { if ( buildings[a1].type != 99 ) rubble_originalBuildingType[v6] = LOBYTE(buildings[a1].type); } grid_bitfields[v6] &= 0xEFu; grid_bitfields[v6] &= 0xF0u; grid_edge[v6] &= 0x80u; grid_edge[v6] |= 0x40u; grid_aqueducts[v6] = 0; grid_buildingIds[v6] = 0; grid_buildingDamage[v6] = 0; grid_animation[v6] = 0; v3 = grid_terrain[v6]; if ( v3 & 4 ) { grid_terrain[v6] &= 4u; sub_47DA90(j + a2, i + a3, 1); } else { grid_graphicIds[v6] = (grid_random[v6] & 7) + graphic_terrain_uglygrass; grid_terrain[v6] &= 0x2E80u; } } } } sub_479720(a2, a3, dword_8B45E4 + a2, dword_8B4608 + a3); sub_479F40(a2, a3, dword_8B45E4 + a2, dword_8B4608 + a3); sub_47A140(a2, a3, dword_8B45E4 + a2, dword_8B4608 + a3); } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } int sub_481370(int a1, int a2) { int j; // [sp+4Ch] [bp-Ch]@15 int i; // [sp+50h] [bp-8h]@10 int v5; // [sp+54h] [bp-4h]@1 v5 = 162 * a2 + a1 + setting_map_startGridOffset; if ( *(&grid_bitfields[162 * a2] + a1 + setting_map_startGridOffset) & 1 ) { dword_8B45E4 = 2; dword_8B4608 = 2; } else { if ( grid_bitfields[v5] & 2 ) { dword_8B45E4 = 3; dword_8B4608 = 3; } else { if ( grid_bitfields[v5] & 4 ) { dword_8B45E4 = 4; dword_8B4608 = 4; } else { if ( grid_bitfields[v5] & 8 ) { dword_8B45E4 = 5; dword_8B4608 = 5; } else { dword_8B45E4 = 1; dword_8B4608 = 1; } } } } for ( i = 0; i < dword_8B45E4 && grid_edge[v5] & 7; ++i ) --v5; for ( j = 0; j < dword_8B4608 && grid_edge[v5] & 0x38; ++j ) v5 -= 162; return v5; } signed int fun_terrainIsClear(int x, int y, int width, int height, unsigned __int16 terrainMask, int a6) { signed int result; // eax@2 int i; // [sp+58h] [bp-10h]@9 int j; // [sp+5Ch] [bp-Ch]@11 int v9; // [sp+64h] [bp-4h]@14 if ( x >= 0 ) { if ( y >= 0 ) { if ( x + width - 1 < setting_map_width ) { if ( y + height - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < height; ++i ) { for ( j = 0; j < width; ++j ) { v9 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; if ( terrainMask & (unsigned __int16)grid_terrain[v9] & 0xD77F ) return 0; if ( grid_walkerIds[v9] ) return 0; if ( a6 && grid_graphicIds[v9] != a6 - 1 ) return 0; } } result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } int unused_4816D0(int a1, int a2, int a3, int a4) { int result; // eax@5 int v5; // eax@13 int i; // [sp+4Ch] [bp-Ch]@9 int j; // [sp+50h] [bp-8h]@11 if ( a1 >= 0 ) { if ( a2 >= 0 ) { result = a3; if ( a1 + a3 - 1 < setting_map_width ) { result = a4; if ( a2 + a4 - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; ; ++i ) { result = i; if ( i >= a4 ) break; for ( j = 0; j < a3; ++j ) { v5 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; grid_bitfields[v5] &= 0xEFu; } } } } } } return result; } int sub_4817E0(int a1, int a2, int a3, int a4, int a5) { int result; // eax@5 int i; // [sp+4Ch] [bp-Ch]@9 int j; // [sp+50h] [bp-8h]@11 if ( a2 >= 0 ) { if ( a3 >= 0 ) { result = a4; if ( a2 + a4 - 1 < setting_map_width ) { result = a5; if ( a3 + a5 - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; for ( i = 0; ; ++i ) { result = i; if ( i >= a5 ) break; for ( j = 0; j < a4; ++j ) { if ( !a1 ) grid_pathingDistance[*(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset] = 0; } } } } } } return result; } signed int sub_4818F0(int a1, int a2, int a3, int a4, int a5, int a6) { signed int result; // eax@2 int i; // [sp+50h] [bp-Ch]@9 int j; // [sp+54h] [bp-8h]@11 int v9; // [sp+58h] [bp-4h]@14 if ( a1 >= 0 ) { if ( a2 >= 0 ) { if ( a1 + a3 - 1 < setting_map_width ) { if ( a2 + a4 - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; i < a4; ++i ) { for ( j = 0; j < a3; ++j ) { v9 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; if ( (unsigned __int16)(grid_terrain[v9] & 0xD77F) != a5 ) return 0; if ( a6 && grid_graphicIds[v9] != a6 - 1 ) return 0; } } result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int sub_481A50(int a1, int a2, int a3) { signed int result; // eax@11 __int16 v4; // ax@23 __int16 v5; // ax@24 __int16 v6; // ax@26 __int16 v7; // ax@30 __int16 v8; // ax@32 __int16 v9; // ax@36 __int16 v10; // cx@41 __int16 v11; // ax@43 __int16 v12; // dx@45 int v13; // [sp+4Ch] [bp-18h]@22 int v14; // [sp+54h] [bp-10h]@20 int v15; // [sp+58h] [bp-Ch]@20 signed int i; // [sp+5Ch] [bp-8h]@20 signed int j; // [sp+5Ch] [bp-8h]@39 int v18; // [sp+60h] [bp-4h]@18 if ( a3 == 1 ) { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: --a2; break; case 4: --a1; --a2; break; case 2: --a1; break; } } } if ( a1 >= 0 ) { if ( a2 >= 0 ) { if ( a1 + 1 < setting_map_width ) { if ( a2 + 1 < setting_map_height ) { v18 = 162 * a2 + a1 + setting_map_startGridOffset; for ( dword_89AA88 = 0; dword_89AA88 < 4; ++dword_89AA88 ) { v15 = 0; v14 = 0; for ( i = 0; i < 4; ++i ) { v13 = dword_5F3538[i]; if ( *(int *)((char *)&dword_5F9E00[4 * dword_89AA88] + 4 * i) ) { v4 = grid_terrain[v13 + v18]; if ( !(v4 & 4) ) break; ++v14; v5 = grid_terrain[v13 + v18]; if ( v5 & 0x40 ) ++v15; v6 = grid_terrain[v13 + v18]; if ( v6 & 1 ) ++v15; } else { v7 = grid_terrain[v13 + v18]; if ( v7 & 4 ) break; ++v14; v8 = grid_terrain[v13 + v18]; if ( v8 & 0x40 ) { ++v15; } else { if ( grid_terrain[v13 + v18] & 0x1237 ) { ++v15; } else { v9 = grid_terrain[v13 + v18]; if ( v9 & 8 ) ++v15; } } } } for ( j = 0; j < 2; ++j ) { v10 = grid_terrain[*(int *)((char *)&dword_5F9E40[2 * dword_89AA88] + 4 * j) + v18]; if ( !(v10 & 4) ) v14 = 0; v11 = grid_terrain[*(int *)((char *)&dword_5F9E60[2 * dword_89AA88] + 4 * j) + v18]; if ( !(v11 & 4) ) v14 = 0; v12 = grid_terrain[*(int *)((char *)&dword_5F9E80[2 * dword_89AA88] + 4 * j) + v18]; if ( !(v12 & 4) ) v14 = 0; } if ( v14 == 4 ) { dword_8E1468 = dword_89AA88; dword_89AA88 -= setting_map_orientation / 2; dword_89AA88 += dword_89AA88 < 0 ? 4 : 0; return v15; } } result = 999; } else { result = 999; } } else { result = 999; } } else { result = 999; } } else { result = 999; } return result; } int sub_481E70(__int16 a1, int a2, int a3, __int16 a4) { int result; // eax@13 __int16 v5; // dx@21 __int16 v6; // dx@21 __int16 v7; // cx@23 signed int v8; // [sp+4Ch] [bp-18h]@25 signed int v9; // [sp+50h] [bp-14h]@24 signed int v10; // [sp+54h] [bp-10h]@17 signed int v11; // [sp+58h] [bp-Ch]@19 int v12; // [sp+5Ch] [bp-8h]@17 int v13; // [sp+60h] [bp-4h]@21 if ( mapOrientation ) { switch ( mapOrientation ) { case 6: v9 = 1; v8 = 1; break; case 4: v9 = 1; v8 = 0; break; case 2: v9 = 0; v8 = 0; break; } } else { v9 = 0; v8 = 1; } if ( a2 >= 0 ) { if ( a3 >= 0 ) { result = a2 + 1; if ( a2 + 1 < setting_map_width ) { if ( a3 + 1 < setting_map_height ) { result = 162 * a3; walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; v10 = 0; v12 = 0; while ( v10 < 2 ) { v11 = 0; while ( v11 < 2 ) { v13 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * v10] + 8 * v11) + walkerBaseGridOffset; v5 = grid_terrain[v13]; _LOBYTE(v5) = v5 | 8; grid_terrain[v13] = v5; v6 = grid_terrain[v13]; if ( !(v6 & 4) ) { grid_terrain[v13] &= 0x2E80u; v7 = grid_terrain[v13]; _LOBYTE(v7) = v7 | 8; grid_terrain[v13] = v7; } grid_buildingIds[v13] = a1; grid_bitfields[v13] &= 0xEFu; grid_bitfields[v13] |= 1u; grid_graphicIds[v13] = a4; grid_edge[v13] = *(&byte_5F324C[40 * v10] + 8 * v11); if ( v11 == v9 ) { if ( v10 == v8 ) grid_edge[v13] |= 0x40u; } ++v11; result = v12++ + 1; } ++v10; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } return result; } signed int sub_482140(int a1, int a2, int a3) { signed int result; // eax@11 __int16 v4; // ax@23 __int16 v5; // ax@24 __int16 v6; // ax@26 __int16 v7; // ax@30 __int16 v8; // ax@32 __int16 v9; // ax@36 __int16 v10; // cx@41 int v11; // [sp+4Ch] [bp-18h]@22 int v12; // [sp+54h] [bp-10h]@20 int v13; // [sp+58h] [bp-Ch]@20 signed int i; // [sp+5Ch] [bp-8h]@20 signed int j; // [sp+5Ch] [bp-8h]@39 int v16; // [sp+60h] [bp-4h]@18 if ( a3 == 1 ) { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: a2 -= 2; break; case 4: a1 -= 2; a2 -= 2; break; case 2: a1 -= 2; break; } } } if ( a1 >= 0 ) { if ( a2 >= 0 ) { if ( a1 + 2 < setting_map_width ) { if ( a2 + 2 < setting_map_height ) { v16 = 162 * a2 + a1 + setting_map_startGridOffset; for ( dword_89AA88 = 0; dword_89AA88 < 4; ++dword_89AA88 ) { v13 = 0; v12 = 0; for ( i = 0; i < 9; ++i ) { v11 = dword_5F355C[i]; if ( *(int *)((char *)&dword_5F9EA0[9 * dword_89AA88] + 4 * i) ) { v4 = grid_terrain[v11 + v16]; if ( !(v4 & 4) ) break; ++v12; v5 = grid_terrain[v11 + v16]; if ( v5 & 0x40 ) ++v13; v6 = grid_terrain[v11 + v16]; if ( v6 & 1 ) ++v13; } else { v7 = grid_terrain[v11 + v16]; if ( v7 & 4 ) break; ++v12; v8 = grid_terrain[v11 + v16]; if ( v8 & 0x40 ) { ++v13; } else { if ( grid_terrain[v11 + v16] & 0x1237 ) { ++v13; } else { v9 = grid_terrain[v11 + v16]; if ( v9 & 8 ) ++v13; } } } } for ( j = 0; j < 2; ++j ) { v10 = grid_terrain[*(int *)((char *)&dword_5F9F30[2 * dword_89AA88] + 4 * j) + v16]; if ( !(v10 & 4) ) v12 = 0; } if ( v12 == 9 ) { dword_8E1468 = dword_89AA88; dword_89AA88 -= setting_map_orientation / 2; dword_89AA88 += dword_89AA88 < 0 ? 4 : 0; return v13; } } result = 999; } else { result = 999; } } else { result = 999; } } else { result = 999; } } else { result = 999; } return result; } int sub_4824E0(__int16 a1, int a2, int a3, __int16 a4) { int result; // eax@13 __int16 v5; // dx@21 __int16 v6; // dx@21 __int16 v7; // cx@23 signed int v8; // [sp+4Ch] [bp-18h]@25 signed int v9; // [sp+50h] [bp-14h]@24 signed int v10; // [sp+54h] [bp-10h]@17 signed int v11; // [sp+58h] [bp-Ch]@19 int v12; // [sp+5Ch] [bp-8h]@17 int v13; // [sp+60h] [bp-4h]@21 if ( mapOrientation ) { switch ( mapOrientation ) { case 6: v9 = 2; v8 = 2; break; case 4: v9 = 2; v8 = 0; break; case 2: v9 = 0; v8 = 0; break; } } else { v9 = 0; v8 = 2; } if ( a2 >= 0 ) { if ( a3 >= 0 ) { result = a2 + 2; if ( a2 + 2 < setting_map_width ) { if ( a3 + 2 < setting_map_height ) { result = 162 * a3; walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; v10 = 0; v12 = 0; while ( v10 < 3 ) { v11 = 0; while ( v11 < 3 ) { v13 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * v10] + 8 * v11) + walkerBaseGridOffset; v5 = grid_terrain[v13]; _LOBYTE(v5) = v5 | 8; grid_terrain[v13] = v5; v6 = grid_terrain[v13]; if ( !(v6 & 4) ) { grid_terrain[v13] &= 0x2E80u; v7 = grid_terrain[v13]; _LOBYTE(v7) = v7 | 8; grid_terrain[v13] = v7; } grid_buildingIds[v13] = a1; grid_bitfields[v13] &= 0xEFu; grid_bitfields[v13] |= 2u; grid_graphicIds[v13] = a4; grid_edge[v13] = *(&byte_5F324C[40 * v10] + 8 * v11); if ( v11 == v9 ) { if ( v10 == v8 ) grid_edge[v13] |= 0x40u; } ++v11; result = v12++ + 1; } ++v10; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } } else { dword_8E146C = 1; } return result; } signed int sub_4827B0(int a1, int a2, int a3) { signed int result; // eax@2 signed int v4; // [sp+4Ch] [bp-1Ch]@15 int v5; // [sp+50h] [bp-18h]@13 int v6; // [sp+54h] [bp-14h]@13 int v7; // [sp+58h] [bp-10h]@11 int v8; // [sp+5Ch] [bp-Ch]@11 signed int i; // [sp+60h] [bp-8h]@11 int v10; // [sp+64h] [bp-4h]@9 if ( a1 >= 0 ) { if ( a2 >= 0 ) { if ( a1 + 1 < setting_map_width ) { if ( a2 + 1 < setting_map_height ) { v10 = 162 * a2 + a1 + setting_map_startGridOffset; for ( dword_8B4604 = 0; ; ++dword_8B4604 ) { if ( dword_8B4604 >= 4 ) return 999; v8 = 0; v7 = 0; for ( i = 0; i < 6; ++i ) { v6 = dword_5F9F50[i]; v5 = *(int *)((char *)&dword_5F9F68[6 * dword_8B4604] + 4 * i); if ( v6 == 2 ) { if ( grid_terrain[v5 + v10] & 0x200 ) { if ( *(&grid_elevation[v5] + v10) == v4 ) ++v8; else ++v7; } else { if ( *(&grid_elevation[v5] + v10) < v4 ) { if ( *(&grid_elevation[v5] + v10) >= v4 ) ++v7; else ++v8; } else { ++v7; } } } else { if ( v6 == 1 ) { if ( grid_terrain[v5 + v10] & 0x200 ) ++v7; else ++v8; v4 = *(&grid_elevation[v5] + v10); } else { if ( grid_terrain[v5 + v10] & 0x200 ) { ++v8; } else { if ( !a3 || grid_terrain[v5 + v10] & 0x400 ) { if ( a3 || !(grid_terrain[v5 + v10] & 0x400) ) { if ( *(&grid_elevation[v5] + v10) <= v4 - 1 ) ++v7; else ++v8; } else { ++v8; } } else { ++v8; } } } } } if ( v7 == 6 ) break; } if ( mapOrientation ) { switch ( mapOrientation ) { case 6: ++dword_8B4604; if ( dword_8B4604 >= 4 ) dword_8B4604 -= 4; break; case 4: dword_8B4604 += 2; if ( dword_8B4604 >= 4 ) dword_8B4604 -= 4; break; case 2: dword_8B4604 += 3; if ( dword_8B4604 >= 4 ) dword_8B4604 -= 4; break; } } else { if ( dword_8B4604 >= 4 ) dword_8B4604 -= 4; } result = 0; } else { result = 999; } } else { result = 999; } } else { result = 999; } } else { result = 999; } return result; } int sub_482BD0(int size, int x, int y, __int16 a4, int a5) { int result; // eax@1 __int16 v6; // ST4C_2@22 int i; // [sp+54h] [bp-10h]@18 int j; // [sp+58h] [bp-Ch]@20 int v9; // [sp+60h] [bp-4h]@22 result = size; dword_8B4608 = size; dword_8B45E4 = dword_8B4608; if ( !a5 ) { if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: y = y - size + 1; break; case 4: result = x - size + 1; x = x - size + 1; y = y - size + 1; break; case 2: x = x - size + 1; result = y; break; } } else { result = y; } } if ( x >= 0 ) { if ( y >= 0 ) { result = x + dword_8B45E4 - 1; if ( result < setting_map_width ) { result = y + dword_8B4608 - 1; if ( result < setting_map_height ) { walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < dword_8B4608; ++i ) { for ( j = 0; j < dword_8B45E4; ++j ) { v9 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; v6 = a4 & grid_terrain[v9]; result = v6 & 0xD77F; if ( v6 & 0xD77F || grid_walkerIds[v9] ) return result; } } result = sub_482DE0(/*i*/); } } } } return result; } int sub_482DE0() { int v0; // ecx@5 int result; // eax@6 int i; // [sp+50h] [bp-8h]@1 int j; // [sp+54h] [bp-4h]@3 dword_9DA7C8 = 1; for ( i = 0; i < dword_8B4608; ++i ) { for ( j = 0; j < dword_8B45E4; ++j ) { v0 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; grid_bitfields[v0] |= 0x10u; } result = i + 1; } return result; } int fun_isTerrainFree(int size, int x, int y, unsigned __int16 mask) { signed int result; // eax@10 int i; // [sp+54h] [bp-Ch]@17 int j; // [sp+58h] [bp-8h]@19 dword_8B4608 = size; dword_8B45E4 = dword_8B4608; if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: y = y - size + 1; break; case 4: x = x - size + 1; y = y - size + 1; break; case 2: x = x - size + 1; break; } } if ( x >= 0 ) { if ( y >= 0 ) { if ( x + dword_8B45E4 - 1 < setting_map_width ) { if ( y + dword_8B4608 - 1 < setting_map_height ) { walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < dword_8B4608; ++i ) { for ( j = 0; j < dword_8B45E4; ++j ) { if ( mask & (unsigned __int16)grid_terrain[*(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset] & 0xD77F ) return 0; } } result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } int unused_483090(int a1, int a2, int a3) { int result; // eax@1 int v4; // edx@13 int i; // [sp+50h] [bp-Ch]@9 int j; // [sp+54h] [bp-8h]@11 result = a1; dword_8B4608 = a1; dword_8B45E4 = dword_8B4608; if ( a2 >= 0 ) { if ( a3 >= 0 ) { result = a2; if ( a2 + dword_8B45E4 - 1 < setting_map_width ) { result = a3; if ( a3 + dword_8B4608 - 1 < setting_map_height ) { result = 162 * a3; walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; for ( i = 0; i < dword_8B4608; ++i ) { for ( j = 0; j < dword_8B45E4; ++j ) { v4 = *(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + walkerBaseGridOffset; grid_bitfields[v4] &= 0xEFu; result = j + 1; } } } } } } return result; } void sub_4831E0() { sub_4837C0(1); dword_8E1484 = 0; sub_4833A0(); sub_47C480(0, 0, setting_map_width - 2, setting_map_height - 2); sub_478CE0(0, 0, setting_map_width - 1, setting_map_height - 1); sub_479C80(0, 0, setting_map_width - 1, setting_map_height - 1); sub_478E40(); sub_479240(); sub_4837C0(0); sub_479720(0, 0, setting_map_width - 1, setting_map_height - 1); sub_479F40(0, 0, setting_map_width - 1, setting_map_height - 1); sub_47A140(0, 0, setting_map_width - 1, setting_map_height - 1); sub_47F400(); sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); sub_47E590(); sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); sub_46F260(); sub_487CD0(); sub_500420(); sub_4A7A70(); sub_4B2CA0(); } int sub_4833A0() { int result; // eax@2 int v1; // [sp+4Ch] [bp-14h]@5 int v2; // [sp+50h] [bp-10h]@5 int v3; // [sp+54h] [bp-Ch]@1 int v4; // [sp+58h] [bp-8h]@1 int v5; // [sp+5Ch] [bp-4h]@3 v3 = setting_map_startGridOffset; v4 = 0; while ( 1 ) { result = v4; if ( v4 >= setting_map_height ) break; v5 = 0; while ( v5 < setting_map_width ) { v2 = grid_bitfields[v3] & 0xF; v1 = grid_edge[v3] & 0x3F; if ( grid_bitfields[v3] & 0xF ) { grid_edge[v3] &= 0xBFu; switch ( v2 ) { case 1: if ( mapOrientation || v1 != 8 ) { if ( mapOrientation != 6 || v1 != 9 ) { if ( mapOrientation != 4 || v1 != 1 ) { if ( mapOrientation == 2 ) { if ( !v1 ) grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } break; case 2: if ( mapOrientation || v1 != 16 ) { if ( mapOrientation != 6 || v1 != 18 ) { if ( mapOrientation != 4 || v1 != 2 ) { if ( mapOrientation == 2 ) { if ( !v1 ) grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } break; case 4: if ( mapOrientation || v1 != 24 ) { if ( mapOrientation != 6 || v1 != 27 ) { if ( mapOrientation != 4 || v1 != 3 ) { if ( mapOrientation == 2 ) { if ( !v1 ) grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } break; case 8: if ( mapOrientation || v1 != 32 ) { if ( mapOrientation != 6 || v1 != 36 ) { if ( mapOrientation != 4 || v1 != 4 ) { if ( mapOrientation == 2 ) { if ( !v1 ) grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } } else { grid_edge[v3] |= 0x40u; } break; } } else { grid_edge[v3] |= 0x40u; } ++v5; ++v3; } ++v4; v3 += setting_map_gridBorderSize; } return result; } void sub_4837C0(int a1) { __int16 v1; // ax@2 __int16 v2; // dx@2 __int16 v3; // dx@27 __int16 v4; // cx@36 signed int v5; // [sp+4Ch] [bp-14h]@27 signed int v6; // [sp+4Ch] [bp-14h]@36 signed int exit_orientation; // [sp+50h] [bp-10h]@13 signed int entry_orientation; // [sp+54h] [bp-Ch]@4 int v9; // [sp+58h] [bp-8h]@22 int v10; // [sp+58h] [bp-8h]@27 int v11; // [sp+58h] [bp-8h]@31 int v12; // [sp+58h] [bp-8h]@36 signed int i; // [sp+5Ch] [bp-4h]@22 signed int j; // [sp+5Ch] [bp-4h]@31 if ( a1 ) { v1 = grid_terrain[162 * dword_607F98 + dword_607F94 + setting_map_startGridOffset]; _LOBYTE(v1) = v1 & 0xFD; grid_terrain[162 * dword_607F98 + dword_607F94 + setting_map_startGridOffset] = v1; v2 = grid_terrain[162 * dword_607FA0 + dword_607F9C + setting_map_startGridOffset]; _LOBYTE(v2) = v2 & 0xFD; grid_terrain[162 * dword_607FA0 + dword_607F9C + setting_map_startGridOffset] = v2; } else { if ( scn_entryPoint_x ) { if ( scn_entryPoint_x == setting_map_width - 1 ) { entry_orientation = 6; } else { if ( scn_entryPoint_y ) { if ( scn_entryPoint_y == setting_map_height - 1 ) entry_orientation = 4; else entry_orientation = -1; } else { entry_orientation = 0; } } } else { entry_orientation = 2; } if ( scn_exitPoint_x ) { if ( scn_exitPoint_x == setting_map_width - 1 ) { exit_orientation = 6; } else { if ( scn_exitPoint_y ) { if ( scn_exitPoint_y == setting_map_height - 1 ) exit_orientation = 4; else exit_orientation = -1; } else { exit_orientation = 0; } } } else { exit_orientation = 2; } if ( entry_orientation >= 0 ) { v9 = 162 * scn_entryPoint_y + scn_entryPoint_x + setting_map_startGridOffset; for ( i = 1; i < 10 && !sub_48D480(scn_entryPoint_x, scn_entryPoint_y, 1, i, v9); ++i ) ; v10 = 162 * walkerGridY + walkerGridX + setting_map_startGridOffset; dword_607F94 = walkerGridX; dword_607F98 = walkerGridY; v3 = grid_terrain[162 * walkerGridY + walkerGridX + setting_map_startGridOffset]; _LOBYTE(v3) = v3 | 2; grid_terrain[162 * walkerGridY + walkerGridX + setting_map_startGridOffset] = v3; dword_8E7B24 = v10; v5 = mapOrientation + entry_orientation; if ( mapOrientation + entry_orientation >= 8 ) v5 -= 8; grid_graphicIds[v10] = v5 / 2 + word_6E6D90; } if ( exit_orientation >= 0 ) { v11 = 162 * scn_exitPoint_y + scn_exitPoint_x + setting_map_startGridOffset; for ( j = 1; j < 10 && !sub_48D480(scn_exitPoint_x, scn_exitPoint_y, 1, j, v11); ++j ) ; v12 = 162 * walkerGridY + walkerGridX + setting_map_startGridOffset; dword_607F9C = walkerGridX; dword_607FA0 = walkerGridY; v4 = grid_terrain[162 * walkerGridY + walkerGridX + setting_map_startGridOffset]; _LOBYTE(v4) = v4 | 2; grid_terrain[162 * walkerGridY + walkerGridX + setting_map_startGridOffset] = v4; dword_89AA64 = v12; v6 = mapOrientation + exit_orientation; if ( mapOrientation + exit_orientation >= 8 ) v6 -= 8; grid_graphicIds[v12] = word_6E6D90 + v6 / 2 + 4; } } } void sub_483BF0(__int16 a1) { dword_8A11C0[0] = a1 & grid_terrain_x_yMinusOne[walkerBaseGridOffset]; dword_8A11C4 = a1 & grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset]; dword_8A11C8 = a1 & grid_terrain_xPlusOne_y[walkerBaseGridOffset]; dword_8A11CC = a1 & grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset]; dword_8A11D0 = a1 & grid_terrain_x_yPlusOne[walkerBaseGridOffset]; dword_8A11D4 = a1 & grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset]; dword_8A11D8 = a1 & grid_terrain_xMinusOne_y[walkerBaseGridOffset]; dword_8A11DC = a1 & grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset]; } void sub_483D00() { __int16 v0; // cx@1 __int16 v1; // dx@5 __int16 v2; // ax@9 __int16 v3; // cx@13 __int16 v4; // dx@17 __int16 v5; // ax@21 __int16 v6; // cx@25 __int16 v7; // dx@29 v0 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; dword_8A11C0[0] = v0 & 2 && byte_8E13FE[walkerBaseGridOffset] & 0x80; v1 = grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset]; dword_8A11C4 = v1 & 2 && byte_8E13FF[walkerBaseGridOffset] & 0x80; v2 = grid_terrain_xPlusOne_y[walkerBaseGridOffset]; dword_8A11C8 = v2 & 2 && byte_8E14A1[walkerBaseGridOffset] & 0x80; v3 = grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset]; dword_8A11CC = v3 & 2 && byte_8E1543[walkerBaseGridOffset] & 0x80; v4 = grid_terrain_x_yPlusOne[walkerBaseGridOffset]; dword_8A11D0 = v4 & 2 && byte_8E1542[walkerBaseGridOffset] & 0x80; v5 = grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset]; dword_8A11D4 = v5 & 2 && byte_8E1541[walkerBaseGridOffset] & 0x80; v6 = grid_terrain_xMinusOne_y[walkerBaseGridOffset]; dword_8A11D8 = v6 & 2 && byte_8E149F[walkerBaseGridOffset] & 0x80; v7 = grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset]; dword_8A11DC = v7 & 2 && byte_8E13FD[walkerBaseGridOffset] & 0x80; } bool sub_483FB0() { dword_8A11DC = 0; dword_8A11D4 = dword_8A11DC; dword_8A11CC = dword_8A11D4; dword_8A11C4 = dword_8A11CC; dword_8A11C0[0] = grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x8000; dword_8A11C8 = grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x8000; dword_8A11D0 = grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x8000; dword_8A11D8 = grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x8000; return dword_8A11C0[0] || dword_8A11C8 || dword_8A11D0 || dword_8A11D8; } signed int sub_4840B0(int a1) { __int16 v1; // cx@1 __int16 v2; // ax@1 __int16 v3; // dx@1 __int16 v4; // cx@1 __int16 v5; // ax@1 __int16 v6; // ax@10 __int16 v7; // ax@19 __int16 v8; // ax@28 signed int v10; // [sp+4Ch] [bp-8h]@37 int v11; // [sp+50h] [bp-4h]@2 int v12; // [sp+50h] [bp-4h]@11 int v13; // [sp+50h] [bp-4h]@20 int v14; // [sp+50h] [bp-4h]@29 v1 = grid_terrain_x_yMinusOne[a1]; dword_8A11C0[0] = v1 & 0x40; v2 = grid_terrain_xPlusOne_y[a1]; dword_8A11C8 = v2 & 0x40; v3 = grid_terrain_x_yPlusOne[a1]; dword_8A11D0 = v3 & 0x40; v4 = grid_terrain_xMinusOne_y[a1]; dword_8A11D8 = v4 & 0x40; v5 = grid_terrain_x_yMinusOne[a1]; if ( v5 & 8 ) { v11 = word_8F605C[a1]; if ( buildings[v11].type == B_Gatehouse ) { dword_8A11C0[0] = buildings[v11].level_resourceId == 1; } else { if ( buildings[v11].type == B_Granary ) { if ( !grid_groundType_162[a1] ) dword_8A11C0[0] = 1; } } } v6 = grid_terrain_xPlusOne_y[a1]; if ( v6 & 8 ) { v12 = word_8F61A2[a1]; if ( buildings[v12].type == B_Gatehouse ) { dword_8A11C8 = buildings[v12].level_resourceId == 2; } else { if ( buildings[v12].type == B_Granary ) { if ( !grid_groundType1[a1] ) dword_8A11C8 = 1; } } } v7 = grid_terrain_x_yPlusOne[a1]; if ( v7 & 8 ) { v13 = word_8F62E4[a1]; if ( buildings[v13].type == B_Gatehouse ) { dword_8A11D0 = buildings[v13].level_resourceId == 1; } else { if ( buildings[v13].type == B_Granary ) { if ( !grid_groundType162[a1] ) dword_8A11D0 = 1; } } } v8 = grid_terrain_xMinusOne_y[a1]; if ( v8 & 8 ) { v14 = word_8F619E[a1]; if ( buildings[v14].type == B_Gatehouse ) { dword_8A11D8 = buildings[v14].level_resourceId == 2; } else { if ( buildings[v14].type == B_Granary ) { if ( !grid_groundType_1[a1] ) dword_8A11D8 = 1; } } } v10 = 0; if ( dword_8A11C0[0] ) v10 = 1; if ( dword_8A11C8 ) ++v10; if ( dword_8A11D0 ) ++v10; if ( dword_8A11D8 ) ++v10; if ( v10 == 4 ) { if ( buildings[grid_buildingIds[a1]].type == B_Granary ) v10 = 2; } return v10; } signed int sub_484470(int a1) { __int16 v1; // ax@1 __int16 v2; // cx@7 __int16 v3; // dx@13 __int16 v4; // ax@19 signed int v6; // [sp+4Ch] [bp-8h]@25 int v7; // [sp+50h] [bp-4h]@2 int v8; // [sp+50h] [bp-4h]@8 int v9; // [sp+50h] [bp-4h]@14 int v10; // [sp+50h] [bp-4h]@20 dword_8A11DC = 0; dword_8A11D4 = dword_8A11DC; dword_8A11CC = dword_8A11D4; dword_8A11C4 = dword_8A11CC; dword_8A11C0[0] = grid_terrain_x_yMinusOne[a1] & 0x440; dword_8A11C8 = grid_terrain_xPlusOne_y[a1] & 0x440; dword_8A11D0 = grid_terrain_x_yPlusOne[a1] & 0x440; dword_8A11D8 = grid_terrain_xMinusOne_y[a1] & 0x440; v1 = grid_terrain_x_yMinusOne[a1]; if ( v1 & 8 ) { v7 = word_8F605C[a1]; if ( buildings[v7].type == B_Gatehouse ) { dword_8A11C0[0] = 0; } else { if ( buildings[v7].type == B_Granary ) { if ( !grid_groundType_162[a1] ) dword_8A11C0[0] = 1; } } } v2 = grid_terrain_xPlusOne_y[a1]; if ( v2 & 8 ) { v8 = word_8F61A2[a1]; if ( buildings[v8].type == B_Gatehouse ) { dword_8A11C8 = 0; } else { if ( buildings[v8].type == B_Granary ) { if ( !grid_groundType1[a1] ) dword_8A11C8 = 1; } } } v3 = grid_terrain_x_yPlusOne[a1]; if ( v3 & 8 ) { v9 = word_8F62E4[a1]; if ( buildings[v9].type == B_Gatehouse ) { dword_8A11D0 = 0; } else { if ( buildings[v9].type == B_Granary ) { if ( !grid_groundType162[a1] ) dword_8A11D0 = 1; } } } v4 = grid_terrain_xMinusOne_y[a1]; if ( v4 & 8 ) { v10 = word_8F619E[a1]; if ( buildings[v10].type == B_Gatehouse ) { dword_8A11D8 = 0; } else { if ( buildings[v10].type == B_Granary ) { if ( !grid_groundType_1[a1] ) dword_8A11D8 = 1; } } } v6 = 0; if ( dword_8A11C0[0] ) v6 = 1; if ( dword_8A11C8 ) ++v6; if ( dword_8A11D0 ) ++v6; if ( dword_8A11D8 ) ++v6; return v6; } int sub_4847A0(int a1) { int v2; // [sp+4Ch] [bp-Ch]@4 int v3; // [sp+50h] [bp-8h]@4 signed int i; // [sp+54h] [bp-4h]@1 signed int v5; // [sp+54h] [bp-4h]@4 dword_8A11C4 = grid_terrain_xPlusOne_yMinusOne[a1] & 0x440; dword_8A11CC = grid_terrain_xPlusOne_yPlusOne[a1] & 0x440; dword_8A11D4 = grid_terrain_xMinusOne_yPlusOne[a1] & 0x440; dword_8A11DC = grid_terrain_xMinusOne_yMinusOne[a1] & 0x440; for ( i = 0; i < 8; ++i ) dword_8A11E0[i] = dword_8A11C0[i]; v2 = 0; dword_8C7A10 = 0; v5 = 0; v3 = 0; while ( v5 < 16 ) { if ( dword_8A11C0[v5] ) { if ( v5 < 8 ) ++dword_8C7A10; ++v3; if ( v3 > v2 ) v2 = v3; } else { v3 = 0; } ++v5; } return v2; } void sub_484900() { int v0; // [sp+4Ch] [bp-4h]@2 int v1; // [sp+4Ch] [bp-4h]@6 int v2; // [sp+4Ch] [bp-4h]@10 int v3; // [sp+4Ch] [bp-4h]@14 if ( grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x8000 ) { v0 = word_8F605C[walkerBaseGridOffset]; if ( buildings[v0].type == 58 ) { if ( buildings[v0].level_resourceId == 1 ) dword_8A11C0[0] = 1; } } if ( grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x8000 ) { v1 = word_8F61A2[walkerBaseGridOffset]; if ( buildings[v1].type == 58 ) { if ( buildings[v1].level_resourceId == 2 ) dword_8A11C8 = 1; } } if ( grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x8000 ) { v2 = word_8F62E4[walkerBaseGridOffset]; if ( buildings[v2].type == 58 ) { if ( buildings[v2].level_resourceId == 1 ) dword_8A11D0 = 1; } } if ( grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x8000 ) { v3 = word_8F619E[walkerBaseGridOffset]; if ( buildings[v3].type == 58 ) { if ( buildings[v3].level_resourceId == 2 ) dword_8A11D8 = 1; } } } int sub_484AD0(int gridOffset) { int result; // eax@2 if ( grid_terrain[gridOffset + walkerBaseGridOffset] & 0x8000u )// gatehouse result = grid_buildingIds[gridOffset + walkerBaseGridOffset]; else result = 0; return result; } signed int sub_484B20(int a1, int a2) { signed int v3; // [sp+4Ch] [bp-4h]@1 v3 = 0; switch ( a1 ) { case -162: if ( grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset] & 0x8000 && word_8F605E[walkerBaseGridOffset] == a2 ) { v3 = 1; if ( !(grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 2; } if ( !(grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } else { if ( grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset] & 0x8000 ) { if ( word_8F605A[walkerBaseGridOffset] == a2 ) { v3 = 3; if ( !(grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 4; } if ( !(grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } } } break; case -1: if ( grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset] & 0x8000 && word_8F62E2[walkerBaseGridOffset] == a2 ) { v3 = 1; if ( !(grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 2; } if ( !(grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } else { if ( grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset] & 0x8000 ) { if ( word_8F605A[walkerBaseGridOffset] == a2 ) { v3 = 3; if ( !(grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 4; } if ( !(grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } } } break; case -4294967134: if ( grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset] & 0x8000 && word_8F62E6[walkerBaseGridOffset] == a2 ) { v3 = 1; if ( !(grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 2; } if ( !(grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } else { if ( grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset] & 0x8000 ) { if ( word_8F62E2[walkerBaseGridOffset] == a2 ) { v3 = 3; if ( !(grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 4; } if ( !(grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } } } break; case -4294967295: if ( grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset] & 0x8000 && word_8F62E6[walkerBaseGridOffset] == a2 ) { v3 = 1; if ( !(grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 2; } if ( !(grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } else { if ( grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset] & 0x8000 ) { if ( word_8F605E[walkerBaseGridOffset] == a2 ) { v3 = 3; if ( !(grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x4000) ) v3 = 0; if ( grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x4000 ) { if ( grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset] & 0x4000 ) v3 = 4; } if ( !(grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0xC000) ) v3 = 0; if ( !(grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset] & 0xC000) ) v3 = 0; } } } break; } return v3; } int sub_485390() { int result; // eax@1 dword_8A11C0[0] += grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x4000; dword_8A11C8 += grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x4000; dword_8A11D0 += grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x4000; result = walkerBaseGridOffset; dword_8A11D8 += grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x4000; return result; } signed int sub_485450(signed int a1) { signed int result; // eax@22 dword_8A11C0[0] = byte_8EFA5E[walkerBaseGridOffset] >= a1; dword_8A11C4 = byte_8EFA5F[walkerBaseGridOffset] >= a1; dword_8A11C8 = byte_8EFB01[walkerBaseGridOffset] >= a1; dword_8A11CC = byte_8EFBA3[walkerBaseGridOffset] >= a1; dword_8A11D0 = byte_8EFBA2[walkerBaseGridOffset] >= a1; dword_8A11D4 = byte_8EFBA1[walkerBaseGridOffset] >= a1; dword_8A11D8 = byte_8EFAFF[walkerBaseGridOffset] >= a1; result = byte_8EFA5D[walkerBaseGridOffset]; dword_8A11DC = result >= a1; return result; } int unused_485600(__int16 a1) { int result; // eax@15 dword_8E1464 = 0; dword_89AA68 = dword_8E1464; dword_8C7A10 = dword_89AA68; dword_8E1488 = 0; dword_8E7B2C = dword_8E1488; dword_8C79C4 = dword_8E7B2C; dword_93CA54 = dword_8C79C4; dword_8CE0A4 = 0; dword_8943C8 = dword_8CE0A4; dword_8A11C0[0] = a1 & grid_terrain_x_yMinusOne[walkerBaseGridOffset]; if ( dword_8A11C0[0] ) { ++dword_8C7A10; ++dword_89AA68; ++dword_93CA54; ++dword_8E1464; } dword_8A11C4 = a1 & grid_terrain_xPlusOne_yMinusOne[walkerBaseGridOffset]; if ( dword_8A11C4 ) { ++dword_8C7A10; ++dword_8E7B2C; } dword_8A11C8 = a1 & grid_terrain_xPlusOne_y[walkerBaseGridOffset]; if ( dword_8A11C8 ) { ++dword_8C7A10; ++dword_89AA68; ++dword_8C79C4; ++dword_8E1464; } dword_8A11CC = a1 & grid_terrain_xPlusOne_yPlusOne[walkerBaseGridOffset]; if ( dword_8A11CC ) { ++dword_8C7A10; ++dword_8E1488; } dword_8A11D0 = a1 & grid_terrain_x_yPlusOne[walkerBaseGridOffset]; if ( dword_8A11D0 ) { ++dword_8C7A10; ++dword_89AA68; ++dword_93CA54; ++dword_8E1464; } dword_8A11D4 = a1 & grid_terrain_xMinusOne_yPlusOne[walkerBaseGridOffset]; if ( dword_8A11D4 ) { ++dword_8C7A10; ++dword_8E7B2C; } dword_8A11D8 = a1 & grid_terrain_xMinusOne_y[walkerBaseGridOffset]; if ( dword_8A11D8 ) { ++dword_8C7A10; ++dword_89AA68; ++dword_8C79C4; ++dword_8E1464; } result = a1; dword_8A11DC = a1 & grid_terrain_xMinusOne_yMinusOne[walkerBaseGridOffset]; if ( dword_8A11DC ) { ++dword_8C7A10; ++dword_8E1488; } return result; } int unused_4859A0() { int result; // eax@1 dword_8A11C0[0] = word_63433C[walkerBaseGridOffset]; dword_8A11C4 = word_63433E[walkerBaseGridOffset]; dword_8A11C8 = word_634482[walkerBaseGridOffset]; dword_8A11CC = word_6345C6[walkerBaseGridOffset]; dword_8A11D0 = word_6345C4[walkerBaseGridOffset]; dword_8A11D4 = word_6345C2[walkerBaseGridOffset]; dword_8A11D8 = word_63447E[walkerBaseGridOffset]; result = word_63433A[walkerBaseGridOffset]; dword_8A11DC = word_63433A[walkerBaseGridOffset]; return result; } int sub_485A80() { __int16 v0; // cx@1 __int16 v1; // cx@7 __int16 v2; // cx@12 __int16 v3; // cx@17 __int16 v4; // cx@22 __int16 v5; // cx@24 __int16 v6; // ax@28 __int16 v7; // dx@32 int result; // eax@36 __int16 v9; // cx@36 signed int v10; // [sp+4Ch] [bp-10h]@2 v0 = grid_terrain[walkerBaseGridOffset]; if ( v0 & 0x40 ) v10 = 1; else v10 = 0; dword_8A11DC = 0; dword_8A11D8 = dword_8A11DC; dword_8A11D4 = dword_8A11D8; dword_8A11D0 = dword_8A11D4; dword_8A11CC = dword_8A11D0; dword_8A11C8 = dword_8A11CC; dword_8A11C4 = dword_8A11C8; dword_8A11C0[0] = dword_8A11C4; if ( grid_terrain_x_yMinusOne[walkerBaseGridOffset] & 0x100 ) { if ( v10 ) { v1 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; if ( !(v1 & 0x40) ) dword_8A11C0[0] = 1; } else { dword_8A11C0[0] = 1; } } if ( grid_terrain_xPlusOne_y[walkerBaseGridOffset] & 0x100 ) { if ( v10 ) { v2 = grid_terrain_xPlusOne_y[walkerBaseGridOffset]; if ( !(v2 & 0x40) ) dword_8A11C8 = 1; } else { dword_8A11C8 = 1; } } if ( grid_terrain_x_yPlusOne[walkerBaseGridOffset] & 0x100 ) { if ( v10 ) { v3 = grid_terrain_x_yPlusOne[walkerBaseGridOffset]; if ( !(v3 & 0x40) ) dword_8A11D0 = 1; } else { dword_8A11D0 = 1; } } if ( grid_terrain_xMinusOne_y[walkerBaseGridOffset] & 0x100 ) { if ( v10 ) { v4 = grid_terrain_xMinusOne_y[walkerBaseGridOffset]; if ( !(v4 & 0x40) ) dword_8A11D8 = 1; } else { dword_8A11D8 = 1; } } v5 = grid_terrain_x_yMinusOne[walkerBaseGridOffset]; if ( v5 & 8 ) { if ( buildings[word_8F605C[walkerBaseGridOffset]].type == 90 ) { if ( (byte_8C129E[walkerBaseGridOffset] & 0x3F) == 17 ) dword_8A11C0[0] = 1; } } v6 = grid_terrain_xPlusOne_y[walkerBaseGridOffset]; if ( v6 & 8 ) { if ( buildings[word_8F61A2[walkerBaseGridOffset]].type == 90 ) { if ( (byte_8C1341[walkerBaseGridOffset] & 0x3F) == 8 ) dword_8A11C8 = 1; } } v7 = grid_terrain_x_yPlusOne[walkerBaseGridOffset]; if ( v7 & 8 ) { if ( buildings[word_8F62E4[walkerBaseGridOffset]].type == 90 ) { if ( (byte_8C13E2[walkerBaseGridOffset] & 0x3F) == 1 ) dword_8A11D0 = 1; } } result = walkerBaseGridOffset; v9 = grid_terrain_xMinusOne_y[walkerBaseGridOffset]; if ( v9 & 8 ) { result = word_8F619E[walkerBaseGridOffset] << 7; if ( buildings[result].type == 90 ) { if ( (byte_8C133F[walkerBaseGridOffset] & 0x3F) == 10 ) dword_8A11D8 = 1; } } if ( dword_607FA4 ) { if ( byte_8E13FE[walkerBaseGridOffset] & 0x10 ) dword_8A11C0[0] = 1; if ( byte_8E14A1[walkerBaseGridOffset] & 0x10 ) dword_8A11C8 = 1; if ( byte_8E1542[walkerBaseGridOffset] & 0x10 ) dword_8A11D0 = 1; result = byte_8E149F[walkerBaseGridOffset] & 0x10; if ( byte_8E149F[walkerBaseGridOffset] & 0x10 ) dword_8A11D8 = 1; } return result; } signed int unused_485F70(int a1, int a2) { signed int result; // eax@2 if ( a2 & grid_terrain_x_yMinusOne[a1] ) { result = 1; } else { if ( a2 & grid_terrain_xPlusOne_y[a1] ) { result = 1; } else { if ( a2 & grid_terrain_x_yPlusOne[a1] ) { result = 1; } else { if ( a2 & grid_terrain_xMinusOne_y[a1] ) result = 1; else result = 0; } } } return result; } signed int unused_486010(int a1, int a2) { signed int result; // eax@2 if ( a2 & grid_terrain_xPlusOne_yMinusOne[a1] ) { result = 1; } else { if ( a2 & grid_terrain_xPlusOne_yPlusOne[a1] ) { result = 1; } else { if ( a2 & grid_terrain_xMinusOne_yPlusOne[a1] ) { result = 1; } else { if ( a2 & grid_terrain_xMinusOne_yMinusOne[a1] ) result = 1; else result = 0; } } } return result; } signed int unused_4860B0(int a1, int a2) { signed int result; // eax@2 if ( a2 & grid_terrain_xPlusOne_yMinusOne[a1] ) { if ( a2 & grid_terrain_xPlusOne_yPlusOne[a1] ) { if ( a2 & grid_terrain_xMinusOne_yPlusOne[a1] ) { if ( a2 & grid_terrain_xMinusOne_yMinusOne[a1] ) result = 0; else result = 1; } else { result = 1; } } else { result = 1; } } else { result = 1; } return result; } signed int sub_486150(int a1, int a2) { signed int v3; // [sp+4Ch] [bp-4h]@1 v3 = 0; if ( a2 & grid_terrain_x_yMinusOne[a1] ) v3 = 1; if ( a2 & grid_terrain_xPlusOne_y[a1] ) ++v3; if ( a2 & grid_terrain_x_yPlusOne[a1] ) ++v3; if ( a2 & grid_terrain_xMinusOne_y[a1] ) ++v3; return v3; } signed int sub_486200(int a1, int a2) { signed int v3; // [sp+4Ch] [bp-4h]@1 v3 = 0; if ( a2 & grid_terrain_xPlusOne_yMinusOne[a1] ) v3 = 1; if ( a2 & grid_terrain_xPlusOne_yPlusOne[a1] ) ++v3; if ( a2 & grid_terrain_xMinusOne_yPlusOne[a1] ) ++v3; if ( a2 & grid_terrain_xMinusOne_yMinusOne[a1] ) ++v3; return v3; } signed int sub_4862B0(int a1, int a2) { signed int result; // eax@2 if ( a2 & grid_terrain_xPlusOne_y[a1] ) { result = 1; } else { if ( a2 & grid_terrain_xMinusOne_y[a1] ) result = 1; else result = 0; } return result; } signed int sub_486310(int a1, int a2) { signed int result; // eax@2 if ( a2 & grid_terrain_x_yMinusOne[a1] ) { result = 1; } else { if ( a2 & grid_terrain_x_yPlusOne[a1] ) result = 1; else result = 0; } return result; } bool unused_486370(int a1, int a2) { bool result; // eax@2 if ( word_8F605C[a1] == a2 ) { result = 1; } else { if ( word_8F61A2[a1] == a2 ) { result = 1; } else { if ( word_8F62E4[a1] == a2 ) result = 1; else result = word_8F619E[a1] == a2; } } return result; } signed int unused_486400(int a1) { __int16 v1; // cx@1 __int16 v2; // cx@3 __int16 v3; // cx@5 __int16 v4; // cx@7 signed int v6; // [sp+4Ch] [bp-4h]@1 v6 = 0; v1 = grid_terrain_x_yMinusOne[a1]; if ( v1 & 0x40 ) v6 = 1; v2 = grid_terrain_xPlusOne_y[a1]; if ( v2 & 0x40 ) ++v6; v3 = grid_terrain_x_yPlusOne[a1]; if ( v3 & 0x40 ) ++v6; v4 = grid_terrain_xMinusOne_y[a1]; if ( v4 & 0x40 ) ++v6; return v6; } signed int sub_4864B0(int a1) { __int16 v1; // cx@1 signed int result; // eax@2 __int16 v3; // ax@3 __int16 v4; // dx@5 __int16 v5; // cx@7 v1 = grid_terrain_x_yMinusOne[a1]; if ( v1 & 4 ) { v3 = grid_terrain_xPlusOne_y[a1]; if ( v3 & 4 ) { v4 = grid_terrain_x_yPlusOne[a1]; if ( v4 & 4 ) { v5 = grid_terrain_xMinusOne_y[a1]; if ( v5 & 4 ) result = 1; else result = 0; } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int sub_486540(int a1, int a2, int a3, int a4, int a5) { signed int result; // eax@17 signed int v6; // [sp+4Ch] [bp-34h]@45 signed int v7; // [sp+50h] [bp-30h]@45 int v8; // [sp+54h] [bp-2Ch]@1 signed int v9; // [sp+58h] [bp-28h]@30 int v10; // [sp+5Ch] [bp-24h]@34 int v11; // [sp+5Ch] [bp-24h]@45 int v12; // [sp+60h] [bp-20h]@34 int v13; // [sp+60h] [bp-20h]@45 int v14; // [sp+64h] [bp-1Ch]@32 int v15; // [sp+64h] [bp-1Ch]@45 int v16; // [sp+68h] [bp-18h]@32 int v17; // [sp+68h] [bp-18h]@45 int v18; // [sp+6Ch] [bp-14h]@35 signed int j; // [sp+70h] [bp-10h]@32 signed int i; // [sp+74h] [bp-Ch]@30 int v21; // [sp+78h] [bp-8h]@1 v8 = model_buildings[0].dword_5F6DD4; dword_9363B4 = 0; dword_89AA84 = 0; dword_8E147C = 0; memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); v21 = fun_getDistanceMaximum(a2, a3, a4, a5); if ( a1 ) { if ( !dword_9DA918 ) v21 = 0; } if ( v21 > 0 ) { if ( sub_486AF0(a2 + setting_map_startGridOffset + 162 * (a3 - 1) - 1) ) { dword_89AA84 = 2; } else { if ( fun_terrainIsClear(a2 - 1, a3 - 1, 3, 3, 0xFFFFu, 0) ) dword_89AA84 = 1; else dword_89AA84 = -1; } } if ( sub_486AF0(a4 + setting_map_startGridOffset + 162 * (a5 - 1) - 1) ) { dword_8E147C = 2; } else { if ( fun_terrainIsClear(a4 - 1, a5 - 1, 3, 3, 0xFFFFu, 0) ) dword_8E147C = 1; else dword_8E147C = -1; } if ( dword_89AA84 != -1 && dword_8E147C != -1 ) { if ( dword_89AA84 != 1 || dword_8E147C != 1 || v21 >= 3 ) { if ( v21 ) { if ( sub_503000(a1, a2, a3, 1) ) { if ( dword_89AA84 ) { sub_4817E0(0, a2 - 1, a3 - 1, 3, 3); sub_482BD0(3, a2 - 1, a3 - 1, -1, 1); } if ( dword_8E147C ) { sub_4817E0(0, a4 - 1, a5 - 1, 3, 3); sub_482BD0(3, a4 - 1, a5 - 1, -1, 1); } v9 = 10000; for ( i = 0; i < 4; ++i ) { v16 = dword_5FA008[2 * i]; v14 = dword_5FA00C[2 * i]; for ( j = 0; j < 4; ++j ) { v12 = dword_5FA008[2 * j]; v10 = dword_5FA00C[2 * j]; if ( a1 ) v18 = sub_5041C0(1, v16 + a2, v14 + a3, v12 + a4, v10 + a5, 4); else v18 = sub_5041C0(2, v16 + a2, v14 + a3, v12 + a4, v10 + a5, 4); if ( v18 ) { if ( multipleConstruction_itemsPlaced ) { if ( multipleConstruction_itemsPlaced < v9 ) { v9 = multipleConstruction_itemsPlaced; v7 = i; v6 = j; } } } } } if ( v9 == 10000 ) { result = 0; } else { v17 = dword_5FA008[2 * v7]; v15 = dword_5FA00C[2 * v7]; v13 = dword_5FA008[2 * v6]; v11 = dword_5FA00C[2 * v6]; if ( a1 ) sub_5041C0(1, v17 + a2, v15 + a3, v13 + a4, v11 + a5, 2); else sub_5041C0(0, v17 + a2, v15 + a3, v13 + a4, v11 + a5, 2); if ( dword_89AA84 == 1 ) dword_9363B4 += model_buildings[0].dword_5F7814; if ( dword_8E147C == 1 ) dword_9363B4 += model_buildings[0].dword_5F7814; if ( v9 ) dword_9363B4 += v9 * v8; result = 1; } } else { result = 0; } } else { dword_9363B4 = model_buildings[0].dword_5F7814; result = 1; } } else { result = 0; } } else { result = 0; } return result; } signed int sub_486AF0(int a1) { signed int result; // eax@3 signed int j; // [sp+50h] [bp-Ch]@6 signed int i; // [sp+54h] [bp-8h]@4 int v4; // [sp+58h] [bp-4h]@1 v4 = grid_buildingIds[a1]; if ( grid_buildingIds[a1] && buildings[v4].type == 90 ) { for ( i = 0; i < 3; ++i ) { for ( j = 0; j < 3; ++j ) { if ( v4 != grid_buildingIds[*(int *)((char *)&multipleTileBuildingGridOffset[10 * i] + 8 * j) + a1] ) return 0; } } result = 1; } else { result = 0; } return result; } signed int sub_486BC0(int a1, int a2, int a3, int a4, int a5) { __int16 v5; // cx@1 __int16 v6; // ax@7 signed int result; // eax@14 signed int v8; // [sp+4Ch] [bp-8h]@1 int v9; // [sp+50h] [bp-4h]@1 memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); v9 = model_buildings[0].dword_5F6DD4; dword_9363B4 = 0; v8 = 0; walkerBaseGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; v5 = grid_terrain[walkerBaseGridOffset]; if ( v5 & 0x40 ) { if ( grid_bitfields[walkerBaseGridOffset] & 0x80 ) v8 = 1; } else { if ( grid_terrain[walkerBaseGridOffset] & 0xD77F ) v8 = 1; } walkerBaseGridOffset = 162 * a5 + a4 + setting_map_startGridOffset; v6 = grid_terrain[walkerBaseGridOffset]; if ( v6 & 0x40 ) { if ( grid_bitfields[walkerBaseGridOffset] & 0x80 ) v8 = 1; } else { if ( grid_terrain[walkerBaseGridOffset] & 0xD77F ) v8 = 1; } if ( v8 ) { result = 0; } else { if ( sub_503000(a1, a2, a3, 1) ) { if ( a1 ) sub_5041C0(1, a2, a3, a4, a5, 2); else sub_5041C0(0, a2, a3, a4, a5, 2); dword_9363B4 += multipleConstruction_itemsPlaced * v9; result = 1; } else { result = 0; } } return result; } int sub_486DF0(int a1, int a2) { int result; // eax@1 __int16 v3; // cx@1 __int16 v4; // ax@3 __int16 v5; // dx@5 __int16 v6; // dx@9 __int16 v7; // cx@11 __int16 v8; // ax@13 __int16 v9; // dx@15 __int16 v10; // cx@20 __int16 v11; // ax@22 __int16 v12; // dx@23 __int16 v13; // cx@25 signed int i; // [sp+4Ch] [bp-8h]@18 int v15; // [sp+50h] [bp-4h]@1 v15 = 162 * a2 + a1 + setting_map_startGridOffset; dword_8A7884 = 162 * a2 + a1 + setting_map_startGridOffset; dword_8E1490 = 0; bridge_something = 0; dword_8F6184 = 0; dword_86331C[0] = 0; result = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_terrain[result]; if ( v3 & 4 ) { v4 = grid_terrain[v15]; result = v4 & 0x40; if ( !result ) { v5 = grid_terrain[v15]; if ( !(v5 & 8) ) { result = sub_486150(v15, 4); if ( result == 3 ) { v6 = grid_terrain_x_yMinusOne[v15]; if ( v6 & 4 ) { result = v15; v7 = grid_terrain_xPlusOne_y[v15]; if ( v7 & 4 ) { v8 = grid_terrain_x_yPlusOne[v15]; result = v8 & 4; if ( result ) { v9 = grid_terrain_xMinusOne_y[v15]; if ( v9 & 4 ) return result; dword_8F6184 = 1; dword_86331C[0] = 2; } else { dword_8F6184 = -162; dword_86331C[0] = 0; } } else { dword_8F6184 = -1; dword_86331C[0] = 6; } } else { dword_8F6184 = 162; dword_86331C[0] = 4; } bridge_something = 1; for ( i = 0; i < 40; ++i ) { v15 += dword_8F6184; ++bridge_something; result = dword_8F6184 + v15; v10 = grid_terrain[dword_8F6184 + v15]; if ( v10 & 1 ) break; v11 = grid_terrain[dword_8F6184 + v15]; result = v11 & 4; if ( !result ) { dword_8E1490 = v15; result = sub_486150(v15, 4); if ( result != 3 ) dword_8E1490 = 0; return result; } v12 = grid_terrain[dword_8F6184 + v15]; if ( v12 & 0x40 || (result = dword_8F6184 + v15, v13 = grid_terrain[dword_8F6184 + v15], v13 & 8) || (result = sub_486200(v15, 4), result != 4) ) return result; result = i + 1; } } } } } return result; } void sub_4870D0(int a1, int a2, int a3) { __int16 v3; // cx@28 signed int v4; // [sp+4Ch] [bp-Ch]@1 int i; // [sp+50h] [bp-8h]@26 int v6; // [sp+54h] [bp-4h]@8 v4 = 0; if ( dword_8E1490 > 0 ) { if ( bridge_something > 1 ) { if ( a3 != 1 || bridge_something >= 5 ) { v6 = 162 * a2 + a1 + setting_map_startGridOffset; dword_86331C[0] -= setting_map_orientation; dword_86331C[0] += dword_86331C[0] < 0 ? 8 : 0; if ( a3 == 1 ) { switch ( bridge_something ) { case 9: v4 = 4; break; case 10: v4 = 4; break; case 11: v4 = 5; break; case 12: v4 = 5; break; case 13: v4 = 6; break; case 14: v4 = 6; break; case 15: v4 = 7; break; case 16: v4 = 7; break; default: v4 = 8; break; } } for ( i = 0; i < bridge_something; ++i ) { v3 = grid_terrain[v6]; _LOBYTE(v3) = v3 | 0x40; grid_terrain[v6] = v3; if ( a3 ) { if ( i == bridge_something - 2 ) { grid_animation[v6] = 13; } else { if ( i == 1 ) { grid_animation[v6] = 13; } else { if ( i == bridge_something - 1 ) { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 7; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 8; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 10; } else { grid_animation[v6] = 9; } } } } else { if ( i ) { if ( i == v4 ) { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 14; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 15; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 15; } else { grid_animation[v6] = 14; } } } } else { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 11; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 12; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 12; } else { grid_animation[v6] = 11; } } } } } else { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 9; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 10; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 8; } else { grid_animation[v6] = 7; } } } } } } } } else { if ( i == bridge_something - 1 ) { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 1; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 2; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 4; } else { grid_animation[v6] = 3; } } } } else { if ( i ) { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 5; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 6; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 6; } else { grid_animation[v6] = 5; } } } } else { if ( dword_86331C[0] == 4 ) { grid_animation[v6] = 3; } else { if ( dword_86331C[0] == 6 ) { grid_animation[v6] = 4; } else { if ( dword_86331C[0] ) { if ( dword_86331C[0] == 2 ) grid_animation[v6] = 2; } else { grid_animation[v6] = 1; } } } } } } v6 += dword_8F6184; } fun_determineGroundType(); sub_4FFDF0(); sub_5001A0(); } else { bridge_something = 0; } } else { bridge_something = 0; } } else { bridge_something = 0; } } int sub_487650(int a1, int a2) { int result; // eax@1 __int16 v3; // cx@1 __int16 v4; // dx@5 __int16 v5; // cx@8 __int16 v6; // ax@11 __int16 v7; // dx@14 __int16 v8; // cx@17 __int16 v9; // ax@20 __int16 v10; // dx@23 __int16 v11; // cx@26 __int16 v12; // cx@32 __int16 v13; // cx@37 __int16 v14; // cx@38 __int16 v15; // cx@42 signed int v16; // [sp+4Ch] [bp-10h]@5 signed int v17; // [sp+50h] [bp-Ch]@5 signed int v18; // [sp+54h] [bp-8h]@30 signed int v19; // [sp+58h] [bp-4h]@30 result = a1; v3 = grid_terrain[a1]; if ( v3 & 4 ) { result = grid_animation[a1]; if ( result > 0 ) { v17 = 0; v16 = 0; v4 = grid_terrain_x_yMinusOne[a1]; if ( v4 & 4 ) { if ( byte_89AA7E[a1] ) v17 = 1; } v5 = word_9092D8[a1]; if ( v5 & 4 ) { if ( byte_89A9DC[a1] ) ++v17; } v6 = grid_terrain_x_yPlusOne[a1]; if ( v6 & 4 ) { if ( byte_89ABC2[a1] ) ++v17; } v7 = word_9097E8[a1]; if ( v7 & 4 ) { if ( byte_89AC64[a1] ) ++v17; } v8 = grid_terrain_xPlusOne_y[a1]; if ( v8 & 4 ) { if ( byte_89AB21[a1] ) v16 = 1; } v9 = grid_terrain_xPlusTwo_y[a1]; if ( v9 & 4 ) { if ( byte_89AB22[a1] ) ++v16; } v10 = grid_terrain_xMinusOne_y[a1]; if ( v10 & 4 ) { if ( byte_89AB1F[a1] ) ++v16; } v11 = grid_terrain_xMinusTwo_y[a1]; if ( v11 & 4 ) { if ( byte_89AB1E[a1] ) ++v16; } if ( v17 < v16 ) { v19 = -1; v18 = 1; } else { v19 = -162; v18 = 162; } while ( 1 ) { v12 = grid_terrain[v19 + a1]; if ( !(v12 & 4) ) break; if ( !*(&grid_animation[v19] + a1) ) break; a1 += v19; } if ( a2 ) { grid_bitfields[a1] |= 0x40u; } else { grid_animation[a1] = 0; v13 = grid_terrain[a1]; _LOBYTE(v13) = v13 & 0xBF; grid_terrain[a1] = v13; } while ( 1 ) { result = v18 + a1; v14 = grid_terrain[v18 + a1]; if ( !(v14 & 4) ) break; result = *(&grid_animation[v18] + a1); if ( !*(&grid_animation[v18] + a1) ) break; a1 += v18; if ( a2 ) { grid_bitfields[a1] |= 0x40u; } else { grid_animation[a1] = 0; v15 = grid_terrain[a1]; _LOBYTE(v15) = v15 & 0xBF; grid_terrain[a1] = v15; } } } } return result; } signed int sub_4879A0(int a1) { __int16 v1; // cx@1 signed int result; // eax@2 __int16 v3; // dx@5 __int16 v4; // cx@8 __int16 v5; // ax@11 __int16 v6; // dx@14 __int16 v7; // cx@17 __int16 v8; // ax@20 __int16 v9; // dx@23 __int16 v10; // cx@26 __int16 v11; // cx@32 __int16 v12; // ax@38 signed int v13; // [sp+4Ch] [bp-14h]@5 signed int v14; // [sp+50h] [bp-10h]@5 signed int v15; // [sp+54h] [bp-Ch]@35 signed int v16; // [sp+58h] [bp-8h]@30 signed int v17; // [sp+5Ch] [bp-4h]@30 v1 = grid_terrain[a1]; if ( v1 & 4 ) { if ( grid_animation[a1] > 0 ) { v14 = 0; v13 = 0; v3 = grid_terrain_x_yMinusOne[a1]; if ( v3 & 4 ) { if ( byte_89AA7E[a1] ) v14 = 1; } v4 = word_9092D8[a1]; if ( v4 & 4 ) { if ( byte_89A9DC[a1] ) ++v14; } v5 = grid_terrain_x_yPlusOne[a1]; if ( v5 & 4 ) { if ( byte_89ABC2[a1] ) ++v14; } v6 = word_9097E8[a1]; if ( v6 & 4 ) { if ( byte_89AC64[a1] ) ++v14; } v7 = grid_terrain_xPlusOne_y[a1]; if ( v7 & 4 ) { if ( byte_89AB21[a1] ) v13 = 1; } v8 = grid_terrain_xPlusTwo_y[a1]; if ( v8 & 4 ) { if ( byte_89AB22[a1] ) ++v13; } v9 = grid_terrain_xMinusOne_y[a1]; if ( v9 & 4 ) { if ( byte_89AB1F[a1] ) ++v13; } v10 = grid_terrain_xMinusTwo_y[a1]; if ( v10 & 4 ) { if ( byte_89AB1E[a1] ) ++v13; } if ( v14 < v13 ) { v17 = -1; v16 = 1; } else { v17 = -162; v16 = 162; } while ( 1 ) { v11 = grid_terrain[v17 + a1]; if ( !(v11 & 4) ) break; if ( !*(&grid_animation[v17] + a1) ) break; a1 += v17; } v15 = 0; if ( grid_walkerIds[a1] ) v15 = 1; for ( grid_bitfields[a1] &= 0xBFu; ; grid_bitfields[a1] &= 0xBFu ) { v12 = grid_terrain[v16 + a1]; if ( !(v12 & 4) ) break; if ( !*(&grid_animation[v16] + a1) ) break; a1 += v16; if ( grid_walkerIds[a1] ) ++v15; } result = v15; } else { result = 0; } } else { result = 0; } return result; } int sub_487CD0() { int result; // eax@2 __int16 v1; // dx@6 int v2; // [sp+4Ch] [bp-Ch]@1 int v3; // [sp+50h] [bp-8h]@1 int v4; // [sp+54h] [bp-4h]@3 v2 = setting_map_startGridOffset; v3 = 0; while ( 1 ) { result = v3; if ( v3 >= setting_map_height ) break; v4 = 0; while ( v4 < setting_map_width ) { v1 = grid_terrain[v2]; if ( v1 & 4 ) { if ( grid_animation[v2] ) { switch ( grid_animation[v2] ) { case 1: if ( dword_8A788C ) grid_animation[v2] = 2; else grid_animation[v2] = 4; break; case 2: if ( dword_8A788C ) grid_animation[v2] = 3; else grid_animation[v2] = 1; break; case 3: if ( dword_8A788C ) grid_animation[v2] = 4; else grid_animation[v2] = 2; break; case 4: if ( dword_8A788C ) grid_animation[v2] = 1; else grid_animation[v2] = 3; break; case 5: grid_animation[v2] = 6; break; case 6: grid_animation[v2] = 5; break; case 7: if ( dword_8A788C ) grid_animation[v2] = 8; else grid_animation[v2] = 10; break; case 8: if ( dword_8A788C ) grid_animation[v2] = 9; else grid_animation[v2] = 7; break; case 9: if ( dword_8A788C ) grid_animation[v2] = 10; else grid_animation[v2] = 8; break; case 0xA: if ( dword_8A788C ) grid_animation[v2] = 7; else grid_animation[v2] = 9; break; case 0xB: grid_animation[v2] = 12; break; case 0xC: grid_animation[v2] = 11; break; case 0xD: grid_animation[v2] = 13; break; case 0xE: grid_animation[v2] = 15; break; case 0xF: grid_animation[v2] = 14; break; } } } ++v4; ++v2; } ++v3; v2 += setting_map_gridBorderSize; } return result; } void sub_4880A0(int a1, int a2) { int v2; // ST58_4@1 int v3; // ST54_4@1 int v4; // [sp+4Ch] [bp-1Ch]@1 int v5; // [sp+50h] [bp-18h]@1 int v6; // [sp+54h] [bp-14h]@1 int v7; // [sp+58h] [bp-10h]@1 int v8; // [sp+64h] [bp-4h]@9 v2 = buildings[a1].x; v3 = buildings[a1].y; v5 = a2 + v2; v4 = a2 + v3; v7 = v2 - a2; v6 = v3 - a2; if ( v7 < 0 ) v7 = 0; if ( v6 < 0 ) v6 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; v8 = 162 * v6 + v7 + setting_map_startGridOffset; walkerGridY = v6; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { if ( grid_buildingIds[v8] ) buildings[grid_buildingIds[v8]].house_hasWell = 1; ++walkerGridX; ++v8; } ++walkerGridY; v8 += 162 - (v5 - v7 + 1); } } signed int sub_488240(int a1, int a2) { int v2; // ST58_4@1 int v3; // ST54_4@1 signed int result; // eax@20 int v5; // [sp+4Ch] [bp-20h]@1 int v6; // [sp+50h] [bp-1Ch]@1 int v7; // [sp+54h] [bp-18h]@1 int v8; // [sp+58h] [bp-14h]@1 int v9; // [sp+5Ch] [bp-10h]@9 int v10; // [sp+64h] [bp-8h]@14 int v11; // [sp+68h] [bp-4h]@9 v2 = buildings[a1].x; v3 = buildings[a1].y; v6 = a2 + v2; v5 = a2 + v3; v8 = v2 - a2; v7 = v3 - a2; if ( v8 < 0 ) v8 = 0; if ( v7 < 0 ) v7 = 0; if ( v6 >= setting_map_width ) v6 = setting_map_width - 1; if ( v5 >= setting_map_height ) v5 = setting_map_height - 1; v11 = 162 * v7 + v8 + setting_map_startGridOffset; v9 = 0; walkerGridY = v7; while ( walkerGridY <= v5 ) { walkerGridX = v8; while ( walkerGridX <= v6 ) { v10 = grid_buildingIds[v11]; if ( v10 > 0 ) { if ( buildings[v10].house_size ) { ++v9; if ( !(grid_terrain[v11] & 0x2000) ) return 0; } } ++walkerGridX; ++v11; } ++walkerGridY; v11 += 162 - (v6 - v8 + 1); } if ( v9 ) result = 1; else result = 2; return result; } bool sub_488430(int a1, int a2) { __int16 v2; // ax@9 __int16 v3; // ax@11 __int16 v4; // ax@13 __int16 v5; // ax@15 __int16 v6; // ax@17 __int16 v7; // ax@19 __int16 v8; // ax@21 __int16 v9; // ax@23 __int16 v10; // ax@25 __int16 v11; // ax@27 __int16 v12; // ax@29 __int16 v13; // ax@31 __int16 v15; // ax@38 __int16 v16; // dx@39 __int16 v17; // cx@41 __int16 v18; // ax@42 __int16 v19; // dx@44 __int16 v20; // cx@45 __int16 v21; // ax@47 __int16 v22; // dx@48 __int16 v23; // cx@50 __int16 v24; // ax@51 __int16 v25; // dx@53 __int16 v26; // cx@54 int v27; // [sp+4Ch] [bp-18h]@9 signed int v28; // [sp+50h] [bp-14h]@9 signed int v29; // [sp+54h] [bp-10h]@9 signed int v30; // [sp+58h] [bp-Ch]@9 signed int v31; // [sp+5Ch] [bp-8h]@9 signed int v32; // [sp+60h] [bp-4h]@9 if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: --a2; break; case 4: --a1; --a2; break; case 2: --a1; break; } } v27 = 162 * a2 + a1 + setting_map_startGridOffset; v28 = 0; v29 = 0; v30 = 0; v31 = 0; v32 = 0; v2 = grid_terrain[162 * a2 + a1 + setting_map_startGridOffset]; if ( v2 & 0x40 ) v32 = 1; v3 = grid_terrain_xPlusOne_y[v27]; if ( v3 & 0x40 ) ++v32; v4 = grid_terrain_x_yPlusOne[v27]; if ( v4 & 0x40 ) ++v32; v5 = grid_terrain_xPlusOne_yPlusOne[v27]; if ( v5 & 0x40 ) ++v32; v6 = grid_terrain_x_yMinusOne[v27]; if ( v6 & 0x40 ) v31 = 1; v7 = grid_terrain_xPlusOne_yMinusOne[v27]; if ( v7 & 0x40 ) ++v31; v8 = grid_terrain_xPlusTwo_y[v27]; if ( v8 & 0x40 ) v30 = 1; v9 = grid_terrain_xPlusTwo_yPlusOne[v27]; if ( v9 & 0x40 ) ++v30; v10 = word_9097E8[v27]; if ( v10 & 0x40 ) v29 = 1; v11 = word_9097EA[v27]; if ( v11 & 0x40 ) ++v29; v12 = grid_terrain_xMinusOne_y[v27]; if ( v12 & 0x40 ) v28 = 1; v13 = grid_terrain_xMinusOne_yPlusOne[v27]; if ( v13 & 0x40 ) ++v28; if ( v32 <= 1 ) return 0; if ( v32 == 3 ) return 0; if ( v32 == 2 ) { v15 = grid_terrain[v27]; if ( v15 & 0x40 ) { v16 = grid_terrain_xPlusOne_yPlusOne[v27]; if ( v16 & 0x40 ) return 0; } v17 = grid_terrain_xPlusOne_y[v27]; if ( v17 & 0x40 ) { v18 = grid_terrain_x_yPlusOne[v27]; if ( v18 & 0x40 ) return 0; } v19 = grid_terrain[v27]; if ( v19 & 0x40 ) { v20 = grid_terrain_x_yPlusOne[v27]; if ( v20 & 0x40 ) return 1; } v21 = grid_terrain_xPlusOne_y[v27]; if ( v21 & 0x40 ) { v22 = grid_terrain_xPlusOne_yPlusOne[v27]; if ( v22 & 0x40 ) return 1; } v23 = grid_terrain[v27]; if ( v23 & 0x40 ) { v24 = grid_terrain_xPlusOne_y[v27]; if ( v24 & 0x40 ) return 2; } v25 = grid_terrain_x_yPlusOne[v27]; if ( v25 & 0x40 ) { v26 = grid_terrain_xPlusOne_yPlusOne[v27]; if ( v26 & 0x40 ) return 2; } } if ( v32 != 4 ) return 0; if ( !v31 && !v29 ) { if ( v30 || v28 ) return 2; return 0; } return !v30 && !v28; } signed int sub_488860(int a1, int a2) { signed int result; // eax@38 int v3; // [sp+50h] [bp-10h]@9 signed int v4; // [sp+54h] [bp-Ch]@9 signed int v5; // [sp+58h] [bp-8h]@9 signed int v6; // [sp+5Ch] [bp-4h]@9 if ( setting_map_orientation ) { switch ( setting_map_orientation ) { case 6: a2 -= 2; break; case 4: a1 -= 2; a2 -= 2; break; case 2: a1 -= 2; break; } } v4 = 0; v5 = 0; v6 = 0; v3 = 162 * a2 + a1 + setting_map_startGridOffset; if ( grid_terrain[162 * a2 + a1 + setting_map_startGridOffset] & 0xD77F ) v6 = 1; if ( grid_terrain_xPlusTwo_y[v3] & 0xD77F ) ++v6; if ( word_9097E8[v3] & 0xD77F ) ++v6; if ( word_9097EC[v3] & 0xD77F ) ++v6; if ( (unsigned __int16)(grid_terrain_xPlusOne_y[v3] & 0xD77F) == 64 ) { v5 = 1; } else { if ( grid_terrain_xPlusOne_y[v3] & 0xD77F ) ++v6; } if ( (unsigned __int16)(word_9097EA[v3] & 0xD77F) == 64 ) { ++v5; } else { if ( word_9097EA[v3] & 0xD77F ) ++v6; } if ( (unsigned __int16)(grid_terrain_x_yPlusOne[v3] & 0xD77F) == 64 ) { v4 = 1; } else { if ( grid_terrain_x_yPlusOne[v3] & 0xD77F ) ++v6; } if ( (unsigned __int16)(grid_terrain_xPlusTwo_yPlusOne[v3] & 0xD77F) == 64 ) { ++v4; } else { if ( grid_terrain_xPlusTwo_yPlusOne[v3] & 0xD77F ) ++v6; } if ( (unsigned __int16)(grid_terrain_xPlusOne_yPlusOne[v3] & 0xD77F) != 64 ) { if ( grid_terrain_xPlusOne_yPlusOne[v3] & 0xD77F ) ++v6; } if ( v6 < 1 ) { if ( v5 > 1 || v4 > 1 ) { if ( v5 != 2 || v4 ) { if ( v5 || v4 != 2 ) result = 0; else result = 2; } else { result = 1; } } else { result = 0; } } else { result = 0; } return result; } void sub_488B70(int x, int y, int a3) { __int16 terrainValue; // ax@1 __int16 v4; // ax@1 __int16 v5; // ax@1 __int16 v6; // ax@1 __int16 v7; // dx@3 __int16 v8; // cx@5 __int16 v9; // ax@7 __int16 v10; // dx@9 __int16 v11; // cx@13 __int16 v12; // ax@15 __int16 v13; // dx@17 __int16 v14; // cx@19 int gridOffset; // [sp+4Ch] [bp-4h]@1 gridOffset = 162 * y + x + setting_map_startGridOffset; terrainValue = grid_terrain[162 * y + x + setting_map_startGridOffset]; _LOBYTE(terrainValue) = terrainValue | T_Road; grid_terrain[162 * y + x + setting_map_startGridOffset] = terrainValue; v4 = grid_terrain_xPlusOne_y[gridOffset]; _LOBYTE(v4) = v4 | 0x40; grid_terrain_xPlusOne_y[gridOffset] = v4; v5 = grid_terrain_x_yPlusOne[gridOffset]; _LOBYTE(v5) = v5 | 0x40; grid_terrain_x_yPlusOne[gridOffset] = v5; v6 = grid_terrain_xPlusOne_yPlusOne[gridOffset]; _LOBYTE(v6) = v6 | 0x40; grid_terrain_xPlusOne_yPlusOne[gridOffset] = v6; if ( a3 == 1 ) { if ( !(grid_terrain_x_yMinusOne[gridOffset] & 0xD77F) ) { v7 = grid_terrain_x_yMinusOne[gridOffset]; _LOBYTE(v7) = v7 | 0x40; grid_terrain_x_yMinusOne[gridOffset] = v7; } if ( !(grid_terrain_xPlusOne_yMinusOne[gridOffset] & 0xD77F) ) { v8 = grid_terrain_xPlusOne_yMinusOne[gridOffset]; _LOBYTE(v8) = v8 | 0x40; grid_terrain_xPlusOne_yMinusOne[gridOffset] = v8; } if ( !(word_9097E8[gridOffset] & 0xD77F) ) { v9 = word_9097E8[gridOffset]; _LOBYTE(v9) = v9 | 0x40; word_9097E8[gridOffset] = v9; } if ( !(word_9097EA[gridOffset] & 0xD77F) ) { v10 = word_9097EA[gridOffset]; _LOBYTE(v10) = v10 | 0x40; word_9097EA[gridOffset] = v10; } } else { if ( a3 == 2 ) { if ( !(grid_terrain_xMinusOne_y[gridOffset] & 0xD77F) ) { v11 = grid_terrain_xMinusOne_y[gridOffset]; _LOBYTE(v11) = v11 | 0x40; grid_terrain_xMinusOne_y[gridOffset] = v11; } if ( !(grid_terrain_xMinusOne_yPlusOne[gridOffset] & 0xD77F) ) { v12 = grid_terrain_xMinusOne_yPlusOne[gridOffset]; _LOBYTE(v12) = v12 | 0x40; grid_terrain_xMinusOne_yPlusOne[gridOffset] = v12; } if ( !(grid_terrain_xPlusTwo_y[gridOffset] & 0xD77F) ) { v13 = grid_terrain_xPlusTwo_y[gridOffset]; _LOBYTE(v13) = v13 | 0x40; grid_terrain_xPlusTwo_y[gridOffset] = v13; } if ( !(grid_terrain_xPlusTwo_yPlusOne[gridOffset] & 0xD77F) ) { v14 = grid_terrain_xPlusTwo_yPlusOne[gridOffset]; _LOBYTE(v14) = v14 | 0x40; grid_terrain_xPlusTwo_yPlusOne[gridOffset] = v14; } } } } char sub_488E00(int a1, int a2, int a3) { int v3; // eax@1 int v5; // [sp+4Ch] [bp-4h]@1 v3 = 162 * a2 + a1 + setting_map_startGridOffset; v5 = 162 * a2 + a1 + setting_map_startGridOffset; if ( a3 == 1 ) { _LOWORD(v3) = grid_terrain_xPlusOne_y[v5]; _LOBYTE(v3) = v3 | 0x40; grid_terrain_xPlusOne_y[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusOne_yPlusOne[v5]; _LOBYTE(v3) = v3 | 0x40; grid_terrain_xPlusOne_yPlusOne[v5] = v3; _LOWORD(v3) = word_9097EA[v5]; _LOBYTE(v3) = v3 | 0x40; word_9097EA[v5] = v3; _LOWORD(v3) = grid_terrain[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain[v5] = v3; _LOWORD(v3) = grid_terrain_x_yPlusOne[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain_x_yPlusOne[v5] = v3; _LOWORD(v3) = word_9097E8[v5]; _LOBYTE(v3) = v3 & 0xBF; word_9097E8[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusTwo_y[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain_xPlusTwo_y[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusTwo_yPlusOne[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain_xPlusTwo_yPlusOne[v5] = v3; _LOWORD(v3) = word_9097EC[v5]; _LOBYTE(v3) = v3 & 0xBF; word_9097EC[v5] = v3; } else { if ( a3 == 2 ) { _LOWORD(v3) = grid_terrain_x_yPlusOne[v5]; _LOBYTE(v3) = v3 | 0x40; grid_terrain_x_yPlusOne[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusOne_yPlusOne[v5]; _LOBYTE(v3) = v3 | 0x40; grid_terrain_xPlusOne_yPlusOne[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusTwo_yPlusOne[v5]; _LOBYTE(v3) = v3 | 0x40; grid_terrain_xPlusTwo_yPlusOne[v5] = v3; _LOWORD(v3) = grid_terrain[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusOne_y[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain_xPlusOne_y[v5] = v3; _LOWORD(v3) = grid_terrain_xPlusTwo_y[v5]; _LOBYTE(v3) = v3 & 0xBF; grid_terrain_xPlusTwo_y[v5] = v3; _LOWORD(v3) = word_9097E8[v5]; _LOBYTE(v3) = v3 & 0xBF; word_9097E8[v5] = v3; _LOWORD(v3) = word_9097EA[v5]; _LOBYTE(v3) = v3 & 0xBF; word_9097EA[v5] = v3; _LOWORD(v3) = word_9097EC[v5]; _LOBYTE(v3) = v3 & 0xBF; word_9097EC[v5] = v3; } } return v3; } signed int sub_489070(int x, int y, int size, signed int radius) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= radius; ++i ) { if ( sub_4891C0(x, y, size, i, 0) ) return 1; } return 0; } signed int sub_4890E0(int a1, int a2, int a3, signed int a4) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= a4; ++i ) { if ( sub_489350(a1, a2, a3, i, 0) ) return 1; } return 0; } // 403495: using guessed type _DWORD sub_403495(_DWORD, _DWORD, _DWORD, _DWORD, _DWORD); //----- (00489150) -------------------------------------------------------- signed int sub_489150(int a1, int a2, int a3, signed int a4, int a5) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= a4; ++i ) { if ( sub_4891C0(a1, a2, a3, i, a5) ) return 1; } return 0; } signed int sub_4891C0(int x, int y, int size, int ring, int a5) { __int16 v5; // cx@13 int v7; // [sp+4Ch] [bp-Ch]@1 int v8; // [sp+50h] [bp-8h]@1 int v9; // [sp+60h] [bp+8h]@1 int v10; // [sp+64h] [bp+Ch]@1 v8 = ring + x + size - 1; v7 = ring + y + size - 1; v9 = x - ring; v10 = y - ring; if ( v9 < 0 ) v9 = 0; if ( v10 < 0 ) v10 = 0; if ( v8 >= setting_map_width ) v8 = setting_map_width - 1; if ( v7 >= setting_map_height ) v7 = setting_map_height - 1; walkerBaseGridOffset = 162 * v10 + v9 + setting_map_startGridOffset; walkerGridY = v10; while ( walkerGridY <= v7 ) { walkerGridX = v9; while ( walkerGridX <= v8 ) { v5 = grid_terrain[walkerBaseGridOffset]; if ( v5 & 0x40 && !a5 ) return 1; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v8 - v9 + 1); } return 0; } signed int sub_489350(int a1, int a2, int a3, int a4, int a5) { __int16 v5; // ax@16 int v7; // [sp+4Ch] [bp-Ch]@1 int v8; // [sp+50h] [bp-8h]@1 int v9; // [sp+60h] [bp+8h]@1 int v10; // [sp+64h] [bp+Ch]@1 v8 = a4 + a1 + a3 - 1; v7 = a4 + a2 + a3 - 1; v9 = a1 - a4; v10 = a2 - a4; if ( v9 < 0 ) v9 = 0; if ( v10 < 0 ) v10 = 0; if ( v8 >= setting_map_width ) v8 = setting_map_width - 1; if ( v7 >= setting_map_height ) v7 = setting_map_height - 1; walkerBaseGridOffset = 162 * v10 + v9 + setting_map_startGridOffset; walkerGridY = v10; while ( walkerGridY <= v7 ) { walkerGridX = v9; while ( walkerGridX <= v8 ) { if ( grid_pathingDistance[walkerBaseGridOffset] ) { v5 = grid_terrain[walkerBaseGridOffset]; if ( v5 & 0x40 ) { if ( !a5 ) return 1; } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v8 - v9 + 1); } return 0; } signed int sub_489500(int a1, int a2, int a3, signed int a4) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= a4; ++i ) { if ( sub_489570(a1, a2, a3, i) ) return 1; } return 0; } signed int sub_489570(int a1, int a2, int a3, int a4) { int v5; // [sp+4Ch] [bp-Ch]@1 int v6; // [sp+50h] [bp-8h]@1 int v7; // [sp+60h] [bp+8h]@1 int v8; // [sp+64h] [bp+Ch]@1 v6 = a4 + a1 + a3 - 1; v5 = a4 + a2 + a3 - 1; v7 = a1 - a4; v8 = a2 - a4; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v6 >= setting_map_width ) v6 = setting_map_width - 1; if ( v5 >= setting_map_height ) v5 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v5 ) { walkerGridX = v7; while ( walkerGridX <= v6 ) { if ( !byte_61AA20[walkerBaseGridOffset] ) return 1; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v6 - v7 + 1); } return 0; } signed int determineAccessRoad(int x, int y, int size) { __int16 v3; // dx@6 __int16 v4; // dx@9 signed int result; // eax@19 int v6; // [sp+4Ch] [bp-24h]@1 signed int v7; // [sp+50h] [bp-20h]@1 signed int v8; // [sp+54h] [bp-1Ch]@10 signed int v9; // [sp+5Ch] [bp-14h]@10 signed int i; // [sp+60h] [bp-10h]@1 int v11; // [sp+64h] [bp-Ch]@4 int v12; // [sp+6Ch] [bp-4h]@1 v12 = 162 * y + x + setting_map_startGridOffset; v7 = 12; v6 = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < 20; ++i ) { v11 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * size] + 4 * i); if ( !v11 ) break; v3 = grid_terrain[v11 + v12]; if ( !(v3 & T_Building) || buildings[grid_buildingIds[v11 + v12]].type != B_Gatehouse ) { v4 = grid_terrain[v11 + v12]; if ( v4 & T_Road ) { v9 = 0; v8 = 11; while ( v9 < 10 ) { if ( city_inform[ciid].dword_6545CC[v9] == *(&byte_91C920[v11] + v12) ) { v8 = v9; break; } ++v9; } if ( v8 < v7 ) { v7 = v8; v6 = i; } } } } if ( v7 >= 12 ) { result = 0; } else { walkerGridX = *(int *)((char *)&dword_5F36A0[40 * size] + 8 * v6) + x; walkerGridY = *(int *)((char *)&dword_5F36A4[40 * size] + 8 * v6) + y; result = 1; } return result; } signed int sub_4898D0(int a1, int a2) { __int16 v2; // dx@6 __int16 v3; // dx@9 __int16 v4; // cx@23 __int16 v5; // cx@26 __int16 v6; // ax@40 __int16 v7; // ax@43 signed int result; // eax@53 signed int v9; // [sp+50h] [bp-28h]@1 int v10; // [sp+54h] [bp-24h]@1 signed int v11; // [sp+58h] [bp-20h]@1 signed int v12; // [sp+5Ch] [bp-1Ch]@10 signed int v13; // [sp+5Ch] [bp-1Ch]@27 signed int v14; // [sp+5Ch] [bp-1Ch]@44 signed int v15; // [sp+64h] [bp-14h]@10 signed int v16; // [sp+64h] [bp-14h]@27 signed int v17; // [sp+64h] [bp-14h]@44 signed int i; // [sp+68h] [bp-10h]@1 signed int j; // [sp+68h] [bp-10h]@18 signed int k; // [sp+68h] [bp-10h]@35 int v21; // [sp+6Ch] [bp-Ch]@4 int v22; // [sp+6Ch] [bp-Ch]@21 int v23; // [sp+6Ch] [bp-Ch]@23 int v24; // [sp+6Ch] [bp-Ch]@38 int v25; // [sp+6Ch] [bp-Ch]@40 int v26; // [sp+74h] [bp-4h]@1 v26 = 162 * a2 + a1 + setting_map_startGridOffset; v11 = 12; v10 = 162 * a2 + a1 + setting_map_startGridOffset; v9 = 0; for ( i = 0; i < 20; ++i ) { v21 = dword_5F34A0[i]; if ( !v21 ) break; v2 = grid_terrain[v21 + v26]; if ( !(v2 & 8) || buildings[grid_buildingIds[v21 + v26]].type != 58 ) { v3 = grid_terrain[v21 + v26]; if ( v3 & 0x40 ) { v15 = 0; v12 = 11; while ( v15 < 10 ) { if ( city_inform[ciid].dword_6545CC[v15] == *(&byte_91C920[v21] + v26) ) { v12 = v15; break; } ++v15; } if ( v12 < v11 ) { v11 = v12; v10 = i; v9 = 0; } } } } for ( j = 0; j < 20; ++j ) { v22 = dword_5F34A0[j]; if ( !v22 ) break; v23 = v22 + 5; v4 = grid_terrain[v23 + v26]; if ( !(v4 & 8) || buildings[grid_buildingIds[v23 + v26]].type != 58 ) { v5 = grid_terrain[v23 + v26]; if ( v5 & 0x40 ) { v16 = 0; v13 = 11; while ( v16 < 10 ) { if ( city_inform[ciid].dword_6545CC[v16] == *(&byte_91C920[v23] + v26) ) { v13 = v16; break; } ++v16; } if ( v13 < v11 ) { v11 = v13; v10 = j; v9 = 5; } } } } for ( k = 0; k < 20; ++k ) { v24 = dword_5F34A0[k]; if ( !v24 ) break; v25 = v24 + 10; v6 = grid_terrain[v25 + v26]; if ( !(v6 & 8) || buildings[grid_buildingIds[v25 + v26]].type != 58 ) { v7 = grid_terrain[v25 + v26]; if ( v7 & 0x40 ) { v17 = 0; v14 = 11; while ( v17 < 10 ) { if ( city_inform[ciid].dword_6545CC[v17] == *(&byte_91C920[v25] + v26) ) { v14 = v17; break; } ++v17; } if ( v14 < v11 ) { v11 = v14; v10 = k; v9 = 10; } } } } if ( v11 >= 12 ) { result = 0; } else { walkerGridX = v9 + dword_5F39C0[2 * v10] + a1; walkerGridY = dword_5F39C4[2 * v10] + a2; result = 1; } return result; } signed int fun_granaryHasRoadAccess(int x, int y) { __int16 v2; // ax@1 signed int result; // eax@2 __int16 v4; // cx@3 __int16 v5; // dx@5 __int16 v6; // ax@7 int v7; // [sp+4Ch] [bp-4h]@1 v7 = 162 * y + x + setting_map_startGridOffset; v2 = grid_terrain_xPlusOne_yMinusOne[162 * y + x + setting_map_startGridOffset]; if ( v2 & T_Road ) { walkerGridX = x + 1; walkerGridY = y - 1; result = 1; } else { v4 = grid_terrain_xPlusThree_yPlusOne[v7]; if ( v4 & T_Road ) { walkerGridX = x + 3; walkerGridY = y + 1; result = 1; } else { v5 = grid_terrain_xPlusOne_yPlusThree[v7]; if ( v5 & T_Road ) { walkerGridX = x + 1; walkerGridY = y + 3; result = 1; } else { v6 = grid_terrain_xMinusOne_yPlusOne[v7]; if ( v6 & T_Road ) { walkerGridX = x - 1; walkerGridY = y + 1; result = 1; } else { result = 0; } } } } return result; } signed int sub_489E70(int a1, int a2, int a3) { __int16 v3; // cx@6 __int16 v4; // ax@7 signed int i; // [sp+50h] [bp-Ch]@1 int v7; // [sp+54h] [bp-8h]@4 int v8; // [sp+58h] [bp-4h]@1 v8 = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; i < 20; ++i ) { v7 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * i); if ( !v7 ) break; v3 = grid_terrain[v7 + v8]; if ( v3 & T_Water ) { v4 = grid_terrain[v7 + v8]; if ( !(v4 & T_Building) ) { walkerBaseGridOffset = v7 + v8; sub_483BF0(4); if ( sub_490AE0() >= 8 ) { walkerGridX = *(int *)((char *)&dword_5F36A0[40 * a3] + 8 * i) + a1; walkerGridY = *(int *)((char *)&dword_5F36A4[40 * a3] + 8 * i) + a2; return 1; } } } } return 0; } signed int fun_isAdjacentToWall(int x, int y, int size) { signed int i; // [sp+4Ch] [bp-Ch]@1 int offset; // [sp+50h] [bp-8h]@3 for ( i = 0; i < 20; ++i ) { offset = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * size] + 4 * i); if ( !offset ) break; if ( grid_terrain[offset + 162 * y + x + setting_map_startGridOffset] & T_Wall ) return 1; } return 0; } signed int sub_48A050(int a1, int a2, int a3) { signed int v4; // [sp+4Ch] [bp-14h]@6 signed int i; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@3 int v7; // [sp+5Ch] [bp-4h]@5 for ( i = 0; i < 20; ++i ) { v6 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * i); if ( !v6 ) break; v7 = 162 * a2 + a1 + setting_map_startGridOffset; if ( grid_terrain[v6 + v7] & T_Road ) { v4 = 1; } else { if ( grid_terrain[v6 + v7] & 0xD77F ) v4 = 0; else v4 = 1; } if ( v4 ) { walkerGridX = *(int *)((char *)&dword_5F36A0[40 * a3] + 8 * i) + a1; walkerGridY = *(int *)((char *)&dword_5F36A4[40 * a3] + 8 * i) + a2; return 1; } } return 0; } int sub_48A180(int a1) { int result; // eax@2 signed int i; // [sp+4Ch] [bp-8h]@3 int v3; // [sp+50h] [bp-4h]@13 if ( city_inform[ciid].numWorkingDocks > 0 ) { for ( i = 0; ; ++i ) { if ( i < 10 ) { v3 = city_inform[ciid].word_654388[i]; if ( v3 <= 0 ) continue; if ( buildings[v3].wharf_hasBoat_house_evolveStatusDesir && buildings[v3].wharf_hasBoat_house_evolveStatusDesir != a1 ) continue; } break; } if ( v3 > 0 ) { if ( buildings[v3].house_neptune ) { if ( buildings[v3].house_neptune == 1 ) { walkerGridX = buildings[v3].x + 3; walkerGridY = buildings[v3].y + 1; } else { if ( buildings[v3].house_neptune == 2 ) { walkerGridX = buildings[v3].x + 1; walkerGridY = buildings[v3].y + 3; } else { walkerGridX = buildings[v3].x - 1; walkerGridY = buildings[v3].y + 1; } } } else { walkerGridX = buildings[v3].x + 1; walkerGridY = buildings[v3].y - 1; } buildings[v3].wharf_hasBoat_house_evolveStatusDesir = a1; result = v3; } else { result = 0; } } else { result = 0; } return result; } signed int sub_48A390(int a1) { signed int result; // eax@14 signed int v2; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 v2 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 && buildings[i].type == 76 ) { if ( !buildings[i].wharf_hasBoat_house_evolveStatusDesir ) { v2 = i; break; } if ( buildings[i].wharf_hasBoat_house_evolveStatusDesir == a1 ) { v2 = i; break; } } } if ( v2 > 0 ) { if ( buildings[v2].house_neptune ) { if ( buildings[v2].house_neptune == 1 ) { walkerGridX = buildings[v2].x + 2; walkerGridY = buildings[v2].y + 1; } else { if ( buildings[v2].house_neptune == 2 ) { walkerGridX = buildings[v2].x + 1; walkerGridY = buildings[v2].y + 2; } else { walkerGridX = buildings[v2].x - 1; walkerGridY = buildings[v2].y + 1; } } } else { walkerGridX = buildings[v2].x + 1; walkerGridY = buildings[v2].y - 1; } result = v2; } else { result = 0; } return result; } signed int sub_48A590(int a1) { signed int result; // eax@7 int v2; // [sp+4Ch] [bp-14h]@1 signed int v3; // [sp+50h] [bp-10h]@8 signed int v4; // [sp+54h] [bp-Ch]@8 int v5; // [sp+58h] [bp-8h]@13 signed int i; // [sp+5Ch] [bp-4h]@1 signed int j; // [sp+5Ch] [bp-4h]@8 v2 = 0; for ( i = 0; i < 8; ++i ) { if ( scn_fish_x[i] > 0 ) ++v2; } if ( v2 > 0 ) { v4 = 10000; v3 = 0; for ( j = 0; j < 8; ++j ) { if ( scn_fish_x[j] > 0 ) { v5 = fun_getDistanceMaximum(walkers[a1].x, walkers[a1].y, scn_fish_x[j], scn_fish_y[j]); if ( v5 < v4 ) { v4 = v5; v3 = j; } } } if ( v4 < 10000 ) { walkerGridX = LOBYTE(scn_fish_x[v3]); walkerGridY = LOBYTE(scn_fish_y[v3]); result = 1; } else { result = 0; } } else { result = 0; } return result; } signed int sub_48A6F0(int a1) { signed int result; // eax@2 int v2; // ST5C_4@5 int v3; // ST58_4@5 __int16 v4; // cx@17 int v5; // [sp+50h] [bp-1Ch]@5 int v6; // [sp+54h] [bp-18h]@5 int v7; // [sp+58h] [bp-14h]@5 int v8; // [sp+5Ch] [bp-10h]@5 int v9; // [sp+60h] [bp-Ch]@13 signed int i; // [sp+68h] [bp-4h]@3 if ( grid_walkerIds[ walkers[a1].gridOffset ] == a1 ) { result = 1; } else { for ( i = 1; i <= 5; ++i ) { v2 = walkers[a1].x; v3 = walkers[a1].y; v6 = i + v2; v5 = i + v3; v8 = v2 - i; v7 = v3 - i; if ( v8 < 0 ) v8 = 0; if ( v7 < 0 ) v7 = 0; if ( v6 >= setting_map_width ) v6 = setting_map_width - 1; if ( v5 >= setting_map_height ) v5 = setting_map_height - 1; v9 = 162 * v7 + v8 + setting_map_startGridOffset; walkerGridY = v7; while ( walkerGridY <= v5 ) { walkerGridX = v8; while ( walkerGridX <= v6 ) { v4 = grid_terrain[v9]; if ( v4 & 4 && !grid_walkerIds[v9] ) return 0; ++walkerGridX; ++v9; } ++walkerGridY; v9 += 162 - (v6 - v8 + 1); } } result = 1; } return result; } signed int sub_48A900(int a1) { __int16 v1; // ax@1 signed int result; // eax@3 int v3; // ST5C_4@6 int v4; // ST58_4@6 __int16 v5; // ax@19 __int16 v6; // ax@23 __int16 v7; // dx@25 __int16 v8; // cx@27 __int16 v9; // ax@29 int v10; // [sp+50h] [bp-1Ch]@6 int v11; // [sp+54h] [bp-18h]@6 int v12; // [sp+58h] [bp-14h]@6 int v13; // [sp+5Ch] [bp-10h]@6 int v14; // [sp+60h] [bp-Ch]@1 int v15; // [sp+60h] [bp-Ch]@14 signed int i; // [sp+68h] [bp-4h]@4 v14 = walkers[a1].gridOffset; v1 = grid_terrain[v14]; if ( v1 & 4 && grid_walkerIds[v14] == a1 ) { result = 0; } else { for ( i = 1; i <= 5; ++i ) { v3 = walkers[a1].x; v4 = walkers[a1].y; v11 = i + v3; v10 = i + v4; v13 = v3 - i; v12 = v4 - i; if ( v13 < 0 ) v13 = 0; if ( v12 < 0 ) v12 = 0; if ( v11 >= setting_map_width ) v11 = setting_map_width - 1; if ( v10 >= setting_map_height ) v10 = setting_map_height - 1; v15 = 162 * v12 + v13 + setting_map_startGridOffset; walkerGridY = v12; while ( walkerGridY <= v10 ) { walkerGridX = v13; while ( walkerGridX <= v11 ) { v5 = grid_terrain[v15]; if ( v5 & 4 ) { if ( !grid_walkerIds[v15] || grid_walkerIds[v15] == a1 ) { v6 = word_9092D8[v15]; if ( v6 & 4 ) { v7 = grid_terrain_xPlusTwo_y[v15]; if ( v7 & 4 ) { v8 = word_9097E8[v15]; if ( v8 & 4 ) { v9 = grid_terrain_xMinusTwo_y[v15]; if ( v9 & 4 ) return 1; } } } } } ++walkerGridX; ++v15; } ++walkerGridY; v15 += 162 - (v11 - v13 + 1); } } result = 0; } return result; } int sub_48ABC0() { int result; // eax@2 signed int i; // [sp+4Ch] [bp-Ch]@3 signed int j; // [sp+4Ch] [bp-Ch]@18 int v3; // [sp+54h] [bp-4h]@6 int v4; // [sp+54h] [bp-4h]@21 if ( city_inform[ciid].numWorkingDocks > 0 ) { for ( i = 0; i < 10; ++i ) { v3 = city_inform[ciid].word_654388[i]; if ( v3 > 0 ) { if ( buildings[v3].house_neptune ) { if ( buildings[v3].house_neptune == 1 ) { walkerGridX = buildings[v3].x + 4; walkerGridY = buildings[v3].y + 2; } else { if ( buildings[v3].house_neptune == 2 ) { walkerGridX = buildings[v3].x + 2; walkerGridY = buildings[v3].y + 4; } else { walkerGridX = buildings[v3].x - 2; walkerGridY = buildings[v3].y + 2; } } } else { walkerGridX = buildings[v3].x + 2; walkerGridY = buildings[v3].y - 2; } if ( !grid_walkerIds[162 * walkerGridY + walkerGridX + setting_map_startGridOffset] ) return v3; } } for ( j = 0; j < 10; ++j ) { v4 = city_inform[ciid].word_654388[j]; if ( v4 > 0 ) { if ( buildings[v4].house_neptune ) { if ( buildings[v4].house_neptune == 1 ) { walkerGridX = buildings[v4].x + 5; walkerGridY = buildings[v4].y + 2; } else { if ( buildings[v4].house_neptune == 2 ) { walkerGridX = buildings[v4].x + 2; walkerGridY = buildings[v4].y + 5; } else { walkerGridX = buildings[v4].x - 3; walkerGridY = buildings[v4].y + 2; } } } else { walkerGridX = buildings[v4].x + 2; walkerGridY = buildings[v4].y - 3; } if ( !grid_walkerIds[162 * walkerGridY + walkerGridX + setting_map_startGridOffset] ) return v4; } } result = 0; } else { result = 0; } return result; } signed int isAdjacentToWater(int x, int y, int size) { __int16 v3; // cx@5 signed int i; // [sp+4Ch] [bp-Ch]@1 int offset; // [sp+50h] [bp-8h]@3 for ( i = 0; i < 20; ++i ) { offset = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * size] + 4 * i); if ( !offset ) break; v3 = grid_terrain[offset + 162 * y + x + setting_map_startGridOffset]; if ( v3 & T_Water ) return 1; } return 0; } int sub_48B030(int a1, int a2, int a3) { __int16 v3; // dx@6 int result; // eax@19 int v5; // [sp+4Ch] [bp-34h]@1 signed int v6; // [sp+50h] [bp-30h]@1 signed int v7; // [sp+54h] [bp-2Ch]@10 int v8; // [sp+5Ch] [bp-24h]@31 int v9; // [sp+60h] [bp-20h]@31 int v10; // [sp+64h] [bp-1Ch]@20 signed int v11; // [sp+68h] [bp-18h]@20 signed int v12; // [sp+6Ch] [bp-14h]@25 signed int v13; // [sp+70h] [bp-10h]@10 signed int i; // [sp+74h] [bp-Ch]@1 signed int j; // [sp+74h] [bp-Ch]@20 int v16; // [sp+78h] [bp-8h]@4 int v17; // [sp+78h] [bp-8h]@23 int v18; // [sp+7Ch] [bp-4h]@1 v18 = 162 * a2 + a1 + setting_map_startGridOffset; v6 = 12; v5 = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; i < 20; ++i ) { v16 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * i); if ( !v16 ) break; v3 = grid_terrain[v16 + v18]; if ( v3 & 0x40 && grid_pathingDistance[v16 + v18] > 0 ) { v13 = 0; v7 = 11; while ( v13 < 10 ) { if ( city_inform[ciid].dword_6545CC[v13] == *(&byte_91C920[v16] + v18) ) { v7 = v13; break; } ++v13; } if ( v7 < v6 ) { v6 = v7; v5 = i; } } } if ( v6 >= 12 ) { v11 = 100000; v10 = -1; for ( j = 0; j < 20; ++j ) { v17 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * j); if ( !v17 ) break; v12 = grid_pathingDistance[v17 + v18]; if ( v12 > 0 ) { if ( v12 < v11 ) { v11 = grid_pathingDistance[v17 + v18]; v10 = v17 + v18; v9 = *(int *)((char *)&dword_5F36A0[40 * a3] + 8 * j) + a1; v8 = *(int *)((char *)&dword_5F36A4[40 * a3] + 8 * j) + a2; } } } if ( v10 < 0 ) { result = 0; } else { walkerGridX = v9; walkerGridY = v8; result = v10 + 1; } } else { walkerGridX = *(int *)((char *)&dword_5F36A0[40 * a3] + 8 * v5) + a1; walkerGridY = *(int *)((char *)&dword_5F36A4[40 * a3] + 8 * v5) + a2; result = v18 + *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * v5) + 1; } return result; } int sub_48B2F0(int a1, int a2, int a3) { __int16 v3; // cx@8 int result; // eax@22 signed int v5; // [sp+4Ch] [bp-3Ch]@1 signed int v6; // [sp+4Ch] [bp-3Ch]@23 signed int i; // [sp+50h] [bp-38h]@1 signed int k; // [sp+50h] [bp-38h]@23 int v9; // [sp+54h] [bp-34h]@1 signed int v10; // [sp+58h] [bp-30h]@1 signed int v11; // [sp+5Ch] [bp-2Ch]@12 int v12; // [sp+64h] [bp-24h]@37 int v13; // [sp+68h] [bp-20h]@37 int v14; // [sp+6Ch] [bp-1Ch]@23 signed int v15; // [sp+70h] [bp-18h]@23 signed int v16; // [sp+74h] [bp-14h]@30 signed int v17; // [sp+78h] [bp-10h]@12 signed int j; // [sp+7Ch] [bp-Ch]@3 signed int l; // [sp+7Ch] [bp-Ch]@25 int v20; // [sp+80h] [bp-8h]@6 int v21; // [sp+80h] [bp-8h]@8 int v22; // [sp+80h] [bp-8h]@28 int v23; // [sp+80h] [bp-8h]@30 int v24; // [sp+84h] [bp-4h]@1 v24 = 162 * a2 + a1 + setting_map_startGridOffset; v10 = 12; v9 = 162 * a2 + a1 + setting_map_startGridOffset; v5 = 0; for ( i = 0; i <= 10; i += 5 ) { for ( j = 0; j < 20; ++j ) { v20 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * j); if ( !v20 ) break; v21 = i + v20; v3 = grid_terrain[v21 + v24]; if ( v3 & 0x40 && grid_pathingDistance[v21 + v24] > 0 ) { v17 = 0; v11 = 11; while ( v17 < 10 ) { if ( city_inform[ciid].dword_6545CC[v17] == *(&byte_91C920[v21] + v24) ) { v11 = v17; break; } ++v17; } if ( v11 < v10 ) { v10 = v11; v9 = j; v5 = i; } } } } if ( v10 >= 12 ) { v15 = 100000; v14 = -1; v6 = 0; for ( k = 0; k <= 10; k += 5 ) { for ( l = 0; l < 20; ++l ) { v22 = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * l); if ( !v22 ) break; v23 = k + v22; v16 = grid_pathingDistance[v23 + v24]; if ( v16 > 0 ) { if ( v16 < v15 ) { v15 = grid_pathingDistance[v23 + v24]; v14 = v23 + v24; v6 = k; v13 = k + *(int *)((char *)&dword_5F36A0[40 * a3] + 8 * l) + a1; v12 = *(int *)((char *)&dword_5F36A4[40 * a3] + 8 * l) + a2; } } } } if ( v14 < 0 ) { result = 0; } else { walkerGridX = v6 + v13; walkerGridY = v12; result = v14 + v6 + 1; } } else { walkerGridX = v5 + *(int *)((char *)&dword_5F36A0[40 * a3] + 8 * v9) + a1; walkerGridY = *(int *)((char *)&dword_5F36A4[40 * a3] + 8 * v9) + a2; result = v24 + v5 + *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * a3] + 4 * v9) + 1; } return result; } signed int fun_isAdjacentToOpenWater(int x, int y, int size) { __int16 terrain; // cx@6 signed int i; // [sp+4Ch] [bp-Ch]@1 int offset; // [sp+50h] [bp-8h]@4 int baseOffset; // [sp+54h] [bp-4h]@1 baseOffset = 162 * y + x + setting_map_startGridOffset; for ( i = 0; i < 20; ++i ) { offset = *(int *)((char *)&tilesAroundBuildingGridOffsets[20 * size] + 4 * i); if ( !offset ) break; terrain = grid_terrain[offset + baseOffset]; if ( terrain & T_Water && grid_pathingDistance[offset + baseOffset] ) return 1; } return 0; } signed int sub_48B700(int a1, int a2, int a3) { __int16 v3; // cx@6 __int16 v4; // ax@8 __int16 *v6; // [sp+4Ch] [bp-20h]@1 int i; // [sp+50h] [bp-1Ch]@1 int v8; // [sp+54h] [bp-18h]@1 int v9; // [sp+58h] [bp-14h]@6 v6 = &word_9D7360[word_5F1852[a3]]; v8 = word_5F1816[a3]; walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; i < v8; ++i ) { if ( !sub_48C110(a1, a2, 1, a3, i) ) { v9 = v6[i]; v3 = grid_terrain[v9 + walkerBaseGridOffset]; if ( !(v3 & 1) ) { v4 = grid_terrain[v9 + walkerBaseGridOffset]; if ( !(v4 & 2) ) return 0; } } } return 1; } signed int sub_48B840(int a1, int a2, int a3) { __int16 *v4; // [sp+4Ch] [bp-20h]@1 int i; // [sp+50h] [bp-1Ch]@1 int v6; // [sp+54h] [bp-18h]@1 v4 = &word_9D7360[word_5F1852[a3]]; v6 = word_5F1816[a3]; walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; for ( i = 0; i < v6; ++i ) { if ( !sub_48C110(a1, a2, 1, a3, i) && !(grid_terrain[v4[i] + walkerBaseGridOffset] & 0x800) ) return 0; } return 1; } signed int fun_mapAreaContainsTerrain(int x, int y, int size, int terrain) { walkerBaseGridOffset = 162 * y + x + setting_map_startGridOffset; walkerGridY = y; while ( walkerGridY <= y + size - 1 ) { walkerGridX = x; while ( walkerGridX <= x + size - 1 ) { if ( walkerGridX >= 0 && walkerGridY >= 0 && walkerGridX < setting_map_width && walkerGridY < setting_map_height && terrain & grid_terrain[walkerBaseGridOffset] ) return 1; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (x + size - 1 - x + 1); } return 0; } signed int sub_48BAC0(int a1, int a2, int a3) { signed int v4; // [sp+4Ch] [bp-20h]@9 int v5; // [sp+50h] [bp-1Ch]@26 int v6; // [sp+54h] [bp-18h]@26 int v7; // [sp+5Ch] [bp-10h]@1 int v8; // [sp+60h] [bp-Ch]@1 int v9; // [sp+64h] [bp-8h]@9 int v10; // [sp+74h] [bp+8h]@1 int v11; // [sp+78h] [bp+Ch]@1 v8 = a1 + 4; v7 = a2 + 4; v10 = a1 - 4; v11 = a2 - 4; if ( v10 < 0 ) v10 = 0; if ( v11 < 0 ) v11 = 0; if ( v8 >= setting_map_width ) v8 = setting_map_width - 1; if ( v7 >= setting_map_height ) v7 = setting_map_height - 1; v9 = 162 * v11 + v10 + setting_map_startGridOffset; v4 = 0; walkerGridY = v11; while ( walkerGridY <= v7 ) { walkerGridX = v10; while ( walkerGridX <= v8 ) { if ( !(grid_terrain[v9] & 0xF3FF) ) { if ( byte_902EC0[v9] ) return 0; if ( a3 ) { if ( grid_desirability[v9] > 1 ) return 0; } else { if ( grid_desirability[v9] ) return 0; } v4 = 1; v6 = walkerGridX; v5 = walkerGridY; } ++walkerGridX; ++v9; } ++walkerGridY; v9 += 162 - (v8 - v10 + 1); } walkerGridX = v6; walkerGridY = v5; return v4; } int sub_48BCD0(int a1, int a2, int a3, int a4, int a5, int a6, signed int a7) { int result; // eax@7 int v8; // [sp+4Ch] [bp-8h]@5 signed int v9; // [sp+50h] [bp-4h]@5 if ( a3 > 0 ) { if ( a7 > 6 ) a7 = 6; v8 = 0; v9 = 1; while ( a7 > 0 ) { sub_48BD80(a1, a2, a3, v9++, a4); result = a7-- - 1; ++v8; if ( v8 >= a5 ) { result = a6 + a4; a4 += a6; v8 = 0; } } } return result; } int sub_48BD80(int a1, int a2, int a3, int a4, char a5) { int result; // eax@7 int v6; // eax@33 signed int v7; // [sp+4Ch] [bp-28h]@1 __int16 *v8; // [sp+50h] [bp-24h]@22 int v9; // [sp+54h] [bp-20h]@22 int j; // [sp+58h] [bp-1Ch]@20 int i; // [sp+58h] [bp-1Ch]@28 int v12; // [sp+5Ch] [bp-18h]@21 v7 = 0; if ( a1 - a4 < -1 ) v7 = 1; if ( a2 - a4 < -1 ) v7 = 1; if ( a4 + a1 + a3 - 1 > setting_map_width ) v7 = 1; result = a4 + a2 + a3 - 1; if ( a4 + a2 + a3 - 1 > setting_map_height ) v7 = 1; switch ( a3 ) { case 1: v8 = &word_9D7360[word_5F1852[a4]]; result = word_5F1816[a4]; v12 = word_5F1816[a4]; break; case 2: v8 = &word_9D74C0[word_5F185E[a4]]; result = word_5F1822[a4]; v12 = word_5F1822[a4]; break; case 3: v8 = &word_9D7640[word_5F186A[a4]]; result = word_5F182E[a4]; v12 = word_5F182E[a4]; break; case 4: v8 = &word_9D5CA0[word_5F1876[a4]]; result = word_5F183A[a4]; v12 = word_5F183A[a4]; break; case 5: v8 = &word_9D6320[word_5F1882[a4]]; result = word_5F1846[a4]; v12 = word_5F1846[a4]; break; } walkerBaseGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( v7 ) { for ( i = 0; i < v12; ++i ) { if ( !sub_48C110(a1, a2, a3, a4, i) ) { v6 = v8[i] + walkerBaseGridOffset; grid_desirability[v6] += a5; if ( grid_desirability[walkerBaseGridOffset] < -100 ) grid_desirability[walkerBaseGridOffset] = -100; if ( grid_desirability[walkerBaseGridOffset] > 100 ) grid_desirability[walkerBaseGridOffset] = 100; } result = i + 1; } } else { for ( j = 0; j < v12; ++j ) { v9 = v8[j] + walkerBaseGridOffset; grid_desirability[v9] += a5; if ( grid_desirability[v9] < -100 ) grid_desirability[v9] = -100; if ( grid_desirability[v9] > 100 ) grid_desirability[v9] = 100; result = j + 1; } } return result; } bool sub_48C110(int a1, int a2, int buildingSize, int distance, int a5) { bool result; // eax@71 int v6; // [sp+4Ch] [bp-8h]@72 int v7; // [sp+50h] [bp-4h]@70 switch ( buildingSize ) { case 1: switch ( distance ) { case 1: v7 = stru_5F1890[a5].x; v6 = stru_5F1890[a5].y; break; case 2: v7 = stru_5F18A0[a5].x; v6 = stru_5F18A0[a5].y; break; case 3: v7 = stru_5F18C0[a5].x; v6 = stru_5F18C0[a5].y; break; case 4: v7 = stru_5F18F0[a5].x; v6 = stru_5F18F0[a5].y; break; case 5: v7 = stru_5F1930[a5].x; v6 = stru_5F1930[a5].y; break; case 6: v7 = stru_5F1980[a5].x; v6 = stru_5F1980[a5].y; break; } break; case 2: switch ( distance ) { case 1: v7 = stru_5F19E0[a5].x; v6 = stru_5F19E0[a5].y; break; case 2: v7 = stru_5F19F8[a5].x; v6 = stru_5F19F8[a5].y; break; case 3: v7 = stru_5F1A20[a5].x; v6 = stru_5F1A20[a5].y; break; case 4: v7 = stru_5F1A58[a5].x; v6 = stru_5F1A58[a5].y; break; case 5: v7 = stru_5F1AA0[a5].x; v6 = stru_5F1AA0[a5].y; break; case 6: v7 = stru_5F1AF8[a5].x; v6 = stru_5F1AF8[a5].y; break; } break; case 3: switch ( distance ) { case 1: v7 = stru_5F1B60[a5].x; v6 = stru_5F1B60[a5].y; break; case 2: v7 = stru_5F1B80[a5].x; v6 = stru_5F1B80[a5].y; break; case 3: v7 = stru_5F1BB0[a5].x; v6 = stru_5F1BB0[a5].y; break; case 4: v7 = stru_5F1BF0[a5].x; v6 = stru_5F1BF0[a5].y; break; case 5: v7 = stru_5F1C40[a5].x; v6 = stru_5F1C40[a5].y; break; case 6: v7 = stru_5F1CA0[a5].x; v6 = stru_5F1CA0[a5].y; break; } break; case 4: switch ( distance ) { case 1: v7 = stru_5F1D10[a5].x; v6 = stru_5F1D10[a5].y; break; case 2: v7 = stru_5F1D38[a5].x; v6 = stru_5F1D38[a5].y; break; case 3: v7 = stru_5F1D70[a5].x; v6 = stru_5F1D70[a5].y; break; case 4: v7 = stru_5F1DB8[a5].x; v6 = stru_5F1DB8[a5].y; break; case 5: v7 = stru_5F1E10[a5].x; v6 = stru_5F1E10[a5].y; break; case 6: v7 = stru_5F1E78[a5].x; v6 = stru_5F1E78[a5].y; break; } break; case 5: switch ( distance ) { case 1: v7 = stru_5F1EF0[a5].x; v6 = stru_5F1EF0[a5].y; break; case 2: v7 = stru_5F1F20[a5].x; v6 = stru_5F1F20[a5].y; break; case 3: v7 = stru_5F1F60[a5].x; v6 = stru_5F1F60[a5].y; break; case 4: v7 = stru_5F1FB0[a5].x; v6 = stru_5F1FB0[a5].y; break; case 5: v7 = stru_5F2010[a5].x; v6 = stru_5F2010[a5].y; break; case 6: v7 = stru_5F2080[a5].x; v6 = stru_5F2080[a5].y; break; } break; } if ( v7 + a1 >= -1 ) { if ( v6 + a2 >= -1 ) { if ( v7 + a1 <= setting_map_width ) result = v6 + a2 > setting_map_height; else result = 1; } else { result = 1; } } else { result = 1; } return result; } __int16 sub_48C740() { int v0; // eax@18 __int16 v2; // [sp+50h] [bp-18h]@17 __int16 v3; // [sp+54h] [bp-14h]@17 int v4; // [sp+58h] [bp-10h]@1 int v5; // [sp+58h] [bp-10h]@19 int v6; // [sp+58h] [bp-10h]@37 int v7; // [sp+58h] [bp-10h]@55 int v8; // [sp+58h] [bp-10h]@73 int v9; // [sp+5Ch] [bp-Ch]@3 int v10; // [sp+5Ch] [bp-Ch]@21 int v11; // [sp+5Ch] [bp-Ch]@39 int v12; // [sp+5Ch] [bp-Ch]@57 int v13; // [sp+5Ch] [bp-Ch]@75 int i; // [sp+60h] [bp-8h]@3 int j; // [sp+60h] [bp-8h]@21 int k; // [sp+60h] [bp-8h]@39 int l; // [sp+60h] [bp-8h]@57 int m; // [sp+60h] [bp-8h]@75 signed int v19; // [sp+64h] [bp-4h]@1 signed int v20; // [sp+64h] [bp-4h]@19 signed int v21; // [sp+64h] [bp-4h]@37 signed int v22; // [sp+64h] [bp-4h]@55 signed int v23; // [sp+64h] [bp-4h]@73 v19 = 0; v4 = 0; while ( v19 < 6 ) { v9 = word_5F1818[v19]; for ( i = 0; i < v9; ++i ) { if ( v19 ) { switch ( v19 ) { case 1: v3 = stru_5F18A0[i].x; v2 = stru_5F18A0[i].y; break; case 2: v3 = stru_5F18C0[i].x; v2 = stru_5F18C0[i].y; break; case 3: v3 = stru_5F18F0[i].x; v2 = stru_5F18F0[i].y; break; case 4: v3 = stru_5F1930[i].x; v2 = stru_5F1930[i].y; break; case 5: v3 = stru_5F1980[i].x; v2 = stru_5F1980[i].y; break; } } else { v3 = stru_5F1890[i].x; v2 = stru_5F1890[i].y; } word_9D7360[v4++] = 162 * v2 + v3; } v0 = v19++ + 1; } v20 = 0; v5 = 0; while ( v20 < 6 ) { _LOWORD(v0) = word_5F1824[v20]; v10 = word_5F1824[v20]; for ( j = 0; j < v10; ++j ) { if ( v20 ) { switch ( v20 ) { case 1: v3 = stru_5F19F8[j].x; v2 = stru_5F19F8[j].y; break; case 2: v3 = stru_5F1A20[j].x; v2 = stru_5F1A20[j].y; break; case 3: v3 = stru_5F1A58[j].x; v2 = stru_5F1A58[j].y; break; case 4: v3 = stru_5F1AA0[j].x; v2 = stru_5F1AA0[j].y; break; case 5: v3 = stru_5F1AF8[j].x; v2 = stru_5F1AF8[j].y; break; } } else { v3 = stru_5F19E0[j].x; v2 = stru_5F19E0[j].y; } _LOWORD(v0) = 162 * v2 + v3; word_9D74C0[v5++] = v0; } ++v20; } v21 = 0; v6 = 0; while ( v21 < 6 ) { v11 = word_5F1830[v21]; for ( k = 0; ; ++k ) { _LOWORD(v0) = k; if ( k >= v11 ) break; if ( v21 ) { switch ( v21 ) { case 1: v3 = stru_5F1B80[k].x; v2 = stru_5F1B80[k].y; break; case 2: v3 = stru_5F1BB0[k].x; v2 = stru_5F1BB0[k].y; break; case 3: v3 = stru_5F1BF0[k].x; v2 = stru_5F1BF0[k].y; break; case 4: v3 = stru_5F1C40[k].x; v2 = stru_5F1C40[k].y; break; case 5: v3 = stru_5F1CA0[k].x; v2 = stru_5F1CA0[k].y; break; } } else { v3 = stru_5F1B60[k].x; v2 = stru_5F1B60[k].y; } word_9D7640[v6++] = 162 * v2 + v3; } ++v21; } v22 = 0; v7 = 0; while ( v22 < 6 ) { v12 = word_5F183C[v22]; for ( l = 0; l < v12; ++l ) { if ( v22 ) { switch ( v22 ) { case 1: v3 = stru_5F1D38[l].x; v2 = stru_5F1D38[l].y; break; case 2: v3 = stru_5F1D70[l].x; v2 = stru_5F1D70[l].y; break; case 3: v3 = stru_5F1DB8[l].x; v2 = stru_5F1DB8[l].y; break; case 4: v3 = stru_5F1E10[l].x; v2 = stru_5F1E10[l].y; break; case 5: v3 = stru_5F1E78[l].x; v2 = stru_5F1E78[l].y; break; } } else { v3 = stru_5F1D10[l].x; v2 = stru_5F1D10[l].y; } word_9D5CA0[v7++] = 162 * v2 + v3; } v0 = v22++ + 1; } v23 = 0; v8 = 0; while ( v23 < 6 ) { _LOWORD(v0) = word_5F1848[v23]; v13 = word_5F1848[v23]; for ( m = 0; m < v13; ++m ) { if ( v23 ) { switch ( v23 ) { case 1: v3 = stru_5F1F20[m].x; v2 = stru_5F1F20[m].y; break; case 2: v3 = stru_5F1F60[m].x; v2 = stru_5F1F60[m].y; break; case 3: v3 = stru_5F1FB0[m].x; v2 = stru_5F1FB0[m].y; break; case 4: v3 = stru_5F2010[m].x; v2 = stru_5F2010[m].y; break; case 5: v3 = stru_5F2080[m].x; v2 = stru_5F2080[m].y; break; } } else { v3 = stru_5F1EF0[m].x; v2 = stru_5F1EF0[m].y; } _LOWORD(v0) = 162 * v2 + v3; word_9D6320[v8++] = v0; } ++v23; } return v0; } void fun_setMapAreaRangeTerrain(int x, int y, int size, int range, __int16 terrain) { int yMax; // [sp+4Ch] [bp-Ch]@1 int xMax; // [sp+50h] [bp-8h]@1 int xMin; // [sp+60h] [bp+8h]@1 int yMin; // [sp+64h] [bp+Ch]@1 xMax = range + x + size - 1; yMax = range + y + size - 1; xMin = x - range; yMin = y - range; if ( xMin < 0 ) xMin = 0; if ( yMin < 0 ) yMin = 0; if ( xMax >= setting_map_width ) xMax = setting_map_width - 1; if ( yMax >= setting_map_height ) yMax = setting_map_height - 1; walkerBaseGridOffset = 162 * yMin + xMin + setting_map_startGridOffset; walkerGridY = yMin; while ( walkerGridY <= yMax ) { walkerGridX = xMin; while ( walkerGridX <= xMax ) { grid_terrain[walkerBaseGridOffset] |= terrain; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (xMax - xMin + 1); } } void sub_48D170(int a1, int a2, int a3, int a4, __int16 a5) { int v5; // [sp+4Ch] [bp-Ch]@1 int v6; // [sp+50h] [bp-8h]@1 int v7; // [sp+60h] [bp+8h]@1 int v8; // [sp+64h] [bp+Ch]@1 v6 = a4 + a1 + a3 - 1; v5 = a4 + a2 + a3 - 1; v7 = a1 - a4; v8 = a2 - a4; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v6 >= setting_map_width ) v6 = setting_map_width - 1; if ( v5 >= setting_map_height ) v5 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v5 ) { walkerGridX = v7; while ( walkerGridX <= v6 ) { grid_terrain[walkerBaseGridOffset] &= a5; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v6 - v7 + 1); } } signed int sub_48D300(int x, int y, int a3, int a4, int a5) { int v6; // [sp+4Ch] [bp-10h]@1 int v7; // [sp+50h] [bp-Ch]@1 int v8; // [sp+54h] [bp-8h]@9 int v9; // [sp+64h] [bp+8h]@1 int v10; // [sp+68h] [bp+Ch]@1 v7 = a4 + x + a3 - 1; v6 = a4 + y + a3 - 1; v9 = x - a4; v10 = y - a4; if ( v9 < 0 ) v9 = 0; if ( v10 < 0 ) v10 = 0; if ( v7 >= setting_map_width ) v7 = setting_map_width - 1; if ( v6 >= setting_map_height ) v6 = setting_map_height - 1; v8 = 162 * v10 + v9 + setting_map_startGridOffset; walkerGridY = v10; while ( walkerGridY <= v6 ) { walkerGridX = v9; while ( walkerGridX <= v7 ) { if ( a5 & grid_terrain[v8] ) return 1; ++walkerGridX; ++v8; } ++walkerGridY; v8 += 162 - (v7 - v9 + 1); } return 0; } signed int sub_48D480(int a1, int a2, int a3, int a4, int a5) { int v6; // [sp+4Ch] [bp-10h]@1 int v7; // [sp+50h] [bp-Ch]@1 int v8; // [sp+54h] [bp-8h]@9 int v9; // [sp+64h] [bp+8h]@1 int v10; // [sp+68h] [bp+Ch]@1 v7 = a4 + a1 + a3 - 1; v6 = a4 + a2 + a3 - 1; v9 = a1 - a4; v10 = a2 - a4; if ( v9 < 0 ) v9 = 0; if ( v10 < 0 ) v10 = 0; if ( v7 >= setting_map_width ) v7 = setting_map_width - 1; if ( v6 >= setting_map_height ) v6 = setting_map_height - 1; v8 = 162 * v10 + v9 + setting_map_startGridOffset; walkerGridY = v10; while ( walkerGridY <= v6 ) { walkerGridX = v9; while ( walkerGridX <= v7 ) { if ( v8 != a5 && !grid_terrain[v8] ) return 1; ++walkerGridX; ++v8; } ++walkerGridY; v8 += 162 - (v7 - v9 + 1); } return 0; } signed int sub_48D600(int a1, int a2, int a3, int a4, int a5) { int v6; // [sp+4Ch] [bp-10h]@1 int v7; // [sp+50h] [bp-Ch]@1 int v8; // [sp+54h] [bp-8h]@9 int v9; // [sp+64h] [bp+8h]@1 int v10; // [sp+68h] [bp+Ch]@1 v7 = a4 + a1 + a3 - 1; v6 = a4 + a2 + a3 - 1; v9 = a1 - a4; v10 = a2 - a4; if ( v9 < 0 ) v9 = 0; if ( v10 < 0 ) v10 = 0; if ( v7 >= setting_map_width ) v7 = setting_map_width - 1; if ( v6 >= setting_map_height ) v6 = setting_map_height - 1; v8 = 162 * v10 + v9 + setting_map_startGridOffset; walkerGridY = v10; while ( walkerGridY <= v6 ) { walkerGridX = v9; while ( walkerGridX <= v7 ) { if ( !(a5 & grid_terrain[v8]) ) return 0; ++walkerGridX; ++v8; } ++walkerGridY; v8 += 162 - (v7 - v9 + 1); } return 1; } void sub_48D780(int a1, int a2, int a3, int a4) { int v4; // [sp+4Ch] [bp-Ch]@1 int v5; // [sp+50h] [bp-8h]@1 int v6; // [sp+60h] [bp+8h]@1 int v7; // [sp+64h] [bp+Ch]@1 v5 = a4 + a1 + a3 - 1; v4 = a4 + a2 + a3 - 1; v6 = a1 - a4; v7 = a2 - a4; if ( v6 < 0 ) v6 = 0; if ( v7 < 0 ) v7 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v7 + v6 + setting_map_startGridOffset; walkerGridY = v7; while ( walkerGridY <= v4 ) { walkerGridX = v6; while ( walkerGridX <= v5 ) { grid_edge[walkerBaseGridOffset] |= 0x80u; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v6 + 1); } } int sub_48D910(int a1, int a2, int a3, int a4) { int result; // eax@9 int v5; // edx@9 int v6; // [sp+4Ch] [bp-Ch]@1 int v7; // [sp+50h] [bp-8h]@1 int v8; // [sp+54h] [bp-4h]@9 int v9; // [sp+60h] [bp+8h]@1 int v10; // [sp+64h] [bp+Ch]@1 v7 = a4 + a1 + a3 - 1; v6 = a4 + a2 + a3 - 1; v9 = a1 - a4; v10 = a2 - a4; if ( v9 < 0 ) v9 = 0; if ( v10 < 0 ) v10 = 0; if ( v7 >= setting_map_width ) v7 = setting_map_width - 1; if ( v6 >= setting_map_height ) v6 = setting_map_height - 1; walkerBaseGridOffset = 162 * v10 + v9 + setting_map_startGridOffset; v5 = v7 - v9 + 1; result = 162 - v5; v8 = 162 - v5; walkerGridY = v10; while ( walkerGridY <= v6 ) { walkerGridX = v9; while ( walkerGridX <= v7 ) { grid_edge[walkerBaseGridOffset] &= 0x7Fu; ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; result = v8 + walkerBaseGridOffset; walkerBaseGridOffset += v8; } return result; } signed int sub_48DAA0(int x, int y, int size, int range) { signed int result; // [sp+4Ch] [bp-14h]@1 int maxY; // [sp+50h] [bp-10h]@1 int maxX; // [sp+54h] [bp-Ch]@1 int buildingId; // [sp+58h] [bp-8h]@14 int minX; // [sp+68h] [bp+8h]@1 int minY; // [sp+6Ch] [bp+Ch]@1 result = 0; maxX = range + x + size - 1; maxY = range + y + size - 1; minX = x - range; minY = y - range; if ( minX < 0 ) minX = 0; if ( minY < 0 ) minY = 0; if ( maxX >= setting_map_width ) maxX = setting_map_width - 1; if ( maxY >= setting_map_height ) maxY = setting_map_height - 1; walkerBaseGridOffset = 162 * minY + minX + setting_map_startGridOffset; walkerGridY = minY; while ( walkerGridY <= maxY ) { walkerGridX = minX; while ( walkerGridX <= maxX ) { buildingId = grid_buildingIds[walkerBaseGridOffset]; if ( buildingId > 0 ) { if ( buildings[buildingId].type != B_MissionPost ) { if ( buildings[buildingId].type != B_NativeHut ) { if ( buildings[buildingId].type != B_NativeMeeting ) { if ( buildings[buildingId].type != B_NativeCrops ) { if ( !result ) result = 1; } } } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (maxX - minX + 1); } return result; } int fun_walkerProvideEngineerCoverage(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int buildingId; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; *(_DWORD *)&engineerMaxDamageSeen = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { buildingId = grid_buildingIds[walkerBaseGridOffset]; if ( grid_buildingIds[walkerBaseGridOffset] ) { if ( buildings[buildingId].type == B_Hippodrome ) buildingId = sub_4789E0(buildingId); if ( buildings[buildingId].damageRisk > *(_DWORD *)&engineerMaxDamageSeen ) *(_DWORD *)&engineerMaxDamageSeen = buildings[buildingId].damageRisk; buildings[buildingId].damageRisk = 0; } if ( buildingId > 0 ) { if ( buildings[buildingId].house_size ) { if ( buildings[buildingId].house_population > 0 ) ++v3; } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvidePrefectFireCoverage(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; prefectMaxFireRiskSeen = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( grid_buildingIds[walkerBaseGridOffset] ) { if ( buildings[v6].type == B_Hippodrome ) v6 = sub_4789E0(v6); if ( buildings[v6].fireRisk > prefectMaxFireRiskSeen ) prefectMaxFireRiskSeen = buildings[v6].fireRisk; buildings[v6].fireRisk = 0; } if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) ++v3; } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvidePrefectCrimeCoverage(int x, int y) { int result; // eax@10 int v3; // [sp+4Ch] [bp-10h]@1 int v4; // [sp+50h] [bp-Ch]@1 int v5; // [sp+54h] [bp-8h]@13 int v6; // [sp+64h] [bp+8h]@1 int v7; // [sp+68h] [bp+Ch]@1 prefectMaxCrimeRiskSeen = 100; v4 = x + 2; v3 = y + 2; v6 = x - 2; v7 = y - 2; if ( v6 < 0 ) v6 = 0; if ( v7 < 0 ) v7 = 0; if ( v4 >= setting_map_width ) v4 = setting_map_width - 1; if ( v3 >= setting_map_height ) v3 = setting_map_height - 1; walkerBaseGridOffset = 162 * v7 + v6 + setting_map_startGridOffset; walkerGridY = v7; while ( 1 ) { result = walkerGridY; if ( walkerGridY > v3 ) break; walkerGridX = v6; while ( walkerGridX <= v4 ) { v5 = grid_buildingIds[walkerBaseGridOffset]; if ( grid_buildingIds[walkerBaseGridOffset] ) { if ( buildings[v5].house_crimeRisk < prefectMaxCrimeRiskSeen ) prefectMaxCrimeRiskSeen = buildings[v5].house_crimeRisk; } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v4 - v6 + 1); } return result; } int fun_walkerProvideTheaterAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { _LOBYTE(buildings[v6].house_theater_amphi_wine) = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideAmphitheaterAccess(int x, int y, int numShows) { int v4; // [sp+4Ch] [bp-14h]@1 int v5; // [sp+50h] [bp-10h]@1 int v6; // [sp+54h] [bp-Ch]@1 int v7; // [sp+58h] [bp-8h]@14 int v8; // [sp+68h] [bp+8h]@1 int v9; // [sp+6Ch] [bp+Ch]@1 v4 = 0; v6 = x + 2; v5 = y + 2; v8 = x - 2; v9 = y - 2; if ( v8 < 0 ) v8 = 0; if ( v9 < 0 ) v9 = 0; if ( v6 >= setting_map_width ) v6 = setting_map_width - 1; if ( v5 >= setting_map_height ) v5 = setting_map_height - 1; walkerBaseGridOffset = 162 * v9 + v8 + setting_map_startGridOffset; walkerGridY = v9; while ( walkerGridY <= v5 ) { walkerGridX = v8; while ( walkerGridX <= v6 ) { v7 = grid_buildingIds[walkerBaseGridOffset]; if ( v7 > 0 ) { if ( buildings[v7].house_size ) { if ( buildings[v7].house_population > 0 ) { _HIBYTE(buildings[v7].house_theater_amphi_wine) = 96; ++v4; if ( numShows == 2 ) _LOBYTE(buildings[v7].house_amphiGlad_colo) = 96; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v6 - v8 + 1); } return v4; } int fun_walkerProvideColosseumAccess(int x, int y, int numShows) { int v4; // [sp+4Ch] [bp-14h]@1 int v5; // [sp+50h] [bp-10h]@1 int v6; // [sp+54h] [bp-Ch]@1 int v7; // [sp+58h] [bp-8h]@14 int v8; // [sp+68h] [bp+8h]@1 int v9; // [sp+6Ch] [bp+Ch]@1 v4 = 0; v6 = x + 2; v5 = y + 2; v8 = x - 2; v9 = y - 2; if ( v8 < 0 ) v8 = 0; if ( v9 < 0 ) v9 = 0; if ( v6 >= setting_map_width ) v6 = setting_map_width - 1; if ( v5 >= setting_map_height ) v5 = setting_map_height - 1; walkerBaseGridOffset = 162 * v9 + v8 + setting_map_startGridOffset; walkerGridY = v9; while ( walkerGridY <= v5 ) { walkerGridX = v8; while ( walkerGridX <= v6 ) { v7 = grid_buildingIds[walkerBaseGridOffset]; if ( v7 > 0 ) { if ( buildings[v7].house_size ) { if ( buildings[v7].house_population > 0 ) { _HIBYTE(buildings[v7].house_amphiGlad_colo) = 96; ++v4; if ( numShows == 2 ) _LOBYTE(buildings[v7].house_coloLion_hippo) = 96; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v6 - v8 + 1); } return v4; } int fun_walkerProvideHippodromeAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { _HIBYTE(buildings[v6].house_coloLion_hippo) = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideMarketGoods(int buildingId, int x, int y) { int homesSeen; // [sp+4Ch] [bp-40h]@1 int maxY; // [sp+50h] [bp-3Ch]@1 int maxX; // [sp+54h] [bp-38h]@1 int potteryWanted; // [sp+58h] [bp-34h]@36 int furnitureWanted; // [sp+58h] [bp-34h]@42 int oilWanted; // [sp+58h] [bp-34h]@48 int wineWanted; // [sp+58h] [bp-34h]@54 int v11; // [sp+60h] [bp-2Ch]@20 int v12; // [sp+64h] [bp-28h]@20 signed int i; // [sp+6Ch] [bp-20h]@20 signed int j; // [sp+6Ch] [bp-20h]@26 signed int houseNextLevel; // [sp+70h] [bp-1Ch]@18 int wine; // [sp+74h] [bp-18h]@52 int furniture; // [sp+78h] [bp-14h]@40 int oil; // [sp+7Ch] [bp-10h]@46 int pottery; // [sp+80h] [bp-Ch]@34 int houseId; // [sp+84h] [bp-8h]@14 int minX; // [sp+98h] [bp+Ch]@1 int minY; // [sp+9Ch] [bp+10h]@1 homesSeen = 0; maxX = x + 2; maxY = y + 2; minX = x - 2; minY = y - 2; if ( minX < 0 ) minX = 0; if ( minY < 0 ) minY = 0; if ( maxX >= setting_map_width ) maxX = setting_map_width - 1; if ( maxY >= setting_map_height ) maxY = setting_map_height - 1; walkerBaseGridOffset = 162 * minY + minX + setting_map_startGridOffset; walkerGridY = minY; while ( walkerGridY <= maxY ) { walkerGridX = minX; while ( walkerGridX <= maxX ) { houseId = grid_buildingIds[walkerBaseGridOffset]; if ( houseId > 0 && buildings[houseId].house_size && buildings[houseId].house_population > 0 ) { ++homesSeen; houseNextLevel = buildings[houseId].level_resourceId; if ( houseNextLevel < 19 ) ++houseNextLevel; v12 = 4 * buildings[houseId].house_maxPopEver; v11 = 0; for ( i = 0; i < 4; ++i ) { if ( buildings[houseId].grow_value_house_foodstocks[i] >= v12 ) ++v11; } if ( model_houses[houseNextLevel].foodtypes > v11 ) { for ( j = 0; j < 4; ++j ) { if ( buildings[houseId].grow_value_house_foodstocks[j] < v12 ) { if ( buildings[buildingId].granary_capacity[j]>= v12 ) { buildings[houseId].grow_value_house_foodstocks[j] += v12; buildings[buildingId].granary_capacity[j] -= v12; break; } if ( buildings[buildingId].granary_capacity[j] ) { buildings[houseId].grow_value_house_foodstocks[j] += buildings[buildingId].granary_capacity[j]; buildings[buildingId].granary_capacity[j] = 0; break; } } } } pottery = model_houses[houseNextLevel].pottery; if ( pottery ) { buildings[buildingId].house_amphiGlad_colo = 10; if ( buildings[buildingId].house_theater_amphi_wine > 0 ) { potteryWanted = 8 * pottery - buildings[houseId].house_pottery; if ( potteryWanted > 0 ) { if ( potteryWanted <= buildings[buildingId].house_theater_amphi_wine ) { buildings[houseId].house_pottery += potteryWanted; buildings[buildingId].house_theater_amphi_wine -= potteryWanted; } else { buildings[houseId].house_pottery += buildings[buildingId].house_theater_amphi_wine; buildings[buildingId].house_theater_amphi_wine = 0; } } } } furniture = model_houses[houseNextLevel].furniture; if ( furniture ) { buildings[buildingId].house_coloLion_hippo = 10; if ( buildings[buildingId].house_pottery > 0 ) { furnitureWanted = 4 * furniture - buildings[houseId].house_furniture; if ( furnitureWanted > 0 ) { if ( furnitureWanted <= buildings[buildingId].house_pottery ) { buildings[houseId].house_furniture += furnitureWanted; buildings[buildingId].house_pottery -= furnitureWanted; } else { buildings[houseId].house_furniture += buildings[buildingId].house_pottery; buildings[buildingId].house_pottery = 0; } } } } oil = model_houses[houseNextLevel].oil; if ( oil ) { buildings[buildingId].house_school_library = 10; if ( buildings[buildingId].house_furniture > 0 ) { oilWanted = 4 * oil - buildings[houseId].house_oil; if ( oilWanted > 0 ) { if ( oilWanted <= buildings[buildingId].house_furniture ) { buildings[houseId].house_oil += oilWanted; buildings[buildingId].house_furniture -= oilWanted; } else { buildings[houseId].house_oil += buildings[buildingId].house_furniture; buildings[buildingId].house_furniture = 0; } } } } wine = model_houses[houseNextLevel].wine; if ( wine ) { buildings[buildingId].house_academy_barber = 10; if ( buildings[buildingId].house_oil > 0 ) { wineWanted = 4 * wine - buildings[houseId].house_wine; if ( wineWanted > 0 ) { if ( wineWanted <= buildings[buildingId].house_oil ) { buildings[houseId].house_wine += wineWanted; buildings[buildingId].house_oil -= wineWanted; } else { buildings[houseId].house_wine += buildings[buildingId].house_oil; buildings[buildingId].house_oil = 0; } } } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (maxX - minX + 1); } return homesSeen; } int fun_walkerProvideBathhouseAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { buildings[v6].house_bathhouse_dock_numships_entert_days = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int walkerProvideReligionAccess(int x, int y, int god) { int v4; // [sp+4Ch] [bp-14h]@1 int maxY; // [sp+50h] [bp-10h]@1 int maxX; // [sp+54h] [bp-Ch]@1 int v7; // [sp+58h] [bp-8h]@14 int minX; // [sp+68h] [bp+8h]@1 int minY; // [sp+6Ch] [bp+Ch]@1 v4 = 0; maxX = x + 2; maxY = y + 2; minX = x - 2; minY = y - 2; if ( minX < 0 ) minX = 0; if ( minY < 0 ) minY = 0; if ( maxX >= setting_map_width ) maxX = setting_map_width - 1; if ( maxY >= setting_map_height ) maxY = setting_map_height - 1; walkerBaseGridOffset = 162 * minY + minX + setting_map_startGridOffset; walkerGridY = minY; while ( walkerGridY <= maxY ) { walkerGridX = minX; while ( walkerGridX <= maxX ) { v7 = grid_buildingIds[walkerBaseGridOffset]; if ( v7 > 0 ) { if ( buildings[v7].house_size ) { if ( buildings[v7].house_population > 0 ) { ++v4; if ( god ) { switch ( god ) { case 1: buildings[v7].house_neptune = 96; break; case 2: buildings[v7].house_mercury = 96; break; case 3: buildings[v7].house_mars = 96; break; case 4: buildings[v7].house_venus = 96; break; } } else { buildings[v7].house_ceres = 96; } } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (maxX - minX + 1); } return v4; } int fun_walkerProvideSchoolAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { _LOBYTE(buildings[v6].house_school_library) = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideAcademyAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { _LOBYTE(buildings[v6].house_academy_barber) = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideLibraryAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { _HIBYTE(buildings[v6].house_school_library) = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideBarberAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { _HIBYTE(buildings[v6].house_academy_barber) = 96; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int walkerProvideClinicAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { buildings[v6].house_clinic = 0x60; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideHospitalAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { buildings[v6].house_hospital_entert_days2 = 0x60; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } signed int fun_walkerProvideMissionaryAccess(int x, int y) { int v3; // [sp+50h] [bp-10h]@1 int v4; // [sp+54h] [bp-Ch]@1 int v5; // [sp+58h] [bp-8h]@14 int v6; // [sp+68h] [bp+8h]@1 int v7; // [sp+6Ch] [bp+Ch]@1 v4 = x + 4; v3 = y + 4; v6 = x - 4; v7 = y - 4; if ( v6 < 0 ) v6 = 0; if ( v7 < 0 ) v7 = 0; if ( v4 >= setting_map_width ) v4 = setting_map_width - 1; if ( v3 >= setting_map_height ) v3 = setting_map_height - 1; walkerBaseGridOffset = 162 * v7 + v6 + setting_map_startGridOffset; walkerGridY = v7; while ( walkerGridY <= v3 ) { walkerGridX = v6; while ( walkerGridX <= v4 ) { v5 = grid_buildingIds[walkerBaseGridOffset]; if ( v5 > 0 ) { if ( buildings[v5].type == B_NativeHut ) { buildings[v5].house_crimeRisk = 0; } else { if ( buildings[v5].type == B_NativeMeeting ) buildings[v5].house_crimeRisk = 0; } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v4 - v6 + 1); } return 1; } int fun_walkerProvideLaborSeekerAccess(int x, int y) { int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@14 int v7; // [sp+68h] [bp+8h]@1 int v8; // [sp+6Ch] [bp+Ch]@1 v3 = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) ++v3; } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } int fun_walkerProvideTaxCollectorAccess(int x, int y) { int v3; // [sp+4Ch] [bp-18h]@1 int v4; // [sp+54h] [bp-10h]@1 int v5; // [sp+58h] [bp-Ch]@1 int v6; // [sp+5Ch] [bp-8h]@14 int v7; // [sp+6Ch] [bp+8h]@1 int v8; // [sp+70h] [bp+Ch]@1 v3 = 0; taxCollectorMaxHousingLevelSeen = 0; v5 = x + 2; v4 = y + 2; v7 = x - 2; v8 = y - 2; if ( v7 < 0 ) v7 = 0; if ( v8 < 0 ) v8 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; walkerBaseGridOffset = 162 * v8 + v7 + setting_map_startGridOffset; walkerGridY = v8; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { v6 = grid_buildingIds[walkerBaseGridOffset]; if ( v6 > 0 ) { if ( buildings[v6].house_size ) { if ( buildings[v6].house_population > 0 ) { if ( model_houses[buildings[v6].level_resourceId].tax > taxCollectorMaxHousingLevelSeen ) taxCollectorMaxHousingLevelSeen = model_houses[buildings[v6].level_resourceId].tax; buildings[v6].house_taxcollector = 50; ++v3; } } } ++walkerGridX; ++walkerBaseGridOffset; } ++walkerGridY; walkerBaseGridOffset += 162 - (v5 - v7 + 1); } return v3; } void sub_490850(char *buffer, int numItems) { signed int j; // [sp+50h] [bp-8h]@3 int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < numItems; ++i ) { for ( j = 0; j < 8 && (buffer[j] == 2 || buffer[j] && dword_8A11C0[j] || !buffer[j] && !dword_8A11C0[j]); ++j ) ; if ( j >= 8 ) { dword_9363A8 = buffer[setting_map_orientation / 2 + 8]; dword_89AA70 = buffer[12]; ++buffer[14]; if ( buffer[14] >= buffer[13] ) buffer[14] = 0; dword_8E7B28 = buffer[14]; return; } buffer += 16; } } void fun_setByte14Zero(char *buffer, int items) { int index; // [sp+4Ch] [bp-4h]@1 index = 0; while ( index < items ) { buffer[14] = 0; ++index; buffer += 16; } } int sub_490A00() { int result; // eax@6 signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 8; ++i ) { if ( dword_8A11C0[i] ) dword_8A11C0[i] = 0; else dword_8A11C0[i] = 1; result = i + 1; } return result; } void sub_490A70() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 8; ++i ) { if ( dword_8A11C0[i] ) dword_8A11C0[i] = 1; else dword_8A11C0[i] = 0; } } int sub_490AE0() { int v1; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 v1 = 0; for ( i = 0; i < 8; ++i ) { if ( dword_8A11C0[i] ) ++v1; } return v1; } int sub_490B40() { signed int i; // [sp+4Ch] [bp-4h]@1 dword_9363B0 = 0; dword_8E1484 = 1; dword_8E1478 = 0; undo_lastBuildingCost = 0; dword_8876B8 = 0; dword_8A7888 = toPlace_buildingType; fun_memset(undoBuildings, 6400, 0); fun_memset(word_89AAA0, 100, 0); for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 2 ) { dword_8E1484 = 0; return 0; } if ( buildings[i].inUse == 6 ) dword_8E1484 = 0; } memcpy(grid_graphicIds, undo_grid_graphicIds, 52488); memcpy(grid_terrain, undo_grid_terrain, 52488); memcpy(grid_aqueducts, undo_grid_aqueducts, 26244); memcpy(grid_bitfields, undo_grid_bitfields, 26244); memcpy(grid_edge, undo_grid_edge, 26244); memcpy(grid_animation, undo_grid_animation, 26244); return 1; } int sub_490D00() { int v1; // [sp+4Ch] [bp-8h]@4 int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < dword_8876B8; ++i ) { if ( word_89AAA0[i] ) { v1 = word_89AAA0[i]; if ( buildings[v1].inUse == 6 ) buildings[v1].inUse = 1; buildings[v1].byte_94BDBB = 0; } } dword_8876B8 = 0; fun_memset(undoBuildings, 6400, 0); return fun_memset(word_89AAA0, 100, 0); } int sub_490DE0(int a1) { signed int result; // eax@2 signed int v2; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@3 signed int j; // [sp+50h] [bp-4h]@12 v2 = 0; if ( a1 > 0 ) { dword_8876B8 = 0; for ( i = 0; i < 50; ++i ) { if ( word_89AAA0[i] ) ++dword_8876B8; if ( word_89AAA0[i] == a1 ) v2 = 1; } if ( v2 ) { result = 0; } else { for ( j = 0; j < 50; ++j ) { if ( !word_89AAA0[j] ) { ++dword_8876B8; memcpy(&buildings[a1], &undoBuildings[j], sizeof(Building)); word_89AAA0[j] = a1; return 1; } } dword_8E1484 = 0; result = 0; } } else { result = 0; } return result; } signed int sub_490F30(int a1) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-4h]@9 if ( a1 > 0 ) { if ( dword_9363B0 == 1 ) { if ( dword_8E1484 == 1 ) { if ( dword_8876B8 > 0 ) { for ( i = 0; i < 50; ++i ) { if ( word_89AAA0[i] == a1 ) return 1; } result = 0; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void sub_490FD0() { dword_9363B0 = 1; dword_8E1478 = 500; undo_lastBuildingCost = amount; window_redrawRequest = 1; } void fun_performUndo() { int v0; // ST58_4@9 int v1; // [sp+4Ch] [bp-8h]@28 int i; // [sp+50h] [bp-4h]@6 int j; // [sp+50h] [bp-4h]@25 if ( dword_9363B0 == 1 ) { if ( dword_8E1484 == 1 ) { dword_8E1484 = 0; city_inform[ciid].treasury += undo_lastBuildingCost; city_inform[ciid].finance_construction_thisyear -= undo_lastBuildingCost; if ( dword_8A7888 == 9 ) { for ( i = 0; i < dword_8876B8; ++i ) { if ( word_89AAA0[i] ) { v0 = word_89AAA0[i]; memcpy(&undoBuildings[i], &buildings[v0], sizeof(Building)); sub_4915A0(v0); } } memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); memcpy(undo_grid_animation, grid_animation, 26244); memcpy(undo_grid_graphicIds, grid_graphicIds, 52488); memcpy(undo_grid_bitfields, grid_bitfields, 26244); memcpy(undo_grid_edge, grid_edge, 26244); fun_memAndWithByte(grid_bitfields, 26244, 0xAFu); } else { if ( dword_8A7888 != 8 && dword_8A7888 != 5 && dword_8A7888 != 6 ) { if ( dword_8A7888 != 82 && dword_8A7888 != 83 ) { if ( dword_8A7888 != 38 && dword_8A7888 != 39 ) { if ( dword_8876B8 ) { if ( dword_8A7888 == 7 ) { memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); } for ( j = 0; j < dword_8876B8; ++j ) { if ( word_89AAA0[j] ) { v1 = word_89AAA0[j]; if ( buildings[v1].type >= B_LargeTempleCeres && buildings[v1].type <= B_LargeTempleVenus || buildings[v1].type == B_Oracle ) fun_refundGoods(ciid, G_Marble, 2); buildings[v1].inUse = 2; } } } } else { memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); memcpy(undo_grid_bitfields, grid_bitfields, 26244); memcpy(undo_grid_edge, grid_edge, 26244); sub_4914E0(); } } else { memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_animation, grid_animation, 26244); sub_4914E0(); } } else { memcpy(undo_grid_terrain, grid_terrain, 52488); memcpy(undo_grid_aqueducts, grid_aqueducts, 26244); sub_4914E0(); } } fun_determineGroundType(); sub_4FFDF0(); sub_500420(); dword_8876B8 = 0; } } } void sub_4914E0() { int y; // [sp+4Ch] [bp-Ch]@1 int x; // [sp+50h] [bp-8h]@3 int gridOffset; // [sp+54h] [bp-4h]@1 gridOffset = setting_map_startGridOffset; y = 0; while ( y < setting_map_height ) { x = 0; while ( x < setting_map_width ) { if ( !grid_buildingIds[gridOffset] ) grid_graphicIds[gridOffset] = undo_grid_graphicIds[gridOffset]; ++x; ++gridOffset; } ++y; gridOffset += setting_map_gridBorderSize; } } void sub_4915A0(int a1) { int v1; // ST68_4@15 if ( a1 > 0 ) { switch ( buildings[a1].type ) { case 100: sub_480460(a1, buildings[a1].x, buildings[a1].y, graphic_nativeCrops, 0); break; case 101: sub_480460(a1, buildings[a1].x, buildings[a1].y, graphic_nativeCrops + 5, 0); break; case 102: sub_480460(a1, buildings[a1].x, buildings[a1].y, graphic_nativeCrops + 10, 0); break; case 103: sub_480460(a1, buildings[a1].x, buildings[a1].y, graphic_nativeCrops + 15, 0); break; case 104: sub_480460(a1, buildings[a1].x, buildings[a1].y, graphic_nativeCrops + 20, 0); break; case 105: sub_480460(a1, buildings[a1].x, buildings[a1].y, graphic_nativeCrops + 25, 0); break; default: v1 = buildingSizes[4 * buildings[a1].type]; fun_putBuildingOnTerrainAndGraphicGrids(a1, buildings[a1].x, buildings[a1].y, v1, v1, 0, 0); break; } if ( buildings[a1].type == 76 ) buildings[a1].wharf_hasBoat_house_evolveStatusDesir = 0; buildings[a1].inUse = 1; } } void sub_4918A0() { int v0; // [sp+4Ch] [bp-8h]@31 int i; // [sp+50h] [bp-4h]@22 int j; // [sp+50h] [bp-4h]@28 if ( dword_8E1484 == 1 && dword_9363B0 == 1 ) { if ( dword_8E1478 > 0 && event_earthquake_state != 1 ) { --dword_8E1478; if ( dword_8A7888 != B_ClearLand && dword_8A7888 != B_Aqueduct && dword_8A7888 != B_Road && dword_8A7888 != B_Wall && dword_8A7888 != B_LowBridge && dword_8A7888 != B_ShipBridge && dword_8A7888 != B_Plaza && dword_8A7888 != B_Gardens ) { if ( dword_8876B8 > 0 ) { if ( dword_8A7888 == B_HouseVacantLot ) { for ( i = 0; i < dword_8876B8; ++i ) { if ( word_89AAA0[i] && buildings[word_89AAA0[i]].house_population ) { dword_8E1484 = 0; window_redrawRequest = 1; return; } } } for ( j = 0; j < dword_8876B8; ++j ) { if ( word_89AAA0[j] ) { v0 = word_89AAA0[j]; if ( buildings[v0].inUse == 2 ) { dword_8E1484 = 0; window_redrawRequest = 1; return; } if ( buildings[v0].inUse == 4 ) { dword_8E1484 = 0; window_redrawRequest = 1; return; } if ( buildings[v0].inUse == 5 ) { dword_8E1484 = 0; window_redrawRequest = 1; return; } if ( buildings[v0].gridOffset != word_8EE1E8[64 * j] ) { dword_8E1484 = 0; window_redrawRequest = 1; return; } if ( buildings[v0].type != word_8EE1EA[64 * j] ) { dword_8E1484 = 0; window_redrawRequest = 1; return; } } } } else { dword_8E1484 = 0; window_redrawRequest = 1; } } } else { dword_8E1484 = 0; window_redrawRequest = 1; fun_memset(undoBuildings, 6400, 0); fun_memset(word_89AAA0, 100, 0); } } } void fun_handleEarthquakeEvent() { signed int v0; // [sp+4Ch] [bp-18h]@21 signed int v1; // [sp+50h] [bp-14h]@21 int v2; // [sp+54h] [bp-10h]@53 int v3; // [sp+58h] [bp-Ch]@53 signed int v4; // [sp+60h] [bp-4h]@21 if ( mode_editor != 1 && scn_event_earthquake_severity && scn_earthquake_x != -1 && scn_earthquake_y != -1 ) { if ( event_earthquake_state ) { if ( event_earthquake_state != 2 ) { ++dword_89AB08; if ( dword_89AB08 >= event_earthquake_maxDamage ) { dword_89AB08 = 0; ++dword_89AA8C; if ( dword_89AA8C >= event_earthquake_maxDuration ) event_earthquake_state = 2; dword_8B4600 = random_7f_1 & 0xF; if ( dword_8B4600 ) { switch ( dword_8B4600 ) { case 4: v4 = 0; v1 = 0; v0 = -1; break; case 5: v4 = 0; v1 = -1; v0 = 0; break; case 6: v4 = 0; v1 = 1; v0 = 0; break; case 1: v4 = 1; v1 = 1; v0 = 0; break; case 7: v4 = 1; v1 = 1; v0 = 0; break; case 8: v4 = 1; v1 = 0; v0 = -1; break; case 9: v4 = 1; v1 = 0; v0 = 1; break; case 2: v4 = 2; v1 = 0; v0 = 1; break; case 10: v4 = 2; v1 = 0; v0 = 1; break; case 11: v4 = 2; v1 = -1; v0 = 0; break; case 12: v4 = 2; v1 = 1; v0 = 0; break; case 3: v4 = 3; v1 = -1; v0 = 0; break; case 13: v4 = 3; v1 = -1; v0 = 0; break; case 14: v4 = 3; v1 = 0; v0 = -1; break; default: if ( dword_8B4600 != 15 ) return; v4 = 3; v1 = 0; v0 = 1; break; } } else { v4 = 0; v1 = 0; v0 = -1; } v3 = v1 + dword_929660[2 * v4]; v2 = v0 + dword_929664[2 * v4]; if ( v3 < 0 ) v3 = 0; if ( v3 > setting_map_width - 1 ) v3 = setting_map_width - 1; if ( v2 < 0 ) v2 = 0; if ( v2 > setting_map_height - 1 ) v2 = setting_map_height - 1; if ( sub_492240(v3, v2) ) { dword_929660[2 * v4] = v3; dword_929664[2 * v4] = v2; sub_492110(v3, v2); } } } } else { if ( gametime_year == event_earthquake_gameYear && gametime_month == event_earthquake_month) { event_earthquake_state = 1; dword_89AA8C = 0; dword_89AB08 = 0; sub_492110(dword_929660[0], dword_929664[0]); message_usePopup = 1; fun_postMessageToPlayer( 62, 0, 162 * LOWORD(dword_929664[0]) + LOWORD(dword_929660[0]) + setting_map_startGridOffset); } } } } int sub_492110(int a1, int a2) { int v3; // [sp+4Ch] [bp-8h]@1 int v4; // [sp+50h] [bp-4h]@1 v4 = 162 * a2 + a1 + setting_map_startGridOffset; v3 = grid_buildingIds[162 * a2 + a1 + setting_map_startGridOffset]; if ( grid_buildingIds[162 * a2 + a1 + setting_map_startGridOffset] ) { sub_46E3D0(v3, 0); sub_467A70(v3, 1); sound_playChannel(5); } if ( grid_buildingIds[v4] ) buildings[grid_buildingIds[v4]].inUse = 5; grid_terrain[v4] = 0; sub_47D180(a1, a2, 1); sub_479240(); sub_47F400(); sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); fun_determineGroundType(); sub_4FFDF0(); sub_500420(); return fun_createDustCloud(a1, a2, 1); } signed int sub_492240(int a1, int a2) { signed int result; // eax@2 if ( grid_terrain[162 * a2 + a1 + setting_map_startGridOffset] & 0x206 ) result = 0; else result = 1; return result; } void fun_handleGladiatorRevoltEvent() { if ( mode_editor != 1 ) { if ( scn_event_gladiatorRevolt_on ) { if ( event_gladiatorRevolt_state < 2 ) { if ( event_gladiatorRevolt_state ) { if ( event_gladiatorRevolt_state == 1 ) { if ( gametime_month == event_gladiatorRevold_endMonth ) { event_gladiatorRevolt_state = 2; message_usePopup = 1; fun_postMessageToPlayer(73, 0, 0); } } } else { if ( gametime_year == event_gladiatorRevolt_gameYear ) { if ( gametime_month == event_gladiatorRevolt_month ) { if ( numWorkingGladiatorSchools > 0 ) { event_gladiatorRevolt_state = 1; message_usePopup = 1; fun_postMessageToPlayer(63, 0, 0); } else { event_gladiatorRevolt_state = 2; } } } } } } } } void fun_handleEmperorChangeEvent() { if ( mode_editor != 1 && scn_event_emperorChange_on) { if ( event_emperorChange_state < 1 ) { if ( !event_emperorChange_state ) { if ( gametime_year == event_emperorChange_gameYear ) { if ( gametime_month == event_emperorChange_month ) { event_emperorChange_state = 1; message_usePopup = 1; fun_postMessageToPlayer(64, 0, 0); } } } } } } void fun_handleRandomEvents() { int gridOffsetIronmine; // [sp+4Ch] [bp-8h]@46 int gridOffsetClaypit; // [sp+4Ch] [bp-8h]@52 int event; // [sp+50h] [bp-4h]@1 event = randomEvent_probability[random_7f_1]; if ( event > 0 ) { switch ( event ) { case 1: if ( scn_event_raiseWages ) { if ( city_inform[ciid].wagesRome < 45 ) { city_inform[ciid].wagesRome += (random_7f_2 & 3) + 1; if ( city_inform[ciid].wagesRome > 45 ) city_inform[ciid].wagesRome = 45; message_usePopup = 1; fun_postMessageToPlayer(68, 0, 0); } } break; case 2: if ( scn_event_lowerWages ) { if ( city_inform[ciid].wagesRome > 5 ) { city_inform[ciid].wagesRome -= (random_7f_2 & 3) + 1; message_usePopup = 1; fun_postMessageToPlayer(69, 0, 0); } } break; case 3: if ( scn_event_landTradeProblem ) { if ( city_inform[ciid].numOpenLandTradeRoutes > 0 ) { city_inform[ciid].landTradeProblemDuration = 48; message_usePopup = 1; if ( scn_climate == Climate_Desert ) fun_postMessageToPlayer(65, 0, 0); else fun_postMessageToPlayer(67, 0, 0); } } break; case 4: if ( scn_event_seaTradeProblem ) { if ( city_inform[ciid].numOpenSeaTradeRoutes > 0 ) { city_inform[ciid].seaTradeProblemDuration = 48; message_usePopup = 1; fun_postMessageToPlayer(66, 0, 0); } } break; case 5: if ( scn_event_contaminatedWater ) { if ( city_inform[ciid].population > 200 ) { if ( city_inform[ciid].healthRate <= 80 ) { if ( city_inform[ciid].healthRate <= 60 ) fun_changeHealthRate(-25); else fun_changeHealthRate(-40); } else { fun_changeHealthRate(-50); } message_usePopup = 1; fun_postMessageToPlayer(70, 0, 0); } } break; case 6: if ( scn_event_ironMineCollapse ) { gridOffsetIronmine = destroyFirstBuildingOfType(B_IronMine); if ( gridOffsetIronmine ) { message_usePopup = 1; fun_postMessageToPlayer(71, 0, gridOffsetIronmine); } } break; case 7: if ( scn_event_clayPitFlooded ) { gridOffsetClaypit = destroyFirstBuildingOfType(B_ClayPit); if ( gridOffsetClaypit ) { message_usePopup = 1; fun_postMessageToPlayer(72, 0, gridOffsetClaypit); } } break; } } } void sub_492870() { int v0; // [sp+4Ch] [bp-4h]@9 debugInfo_numFigures = 0; city_inform[ciid].imperialArmyComing = 0; city_inform[ciid].rioting = 0; city_inform[ciid].dword_654648 = 0; city_inform[ciid].word_6543A2 = 0; city_inform[ciid].enemyDestroyedBuildings = 0; city_inform[ciid].dword_654598 = 0; city_inform[ciid].dword_654624 = 0; if ( city_inform[ciid].dword_654468 > 0 ) --city_inform[ciid].dword_654468; for ( walkerId = 1; walkerId < 1000; ++walkerId ) { if ( walkers[walkerId].state ) { if ( walkers[walkerId].wlk_ID_mm ) { v0 = walkers[walkerId].wlk_ID_mm; if ( walkers[v0].state != 1 ) walkers[walkerId].wlk_ID_mm = 0; if ( walkers[v0].word_7FA3B0 != walkerId ) walkers[walkerId].wlk_ID_mm = 0; } ++debugInfo_numFigures; ((void (__fastcall *)(int, _DWORD))walker_callbacks[walkers[walkerId].type])( walkerId << 7, walkers[walkerId].type); if ( walkers[walkerId].state == 2 ) deleteWalker(walkerId); } } } void fun_walker_nobody() { ; } void walker_immigrant() { int v0; // [sp+4Ch] [bp-10h]@29 int v1; // [sp+50h] [bp-Ch]@27 int buildingId; // [sp+58h] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 0; walkers[walkerId].word_7FA346 = 0; buildingId = walkers[walkerId].migrantDestinationHome; if ( buildings[buildingId].inUse == 1 && buildings[buildingId].immigrantId == walkerId && buildings[buildingId].house_size ) { ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 1: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA341 = 0; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { if ( sub_489070( buildings[buildingId].x, buildings[buildingId].y, buildings[buildingId].size, 2) ) { walkers[walkerId].actionState = 2; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } break; case 2: walkers[walkerId].reachedLastStep = 0; walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 9: removeDestinationPathForWalker(walkerId); break; case 10: buildings[buildingId].immigrantId = 0; buildings[buildingId].haveRomeroad = 0; walkers[walkerId].state = 2; break; case 8: walkers[walkerId].actionState = 3; walkers[walkerId].destination_x = buildings[buildingId].x; walkers[walkerId].destination_y = buildings[buildingId].y; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; break; } break; case 3: walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { walkers[walkerId].state = 2; v1 = model_houses[buildings[buildingId].level_resourceId].numPeople; if ( buildings[buildingId].house_isMerged ) v1 *= 4; v0 = v1 - buildings[buildingId].house_population; if ( v0 < 0 ) v0 = 0; if ( v0 < walkers[walkerId].migrantNumPeopleCarried ) walkers[walkerId].migrantNumPeopleCarried = v0; if ( !buildings[buildingId].house_population ) { if ( !debug_houseEvolution ) fun_evolveHouseTo(buildingId, B_HouseVacantLot); } buildings[buildingId].house_population += walkers[walkerId].migrantNumPeopleCarried; buildings[buildingId].house_roomForPeople = v1 - buildings[buildingId].house_population; fun_addPeopleToCityAndCensus(ciid, walkers[walkerId].migrantNumPeopleCarried); buildings[buildingId].immigrantId = 0; } if ( walkers[walkerId].byte_7FA370 ) walkers[walkerId].reachedLastStep = 1; else walkers[walkerId].reachedLastStep = 0; break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C88 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C88 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; if ( walkers[walkerId].actionState == 2 ) { dword_7F87B0 = dword_65DF24 + 4; if ( dword_7F87B0 >= 8 ) dword_7F87B0 -= 8; walkers[walkerId].word_7FA346 = dword_65DF24 + word_6E6CB6; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_7F87B0]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_7F87B0]; } } else { walkers[walkerId].state = 2; } } void fun_walker_emigrant() { walkers[walkerId].byte_7FA3A2 = 0; walkers[walkerId].word_7FA346 = 0; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 4: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 5 ) { if ( !sub_489070(walkers[walkerId].x, walkers[walkerId].y, 1, 5) ) walkers[walkerId].state = 2; walkers[walkerId].actionState = 5; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } break; case 5: walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { walkers[walkerId].actionState = 6; walkers[walkerId].destination_x = city_inform[ciid].entry_x; walkers[walkerId].destination_y = city_inform[ciid].entry_y; walkers[walkerId].word_7FA374 = 0; walkers[walkerId].progressOnTile = 15; } if ( walkers[walkerId].byte_7FA370 ) walkers[walkerId].reachedLastStep = 1; else walkers[walkerId].reachedLastStep = 0; break; case 6: walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].reachedLastStep = 0; walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].state = 2; } else { walkers[walkerId].state = 2; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C88 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C88 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; if ( walkers[walkerId].actionState == 6 ) { dword_7F87B0 = dword_65DF24 + 4; if ( dword_7F87B0 >= 8 ) dword_7F87B0 -= 8; walkers[walkerId].word_7FA346 = dword_65DF24 + word_6E6CB6; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_7F87B0]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_7F87B0]; } } void fun_walker_homeless() { int v0; // [sp+4Ch] [bp-10h]@41 int housePeopleNumber; // [sp+50h] [bp-Ch]@39 int v2; // [sp+58h] [bp-4h]@9 int v3; // [sp+58h] [bp-4h]@16 int v4; // [sp+58h] [bp-4h]@30 ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].byte_7FA3A2 = 3; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 7: walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 51 ) { v2 = sub_454D40(walkers[walkerId].x, walkers[walkerId].y); if ( v2 ) { if ( sub_489070( buildings[v2].x, buildings[v2].y, buildings[v2].size, 2) ) { buildings[v2].immigrantId = walkerId; walkers[walkerId].migrantDestinationHome = v2; walkers[walkerId].actionState = 8; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } else { walkers[walkerId].actionState = 10; walkers[walkerId].destination_x = city_inform[ciid].exit_x; walkers[walkerId].destination_y = city_inform[ciid].exit_y; walkers[walkerId].word_7FA374 = 0; walkers[walkerId].word_7FA366 = 0; } } break; case 8: walkers[walkerId].reachedLastStep = 0; walkerWalkTicks(walkerId, 1); v3 = walkers[walkerId].migrantDestinationHome; if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = 9; walkers[walkerId].destination_x = buildings[v3].x; walkers[walkerId].destination_y = buildings[v3].y; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } } else { buildings[v3].immigrantId = 0; walkers[walkerId].state = 2; } break; case 0xA: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 30 ) { walkers[walkerId].word_7FA366 = 0; v4 = sub_454D40(walkers[walkerId].x, walkers[walkerId].y); if ( v4 > 0 ) { if ( sub_489070( buildings[v4].x, buildings[v4].y, buildings[v4].size, 2) ) { buildings[v4].immigrantId = walkerId; walkers[walkerId].migrantDestinationHome = v4; walkers[walkerId].actionState = 8; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].word_7FA374 = 0; removeDestinationPathForWalker(walkerId); } } } break; case 9: { int migrHouseId = walkers[walkerId].migrantDestinationHome; walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { walkers[walkerId].state = 2; if ( migrHouseId ) { if ( buildings[migrHouseId].type >= 10 ) { if ( buildings[migrHouseId].type <= 29 ) { housePeopleNumber = model_houses[buildings[migrHouseId].level_resourceId].numPeople; if ( buildings[migrHouseId].house_isMerged ) housePeopleNumber *= 4; v0 = housePeopleNumber - buildings[migrHouseId].house_population; if ( v0 < 0 ) v0 = 0; if ( v0 < walkers[walkerId].migrantNumPeopleCarried ) walkers[walkerId].migrantNumPeopleCarried = v0; if ( !buildings[migrHouseId].house_population ) fun_evolveHouseTo(migrHouseId, B_HouseVacantLot); buildings[migrHouseId].house_population += walkers[walkerId].migrantNumPeopleCarried; buildings[migrHouseId].house_roomForPeople = housePeopleNumber - buildings[migrHouseId].house_population; sub_4E3920(ciid, walkers[walkerId].migrantNumPeopleCarried); buildings[migrHouseId].immigrantId = 0; } } } } } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = graphic_homeless + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = graphic_homeless + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_cartpusher() { int v0; // [sp+4Ch] [bp-14h]@3 int v1; // [sp+50h] [bp-10h]@3 int v2; // [sp+54h] [bp-Ch]@15 int v3; // [sp+54h] [bp-Ch]@19 int v4; // [sp+54h] [bp-Ch]@21 int v5; // [sp+54h] [bp-Ch]@23 int v6; // [sp+54h] [bp-Ch]@25 int v7; // [sp+54h] [bp-Ch]@75 int v8; // [sp+54h] [bp-Ch]@77 int v9; // [sp+54h] [bp-Ch]@79 int v10; // [sp+58h] [bp-8h]@8 int v11; // [sp+58h] [bp-8h]@72 ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; v1 = walkers[walkerId].gridOffset; v0 = byte_91C920[v1]; walkers[walkerId].byte_7FA3A2 = 1; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x14: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); v10 = walkers[walkerId].buildingId; if ( grid_groundType[v1] < 0 || grid_groundType[v1] > 2 ) walkers[walkerId].state = 2; if ( buildings[v10].inUse != 1 || buildings[v10].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 30 ) { dword_862D40 = 0; v2 = sub_458E80( 0, walkers[walkerId].x, walkers[walkerId].y, buildings[v10].industry_outputGood, buildings[v10].haveRomeroad, v0); if ( !city_inform[ciid].resourceStockpile[ buildings[v10].industry_outputGood ] ) v2 = 0; if ( v2 ) { walkers[walkerId].baseWorkingBuildingId = v2; walkers[walkerId].actionState = 21; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v3 = sub_45C100( 0, walkers[walkerId].x, walkers[walkerId].y, buildings[v10].industry_outputGood, buildings[v10].haveRomeroad, v0); if ( v3 ) { walkers[walkerId].baseWorkingBuildingId = v3; walkers[walkerId].actionState = 22; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v4 = sub_45E100( walkers[walkerId].x, walkers[walkerId].y, buildings[v10].industry_outputGood, buildings[v10].haveRomeroad, v0); if ( v4 ) { walkers[walkerId].baseWorkingBuildingId = v4; walkers[walkerId].actionState = 23; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v5 = sub_458E80( 0, walkers[walkerId].x, walkers[walkerId].y, buildings[v10].industry_outputGood, buildings[v10].haveRomeroad, v0); if ( v5 ) { walkers[walkerId].baseWorkingBuildingId = v5; walkers[walkerId].actionState = 21; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v6 = sub_45C100( 1, walkers[walkerId].x, walkers[walkerId].y, buildings[v10].industry_outputGood, buildings[v10].haveRomeroad, v0); if ( v6 ) { walkers[walkerId].baseWorkingBuildingId = v6; walkers[walkerId].actionState = 22; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].word_7FA366 = 0; if ( dword_862D40 ) walkers[walkerId].maxLevelOrRiskSeen = 2; else walkers[walkerId].maxLevelOrRiskSeen = 1; } } } } } } walkers[walkerId].byte_7FA341 = 0; break; case 0x15: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 24; break; case 9: removeDestinationPathForWalker(walkerId); if ( grid_groundType[walkers[walkerId].gridOffset] != 2 ) walkers[walkerId].actionState = 20; walkers[walkerId].word_7FA366 = 0; break; case 10: walkers[walkerId].state = 2; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 0x16: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 25; break; case 9: removeDestinationPathForWalker(walkerId); if ( grid_groundType[walkers[walkerId].gridOffset] != 2 ) walkers[walkerId].actionState = 20; walkers[walkerId].word_7FA366 = 0; break; case 10: walkers[walkerId].actionState = 20; walkers[walkerId].word_7FA366 = 0; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 0x17: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 26; break; case 9: removeDestinationPathForWalker(walkerId); if ( grid_groundType[walkers[walkerId].gridOffset] != 2 ) walkers[walkerId].actionState = 20; walkers[walkerId].word_7FA366 = 0; break; case 10: walkers[walkerId].state = 2; break; } break; case 0x18: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 10 ) { if ( fun_addGoodToWarehouse( walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].cartPusherGoodType) ) { walkers[walkerId].actionState = 27; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } else { removeDestinationPathForWalker(walkerId); walkers[walkerId].actionState = 20; walkers[walkerId].word_7FA366 = 0; } } walkers[walkerId].byte_7FA341 = 0; break; case 0x19: v11 = walkers[walkerId].buildingId; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 5 ) { if ( sub_45D3D0(walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].cartPusherGoodType, 1) ) { walkers[walkerId].actionState = 27; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } else { v7 = sub_45C100( 0, walkers[walkerId].x, walkers[walkerId].y, buildings[v11].industry_outputGood, buildings[v11].haveRomeroad, v0); if ( v7 ) { walkers[walkerId].baseWorkingBuildingId = v7; walkers[walkerId].actionState = 22; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v8 = sub_458E80( 0, walkers[walkerId].x, walkers[walkerId].y, buildings[v11].industry_outputGood, buildings[v11].haveRomeroad, v0); if ( v8 ) { walkers[walkerId].baseWorkingBuildingId = v8; walkers[walkerId].actionState = 21; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v9 = sub_45C100( 1, walkers[walkerId].x, walkers[walkerId].y, buildings[v11].industry_outputGood, buildings[v11].haveRomeroad, v0); if ( v9 ) { walkers[walkerId].baseWorkingBuildingId = v9; walkers[walkerId].actionState = 22; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].word_7FA366 = 0; } } } } } walkers[walkerId].byte_7FA341 = 0; break; case 0x1A: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 5 ) { sub_45E740(walkers[walkerId].baseWorkingBuildingId); walkers[walkerId].actionState = 27; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } walkers[walkerId].byte_7FA341 = 0; break; case 0x1B: walkers[walkerId].word_7FA346 = word_6E6C72; walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 20; walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6C86 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; walkers[walkerId].word_7FA346 = 0; } else { walkers[walkerId].word_7FA344 = word_6E6C86 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } if ( walkers[walkerId].word_7FA346 ) { walkers[walkerId].word_7FA346 += dword_65DF24; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_65DF24]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_65DF24]; } } void walker_laborSeeker() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].laborSeekerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C22 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C22 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void walker_explosion() { walkers[walkerId].byte_7FA34C = 1; ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile > 44 ) walkers[walkerId].state = 2; sub_4B66E0(walkerId, walkers[walkerId].byte_7FA389); if ( walkers[walkerId].progressOnTile < 48 ) walkers[walkerId].word_7FA344 = LOWORD(dword_5FA2A8[walkers[walkerId].progressOnTile / 2]) + word_6E6C7C; else walkers[walkerId].word_7FA344 = word_6E6C7C + 7; } void walker_taxCollector() { int v0; // [sp+50h] [bp-Ch]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 512; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 40: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA341 = 0; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { if ( sub_489070( buildings[v0].x, buildings[v0].y, buildings[v0].size, 2) ) { walkers[walkerId].actionState = 41; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } break; case 41: walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { if ( grid_buildingIds[walkers[walkerId].gridOffset] == v0 ) { walkers[walkerId].state = 2; } else { walkers[walkerId].actionState = 42; fun_roamWalker(walkerId); walkers[walkerId].word_7FA374 = 0; } } break; case 42: walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= walkers[walkerId].word_7FA372 ) { if ( sub_489070( buildings[v0].x, buildings[v0].y, buildings[v0].size, 2) ) { walkers[walkerId].actionState = 43; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } sub_4B3F00(walkerId, 1); break; case 43: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = 41; walkers[walkerId].destination_x = buildings[v0].x; walkers[walkerId].destination_y = buildings[v0].y; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } } else { walkers[walkerId].state = 2; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C80 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C80 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_engineer() { int v0; // [sp+50h] [bp-Ch]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 640; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 60: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA341 = 0; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { if ( sub_489070( buildings[v0].x, buildings[v0].y, buildings[v0].size, 2) ) { walkers[walkerId].actionState = 61; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } break; case 61: walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { if ( grid_buildingIds[walkers[walkerId].gridOffset] == v0 ) { walkers[walkerId].state = 2; } else { walkers[walkerId].actionState = 62; fun_roamWalker(walkerId); walkers[walkerId].word_7FA374 = 0; } } break; case 62: walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= walkers[walkerId].word_7FA372 ) { if ( sub_489070( buildings[v0].x, buildings[v0].y, buildings[v0].size, 2) ) { walkers[walkerId].actionState = 63; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } sub_4B3F00(walkerId, 1); break; case 63: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = 61; walkers[walkerId].destination_x = buildings[v0].x; walkers[walkerId].destination_y = buildings[v0].y; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } } else { walkers[walkerId].state = 2; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C8C + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C8C + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_warehouseman() { int v0; // [sp+4Ch] [bp-20h]@3 int v1; // [sp+58h] [bp-14h]@49 signed int i; // [sp+5Ch] [bp-10h]@110 signed int j; // [sp+5Ch] [bp-10h]@129 signed int k; // [sp+5Ch] [bp-10h]@153 int v5; // [sp+60h] [bp-Ch]@14 int v6; // [sp+60h] [bp-Ch]@18 int v7; // [sp+60h] [bp-Ch]@20 int v8; // [sp+60h] [bp-Ch]@22 int v9; // [sp+60h] [bp-Ch]@27 int v10; // [sp+60h] [bp-Ch]@31 int v11; // [sp+60h] [bp-Ch]@33 int v12; // [sp+60h] [bp-Ch]@35 int v13; // [sp+60h] [bp-Ch]@37 int v14; // [sp+60h] [bp-Ch]@39 int v15; // [sp+60h] [bp-Ch]@44 int v16; // [sp+60h] [bp-Ch]@64 int v17; // [sp+60h] [bp-Ch]@93 int v18; // [sp+60h] [bp-Ch]@128 int v19; // [sp+64h] [bp-8h]@8 int v20; // [sp+64h] [bp-8h]@93 int v21; // [sp+64h] [bp-8h]@97 int v22; // [sp+64h] [bp-8h]@137 walkers[walkerId].byte_7FA3A2 = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; v0 = byte_91C920[walkers[walkerId].gridOffset]; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 50: v19 = walkers[walkerId].buildingId; if ( buildings[v19].inUse != 1 || buildings[v19].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 2 ) { if ( buildings[v19].type == 71 ) { if ( walkers[walkerId].cartPusherGoodType ) { v6 = sub_45C100( 0, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v6 ) { walkers[walkerId].baseWorkingBuildingId = v6; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; sub_45D7B0(ciid, v19, walkers[walkerId].cartPusherGoodType, 100); } else { v7 = sub_458E80( 0, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v7 ) { walkers[walkerId].baseWorkingBuildingId = v7; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; sub_45D7B0(ciid, v19, walkers[walkerId].cartPusherGoodType, 100); } else { v8 = sub_45C100( 1, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v8 ) { walkers[walkerId].baseWorkingBuildingId = v8; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; sub_45D7B0(ciid, v19, walkers[walkerId].cartPusherGoodType, 100); } else { walkers[walkerId].state = 2; } } } } else { v5 = sub_45C720(v19); if ( v5 ) { walkers[walkerId].byte_7FA3A3 = 0; walkers[walkerId].baseWorkingBuildingId = v5; walkers[walkerId].actionState = 54; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } } else { if ( walkers[walkerId].cartPusherGoodType ) { v10 = sub_45E600( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, v0); if ( v10 ) { walkers[walkerId].baseWorkingBuildingId = v10; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v11 = sub_45E100( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v11 ) { walkers[walkerId].baseWorkingBuildingId = v11; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v12 = sub_45C100( 0, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v12 ) { walkers[walkerId].baseWorkingBuildingId = v12; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v13 = sub_45C460( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v13 ) { walkers[walkerId].baseWorkingBuildingId = v13; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v14 = sub_458E80( v19, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v14 ) { if ( v14 == v19 ) { walkers[walkerId].state = 2; } else { walkers[walkerId].baseWorkingBuildingId = v14; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } } else { v15 = sub_45E390( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].cartPusherGoodType, buildings[v19].haveRomeroad, v0); if ( v15 ) { walkers[walkerId].baseWorkingBuildingId = v15; walkers[walkerId].actionState = 51; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } } } } } if ( walkers[walkerId].state != 2 ) v1 = fun_removeGoodFromWarehouse( ciid, walkers[walkerId].buildingId, walkers[walkerId].cartPusherGoodType, 1); if ( v1 ) walkers[walkerId].state = 2; } else { v9 = sub_459DD0(v19, walkers[walkerId].itemCollecting); if ( v9 ) { walkers[walkerId].byte_7FA3A3 = 0; walkers[walkerId].baseWorkingBuildingId = v9; walkers[walkerId].actionState = 57; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].byte_7FA3A2 = 3; } else { walkers[walkerId].state = 2; } } } } walkers[walkerId].byte_7FA341 = 0; break; case 51: if ( walkers[walkerId].byte_7FA3A3 == 1 ) { walkers[walkerId].word_7FA346 = word_6E6D8A + 8 * walkers[walkerId].cartPusherGoodType - 8; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 2); } else { walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); } walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 52; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 52: v16 = walkers[walkerId].baseWorkingBuildingId; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 4 ) { switch ( buildings[v16].type ) { case 71: sub_45D3D0(v16, walkers[walkerId].cartPusherGoodType, 0); break; case 95: sub_45E7D0(v16); break; case 72: fun_addGoodToWarehouse(ciid, v16, walkers[walkerId].cartPusherGoodType); break; case 73: fun_addGoodToWarehouse(ciid, v16, walkers[walkerId].cartPusherGoodType); break; default: sub_45E740(v16); break; } walkers[walkerId].actionState = 53; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } walkers[walkerId].byte_7FA341 = 0; break; case 53: walkers[walkerId].word_7FA346 = word_6E6C72; walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 54: walkers[walkerId].word_7FA346 = word_6E6C72; walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 55; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 55: v20 = walkers[walkerId].buildingId; v17 = walkers[walkerId].baseWorkingBuildingId; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 4 ) { walkers[walkerId].byte_7FA3A3 = sub_45CDC0(v20, v17); walkers[walkerId].cartPusherGoodType = dword_94B3B0; walkers[walkerId].actionState = 56; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; removeDestinationPathForWalker(walkerId); } walkers[walkerId].byte_7FA341 = 0; break; case 56: v21 = walkers[walkerId].buildingId; if ( walkers[walkerId].byte_7FA3A3 > 0 ) { if ( walkers[walkerId].byte_7FA3A3 > 1 ) { if ( walkers[walkerId].byte_7FA3A3 >= 8 ) walkers[walkerId].word_7FA346 = dword_5FA388[2 * walkers[walkerId].cartPusherGoodType] + word_6E6D8A; else walkers[walkerId].word_7FA346 = LOWORD(dword_5FA308[walkers[walkerId].cartPusherGoodType]) + word_6E6D8A; } else { walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; } } else { walkers[walkerId].word_7FA346 = word_6E6C72; } if ( walkers[walkerId].byte_7FA3A3 > 0 ) { if ( walkers[walkerId].byte_7FA3A3 > 1 ) walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset( walkers[walkerId].cartPusherGoodType, 2); else walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset( walkers[walkerId].cartPusherGoodType, 1); } walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: for ( i = 0; i < walkers[walkerId].byte_7FA3A3; ++i ) sub_45D3D0(v21, walkers[walkerId].cartPusherGoodType, 0); walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 57: walkers[walkerId].byte_7FA3A2 = 3; walkers[walkerId].word_7FA346 = word_6E6C72; walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 58; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 58: walkers[walkerId].byte_7FA3A2 = 3; v18 = walkers[walkerId].baseWorkingBuildingId; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 4 ) { walkers[walkerId].byte_7FA3A3 = 0; for ( j = 0; j < 4 && !fun_removeGoodFromWarehouse(ciid, v18, walkers[walkerId].itemCollecting, 1); ++j ) ++walkers[walkerId].byte_7FA3A3; walkers[walkerId].cartPusherGoodType = walkers[walkerId].itemCollecting; walkers[walkerId].actionState = 59; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; removeDestinationPathForWalker(walkerId); } walkers[walkerId].byte_7FA341 = 0; break; case 59: walkers[walkerId].byte_7FA3A2 = 3; v22 = walkers[walkerId].buildingId; if ( walkers[walkerId].byte_7FA3A3 > 0 ) { if ( walkers[walkerId].byte_7FA3A3 > 1 ) { if ( walkers[walkerId].cartPusherGoodType != 1 && walkers[walkerId].cartPusherGoodType != 2 && walkers[walkerId].cartPusherGoodType != 3 && walkers[walkerId].cartPusherGoodType != 6 ) walkers[walkerId].word_7FA346 = dword_5FA348[2 * walkers[walkerId].cartPusherGoodType] + word_6E6DA4; else walkers[walkerId].word_7FA346 = LOWORD(dword_5FA308[walkers[walkerId].cartPusherGoodType]) + word_6E6D8A; } else { walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; } } else { walkers[walkerId].word_7FA346 = word_6E6C72; } if ( walkers[walkerId].byte_7FA3A3 > 0 ) { if ( walkers[walkerId].byte_7FA3A3 > 1 ) walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset( walkers[walkerId].cartPusherGoodType, 2); else walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset( walkers[walkerId].cartPusherGoodType, 1); } walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: for ( k = 0; k < walkers[walkerId].byte_7FA3A3; ++k ) fun_addGoodToWarehouse(ciid, v22, walkers[walkerId].cartPusherGoodType); walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6C86 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; walkers[walkerId].word_7FA346 = 0; } else { walkers[walkerId].word_7FA344 = word_6E6C86 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } if ( walkers[walkerId].word_7FA346 ) { walkers[walkerId].word_7FA346 += dword_65DF24; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_65DF24]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_65DF24]; if ( walkers[walkerId].byte_7FA3A3 >= 8 ) walkers[walkerId].byte_7FA39D -= 40; } } void fun_walker_prefect() { int v0; // ST68_4@71 __int64 v1; // qax@86 int v2; // [sp+4Ch] [bp-1Ch]@46 int v3; // [sp+58h] [bp-10h]@46 int v4; // [sp+5Ch] [bp-Ch]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 640; v4 = walkers[walkerId].buildingId; if ( buildings[v4].inUse != 1 || buildings[v4].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; if ( !sub_49A250(walkerId) ) sub_499FE0(walkerId); switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x46: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA341 = 0; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { if ( sub_489070( buildings[v4].x, buildings[v4].y, buildings[v4].size, 2) ) { walkers[walkerId].actionState = 71; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } break; case 0x47: walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { if ( grid_buildingIds[walkers[walkerId].gridOffset] == v4 ) { walkers[walkerId].state = 2; } else { walkers[walkerId].actionState = 72; fun_roamWalker(walkerId); walkers[walkerId].word_7FA374 = 0; } } break; case 0x48: walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= walkers[walkerId].word_7FA372 ) { if ( sub_489070( buildings[v4].x, buildings[v4].y, buildings[v4].size, 2) ) { walkers[walkerId].actionState = 73; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].state = 2; } } sub_4B3F00(walkerId, 1); break; case 0x49: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = 71; walkers[walkerId].destination_x = buildings[v4].x; walkers[walkerId].destination_y = buildings[v4].y; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } } else { walkers[walkerId].state = 2; } break; case 0x4A: walkers[walkerId].byte_7FA3A2 = 0; walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = 75; removeDestinationPathForWalker(walkerId); walkers[walkerId].word_7FA374 = 0; walkers[walkerId].word_7FA366 = 50; } } else { walkers[walkerId].state = 2; } break; case 0x4B: v3 = walkers[walkerId].baseWorkingBuildingId; v2 = fun_getDistanceMaximum( walkers[walkerId].x, walkers[walkerId].y, buildings[v3].x, buildings[v3].y); if ( buildings[v3].inUse == 1 ) { if ( buildings[v3].type == B_BurningRuin ) { if ( v2 < 2 ) { buildings[v3].burningRuinStep = 32; sound_playChannel(157); } else { walkers[walkerId].word_7FA366 = 1; } } else { walkers[walkerId].word_7FA366 = 1; } } else { walkers[walkerId].word_7FA366 = 1; } walkers[walkerId].simpleDirection = fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, buildings[v3].x, buildings[v3].y); if ( walkers[walkerId].simpleDirection >= 8 ) walkers[walkerId].simpleDirection = 0; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { walkers[walkerId].byte_7FA39B = 20; if ( !sub_499FE0(walkerId) ) { int baseId = walkers[walkerId].buildingId; if ( sub_489070( buildings[baseId].x, buildings[baseId].y, buildings[baseId].size, 2) ) { walkers[walkerId].actionState = 73; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].state = 2; } } } break; case 0x4C: walkers[walkerId].byte_7FA3A2 = 0; if ( !sub_4B76D0(walkerId) ) { if ( sub_489070( buildings[walkers[walkerId].buildingId].x, buildings[walkers[walkerId].buildingId].y, buildings[walkers[walkerId].buildingId].size, 2) ) { walkers[walkerId].actionState = 73; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; removeDestinationPathForWalker(walkerId); walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { v0 = walkers[walkerId].word_7FA3B0; walkers[walkerId].destination_x = walkers[v0].x; walkers[walkerId].destination_y = walkers[v0].y; removeDestinationPathForWalker(walkerId); } } else { walkers[walkerId].state = 2; } break; } if ( walkers[walkerId].actionState == 75 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; switch ( walkers[walkerId].actionState ) { case 0x4A: walkers[walkerId].word_7FA344 = word_6E6CA2 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; break; case 0x4B: walkers[walkerId].word_7FA344 = word_6E6CA2 + dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 96; break; case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = word_6E6C9A + dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1) + 104; } else { walkers[walkerId].word_7FA344 = word_6E6C9A + dword_65DF24 + 104; } break; case 0x95: walkers[walkerId].word_7FA344 = word_6E6C9A + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; break; default: walkers[walkerId].word_7FA344 = word_6E6C9A + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; break; } } signed int sub_499FE0(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-4h]@21 if ( dword_98BF18 > 0 ) { switch ( walkers[a1].actionState ) { case 0x96: result = 0; break; case 0x95: result = 0; break; case 0x46: result = 0; break; case 0x47: result = 0; break; case 0x4A: result = 0; break; case 0x4B: result = 0; break; case 0x4C: result = 0; break; case 0x4D: result = 0; break; default: ++walkers[a1].byte_7FA39B; if ( walkers[a1].byte_7FA39B >= 20 ) { v2 = sub_4680A0(walkers[a1].x, walkers[a1].y); if ( v2 > 0 ) { if ( dword_94A2F8 <= 25 ) { walkers[a1].byte_7FA39B = 0; walkers[a1].actionState = 74; walkers[a1].destination_x = buildings[v2].enter_x; walkers[a1].destination_y = buildings[v2].enter_y; walkers[a1].baseWorkingBuildingId = v2; removeDestinationPathForWalker(a1); buildings[v2].towerBallistaId = a1; result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } break; } } else { result = 0; } return result; } signed int sub_49A250(int a1) { signed int result; // eax@3 int v2; // [sp+4Ch] [bp-4h]@22 if ( city_inform[ciid].dword_654468 > 0 || dword_819848 > 0 ) { switch ( walkers[a1].actionState ) { case 0x96: result = 0; break; case 0x95: result = 0; break; case 0x46: result = 0; break; case 0x47: result = 0; break; case 0x4A: result = 0; break; case 0x4B: result = 0; break; case 0x4C: result = 0; break; case 0x4D: result = 0; break; default: ++byte_7FA3AE[128 * a1]; if ( byte_7FA3AE[128 * a1] >= 10 ) { byte_7FA3AE[128 * a1] = 0; v2 = sub_49A510(walkers[a1].x, walkers[a1].y); if ( v2 > 0 ) { if ( dword_7FA2A4 <= 30 ) { byte_7FA3AE[128 * a1] = 0; walkers[a1].actionState = 76; walkers[a1].destination_x = walkers[v2].x; walkers[a1].destination_y = walkers[v2].y; walkers[a1].word_7FA3B0 = v2; walkers[v2].wlk_ID_mm = a1; walkers[a1].word_7FA3B6 = walkers[v2].word_7FA3B4; removeDestinationPathForWalker(a1); result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } break; } } else { result = 0; } return result; } signed int sub_49A510(int a1, int a2) { signed int v3; // [sp+4Ch] [bp-Ch]@1 int v4; // [sp+50h] [bp-8h]@9 signed int i; // [sp+54h] [bp-4h]@1 v3 = 0; dword_7FA2A4 = 10000; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 && !walkers[i].wlk_ID_mm ) { if ( walkers[i].type== 24 ) { v4 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); } else { if ( walkers[i].type== 54 ) { v4 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); } else { if ( walkers[i].type!= 41 || walkers[i].actionState != 159 ) { if ( walkers[i].type< 43 || walkers[i].type> 57 ) { if ( walkers[i].type!= 69 ) continue; v4 = 4 * fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); } else { v4 = 3 * fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); } } else { v4 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); } } } if ( v4 < dword_7FA2A4 ) { dword_7FA2A4 = v4; v3 = i; } } } return v3; } void fun_walker_soldier() { int v0; // ST70_4@99 __int64 v1; // qax@139 __int64 v2; // qax@151 __int64 v3; // qax@160 int v4; // [sp+4Ch] [bp-14h]@1 int v5; // [sp+54h] [bp-Ch]@6 int v6; // [sp+58h] [bp-8h]@85 signed int v7; // [sp+5Ch] [bp-4h]@10 v4 = walkers[walkerId].formationId; ++ city_inform[ciid].dword_654598; walkers[walkerId].byte_7FA3A2 = 0; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; if ( formations[v4].inUse != 1 ) walkers[walkerId].actionState = -107; if ( walkers[walkerId].type == Walker_FortJavelin ) { v5 = 2; } else { if ( walkers[walkerId].type == Walker_FortMounted ) v5 = 3; else v5 = 1; } v7 = formations[v4].layout; if ( walkers[walkerId].byte_7FA393 ) { v7 = 7; } else { if ( walkers[walkerId].actionState == 81 ) v7 = 7; } walkers[ walkerId ].at_dest_x = *((_BYTE *)&dword_5F3CB0[32 * v7] + 8 * byte_7FA392[128 * walkerId]) + formations[v4].x; walkers[walkerId].at_dest_y = *((_BYTE *)&dword_5F3CB4[32 * v7] + 8 * byte_7FA392[128 * walkerId]) + formations[v4].y; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 80: sub_4B8B80(walkerId); walkers[walkerId].word_7FA366 = 0; walkers[walkerId].byte_7FA393 = 1; walkers[walkerId].byte_7FA341 = 0; if ( walkers[walkerId].x != walkers[walkerId].at_dest_x || walkers[walkerId].y != walkers[walkerId].at_dest_y ) walkers[walkerId].actionState = 81; break; case 81: walkers[walkerId].word_7FA366 = 0; walkers[walkerId].byte_7FA393 = 1; walkers[walkerId].destination_x = walkers[walkerId].at_dest_x; walkers[walkerId].destination_y = walkers[walkerId].at_dest_y; walkers[walkerId].word_7FA35E = 162 * walkers[walkerId].destination_y + walkers[walkerId].destination_x + setting_map_startGridOffset; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 80; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 148: walkers[walkerId].word_7FA366 = 0; walkers[walkerId].byte_7FA393 = 1; walkers[walkerId].destination_x = walkers[walkerId].at_dest_x; walkers[walkerId].destination_y = walkers[walkerId].at_dest_y; walkers[walkerId].word_7FA35E = 162 * walkers[walkerId].destination_y + walkers[walkerId].destination_x + (_WORD)setting_map_startGridOffset; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 80; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 82: walkers[walkerId].byte_7FA393 = 1; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 83: walkers[walkerId].byte_7FA393 = 0; walkers[walkerId].destination_x = *((_BYTE *)&dword_5F3CB0[32 * formations[v4].layout] + 8 * byte_7FA392[128 * walkerId]) + formations[v4].standardX; walkers[walkerId].destination_y = *((_BYTE *)&dword_5F3CB4[32 * formations[v4].layout] + 8 * byte_7FA392[128 * walkerId]) + formations[v4].standardY; if ( walkers[walkerId].inUse ) { walkers[walkerId].destination_x += stru_5F20FE[walkers[walkerId].inUse].x; walkers[walkerId].destination_y += stru_5F20FE[walkers[walkerId].inUse].y; } walkers[walkerId].word_7FA35E = 162 * walkers[walkerId].destination_y + walkers[walkerId].destination_x + (_WORD)setting_map_startGridOffset; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 84; walkers[walkerId].byte_7FA341 = 0; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: ++walkers[walkerId].inUse; if ( walkers[walkerId].inUse > 168 ) walkers[walkerId].state = 2; walkers[walkerId].byte_7FA341 = 0; break; } break; case 84: walkers[walkerId].byte_7FA393 = 0; walkers[walkerId].byte_7FA341 = 0; sub_4B8B80(walkerId); walkers[walkerId].destination_x = *((_BYTE *)&dword_5F3CB0[32 * formations[v4].layout] + 8 * byte_7FA392[128 * walkerId]) + formations[v4].standardX; walkers[walkerId].destination_y = *((_BYTE *)&dword_5F3CB4[32 * formations[v4].layout] + 8 * byte_7FA392[128 * walkerId]) + formations[v4].standardY; if ( walkers[walkerId].inUse ) { walkers[walkerId].destination_x += stru_5F20FE[ walkers[walkerId].inUse ].x; walkers[walkerId].destination_y += stru_5F20FE[ walkers[walkerId].inUse ].y; } if ( walkers[walkerId].x != walkers[walkerId].destination_x || walkers[walkerId].y != walkers[walkerId].destination_y ) { if ( formations[v4].formation_54 <= 0 ) { if ( formations[v4].formation_48 <= 0 ) { if ( formations[v4].formation_56 <= 0 ) { walkers[walkerId].actionState = 83; walkers[walkerId].inUse = 0; } } } } if ( walkers[walkerId].type != 11 || walkers[walkerId].actionState == 83 ) { if ( walkers[walkerId].type == 13 ) { if ( walkers[walkerId].actionState != 83 ) sub_4B32F0(walkerId); } } else { ++walkers[walkerId].byte_7FA39B; if ( walkers[walkerId].byte_7FA39B > byte_5F60FB[10 * walkers[walkerId].type] ) { walkers[walkerId].byte_7FA39B = 0; if ( sub_4ADB30(walkerId, 10) ) { walkers[walkerId].byte_7FA39A = 1; walkers[walkerId].direction = fun_pathing_getDirection8( walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY); } else { walkers[walkerId].byte_7FA39A = 0; } } if ( walkers[walkerId].byte_7FA39A ) { if ( walkers[walkerId].byte_7FA39A == 1 ) { spawnWalkerWithParent(walkerId, walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY, Walker_Javelin); formations[v4].formation_54 = 6; } ++walkers[walkerId].byte_7FA39A; if ( walkers[walkerId].byte_7FA39A > 100 ) walkers[walkerId].byte_7FA39A = 0; } } break; case 86: walkers[walkerId].byte_7FA393 = 0; v6 = walkers[walkerId].word_7FA3B0; if ( walkers[v6].state != 1 ) { walkers[walkerId].word_7FA3B0 = 0; v6 = 0; } if ( walkers[v6].actionState== 149 ) { walkers[walkerId].word_7FA3B0 = 0; v6 = 0; } if ( v6 <= 0 ) { v6 = sub_4AD800(walkers[walkerId].x, walkers[walkerId].y, 20); if ( v6 ) { walkers[walkerId].destination_x = walkers[v6].x; walkers[walkerId].destination_y = walkers[v6].y; walkers[walkerId].word_7FA3B0 = v6; walkers[v6].wlk_ID_mm = walkerId; walkers[walkerId].word_7FA3B6 = walkers[v6].word_7FA3B4; } else { walkers[walkerId].actionState = 84; walkers[walkerId].byte_7FA341 = 0; } removeDestinationPathForWalker(walkerId); } if ( v6 ) { walkerWalkTicks(walkerId, v5); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { v0 = walkers[walkerId].word_7FA3B0; walkers[walkerId].destination_x = walkers[v0].x; walkers[walkerId].destination_y = walkers[v0].y; removeDestinationPathForWalker(walkerId); } } else { walkers[walkerId].actionState = 84; walkers[walkerId].word_7FA3B0 = 0; walkers[walkerId].byte_7FA341 = 0; } } break; case 85: formations[v4].hasMilitaryTraining = 1; walkers[walkerId].byte_7FA393 = 1; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 81; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 87: walkers[walkerId].byte_7FA393 = 0; walkers[walkerId].destination_x = city_inform[ciid].exit_x; walkers[walkerId].destination_y = city_inform[ciid].exit_y; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 89; removeDestinationPathForWalker(walkerId); break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 89: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA393 = 1; break; case 88: walkers[walkerId].reachedLastStep = 0; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].byte_7FA393 = 1; walkers[walkerId].destination_x = walkers[walkerId].at_dest_x; walkers[walkerId].destination_y = walkers[walkerId].at_dest_y; walkers[walkerId].word_7FA35E = 162 * walkers[walkerId].destination_y + walkers[walkerId].destination_x + (_WORD)setting_map_startGridOffset; walkerWalkTicks(walkerId, v5); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 80; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( formations[v4].formation_54 ) { dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; } else { if ( walkers[walkerId].actionState == 84 ) { dword_65DF24 = formations[v4].formation_63 - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].type == 11 ) { switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = word_6E6D44 + dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1) + 96; } else { walkers[walkerId].word_7FA344 = word_6E6D44 + dword_65DF24 + 96; } break; case 0x54: walkers[walkerId].word_7FA344 = word_6E6D44 + dword_65DF24 + 96 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; break; case 0x95: walkers[walkerId].word_7FA344 = word_6E6D44 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 144; break; default: walkers[walkerId].word_7FA344 = word_6E6D44 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; break; } } else { if ( walkers[walkerId].type == 12 ) { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v2 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = word_6E6D80 + dword_65DF24 + 8 * (((_DWORD)v2 - _HIDWORD(v2)) >> 1) + 96; } else { walkers[walkerId].word_7FA344 = word_6E6D80 + dword_65DF24 + 96; } } else { if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D80 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 144; else walkers[walkerId].word_7FA344 = word_6E6D80 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } } else { switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v3 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = word_6E6D48 + dword_65DF24 + 8 * (((_DWORD)v3 - _HIDWORD(v3)) >> 1) + 96; } else { walkers[walkerId].word_7FA344 = word_6E6D48 + dword_65DF24 + 96; } break; case 0x54: if ( formations[v4].formation_52 && !formations[v4].layout && formations[v4].formation_56 ) walkers[walkerId].word_7FA344 = word_6E6D48 + dword_65DF24 + 144; else walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D48; break; case 0x95: walkers[walkerId].word_7FA344 = word_6E6D48 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 152; break; default: walkers[walkerId].word_7FA344 = word_6E6D48 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; break; } } } } void fun_walker_militaryStandard() { int v0; // [sp+50h] [bp-4h]@1 v0 = walkers[walkerId].formationId; walkers[walkerId].byte_7FA3A2 = 0; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 16 ) walkers[walkerId].byte_7FA341 = 0; removeWalkerFromTileList(walkerId); if ( formations[v0].f03_flag ) { walkers[walkerId].x = formations[v0].x; walkers[walkerId].y = formations[v0].y; walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; walkers[walkerId].tilePosition_y = 15 * walkers[walkerId].x; walkers[walkerId].tilePosition_x = 15 * walkers[walkerId].y; walkers[walkerId].tilePosition_y += 7; walkers[walkerId].tilePosition_x += 7; } else { walkers[walkerId].x = formations[v0].standardX; walkers[walkerId].y = formations[v0].standardY; walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; walkers[walkerId].tilePosition_y = 15 * walkers[walkerId].x; walkers[walkerId].tilePosition_x = 15 * walkers[walkerId].y; walkers[walkerId].tilePosition_y += 7; walkers[walkerId].tilePosition_x += 7; } sub_4B8A40(walkerId); walkers[walkerId].word_7FA344 = 20 - formations[v0].morale / 5 + word_6E6D92; if ( formations[v0].walkerType == 13 ) { if ( formations[v0].formation_52 ) walkers[walkerId].word_7FA346 = word_6E6CAC + 8; else walkers[walkerId].word_7FA346 = (walkers[walkerId].byte_7FA341 >> 1) + word_6E6CAC; } else { if ( formations[v0].walkerType == 12 ) { if ( formations[v0].formation_52 ) walkers[walkerId].word_7FA346 = word_6E6CAC + 26; else walkers[walkerId].word_7FA346 = word_6E6CAC + (walkers[walkerId].byte_7FA341 >> 1) + 18; } else { if ( formations[v0].formation_52 ) walkers[walkerId].word_7FA346 = word_6E6CAC + 17; else walkers[walkerId].word_7FA346 = word_6E6CAC + (walkers[walkerId].byte_7FA341 >> 1) + 9; } } } void fun_walker_entertainer() { int v0; // [sp+4Ch] [bp-18h]@12 signed int v1; // [sp+54h] [bp-10h]@85 int v2; // [sp+58h] [bp-Ch]@37 int v3; // [sp+5Ch] [bp-8h]@1 walkers[walkerId].word_7FA346 = word_6E6C72; walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 512; v3 = walkers[walkerId].buildingId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].byte_7FA39B; if ( walkers[walkerId].byte_7FA39B >= 120 ) walkers[walkerId].byte_7FA39B = 0; if ( event_gladiatorRevolt_state == 1 && walkers[walkerId].type == Walker_Gladiator && (walkers[walkerId].actionState == 92 || walkers[walkerId].actionState == 94 || walkers[walkerId].actionState == 95) ) { // gladiator revolt walkers[walkerId].type = Walker_Enemy54; removeDestinationPathForWalker(walkerId); walkers[walkerId].word_7FA374 = 0; walkers[walkerId].actionState = -98; return; } if ( walkers[walkerId].type == Walker_Charioteer ) v0 = 2; else v0 = 1; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 32 ) walkers[walkerId].byte_7FA341 = 0; break; case 149: sub_4B3B80(walkerId); break; case 90: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].byte_7FA39B = 0; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { if ( sub_489070( buildings[v3].x, buildings[v3].y, buildings[v3].size, 2) ) { walkers[walkerId].actionState = 91; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } break; case 91: walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 1; if ( sub_4B66E0(walkerId, 1) == 1 ) { switch ( walkers[walkerId].type ) { case Walker_Actor: v2 = fun_determineEntertainerDestination( walkers[walkerId].x, walkers[walkerId].y, B_Theater, B_Amphitheater); break; case Walker_Gladiator: v2 = fun_determineEntertainerDestination( walkers[walkerId].x, walkers[walkerId].y, B_Amphitheater, B_Colosseum); break; case Walker_LionTamer: v2 = fun_determineEntertainerDestination( walkers[walkerId].x, walkers[walkerId].y, B_Colosseum, 0); break; case Walker_Charioteer: v2 = fun_determineEntertainerDestination( walkers[walkerId].x, walkers[walkerId].y, B_Hippodrome, 0); break; } if ( v2 ) { if ( sub_489070( buildings[v2].x, buildings[v2].y, buildings[v2].size, 2) ) { walkers[walkerId].baseWorkingBuildingId = v2; walkers[walkerId].actionState = 92; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } else { walkers[walkerId].state = 2; } } walkers[walkerId].reachedLastStep = 1; break; case 92: walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= 3200 ) walkers[walkerId].state = 2; walkerWalkTicks(walkerId, v0); switch ( walkers[walkerId].direction ) { case 8: sub_466330(walkerId); walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 94: walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= walkers[walkerId].word_7FA372 ) { if ( sub_489070( buildings[v3].x, buildings[v3].y, buildings[v3].size, 2) ) { walkers[walkerId].actionState = 95; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } sub_4B3F00(walkerId, v0); break; case 95: walkerWalkTicks(walkerId, v0); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].state = 2; } else { walkers[walkerId].state = 2; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].type == Walker_Actor ) { v1 = 98; goto LABEL_83; } if ( walkers[walkerId].type == Walker_Gladiator ) { v1 = 111; goto LABEL_83; } if ( walkers[walkerId].type == Walker_LionTamer ) { v1 = 101; if ( walkers[walkerId].byte_7FA39B >= 96 ) v1 = 109; walkers[walkerId].word_7FA346 = word_6E6CF6; goto LABEL_83; } if ( walkers[walkerId].type != Walker_Charioteer ) { LABEL_83: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].type == Walker_Gladiator ) walkers[walkerId].word_7FA344 = graphic_id_start[v1] + dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 104; else walkers[walkerId].word_7FA344 = dword_65DF24 + graphic_id_start[v1]; } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = graphic_id_start[v1] + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; walkers[walkerId].word_7FA346 = 0; } else { walkers[walkerId].word_7FA344 = graphic_id_start[v1] + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } } if ( walkers[walkerId].word_7FA346 ) { walkers[walkerId].word_7FA346 += dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_65DF24]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_65DF24]; } return; } walkers[walkerId].word_7FA346 = 0; if ( walkers[walkerId].actionState == 150 ) { walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D5E; } else { if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D5E; else walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D5E + 8 * walkers[walkerId].byte_7FA341; } } void fun_walker_tradecaravan() { int v0; // [sp+4Ch] [bp-1Ch]@10 int v1; // [sp+50h] [bp-18h]@10 signed int v2; // [sp+58h] [bp-10h]@28 int v3; // [sp+5Ch] [bp-Ch]@29 int v4; // [sp+5Ch] [bp-Ch]@35 int v5; // [sp+60h] [bp-8h]@12 int v6; // [sp+60h] [bp-8h]@41 walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A2 = 3; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x64: walkers[walkerId].reachedLastStep = 1; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 20 ) { if ( city_inform[ciid].tradeCenterId ) { int tradeCenterId = city_inform[ciid].tradeCenterId; v1 = buildings[tradeCenterId].x; v0 = buildings[tradeCenterId].y; } else { v1 = walkers[walkerId].x; v0 = walkers[walkerId].y; } v5 = sub_446550(walkerId, v1, v0, walkers[walkerId].tradeCityId, 0); if ( v5 ) { walkers[walkerId].baseWorkingBuildingId = v5; walkers[walkerId].actionState = 101; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].word_7FA366 = 0; walkers[walkerId].actionState = 103; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = city_inform[ciid].exit_x; walkers[walkerId].destination_y = city_inform[ciid].exit_y; } } walkers[walkerId].byte_7FA341 = 0; break; case 0x65: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 102; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; walkers[walkerId].reachedLastStep = 1; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 0x66: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 10 ) { v2 = 0; walkers[walkerId].word_7FA366 = 0; if ( sub_45AA70( walkerId, walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].tradeCityId) ) { v3 = sub_45AB50( walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].tradeCityId); if ( v3 ) { ++tradedSoFar[ tradeRoutes[walkers[walkerId].tradeCityId].routeId[ v3 ] ]; sub_445B60(walkerId, v3); ++walkers[walkerId].byte_7FA39F; } else { v2 = 1; } } else { v2 = 1; } if ( sub_45AEB0( walkerId, walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].tradeCityId) ) { v4 = sub_45B220( walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].tradeCityId); if ( v4 ) { ++tradedSoFar[ tradeRoutes[walkers[walkerId].tradeCityId].routeId[v4] ]; sub_445AB0(walkerId, v4); ++walkers[walkerId].byte_7FA3A3; } else { ++v2; } } else { ++v2; } if ( v2 == 2 ) { v6 = sub_446550( walkerId, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].tradeCityId, -1); if ( v6 ) { walkers[walkerId].baseWorkingBuildingId = v6; walkers[walkerId].actionState = 101; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].actionState = 103; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = city_inform[ciid].exit_x; walkers[walkerId].destination_y = city_inform[ciid].exit_y; } } } walkers[walkerId].byte_7FA341 = 0; break; case 0x67: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 100; walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].word_7FA344 = word_6E6CB4 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void walker_tradeship() { int v1; // ecx@28 int v2; // [sp+50h] [bp-Ch]@9 int v3; // [sp+50h] [bp-Ch]@26 walkers[walkerId].reachedLastStep = 0; walkers[walkerId].isBoat = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x6E: walkers[walkerId].byte_7FA3A3 = 12; walkers[walkerId].byte_7FA39F = 0; walkers[walkerId].reachedLastStep = 1; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 20 ) { v2 = sub_48A180(walkerId); if ( v2 ) { walkers[walkerId].baseWorkingBuildingId = v2; walkers[walkerId].actionState = 111; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { if ( sub_48ABC0(/*v0*/) ) { walkers[walkerId].actionState = 113; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } walkers[walkerId].word_7FA366 = 0; } walkers[walkerId].byte_7FA341 = 0; break; case 0x71: walkerWalkTicks(walkerId, 1); walkers[walkerId].byte_7FA3A5 = 0; switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 114; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; case 0x72: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 40 ) { v3 = sub_48A180(walkerId); if ( v3 ) { walkers[walkerId].baseWorkingBuildingId = v3; walkers[walkerId].actionState = 111; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { v1 = walkers[walkerId].gridOffset; if ( grid_walkerIds[v1] != walkerId ) { if ( sub_48ABC0(/*v1*/) ) { walkers[walkerId].actionState = 113; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } } } walkers[walkerId].word_7FA366 = 0; } walkers[walkerId].byte_7FA341 = 0; break; case 0x6F: walkerWalkTicks(walkerId, 1); walkers[walkerId].byte_7FA3A5 = 0; switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 112; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; if ( !dword_65DE30 ) { message_usePopup = 1; fun_postMessageToPlayer(15, 0, 0); ++dword_65DE30; } break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) { walkers[walkerId].actionState = 115; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = scn_riverEntry_x; walkers[walkerId].destination_y = scn_riverEntry_y; } break; case 0x70: { int baseWorkingBUildingID = walkers[walkerId].baseWorkingBuildingId; if ( sub_4A4CC0(walkerId) ) { walkers[walkerId].byte_7FA3A9 = 0; walkers[walkerId].actionState = 115; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = scn_riverEntry_x; walkers[walkerId].destination_y = scn_riverEntry_y; } else { if ( sub_4A4B50(walkerId) ) { walkers[walkerId].byte_7FA3A9 = 0; walkers[walkerId].actionState = 115; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = scn_riverEntry_x; walkers[walkerId].destination_y = scn_riverEntry_y; buildings[baseWorkingBUildingID].grow_value_house_foodstocks[0] = 0; buildings[baseWorkingBUildingID].house_bathhouse_dock_numships_entert_days = 0; } } if ( buildings[baseWorkingBUildingID].house_neptune ) { if ( buildings[baseWorkingBUildingID].house_neptune == 1 ) { walkers[walkerId].direction = 4; } else { if ( buildings[baseWorkingBUildingID].house_neptune == 2 ) walkers[walkerId].direction = 6; else walkers[walkerId].direction = 0; } } else { walkers[walkerId].direction = 2; } walkers[walkerId].byte_7FA341 = 0; dword_65DE30 = 0; } break; case 0x73: walkerWalkTicks(walkerId, 1); walkers[walkerId].byte_7FA3A5 = 0; switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = 110; walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6CFA; } void fun_walker_tradecaravanDonkey() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = walkers[walkerId].tradeCaravanNextId; walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A2 = 3; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; if ( v0 > 0 ) { if ( walkers[v0].actionState == 149 ) { walkers[walkerId].state = 2; } else { if ( walkers[v0].state == 1 ) { if ( walkers[v0].type == 19 || walkers[v0].type == 21 ) sub_4B4880(walkerId, walkers[walkerId].tradeCaravanNextId, 1); else walkers[walkerId].state = 2; } else { walkers[walkerId].state = 2; } } } else { walkers[walkerId].state = 2; } if ( walkers[v0].reachedLastStep ) walkers[walkerId].reachedLastStep = 1; if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].word_7FA344 = word_6E6CB4 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_protestor() { walkers[walkerId].byte_7FA3A2 = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 64 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].state = 2; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 200 ) { walkers[walkerId].state = 2; walkers[walkerId].byte_7FA341 = 0; } if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C96 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C96 + LOWORD(dword_5FA3C8[walkers[walkerId].byte_7FA341 >> 2]) + 104; } void fun_walker_criminal() { walkers[walkerId].byte_7FA3A2 = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 32 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].state = 2; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 200 ) { walkers[walkerId].state = 2; walkers[walkerId].byte_7FA341 = 0; } if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C96 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C96 + LOWORD(dword_5FA3C8[walkers[walkerId].byte_7FA341 >> 1]) + 104; } void fun_walker_rioter() { int v0; // [sp+4Ch] [bp-4h]@12 int v1; // [sp+4Ch] [bp-4h]@23 ++city_inform[ciid].rioting; if ( !walkers[walkerId].wlk_ID_mm ) city_inform[ciid].dword_654468 = 10; walkers[walkerId].byte_7FA3A2 = 2; walkers[walkerId].word_7FA372 = 480; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].reachedLastStep = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x78: ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 32 ) walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 160 ) { walkers[walkerId].actionState = 121; //v0 = sub_4C1100(); if ( v0 ) { walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].baseWorkingBuildingId = v0; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].state = 2; } } break; case 0x79: ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { //v1 = sub_4C1100(); if ( v1 ) { walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].baseWorkingBuildingId = v1; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].state = 2; } } else { if ( walkers[walkerId].direction == 11 ) { if ( walkers[walkerId].byte_7FA341 > 12 ) walkers[walkerId].byte_7FA341 = 0; } } } else { walkers[walkerId].actionState = 120; removeDestinationPathForWalker(walkerId); } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].direction == 11 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6C96 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; } else { if ( walkers[walkerId].direction == 11 ) { walkers[walkerId].word_7FA344 = word_6E6C96 + LOWORD(dword_5FA3C8[walkers[walkerId].byte_7FA341]) + 104; } else { if ( walkers[walkerId].actionState == 121 ) walkers[walkerId].word_7FA344 = word_6E6C96 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; else walkers[walkerId].word_7FA344 = word_6E6C96 + LOWORD(dword_5FA3C8[walkers[walkerId].byte_7FA341 >> 1]) + 104; } } } signed int sub_49FDE0(int walkerId) { int v1; // edx@4 int v3; // [sp+54h] [bp-8h]@4 signed int i; // [sp+58h] [bp-4h]@1 for ( i = 0; ; i += 2 ) { if ( i >= 8 ) return 0; v1 = dword_5FFE4C[i] + walkers[walkerId].gridOffset; v3 = grid_buildingIds[v1]; if ( grid_buildingIds[v1] ) { if ( (!buildings[v3].house_size || buildings[v3].level_resourceId > 5) && buildings[v3].type != B_WarehouseSpace && buildings[v3].type != B_Warehouse && buildings[v3].type != B_FortGround && buildings[v3].type != B_FortGround__ && buildings[v3].type != B_BurningRuin ) break; } } if ( time_current - dword_659C14 <= 15000 ) dword_65DED0 = 0; else dword_659C14 = time_current; fun_postMessageToPlayer(14, buildings[v3].type, walkers[walkerId].gridOffset); ++dword_65DE2C; sub_46E3D0(v3, 0); walkers[walkerId].actionState = 120; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].direction = i; return 1; } int sub_49FFE0(int a1) { int result; // eax@2 int v2; // [sp+4Ch] [bp-4h]@1 v2 = walkers[walkerId].buildingId; if ( walkers[walkerId].actionState == 150 ) { /*result =*/ sub_4B3390(walkerId); } else { if ( walkers[walkerId].actionState == 149 ) { result = sub_4B3B80(walkerId); } else { result = walkers[walkerId].actionState; if ( result == 125 ) { walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= walkers[walkerId].word_7FA372 ) { if ( sub_489070( buildings[v2].x, buildings[v2].y, buildings[v2].size, 2) ) { walkers[walkerId].actionState = 126; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; removeDestinationPathForWalker(walkerId); walkers[walkerId].word_7FA374 = 0; } else { walkers[walkerId].state = 2; } } /*result = */sub_4B3F00(walkerId, a1); } else { if ( walkers[walkerId].actionState == 126 ) { walkerWalkTicks(walkerId, a1); result = walkers[walkerId].direction; if ( result != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { result = walkerId << 7; walkers[walkerId].state = 2; } } else { result = walkerId << 7; walkers[walkerId].state = 2; } } } } } return result; } void walker_fishingBoat() { int v0; // [sp+4Ch] [bp-14h]@41 int v1; // [sp+50h] [bp-10h]@41 int v2; // [sp+58h] [bp-8h]@12 int v3; // [sp+5Ch] [bp-4h]@1 v3 = walkers[walkerId].buildingId; if ( buildings[v3].inUse != 1 ) walkers[walkerId].state = 2; if ( walkers[walkerId].actionState != 190 ) { if ( buildings[v3].wharf_hasBoat_house_evolveStatusDesir != walkerId ) { v3 = sub_48A390(walkerId); if ( v3 ) { walkers[walkerId].buildingId = v3; buildings[v3].wharf_hasBoat_house_evolveStatusDesir = walkerId; walkers[walkerId].actionState = -63; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].byte_7FA360 = walkerGridX; walkers[walkerId].byte_7FA361 = walkerGridY; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].state = 2; } } } walkers[walkerId].reachedLastStep = 0; walkers[walkerId].isBoat = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; switch ( walkers[walkerId].actionState ) { case 0xBE: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 50 ) { walkers[walkerId].word_7FA366 = 0; v2 = sub_48A390(walkerId); if ( v2 ) { buildings[v3].walkerId = 0; walkers[walkerId].buildingId = v2; buildings[v2].wharf_hasBoat_house_evolveStatusDesir = walkerId; walkers[walkerId].actionState = -63; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].byte_7FA360 = walkerGridX; walkers[walkerId].byte_7FA361 = walkerGridY; removeDestinationPathForWalker(walkerId); } } break; case 0xBF: walkerWalkTicks(walkerId, 1); walkers[walkerId].byte_7FA3A5 = 0; if ( walkers[walkerId].direction == 8 ) { if ( sub_48A6F0(walkerId) ) { walkers[walkerId].actionState = -64; walkers[walkerId].word_7FA366 = 0; } else { removeDestinationPathForWalker(walkerId); walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].direction = walkers[walkerId].lastDirection; } } else { if ( walkers[walkerId].direction == 9 || walkers[walkerId].direction == 10 ) { walkers[walkerId].actionState = -62; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } } break; case 0xC0: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 200 ) { walkers[walkerId].word_7FA366 = 0; walkers[walkerId].actionState = -61; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; removeDestinationPathForWalker(walkerId); } break; case 0xC1: walkerWalkTicks(walkerId, 1); walkers[walkerId].byte_7FA3A5 = 0; switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -62; walkers[walkerId].word_7FA366 = 0; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: if ( dword_65DE4C[0] > 0 ) { --dword_65DE4C[0]; } else { message_usePopup = 1; fun_postMessageToPlayer(118, 0, 0); dword_65DE4C[0] = 12; } walkers[walkerId].state = 2; break; } break; case 0xC2: v1 = getPercentage( buildings[v3].num_workers, model_buildings[buildings[v3].type].laborers); v0 = 5 * (102 - v1); if ( buildings[v3].house_pottery > 0 ) v1 = 0; if ( v1 > 0 ) { ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= v0 ) { walkers[walkerId].word_7FA366 = 0; if ( sub_48A590(walkerId) ) { walkers[walkerId].actionState = -65; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; removeDestinationPathForWalker(walkerId); } } } break; case 0xC3: walkerWalkTicks(walkerId, 1); walkers[walkerId].byte_7FA3A5 = 0; switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -62; walkers[walkerId].word_7FA366 = 0; buildings[v3].walkerSpawnDelay = 1; ++buildings[v3].house_pottery; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 192 ) walkers[walkerId].word_7FA344 = word_6E6CFA + dword_65DF24 + 16; else walkers[walkerId].word_7FA344 = word_6E6CFA + dword_65DF24 + 8; } void fun_walker_marketTrader() { int walkerBaseId; // [sp+50h] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; walkerBaseId = walkers[walkerId].buildingId; if ( buildings[walkerBaseId].inUse != 1 || buildings[walkerBaseId].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; if ( walkers[walkerId].actionState == 125 ) { int v0 = sub_452DD0(walkerBaseId); int v1 = sub_452ED0(walkerBaseId) + v0; if ( walkers[walkerId].word_7FA374 >= 96 ) { if ( v1 <= 0 ) walkers[walkerId].word_7FA374 = walkers[walkerId].word_7FA372; } } sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C84 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C84 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_priest() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C66 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C66 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_schoolChild() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 96; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].type != 51 ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x7D: walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].word_7FA374; if ( walkers[walkerId].word_7FA374 >= walkers[walkerId].word_7FA372 ) walkers[walkerId].state = 2; sub_4B3F00(walkerId, 2); break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C82 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C82 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_teacher() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D7E + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D7E + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_librarian() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D7E + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D7E + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_barber() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C98 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C98 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_bathhouseWorker() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C60 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C60 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_doctor() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D78 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D78 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_surgeon() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D78 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D78 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_worker() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 384; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; } void fun_walker_mapFlag() { ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 16 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA344 = (walkers[walkerId].byte_7FA341 >> 1) + word_6E6CC6; removeWalkerFromTileList(walkerId); switch ( walkers[walkerId].cartPusherGoodType ) { case 1: walkers[walkerId].x = map_earthquake_x; walkers[walkerId].y = map_earthquake_y; walkers[walkerId].word_7FA346 = word_6E6CC8; break; case 2: walkers[walkerId].x = LOBYTE(map_entry_x[0]); walkers[walkerId].y = map_entry_y; walkers[walkerId].word_7FA346 = word_6E6CC8 + 2; break; case 3: walkers[walkerId].x = map_exit_x; walkers[walkerId].y = LOBYTE(map_exit_y[0]); walkers[walkerId].word_7FA346 = word_6E6CC8 + 3; break; case 0xC: walkers[walkerId].x = map_riverEntry_x; walkers[walkerId].y = map_riverEntry_y; walkers[walkerId].word_7FA346 = word_6E6CC8 + 4; break; case 0xD: walkers[walkerId].x = map_riverExit_x; walkers[walkerId].y = map_riverExit_y; walkers[walkerId].word_7FA346 = word_6E6CC8 + 5; break; default: if ( walkers[walkerId].cartPusherGoodType < 14 || walkers[walkerId].cartPusherGoodType > 21 ) { if ( walkers[walkerId].cartPusherGoodType < 22 || walkers[walkerId].cartPusherGoodType > 25 ) { walkers[walkerId].x = LOBYTE(map_entry_x[walkers[walkerId].cartPusherGoodType]); walkers[walkerId].y = LOBYTE(map_invasionPoints_x[walkers[walkerId].cartPusherGoodType + 4]); walkers[walkerId].word_7FA346 = word_6E6CC8 + 1; } else { walkers[walkerId].x = byte_9909EC[2 * walkers[walkerId].cartPusherGoodType]; walkers[walkerId].y = byte_9909F4[2 * walkers[walkerId].cartPusherGoodType]; walkers[walkerId].word_7FA346 = word_6E6CAE + 4; } } else { walkers[walkerId].x = *((_BYTE *)&map_event_seaTradeProblem + 2 * walkers[walkerId].cartPusherGoodType); walkers[walkerId].y = *((_BYTE *)&map_event_contaminatedWater + 2 * walkers[walkerId].cartPusherGoodType); walkers[walkerId].word_7FA346 = word_6E6CAE + 3; } break; } walkers[walkerId].tilePosition_y = 15 * walkers[walkerId].x; walkers[walkerId].tilePosition_x = 15 * walkers[walkerId].y; walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; walkers[walkerId].tilePosition_y += 7; walkers[walkerId].tilePosition_x += 7; sub_4B8A40(walkerId); } void fun_walker_flotsam() { walkers[walkerId].isBoat = 2; if ( mode_editor == 1 ) { if ( map_riverExit_x == -1 || map_riverExit_y == -1 ) return; LABEL_9: walkers[walkerId].reachedLastStep = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA3A2 = 0; switch ( walkers[walkerId].actionState ) { case 0x80: walkers[walkerId].reachedLastStep = 1; --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { walkers[walkerId].actionState = -127; walkers[walkerId].word_7FA366 = 0; if ( city_inform[ciid].dword_654620 ) { if ( !walkers[walkerId].cartPusherGoodType ) { walkers[walkerId].maxLevelOrRiskSeen = 1; city_inform[ciid].dword_654620 = 0; } } if ( mode_editor == 1 ) { walkers[walkerId].destination_x = map_riverExit_x; walkers[walkerId].destination_y = map_riverExit_y; } else { walkers[walkerId].destination_x = scn_riverExit_x; walkers[walkerId].destination_y = scn_riverExit_y; } } break; case 0x81: if ( byte_7FA343[128 * walkerId] ) { byte_7FA343[128 * walkerId] = 0; } else { byte_7FA343[128 * walkerId] = 1; ++walkers[walkerId].word_7FA366; walkerWalkTicks(walkerId, 1); walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A5 = 0; switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -126; break; case 9: walkers[walkerId].actionState = -126; break; case 10: walkers[walkerId].actionState = -126; break; } } break; case 0x82: walkers[walkerId].reachedLastStep = 1; walkers[walkerId].maxLevelOrRiskSeen = 0; walkers[walkerId].actionState = -128; if ( walkers[walkerId].word_7FA366 < 400 ) { if ( walkers[walkerId].word_7FA366 < 200 ) { if ( walkers[walkerId].word_7FA366 < 100 ) { if ( walkers[walkerId].word_7FA366 < 50 ) walkers[walkerId].word_7FA366 = random_7f_1 + 300; else walkers[walkerId].word_7FA366 = (random_7f_1 & 0x3F) + 200; } else { walkers[walkerId].word_7FA366 = (random_7f_1 & 0x1F) + 100; } } else { walkers[walkerId].word_7FA366 = (random_7f_1 & 0xF) + 50; } } else { walkers[walkerId].word_7FA366 = random_7f_1 & 7; } removeWalkerFromTileList(walkerId); if ( mode_editor == 1 ) { walkers[walkerId].x = map_riverEntry_x; walkers[walkerId].y = map_riverEntry_y; } else { walkers[walkerId].x = scn_riverEntry_x; walkers[walkerId].y = scn_riverEntry_y; } walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; walkers[walkerId].tilePosition_y = 15 * walkers[walkerId].x; walkers[walkerId].tilePosition_x = 15 * walkers[walkerId].y; break; } if ( walkers[walkerId].cartPusherGoodType ) { switch ( walkers[walkerId].cartPusherGoodType ) { case 1: ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 24 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA344 = dword_5FA438[2 * walkers[walkerId].byte_7FA341] + word_6E6CE4; break; case 2: ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 24 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA344 = dword_5FA438[2 * walkers[walkerId].byte_7FA341] + word_6E6CE6; break; case 3: ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 24 ) walkers[walkerId].byte_7FA341 = 0; if ( dword_5FA498[walkers[walkerId].byte_7FA341] == -1 ) walkers[walkerId].word_7FA344 = 0; else walkers[walkerId].word_7FA344 = LOWORD(dword_5FA498[walkers[walkerId].byte_7FA341]) + word_6E6CE8; break; } } else { ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; if ( walkers[walkerId].maxLevelOrRiskSeen ) walkers[walkerId].word_7FA344 = dword_5FA408[2 * walkers[walkerId].byte_7FA341] + word_6E6D94; else walkers[walkerId].word_7FA344 = dword_5FA408[2 * walkers[walkerId].byte_7FA341] + word_6E6CE2; } if ( mode_editor == 1 ) { if ( !map_flotsam ) walkers[walkerId].word_7FA344 = 0; } return; } if ( scn_riverExit_x != -1 && scn_riverExit_y != -1 ) goto LABEL_9; } void walker_docker() { int v0; // [sp+4Ch] [bp-24h]@11 signed int v1; // [sp+50h] [bp-20h]@35 int v2; // [sp+54h] [bp-1Ch]@93 int v3; // [sp+54h] [bp-1Ch]@102 signed int i; // [sp+58h] [bp-18h]@35 int v5; // [sp+60h] [bp-10h]@3 int v6; // [sp+68h] [bp-8h]@38 int v7; // [sp+6Ch] [bp-4h]@11 ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; v5 = walkers[walkerId].buildingId; if ( buildings[v5].inUse != 1 ) walkers[walkerId].state = 2; if ( buildings[v5].type != 75 ) { if ( buildings[v5].type != 76 ) walkers[walkerId].state = 2; } if ( buildings[v5].house_bathhouse_dock_numships_entert_days ) --buildings[v5].house_bathhouse_dock_numships_entert_days; if ( buildings[v5].wharf_hasBoat_house_evolveStatusDesir ) { v7 = buildings[v5].wharf_hasBoat_house_evolveStatusDesir; v0 = byte_7FA3AD[128 * v7]; if ( walkers[v7].state == 1 && walkers[v7].type == 20 ) { if ( dword_993F60[12 * v0] < 12 && dword_993F64[12 * v0] < 12 ) { if ( walkers[v7].actionState == 115 ) buildings[v5].wharf_hasBoat_house_evolveStatusDesir = 0; } else { buildings[v5].wharf_hasBoat_house_evolveStatusDesir = 0; } } else { buildings[v5].wharf_hasBoat_house_evolveStatusDesir = 0; } } walkers[walkerId].byte_7FA3A2 = 1; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 132: walkers[walkerId].cartPusherGoodType = 0; walkers[walkerId].word_7FA346 = 0; if ( !sub_4A46D0(v5) ) sub_4A4910(v5); walkers[walkerId].byte_7FA341 = 0; break; case 133: walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA341 = 0; if ( buildings[v5].grow_value_house_foodstocks[0] <= 0 ) { buildings[v5].grow_value_house_foodstocks[0] = walkerId; walkers[walkerId].word_7FA366 = 0; } if ( buildings[v5].grow_value_house_foodstocks[0] == walkerId ) { buildings[v5].house_bathhouse_dock_numships_entert_days = 120; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 80 ) { walkers[walkerId].actionState = -121; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset( walkers[walkerId].cartPusherGoodType, 1); buildings[v5].grow_value_house_foodstocks[0] = 0; } } else { v1 = 0; for ( i = 0; i <= 2; ++i ) { v6 = buildings[v5].word_94BDAC[i]; if ( buildings[v5].word_94BDAC[i] ) { if ( walkers[v6].state == 1 ) { if ( walkers[v6].actionState == 133 || walkers[v6].actionState == 134 ) { if ( buildings[v5].grow_value_house_foodstocks[0] == v6 ) v1 = 1; } } } } if ( v1 != 1 ) buildings[v5].grow_value_house_foodstocks[0] = 0; } break; case 134: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); if ( buildings[v5].grow_value_house_foodstocks[0] <= 0 ) { buildings[v5].grow_value_house_foodstocks[0] = walkerId; walkers[walkerId].word_7FA366 = 0; } if ( buildings[v5].grow_value_house_foodstocks[0] == walkerId ) { buildings[v5].house_bathhouse_dock_numships_entert_days = 120; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 80 ) { walkers[walkerId].actionState = -124; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].word_7FA344 = 0; walkers[walkerId].word_7FA346 = 0; buildings[v5].grow_value_house_foodstocks[0] = 0; } } ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 >= 20 ) { walkers[walkerId].actionState = -124; walkers[walkerId].word_7FA366 = 0; } walkers[walkerId].byte_7FA341 = 0; break; case 135: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -117; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 136: walkers[walkerId].word_7FA346 = word_6E6C72; walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -116; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 137: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -122; walkers[walkerId].word_7FA366 = 0; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 139: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 10 ) { if ( buildings[v5].wharf_hasBoat_house_evolveStatusDesir ) v2 = walkers[128 * buildings[v5].wharf_hasBoat_house_evolveStatusDesir].tradeCityId; else v2 = 0; if ( fun_importOneGoodFromCity(walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].cartPusherGoodType, v2) ) { sub_445AB0( buildings[v5].wharf_hasBoat_house_evolveStatusDesir, walkers[walkerId].cartPusherGoodType); walkers[walkerId].actionState = -118; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; walkers[walkerId].cartPusherGoodType = 0; sub_4A4910(v5); } else { walkers[walkerId].actionState = -118; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } walkers[walkerId].word_7FA366 = 0; } walkers[walkerId].byte_7FA341 = 0; break; case 140: walkers[walkerId].word_7FA346 = word_6E6C72; if ( buildings[v5].wharf_hasBoat_house_evolveStatusDesir ) v3 = walkers[128 * buildings[v5].wharf_hasBoat_house_evolveStatusDesir].tradeCityId; else v3 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 10 ) { walkers[walkerId].actionState = -118; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; walkers[walkerId].word_7FA366 = 0; if ( fun_exportOneGoodToCity(walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].cartPusherGoodType, v3) ) { sub_445B60( buildings[v5].wharf_hasBoat_house_evolveStatusDesir, walkers[walkerId].cartPusherGoodType); walkers[walkerId].actionState = -119; } else { sub_4A4910(v5); } } walkers[walkerId].byte_7FA341 = 0; break; case 138: walkers[walkerId].word_7FA346 = word_6E6C72 + 8 * walkers[walkerId].cartPusherGoodType; walkers[walkerId].word_7FA346 += fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 1); walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -124; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6C86 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; walkers[walkerId].word_7FA346 = 0; } else { walkers[walkerId].word_7FA344 = word_6E6C86 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } if ( walkers[walkerId].word_7FA346 ) { walkers[walkerId].word_7FA346 += dword_65DF24; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_65DF24]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_65DF24]; } else { walkers[walkerId].word_7FA344 = 0; } } signed int sub_4A46D0(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-10h]@8 int v3; // [sp+50h] [bp-Ch]@8 int v5; // [sp+58h] [bp-4h]@10 int wlkId = buildings[a1].wharf_hasBoat_house_evolveStatusDesir; if ( buildings[a1].wharf_hasBoat_house_evolveStatusDesir ) { if ( walkers[wlkId].actionState == 112 ) { if ( walkers[wlkId].byte_7FA3A3 > 0 ) { if ( city_inform[ciid].tradeCenterId ) { int trCId = city_inform[ciid].tradeCenterId; v3 = buildings[trCId].x; v2 = buildings[trCId].y; } else { v3 = walkers[walkerId].x; v2 = walkers[walkerId].y; } v5 = sub_446B50(v3,v2, walkers[wlkId].tradeCityId, buildings[a1].haveRomeroad, buildings[a1].haveRoadnet); if ( v5 ) { --walkers[wlkId].byte_7FA3A3; walkers[walkerId].baseWorkingBuildingId = v5; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].actionState = -123; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].cartPusherGoodType = LOBYTE(city_inform[ciid].dword_6543B8); result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int sub_4A4910(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-10h]@8 int v3; // [sp+50h] [bp-Ch]@8 int v4; // [sp+54h] [bp-8h]@1 int v5; // [sp+58h] [bp-4h]@10 v4 = buildings[a1].wharf_hasBoat_house_evolveStatusDesir; if ( buildings[a1].wharf_hasBoat_house_evolveStatusDesir ) { if ( walkers[v4].actionState == 112 ) { if ( walkers[v4].byte_7FA39F < 12 ) { if ( city_inform[ciid].tradeCenterId ) { int trcid =city_inform[ciid].tradeCenterId; v3 = buildings[trcid].x; v2 = buildings[trcid].y; } else { v3 = walkers[walkerId].x; v2 = walkers[walkerId].y; } v5 = sub_447210( v3, v2, walkers[v4].tradeCityId, buildings[a1].haveRomeroad, buildings[a1].haveRoadnet); if ( v5 ) { ++walkers[v4].byte_7FA39F; walkers[walkerId].baseWorkingBuildingId = v5; walkers[walkerId].actionState = -120; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].cartPusherGoodType = LOBYTE(city_inform[ciid].dword_6543BC); result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int sub_4A4B50(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-Ch]@10 signed int i; // [sp+50h] [bp-8h]@7 int workingBuildingID = walkers[a1].baseWorkingBuildingId; if ( buildings[workingBuildingID].inUse == 1 ) { if ( buildings[workingBuildingID].type == B_Dock ) { if ( buildings[workingBuildingID].num_workers > 0 ) { for ( i = 0; i <= 2; ++i ) { v2 = buildings[workingBuildingID].word_94BDAC[i]; if ( buildings[workingBuildingID].word_94BDAC[i] && walkers[v2].state == 1 && walkers[v2].actionState != 132 ) return 0; } ++walkers[a1].byte_7FA3A9; if ( walkers[a1].byte_7FA3A9 >= 10 ) { walkers[a1].byte_7FA3A9 = 11; result = 1; } else { result = 0; } } else { result = 1; } } else { result = 1; } } else { result = 1; } return result; } bool sub_4A4CC0(int a1) { bool result; // eax@2 int baseWorkingBuildingID = walkers[a1].baseWorkingBuildingId; if ( buildings[baseWorkingBuildingID].inUse == 1 && buildings[baseWorkingBuildingID].type == B_Dock && buildings[baseWorkingBuildingID].num_workers > 0 ) { result = buildings[baseWorkingBuildingID].wharf_hasBoat_house_evolveStatusDesir != a1; } else { result = 1; } return result; } signed int sub_4A4D70(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-Ch]@8 signed int i; // [sp+50h] [bp-8h]@5 int v4; // [sp+54h] [bp-4h]@1 v4 = walkers[a1].baseWorkingBuildingId; if ( buildings[v4].inUse == 1 ) { if ( buildings[v4].type == 75 ) { for ( i = 0; i <= 2; ++i ) { v2 = buildings[v4].word_94BDAC[i]; if ( buildings[v4].word_94BDAC[i] && walkers[v2].state == 1 ) { if ( walkers[v2].actionState == 133 ) return 1; if ( walkers[v2].actionState == 135 ) return 1; if ( walkers[v2].actionState == 139 ) return 1; if ( walkers[v2].actionState == 138 ) return 1; if ( walkers[v2].actionState == 134 ) return 2; if ( walkers[v2].actionState == 136 ) return 2; if ( walkers[v2].actionState == 137 ) return 2; if ( walkers[v2].actionState == 140 ) return 2; } } result = 0; } else { result = 1; } } else { result = 1; } return result; } int sub_4A4F80(int a1) { int v2; // [sp+4Ch] [bp-Ch]@4 int v3; // [sp+50h] [bp-8h]@1 signed int i; // [sp+54h] [bp-4h]@1 v3 = 0; for ( i = 0; i <= 2; ++i ) { if ( *(__int16 *)((char *)&buildings[a1].word_94BDAC + 2 * i) ) { v2 = *(__int16 *)((char *)&buildings[a1].word_94BDAC + 2 * i); if ( walkers[v2].actionState == 132 ) { ++v3; } else { if ( walkers[v2].actionState == 133 ) ++v3; } } } return v3; } signed int unused_4A5050(int a1, int a2) { signed int result; // eax@2 int v3; // [sp+4Ch] [bp-8h]@1 signed int v4; // [sp+50h] [bp-4h]@1 v4 = 0; v3 = grid_walkerIds[a2]; if ( v3 == a1 ) { result = 0; } else { do { if ( !walkers[v3].nextIdOnSameTile ) break; if ( v3 == a1 ) return 0; if ( walkers[v3].type == 38 ) return 1; v3 = walkers[v3].nextIdOnSameTile; ++v4; } while ( v4 <= 1000 ); result = 0; } return result; } void fun_walker_marketBuyer() { int v0; // [sp+54h] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 800; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].laborSeekerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 145: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction == 8 ) { if ( walkers[walkerId].itemCollecting && walkers[walkerId].itemCollecting != 1 && walkers[walkerId].itemCollecting != 2 && walkers[walkerId].itemCollecting != 3 ) { if ( !sub_4A5EB0(walkerId, v0, walkers[walkerId].baseWorkingBuildingId) ) walkers[walkerId].state = 2; } else { if ( !createCaravanForMarketTrader(walkerId, v0, walkers[walkerId].baseWorkingBuildingId) ) walkers[walkerId].state = 2; } walkers[walkerId].actionState = -110; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } else { if ( walkers[walkerId].direction == 9 || walkers[walkerId].direction == 10 ) { walkers[walkerId].actionState = -110; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; removeDestinationPathForWalker(walkerId); } } break; case 146: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6C84 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6C84 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } signed int createCaravanForMarketTrader(int marketTraderId, int a2, int a3) { signed int result; // eax@32 int eithDelvrBoyIndex; // eax@47 signed int delvrBoysQty; // [sp+50h] [bp-18h]@10 int v12; // [sp+54h] [bp-14h]@9 signed int v13; // [sp+58h] [bp-10h]@12 int deliveryBoyNumber; // [sp+5Ch] [bp-Ch]@13 int firstDelvrBoyIndex; // [sp+64h] [bp-4h]@33 int secondDelvrBoyIndex; // [sp+64h] [bp-4h]@35 int thirdDelvrBoyIndex; // [sp+64h] [bp-4h]@37 int fortyDelvrBoyIndex; // [sp+64h] [bp-4h]@39 int fifthDelvrBoyIndex; // [sp+64h] [bp-4h]@41 int sixDelvrBoyIndex; // [sp+64h] [bp-4h]@43 int sevendelvrBoyIndex; // [sp+64h] [bp-4h]@45 if ( walkers[marketTraderId].itemCollecting ) { switch ( walkers[marketTraderId].itemCollecting ) { case 1: v13 = 2; break; case 2: v13 = 3; break; case 3: v13 = 6; break; } } else { v13 = 1; } v12 = buildings[a2].granary_capacity[walkers[marketTraderId].itemCollecting]; if ( walkers[marketTraderId].itemCollecting ) delvrBoysQty = 600 - v12; else delvrBoysQty = 800 - v12; if (buildings[a3].granary_capacity[v13] < 800 ) { if (buildings[a3].granary_capacity[v13] < 700 ) { if (buildings[a3].granary_capacity[v13] < 600 ) { if (buildings[a3].granary_capacity[v13] < 500 ) { if (buildings[a3].granary_capacity[v13] < 400 ) { if (buildings[a3].granary_capacity[v13] < 300 ) { if (buildings[a3].granary_capacity[v13] < 200 ) deliveryBoyNumber =buildings[a3].granary_capacity[v13] >= 100; else deliveryBoyNumber = 2; } else { deliveryBoyNumber = 3; } } else { deliveryBoyNumber = 4; } } else { deliveryBoyNumber = 5; } } else { deliveryBoyNumber = 6; } } else { deliveryBoyNumber = 7; } } else { deliveryBoyNumber = 8; } if( deliveryBoyNumber > delvrBoysQty / 100 ) deliveryBoyNumber = delvrBoysQty / 100; if ( deliveryBoyNumber > 0 ) { sub_45D7B0(ciid, a3, v13, 100 * deliveryBoyNumber); firstDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[firstDelvrBoyIndex].tradeCaravanNextId = marketTraderId; walkers[firstDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[firstDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 1 ) { secondDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[secondDelvrBoyIndex].tradeCaravanNextId = firstDelvrBoyIndex; walkers[secondDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[secondDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 2 ) { thirdDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[thirdDelvrBoyIndex].tradeCaravanNextId = secondDelvrBoyIndex; walkers[thirdDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[thirdDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 3 ) { fortyDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[fortyDelvrBoyIndex].tradeCaravanNextId = thirdDelvrBoyIndex; walkers[fortyDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[fortyDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 4 ) { fifthDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[fifthDelvrBoyIndex].tradeCaravanNextId = fortyDelvrBoyIndex; walkers[fifthDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[fifthDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 5 ) { sixDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[sixDelvrBoyIndex].tradeCaravanNextId = fifthDelvrBoyIndex; walkers[sixDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[sixDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 6 ) { sevendelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[sevendelvrBoyIndex].tradeCaravanNextId= sixDelvrBoyIndex; walkers[sevendelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[sevendelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; if ( deliveryBoyNumber > 7 ) { eithDelvrBoyIndex = spawnWalker(ciid, Walker_DeliveryBoy, walkers[marketTraderId].x, walkers[marketTraderId].y, 0); walkers[eithDelvrBoyIndex].tradeCaravanNextId = sevendelvrBoyIndex; walkers[eithDelvrBoyIndex].itemCollecting = walkers[marketTraderId].itemCollecting; walkers[eithDelvrBoyIndex].buildingId = walkers[marketTraderId].buildingId; result = 1; } else { result = 1; } } else { result = 1; } } else { result = 1; } } else { result = 1; } } else { result = 1; } } else { result = 1; } } else { result = 1; } } else { result = 0; } return result; } signed int sub_4A5EB0(int a1, int a2, int a3) { signed int result; // eax@15 int v4; // eax@18 bool v5; // [sp+50h] [bp-18h]@10 int v6; // [sp+58h] [bp-10h]@9 int v7; // [sp+64h] [bp-4h]@16 switch ( walkers[a1].itemCollecting ) { case 7: v6 = 15; break; case 6: v6 = 14; break; case 5: v6 = 8; break; case 4: v6 = 7; break; } if ( fun_getGoodAmountStoredInWarehouse(a3, v6) <= 1 ) v5 = fun_getGoodAmountStoredInWarehouse(a3, v6) > 0; else v5 = 2; if ( v5 > 0 ) { fun_removeGoodFromWarehouse(ciid, a3, v6, v5); v7 = spawnWalker(ciid, Walker_DeliveryBoy, walkers[a1].x, walkers[a1].y, 0); walkers[v7].tradeCaravanNextId = a1; walkers[v7].itemCollecting = walkers[a1].itemCollecting; walkers[v7].buildingId = walkers[a1].buildingId; if ( v5 > 1 ) { v4 = spawnWalker(ciid, Walker_DeliveryBoy, walkers[a1].x, walkers[a1].y, 0); walkers[v4].tradeCaravanNextId = v7; walkers[v4].itemCollecting = walkers[a1].itemCollecting; walkers[v4].buildingId = walkers[a1].buildingId; result = 1; } else { result = 1; } } else { result = 0; } return result; } void fun_walker_patrician() { walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 128; if ( buildings[walkers[walkerId].buildingId].inUse != 1 ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D7A + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D7A + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_indigenousNative() { __int64 v0; // qax@48 int v1; // [sp+54h] [bp-8h]@1 walkers[walkerId].byte_7FA3A2 = 0; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 800; v1 = walkers[walkerId].buildingId; if ( buildings[v1].inUse != 1 || buildings[v1].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0x9F: city_inform[ciid].dword_654468 = 10; ++city_inform[ciid].dword_654648; walkers[walkerId].byte_7FA3A2 = 2; walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].actionState = -98; } else { walkers[walkerId].actionState = -98; } break; case 0x9E: walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > (walkerId & 3) + 10 ) { walkers[walkerId].word_7FA366 = 0; if ( city_inform[ciid].dword_6544B8 ) { walkers[walkerId].actionState = -97; walkers[walkerId].destination_x = formations[0].f34; walkers[walkerId].destination_y = formations[0].f35; walkers[walkerId].baseWorkingBuildingId = formations[0].f36; } else { if ( sub_48A050( buildings[buildings[v1].level_resourceId].x, buildings[buildings[v1].level_resourceId].y, buildings[buildings[v1].level_resourceId].size) ) { walkers[walkerId].actionState = -100; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } } removeDestinationPathForWalker(walkerId); } break; case 0x9C: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = -99; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } } else { walkers[walkerId].state = 2; } break; case 0x9D: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction == 9 || walkers[walkerId].direction == 10 ) walkers[walkerId].state = 2; if ( walkers[walkerId].direction == 8 ) walkers[walkerId].state = 2; break; } if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction == 11 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v0 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v0 - _HIDWORD(v0)) >> 1) + 393; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 393; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 441; } else { if ( walkers[walkerId].direction == 11 ) { walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 393; } else { if ( walkers[walkerId].actionState == 159 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 297; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 201; } } } } void fun_walker_towerSentry() { int v0; // [sp+4Ch] [bp-8h]@41 int v1; // [sp+50h] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 4; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA3A5 = 10; walkers[walkerId].word_7FA372 = 800; v1 = walkers[walkerId].buildingId; if ( buildings[v1].inUse != 1 || buildings[v1].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_4A7DC0(walkerId); switch ( walkers[walkerId].actionState ) { case 150: sub_4B3390(walkerId); break; case 149: sub_4B3B80(walkerId); break; case 170: walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 40 ) { walkers[walkerId].word_7FA366 = 0; if ( sub_4A7760(walkerId) ) { walkers[walkerId].actionState = -85; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; removeDestinationPathForWalker(walkerId); } } break; case 174: walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A5 = 0; walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { removeWalkerFromTileList(walkerId); walkers[walkerId].x = buildings[v1].x; walkers[walkerId].byte_7FA360 = walkers[walkerId].x; walkers[walkerId].y = buildings[v1].y; walkers[walkerId].byte_7FA361 = walkers[walkerId].y; walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; sub_4B8A40(walkerId); walkers[walkerId].actionState = -86; removeDestinationPathForWalker(walkerId); } } else { walkers[walkerId].state = 2; } break; case 171: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { walkers[walkerId].actionState = -83; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; removeDestinationPathForWalker(walkerId); } } else { walkers[walkerId].actionState = -86; } break; case 173: walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].actionState = -86; } else { walkers[walkerId].state = 2; } break; case 172: sub_4B4BC0(walkerId, 1); ++walkers[walkerId].byte_7FA39B; if ( walkers[walkerId].byte_7FA39B > byte_5F60FB[10 * walkers[walkerId].type] ) { if ( sub_4ADB30(walkerId, 10) ) { walkers[walkerId].direction = fun_pathing_getDirection8( walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY); walkers[walkerId].byte_7FA39B = 0; spawnWalkerWithParent(walkerId, walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY, Walker_Javelin); } else { walkers[walkerId].actionState = -83; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; removeDestinationPathForWalker(walkerId); } } break; } v0 = walkers[walkerId].gridOffset; if ( grid_terrain[v0] & T_Wall ) { walkers[walkerId].byte_7FA3A6 = 18; } else { if ( grid_terrain[v0] & 0x8000u ) { walkers[walkerId].byte_7FA370 = 24; } else { if ( walkers[walkerId].actionState != 174 ) walkers[walkerId].state = 2; } } if ( walkers[walkerId].byte_7FA370 ) { --walkers[walkerId].byte_7FA370; walkers[walkerId].byte_7FA3A5 = 0; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6D34 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 136; } else { if ( walkers[walkerId].actionState == 172 ) walkers[walkerId].word_7FA344 = word_6E6D34 + dword_65DF24 + 96 + 8 * byte_5F5F24[walkers[walkerId].byte_7FA39B >> 1]; else walkers[walkerId].word_7FA344 = word_6E6D34 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } } signed int sub_4A7760(int a1) { signed int result; // eax@20 int v2; // [sp+4Ch] [bp-14h]@1 int v3; // [sp+4Ch] [bp-14h]@25 int v4; // [sp+50h] [bp-10h]@1 int v5; // [sp+50h] [bp-10h]@25 int v6; // [sp+54h] [bp-Ch]@1 int v7; // [sp+54h] [bp-Ch]@23 signed int i; // [sp+58h] [bp-8h]@21 int v9; // [sp+5Ch] [bp-4h]@1 v9 = walkers[a1].buildingId; v6 = buildings[v9].byte_94BD6C; v4 = buildings[v9].x; v2 = buildings[v9].y; if ( buildings[v9].byte_94BD6C ) { switch ( v6 ) { case 2: v4 += 8; break; case 4: v2 += 8; break; case 6: v4 -= 8; break; } } else { v2 -= 8; } if ( v4 < 0 ) v4 = 0; if ( v2 < 0 ) v2 = 0; if ( v4 >= setting_map_width ) v4 = setting_map_width - 1; if ( v2 >= setting_map_height ) v2 = setting_map_height - 1; if ( sub_489500(v4, v2, 1, 6) ) { buildings[v9].byte_94BD6C += 2; if ( buildings[v9].byte_94BD6C > 6 ) buildings[v9].byte_94BD6C = 0; result = 1; } else { for ( i = 0; i < 4; ++i ) { v7 = buildings[v9].byte_94BD6C; buildings[v9].byte_94BD6C += 2; if ( buildings[v9].byte_94BD6C > 6 ) buildings[v9].byte_94BD6C = 0; v5 = buildings[v9].x; v3 = buildings[v9].y; if ( v7 ) { switch ( v7 ) { case 2: v5 += 3; break; case 4: v3 += 3; break; case 6: v5 -= 3; break; } } else { v3 -= 3; } if ( v5 < 0 ) v5 = 0; if ( v3 < 0 ) v3 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v3 >= setting_map_height ) v3 = setting_map_height - 1; if ( sub_489500(v5, v3, 1, 6) ) return 1; } result = 0; } return result; } void sub_4A7A70() { int v0; // ST5C_4@9 int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 1000; ++i ) { if ( walkers[i].type== Walker_TowerSentry ) { if ( byte_61AA20[walkers[i].gridOffset] ) { if ( sub_489500(walkers[i].x, walkers[i].y, 1, 2) ) { removeDestinationPathForWalker(walkerId); walkers[i].progressOnTile = 15; walkers[i].progressOnTile = 0; removeWalkerFromTileList(i); walkers[i].x = walkerGridX; byte_7FA356[128 * i] = walkerGridX; walkers[i].y = walkerGridY; byte_7FA357[128 * i] = walkerGridY; walkers[i].tilePosition_y = 15 * walkerGridX; walkers[i].tilePosition_x = 15 * walkerGridY; walkers[i].gridOffset = 162 * walkerGridY + walkerGridX + (_WORD)setting_map_startGridOffset; sub_4B8A40(i); walkers[walkerId].actionState = -83; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } else { walkers[i].actionState = -86; removeWalkerFromTileList(i); v0 = walkers[i].buildingId; walkers[i].x = buildings[v0].x; walkers[i].byte_7FA360 = walkers[i].x; walkers[i].y = buildings[v0].y; walkers[i].byte_7FA361 = walkers[i].y; walkers[i].gridOffset = 162 * walkers[i].y + walkers[i].x + (_WORD)setting_map_startGridOffset; sub_4B8A40(i); walkers[i].actionState = -86; removeDestinationPathForWalker(i); } } } } } signed int sub_4A7DC0(int a1) { signed int result; // eax@2 if ( dword_819848 > 0 ) { if ( walkers[a1].actionState == 150 ) { result = 0; } else { if ( walkers[a1].actionState == 149 ) { result = 0; } else { if ( walkers[a1].byte_7FA370 ) { result = 0; } else { ++byte_7FA3AE[128 * a1]; if ( byte_7FA3AE[128 * a1] >= 40 ) { byte_7FA3AE[128 * a1] = 0; if ( sub_4ADB30(a1, 10) > 0 ) { if ( dword_7FA2A4 <= 10 ) { walkers[a1].actionState = -84; walkers[a1].destination_x = walkers[a1].x; walkers[a1].destination_y = walkers[a1].y; result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } } } } else { result = 0; } return result; } void sub_4A7F30() { __int64 v0; // qax@14 __int64 v1; // qax@28 __int64 v2; // qax@42 __int64 v3; // qax@56 int v4; // [sp+4Ch] [bp-8h]@1 v4 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( formations[v4].formation_54 ) { dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; switch ( formations[v4].enemyType ) { case 8: switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v0 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v0 - _HIDWORD(v0)) >> 1) + 745; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 745; } break; case 0x97: walkers[walkerId].word_7FA344 = dword_65DF24 + 697 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; break; case 0x95: walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 793; break; default: if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 745; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; break; } break; case 7: switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1) + 745; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 745; } break; case 0x97: walkers[walkerId].word_7FA344 = dword_65DF24 + 697 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; break; case 0x95: walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 793; break; default: if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 745; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; break; } break; case 5: switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v2 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v2 - _HIDWORD(v2)) >> 1) + 745; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 745; } break; case 0x97: walkers[walkerId].word_7FA344 = dword_65DF24 + 697 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; break; case 0x95: walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 793; break; default: if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 745; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; break; } break; case 6: switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v3 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v3 - _HIDWORD(v3)) >> 1) + 745; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 745; } break; case 0x97: walkers[walkerId].word_7FA344 = dword_65DF24 + 697 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; break; case 0x95: walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 793; break; default: if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 745; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; break; } break; } } void sub_4A8A30() { __int64 v0; // qax@12 __int64 v1; // qax@24 __int64 v2; // qax@36 int v3; // [sp+4Ch] [bp-8h]@1 v3 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; switch ( formations[v3].enemyType ) { case 5: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v0 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v0 - _HIDWORD(v0)) >> 1) + 545; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; } else { if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } break; case 6: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1) + 545; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; } else { if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } break; case 9: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v2 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v2 - _HIDWORD(v2)) >> 1) + 545; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; } else { if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } break; } } void sub_4A9140() { __int64 v0; // qax@12 __int64 v1; // qax@24 __int64 v2; // qax@36 int v3; // [sp+4Ch] [bp-8h]@1 v3 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; switch ( formations[v3].enemyType ) { case 8: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v0 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v0 - _HIDWORD(v0)) >> 1) + 545; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; } else { if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } break; case 0xA: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1) + 545; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; } else { if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } break; case 7: if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v2 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (((_DWORD)v2 - _HIDWORD(v2)) >> 1) + 545; } else { walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; } else { if ( walkers[walkerId].direction == 11 ) walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; else walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } break; } } int sub_4A9850() { int result; // eax@11 int v1; // [sp+4Ch] [bp-8h]@1 v1 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( formations[v1].formation_54 ) { dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( walkers[walkerId].direction == 11 ) { result = 601; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; } else { switch ( walkers[walkerId].actionState ) { case 0x96: result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + 601; break; case 0x97: result = dword_65DF24 + 697 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; walkers[walkerId].word_7FA344 = result; break; case 0x95: result = 601; walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 745; break; default: result = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; walkers[walkerId].word_7FA344 = result; break; } } return result; } int sub_4A9BC0() { int result; // eax@9 ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( walkers[walkerId].direction == 11 ) { result = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].actionState == 150 ) { result = 601; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 705; walkers[walkerId].word_7FA344 = result; } else { result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; } } } return result; } int sub_4A9EA0() { int result; // eax@9 ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 3; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 697; } else { if ( walkers[walkerId].actionState == 150 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 697; } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 745; walkers[walkerId].word_7FA344 = result; } else { result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; } } } return result; } int sub_4AA1A0() { int result; // eax@11 __int64 v1; // qax@12 __int64 v2; // qax@24 __int64 v3; // qax@36 int v4; // [sp+4Ch] [bp-8h]@1 v4 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 2; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( formations[v4].enemyType ) { if ( formations[v4].enemyType == 1 ) { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v2 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v2) = dword_65DF24 + 8 * (((_DWORD)v2 - _HIDWORD(v2)) >> 1) + 593; result = walkerId << 7; walkers[walkerId].word_7FA344 = WORD2(v2); } else { result = 449; walkers[walkerId].word_7FA344 = dword_65DF24 + 593; } } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 641; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 593; } else { result = 449; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } } } else { result = v4 << 7; if ( formations[v4].enemyType == 4 ) { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v3 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v3) = dword_65DF24 + 8 * (((_DWORD)v3 - _HIDWORD(v3)) >> 1); result = 449; walkers[walkerId].word_7FA344 = WORD2(v3) + 545; } else { result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; } else { result = 449; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } } } } } else { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v1) = dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1); result = 201; walkers[walkerId].word_7FA344 = WORD2(v1) + 393; } else { result = dword_65DF24 + 393; walkers[walkerId].word_7FA344 = dword_65DF24 + 393; } } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 441; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 393; } else { result = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 297; walkers[walkerId].word_7FA344 = result; } } } } return result; } int sub_4AA8C0() { int result; // eax@11 __int64 v1; // qax@12 __int64 v2; // qax@24 int v3; // [sp+4Ch] [bp-8h]@1 v3 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( formations[v3].enemyType == 3 ) { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v1) = dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1); result = 449; walkers[walkerId].word_7FA344 = WORD2(v1) + 545; } else { result = dword_65DF24 + 545; walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; } else { result = 449; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } } } else { result = v3 << 7; if ( formations[v3].enemyType == 2 ) { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v2 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v2) = dword_65DF24 + 8 * (((_DWORD)v2 - _HIDWORD(v2)) >> 1); result = 449; walkers[walkerId].word_7FA344 = WORD2(v2) + 545; } else { result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + 545; } } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 593; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 545; } else { result = 449; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; } } } } } return result; } int sub_4AADF0() { int result; // eax@10 __int64 v1; // qax@14 int v2; // [sp+4Ch] [bp-8h]@1 v2 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 2; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( formations[v2].formation_54 ) { dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; result = formations[v2].enemyType; if ( result == 1 ) { switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v1) = dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1) + 593; result = walkerId << 7; walkers[walkerId].word_7FA344 = WORD2(v1); } else { result = 449; walkers[walkerId].word_7FA344 = dword_65DF24 + 593; } break; case 0x97: result = dword_65DF24 + 545 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; walkers[walkerId].word_7FA344 = result; break; case 0x95: result = 449; walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 641; break; default: if ( walkers[walkerId].direction == 11 ) { result = 449; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 593; } else { result = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 449; walkers[walkerId].word_7FA344 = result; } break; } } return result; } int sub_4AB200() { int result; // eax@11 int v1; // [sp+4Ch] [bp-8h]@1 v1 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 3; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( formations[v1].formation_54 ) { dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; walkers[walkerId].byte_7FA342 = 1; if ( walkers[walkerId].direction == 11 ) { result = 601; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; } else { switch ( walkers[walkerId].actionState ) { case 0x96: result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + 601; break; case 0x97: result = dword_65DF24 + 697 + 8 * byte_5F5FA4[walkers[walkerId].byte_7FA39A >> 1]; walkers[walkerId].word_7FA344 = result; break; case 0x95: result = 601; walkers[walkerId].word_7FA344 = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 745; break; default: result = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; walkers[walkerId].word_7FA344 = result; break; } } return result; } int sub_4AB570() { int result; // eax@8 __int64 v1; // qax@12 int v2; // [sp+4Ch] [bp-8h]@1 v2 = walkers[walkerId].formationId; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; result = walkerId << 7; walkers[walkerId].byte_7FA342 = 1; if ( formations[v2].enemyType == 2 ) { if ( walkers[walkerId].actionState == 150 ) { if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; _HIDWORD(v1) = dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1); result = 601; walkers[walkerId].word_7FA344 = WORD2(v1) + 697; } else { result = dword_65DF24 + 697; walkers[walkerId].word_7FA344 = dword_65DF24 + 697; } } else { if ( walkers[walkerId].actionState == 149 ) { result = byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 745; walkers[walkerId].word_7FA344 = result; } else { if ( walkers[walkerId].direction == 11 ) { result = walkerId << 7; walkers[walkerId].word_7FA344 = (_WORD)dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 697; } else { result = 601; walkers[walkerId].word_7FA344 = dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 601; } } } } return result; } int sub_4AB8D0() { int result; // eax@33 int v1; // [sp+50h] [bp-4h]@21 walkers[walkerId].byte_7FA3A2 = 0; walkers[walkerId].byte_7FA34C = 0; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; if ( event_gladiatorRevolt_state == 2 ) { if ( walkers[walkerId].actionState != 149 ) { walkers[walkerId].actionState = -107; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].direction = 0; } } switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 16 ) walkers[walkerId].byte_7FA341 = 0; break; case 0x95: sub_4B3B80(walkerId); break; case 0x9F: city_inform[ciid].dword_654468 = 10; walkers[walkerId].byte_7FA3A2 = 2; walkerWalkTicks(walkerId, 1); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].actionState = -98; } else { walkers[walkerId].actionState = -98; } break; case 0x9E: walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > (walkerId & 3) + 10 ) { walkers[walkerId].word_7FA366 = 0; walkers[walkerId].actionState = -97; //v1 = sub_4C1100(); if ( v1 ) { walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; walkers[walkerId].baseWorkingBuildingId = v1; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].state = 2; } } break; } if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction == 11 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState != 150 && walkers[walkerId].direction != 11 ) { if ( walkers[walkerId].actionState == 149 ) { result = word_6E6C8E + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; walkers[walkerId].word_7FA344 = result; } else { result = word_6E6C8E + dword_65DF24; walkers[walkerId].word_7FA344 = result + 8 * walkers[walkerId].byte_7FA341; } } else { result = word_6E6C8E + dword_65DF24 + 8 * (walkers[walkerId].byte_7FA341 >> 1) + 104; walkers[walkerId].word_7FA344 = result; } return result; } void empty_4ABEF0() { ; } void empty_4ABF10() { ; } void sub_4ABF30() { __int64 v0; // qax@9 __int64 v1; // qax@13 int v2; // [sp+4Ch] [bp-4h]@1 v2 = walkers[walkerId].formationId; ++city_inform[ciid].enemyDestroyedBuildings; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; walkers[walkerId].byte_7FA389 = 1; sub_4AC350(); if ( walkers[walkerId].actionState == 150 ) { dword_65DF24 = walkers[walkerId].simpleDirection - setting_map_orientation; } else { if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; } dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].direction == 11 ) { v0 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = word_6E6D88 + dword_65DF24 + 8 * (((_DWORD)v0 - _HIDWORD(v0)) >> 1); } switch ( walkers[walkerId].actionState ) { case 0x96: if ( walkers[walkerId].byte_7FA39A >= 12 ) { v1 = walkers[walkerId].byte_7FA39A - 12; walkers[walkerId].word_7FA344 = word_6E6D88 + dword_65DF24 + 8 * (((_DWORD)v1 - _HIDWORD(v1)) >> 1); } else { walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D88; } break; case 0x54: if ( formations[v2].formation_52 && !formations[v2].layout && formations[v2].formation_56 ) walkers[walkerId].word_7FA344 = word_6E6D48 + dword_65DF24 + 144; else walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D48; break; case 0x95: walkers[walkerId].word_7FA344 = word_6E6D88 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 152; break; default: walkers[walkerId].word_7FA344 = word_6E6D88 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341 + 48; break; } } void sub_4AC350() { int v0; // ST70_4@93 bool v1; // [sp+4Ch] [bp-10h]@24 WalkerType wlkrType; // [sp+50h] [bp-Ch]@31 int walkerFormationId; // [sp+54h] [bp-8h]@1 int v4; // [sp+58h] [bp-4h]@80 walkerFormationId = walkers[walkerId].formationId; ++city_inform[ciid].imperialArmyComing; walkers[walkerId].byte_7FA3A2 = 2; walkers[walkerId].at_dest_x = *((_BYTE *)&dword_5F3CB0[32 * formations[walkerFormationId].layout] + 8 * byte_7FA392[128 * walkerId]); walkers[walkerId].at_dest_y = *((_BYTE *)&dword_5F3CB4[32 * formations[walkerFormationId].layout] + 8 * byte_7FA392[128 * walkerId]); if ( walkers[walkerId].actionState == 150 ) { sub_4B3390(walkerId); return; } if ( walkers[walkerId].actionState == 149 ) { sub_4B3B80(walkerId); return; } if ( walkers[walkerId].actionState == 151 ) { sub_4B8B80(walkerId); walkers[walkerId].byte_7FA341 = 0; removeDestinationPathForWalker(walkerId); --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { if ( walkers[walkerId].reachedLastStep ) { if ( !byte_7FA392[128 * walkerId] ) { if ( formations[walkerFormationId].layout == 8 ) { fun_playSound("wavs\\drums.wav", 1, 0); } else { if ( formations[walkerFormationId].layout == 12 ) fun_playSound("wavs\\horn2.wav", 1, 0); else fun_playSound("wavs\\horn1.wav", 1, 0); } } } walkers[walkerId].reachedLastStep = 0; if ( formations[walkerFormationId].formation_48 ) { walkers[walkerId].actionState = -102; } else { walkers[walkerId].destination_x = walkers[walkerId].at_dest_x + formations[walkerFormationId].f34; walkers[walkerId].destination_y = walkers[walkerId].at_dest_y + formations[walkerFormationId].f35; if ( fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y) < 8 ) walkers[walkerId].actionState = -103; } } if ( walkers[walkerId].type == Walker_Enemy43 || walkers[walkerId].type == Walker_Enemy46 || walkers[walkerId].type == Walker_Enemy51 || walkers[walkerId].type == Walker_Enemy52 ) { ++walkers[walkerId].byte_7FA39B; if ( walkers[walkerId].byte_7FA39B > byte_5F60FB[10 * walkers[walkerId].type] ) { walkers[walkerId].byte_7FA39B = 0; v1 = city_inform[ciid].dword_654598 < 4; if ( sub_4ADE90(walkerId, 10, v1) ) { walkers[walkerId].byte_7FA39A = 1; walkers[walkerId].direction = fun_pathing_getDirection8( walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY); } else { walkers[walkerId].byte_7FA39A = 0; } } if ( walkers[walkerId].byte_7FA39A ) { switch ( formations[walkerFormationId].enemyType ) { case 5: case 10: case 9: case 4: default: wlkrType = Walker_Arrow; break; } if ( walkers[walkerId].byte_7FA39A == 1 ) { spawnWalkerWithParent(walkerId, walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY, wlkrType); formations[walkerFormationId].formation_54 = 6; } if ( wlkrType == Walker_Arrow ) { -- city_inform[ciid].byte_654593; if ( city_inform[ciid].byte_654593 <= 0 ) { city_inform[ciid].byte_654593 = 10; sound_playChannel(10); } } ++walkers[walkerId].byte_7FA39A; if ( walkers[walkerId].byte_7FA39A > 100 ) walkers[walkerId].byte_7FA39A = 0; } } } else { if ( walkers[walkerId].actionState == 148 ) { walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; walkerWalkTicks(walkerId, walkers[walkerId].byte_7FA389); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].state = 2; } else { walkers[walkerId].state = 2; } } else { if ( walkers[walkerId].actionState == 152 ) { sub_4B8B80(walkerId); return; } if ( walkers[walkerId].actionState == 153 ) { --walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 <= 0 ) { walkers[walkerId].word_7FA366 = 50; walkers[walkerId].destination_x = walkers[walkerId].at_dest_x + formations[walkerFormationId].f34; walkers[walkerId].destination_y = walkers[walkerId].at_dest_y + formations[walkerFormationId].f35; if ( fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y) == 8 ) { walkers[walkerId].actionState = -105; return; } walkers[walkerId].baseWorkingBuildingId = formations[walkerFormationId].f36; removeDestinationPathForWalker(walkerId); } walkerWalkTicks(walkerId, walkers[walkerId].byte_7FA389); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) walkers[walkerId].actionState = -105; } else { walkers[walkerId].actionState = -105; } } else { if ( walkers[walkerId].actionState == 154 ) { if ( !formations[walkerFormationId].formation_48 ) walkers[walkerId].actionState = -105; if ( walkers[walkerId].type != 46 ) { if ( walkers[walkerId].type != 47 ) { if ( walkers[walkerId].type != 52 && walkers[walkerId].type != 48 ) { -- city_inform[ciid].byte_65459F; if ( city_inform[ciid].byte_65459F <= 0 ) { city_inform[ciid].byte_65459F = -56; sound_playChannel(27); } } else { -- city_inform[ciid].byte_6545A0; if ( city_inform[ciid].byte_6545A0 <= 0 ) { city_inform[ciid].byte_6545A0 = -56; sound_playChannel(23); } } } } v4 = walkers[walkerId].word_7FA3B0; if ( walkers[v4].state != 1 ) { walkers[walkerId].word_7FA3B0 = 0; v4 = 0; } if ( walkers[v4].actionState == 149 ) { walkers[walkerId].word_7FA3B0 = 0; v4 = 0; } if ( v4 <= 0 ) { v4 = sub_4AD320(walkers[walkerId].x, walkers[walkerId].y); if ( v4 ) { walkers[walkerId].destination_x = walkers[v4].x; walkers[walkerId].destination_y = walkers[v4].y; walkers[walkerId].word_7FA3B0 = v4; walkers[v4].wlk_ID_mm = walkerId; walkers[walkerId].word_7FA3B6 = walkers[v4].word_7FA3B4; removeDestinationPathForWalker(walkerId); } } if ( v4 > 0 ) { walkerWalkTicks(walkerId, walkers[walkerId].byte_7FA389); if ( walkers[walkerId].direction != 9 && walkers[walkerId].direction != 10 ) { if ( walkers[walkerId].direction == 8 ) { v0 = walkers[walkerId].word_7FA3B0; walkers[walkerId].destination_x = walkers[v0].x; walkers[walkerId].destination_y = walkers[v0].y; removeDestinationPathForWalker(walkerId); } } else { walkers[walkerId].actionState = -105; walkers[walkerId].word_7FA3B0 = 0; } } else { walkers[walkerId].actionState = -105; walkers[walkerId].word_7FA366 = 50; } } } } } } signed int sub_4AD320(int a1, int a2) { signed int result; // eax@18 signed int v3; // [sp+4Ch] [bp-Ch]@1 int v4; // [sp+50h] [bp-8h]@12 signed int i; // [sp+54h] [bp-4h]@1 signed int j; // [sp+54h] [bp-4h]@19 v3 = 0; dword_7FA2A4 = 10000; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].actionState != 149 ) { if ( !walkers[i].wlk_ID_mm ) { if ( walkers[i].type>= 11 ) { if ( walkers[i].type<= 13 ) { v4 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); if ( v4 < dword_7FA2A4 ) { dword_7FA2A4 = v4; v3 = i; } } } } } } } if ( v3 ) { result = v3; } else { for ( j = 1; j < 1000; ++j ) { if ( walkers[j].state == 1 && walkers[j].actionState != 149 && walkers[j].type >= 11 && walkers[j].type <= 13 ) return j; } result = 0; } return result; } signed int sub_4AD500(int a1, int a2, int a3) { signed int result; // eax@40 signed int v4; // [sp+4Ch] [bp-Ch]@1 int v5; // [sp+50h] [bp-8h]@26 signed int i; // [sp+54h] [bp-4h]@1 v4 = 0; dword_7FA2A4 = 10000; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 && walkers[i].actionState != 149 && walkers[i].type > 0 && walkers[i].type!= Walker_Explosion && walkers[i].type!= Walker_FortStandard && walkers[i].type!= Walker_TradeShip && walkers[i].type!= Walker_FishingBoat && walkers[i].type!= Walker_MapFlag && walkers[i].type!= Walker_Flotsam ) { if ( walkers[i].type>= Walker_FortJavelin && walkers[i].type<= Walker_FortLegionary ) { if (walkers[i].actionState == 80 ) continue; v5 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); goto LABEL_34; } if ( (walkers[i].type< Walker_IndigenousNative || walkers[i].type> Walker_Creature) && (walkers[i].type< Walker_Shipwreck || walkers[i].type> Walker_Zebra) ) { v5 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); LABEL_34: if ( walkers[i].wlk_ID_mm ) v5 *= 2; if ( v5 < dword_7FA2A4 ) { dword_7FA2A4 = v5; v4 = i; } continue; } } } if ( dword_7FA2A4 <= a3 ) { if ( v4 ) result = v4; else result = 0; } else { result = 0; } return result; } signed int sub_4AD800(int a1, int a2, int a3) { signed int result; // eax@25 signed int v4; // [sp+4Ch] [bp-Ch]@1 int v5; // [sp+50h] [bp-8h]@10 signed int i; // [sp+54h] [bp-4h]@1 signed int j; // [sp+54h] [bp-4h]@26 v4 = 0; dword_7FA2A4 = 10000; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 && walkers[i].actionState!= 149 ) { if ( walkers[i].type>= 43 && walkers[i].type<= 57 ) { v5 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); goto LABEL_17; } if ( walkers[i].type== 24 ) { v5 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); goto LABEL_17; } if ( walkers[i].type== 41 && walkers[i].actionState == 159 ) { v5 = fun_getDistanceMaximum(a1, a2, walkers[i].x, walkers[i].y); LABEL_17: if ( v5 <= a3 ) { if ( walkers[i].wlk_ID_mm ) v5 *= 2; if ( v5 < dword_7FA2A4 ) { dword_7FA2A4 = v5; v4 = i; } } continue; } } } if ( v4 ) { result = v4; } else { for ( j = 1; j < 1000; ++j ) { if ( walkers[j].state == 1 && walkers[j].actionState != 149 ) { if ( walkers[j].type >= 43 && walkers[j].type <= 57 ) return j; if ( walkers[j].type== 24 ) return j; if ( walkers[j].type== 41 && walkers[j].actionState == 159 ) return j; } } result = 0; } return result; } signed int sub_4ADB30(int a1, int a2) { signed int result; // eax@27 int v3; // [sp+4Ch] [bp-14h]@1 int v4; // [sp+50h] [bp-10h]@1 signed int v5; // [sp+54h] [bp-Ch]@1 int v6; // [sp+58h] [bp-8h]@10 signed int i; // [sp+5Ch] [bp-4h]@1 v4 = walkers[a1].x; v3 = walkers[a1].y; v5 = 0; dword_7FA2A4 = a2; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 && walkers[i].actionState != 149 ) { if ( walkers[i].type< 43 || walkers[i].type> 57 ) { if ( walkers[i].type!= 41 || walkers[i].actionState != 159 ) { if ( walkers[i].type== 69 ) { v6 = fun_getDistanceMaximum(v4, v3, walkers[i].x, walkers[i].y); } else { if ( walkers[i].type== 68 ) { v6 = fun_getDistanceMaximum(v4, v3, walkers[i].x, walkers[i].y); } else { if ( walkers[i].type!= 70 ) continue; v6 = fun_getDistanceMaximum(v4, v3, walkers[i].x, walkers[i].y); } } } else { v6 = fun_getDistanceMaximum(v4, v3, walkers[i].x, walkers[i].y); } } else { v6 = fun_getDistanceMaximum(v4, v3, walkers[i].x, walkers[i].y); } if ( v6 < dword_7FA2A4 ) { if ( sub_4B70B0(v4, v3, walkers[i].x, walkers[i].y) ) { dword_7FA2A4 = v6; v5 = i; } } } } if ( v5 ) { walkerGridX = walkers[v5].x; walkerGridY = walkers[v5].y; result = v5; } else { result = 0; } return result; } signed int sub_4ADE90(int a1, int a2, int a3) { signed int result; // eax@58 int v4; // [sp+4Ch] [bp-14h]@1 int v5; // [sp+50h] [bp-10h]@1 signed int walkerId; // [sp+54h] [bp-Ch]@1 int v7; // [sp+58h] [bp-8h]@46 signed int i; // [sp+5Ch] [bp-4h]@1 v5 = walkers[a1].x; v4 = walkers[a1].y; walkerId = 0; dword_7FA2A4 = a2; for ( i = 1; i < MAX_WALKERS; ++i ) { if ( walkers[i].state == 1 && walkers[i].actionState != 149 && walkers[i].type && walkers[i].type!= Walker_Explosion && walkers[i].type!= Walker_FortStandard && walkers[i].type!= Walker_MapFlag && walkers[i].type!= Walker_Flotsam && walkers[i].type!= Walker_IndigenousNative && walkers[i].type!= Walker_NativeTrader && walkers[i].type!= Walker_Arrow && walkers[i].type!= Walker_Javelin && walkers[i].type!= Walker_Bolt && walkers[i].type!= Walker_Ballista && walkers[i].type!= Walker_Creature && walkers[i].type!= Walker_FishGulls && walkers[i].type!= Walker_Shipwreck && walkers[i].type!= Walker_Sheep && walkers[i].type!= Walker_Wolf && walkers[i].type!= Walker_Zebra && walkers[i].type!= Walker_Spear ) { if ( walkers[i].type>= Walker_FortJavelin && walkers[i].type<= Walker_FortLegionary ) { v7 = fun_getDistanceMaximum(v5, v4, walkers[i].x, walkers[i].y); goto LABEL_52; } if ( walkers[i].byte_7FA34D && a3 ) { v7 = fun_getDistanceMaximum(v5, v4, walkers[i].x, walkers[i].y) + 5; LABEL_52: if ( v7 < dword_7FA2A4 ) { if ( sub_4B70B0(v5, v4, walkers[i].x, walkers[i].y) ) { dword_7FA2A4 = v7; walkerId = i; } } continue; } } } if ( walkerId ) { walkerGridX = walkers[walkerId].x; walkerGridY = walkers[walkerId].y; result = walkerId; } else { result = 0; } return result; } void walker_nativeTrader() { int v0; // ST60_4@26 int v1; // [sp+50h] [bp-8h]@9 int v2; // [sp+50h] [bp-8h]@27 walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A2 = 0; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0xA2: walkers[walkerId].reachedLastStep = 1; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 10 ) { walkers[walkerId].word_7FA366 = 0; v1 = sub_446550(walkerId, walkers[walkerId].x, walkers[walkerId].y, 0, -1); if ( v1 ) { walkers[walkerId].baseWorkingBuildingId = v1; walkers[walkerId].actionState = -96; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].state = 2; } } walkers[walkerId].byte_7FA341 = 0; break; case 0xA0: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].actionState = -93; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; walkers[walkerId].reachedLastStep = 1; break; } if ( buildings[walkers[walkerId].baseWorkingBuildingId].inUse != 1 ) walkers[walkerId].state = 2; break; case 0xA3: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 10 ) { walkers[walkerId].word_7FA366 = 0; if ( sub_45AA70(walkerId, walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, 0) ) { v0 = sub_45AB50(walkers[walkerId].ruler, walkers[walkerId].baseWorkingBuildingId, 0); sub_445B60(walkerId, v0); walkers[walkerId].byte_7FA39F += 3; } else { v2 = sub_446550(walkerId, walkers[walkerId].x, walkers[walkerId].y, 0, -1); if ( v2 ) { walkers[walkerId].baseWorkingBuildingId = v2; walkers[walkerId].actionState = -96; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkerGridX; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].actionState = -95; walkers[walkerId].word_7FA366 = 0; walkers[walkerId].destination_x = walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = walkers[walkerId].byte_7FA361; } } } walkers[walkerId].byte_7FA341 = 0; break; case 0xA1: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 8: walkers[walkerId].state = 2; break; case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].state = 2; break; } break; } if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6C86 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; walkers[walkerId].word_7FA346 = 0; } else { walkers[walkerId].word_7FA344 = word_6E6C86 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } walkers[walkerId].word_7FA346 = word_6E6CB6 + 8 * walkers[walkerId].cartPusherGoodType + 8; if ( walkers[walkerId].word_7FA346 ) { walkers[walkerId].word_7FA346 += dword_65DF24; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_65DF24]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_65DF24]; } } void fun_walker_arrow() { __int16 v0; // ST54_2@13 int v1; // [sp+50h] [bp-24h]@4 int v2; // [sp+54h] [bp-20h]@10 int v3; // [sp+58h] [bp-1Ch]@4 int v4; // [sp+5Ch] [bp-18h]@4 int v5; // [sp+6Ch] [bp-8h]@3 int v6; // [sp+70h] [bp-4h]@3 walkers[walkerId].byte_7FA34C = 1; ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile > 120 ) walkers[walkerId].state = 2; v6 = sub_4B66E0(walkerId, 4); v5 = sub_4B9080(walkerId); if ( v5 ) { v1 = walkers[v5].formationId; v3 = byte_5F60F5[10 * walkers[v5].type]; v4 = byte_5F60F9[10 * walkers[walkerId].type] - byte_5F60F8[10 * walkers[v5].type]; if ( v4 < 0 ) v4 = 0; if ( walkers[v5].type == 13 ) { if ( formations[v1].formation_52 ) { if ( !formations[v1].layout ) v4 = 1; } } v2 = v4 + byte_7FA359[128 * v5]; if ( v2 <= v3 ) { byte_7FA359[128 * v5] = v2; } else { byte_7FA359[128 * v5] = v3 + 1; walkers[v5].actionState = -107; walkers[v5].word_7FA366 = 0; sub_4B8080(walkers[v5].type); fun_formationDecreaseMoraleAfterComradeDeath(v1); } walkers[walkerId].state = 2; v0 = walkers[walkers[walkerId].buildingId].formationId; formations[v1].formation_56 = 6; formations[v1].formation_58 = v0; sound_playChannel(11); } else { if ( v6 ) walkers[walkerId].state = 2; } dword_65DF24 = walkers[walkerId].direction - 2 * setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 0x10 : 0; walkers[walkerId].word_7FA344 = word_6E6D3C + dword_65DF24 + 16; } int fun_walker_javelin() { __int16 v0; // ST54_2@13 int result; // eax@16 int v2; // [sp+50h] [bp-24h]@4 int v3; // [sp+54h] [bp-20h]@10 int v4; // [sp+58h] [bp-1Ch]@4 int v5; // [sp+5Ch] [bp-18h]@4 int v6; // [sp+6Ch] [bp-8h]@3 int v7; // [sp+70h] [bp-4h]@3 walkers[walkerId].byte_7FA34C = 1; ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile > 120 ) walkers[walkerId].state = 2; v7 = sub_4B66E0(walkerId, 4); v6 = sub_4B8F30(walkerId); if ( v6 ) { v2 = walkers[v6].formationId; v4 = byte_5F60F5[10 * walkers[v6].type]; v5 = byte_5F60F9[10 * walkers[walkerId].type] - byte_5F60F8[10 * walkers[v6].type]; if ( v5 < 0 ) v5 = 0; if ( walkers[v6].type == 57 ) { if ( formations[v2].formation_52 ) { if ( !formations[v2].layout ) v5 = 1; } } v3 = v5 + byte_7FA359[128 * v6]; if ( v3 <= v4 ) { byte_7FA359[128 * v6] = v3; } else { byte_7FA359[128 * v6] = v4 + 1; walkers[v6].actionState = -107; walkers[v6].word_7FA366 = 0; sub_4B8080(walkers[v6].type); fun_formationDecreaseMoraleAfterComradeDeath(v2); } v0 = walkers[walkers[walkerId].buildingId].formationId; formations[v2].formation_56 = 6; formations[v2].formation_58 = v0; sound_playChannel(24); walkers[walkerId].state = 2; } else { if ( v7 ) walkers[walkerId].state = 2; } dword_65DF24 = walkers[walkerId].direction - 2 * setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 0x10 : 0; result = walkerId << 7; walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D3C; return result; } void fun_walker_bolt() { int v0; // [sp+4Ch] [bp-20h]@6 int v1; // [sp+50h] [bp-1Ch]@4 int v2; // [sp+54h] [bp-18h]@4 int v3; // [sp+60h] [bp-Ch]@4 int v4; // [sp+64h] [bp-8h]@3 int v5; // [sp+68h] [bp-4h]@3 walkers[walkerId].byte_7FA34C = 1; ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile > 120 ) walkers[walkerId].state = 2; v5 = sub_4B66E0(walkerId, 4); v4 = sub_4B8F30(walkerId); if ( v4 ) { v3 = walkers[v4].formationId; v1 = byte_5F60F5[10 * walkers[v4].type]; v2 = byte_5F60F9[10 * walkers[walkerId].type] - byte_5F60F8[10 * walkers[v4].type]; if ( v2 < 0 ) v2 = 0; v0 = v2 + byte_7FA359[128 * v4]; if ( v0 <= v1 ) { byte_7FA359[128 * v4] = v0; } else { byte_7FA359[128 * v4] = v1 + 1; walkers[v4].actionState = -107; walkers[v4].word_7FA366 = 0; sub_4B8080(walkers[v4].type); fun_formationDecreaseMoraleAfterComradeDeath(v3); } sound_playChannel(15); walkers[walkerId].state = 2; } else { if ( v5 ) { walkers[walkerId].state = 2; sound_playChannel(14); } } dword_65DF24 = walkers[walkerId].direction - 2 * setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 0x10 : 0; walkers[walkerId].word_7FA344 = word_6E6D3C + dword_65DF24 + 32; } void fun_walker_ballista() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 4; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].reachedLastStep = 1; walkers[walkerId].byte_7FA3A5 = 10; walkers[walkerId].byte_7FA3A6 = 45; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].towerBallistaId != walkerId ) walkers[walkerId].state = 2; if ( buildings[v0].num_workers <= 0 ) walkers[walkerId].state = 2; if ( buildings[v0].walkerId <= 0 ) walkers[walkerId].state = 2; removeWalkerFromTileList(walkerId); if ( !setting_map_orientation ) { walkers[walkerId].x = buildings[v0].x; walkers[walkerId].y = buildings[v0].y; } if ( setting_map_orientation == 2 ) { walkers[walkerId].x = buildings[v0].x + 1; walkers[walkerId].y = buildings[v0].y; } if ( setting_map_orientation == 4 ) { walkers[walkerId].x = buildings[v0].x + 1; walkers[walkerId].y = buildings[v0].y + 1; } if ( setting_map_orientation == 6 ) { walkers[walkerId].x = buildings[v0].x; walkers[walkerId].y = buildings[v0].y + 1; } walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; sub_4B8A40(walkerId); switch ( walkers[walkerId].actionState ) { case 0x95: walkers[walkerId].state = 2; break; case 0xB4: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 20 ) { walkers[walkerId].word_7FA366 = 0; if ( sub_4ADB30(walkerId, 15) ) { walkers[walkerId].actionState = -75; walkers[walkerId].byte_7FA39B = byte_5F60FB[10 * walkers[walkerId].type]; } } break; case 0xB5: ++walkers[walkerId].byte_7FA39B; if ( walkers[walkerId].byte_7FA39B > byte_5F60FB[10 * walkers[walkerId].type] ) { if ( sub_4ADB30(walkerId, 15) ) { walkers[walkerId].direction = fun_pathing_getDirection8( walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY); walkers[walkerId].byte_7FA39B = 0; spawnWalkerWithParent(walkerId, walkers[walkerId].x, walkers[walkerId].y, walkerGridX, walkerGridY, Walker_Bolt); sound_playChannel(13); } else { walkers[walkerId].actionState = -76; } } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 181 ) walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D40 + 8 * byte_5F6024[walkers[walkerId].byte_7FA39B >> 2]; else walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D40; } void fun_walker_creature() { ; } void fun_walker_missionary() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 1; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].word_7FA372 = 192; v0 = walkers[walkerId].buildingId; if ( buildings[v0].inUse != 1 || buildings[v0].walkerId != walkerId ) walkers[walkerId].state = 2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; sub_49FFE0(1); dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D7C + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D7C + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_seagulls() { walkers[walkerId].byte_7FA3A2 = 0; walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA34C = 1; if ( !(walkers[walkerId].byte_7FA341 & 3) ) { if ( sub_4B66E0(walkerId, 1) ) { ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile > 8 ) walkers[walkerId].progressOnTile = 0; walkers[walkerId].destination_x = word_5FA4F8[2 * walkers[walkerId].progressOnTile] + walkers[walkerId].byte_7FA360; walkers[walkerId].destination_y = word_5FA4FA[2 * walkers[walkerId].progressOnTile] + walkers[walkerId].byte_7FA361; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); } } if ( walkerId & 1 ) { ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 54 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA344 = walkers[walkerId].byte_7FA341 / 3 + word_6E6D4C; } else { ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 72 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA344 = word_6E6D4C + walkers[walkerId].byte_7FA341 / 3 + 18; } } void fun_walker_deliveryBoy() { int v0; // [sp+4Ch] [bp-8h]@1 int v1; // [sp+50h] [bp-4h]@1 v1 = walkers[walkerId].tradeCaravanNextId; v0 = walkers[walkerId].buildingId; walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A2 = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].word_7FA346 = 0; if ( v1 > 0 ) { if ( walkers[v1].actionState == 149 ) { walkers[walkerId].state = 2; } else { if ( walkers[v1].state == 1 ) { if ( walkers[v1].type == 39 || walkers[v1].type == 66 ) sub_4B4880(walkerId, walkers[walkerId].tradeCaravanNextId, 1); else walkers[walkerId].state = 2; } else { buildings[v0].granary_capacity[walkers[walkerId].itemCollecting] += 100; walkers[walkerId].state = 2; } } } else { walkers[walkerId].state = 2; } if ( walkers[v1].reachedLastStep ) walkers[walkerId].reachedLastStep = 1; if ( walkers[walkerId].direction < 8 ) dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; else dword_65DF24 = walkers[walkerId].lastDirection - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) walkers[walkerId].word_7FA344 = word_6E6D52 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; else walkers[walkerId].word_7FA344 = word_6E6D52 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } void fun_walker_shipwreck() { walkers[walkerId].reachedLastStep = 0; walkers[walkerId].byte_7FA3A5 = 0; walkers[walkerId].isBoat = 1; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 128 ) walkers[walkerId].byte_7FA341 = 0; if ( walkers[walkerId].word_7FA366 < 1000 ) { removeWalkerFromTileList(walkerId); if ( sub_48A900(walkerId) ) { walkers[walkerId].x = walkerGridX; walkers[walkerId].y = walkerGridY; walkers[walkerId].gridOffset = 162 * walkers[walkerId].y + walkers[walkerId].x + (_WORD)setting_map_startGridOffset; walkers[walkerId].tilePosition_y = 15 * walkers[walkerId].x; walkers[walkerId].tilePosition_x = 15 * walkers[walkerId].y; walkers[walkerId].tilePosition_y += 7; walkers[walkerId].tilePosition_x += 7; } sub_4B8A40(walkerId); walkers[walkerId].word_7FA366 = 1000; } ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 2000 ) walkers[walkerId].state = 2; walkers[walkerId].word_7FA344 = (walkers[walkerId].byte_7FA341 >> 4) + word_6E6D74; } void fun_walker_sheep() { __int16 v0; // dx@23 int v1; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 5; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].reachedLastStep = 0; v1 = walkers[walkerId].formationId; ++city_inform[ciid].word_6543A2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 6 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0xC4: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 400 ) { walkers[walkerId].word_7FA366 = walkerId & 0x1F; walkers[walkerId].actionState = -59; walkers[walkerId].destination_x = LOBYTE(dword_5F4130[2 * byte_7FA392[128 * walkerId]]) + formations[v1].f34; walkers[walkerId].destination_y = dword_5F4134[8 * byte_7FA392[128 * walkerId]] + formations[v1].f35; walkers[walkerId].word_7FA374 = 0; } break; case 0xC5: walkerWalkTicks(walkerId, 1); switch ( walkers[walkerId].direction ) { case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; case 8: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6D82 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 104; } else { if ( walkers[walkerId].actionState == 196 ) { if ( walkerId & 3 ) { v0 = walkers[walkerId].word_7FA366; walkers[walkerId].word_7FA344 = word_6E6D82 + dword_65DF24 + 8 * LOWORD(dword_5FA518[v0 & 0x3F]) + 48; } else { walkers[walkerId].word_7FA344 = word_6E6D82 + dword_65DF24 + 96; } } else { walkers[walkerId].word_7FA344 = word_6E6D82 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } } } void fun_walker_wolf() { int v0; // [sp+4Ch] [bp-8h]@17 int v1; // [sp+50h] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 5; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].reachedLastStep = 0; v1 = walkers[walkerId].formationId; ++city_inform[ciid].word_6543A2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0xC4: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 400 ) { walkers[walkerId].word_7FA366 = walkerId & 0x1F; walkers[walkerId].actionState = -59; walkers[walkerId].destination_x = LOBYTE(dword_5F4130[2 * byte_7FA392[128 * walkerId]]) + formations[v1].f34; walkers[walkerId].destination_y = dword_5F4134[8 * byte_7FA392[128 * walkerId]] + formations[v1].f35; walkers[walkerId].word_7FA374 = 0; } break; case 0xC7: walkerWalkTicks(walkerId, 2); switch ( walkers[walkerId].direction ) { case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; case 8: v0 = sub_4AD500(walkers[walkerId].x, walkers[walkerId].y, 6); if ( v0 ) { walkers[walkerId].destination_x = walkers[v0].x; walkers[walkerId].destination_y = walkers[v0].y; walkers[walkerId].word_7FA3B0 = v0; walkers[v0].wlk_ID_mm = walkerId; walkers[walkerId].word_7FA3B6 = walkers[v0].word_7FA3B4; removeDestinationPathForWalker(walkerId); } else { walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; } break; } break; case 0xC5: walkerWalkTicks(walkerId, 2); switch ( walkers[walkerId].direction ) { case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; case 8: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; switch ( walkers[walkerId].actionState ) { case 0x95: walkers[walkerId].word_7FA344 = word_6E6D84 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; break; case 0x96: walkers[walkerId].word_7FA344 = word_6E6D84 + dword_65DF24 + 8 * (walkers[walkerId].byte_7FA39A >> 2) + 104; break; case 0xC4: walkers[walkerId].word_7FA344 = word_6E6D84 + dword_65DF24 + 152; break; default: walkers[walkerId].word_7FA344 = word_6E6D84 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; break; } } void fun_walker_zebra() { int v0; // [sp+4Ch] [bp-4h]@1 walkers[walkerId].byte_7FA3A2 = 5; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].reachedLastStep = 0; v0 = walkers[walkerId].formationId; ++city_inform[ciid].word_6543A2; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 12 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0x96: sub_4B3390(walkerId); break; case 0x95: sub_4B3B80(walkerId); break; case 0xC4: ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 200 ) { walkers[walkerId].word_7FA366 = walkerId & 0x1F; walkers[walkerId].actionState = -59; walkers[walkerId].destination_x = LOBYTE(dword_5F4130[2 * byte_7FA392[128 * walkerId]]) + formations[v0].f34; walkers[walkerId].destination_y = dword_5F4134[8 * byte_7FA392[128 * walkerId]] + formations[v0].f35; walkers[walkerId].word_7FA374 = 0; } break; case 0xC5: walkerWalkTicks(walkerId, 2); switch ( walkers[walkerId].direction ) { case 9: removeDestinationPathForWalker(walkerId); break; case 10: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; case 8: walkers[walkerId].direction = walkers[walkerId].lastDirection; walkers[walkerId].actionState = -60; walkers[walkerId].word_7FA366 = walkerId & 0x1F; break; } break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].actionState == 149 ) { walkers[walkerId].word_7FA344 = word_6E6D86 + byte_5F5EA4[walkers[walkerId].word_7FA366 / 2] + 96; } else { if ( walkers[walkerId].actionState == 196 ) walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D86; else walkers[walkerId].word_7FA344 = word_6E6D86 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; } } void fun_walker_spear() { __int16 v0; // ST54_2@13 int v1; // [sp+50h] [bp-24h]@4 int v2; // [sp+54h] [bp-20h]@10 int v3; // [sp+58h] [bp-1Ch]@4 int v4; // [sp+5Ch] [bp-18h]@4 int v5; // [sp+6Ch] [bp-8h]@3 int v6; // [sp+70h] [bp-4h]@3 walkers[walkerId].byte_7FA34C = 1; ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile > 120 ) walkers[walkerId].state = 2; v6 = sub_4B66E0(walkerId, 4); v5 = sub_4B9080(walkerId); if ( v5 ) { v1 = walkers[v5].formationId; v3 = byte_5F60F5[10 * walkers[v5].type]; v4 = byte_5F60F9[10 * walkers[walkerId].type] - byte_5F60F8[10 * walkers[v5].type]; if ( v4 < 0 ) v4 = 0; if ( walkers[v5].type == Walker_FortLegionary ) { if ( formations[v1].formation_52 ) { if ( !formations[v1].layout ) v4 = 1; } } v2 = v4 + byte_7FA359[128 * v5]; if ( v2 <= v3 ) { byte_7FA359[128 * v5] = v2; } else { byte_7FA359[128 * v5] = v3 + 1; walkers[v5].actionState = -107; walkers[v5].word_7FA366 = 0; sub_4B8080(walkers[v5].type); fun_formationDecreaseMoraleAfterComradeDeath(v1); } v0 = walkers[walkers[walkerId].buildingId].formationId; formations[v1].formation_56 = 6; formations[v1].formation_58 = v0; sound_playChannel(24); walkers[walkerId].state = 2; } else { if ( v6 ) walkers[walkerId].state = 2; } dword_65DF24 = walkers[walkerId].direction - 2 * setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 0x10 : 0; walkers[walkerId].word_7FA344 = dword_65DF24 + word_6E6D3C; } void fun_walker_hippodromeHorse() { city_inform[ciid].dword_654624 = 1; walkers[walkerId].byte_7FA34C = 1; walkers[walkerId].reachedLastStep = 0; ++walkers[walkerId].byte_7FA341; if ( walkers[walkerId].byte_7FA341 >= 8 ) walkers[walkerId].byte_7FA341 = 0; switch ( walkers[walkerId].actionState ) { case 0xC8: walkers[walkerId].byte_7FA341 = 0; walkers[walkerId].byte_7FA39B = 0; sub_4B2740(walkerId, 0); ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 60 ) { if ( !walkers[walkerId].cartPusherGoodType ) { walkers[walkerId].actionState = -55; walkers[walkerId].word_7FA366 = 0; } } ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 20 ) { if ( walkers[walkerId].cartPusherGoodType == 1 ) { walkers[walkerId].actionState = -55; walkers[walkerId].word_7FA366 = 0; } } break; case 0xC9: walkers[walkerId].direction = fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); if ( walkers[walkerId].direction == 8 ) { ++walkers[walkerId].byte_7FA39B; if ( walkers[walkerId].byte_7FA39B < 22 ) { if ( walkers[walkerId].byte_7FA39B == 11 ) { if ( (walkerId + random_7f_1) & 1 ) walkers[walkerId].byte_7FA389 = 3; else walkers[walkerId].byte_7FA389 = 4; } } else { walkers[walkerId].byte_7FA39B = 0; ++walkers[walkerId].tradeCaravanNextId; if ( walkers[walkerId].tradeCaravanNextId >= 6 ) { walkers[walkerId].actionState = -54; walkers[walkerId].word_7FA366 = 0; } if ( (walkerId + random_7f_1) & 1 ) walkers[walkerId].byte_7FA389 = 3; else walkers[walkerId].byte_7FA389 = 4; } sub_4B2740(walkerId, 1); walkers[walkerId].direction = fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); } if ( walkers[walkerId].actionState != 202 ) sub_4B66E0(walkerId, walkers[walkerId].byte_7FA389); break; case 0xCA: if ( !walkers[walkerId].word_7FA366 ) { sub_4B2740(walkerId, 2); walkers[walkerId].direction = fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); } if ( walkers[walkerId].direction != 8 ) sub_4B66E0(walkerId, 1); ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 30 ) walkers[walkerId].byte_7FA341 = 0; ++walkers[walkerId].word_7FA366; if ( walkers[walkerId].word_7FA366 > 150 ) walkers[walkerId].state = 2; break; } dword_65DF24 = walkers[walkerId].direction - setting_map_orientation; dword_65DF24 += dword_65DF24 < 0 ? 8 : 0; if ( walkers[walkerId].cartPusherGoodType ) { walkers[walkerId].word_7FA344 = word_6E6D64 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; dword_7F87B0 = dword_65DF24 + 4; if ( dword_7F87B0 >= 8 ) dword_7F87B0 -= 8; walkers[walkerId].word_7FA346 = dword_65DF24 + word_6E6D68; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_7F87B0]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_7F87B0]; } else { walkers[walkerId].word_7FA344 = word_6E6D62 + dword_65DF24 + 8 * walkers[walkerId].byte_7FA341; dword_7F87B0 = dword_65DF24 + 4; if ( dword_7F87B0 >= 8 ) dword_7F87B0 -= 8; walkers[walkerId].word_7FA346 = dword_65DF24 + word_6E6D66; walkers[walkerId].byte_7FA39C = byte_5FA158[2 * dword_7F87B0]; walkers[walkerId].byte_7FA39D = byte_5FA159[2 * dword_7F87B0]; } } void sub_4B2740(int a1, int a2) { int v2; // [sp+4Ch] [bp-4h]@1 v2 = walkers[a1].buildingId; if ( a2 == 1 ) { if ( setting_map_orientation && setting_map_orientation != 6 ) { walkers[a1].destination_x = LOBYTE(dword_5FA7C8[2 * walkers[a1].byte_7FA39B]) + buildings[v2].x; walkers[a1].destination_y = dword_5FA7CC[8 * walkers[a1].byte_7FA39B] + buildings[v2].y; } else { walkers[a1].destination_x = LOBYTE(dword_5FA718[2 * walkers[a1].byte_7FA39B]) + buildings[v2].x; walkers[a1].destination_y = dword_5FA71C[8 * walkers[a1].byte_7FA39B] + buildings[v2].y; } } else { if ( a2 == 2 ) { if ( setting_map_orientation && setting_map_orientation != 6 ) { if ( walkers[a1].cartPusherGoodType ) { walkers[a1].destination_x = buildings[v2].x + 12; walkers[a1].destination_y = buildings[v2].y + 3; } else { walkers[a1].destination_x = buildings[v2].x + 12; walkers[a1].destination_y = buildings[v2].y + 2; } } else { if ( walkers[a1].cartPusherGoodType ) { walkers[a1].destination_x = buildings[v2].x + 1; walkers[a1].destination_y = buildings[v2].y + 2; } else { walkers[a1].destination_x = buildings[v2].x + 1; walkers[a1].destination_y = buildings[v2].y + 1; } } } else { removeWalkerFromTileList(a1); if ( setting_map_orientation && setting_map_orientation != 6 ) { walkers[a1].destination_x = LOBYTE(dword_5FA7C8[2 * walkers[a1].byte_7FA39B]) + buildings[v2].x; walkers[a1].x = walkers[a1].destination_x; walkers[a1].destination_y = dword_5FA7CC[8 * walkers[a1].byte_7FA39B] + buildings[v2].y; walkers[a1].y = walkers[a1].destination_y; } else { walkers[a1].destination_x = LOBYTE(dword_5FA718[2 * walkers[a1].byte_7FA39B]) + buildings[v2].x; walkers[a1].x = walkers[a1].destination_x; walkers[a1].destination_y = dword_5FA71C[8 * walkers[a1].byte_7FA39B] + buildings[v2].y; walkers[a1].y = walkers[a1].destination_y; } if ( walkers[a1].cartPusherGoodType == 1 ) { ++walkers[a1].y; ++walkers[a1].destination_y; } walkers[a1].tilePosition_y = 15 * walkers[a1].x; walkers[a1].tilePosition_x = 15 * walkers[a1].y; walkers[a1].gridOffset = 162 * walkers[a1].y + walkers[a1].x + (_WORD)setting_map_startGridOffset; sub_4B8A40(a1); } } } void sub_4B2CA0() { int i; // [sp+4Ch] [bp-4h]@3 if ( city_inform[ciid].dword_654624 ) { for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].type== Walker_HippodromeMiniHorses ) { walkers[i].byte_7FA39B = 0; sub_4B2740(i, 0); } } } } } void sub_4B2D50(int a1, int a2) { signed int v2; // [sp+4Ch] [bp-10h]@1 signed int v3; // [sp+50h] [bp-Ch]@1 int v4; // [sp+54h] [bp-8h]@12 signed int v5; // [sp+58h] [bp-4h]@1 v3 = 0; v2 = 0; v5 = byte_5F60F4[10 * walkers[a1].type]; if ( v5 > 0 && v5 < 4 && walkers[a1].actionState != 150 ) { while ( 1 ) { ++v2; if ( v2 >= 1000 ) break; if ( a2 <= 0 ) break; if ( a2 == a1 ) { a2 = walkers[a2].nextIdOnSameTile; } else { v4 = byte_5F60F4[10 * walkers[a2].type]; if ( walkers[a2].state == 1 ) { if ( walkers[a2].actionState == 149 ) { v3 = 0; } else { if ( v5 != 2 || v4 != 5 ) { if ( v5 != 2 || v4 != 4 ) { if ( v5 != 2 || v4 != 3 ) { if ( v5 != 3 || v4 != 1 ) { if ( v5 != 3 || v4 != 2 ) { if ( v5 != 3 || v4 != 4 ) { if ( v5 != 2 || v4 != 6 ) { if ( v5 == 3 ) { if ( v4 == 6 ) v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { if ( walkers[a2].actionState == 159 ) v3 = 1; } } } else { v3 = 0; } if ( v3 ) { if ( walkers[a2].actionState == 150 ) { if ( walkers[a2].byte_7FA3B9 >= 2 ) v3 = 0; } } if ( v3 ) { walkers[a1].prevActionState = walkers[a1].actionState; walkers[a1].actionState = -106; walkers[a1].wlk_ID_pp = a2; walkers[a1].word_7FA3BA = a2; walkers[a1].byte_7FA3B9 = 1; walkers[a1].byte_7FA39A = 12; if ( walkers[a2].x != walkers[a2].destination_x || walkers[a2].y != walkers[a2].destination_y ) walkers[a1].simpleDirection = fun_walkerGetSimpleDestinationDirection( byte_7FA356[128 * a1], byte_7FA357[128 * a1], byte_7FA356[128 * a2], byte_7FA357[128 * a2]); else walkers[a1].simpleDirection = fun_walkerGetSimpleDestinationDirection( byte_7FA356[128 * a1], byte_7FA357[128 * a1], walkers[a2].x, walkers[a2].y); if ( walkers[a1].simpleDirection >= 8 ) walkers[a1].simpleDirection = 0; if (walkers[a2].actionState != 150 ) { walkers[a2].prevActionState = walkers[a2].actionState; walkers[a2].actionState = -106; walkers[a2].byte_7FA39A = 0; walkers[a2].simpleDirection = walkers[a1].simpleDirection + 4; if ( walkers[a2].simpleDirection >= 8 ) walkers[a2].simpleDirection -= 8; } if ( walkers[a2].byte_7FA3B9 ) { if ( walkers[a2].byte_7FA3B9 == 1 ) { walkers[a2].word_7FA3BC = a1; walkers[a2].byte_7FA3B9 = 2; } } else { walkers[a2].word_7FA3BA = a1; walkers[a2].wlk_ID_pp = a1; walkers[a2].byte_7FA3B9 = 1; } return; } a2 = walkers[a2].nextIdOnSameTile; } } } } void sub_4B32F0(int a1) { int v1; // [sp+4Ch] [bp-Ch]@1 signed int i; // [sp+54h] [bp-4h]@1 v1 = walkers[a1].gridOffset; for ( i = 0; i < 8 && walkers[a1].actionState != 150; ++i ) sub_4B2D50(a1, grid_walkerIds[dword_5FFE4C[i] + v1]); } void sub_4B3390(int walkerId) { int v1; // [sp+4Ch] [bp-20h]@22 signed int v2; // [sp+50h] [bp-1Ch]@54 int v3; // [sp+54h] [bp-18h]@54 int v4; // [sp+58h] [bp-14h]@26 signed int v5; // [sp+5Ch] [bp-10h]@26 int v6; // [sp+60h] [bp-Ch]@22 int v7; // [sp+64h] [bp-8h]@1 int v8; // [sp+68h] [bp-4h]@6 int v9; // [sp+68h] [bp-4h]@11 int v10; // [sp+68h] [bp-4h]@17 int v11; // [sp+68h] [bp-4h]@22 v7 = walkers[walkerId].formationId; if ( walkers[walkerId].progressOnTile <= 5 ) { ++walkers[walkerId].progressOnTile; walkerAdvanceTick(walkerId); } if ( !walkers[walkerId].byte_7FA3B9 ) { clearAndRemoveDestPathForWalker(walkerId); return; } if ( walkers[walkerId].byte_7FA3B9 == 1 ) { v8 = walkers[walkerId].wlk_ID_pp; if ( walkers[v8].state != 1 || walkers[v8].actionState == 149 ) { clearAndRemoveDestPathForWalker(walkerId); return; } } else { if ( walkers[walkerId].byte_7FA3B9 == 2 ) { v9 = walkers[walkerId].wlk_ID_pp; if ( walkers[v9].state != 1 || walkers[v9].actionState == 149 ) { if ( v9 == walkers[walkerId].word_7FA3BA ) { walkers[walkerId].wlk_ID_pp = walkers[walkerId].word_7FA3BC; } else { if ( v9 == walkers[walkerId].word_7FA3BC ) walkers[walkerId].wlk_ID_pp = walkers[walkerId].word_7FA3BA; } v10 = walkers[walkerId].wlk_ID_pp; if ( walkers[v10].state != 1 || walkers[v10].actionState == 149 ) { clearAndRemoveDestPathForWalker(walkerId); return; } walkers[walkerId].byte_7FA3B9 = 1; walkers[walkerId].word_7FA3BA = v10; walkers[walkerId].word_7FA3BC = 0; } } } ++walkers[walkerId].byte_7FA39A; if ( walkers[walkerId].byte_7FA39A >= 24 ) { v11 = walkers[walkerId].wlk_ID_pp; v6 = walkers[v11].formationId; v1 = byte_5F60F4[10 * walkers[v11].type]; if ( v1 != 1 && v1 != 4 ) walkers[walkerId].byte_7FA39A = 0; else walkers[walkerId].byte_7FA39A = 12; v5 = byte_5F60F6[10 * walkers[walkerId].type]; v4 = byte_5F60F7[10 * walkers[v11].type]; if ( walkers[walkerId].type == Walker_Wolf ) { if ( setting_difficulty ) { if ( setting_difficulty == 1 ) { v5 = 4; } else { if ( setting_difficulty == 2 ) v5 = 6; } } else { v5 = 2; } } if ( walkers[v11].wlk_ID_pp != walkerId ) { if ( sub_4B3A40(walkers[walkerId].simpleDirection, walkers[v11].simpleDirection) ) { if ( formations[v7].walkerType!= 13 ) { v5 += 4; sound_playChannel(141); } } } if ( formations[v7].formation_52 ) { if ( formations[v7].walkerType== Walker_FortLegionary ) { if ( sub_4B3A40(walkers[walkerId].simpleDirection, formations[v7].formation_63 ) ) v5 += 4; } } if ( formations[v6].formation_52 ) { if ( formations[v6].walkerType == Walker_FortLegionary || formations[v6].walkerType == Walker_Enemy57 ) { if ( sub_4B3A40(walkers[v11].simpleDirection, formations[v6].formation_63) ) { if ( formations[v6].layout ) { if ( formations[v6].layout == 2 ) { v4 += 4; } else { if ( formations[v6].layout == 1 ) v4 += 4; } } else { v4 += 7; } } else { v4 -= 4; } } } v2 = byte_5F60F5[10 * walkers[v11].type]; v3 = v5 - v4; if ( v5 - v4 < 0 ) _LOBYTE(v3) = 0; byte_7FA359[128 * v11] += v3; if ( byte_7FA359[128 * v11] <= v2 ) { sub_4B84E0(walkers[walkerId].type); } else { walkers[v1].actionState = -107; walkers[v11].word_7FA366 = 0; sub_4B8080(walkers[v11].type); fun_formationDecreaseMoraleAfterComradeDeath(v6); } } } bool sub_4B3A40(int a1, int a2) { bool result; // eax@2 int v3; // [sp+4Ch] [bp-4h]@3 int v4; // [sp+4Ch] [bp-4h]@7 if ( a1 == a2 ) { result = 1; } else { v3 = a2 - 1; if ( a2 - 1 < 0 ) v3 = 7; if ( a1 == v3 ) { result = 1; } else { v4 = a2 + 1; if ( a2 + 1 >= 8 ) v4 = 0; result = a1 == v4; } } return result; } //----- (004B3AD0) -------------------------------------------------------- bool sub_4B3AD0(int a1, int a2) { bool result; // eax@4 int v3; // [sp+4Ch] [bp-4h]@5 int v4; // [sp+4Ch] [bp-4h]@9 int v5; // [sp+5Ch] [bp+Ch]@1 v5 = a2 + 4; if ( v5 >= 8 ) v5 -= 8; if ( a1 == v5 ) { result = 1; } else { v3 = v5 - 1; if ( v5 - 1 < 0 ) v3 = 7; if ( a1 == v3 ) { result = 1; } else { v4 = v5 + 1; if ( v5 + 1 >= 8 ) v4 = 0; result = a1 == v4; } } return result; } int sub_4B3B80(int a1) { int result; // eax@3 if ( walkers[a1].word_7FA366 < 0 ) walkers[a1].word_7FA366 = 0; ++walkers[a1].word_7FA366; result = a1 << 7; if ( walkers[a1].word_7FA366 >= 128 ) { walkers[a1].word_7FA366 = 127; result = a1 << 7; walkers[a1].state = 2; } return result; } void clearAndRemoveDestPathForWalker(int wlkId) { walkers[wlkId].byte_7FA3B9 = 0; walkers[wlkId].actionState = walkers[wlkId].prevActionState; walkers[wlkId].wlk_ID_pp = 0; walkers[wlkId].word_7FA3BA = 0; walkers[wlkId].word_7FA3BC = 0; removeDestinationPathForWalker(wlkId); } char fun_roamWalker(int walkerId) { signed int v1; // eax@19 int y; // [sp+4Ch] [bp-14h]@3 int x; // [sp+50h] [bp-10h]@3 int v5; // [sp+54h] [bp-Ch]@1 int buildingId; // [sp+5Ch] [bp-4h]@1 buildingId = walkers[walkerId].buildingId; walkers[walkerId].progressOnTile = 15; walkers[walkerId].byte_7FA376 = 0; byte_7FA379[128 * walkerId] = -1; byte_7FA378[128 * walkerId] = 2; v5 = buildings[buildingId].byte_94BD6C; buildings[buildingId].byte_94BD6C += 2; if ( buildings[buildingId].byte_94BD6C > 6 ) buildings[buildingId].byte_94BD6C = 0; x = buildings[buildingId].x; y = buildings[buildingId].y; if ( v5 ) { switch ( v5 ) { case 2: x += 8; break; case 4: y += 8; break; case 6: x -= 8; break; } } else { y -= 8; } if ( x < 0 ) x = 0; if ( y < 0 ) y = 0; if ( x >= setting_map_width ) x = setting_map_width - 1; if ( y >= setting_map_height ) y = setting_map_height - 1; v1 = sub_489070(x, y, 1, 6); if ( v1 ) { walkers[walkerId].destination_x = walkerGridX; _LOBYTE(v1) = walkerGridY; walkers[walkerId].destination_y = walkerGridY; } else { walkers[walkerId].byte_7FA376 = 1; } return v1; } void sub_4B3F00(int a1, int a2) { signed int v2; // eax@38 signed int v3; // ecx@50 signed int v4; // ecx@63 signed int v5; // [sp+54h] [bp-Ch]@14 int v6; // [sp+58h] [bp-8h]@12 int v7; // [sp+5Ch] [bp-4h]@1 v7 = 0; if ( walkers[a1].byte_7FA376 ) { LABEL_10: while ( a2 > 0 ) { --a2; ++walkers[a1].progressOnTile; if ( walkers[a1].progressOnTile < 15 ) { walkerAdvanceTick(a1); } else { walkers[a1].progressOnTile = 15; v6 = (walkers[a1].lastDirection + 4) % 8; ++byte_7FA377[128 * a1]; if ( fun_walkerProvideServiceCoverage(a1) ) return; v5 = sub_484470(walkers[a1].gridOffset); if ( v5 == 3 ) { if ( sub_4847A0(walkers[a1].gridOffset) >= 5 ) { v5 = 2; if ( v6 && v6 != 4 ) { if ( dword_8A11C8 && dword_8A11D8 ) { dword_8A11C0[0] = 0; dword_8A11D0 = dword_8A11C0[0]; } else { dword_8A11D8 = 0; dword_8A11C8 = dword_8A11D8; } } else { if ( dword_8A11C0[0] && dword_8A11D0 ) { dword_8A11D8 = 0; dword_8A11C8 = dword_8A11D8; } else { dword_8A11C0[0] = 0; dword_8A11D0 = dword_8A11C0[0]; } } } } if ( v5 == 4 ) { if ( sub_4847A0(walkers[a1].gridOffset) >= 8 ) { v5 = 2; if ( v6 && v6 != 4 ) { dword_8A11C0[0] = 0; dword_8A11D0 = dword_8A11C0[0]; } else { dword_8A11D8 = 0; dword_8A11C8 = dword_8A11D8; } } } if ( v5 <= 0 ) { walkers[walkerId].word_7FA374 = walkers[walkerId].word_7FA372; return; } if ( v5 > 1 ) { if ( v5 == 2 ) { if ( byte_7FA379[128 * a1] == -1 ) { sub_4B4630(a1); v6 = -1; } do { if ( dword_8A11C0[walkers[a1].direction] && walkers[a1].direction != v6 ) break; walkers[a1].direction += byte_7FA378[128 * a1]; if ( walkers[a1].direction > 6 ) walkers[a1].direction = 0; if (walkers[a1].direction < 0 ) walkers[a1].direction = 6; v3 = v7++; } while ( v3 < 4 ); } else { walkers[a1].direction = (byte_7FA377[128 * a1] + grid_random[walkers[a1].gridOffset]) & 6; if ( !dword_8A11C0[walkers[a1].direction] || walkers[a1].direction == v6 ) { --byte_7FA379[128 * a1]; if ( byte_7FA379[128 * a1] <= 0 ) { sub_4B4630(a1); v6 = -1; } do { if ( dword_8A11C0[walkers[a1].direction] && walkers[a1].direction != v6 ) break; walkers[a1].direction += byte_7FA378[128 * a1]; if ( walkers[a1].direction > 6 ) walkers[a1].direction = 0; if ( walkers[a1].direction < 0 ) walkers[a1].direction = 6; v4 = v7++; } while ( v4 < 4 ); } } } else { do { walkers[a1].direction = 2 * v7; if ( dword_8A11C0[walkers[a1].direction] ) break; v2 = v7++; } while ( v2 < 4 ); } walkers[a1].destinationPathCurrent++; walkers[a1].lastDirection = walkers[a1].direction; walkers[a1].progressOnTile = 0; sub_4B5BE0(a1); walkerAdvanceTick(a1); } } } else { dword_7FA238 = 1; walkerWalkTicks(a1, a2); if ( walkers[a1].direction != 9 && walkers[a1].direction != 10 ) { if ( walkers[a1].direction == 8 ) { walkers[a1].byte_7FA376 = 1; walkers[a1].word_7FA374 = 0; } } else { walkers[a1].byte_7FA376 = 1; } if ( walkers[a1].byte_7FA376 ) { byte_7FA379[128 * a1] = 100; walkers[a1].direction = walkers[a1].lastDirection; goto LABEL_10; } } } int sub_4B4630(int a1) { int result; // eax@1 __int16 v2; // ax@6 __int16 v3; // ax@14 int v4; // [sp+4Ch] [bp-20h]@1 char v5; // [sp+50h] [bp-1Ch]@20 char v6; // [sp+54h] [bp-18h]@21 int v7; // [sp+58h] [bp-14h]@11 int v8; // [sp+5Ch] [bp-10h]@3 signed int v9; // [sp+60h] [bp-Ch]@3 signed int v10; // [sp+60h] [bp-Ch]@11 int v11; // [sp+64h] [bp-8h]@1 signed int v12; // [sp+68h] [bp-4h]@3 signed int v13; // [sp+68h] [bp-4h]@11 v4 = 162 * walkers[a1].y + walkers[a1].x + setting_map_startGridOffset; result = fun_walkerGetSimpleDestinationDirection( walkers[a1].x, walkers[a1].y, walkers[a1].destination_x, walkers[a1].destination_y); v11 = result; if ( result >= 8 ) v11 = 0; v8 = 0; v12 = 0; v9 = v11; while ( v12 < 8 ) { if ( !(v9 & 1) ) { v2 = grid_terrain[dword_5FFE4C[v9] + v4]; result = v2 & 0x40; if ( result ) { v6 = v9; break; } } ++v9; if ( v9 > 7 ) v9 = 0; result = v8++ + 1; ++v12; } v7 = 0; v13 = 0; v10 = v11; while ( v13 < 8 ) { if ( !(v10 & 1) ) { v3 = grid_terrain[dword_5FFE4C[v10] + v4]; result = v3 & 0x40; if ( result ) { v5 = v10; break; } } --v10; if ( v10 < 0 ) v10 = 7; result = v7++ + 1; ++v13; } if ( v8 <= v7 ) { _LOBYTE(result) = v6; walkers[a1].direction = v6; byte_7FA378[128 * a1] = 2; } else { _LOBYTE(result) = v5; walkers[a1].direction = v5; byte_7FA378[128 * a1] = -2; } byte_7FA379[128 * a1] = 5; return result; } void sub_4B4880(int a1, int a2, int a3) { if ( walkers[a1].x == walkers[a1].byte_7FA360 ) { if ( walkers[a1].y == walkers[a1].byte_7FA361) walkers[a1].reachedLastStep = 1; } while ( a3 > 0 ) { --a3; ++walkers[a1].progressOnTile; if ( walkers[a1].progressOnTile < 15 ) { walkerAdvanceTick(a1); } else { walkers[a1].progressOnTile = 15; walkers[a1].direction = fun_walkerGetSimpleDestinationDirection( walkers[a1].x, walkers[a1].y, byte_7FA356[128 * a2], byte_7FA357[128 * a2]); if ( walkers[a1].direction >= 8 ) return; walkers[a1].lastDirection = walkers[a1].direction; walkers[a1].progressOnTile = 0; sub_4B5BE0(a1); walkerAdvanceTick(a1); } } } void walkerWalkTicks(int walkerId, int numTicks) { while ( numTicks > 0 ) { --numTicks; ++walkers[walkerId].progressOnTile; if ( walkers[walkerId].progressOnTile < 15 ) { walkerAdvanceTick(walkerId); } else { fun_walkerProvideServiceCoverage(walkerId); walkers[walkerId].progressOnTile = 15; if ( walkers[walkerId].destinationpathId <= 0 ) fun_determineDestinationPathForWalker(walkerId); fun_walkerGetNextTileDirection(walkerId); fun_walkerAdvanceTile(walkerId); if ( walkers[walkerId].direction >= 8 ) break; walkers[walkerId].destinationPathCurrent++; walkers[walkerId].lastDirection = walkers[walkerId].direction; walkers[walkerId].progressOnTile = 0; sub_4B5BE0(walkerId); walkerAdvanceTick(walkerId); } } dword_7FA238 = 0; } void sub_4B4BC0(int a1, int a2) { while ( a2 > 0 ) { --a2; ++walkers[a1].progressOnTile; if ( walkers[a1].progressOnTile < 15 ) walkerAdvanceTick(a1); else walkers[a1].progressOnTile = 15; } } void fun_determineDestinationPathForWalker(int walkerId) { signed int v1; // [sp+4Ch] [bp-Ch]@19 signed int pathLength; // [sp+50h] [bp-8h]@15 int destinationPathId; // [sp+54h] [bp-4h]@1 walkers[walkerId].destinationpathId = 0; walkers[walkerId].destinationPathCurrent = 0; walker_destinationPathLength[64 * walkerId] = 0; for ( destinationPathId = 1; destinationPathId < 600 && destinationpath_index[destinationPathId]; ++destinationPathId ) ; if ( destinationPathId < 600 ) { if ( walkers[walkerId].isBoat ) { if ( mode_editor == 1 ) // flotsam { sub_505060(map_riverEntry_x, map_riverEntry_y); } else { if ( walkers[walkerId].isBoat == 2 )// flotsam sub_505060(walkers[walkerId].x, walkers[walkerId].y); else fun_determineOpenWaterTiles(walkers[walkerId].x, walkers[walkerId].y); } if ( walkers[walkerId].isBoat == 2 ) pathLength = fun_determineShortestPathOnWater( destinationPathId, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y, 1); else pathLength = fun_determineShortestPathOnWater( destinationPathId, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y, 0); } else { switch ( walkers[walkerId].byte_7FA3A2 ) { case 2: v1 = sub_501B60( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y, walkers[walkerId].baseWorkingBuildingId, 5000); if ( !v1 ) v1 = sub_501B60( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y, 0, 25000); if ( !v1 ) v1 = sub_502510( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); break; case 4: v1 = sub_5017A0( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); break; case 5: v1 = sub_501B60( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y, 10000, 5000); break; case 3: v1 = fun_canTravelToDestinationOverRoadGarden( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); if ( !v1 ) v1 = sub_501000( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); break; case 1: v1 = fun_canTravelToDestinationOverRoadGarden( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); break; default: v1 = sub_501000( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); break; } if ( v1 ) { if ( walkers[walkerId].byte_7FA3A2 == 4 ) { pathLength = fun_determineShortestPathFromDistanceGraph( 4, destinationPathId, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); if ( pathLength <= 0 ) pathLength = fun_determineShortestPathFromDistanceGraph( 8, destinationPathId, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); } else { pathLength = fun_determineShortestPathFromDistanceGraph( 8, destinationPathId, walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); } } else { pathLength = 0; } } if ( pathLength ) { destinationpath_index[destinationPathId] = walkerId; walkers[walkerId].destinationpathId = destinationPathId; walker_destinationPathLength[64 * walkerId] = pathLength; } } } void removeDestinationPathForWalker(int walkerId) { if ( walkers[walkerId].destinationpathId > 0 ) { if ( destinationpath_index[walkers[walkerId].destinationpathId] == walkerId ) destinationpath_index[walkers[walkerId].destinationpathId] = 0; walkers[walkerId].destinationpathId = 0; } } void fun_clearDestinationPaths() { signed int j; // [sp+4Ch] [bp-8h]@3 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 600; ++i ) { destinationpath_index[i] = 0; for ( j = 0; j < 500; ++j ) *(&destinationpath_data[500 * i] + j) = 0; } } void fun_garbageCollectDestinationPaths() { signed int walkerId; // [sp+4Ch] [bp-8h]@4 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 600; ++i ) { walkerId = destinationpath_index[i]; if ( walkerId > 0 ) { if ( walkerId < 1000 ) { if ( walkers[walkerId].state != 1 ) destinationpath_index[i] = 0; if ( walkers[walkerId].destinationpathId != i ) destinationpath_index[i] = 0; } } } } int fun_getNumFreeDestinationPaths() { int free; // [sp+4Ch] [bp-8h]@1 signed int index; // [sp+50h] [bp-4h]@1 index = 1; free = 0; while ( index < 600 ) { if ( !destinationpath_index[index] ) ++free; ++index; } return free; } void fun_walkerGetNextTileDirection(int walkerId) { if ( walkers[walkerId].destinationpathId > 0 ) { if ( walkers[walkerId].destinationPathCurrent < walker_destinationPathLength[64 * walkerId] ) { walkers[walkerId].direction = *(&destinationpath_data[500 * walkers[walkerId].destinationpathId] + walkers[walkerId].destinationPathCurrent); } else { removeDestinationPathForWalker(walkerId); walkers[walkerId].direction = 8; } } else { walkers[walkerId].direction = fun_walkerGetSimpleDestinationDirection( walkers[walkerId].x, walkers[walkerId].y, walkers[walkerId].destination_x, walkers[walkerId].destination_y); if ( walkers[walkerId].direction != 8 ) walkers[walkerId].direction = 10; } } void fun_walkerAdvanceTile(int walkerId) { int v1; // [sp+4Ch] [bp-18h]@3 signed int v2; // [sp+54h] [bp-10h]@9 __int16 v3; // [sp+58h] [bp-Ch]@3 int v4; // [sp+5Ch] [bp-8h]@3 int v5; // [sp+60h] [bp-4h]@3 if ( walkers[walkerId].direction < 8 ) { v4 = walkers[walkerId].gridOffset; v5 = dword_5FFE4C[walkers[walkerId].direction]; v3 = grid_terrain[v5 + v4] & 0xC75F; v1 = grid_buildingIds[v5 + v4]; if ( walkers[walkerId].isBoat ) { if ( !(v3 & 4) ) walkers[walkerId].direction = 9; } else { if ( walkers[walkerId].byte_7FA3A2 == 2 ) { v2 = *(&byte_6415A0[v5] + v4); if ( v2 > -1 ) { if ( *(&byte_6415A0[v5] + v4) ) { if ( v2 != 5 ) { switch ( v2 ) { case 1: walkers[walkerId].simpleDirection = walkers[walkerId].direction; walkers[walkerId].direction = 11; if ( !(game_ticks & 3) ) fun_enemyHitBuilding(v5 + v4, 10); break; case 2: if ( !(grid_terrain[v5 + v4] & 0x1420) ) { walkers[walkerId].simpleDirection = walkers[walkerId].direction; walkers[walkerId].direction = 11; if ( !(game_ticks & 3) ) fun_enemyHitBuilding(v5 + v4, 10); } break; case 3: walkers[walkerId].simpleDirection = walkers[walkerId].direction; walkers[walkerId].direction = 11; if ( !(game_ticks & 3) ) fun_enemyHitBuilding(v5 + v4, 200); break; default: walkers[walkerId].simpleDirection = walkers[walkerId].direction; walkers[walkerId].direction = 11; if ( !(game_ticks & 3) ) fun_enemyHitBuilding(v5 + v4, 150); break; } } } } else { walkers[walkerId].direction = 9; } } else { if ( walkers[walkerId].byte_7FA3A2 == 4 ) { if ( *(&byte_61AA20[v5] + v4) <= -1 ) walkers[walkerId].direction = 9; } else { if ( v3 & 0x40 || grid_terrain[v5 + v4] & 0x400 ) { if ( dword_7FA238 ) { if ( v3 & 8 ) { if ( buildings[v1].type == 58 ) walkers[walkerId].direction = 9; } } } else { if ( v3 & 8 ) { if ( buildings[v1].type != 72 ) { if ( buildings[v1].type != 71 ) { if ( buildings[v1].type != 56 ) { if ( buildings[v1].type != 54 ) walkers[walkerId].direction = 9; } } } } else { if ( grid_terrain[v5 + v4] & 0xC75F ) walkers[walkerId].direction = 9; } } } } } } } char sub_4B5BE0(int wlkId) { __int16 v2; // ax@10 __int16 v3; // ax@11 int v7; // [sp+58h] [bp-4h]@10 unsigned char walker_pX = walkers[wlkId].x; unsigned char walker_pY = walkers[wlkId].y; removeWalkerFromTileList(wlkId); int walkerDirection = walkers[wlkId].direction; switch ( walkerDirection ) { case Direction_North: --walkers[wlkId].y; walkers[wlkId].gridOffset -= 162; goto LABEL_10; case Direction_NorthEast: --walkers[wlkId].y; ++walkers[wlkId].x; walkers[wlkId].gridOffset -= 161; goto LABEL_10; case Direction_East: ++walkers[wlkId].x; ++walkers[wlkId].gridOffset; goto LABEL_10; case Direction_SouthEast: ++walkers[wlkId].y; ++walkers[wlkId].x; walkers[wlkId].gridOffset += 163; goto LABEL_10; case Direction_South: ++walkers[wlkId].y; walkers[wlkId].gridOffset += 162; goto LABEL_10; case Direction_SouthWest: ++walkers[wlkId].y; --walkers[wlkId].x; walkers[wlkId].gridOffset += 161; goto LABEL_10; case Direction_West: --walkers[wlkId].x; --walkers[wlkId].gridOffset; goto LABEL_10; case Direction_NorthWest: --walkers[wlkId].y; --walkers[wlkId].x; walkers[wlkId].gridOffset -= 163; LABEL_10: sub_4B8A40(wlkId); v7 = walkers[wlkId].gridOffset; v2 = grid_terrain[v7]; if ( v2 & 0x40 ) { byte_7FA371[128 * wlkId] = 1; v3 = grid_terrain[v7]; if ( v3 & 4 ) { walkers[wlkId].byte_7FA3A5 = 18; if ( grid_animation[v7] > 6 ) { switch ( grid_animation[v7] ) { case 0xD: walkers[wlkId].byte_7FA3A7 = 30; break; case 9: walkers[wlkId].byte_7FA3A7 = 14; break; case 8: walkers[wlkId].byte_7FA3A7 = 14; break; case 7: walkers[wlkId].byte_7FA3A7 = 14; break; case 0xA: walkers[wlkId].byte_7FA3A7 = 14; break; default: walkers[wlkId].byte_7FA3A7 = 36; break; } } else { switch ( grid_animation[v7] ) { case 3: walkers[wlkId].byte_7FA3A7 = 16; break; case 2: walkers[wlkId].byte_7FA3A7 = 16; break; case 1: walkers[wlkId].byte_7FA3A7 = 10; break; case 4: walkers[wlkId].byte_7FA3A7 = 10; break; default: walkers[wlkId].byte_7FA3A7 = 20; break; } } } } else { byte_7FA371[128 * wlkId] = 0; } sub_4B2D50(wlkId, grid_walkerIds[walkers[wlkId].gridOffset]); _LOBYTE(walkerDirection) = walker_pX; byte_7FA356[128 * wlkId] = walker_pX; byte_7FA357[128 * wlkId] = walker_pY; break; default: return walkerDirection; } return walkerDirection; } void walkerAdvanceTick(int walkerId) { switch ( walkers[walkerId].direction ) { case 0: --walkers[walkerId].tilePosition_x; break; case 1: --walkers[walkerId].tilePosition_x; ++walkers[walkerId].tilePosition_y; break; case 2: ++walkers[walkerId].tilePosition_y; break; case 3: ++walkers[walkerId].tilePosition_x; ++walkers[walkerId].tilePosition_y; break; case 4: ++walkers[walkerId].tilePosition_x; break; case 5: ++walkers[walkerId].tilePosition_x; --walkers[walkerId].tilePosition_y; break; case 6: --walkers[walkerId].tilePosition_y; break; case 7: --walkers[walkerId].tilePosition_x; --walkers[walkerId].tilePosition_y; break; default: break; } if ( walkers[walkerId].byte_7FA3A5 > 0 ) { --walkers[walkerId].byte_7FA3A5; if ( walkers[walkerId].byte_7FA3A5 > 0 ) { walkers[walkerId].reachedLastStep = 1; if ( walkers[walkerId].byte_7FA3A6 < walkers[walkerId].byte_7FA3A7 ) ++walkers[walkerId].byte_7FA3A6; if ( walkers[walkerId].byte_7FA3A6 > walkers[walkerId].byte_7FA3A7 ) --walkers[walkerId].byte_7FA3A6; } else { walkers[walkerId].reachedLastStep = 0; } } else { if ( walkers[walkerId].byte_7FA3A6 ) --walkers[walkerId].byte_7FA3A6; } } int sub_4B66E0(int wlkId, int a2) { __int16 v2; // cx@15 signed int v4; // [sp+4Ch] [bp-Ch]@1 int i; // [sp+54h] [bp-4h]@1 v4 = 0; removeWalkerFromTileList(wlkId); for ( i = 0; i < a2; ++i ) { if ( walkers[wlkId].speed <= 0 ) walkers[wlkId].speed = 0; else --walkers[wlkId].speed; if ( walkers[wlkId].word_7FA384 + word_7FA382[64 * wlkId] <= 0 ) { v4 = 1; break; } sub_4B69C0(wlkId); if ( byte_7FA388[128 * wlkId] == 2 ) { sub_4B6F50(wlkId); if ( word_7FA386[64 * wlkId] >= 0 ) { --word_7FA382[64 * wlkId]; sub_4B7000(wlkId); } } else { sub_4B7000(wlkId); if ( word_7FA386[64 * wlkId] >= 0 ) { --walkers[wlkId].word_7FA384; sub_4B6F50(wlkId); } } } walkers[wlkId].x = walkers[wlkId].tilePosition_y / 15; walkers[wlkId].y = walkers[wlkId].tilePosition_x / 15; walkers[wlkId].gridOffset = 162 * walkers[wlkId].y + walkers[wlkId].x + (_WORD)setting_map_startGridOffset; v2 = grid_terrain[walkers[wlkId].gridOffset]; if ( v2 & 8 ) { walkers[wlkId].byte_7FA370 = 8; } else { if ( walkers[wlkId].byte_7FA370 ) --walkers[wlkId].byte_7FA370; } sub_4B8A40(wlkId); return v4; } int sub_4B69C0(int a1) { int result; // eax@5 if ( byte_7FA388[128 * a1] == 1 ) { if ( word_7FA386[64 * a1] >= 0 ) word_7FA386[64 * a1] += 2 * (walkers[a1].word_7FA384 - word_7FA382[64 * a1]); else word_7FA386[64 * a1] += 2 * walkers[a1].word_7FA384; result = a1 << 7; --word_7FA382[64 * a1]; } else { if ( word_7FA386[64 * a1] >= 0 ) word_7FA386[64 * a1] += 2 * (word_7FA382[64 * a1] - walkers[a1].word_7FA384); else word_7FA386[64 * a1] += 2 * word_7FA382[64 * a1]; result = a1 << 7; --walkers[a1].word_7FA384; } return result; } int turnWalkerToTile(int walkerIndex, int startX, int startY, int stopX, int stopY, int a6) { int result; // eax@32 word_7FA37E[64 * walkerIndex] = stopX; word_7FA380[64 * walkerIndex] = stopY; if ( startX <= stopX ) word_7FA382[64 * walkerIndex] = stopX - startX; else word_7FA382[64 * walkerIndex] = startX - stopX; if ( startY <= stopY ) walkers[walkerIndex].word_7FA384 = stopY - startY; else walkers[walkerIndex].word_7FA384 = startY - stopY; if ( walkers[walkerIndex].word_7FA384 <= word_7FA382[64 * walkerIndex] ) { if ( word_7FA382[64 * walkerIndex] <= walkers[walkerIndex].word_7FA384 ) word_7FA386[64 * walkerIndex] = 0; else word_7FA386[64 * walkerIndex] = 2 * walkers[walkerIndex].word_7FA384 - word_7FA382[64 * walkerIndex]; } else { word_7FA386[64 * walkerIndex] = 2 * word_7FA382[64 * walkerIndex] - walkers[walkerIndex].word_7FA384; } if ( a6 ) { walkers[walkerIndex].direction = fun_pathing_getDirection16(startX, startY, stopX, stopY); } else { walkers[walkerIndex].direction = fun_walkerGetSimpleDestinationDirection(startX, startY, stopX, stopY); if ( walkers[walkerIndex].word_7FA384 > 2 * word_7FA382[64 * walkerIndex] ) { switch ( walkers[walkerIndex].direction ) { case 1: walkers[walkerIndex].direction = 0; break; case 3: walkers[walkerIndex].direction = 4; break; case 5: walkers[walkerIndex].direction = 4; break; case 7: walkers[walkerIndex].direction = 0; break; } } if ( word_7FA382[64 * walkerIndex] > 2 * walkers[walkerIndex].word_7FA384 ) { switch ( walkers[walkerIndex].direction ) { case 1: walkers[walkerIndex].direction = 2; break; case 3: walkers[walkerIndex].direction = 2; break; case 5: walkers[walkerIndex].direction = 6; break; case 7: walkers[walkerIndex].direction = 6; break; } } } result = walkerIndex << 7; if ( walkers[walkerIndex].word_7FA384 <= word_7FA382[64 * walkerIndex] ) { result = walkerIndex << 7; byte_7FA388[128 * walkerIndex] = 1; } else { byte_7FA388[128 * walkerIndex] = 2; } return result; } __int16 sub_4B6F50(int a1) { __int16 result; // ax@2 if ( walkers[a1].tilePosition_x >= word_7FA380[64 * a1] ) { result = (_WORD)a1 << 7; if ( walkers[a1].tilePosition_x > word_7FA380[64 * a1] ) { result = walkers[a1].tilePosition_x - 1; walkers[a1].tilePosition_x = result; } } else { result = (_WORD)a1 << 7; ++walkers[a1].tilePosition_x; } return result; } __int16 sub_4B7000(int a1) { __int16 result; // ax@2 if ( walkers[a1].tilePosition_y >= word_7FA37E[64 * a1] ) { result = (_WORD)a1 << 7; if ( walkers[a1].tilePosition_y > word_7FA37E[64 * a1] ) { result = walkers[a1].tilePosition_y - 1; walkers[a1].tilePosition_y = result; } } else { result = (_WORD)a1 << 7; ++walkers[a1].tilePosition_y; } return result; } signed int sub_4B70B0(int a1, int a2, int a3, int a4) { signed int result; // eax@9 __int16 v5; // ax@21 signed int v6; // [sp+4Ch] [bp-14h]@1 int v7; // [sp+54h] [bp-Ch]@19 signed int i; // [sp+58h] [bp-8h]@6 signed int v9; // [sp+5Ch] [bp-4h]@3 v6 = 0; walkers[0].tilePosition_y = 15 * a1; walkers[0].tilePosition_x = 15 * a2; if ( grid_terrain[162 * a2 + a1 + setting_map_startGridOffset] & 0xC000 ) v6 = 6; turnWalkerToTile(0, 15 * a1, 15 * a2, 15 * a3, 15 * a4, 0); v9 = 0; while ( 2 ) { if ( v9 >= 1000 ) { result = 0; } else { for ( i = 0; i < 8; ++i ) { if ( walkers[0].word_7FA384 + word_7FA382[0] <= 0 ) return 1; sub_4B69C0(0); if ( byte_7FA388[0] == 2 ) { sub_4B6F50(0); if ( word_7FA386[0] >= 0 ) { --word_7FA382[0]; sub_4B7000(0); } } else { sub_4B7000(0); if ( word_7FA386[0] >= 0 ) { --walkers[0].word_7FA384; sub_4B6F50(0); } } } walkers[0].x = walkers[0].tilePosition_y / 15; walkers[0].y = walkers[0].tilePosition_x / 15; if ( v6 ) { --v6; LABEL_4: ++v9; continue; } v7 = 162 * walkers[0].y + walkers[0].x + setting_map_startGridOffset; if ( grid_terrain[v7] & 0xC001 ) { result = 0; } else { v5 = grid_terrain[v7]; if ( !(v5 & 8) || !(grid_bitfields[v7] & 0xF) ) goto LABEL_4; result = 0; } } return result; } } signed int fun_createDustCloud(__int16 x, __int16 y, int size) { int v4; // [sp+4Ch] [bp-10h]@1 int v5; // [sp+50h] [bp-Ch]@1 int v6; // [sp+54h] [bp-8h]@3 signed int i; // [sp+58h] [bp-4h]@1 v5 = dustcloud_dword_5FA878[size]; v4 = dustcloud_dword_5FA890[size]; for ( i = 0; i < 16; ++i ) { v6 = spawnWalker(ciid, Walker_Explosion, v5 + x, v5 + y, 0); if ( v6 ) { walkers[v6].tilePosition_y += v4; walkers[v6].tilePosition_x += v4; walkers[v6].destination_x += dustcloud_x[8 * i]; walkers[v6].destination_y += dustcloud_y[8 * i]; turnWalkerToTile( v6, walkers[v6].tilePosition_y, walkers[v6].tilePosition_x, v4 + 15 * walkers[v6].destination_x, v4 + 15 * walkers[v6].destination_y, 0); walkers[v6].byte_7FA389 = dustcloud_byte_5FA928[4 * i]; } } return sound_playChannel(5); } int spawnWalkerWithParent(short parentBuildingId, short x, short y, short dstX, short dstY, WalkerType walkerType) { int newWallkerIndex = spawnWalker(ciid, walkerType, x, y, 0); if ( newWallkerIndex ) { if ( walkerType == Walker_Bolt ) walkers[newWallkerIndex].speed = 60; else walkers[newWallkerIndex].speed = 10; walkers[newWallkerIndex].buildingId = parentBuildingId; walkers[newWallkerIndex].destination_x = dstX; walkers[newWallkerIndex].destination_y = dstY; turnWalkerToTile( newWallkerIndex, walkers[newWallkerIndex].tilePosition_y, walkers[newWallkerIndex].tilePosition_x, 15 * walkers[newWallkerIndex].destination_x, 15 * walkers[newWallkerIndex].destination_y, 1); } return newWallkerIndex; } bool sub_4B76D0(int a1) { bool result; // eax@2 int v2; // [sp+4Ch] [bp-4h]@1 v2 = walkers[a1].word_7FA3B0; if ( v2 > 0 ) { if ( walkers[v2].state == 1 ) { if ( walkers[v2].actionState == 149 ) result = 0; else result = (unsigned __int16)walkers[v2].word_7FA3B4 == (unsigned __int16)walkers[a1].word_7FA3B6; } else { result = 0; } } else { result = 0; } return result; } void fun_neptuneSinkAllShips() { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].type== Walker_TradeShip ) { buildings[walkers[i].baseWorkingBuildingId].wharf_hasBoat_house_evolveStatusDesir = 0; LABEL_11: walkers[i].buildingId = 0; walkers[i].type = Walker_Shipwreck; walkers[i].word_7FA366 = 0; continue; } if ( walkers[i].type== Walker_FishingBoat ) { buildings[walkers[i].buildingId].wharf_hasBoat_house_evolveStatusDesir = 0; goto LABEL_11; } } } } void fun_clearWalkers() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 1000; ++i ) { //fun_memset( walkers[i].inUse, 128, 0); walkers[ i ].inUse = 0; } walkerId_lastUsed = 0; dword_7FA22C = 0; } int spawnWalker(char a1, WalkerType type, __int16 x, __int16 y, char a5) { int walkerId; // [sp+4Ch] [bp-4h]@1 for ( walkerId = 1; ; ++walkerId ) { if ( walkerId >= 1000 ) return 0; if ( !walkers[walkerId].state ) break; } walkers[walkerId].state = 1; walkers[walkerId].ruler = a1; walkers[walkerId].type = type; walkers[walkerId].byte_7FA34C = 0; walkers[walkerId].byte_7FA34D = 1; walkers[walkerId].word_7FA3B4 = dword_607FC8++; walkers[walkerId].direction = a5; walkers[walkerId].byte_7FA360 = x; walkers[walkerId].destination_x = x; byte_7FA356[128 * walkerId] = x; walkers[walkerId].x = x; walkers[walkerId].byte_7FA361 = y; walkers[walkerId].destination_y = y; byte_7FA357[128 * walkerId] = y; walkers[walkerId].y = y; walkers[walkerId].gridOffset = 162 * y + x + setting_map_startGridOffset; walkers[walkerId].tilePosition_y = 15 * walkers[walkerId].x; walkers[walkerId].tilePosition_x = 15 * walkers[walkerId].y; walkers[walkerId].progressOnTile = 15; byte_7FA3AC[128 * walkerId] = random_7f_1 & 3; byte_7FA3AA[128 * walkerId] = byte_7FA3AC[128 * walkerId]; fun_generateWalkerName(walkerId); sub_4B8A40(walkerId); if ( type == Walker_TradeCaravan || type == Walker_TradeShip ) sub_445A30(walkerId); if ( walkerId > walkerId_lastUsed ) walkerId_lastUsed = walkerId; return walkerId; } void deleteWalker(int walkerId) { signed int i; // [sp+4Ch] [bp-8h]@31 int buildingId; // [sp+50h] [bp-4h]@31 if ( walkers[walkerId].type == Walker_Enemy57 ) ++city_inform[ciid].dword_6545B4; switch ( walkers[walkerId].type ) { case Walker_LaborSeeker: if ( walkers[walkerId].buildingId ) buildings[walkers[walkerId].buildingId].laborSeekerId = 0; break; case Walker_MarketBuyer: if ( walkers[walkerId].buildingId ) buildings[walkers[walkerId].buildingId].laborSeekerId = 0; break; case Walker_Ballista: buildings[walkers[walkerId].buildingId].towerBallistaId = 0; break; default: if ( walkers[walkerId].type != Walker_Explosion ) { if ( walkers[walkerId].type != Walker_FortStandard ) { if ( walkers[walkerId].type != Walker_Arrow ) { if ( walkers[walkerId].type != Walker_Javelin ) { if ( walkers[walkerId].type != Walker_Bolt ) { if ( walkers[walkerId].type != Walker_Spear ) { if ( walkers[walkerId].type != Walker_FishGulls ) { if ( walkers[walkerId].type != Walker_Sheep ) { if ( walkers[walkerId].type != Walker_Wolf ) { if ( walkers[walkerId].type != Walker_Zebra ) { if ( walkers[walkerId].type != Walker_DeliveryBoy ) { if ( walkers[walkerId].type != Walker_Patrician ) { if ( walkers[walkerId].type == Walker_Dockman ) { buildingId = walkers[walkerId].buildingId; for ( i = 0; i < 3; ++i ) { if ( *(__int16 *)((char *)&buildings[buildingId].word_94BDAC + 2 * i) == walkerId ) *(__int16 *)((char *)&buildings[buildingId].word_94BDAC + 2 * i) = 0; } } else { if ( walkers[walkerId].buildingId ) buildings[walkers[walkerId].buildingId].walkerId = 0; } } } } } } } } } } } } } break; } if ( walkers[walkerId].tradeCityId ) { tradeRoutes[ walkers[walkerId].tradeCityId ].unknown0 = 0; if ( tradeRoutes[ walkers[walkerId].tradeCityId ].walkerId1 == walkerId ) { tradeRoutes[ walkers[walkerId].tradeCityId ].walkerId1 = 0; } else { if ( tradeRoutes[ walkers[walkerId].tradeCityId ].walkerId2 == walkerId ) { tradeRoutes[walkers[walkerId].tradeCityId].walkerId2 = 0; } else { if ( tradeRoutes[walkers[walkerId].tradeCityId].walkerId3 == walkerId ) tradeRoutes[walkers[walkerId].tradeCityId].walkerId3 = 0; } } } if ( walkers[walkerId].migrantDestinationHome ) buildings[walkers[walkerId].buildingId].immigrantId = 0; removeDestinationPathForWalker(walkerId); removeWalkerFromTileList(walkerId); walkers[walkerId].inUse = 0; //memset(&walker_inUse[128 * walkerId], 0, 0x80u); } void sub_4B8080(signed int a1) { signed int v1; // [sp+4Ch] [bp-8h]@1 signed int v2; // [sp+50h] [bp-4h]@1 v2 = 0; v1 = 0; switch ( a1 ) { case 69: sound_playChannel(145); break; case 68: sound_playChannel(154); break; case 70: sound_playChannel(155); break; case 17: sound_playChannel(26); break; case 52: sound_playChannel(22); break; case 48: sound_playChannel(22); break; case 46: sound_playChannel(17); break; case 47: sound_playChannel(20); break; default: if ( a1 != 58 ) { if ( a1 != 19 ) { if ( a1 != 21 ) { switch ( a1 ) { case 10: v2 = 1; break; case 11: v2 = 1; break; case 12: v2 = 1; break; case 13: v2 = 1; break; case 16: v2 = 1; break; case 41: v2 = 1; break; case 42: v2 = 1; break; case 43: v2 = 1; break; case 44: v2 = 1; break; case 45: v2 = 1; break; case 49: v2 = 1; break; case 50: v2 = 1; break; case 51: v2 = 1; break; case 53: v2 = 1; break; case 54: v2 = 1; break; case 55: v2 = 1; break; case 56: v2 = 1; break; case 57: v2 = 1; break; default: v1 = 1; break; } } } } break; } if ( v2 ) { ++ city_inform[ciid].byte_654592; if ( city_inform[ciid].byte_654592 >= 4 ) city_inform[ciid].byte_654592 = 0; sound_playChannel(city_inform[ciid].byte_654592 + 146); } else { if ( v1 ) { ++ city_inform[ciid].byte_654591; if ( city_inform[ciid].byte_654591 >= 4 ) city_inform[ciid].byte_654591 = 0; sound_playChannel(city_inform[ciid].byte_654591 + 150); } } if ( a1 < 43 || a1 > 57 ) { if ( a1 >= 11 ) { if ( a1 <= 13 ) { if ( city_inform[ciid].dword_654598 == 1 ) fun_playSound("wavs\\barbarian_war_cry.wav", 1, 0); } } } else { if ( city_inform[ciid].imperialArmyComing == 1 ) fun_playSound("wavs\\Army_war_cry.wav", 1, 0); } } int sub_4B84E0(int a1) { int result; // eax@3 if ( a1 != 13 && a1 != 57 ) { if ( a1 == 12 ) { -- city_inform[ciid].byte_65459C; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459C <= 0 ) { city_inform[ciid].byte_65459C = 8; result = sound_playChannel(141); } } else { if ( a1 == 11 ) { -- city_inform[ciid].byte_65459C; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459C <= 0 ) { city_inform[ciid].byte_65459C = 8; result = sound_playChannel(142); } } else { if ( a1 != 43 && a1 != 51 ) { if ( a1 != 44 && a1 != 49 ) { if ( a1 != 45 && a1 != 48 && a1 != 50 && a1 != 52 ) { switch ( a1 ) { case 53: -- city_inform[ciid].byte_6545A2; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_6545A2 <= 0 ) { city_inform[ciid].byte_6545A2 = 8; result = sound_playChannel(12); } break; case 54: -- city_inform[ciid].byte_65459C; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459C <= 0 ) { city_inform[ciid].byte_65459C = 8; result = sound_playChannel(141); } break; case 46: result = sound_playChannel(17); break; case 47: if ( city_inform[ciid].byte_6545A1 == 1 ) { result = sound_playChannel(19); city_inform[ciid].byte_6545A1 = 0; } else { sound_playChannel(18); //result = 18068 * ciid; result = ciid; city_inform[ciid].byte_6545A1 = 1; } break; case 69: //result = 18068 * ciid; result = ciid; --city_inform[ciid].byte_6545A3; if ( city_inform[ciid].byte_6545A3 <= 0 ) { city_inform[ciid].byte_6545A3 = 4; result = sound_playChannel(144); } break; case 17: result = sound_playChannel(25); break; } } else { --city_inform[ciid].byte_65459C; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459C <= 0 ) { city_inform[ciid].byte_65459C = 8; result = sound_playChannel(141); } } } else { --city_inform[ciid].byte_65459E; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459E <= 0 ) { city_inform[ciid].byte_65459E = 8; result = sound_playChannel(16); } } } else { --city_inform[ciid].byte_65459D; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459D <= 0 ) { city_inform[ciid].byte_65459D = 8; result = sound_playChannel(143); } } } } } else { --city_inform[ciid].byte_65459C; //result = 18068 * ciid; result = ciid; if ( city_inform[ciid].byte_65459C <= 0 ) { city_inform[ciid].byte_65459C = 8; result = sound_playChannel(140); } } return result; } void sub_4B8A40(int a1) { int v1; // [sp+4Ch] [bp-4h]@3 if ( walkers[a1].gridOffset >= 0 ) { v1 = grid_walkerIds[walkers[a1].gridOffset]; walkers[a1].byte_7FA3B8 = 0; if ( v1 ) { ++walkers[a1].byte_7FA3B8; while ( walkers[v1].nextIdOnSameTile ) { v1 = walkers[v1].nextIdOnSameTile; ++walkers[a1].byte_7FA3B8; } if ( walkers[a1].byte_7FA3B8 > 20 ) walkers[a1].byte_7FA3B8 = 20; walkers[v1].nextIdOnSameTile = a1; } else { grid_walkerIds[walkers[a1].gridOffset] = a1; } } } int sub_4B8B80(int a1) { int result; // eax@1 int v2; // [sp+4Ch] [bp-4h]@1 v2 = grid_walkerIds[walkers[a1].gridOffset]; result = a1 << 7; walkers[a1].byte_7FA3B8 = 0; while ( v2 ) { if ( v2 == a1 ) return result; ++walkers[a1].byte_7FA3B8; result = walkers[v2].nextIdOnSameTile; v2 = walkers[v2].nextIdOnSameTile; } if ( walkers[a1].byte_7FA3B8 > 20 ) { result = a1 << 7; walkers[a1].byte_7FA3B8 = 20; } return result; } void removeWalkerFromTileList(int walkerId) { int v1; // eax@3 int v2; // [sp+4Ch] [bp-4h]@3 if ( walkers[walkerId].gridOffset >= 0 ) { v1 = walkers[walkerId].gridOffset; v2 = grid_walkerIds[v1]; if ( grid_walkerIds[v1] ) { if ( v2 == walkerId ) { grid_walkerIds[walkers[walkerId].gridOffset] = walkers[walkerId].nextIdOnSameTile; walkers[walkerId].nextIdOnSameTile = 0; } else { while ( walkers[v2].nextIdOnSameTile!= walkerId && v2 ) v2 = walkers[v2].nextIdOnSameTile; walkers[v2].nextIdOnSameTile = walkers[walkerId].nextIdOnSameTile; walkers[walkerId].nextIdOnSameTile = 0; } } } } int sub_4B8D50(int a1) { int i; // [sp+4Ch] [bp-8h]@1 int v3; // [sp+50h] [bp-4h]@1 v3 = 0; for ( i = grid_walkerIds[a1]; walkers[i].nextIdOnSameTile != i; i = walkers[i].nextIdOnSameTile ) { if ( !i ) return v3; ++v3; } return v3; } int fun_getWalkerFormationIdAtOffset(int gridOffset) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = grid_walkerIds[gridOffset]; walkers[i].nextIdOnSameTile != i; i = walkers[i].nextIdOnSameTile ) { if ( !i ) return 0; if ( walkers[i].type>= Walker_FortJavelin && walkers[i].type<= Walker_FortStandard ) return walkers[i].formationId; } return 0; } int getFormationFromGridBldId(int a1) { int result; // eax@2 int currentBldId = grid_buildingIds[a1]; if ( currentBldId > 0 ) { if ( buildings[currentBldId].inUse == 1 ) { if ( buildings[currentBldId].type == B_FortGround ) { result = buildings[currentBldId].formationId; } else { if ( buildings[currentBldId].type == B_FortGround__ ) result = buildings[currentBldId].formationId; else result = 0; } } else { result = 0; } } else { result = 0; } return result; } int sub_4B8F30(int walkerId) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = grid_walkerIds[walkers[walkerId].gridOffset]; i > 0; i = walkers[i].nextIdOnSameTile ) { if ( walkers[i].actionState!= 149 ) { if ( walkers[i].type>= Walker_Enemy43 && walkers[i].type<= Walker_Enemy57 ) return i; if ( walkers[i].type== Walker_IndigenousNative && walkers[i].actionState == 159 ) return i; if ( walkers[i].type== Walker_Wolf ) return i; if ( walkers[i].type== Walker_Sheep ) return i; if ( walkers[i].type== Walker_Zebra ) return i; } } return 0; } int sub_4B9080(int walkerId) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = grid_walkerIds[walkers[walkerId].gridOffset]; i > 0; i = walkers[i].nextIdOnSameTile ) { if ( walkers[i].actionState != 149 && walkers[i].type && walkers[i].type!= Walker_Explosion && walkers[i].type!= Walker_FortStandard && walkers[i].type!= Walker_MapFlag && walkers[i].type!= Walker_Flotsam && walkers[i].type< Walker_IndigenousNative ) return i; } return 0; } signed int fun_hasEnemyNear(signed int xMin, signed int yMin, signed int xMax, signed int yMax) { int v5; // [sp+4Ch] [bp-Ch]@14 int v6; // [sp+4Ch] [bp-Ch]@23 int v7; // [sp+50h] [bp-8h]@11 int v8; // [sp+50h] [bp-8h]@20 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 && walkers[i].type>= Walker_Enemy43 && walkers[i].type<= Walker_Enemy57 ) { if ( walkers[i].x <= xMin ) v7 = xMin - walkers[i].x; else v7 = walkers[i].x - xMin; if ( walkers[i].y <= yMin ) v5 = yMin - walkers[i].y; else v5 = walkers[i].y - yMin; if ( v7 <= 12 && v5 <= 12 ) return 1; v8 = walkers[i].x <= xMax ? xMax - walkers[i].x : walkers[i].x - xMax; v6 = walkers[i].y <= yMax ? yMax - walkers[i].y : walkers[i].y - yMax; if ( v8 <= 12 && v6 <= 12 ) return 1; } } return 0; } void fun_initWalkerNameSequences() { fun_generateRandomness(); seqWalkerName_citizen = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_patrician = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_female = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_taxCollector = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_engineer = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_prefect = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_javelinThrower = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_cavalry = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_legionary = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_actor = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_gladiator = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_lionTamer = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_charioteer = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_barbarian = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_greek = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_egyptian = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_arabian = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_trader = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_tradeShip = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_unknown1 = random_7f_1 & 0xF; fun_generateRandomness(); seqWalkerName_unknown2 = random_7f_1 & 0xF; } void fun_generateWalkerName(int walkerId) { int formation; // [sp+4Ch] [bp-4h]@1 formation = walkers[walkerId].formationId; if ( walkers[walkerId].type != Walker_Explosion ) { if ( walkers[walkerId].type != Walker_FortStandard ) { if ( walkers[walkerId].type != Walker_FishGulls ) { if ( walkers[walkerId].type != Walker_Creature ) { if ( walkers[walkerId].type != Walker_HippodromeMiniHorses ) { switch ( walkers[walkerId].type ) { case Walker_TaxCollector: walker_name[64 * walkerId] = seqWalkerName_taxCollector++ + 132; if ( seqWalkerName_taxCollector >= 32 ) seqWalkerName_taxCollector = 0; break; case Walker_Engineer: walker_name[64 * walkerId] = seqWalkerName_engineer++ + 165; if ( seqWalkerName_engineer >= 32 ) seqWalkerName_engineer = 0; break; case Walker_Prefect: walker_name[64 * walkerId] = seqWalkerName_prefect++ + 198; if ( seqWalkerName_prefect >= 32 ) seqWalkerName_prefect = 0; break; default: if ( walkers[walkerId].type != 11 && walkers[walkerId].type != 55 ) { if ( walkers[walkerId].type != 12 && walkers[walkerId].type != 56 ) { if ( walkers[walkerId].type != 13 && walkers[walkerId].type != 57 ) { switch ( walkers[walkerId].type ) { case 15: walker_name[64 * walkerId] = seqWalkerName_actor++ + 330; if ( seqWalkerName_actor >= 32 ) seqWalkerName_actor = 0; break; case 16: walker_name[64 * walkerId] = seqWalkerName_gladiator++ + 363; if ( seqWalkerName_gladiator >= 32 ) seqWalkerName_gladiator = 0; break; case 17: walker_name[64 * walkerId] = seqWalkerName_lionTamer++ + 396; if ( seqWalkerName_lionTamer >= 16 ) seqWalkerName_lionTamer = 0; break; case 18: walker_name[64 * walkerId] = seqWalkerName_charioteer++ + 413; if ( seqWalkerName_charioteer >= 16 ) seqWalkerName_charioteer = 0; break; case 19: walker_name[64 * walkerId] = seqWalkerName_trader++ + 562; if ( seqWalkerName_trader >= 16 ) seqWalkerName_trader = 0; break; case 21: walker_name[64 * walkerId] = seqWalkerName_trader++ + 562; if ( seqWalkerName_trader >= 16 ) seqWalkerName_trader = 0; break; case 58: walker_name[64 * walkerId] = seqWalkerName_barbarian++ + 430; if ( seqWalkerName_barbarian >= 32 ) seqWalkerName_barbarian = 0; break; case 20: walker_name[64 * walkerId] = seqWalkerName_tradeShip++ + 579; if ( seqWalkerName_tradeShip >= 16 ) seqWalkerName_tradeShip = 0; break; case 25: walker_name[64 * walkerId] = seqWalkerName_tradeShip++ + 579; if ( seqWalkerName_tradeShip >= 16 ) seqWalkerName_tradeShip = 0; break; case 26: walker_name[64 * walkerId] = seqWalkerName_female++ + 99; if ( seqWalkerName_female >= 32 ) seqWalkerName_female = 0; break; case 39: walker_name[64 * walkerId] = seqWalkerName_female++ + 99; if ( seqWalkerName_female >= 32 ) seqWalkerName_female = 0; break; case 27: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 28: walker_name[64 * walkerId] = seqWalkerName_citizen++ + 1; if ( seqWalkerName_citizen >= 64 ) seqWalkerName_citizen = 0; break; case 66: walker_name[64 * walkerId] = seqWalkerName_citizen++ + 1; if ( seqWalkerName_citizen >= 64 ) seqWalkerName_citizen = 0; break; case 29: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 64: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 30: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 31: walker_name[64 * walkerId] = seqWalkerName_citizen++ + 1; if ( seqWalkerName_citizen >= 64 ) seqWalkerName_citizen = 0; break; case 32: walker_name[64 * walkerId] = seqWalkerName_female++ + 99; if ( seqWalkerName_female >= 32 ) seqWalkerName_female = 0; break; case 33: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 34: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 35: walker_name[64 * walkerId] = seqWalkerName_citizen++ + 1; if ( seqWalkerName_citizen >= 64 ) seqWalkerName_citizen = 0; break; case 40: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; default: switch ( walkers[walkerId].type ) { case 0x40: walker_name[64 * walkerId] = seqWalkerName_patrician++ + 66; if ( seqWalkerName_patrician >= 32 ) seqWalkerName_patrician = 0; break; case 0x29: walker_name[64 * walkerId] = seqWalkerName_barbarian++ + 430; if ( seqWalkerName_barbarian >= 32 ) seqWalkerName_barbarian = 0; break; case 0x2A: walker_name[64 * walkerId] = seqWalkerName_prefect++ + 198; if ( seqWalkerName_prefect >= 32 ) seqWalkerName_prefect = 0; break; default: if ( walkers[walkerId].type < 43 || walkers[walkerId].type > 53 ) { walker_name[64 * walkerId] = seqWalkerName_citizen++ + 1; if ( seqWalkerName_citizen >= 64 ) seqWalkerName_citizen = 0; } else { if ( formations[formation].enemyType == Enemy_Greek ) { walker_name[64 * walkerId] = seqWalkerName_greek++ + 463; if ( seqWalkerName_greek >= 32 ) seqWalkerName_greek = 0; } else { if ( formations[formation].enemyType == Enemy_Egyptian ) { walker_name[64 * walkerId] = seqWalkerName_egyptian++ + 496; if ( seqWalkerName_egyptian >= 32 ) seqWalkerName_egyptian = 0; } else { if ( formations[formation].enemyType != 1 && formations[formation].enemyType != 5 && formations[formation].enemyType != 10 ) { if ( formations[formation].enemyType == 7 ) { walker_name[64 * walkerId] = seqWalkerName_prefect++ + 198; if ( seqWalkerName_prefect >= 32 ) seqWalkerName_prefect = 0; } else { walker_name[64 * walkerId] = seqWalkerName_barbarian++ + 430; if ( seqWalkerName_barbarian >= 32 ) seqWalkerName_barbarian = 0; } } else { walker_name[64 * walkerId] = seqWalkerName_arabian++ + 529; if ( seqWalkerName_arabian >= 32 ) seqWalkerName_arabian = 0; } } } } break; } break; } } else { walker_name[64 * walkerId] = seqWalkerName_legionary++ + 297; if ( seqWalkerName_legionary >= 32 ) seqWalkerName_legionary = 0; } } else { walker_name[64 * walkerId] = seqWalkerName_cavalry++ + 264; if ( seqWalkerName_cavalry >= 32 ) seqWalkerName_cavalry = 0; } } else { walker_name[64 * walkerId] = seqWalkerName_javelinThrower++ + 231; if ( seqWalkerName_javelinThrower >= 32 ) seqWalkerName_javelinThrower = 0; } break; } } } } } } } void fun_moveLegionTo(int x, int y, int legionId) { int walkerId; // [sp+4Ch] [bp-14h]@15 signed int i; // [sp+54h] [bp-Ch]@10 sub_5007F0(formations[legionId].fortX, formations[legionId].fortY, -2, -2); if ( grid_pathingDistance[162 * y + x + setting_map_startGridOffset] > 0 )// can move to { if ( x != formations[legionId].fortX || y != formations[legionId].fortY ) { if ( !formations[legionId].cursedByMars ) { formations[legionId].standardX = x; formations[legionId].standardY = y; formations[legionId].f03_flag = 0; if ( formations[legionId].morale <= 20 ) showWarning(51); // legion's morale too low for ( i = 0; i < 16 && formations[legionId].walkerIds[i]; ++i ) { walkerId = formations[legionId].walkerIds[i]; if ( walkers[walkerId].actionState != 149 ) { if ( walkers[walkerId].actionState != 150 ) { if ( !formations[legionId].formation_69 ) { if ( formations[legionId].formation_5e <= 1 ) { if ( formations[legionId].formation_5e == 1 ) fun_formationIncreaseMorale(legionId, 10); walkers[walkerId].inUse = 0; walkers[walkerId].actionState = 83; removeDestinationPathForWalker(walkerId); } } } } } } } } } void sub_4BA850(int formationId) { int v1; // [sp+4Ch] [bp-14h]@12 signed int i; // [sp+54h] [bp-Ch]@7 sub_5007F0( formations[formationId].fortX, formations[formationId].fortY, -2, -2); if ( grid_pathingDistance[162 * formations[formationId].y + formations[formationId].x + setting_map_startGridOffset] > 0 ) { if ( !formations[formationId].cursedByMars ) { formations[formationId].f03_flag = 1; if ( formations[formationId].layout == 6 ) formations[formationId].layout = formations[formationId].formation_5a; for ( i = 0; i < 16 && formations[formationId].walkerIds[i]; ++i ) { v1 = formations[formationId].walkerIds[i]; if ( walkers[v1].actionState != 149 ) { if ( walkers[v1].actionState != 150 ) { if ( !formations[formationId].formation_69 ) { if ( formations[formationId].formation_5e <= 1 ) { if ( formations[formationId].formation_5e == 1 ) fun_formationIncreaseMorale(formationId, 10); walkers[v1].actionState = 81; removeDestinationPathForWalker(v1); } } } } } } } } signed int fun_createFortFormation(int buildingId) { int flagId; // ST60_4@5 signed int formationId; // [sp+50h] [bp-4h]@1 fun_calculateFortTotals(); for ( formationId = 1; ; ++formationId ) { if ( formationId >= 50 ) return 0; if ( !formations[formationId].inUse ) break; } formations[formationId].inUse = 1; formations[formationId].isFort = 1; formations[formationId].formation_01 = ciid; formations[formationId].walkerType = (WalkerType)buildings[buildingId].level_resourceId; formations[formationId].buildingId = buildingId; formations[formationId].layout = 1; formations[formationId].morale = 50; formations[formationId].f03_flag = 1; formations[formationId].fortId = formationId - 1; formations[formationId].fortX = buildings[buildingId].x + 3; formations[formationId].fortY = buildings[buildingId].y - 1; formations[formationId].standardX = buildings[buildingId].x + 3; formations[formationId].standardY = buildings[buildingId].y - 1; formations[formationId].x = buildings[buildingId].x + 3; formations[formationId].y = buildings[buildingId].y - 1; flagId = spawnWalker(buildings[buildingId].cityId, Walker_FortStandard, 0, 0, 0); walkers[flagId].buildingId = buildingId; walkers[flagId].formationId = formationId; formations[formationId].bannerId = flagId; ++numForts; if ( formationId > formationId_lastInUse ) formationId_lastInUse = formationId; return formationId; } signed int fun_createFormation(WalkerType walkerType, int layout, int orientation, char x, char y) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 10; ; ++i ) { if ( i >= 50 ) return 0; if ( !formations[i].inUse ) break; } formations[i].x = x; formations[i].y = y; formations[i].inUse = 1; formations[i].isFort = 0; formations[i].formation_01 = 0; formations[i].walkerType = walkerType; formations[i].fortId = i - 10; if ( layout == 10 ) { if ( orientation && orientation != 4 ) formations[i].layout = 2; else formations[i].layout = 1; } else { formations[i].layout = layout; } formations[i].morale = 100; return i; } signed int fun_generateSoldierFromBarracks(int buildingId) { signed int result; // eax@33 signed int v2; // [sp+4Ch] [bp-20h]@4 int v3; // [sp+50h] [bp-1Ch]@16 signed int v4; // [sp+54h] [bp-18h]@4 signed int formationId; // [sp+58h] [bp-14h]@4 bool hasWeapons; // [sp+5Ch] [bp-10h]@2 int v7; // [sp+60h] [bp-Ch]@26 signed int i; // [sp+64h] [bp-8h]@4 int v9; // [sp+68h] [bp-4h]@23 hasWeapons = buildings[buildingId].industry_unitsStored <= 0; v4 = 0; formationId = 0; v2 = 10000; for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { if ( !formations[i].formation_60 ) { if ( formations[i].formation_3e > 0 ) { if ( formations[i].formation_3e != 3 || !hasWeapons ) { v3 = fun_getDistanceMaximum( buildings[buildingId].x, buildings[buildingId].y, buildings[formations[i].buildingId].x, buildings[formations[i].buildingId].y); if ( formations[i].formation_3e <= v4 ) { if ( formations[i].formation_3e == v4 ) { if ( v3 < v2 ) { v4 = formations[i].formation_3e; formationId = i; v2 = v3; } } } else { v4 = formations[i].formation_3e; formationId = i; v2 = v3; } } } } } } } if ( formationId > 0 ) { v9 = spawnWalker( buildings[buildingId].cityId, formations[formationId].walkerType, walkerGridX, walkerGridY, 0); walkers[v9].formationId = formationId; walkers[v9].byte_7FA393 = 1; if ( formations[formationId].walkerType == Walker_FortLegionary ) { if ( buildings[buildingId].industry_unitsStored > 0 ) --buildings[buildingId].industry_unitsStored; } v7 = sub_4BB640(formationId); if ( v7 ) { if ( determineAccessRoad( buildings[v7].x, buildings[v7].y, buildings[v7].size) ) { walkers[v9].actionState = 85; walkers[v9].destination_x = walkerGridX; walkers[v9].destination_y = walkerGridY; walkers[v9].word_7FA35E = 162 * walkers[v9].destination_y + walkers[v9].destination_x + setting_map_startGridOffset; } else { walkers[v9].actionState = 81; } } else { walkers[v9].actionState = 81; } } sub_4BC600(); if ( formationId ) result = 1; else result = 0; return result; } signed int fun_generateTowerSentryFromBarracks(int buildingId) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-8h]@3 int v3; // [sp+50h] [bp-4h]@16 if ( dword_7FA224 > 0 ) { for ( i = 1; ; ++i ) { if ( i >= 2000 ) return 0; if ( buildings[i].inUse == 1 && buildings[i].type == B_Tower && buildings[i].num_workers > 0 && !buildings[i].walkerId && buildings[i].haveRoadnet == buildings[buildingId].haveRoadnet ) break; } v3 = spawnWalker(buildings[buildingId].cityId, Walker_TowerSentry, walkerGridX, walkerGridY, 0); walkers[v3].actionState = -82; if ( !determineAccessRoad( buildings[i].x, buildings[i].y, buildings[i].size) ) walkers[v3].state = 2; walkers[v3].destination_x = walkerGridX; walkers[v3].destination_y = walkerGridY; buildings[i].walkerId = v3; walkers[v3].buildingId = i; result = 1; } else { result = 0; } return result; } void fun_removeTowerSentry(int x, int y) { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].type== Walker_TowerSentry ) { if ( walkers[i].actionState != 149 ) { if ( fun_getDistanceMaximum(walkers[i].x, walkers[i].y, x, y) <= 1 ) walkers[i].state = 2; } } } } } signed int sub_4BB5B0() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 && formations[i].isFort && formations[i].formation_3e > 0 ) return 1; } return 0; } signed int sub_4BB640(int a1) { signed int v2; // [sp+4Ch] [bp-14h]@1 signed int v3; // [sp+50h] [bp-10h]@1 int v4; // [sp+54h] [bp-Ch]@8 int v5; // [sp+58h] [bp-8h]@1 signed int i; // [sp+5Ch] [bp-4h]@1 v5 = formations[a1].buildingId; v2 = 0; v3 = 10000; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type == 94 ) { if ( buildings[i].num_workers >= model_buildings[buildings[i].type].laborers ) { v4 = fun_getDistanceMaximum( buildings[v5].x, buildings[v5].y, buildings[i].x, buildings[i].y); if ( v4 < v3 ) { v2 = i; v3 = v4; } } } } } return v2; } void sub_4BB790(int a1) { int v2; // [sp+50h] [bp-Ch]@15 signed int i; // [sp+54h] [bp-8h]@15 int bldFormationId = buildings[a1].formationId; formations[bldFormationId].formation_3e = 0; if ( formations[bldFormationId].f03_flag ) { if ( !formations[bldFormationId].cursedByMars ) { if ( formations[bldFormationId].numWalkers != formations[bldFormationId].maxWalkers ) { if ( formations[bldFormationId].numWalkers >= formations[bldFormationId].maxWalkers ) { v2 = formations[bldFormationId].numWalkers - formations[bldFormationId].maxWalkers; for ( i = 15; ; --i ) { if ( i >= 0 ) { if ( formations[bldFormationId].walkerIds[i] <= 0 ) continue; walkers[ formations[bldFormationId].walkerIds[i] ].actionState = 82; --v2; if ( v2 > 0 ) continue; } break; } sub_4BC600(); } else { if ( buildings[a1].level_resourceId == 13 ) formations[bldFormationId].formation_3e = 3; if ( buildings[a1].level_resourceId == 11 ) formations[bldFormationId].formation_3e = 2; if ( buildings[a1].level_resourceId == 12 ) formations[bldFormationId].formation_3e = 1; } } } } } int sub_4BB990(int a1) { fun_calculateFortTotals(); sub_4BC600(); sub_4BCF70(); sub_4BBC90(); if ( !a1 ) sub_4BBF50(); fun_setMaxSoldiersPerFort(); sub_4BDC50(); sub_4BE200(); sub_4BF500(); return 1; } void fun_calculateFortTotals() { int v0; // [sp+4Ch] [bp-8h]@7 signed int formationId; // [sp+50h] [bp-4h]@1 formationId_lastFort = 0; numForts = 0; city_inform[ciid].numLegionaryForts = 0; for ( formationId = 1; formationId < 50; ++formationId ) { if ( formations[formationId].inUse == 1 ) { if ( formations[formationId].isFort ) { formationId_lastFort = formationId; ++numForts; if ( formations[formationId].walkerType == Walker_FortLegionary ) ++city_inform[ciid].numLegionaryForts; } v0 = formations[formationId].walkerIds[0]; if ( formations[formationId].formation_56 <= 0 ) { if ( formations[formationId].walkerIds ) { if ( walkers[v0].state == 1 ) { formations[formationId].fortX = walkers[v0].x; formations[formationId].fortY = walkers[v0].y; } } } } } } signed int fun_getFormationIdOfLegion(int legionId) { signed int v2; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 v2 = 1; for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 && formations[i].isFort ) { if ( v2 == legionId ) return i; ++v2; } } return 0; } int fun_calculateNumForts() { int numForts; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 numForts = 0; for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) ++numForts; } } return numForts; } void sub_4BBC90() { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].type>= Walker_FortJavelin ) { if ( walkers[i].type<= Walker_FortLegionary ) { if ( walkers[i].actionState == 80 ) { if ( byte_7FA359[128 * i] ) --byte_7FA359[128 * i]; } } } } } } void sub_4BBD90() { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( !formations[i].formation_61 ) { if ( formations[i].isFort ) { if ( formations[i].f03_flag ) { formations[i].formation_68 = 0; formations[i].formation_69 = 0; formations[i].formation_5e = 0; fun_formationIncreaseMorale(i, 5); if ( formations[i].layout == 6 ) formations[i].layout = formations[i].formation_5a; } else { if ( !formations[i].formation_48 ) { ++formations[i].formation_68; if ( formations[i].formation_68 > 3 ) { if ( formations[i].formation_68 > 100 ) formations[i].formation_68 = 100; fun_formationIncreaseMorale(i, -5); } } } } else { fun_formationIncreaseMorale(i, 0); } } } } } void sub_4BBF50() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( !formations[i].formation_61 ) { if ( formations[i].isFort ) { if ( !formations[i].f03_flag ) { if ( !formations[i].formation_60 ) { if ( formations[i].morale <= 20 ) { if ( !formations[i].formation_5e ) { if ( !formations[i].formation_69 ) { fun_increaseMoraleOfAllForts(-10); fun_increaseMoraleOfAllEnemies(10); } } } if ( formations[i].morale > 10 ) { if ( formations[i].morale <= 20 ) ++formations[i].formation_5e; } else { ++formations[i].formation_69; } } } } else { if ( formations[i].morale <= 20 ) { if ( !formations[i].formation_5e ) { if ( !formations[i].formation_69 ) { fun_increaseMoraleOfAllForts(10); fun_increaseMoraleOfAllEnemies(-10); } } } if ( formations[i].morale > 10 ) { if ( formations[i].morale <= 20 ) ++formations[i].formation_5e; } else { ++formations[i].formation_69; } } } } } } void fun_formationDecreaseMoraleAfterComradeDeath(int a2) { int percentageDiedOff; // [sp+4Ch] [bp-4h]@1 sub_4BC600(); percentageDiedOff = getPercentage(1, formations[a2].numWalkers); if ( percentageDiedOff >= 8 ) { if ( percentageDiedOff >= 10 ) { if ( percentageDiedOff >= 14 ) { if ( percentageDiedOff >= 20 ) { if ( percentageDiedOff >= 30 ) fun_formationIncreaseMorale(a2, -20); else fun_formationIncreaseMorale(a2, -15); } else { fun_formationIncreaseMorale(a2, -12); } } else { fun_formationIncreaseMorale(a2, -10); } } else { fun_formationIncreaseMorale(a2, -7); } } else { fun_formationIncreaseMorale(a2, -5); } } void fun_formationIncreaseMorale(int formationId, __int16 moraleToAdd) { signed int maxMorale; // [sp+4Ch] [bp-4h]@3 if ( formations[formationId].walkerType == Walker_FortLegionary ) { if ( formations[formationId].hasMilitaryTraining ) maxMorale = 100; else maxMorale = 80; } else { if ( formations[formationId].walkerType == Walker_Enemy57 ) { // caesar's legions? maxMorale = 100; } else { if ( formations[formationId].walkerType != Walker_FortMounted && formations[formationId].walkerType != Walker_FortJavelin ) { // enemies if ( formations[formationId].enemyType && formations[formationId].enemyType != 1 && formations[formationId].enemyType != 2 && formations[formationId].enemyType != 3 && formations[formationId].enemyType != 4 ) { if ( formations[formationId].enemyType != 10 && formations[formationId].enemyType != 8 ) maxMorale = 70; else maxMorale = 90; } else { maxMorale = 80; } } else { if ( formations[formationId].hasMilitaryTraining ) maxMorale = 80; else maxMorale = 60; } } } formations[formationId].morale += moraleToAdd; if ( formations[formationId].morale > maxMorale ) formations[formationId].morale = maxMorale; if ( formations[formationId].morale < 0 ) formations[formationId].morale = 0; } void fun_increaseMoraleOfAllForts(__int16 a1) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( !formations[i].formation_61 ) { if ( formations[i].isFort ) fun_formationIncreaseMorale(i, a1); } } } } void fun_increaseMoraleOfAllEnemies(__int16 a1) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( !formations[i].formation_61 ) { if ( !formations[i].isFort ) fun_formationIncreaseMorale(i, a1); } } } } void sub_4BC600() { int v0; // [sp+4Ch] [bp-14h]@43 int v1; // [sp+54h] [bp-Ch]@14 signed int j; // [sp+58h] [bp-8h]@3 signed int l; // [sp+58h] [bp-8h]@27 signed int n; // [sp+58h] [bp-8h]@43 signed int i; // [sp+5Ch] [bp-4h]@1 signed int k; // [sp+5Ch] [bp-4h]@7 signed int m; // [sp+5Ch] [bp-4h]@33 signed int ii; // [sp+5Ch] [bp-4h]@58 for ( i = 1; i < 50; ++i ) { for ( j = 0; j < 16; ++j ) formations[i].walkerIds[j] = 0; formations[i].numWalkers = 0; formations[i].f03_flag = 1; formations[i].formation_42 = 0; formations[i].formation_44 = 0; } for ( k = 1; k < 1000; ++k ) { if ( walkers[k].state != 1 ) continue; if ( walkers[k].type < Walker_FortJavelin || walkers[k].type > Walker_FortLegionary ) { if ( walkers[k].type < 43 || walkers[k].type > 53 ) { if ( walkers[k].type < 55 || walkers[k].type > 57 ) { if ( walkers[k].type < 68 || walkers[k].type > 70 ) continue; v1 = walkers[k].formationId; } else { v1 = walkers[k].formationId; } } else { v1 = walkers[k].formationId; } } else { v1 = walkers[k].formationId; } ++formations[v1].numWalkers; formations[v1].formation_44 += byte_5F60F5[10 * walkers[k].type]; formations[v1].formation_42 += byte_7FA359[128 * k]; if ( walkers[k].byte_7FA393 != 1 ) formations[v1].f03_flag = 0; for ( l = 0; l < 16; ++l ) { if ( !formations[v1].walkerIds[l] ) { formations[v1].walkerIds[l] = k; byte_7FA392[128 * k] = l; break; } } } dword_819848 = 0; dword_7FA234 = 0; dword_7F87A8 = 0; dword_7F87AC = 0; for ( m = 1; m < 50; ++m ) { if ( formations[m].inUse == 1 ) { if ( !formations[m].formation_61 ) { if ( formations[m].isFort ) { if ( formations[m].numWalkers > 0 ) { v0 = formations[m].formation_52; formations[m].formation_52 = 1; for ( n = 0; n < formations[m].numWalkers; ++n ) { if ( formations[m].walkerIds[n] ) { if ( walkers[ formations[m].walkerIds[n] ].direction != 8 ) formations[m].formation_52 = 0; } } ++dword_7F87A8; dword_7F87AC += formations[m].numWalkers; if ( formations[m].walkerType == Walker_FortLegionary ) { if ( !v0 ) { if ( formations[m].formation_52 == 1 ) sound_playChannel(158); } dword_7F87AC += formations[m].numWalkers >> 1; } } } else { if ( formations[m].numWalkers <= 0 ) { memset( &formations[m], 0, sizeof(Formation) ); } else { ++dword_819848; dword_7FA234 += formations[m].numWalkers; } } } } } city_inform[ciid].byte_65458D = 0; city_inform[ciid].byte_65458F = 0; city_inform[ciid].byte_65458C = 0; for ( ii = 1; ii < 50; ++ii ) { if ( formations[ii].inUse == 1 ) { if ( formations[ii].isFort ) { ++city_inform[ciid].byte_65458C; if ( formations[ii].fortEmpireServiceFlag ) { if (formations[ii].numWalkers > 0 ) ++city_inform[ciid].byte_65458D; } city_inform[ciid].byte_65458F += formations[ii].numWalkers; } } } } void fun_setMaxSoldiersPerFort() { signed int i; // [sp+54h] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { formations[i].maxWalkers = buildings[formations[i].buildingId].num_workers; formations[i].maxWalkers = 16; if ( formations[i].maxWalkers > 16 ) formations[i].maxWalkers = 16; if ( formations[i].maxWalkers < 0 ) formations[i].maxWalkers = 0; } } } } int fun_getInvasionGridOffset(int invasionId) { int result; // eax@13 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; ; ++i ) { if ( i >= 50 ) return 0; if ( formations[i].inUse == 1 && !formations[i].isFort && !formations[i].formation_61 && formations[i].invasionInternalId == invasionId ) break; } if ( formations[i].fortX > 0 || formations[i].fortY > 0 ) result = 162 * formations[i].fortY + formations[i].fortX + setting_map_startGridOffset; else result = 0; return result; } int sub_4BCF70() { int result; // eax@2 int v1; // [sp+4Ch] [bp-10h]@12 int v2; // [sp+50h] [bp-Ch]@9 signed int i; // [sp+58h] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( !formations[i].formation_61 ) { if ( formations[i].fortX >= formations[i].formation_64 ) v2 = formations[i].fortX - formations[i].formation_64; else v2 = formations[i].formation_64 - formations[i].fortX; if ( formations[i].fortY >= formations[i].formation_65 ) v1 = formations[i].fortY - formations[i].formation_65; else v1 = formations[i].formation_65 - formations[i].fortY; /*if( formation_65[128 * i + 1] ) { --formation_65[128 * i + 1]; }*/ if( formations[i].orientation ) { --formations[i].orientation; } else { if ( formations[i].formation_54 ) { formations[i].formation_63 = walkers[formations[i].walkerIds[0]].direction; } else { if ( formations[i].layout != 6 ) { if ( formations[i].layout != 7 ) { if ( formations[i].layout != 8 ) { if ( formations[i].layout != 9 ) { if ( formations[i].layout != 12 ) { if ( formations[i].layout != 1 && formations[i].layout != 3 ) { if ( formations[i].layout != 2 && formations[i].layout != 4 ) { if ( !formations[i].layout || formations[i].layout == 5 ) { if ( v2 <= v1 ) { if ( formations[i].fortY >= formations[i].formation_65 ) { if ( formations[i].fortY > formations[i].formation_65 ) formations[i].formation_63 = 4; } else { formations[i].formation_63 = 0; } } else { if ( formations[i].fortX >= formations[i].formation_64 ) { if ( formations[i].fortX > formations[i].formation_64 ) formations[i].formation_63 = 2; } else { formations[i].formation_63 = 6; } } } } else { if ( formations[i].fortX >= formations[i].formation_64 ) { if ( formations[i].fortX > formations[i].formation_64 ) formations[i].formation_63 = 2; } else { formations[i].formation_63 = 6; } } } else { if ( formations[i].fortY >= formations[i].formation_65 ) { if ( formations[i].fortY > formations[i].formation_65 ) formations[i].formation_63 = 4; } else { formations[i].formation_63 = 0; } } } } } } } } } formations[i].formation_64 = formations[i].fortX; formations[i].formation_65 = formations[i].fortY; } } result = i + 1; } return result; } void fun_clearFormations() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 50; ++i ) fun_memset(&formations[i].inUse, 128, 0); formationId_lastInUse = 0; formationId_lastFort = 0; numForts = 0; } void deleteFormation(int formationId) { if ( formationId > 0 ) { if ( formations[formationId].inUse ) { if ( formations[formationId].bannerId ) deleteWalker(formations[formationId].bannerId); memset(&formations[formationId], 0, sizeof(Formation)); fun_calculateFortTotals(); } } } void sub_4BD5C0() { int v0; // [sp+4Ch] [bp-10h]@1 int v1; // [sp+50h] [bp-Ch]@23 signed int j; // [sp+54h] [bp-8h]@20 signed int i; // [sp+58h] [bp-4h]@1 city_inform[ciid].byte_654582 = 0; v0 = 0; for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { if ( formations[i].fortEmpireServiceFlag ) { if ( formations[i].numWalkers > 0 ) { formations[i].formation_60 = 1; formations[i].f03_flag = 0; ++v0; if ( formations[i].hasMilitaryTraining ) { if ( formations[i].walkerType == 13 ) city_inform[ciid].byte_654582 += 3 * formations[i].numWalkers; else city_inform[ciid].byte_654582 += 2 * formations[i].numWalkers; } else { if ( formations[i].walkerType == 13 ) city_inform[ciid].byte_654582 += 2 * formations[i].numWalkers; else city_inform[ciid].byte_654582 += formations[i].numWalkers; } for ( j = 0; j < formations[i].numWalkers; ++j ) { v1 = *(__int16 *)((char *)&formations[i].walkerIds[0] + 2 * j); if ( v1 > 0 ) { if ( walkers[v1].state == 1 ) { if ( walkers[v1].actionState != 149 ) walkers[v1].actionState = 87; } } } } } } } } if ( v0 > 0 ) city_inform[ciid].byte_654585 = scn_distantBattle_romanTravelTime; } int sub_4BD8D0() { int result; // eax@2 int v1; // [sp+4Ch] [bp-Ch]@13 signed int j; // [sp+50h] [bp-8h]@10 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { if ( formations[i].formation_60 ) { formations[i].formation_60 = 0; for ( j = 0; j < formations[i].numWalkers; ++j ) { v1 = formations[i].walkerIds[j]; if ( v1 > 0 ) { if ( walkers[v1].state == 1 ) { if ( walkers[v1].actionState!= 149 ) { walkers[v1].actionState = 88; walkers[v1].byte_7FA393 = 1; } } } } } } } result = i + 1; } return result; } void sub_4BDA20(int a1) { int v1; // [sp+4Ch] [bp-14h]@20 int v2; // [sp+50h] [bp-10h]@10 int v3; // [sp+54h] [bp-Ch]@13 int v4; // [sp+54h] [bp-Ch]@25 signed int j; // [sp+58h] [bp-8h]@10 signed int k; // [sp+58h] [bp-8h]@22 int i; // [sp+5Ch] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { if ( formations[i].formation_60 ) { fun_formationIncreaseMorale(i, -75); v2 = 0; for ( j = 0; j < formations[i].numWalkers; ++j ) { v3 = formations[i].walkerIds[j]; if ( v3 > 0 ) { if ( walkers[v3].state == 1 ) { if ( walkers[v3].actionState != 149 ) ++v2; } } } v1 = fun_adjustWithPercentage(v2, a1); if ( v1 >= v2 ) { formations[i].f03_flag = 1; formations[i].formation_60 = 0; } for ( k = 0; k < formations[i].numWalkers; ++k ) { v4 = formations[i].walkerIds[k]; if ( v4 > 0 ) { if ( walkers[v4].state == 1 ) { if ( walkers[v4].actionState != 149 ) { if ( v1 ) { --v1; walkers[v4].state = 2; } } } } } } } } } } int sub_4BDC50() { int result; // eax@2 int v1; // [sp+4Ch] [bp-Ch]@28 int v2; // [sp+4Ch] [bp-Ch]@42 signed int j; // [sp+50h] [bp-8h]@18 signed int k; // [sp+50h] [bp-8h]@25 signed int l; // [sp+50h] [bp-8h]@39 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 1; i <= 6; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { if ( formations[i].cursedByMars ) --formations[i].cursedByMars; if ( formations[i].formation_54 ) --formations[i].formation_54; if ( formations[i].formation_56 ) --formations[i].formation_56; if ( formations[i].formation_48 ) --formations[i].formation_48; if ( city_inform[ciid].imperialArmyComing <= 0 ) { formations[i].formation_48 = 0; formations[i].formation_56 = 0; formations[i].formation_54 = 0; } for ( j = 0; j < 16; ++j ) { if ( walkers[ formations[i].walkerIds[j] ].actionState == 150 ) formations[i].formation_48 = 6; } if ( formations[i].formation_69 || formations[i].formation_5e ) { for ( k = 0; k < 16; ++k ) { v1 = formations[i].walkerIds[ k ]; if ( walkers[v1].actionState != 150 ) { if ( walkers[v1].actionState != 149 ) { if ( walkers[v1].actionState != 148 ) { walkers[v1].actionState = -108; removeDestinationPathForWalker(v1); } } } } } else { if ( formations[i].layout == 6 ) { if ( dword_819848 + city_inform[ciid].rioting + city_inform[ciid].dword_654648 > 0 ) { for ( l = 0; l < 16; ++l ) { v2 = formations[i].walkerIds[ l ]; if ( v2 > 0 ) { if (walkers[v2].actionState != 150 ) { if ( walkers[v2].actionState != 149 ) walkers[v2].actionState = 86; } } } } else { formations[i].layout = formations[i].formation_5a; } } } } } result = i + 1; } return result; } char unused_4BE060(int a1) { int v1; // eax@1 int v3; // [sp+4Ch] [bp-4h]@1 _LOBYTE(v1) = (_BYTE)a1 << 7; v3 = formations[a1].walkerIds[0]; if ( formations[a1].walkerIds[0] ) { v1 = walkers[v3].state; if ( v1 == 1 ) { formations[a1].fortX = walkers[v3].x; _LOBYTE(v1) = walkers[v3].y; formations[a1].fortY = v1; } } return v1; } void sub_4BE0F0() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 25; ++i ) { dword_7FA2C0[i] = 0; dword_862DE0[i] = 0; dword_862D60[i] = 0; dword_819860[i] = 0; *(_DWORD *)&dword_819760[4 * i] = 0; *(_DWORD *)&dword_8197E0[4 * i] = 0; *(_DWORD *)&dword_7FA1C0[2 * i] = 0; dword_7FA240[i] = 0; } dword_819848 = 0; dword_7FA234 = 0; dword_7F87A8 = 0; dword_7F87AC = 0; dword_863318 = 0; } void sub_4BE200() { signed int v0; // [sp+4Ch] [bp-40h]@1 int v1; // [sp+5Ch] [bp-30h]@68 signed int v2; // [sp+60h] [bp-2Ch]@79 signed int v3; // [sp+64h] [bp-28h]@79 signed int v4; // [sp+68h] [bp-24h]@79 signed int v5; // [sp+6Ch] [bp-20h]@68 signed int v6; // [sp+70h] [bp-1Ch]@68 signed int v7; // [sp+74h] [bp-18h]@68 signed int v8; // [sp+78h] [bp-14h]@68 int v9; // [sp+7Ch] [bp-10h]@35 int v10; // [sp+80h] [bp-Ch]@34 int v11; // [sp+80h] [bp-Ch]@47 int v12; // [sp+80h] [bp-Ch]@55 signed int m; // [sp+84h] [bp-8h]@2 signed int i; // [sp+84h] [bp-8h]@8 signed int k; // [sp+84h] [bp-8h]@32 signed int l; // [sp+84h] [bp-8h]@44 int j; // [sp+88h] [bp-4h]@11 v0 = 0; if ( dword_819848 > 0 ) { ++dword_863318; if ( dword_863318 > 4 ) { dword_863318 = 0; sub_4C04D0(); } for ( i = 0; i < 25; ++i ) { dword_7FA2C0[i] = 0; *(_DWORD *)&dword_8198E0[2 * i] = 0; } for ( j = 1; j < 50; ++j ) { if ( formations[j].inUse == 1 ) { if ( !formations[j].isFort ) { if ( !formations[j].formation_61 ) { if ( dword_7FA234 > 2 * dword_7F87AC ) { if ( formations[j].walkerType != 11 ) dword_7FA240[formations[j].invasionId] = 1; } if ( formations[j].formation_54 ) --formations[j].formation_54; if ( formations[j].formation_56 ) --formations[j].formation_56; if ( formations[j].formation_48 ) --formations[j].formation_48; if ( city_inform[ciid].dword_654598 <= 0 ) { formations[j].formation_48 = 0; formations[j].formation_56 = 0; formations[j].formation_54 = 0; } for ( k = 0; k < 16; ++k ) { v10 = formations[j].walkerIds[k]; if ( walkers[v10].actionState == 150 ) { v9 = walkers[v10].wlk_ID_pp; if ( walkers[v9].state == 1 ) { if ( walkers[v9].actionState != 149 ) { if ( walkers[v9].type >= 11 ) { if ( walkers[v9].type <= 13 ) formations[j].formation_48 = 6; } } } } } if ( formations[j].formation_69 || formations[j].formation_5e ) { for ( l = 0; l < 16; ++l ) { v11 = formations[j].walkerIds[l]; if ( walkers[v11].actionState != 150 ) { if ( walkers[v11].actionState != 149 ) { if ( walkers[v11].actionState != 148 ) { walkers[v11].actionState = -108; removeDestinationPathForWalker(v11); } } } } } else { v12 = formations[j].walkerIds[0]; if ( formations[j].walkerIds[0] ) { if ( walkers[v12].state == 1 ) { formations[j].fortX = walkers[v12].x; formations[j].fortY = walkers[v12].y; } } if ( !dword_7FA2C0[formations[j].invasionId] ) { dword_7FA2C0[formations[j].invasionId] = j; dword_862DE0[formations[j].invasionId] = formations[j].fortX; dword_862D60[formations[j].invasionId] = formations[j].fortY; dword_819860[formations[j].invasionId] = formations[j].layout; v0 = 0; sub_501B60( formations[j].fortX, formations[j].fortY, -2, -2, 100000, 300); if ( sub_4C0910( formations[j].fortX, formations[j].fortY, 16) ) { v0 = 1; } else { if ( sub_4C0910(formations[j].fortX,formations[j].fortY,32) ) v0 = 2; } if ( dword_7FA240[formations[j].invasionId] ) v0 = 0; if ( v0 == 1 ) { *(_DWORD *)&dword_819760[4 * formations[j].invasionId] = walkerGridX; *(_DWORD *)&dword_8197E0[4 * formations[j].invasionId] = walkerGridY; *(_DWORD *)&dword_7FA1C0[2 * formations[j].invasionId] = 0; } else { sub_4C0AF0(j); sub_4BF390(j); *(_DWORD *)&dword_819760[4 * formations[j].invasionId] = formations[j].f34; *(_DWORD *)&dword_8197E0[4 * formations[j].invasionId] = formations[j].f35; *(_DWORD *)&dword_7FA1C0[2 * formations[j].invasionId] = formations[j].f36; } } formations[j].formation_50 = dword_8198E0[2 * formations[j].invasionId]; ++*(_DWORD *)&dword_8198E0[2 * formations[j].invasionId]; ++formations[j].formation_46; formations[j].f34 = dword_819760[4 * formations[j].invasionId]; formations[j].f35 = dword_8197E0[4 * formations[j].invasionId]; formations[j].f36 = dword_7FA1C0[2 * formations[j].invasionId]; v8 = 0; v7 = 0; v6 = 0; v5 = 0; v1 = 0; if ( formations[j].formation_54 ) { v7 = 1; } else { if ( formations[j].formation_56 ) { v6 = 1; v1 = formations[j].formation_58; } else { if ( formations[j].formation_46 >= 32 ) { if ( dword_7FA240[formations[j].invasionId] ) { v7 = 0; v8 = 0; v5 = 1; } else { if ( dword_819860[formations[j].invasionId] != 8 && dword_819860[formations[j].invasionId] != 12 ) { if ( v0 ) { _LOWORD(v4) = 6; _LOWORD(v3) = 4; _LOWORD(v2) = 2; } else { _LOWORD(v4) = 1; _LOWORD(v3) = 12; _LOWORD(v2) = 1; } } else { if ( formations[j].formation_50 ) { switch ( formations[j].formation_50 ) { case 1: v4 = 2; v3 = 4; v2 = 2; break; case 2: v4 = 2; v3 = 5; v2 = 3; break; case 3: v4 = 2; v3 = 5; v2 = 3; break; default: v4 = 2; v3 = 6; v2 = 4; break; } } else { v4 = 2; v3 = 4; v2 = 2; } if ( !v0 ) { v3 += 6; --v2; --v4; } } if ( formations[j].formation_4e ) { formations[j].formation_4a = 0; formations[j].formation_4c = 0; v7 = 1; --formations[j].formation_4e; if ( formations[j].formation_4e <= 0 ) { formations[j].formation_4c = v4; sub_4C0410(j); v8 = 0; v7 = 1; } } else { if ( formations[j].formation_4c ) { formations[j].formation_4a = 0; formations[j].formation_4e = 0; v8 = 1; --formations[j].formation_4c; if ( formations[j].formation_4c <= 0 ) { formations[j].formation_4a = v3; sub_4C0410(j); v5 = 1; v8 = 0; } } else { formations[j].formation_4c = 0; formations[j].formation_4e = 0; v5 = 1; --formations[j].formation_4a; if ( formations[j].formation_4a <= 0 ) { formations[j].formation_4e = v2; sub_4C0410(j); v7 = 1; v5 = 0; } } } } } else { v8 = 1; formations[j].formation_4a = 4; } } } if ( formations[j].formation_46 > 32 ) fun_killEnemiesSpiritOfMars(); if ( v7 ) { formations[j].f34 = formations[j].fortX; formations[j].f35 = formations[j].fortY; } else { if ( v6 ) { if ( v1 > 0 ) { if ( formations[v1].numWalkers > 0 ) { formations[j].f34 = formations[v1].fortX; formations[j].f35 = formations[v1].fortY; } } else { formations[j].f34 = dword_819760[4 * formations[j].invasionId]; formations[j].f35 = dword_8197E0[4 * formations[j].invasionId]; } } else { if ( v8 ) { if ( sub_4C1280( j, *(&dword_5FA968[160 * dword_819860[formations[j].invasionId]] + 40 * (formations[j].orientation >> 1) + 2 * formations[j].formation_50) + dword_862DE0[formations[j].invasionId], *(_DWORD *)((char *)&dword_5FA968[160 * dword_819860[formations[j].invasionId] + 1] + 40 * (formations[j].orientation >> 1) + 2 * formations[j].formation_50) + dword_862D60[formations[j].invasionId]) ) { formations[j].f34 = dword_7FA1AC; formations[j].f35 = dword_7FA1A8; } } else { if ( v5 ) { if ( sub_4C1280( j, *(&dword_5FA968[160 * dword_819860[formations[j].invasionId]] + 40 * (formations[j].orientation >> 1) + 2 * formations[j].formation_50) + *(_DWORD *)&dword_819760[4 * formations[j].invasionId], *(_DWORD *)((char *)&dword_5FA968[160 * dword_819860[formations[j].invasionId] + 1] + 40 * (formations[j].orientation >> 1) + 2 * formations[j].formation_50) + *(_DWORD *)&dword_8197E0[4 * formations[j].invasionId]) ) { formations[j].f34 = dword_7FA1AC; formations[j].f35 = dword_7FA1A8; } } } } } } } } } } sub_4C0F10(0); } else { for ( m = 0; m < 25; ++m ) dword_7FA240[m] = 0; sub_4C0F10(0); } } void sub_4BF390(int a1) { if ( sub_501B60( formations[a1].fortX, formations[a1].fortY, formations[a1].f34, formations[a1].f35, formations[a1].f36, 400) || sub_502510( formations[a1].fortX, formations[a1].fortY, formations[a1].f34, formations[a1].f35) ) { if ( sub_502C50( 8, formations[a1].fortX, formations[a1].fortY, formations[a1].f34, formations[a1].f35, 20) ) { formations[a1].f34 = walkerGridX; formations[a1].f35 = walkerGridY; } } } void sub_4BF500() { int wolfId; // eax@18 signed int v1; // [sp+50h] [bp-28h]@19 signed int v2; // [sp+54h] [bp-24h]@43 signed int v3; // [sp+58h] [bp-20h]@39 signed int v4; // [sp+5Ch] [bp-1Ch]@43 int v5; // [sp+68h] [bp-10h]@60 int v6; // [sp+6Ch] [bp-Ch]@22 int v7; // [sp+6Ch] [bp-Ch]@29 int curWalkerId; // [sp+6Ch] [bp-Ch]@53 signed int j; // [sp+70h] [bp-8h]@19 signed int k; // [sp+70h] [bp-8h]@50 signed int i; // [sp+74h] [bp-4h]@3 if ( city_inform[ciid].word_6543A2 > 0 ) { for ( i = 1; ; ++i ) { if ( i >= 50 ) return; if ( formations[i].inUse == 1 ) { if ( !formations[i].isFort ) { if ( formations[i].formation_61 ) { if ( formations[i].numWalkers > 0 ) { if ( formations[i].numWalkers < formations[i].maxWalkers ) { if ( formations[i].walkerType == Walker_Wolf ) { ++formations[i].formation_6b; if ( formations[i].formation_6b > 32 ) { formations[i].formation_6b = 0; if ( !(grid_terrain[162 * formations[i].y + formations[i].x + setting_map_startGridOffset] & 0xD73F) ) { wolfId = spawnWalker( 1, formations[i].walkerType, formations[i].x, formations[i].y, 0); walkers[wolfId].actionState = -60; walkers[wolfId].formationId = i; walkers[wolfId].word_7FA366 = wolfId & 0x1F; } } } } v1 = 0; for ( j = 0; j < 16; ++j ) { v6 = formations[i].walkerIds[j]; if ( v6 > 0 ) { if ( walkers[v6].actionState == 150 ) ++v1; } } if ( formations[i].formation_56 ) v1 = 1; v7 = formations[i].walkerIds[0]; if ( formations[i].walkerIds[0] ) { if ( walkers[v7].state == 1 ) { formations[i].fortX = walkers[v7].x; formations[i].fortY = walkers[v7].y; } } switch ( formations[i].walkerType ) { case Walker_Sheep: v4 = 8; v3 = 20; v2 = 0; v1 = 0; break; case Walker_Zebra: v4 = 20; v3 = 4; v2 = 0; v1 = 0; break; case Walker_Wolf: v4 = 16; v3 = 6; v2 = 1; break; } if ( v1 ) formations[i].formation_46 = v3 + 1; ++formations[i].formation_46; if ( formations[i].formation_46 > v3 ) { formations[i].formation_46 = 0; if ( v1 ) { formations[i].f34 = formations[i].fortX; formations[i].f35 = formations[i].fortY; LABEL_50: for ( k = 0; k < 16; ++k ) { curWalkerId = formations[i].walkerIds[k]; if ( curWalkerId > 0 ) { if ( walkers[curWalkerId].actionState != 150 ) { if ( walkers[curWalkerId].actionState != 149 ) { walkers[curWalkerId].word_7FA366 = 401; if ( v1 ) { v5 = sub_4AD500(walkers[curWalkerId].x, walkers[curWalkerId].y, 6); if ( v5 ) { walkers[curWalkerId].actionState = -57; walkers[curWalkerId].destination_x = walkers[v5].x; walkers[curWalkerId].destination_y = walkers[v5].y; walkers[curWalkerId].word_7FA3B0 = v5; walkers[v5].wlk_ID_mm = curWalkerId; walkers[curWalkerId].word_7FA3B6 = walkers[v5].word_7FA3B4; removeDestinationPathForWalker(curWalkerId); } else { walkers[curWalkerId].actionState = -60; } } else { walkers[curWalkerId].actionState = -60; } } } } } continue; } if ( sub_4BFE10( i, v2, formations[i].fortX, formations[i].fortY, v4, formations[i].formation_6c) ) { formations[i].formation_6c = 0; if ( sub_4C1280(i, walkerGridX, walkerGridY) ) { formations[i].f34 = dword_7FA1AC; formations[i].f35 = dword_7FA1A8; if ( formations[i].walkerType == Walker_Wolf ) { --city_inform[ciid].byte_6545A4; if ( city_inform[ciid].byte_6545A4 <= 0 ) { city_inform[ciid].byte_6545A4 = 12; sound_playChannel(156); } } goto LABEL_50; } } } } } } } } } } void sub_4BFCC0(int a1, int a2) { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 1; i < 50; ++i ) { if ( formations[i].inUse == 1 ) { if ( !formations[i].isFort ) { if ( formations[i].formation_61 ) { if ( formations[i].numWalkers > 0 ) { if ( fun_getDistanceMaximum( a1, a2, formations[i].fortX, formations[i].fortY) <= 6 ) { formations[i].formation_46 = 50; formations[i].formation_6c = fun_walkerGetSimpleDestinationDirection( a1, a2, formations[i].fortX, formations[i].fortY); } } } } } } } signed int sub_4BFE10(int a1, signed int a2, int a3, int a4, int a5, int a6) { int v7; // [sp+4Ch] [bp-10h]@23 int v8; // [sp+50h] [bp-Ch]@21 int v9; // [sp+54h] [bp-8h]@1 signed int i; // [sp+58h] [bp-4h]@3 v9 = (a1 + random_7f_1) & 6; if ( a6 ) { v9 = a6; a2 = 1; } for ( i = 0; i < 4; ++i ) { if ( v9 ) { switch ( v9 ) { case 1: v8 = a5 + a3; v7 = a4 - a5; break; case 2: v8 = a5 + a3; v7 = a4; break; case 3: v8 = a5 + a3; v7 = a5 + a4; break; case 4: v8 = a3; v7 = a5 + a4; break; case 5: v8 = a3 - a5; v7 = a5 + a4; break; case 6: v8 = a3 - a5; v7 = a4; break; case 7: v8 = a3 - a5; v7 = a4 - a5; break; } } else { v8 = a3; v7 = a4 - a5; } if ( v8 > 0 ) { if ( v7 > 0 ) { if ( v8 < setting_map_width - 1 ) { if ( v7 >= setting_map_height - 1 ) v7 = setting_map_height - 2; } else { v8 = setting_map_width - 2; } } else { v7 = 1; } } else { v8 = 1; } if ( sub_48BAC0(v8, v7, a2) ) return 1; v9 += 2; if ( v9 > 6 ) v9 = 0; } return 0; } void fun_killEnemiesSpiritOfMars() { int gridOffset; // [sp+4Ch] [bp-Ch]@1 int v1; // [sp+50h] [bp-8h]@3 signed int i; // [sp+54h] [bp-4h]@3 gridOffset = 0; if ( city_inform[ciid].dword_6544F4 > 0 ) { v1 = city_inform[ciid].dword_6544F4; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( v1 <= 0 ) break; if ( walkers[i].type< Walker_Enemy43 || walkers[i].type> Walker_Enemy53 ) { if ( walkers[i].type>= Walker_Enemy55 ) { if ( walkers[i].type<= Walker_Enemy57 ) { walkers[i].actionState = actionWalkerDie; --v1; if ( !gridOffset ) gridOffset = walkers[i].gridOffset; } } } else { walkers[i].actionState = actionWalkerDie; --v1; if ( !gridOffset ) gridOffset = walkers[i].gridOffset; } } } city_inform[ciid].dword_6544F4 = 0; message_usePopup = 1; fun_postMessageToPlayer(105, 0, gridOffset); } } void killAllWalkersExcludeEnemies() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].type < Walker_Enemy43 || walkers[i].type > Walker_Enemy53 ) { if ( walkers[i].type>= Walker_Enemy55 ) { if ( walkers[i].type<= Walker_Enemy57 ) walkers[i].actionState = actionWalkerDie; } } else { walkers[i].actionState = actionWalkerDie; } } } } signed int sub_4C02C0() { signed int result; // eax@14 int curWalkerID; // [sp+4Ch] [bp-18h]@17 int v2; // [sp+50h] [bp-14h]@8 int v3; // [sp+54h] [bp-10h]@1 signed int v4; // [sp+58h] [bp-Ch]@1 signed int j; // [sp+5Ch] [bp-8h]@15 signed int i; // [sp+60h] [bp-4h]@1 v4 = 0; v3 = 0; for ( i = 1; i <= 6; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { v2 = formations[i].numWalkers; if ( formations[i].walkerType == Walker_FortLegionary ) v2 *= 2; if ( v2 > v3 ) { v3 = v2; v4 = i; } } } } if ( v4 > 0 ) { for ( j = 0; j < 15; ++j ) //WTF 15? { curWalkerID = formations[v4].walkerIds[j]; if ( curWalkerID > 0 ) walkers[curWalkerID].actionState = 82; } formations[v4].cursedByMars = 96; sub_4BC600(); result = 1; } else { result = 0; } return result; } void sub_4C0410(int a1) { int v1; // [sp+4Ch] [bp-8h]@4 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 16; ++i ) { v1 = *(__int16 *)((char *)&formations[a1].walkerIds[0] + 2 * i); if ( v1 > 0 ) { if ( walkers[v1].actionState != 150 ) { if ( walkers[v1].actionState != 149 ) { walkers[v1].actionState = -105; walkers[v1].word_7FA366 = 0; } } } } } void sub_4C04D0() { signed int i; // [sp+4Ch] [bp-4h]@1 fun_memset(byte_902EC0, 26244, 0); for ( i = 1; i <= 6; ++i ) { if ( formations[i].inUse == 1 ) { if ( formations[i].isFort ) { if ( formations[i].numWalkers > 0 ) sub_4C0730(formations[i].fortX, formations[i].fortY, 7, 1); if ( formations[i].numWalkers > 3 ) sub_4C0730(formations[i].fortX, formations[i].fortY, 6, 1); if ( formations[i].numWalkers > 6 ) sub_4C0730(formations[i].fortX, formations[i].fortY, 5, 1); if ( formations[i].numWalkers > 9 ) sub_4C0730(formations[i].fortX, formations[i].fortY, 4, 1); if ( formations[i].numWalkers > 12 ) sub_4C0730(formations[i].fortX, formations[i].fortY, 3, 1); if ( formations[i].numWalkers > 15 ) sub_4C0730(formations[i].fortX, formations[i].fortY, 2, 1); } } } } void sub_4C0730(int a1, int a2, int a3, char a4) { int v4; // [sp+4Ch] [bp-1Ch]@1 int v5; // [sp+50h] [bp-18h]@1 int v6; // [sp+54h] [bp-14h]@1 int v7; // [sp+58h] [bp-10h]@1 int v8; // [sp+60h] [bp-8h]@14 int v9; // [sp+64h] [bp-4h]@9 v5 = a3 + a1; v4 = a3 + a2; v7 = a1 - a3; v6 = a2 - a3; if ( a1 - a3 < 0 ) v7 = 0; if ( v6 < 0 ) v6 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; v9 = 162 * v6 + v7 + setting_map_startGridOffset; walkerGridY = v6; while ( walkerGridY <= v4 ) { walkerGridX = v7; while ( walkerGridX <= v5 ) { byte_902EC0[v9] += a4; v8 = grid_walkerIds[v9]; if ( v8 > 0 ) { if ( walkers[v8].type >= 11 ) { if ( walkers[v8].type <= 13 ) byte_902EC0[v9] += 2; } } ++walkerGridX; ++v9; } ++walkerGridY; v9 += 162 - (v5 - v7 + 1); } } signed int sub_4C0910(int a1, int a2, int a3) { signed int result; // eax@21 int v4; // [sp+4Ch] [bp-28h]@22 int v5; // [sp+50h] [bp-24h]@22 signed int v6; // [sp+54h] [bp-20h]@9 int v7; // [sp+5Ch] [bp-18h]@1 int v8; // [sp+60h] [bp-14h]@1 int v9; // [sp+64h] [bp-10h]@1 int v10; // [sp+68h] [bp-Ch]@1 int v11; // [sp+70h] [bp-4h]@9 v8 = a3 + a1; v7 = a3 + a2; v10 = a1 - a3; v9 = a2 - a3; if ( a1 - a3 < 0 ) v10 = 0; if ( v9 < 0 ) v9 = 0; if ( v8 >= setting_map_width ) v8 = setting_map_width - 1; if ( v7 >= setting_map_height ) v7 = setting_map_height - 1; v6 = 0; v11 = 162 * v9 + v10 + setting_map_startGridOffset; walkerGridY = v9; while ( walkerGridY <= v7 ) { walkerGridX = v10; while ( walkerGridX <= v8 ) { if ( grid_pathingDistance[v11] > 0 ) { if ( byte_902EC0[v11] > v6 ) { v6 = byte_902EC0[v11]; v5 = walkerGridX; v4 = walkerGridY; } } ++walkerGridX; ++v11; } ++walkerGridY; v11 += 162 - (v8 - v10 + 1); } if ( v6 > 0 ) { walkerGridX = v5; walkerGridY = v4; result = 1; } else { result = 0; } return result; } void sub_4C0AF0(int a1) { signed int v1; // [sp+4Ch] [bp-20h]@3 int v2; // [sp+50h] [bp-1Ch]@18 int v3; // [sp+50h] [bp-1Ch]@39 signed int v4; // [sp+54h] [bp-18h]@3 signed int v5; // [sp+58h] [bp-14h]@3 int v6; // [sp+60h] [bp-Ch]@1 signed int j; // [sp+64h] [bp-8h]@10 signed int l; // [sp+64h] [bp-8h]@31 signed int i; // [sp+68h] [bp-4h]@3 signed int k; // [sp+68h] [bp-4h]@24 v6 = formations[a1].attackType; if ( v6 == 4 ) v6 = random_7f_1 & 3; v5 = 100; v4 = 0; v1 = 10000; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 && !byte_902EC0[buildings[i].gridOffset] ) { for ( j = 0; j < 100 && j <= v5 && *(__int16 *)((char *)&word_5FC9E8[100 * v6] + 2 * j); ++j ) { if ( buildings[i].type == *(__int16 *)((char *)&word_5FC9E8[100 * v6] + 2 * j) ) { v2 = fun_getDistanceMaximum( formations[a1].fortX, formations[a1].fortY, buildings[i].x, buildings[i].y); if ( j >= v5 ) { if ( v2 < v1 ) { v4 = i; v1 = v2; } } else { v5 = j; v4 = i; v1 = v2; } break; } } } } if ( v4 <= 0 ) { for ( k = 1; k < 2000; ++k ) { if ( buildings[k].inUse == 1 && !byte_902EC0[buildings[k].gridOffset] ) { for ( l = 0; l < 100 && l <= v5 && word_5FCD08[l]; ++l ) { if ( buildings[k].type == word_5FCD08[l] ) { v3 = fun_getDistanceMaximum( formations[a1].fortX, formations[a1].fortY, buildings[k].x, buildings[k].y); if ( l >= v5 ) { if ( v3 < v1 ) { v4 = k; v1 = v3; } } else { v5 = l; v4 = k; v1 = v3; } break; } } } } } if ( v4 > 0 ) { if ( buildings[v4].type == 72 ) { formations[a1].f34 = buildings[v4].x + 1; formations[a1].f35 = buildings[v4].y; formations[a1].f36 = v4 + 1; } else { formations[a1].f34 = buildings[v4].x; formations[a1].f35 = buildings[v4].y; formations[a1].f36 = v4; } } } void sub_4C0F10(int a1) { signed int v1; // [sp+4Ch] [bp-10h]@1 int v2; // [sp+50h] [bp-Ch]@18 signed int v3; // [sp+54h] [bp-8h]@1 signed int i; // [sp+58h] [bp-4h]@1 v3 = 0; v1 = 10000; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].type != B_MissionPost ) { if ( buildings[i].type != B_NativeHut ) { if ( buildings[i].type != B_NativeMeeting ) { if ( buildings[i].type != B_NativeCrops ) { if ( buildings[i].type != B_Warehouse ) { if ( buildings[i].type != B_FortGround__ ) { v2 = fun_getDistanceMaximum( city_inform[ciid].dword_6544C4, city_inform[ciid].dword_6544C8, buildings[i].x, buildings[i].y); if ( v2 < v1 ) { v3 = i; v1 = v2; } } } } } } } } } if ( v3 > 0 ) { formations[a1].f34 = buildings[v3].x; formations[a1].f35 = buildings[v3].y; formations[a1].f36 = v3; } } void sub_4C1100() { signed int v0; // [sp+4Ch] [bp-14h]@1 signed int v1; // [sp+50h] [bp-10h]@1 signed int j; // [sp+58h] [bp-8h]@6 signed int i; // [sp+5Ch] [bp-4h]@1 v1 = 100; v0 = 0; for ( i = 1; i < MAX_BUILDINGS; ++i ) { if ( buildings[i].inUse == 1 ) { for ( j = 0; j < 100 && j <= v1 && word_5FCD08[j]; ++j ) { if ( buildings[i].type == word_5FCD08[j] ) { if ( j < v1 ) { v1 = j; v0 = i; } break; } } } } if ( v0 > 0 ) { if ( buildings[v0].type == B_Warehouse ) { walkerGridX = buildings[v0].x + 1; walkerGridY = buildings[v0].y; } else { walkerGridX = buildings[v0].x; walkerGridY = buildings[v0].y; } } } signed int sub_4C1280(int a1, int a2, int a3) { int v4; // [sp+4Ch] [bp-3Ch]@6 int v5; // [sp+50h] [bp-38h]@6 int v6; // [sp+54h] [bp-34h]@6 int v7; // [sp+58h] [bp-30h]@6 signed int j; // [sp+5Ch] [bp-2Ch]@4 signed int v9; // [sp+60h] [bp-28h]@18 int k; // [sp+64h] [bp-24h]@14 int l; // [sp+68h] [bp-20h]@16 int v12; // [sp+74h] [bp-14h]@1 int v13; // [sp+78h] [bp-10h]@20 signed int i; // [sp+7Ch] [bp-Ch]@1 signed int v15; // [sp+7Ch] [bp-Ch]@18 signed int v16; // [sp+80h] [bp-8h]@1 v16 = formations[a1].numWalkers; v12 = 162 * dword_5F3CB4[32 * formations[a1].layout] + dword_5F3CB0[32 * formations[a1].layout] + setting_map_startGridOffset; dword_7FA0E0[0] = 0; for ( i = 1; i < v16; ++i ) dword_7FA0E0[i] = 162 * *(_DWORD *)((char *)&dword_5F3CB4[32 * formations[a1].layout] + 8 * i) + *(int *)((char *)&dword_5F3CB0[32 * formations[a1].layout] + 8 * i) + setting_map_startGridOffset - v12; sub_501B60(a2, a3, -1, -1, 0, 600); for ( j = 0; j <= 10; ++j ) { v7 = a2 - j; v6 = a3 - j; v5 = j + a2; v4 = j + a3; if ( a2 - j < 0 ) v7 = 0; if ( v6 < 0 ) v6 = 0; if ( v5 >= setting_map_width ) v5 = setting_map_width - 1; if ( v4 >= setting_map_height ) v4 = setting_map_height - 1; for ( k = v6; k <= v4; ++k ) { for ( l = v7; l <= v5; ++l ) { v15 = 0; v9 = 1; while ( v15 < v16 ) { v13 = dword_7FA0E0[v15] + 162 * k + l + setting_map_startGridOffset; if ( grid_terrain[v13] & 0x1237 ) { v9 = 0; break; } if ( grid_pathingDistance[v13] <= 0 ) { v9 = 0; break; } if ( grid_walkerIds[v13] && walkers[grid_walkerIds[v13]].formationId != a1 ) { v9 = 0; break; } ++v15; } if ( v9 ) { dword_7FA1AC = l; dword_7FA1A8 = k; return 1; } } } } return 0; } signed int fun_walkerProvideServiceCoverage(int walkerId) { __int16 v2; // [sp+4Ch] [bp-8h]@1 int v3; // [sp+50h] [bp-4h]@28 int v4; // [sp+50h] [bp-4h]@65 int v5; // [sp+50h] [bp-4h]@77 int v6; // [sp+50h] [bp-4h]@92 int v7; // [sp+50h] [bp-4h]@100 v2 = 0; if ( walkers[walkerId].type == Walker_Patrician ) return 0; switch ( walkers[walkerId].type ) { case Walker_LaborSeeker: v2 = fun_walkerProvideLaborSeekerAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_TaxCollector: v2 = fun_walkerProvideTaxCollectorAccess(walkers[walkerId].x, walkers[walkerId].y); walkers[walkerId].maxLevelOrRiskSeen = taxCollectorMaxHousingLevelSeen; break; case Walker_MarketTrader: v2 = fun_walkerProvideMarketGoods( walkers[walkerId].buildingId, walkers[walkerId].x, walkers[walkerId].y); break; case Walker_MarketBuyer: v2 = fun_walkerProvideMarketGoods( walkers[walkerId].buildingId, walkers[walkerId].x, walkers[walkerId].y); break; case Walker_BathhouseWorker: v2 = fun_walkerProvideBathhouseAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_SchoolChild: v2 = fun_walkerProvideSchoolAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Teacher: v2 = fun_walkerProvideAcademyAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Librarian: v2 = fun_walkerProvideLibraryAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Barber: v2 = fun_walkerProvideBarberAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Doctor: v2 = walkerProvideClinicAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Surgeon: v2 = fun_walkerProvideHospitalAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Missionary: v2 = fun_walkerProvideMissionaryAccess(walkers[walkerId].x, walkers[walkerId].y); break; case Walker_Priest: v3 = walkers[walkerId].buildingId; switch ( buildings[v3].type ) { case B_SmallTempleCeres: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 0); break; case B_LargeTempleCeres: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 0); break; case B_SmallTempleNeptune: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 1); break; case B_LargeTempleNeptune: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 1); break; case B_SmallTempleMercury: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 2); break; case B_LargeTempleMercury: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 2); break; case B_SmallTempleMars: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 3); break; case B_LargeTempleMars: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 3); break; case B_SmallTempleVenus: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 4); break; case B_LargeTempleVenus: v2 = walkerProvideReligionAccess(walkers[walkerId].x, walkers[walkerId].y, 4); break; } break; case Walker_Engineer: v2 = fun_walkerProvideEngineerCoverage(walkers[walkerId].x, walkers[walkerId].y); if ( *(_DWORD *)&engineerMaxDamageSeen <= walkers[walkerId].maxLevelOrRiskSeen ) { if ( walkers[walkerId].maxLevelOrRiskSeen <= 10 ) walkers[walkerId].maxLevelOrRiskSeen = 0; else walkers[walkerId].maxLevelOrRiskSeen -= 10; } else { walkers[walkerId].maxLevelOrRiskSeen = engineerMaxDamageSeen; } break; case Walker_Prefect: v2 = fun_walkerProvidePrefectFireCoverage(walkers[walkerId].x, walkers[walkerId].y); fun_walkerProvidePrefectCrimeCoverage(walkers[walkerId].x, walkers[walkerId].y); walkers[walkerId].maxLevelOrRiskSeen = prefectMaxCrimeRiskSeen; break; case Walker_Rioter: if ( sub_49FDE0(walkerId) == 1 ) return 1; break; case Walker_Actor: if ( walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ) v4 = walkers[walkerId].baseWorkingBuildingId; else v4 = walkers[walkerId].buildingId; if ( buildings[v4].type == B_Theater ) { v2 = fun_walkerProvideTheaterAccess(walkers[walkerId].x, walkers[walkerId].y); } else { if ( buildings[v4].type == B_Amphitheater ) { if ( buildings[v4].house_bathhouse_dock_numships_entert_days ) v2 = fun_walkerProvideAmphitheaterAccess(walkers[walkerId].x, walkers[walkerId].y, 2); else v2 = fun_walkerProvideAmphitheaterAccess(walkers[walkerId].x, walkers[walkerId].y, 1); } } break; case Walker_Gladiator: if ( walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ) v5 = walkers[walkerId].baseWorkingBuildingId; else v5 = walkers[walkerId].buildingId; if ( buildings[v5].type == B_Amphitheater ) { if ( buildings[v5].house_hospital_entert_days2 ) v2 = fun_walkerProvideAmphitheaterAccess(walkers[walkerId].x, walkers[walkerId].y, 2); else v2 = fun_walkerProvideAmphitheaterAccess(walkers[walkerId].x, walkers[walkerId].y, 1); } else { if ( buildings[v5].type == B_Colosseum ) { if ( buildings[v5].house_bathhouse_dock_numships_entert_days ) v2 = fun_walkerProvideColosseumAccess(walkers[walkerId].x, walkers[walkerId].y, 2); else v2 = fun_walkerProvideColosseumAccess(walkers[walkerId].x, walkers[walkerId].y, 1); } } break; case Walker_LionTamer: if ( walkers[walkerId].actionState != 94 && walkers[walkerId].actionState != 95 ) v6 = walkers[walkerId].baseWorkingBuildingId; else v6 = walkers[walkerId].buildingId; if ( buildings[v6].house_hospital_entert_days2 ) v2 = fun_walkerProvideColosseumAccess(walkers[walkerId].x, walkers[walkerId].y, 2); else v2 = fun_walkerProvideColosseumAccess(walkers[walkerId].x, walkers[walkerId].y, 1); break; case Walker_Charioteer: v2 = fun_walkerProvideHippodromeAccess(walkers[walkerId].x, walkers[walkerId].y); break; } v7 = walkers[walkerId].buildingId; if ( walkers[walkerId].buildingId ) { buildings[v7].walkerServiceAccess += v2; if ( buildings[v7].walkerServiceAccess > 300 ) buildings[v7].walkerServiceAccess = 300; } return 0; } void fun_generateMapFlagWalkers() { fun_clearWalkers(); sub_4BE0F0(); walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 1; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 2; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 3; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 4; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 5; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 6; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 7; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 8; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 9; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 10; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 11; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 12; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 13; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 14; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 15; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 16; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 17; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 18; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 19; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 20; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 21; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 22; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 23; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 24; walkers[spawnWalker(1, Walker_MapFlag, -1, -1, 0)].cartPusherGoodType = 25; } void fun_createFishHerdFlotsamWalkers(__int16 riverEntryX, __int16 riverEntryY, int createFlotsam) { int v3; // eax@7 int v4; // eax@37 WalkerType type; // [sp+4Ch] [bp-1Ch]@22 signed int numAnimals; // [sp+50h] [bp-18h]@35 int numHerdPoints; // [sp+54h] [bp-14h]@15 signed int formationId; // [sp+58h] [bp-10h]@33 int m; // [sp+5Ch] [bp-Ch]@44 int v10; // [sp+5Ch] [bp-Ch]@54 signed int l; // [sp+60h] [bp-8h]@35 signed int i; // [sp+64h] [bp-4h]@2 signed int j; // [sp+64h] [bp-4h]@15 signed int k; // [sp+64h] [bp-4h]@28 signed int n; // [sp+64h] [bp-4h]@52 if ( !mode_editor ) { for ( i = 0; i < 8; ++i ) { if ( scn_fish_x[i] > 0 ) { fun_generateRandomness(); v3 = spawnWalker(1, Walker_FishGulls, scn_fish_x[i], scn_fish_y[i], 0); walkers[v3].byte_7FA341 = random_7f_1 & 0x1F; walkers[v3].progressOnTile = random_7f_1 & 7; turnWalkerToTile( walkerId, walkers[walkerId].tilePosition_y, walkers[walkerId].tilePosition_x, 15 * walkers[walkerId].destination_x, 15 * walkers[walkerId].destination_y, 0); } } } if ( !mode_editor ) { if ( scn_climate ) { if ( scn_climate == Climate_Northern ) { type = Walker_Wolf; } else { if ( scn_climate == Climate_Desert ) type = Walker_Zebra; } } else { type = Walker_Sheep; } numHerdPoints = 0; for ( j = 0; j < 4; ++j ) { if ( scn_herd_x[j] > 0 ) ++numHerdPoints; } if ( numHerdPoints > 0 ) { switch ( type ) { case Walker_Sheep: numAnimals = 10; break; case Walker_Zebra: numAnimals = 12; break; case Walker_Wolf: numAnimals = 8; break; } } else { numAnimals = 0; } for ( k = 0; k < 4; ++k ) { if ( scn_herd_x[k] > 0 ) { formationId = fun_createFormation(type, 9, 0, scn_herd_x[k], scn_herd_y[k]); if ( formationId > 0 ) { formations[formationId].formation_61 = 1; formations[formationId].formation_46 = 24; formations[formationId].maxWalkers = numAnimals; for ( l = 0; l < numAnimals; ++l ) { fun_generateRandomness(); v4 = spawnWalker(1, type, scn_herd_x[k], scn_herd_y[k], 0); walkers[v4].actionState = -60; walkers[v4].formationId = formationId; walkers[v4].word_7FA366 = v4 & 0x1F; } } } } } if ( createFlotsam ) { if ( mode_editor || scn_flotsam ) { for ( m = 1; m < 1000; ++m ) { if ( walkers[m].state ) { if ( walkers[m].type == Walker_Flotsam ) deleteWalker(m); } } for ( n = 0; n < 20; ++n ) { v10 = spawnWalker(1, Walker_Flotsam, riverEntryX, riverEntryY, 0); walkers[v10].actionState= -128; if ( !n ) { walkers[v10].cartPusherGoodType = G_Fruit; walkers[v10].word_7FA366 = 10; } if ( n == 1 ) { walkers[v10].cartPusherGoodType = G_Wheat; walkers[v10].word_7FA366 = 50; } if ( n == 2 ) { walkers[v10].cartPusherGoodType = G_Fruit; walkers[v10].word_7FA366 = 100; } if ( n == 3 ) { walkers[v10].cartPusherGoodType = 2; walkers[v10].word_7FA366 = 130; } if ( n == 4 ) { walkers[v10].cartPusherGoodType = G_Wheat; walkers[v10].word_7FA366 = 200; } if ( n == 5 ) { walkers[v10].cartPusherGoodType = G_Fruit; walkers[v10].word_7FA366 = 250; } if ( n == 6 ) { walkers[v10].cartPusherGoodType = 2; walkers[v10].word_7FA366 = 400; } if ( n == 7 ) { walkers[v10].cartPusherGoodType = 3; walkers[v10].word_7FA366 = 430; } if ( n == 8 ) { walkers[v10].cartPusherGoodType = 2; walkers[v10].word_7FA366 = 500; } if ( n == 9 ) { walkers[v10].cartPusherGoodType = 1; walkers[v10].word_7FA366 = 600; } if ( n == 10 ) { walkers[v10].cartPusherGoodType = 3; walkers[v10].word_7FA366 = 70; } if ( n == 11 ) { walkers[v10].cartPusherGoodType = 3; walkers[v10].word_7FA366 = 750; } if ( n == 12 ) { walkers[v10].cartPusherGoodType = 2; walkers[v10].word_7FA366 = 820; } if ( n == 13 ) { walkers[v10].cartPusherGoodType = 3; walkers[v10].word_7FA366 = 830; } if ( n == 14 ) { walkers[v10].cartPusherGoodType = 3; walkers[v10].word_7FA366 = 900; } if ( n == 15 ) { walkers[v10].cartPusherGoodType = 3; walkers[v10].word_7FA366 = 980; } if ( n == 16 ) { walkers[v10].cartPusherGoodType = 1; walkers[v10].word_7FA366 = 1010; } if ( n == 17 ) { walkers[v10].cartPusherGoodType = 2; walkers[v10].word_7FA366 = 1030; } if ( n == 18 ) { walkers[v10].cartPusherGoodType = 0; walkers[v10].word_7FA366 = 1200; } if ( n == 19 ) { walkers[v10].cartPusherGoodType = 1; walkers[v10].word_7FA366 = 1300; } } } } } void fun_showHelpDialog(int helpId, int a2) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 200; ++i ) { byte_7E3180[i] = 0; byte_7E2C40[i] = 0; } dword_7E2C14 = 0; helpDialog_value = 0; dword_7E2C10 = 0; dword_7E314C = 0; currentHelpId = helpId; dword_7E29E8 = a2; if ( help_videoLink[20 * currentHelpId] ) helpDialog_showVideo = 1; else helpDialog_showVideo = 0; if ( message_usePopup != 1 ) helpDialog_showVideo = 0; sub_4C64A0(); helpDialog_windowId = window_id; window_id = 5; window_redrawRequest = 1; } void fun_drawHelpDialog() { if ( helpDialog_showVideo ) fun_drawHelpDialogWithVideo(); else fun_drawHelpDialogNoVideo(); } void sub_4C4CC0() { int v0; // [sp+4Ch] [bp-Ch]@8 int v1; // [sp+54h] [bp-4h]@4 if ( helpDialog_max > 0 ) { if ( helpDialog_value > 0 ) { if ( helpDialog_value < helpDialog_max ) v1 = getPercentage(helpDialog_value, helpDialog_max); else v1 = 100; } else { v1 = 0; } v0 = fun_adjustWithPercentage(16 * helpDialog_text_height - 77, v1); if ( dword_7E314C ) v0 = dword_7E2D0C; drawGraphic( graphic_buttons + 39, helpDialog_text_x + 16 * helpDialog_text_width + 6, helpDialog_text_y + v0 + 26); } } void fun_drawHelpDialogButtons() { imagebuttons_redraw = 1; if ( helpDialog_showVideo ) { switch ( message_msgAdvisorId ) { case MessageAdvisor_Labor: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_labor, 1); break; case MessageAdvisor_Trade: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_trade, 1); break; case MessageAdvisor_Population: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_population, 1); break; case MessageAdvisor_Imperial: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_imperial, 1); break; case MessageAdvisor_Military: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_military, 1); break; case MessageAdvisor_Health: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_health, 1); break; case MessageAdvisor_Religion: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_religion, 1); break; default: fun_drawImageButtonCollection(xOffset + 16, yOffset + 408, &imagebuttons_message_help, 1); break; } fun_drawImageButtonCollection(xOffset + 372, yOffset + 410, &imagebuttons_message_close, 1); video_refreshRequested = 0; } else { if ( !help_type[40 * currentHelpId] ) { if ( dword_7E2C14 > 0 ) { fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_unknown_5EF620, 1); fun_drawGameText( 12, 0, xOffset + 52, yOffset + 16 * help_height[40 * currentHelpId] - 31, graphic_font + 134, 0); } } if ( help_type[40 * currentHelpId] == Help_Message ) { switch ( message_msgAdvisorId ) { case MessageAdvisor_Labor: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_labor, 1); break; case MessageAdvisor_Trade: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_trade, 1); break; case MessageAdvisor_Population: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_population, 1); break; case MessageAdvisor_Imperial: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_imperial, 1); break; case MessageAdvisor_Military: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_military, 1); break; case MessageAdvisor_Health: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_health, 1); break; case MessageAdvisor_Religion: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_religion, 1); break; default: fun_drawImageButtonCollection( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 40, &imagebuttons_message_help, 1); break; } if ( help_messageType[40 * currentHelpId] == HelpMessage_Disaster || help_messageType[40 * currentHelpId] == HelpMessage_Invasion ) fun_drawImageButtonCollection(xOffset + 64, helpDialog_text_y + 36, &imagebuttons_message_gotoArea, 1); } fun_drawImageButtonCollection( xOffset + 16 * help_width[40 * currentHelpId] - 38, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_close, 1); if ( helpDialog_max ) { fun_drawImageButtonCollection( helpDialog_text_x + 16 * helpDialog_text_width - 1, helpDialog_text_y, &imagebuttons_unknown_5EF670, 1); fun_drawImageButtonCollection( helpDialog_text_x + 16 * helpDialog_text_width - 1, helpDialog_text_y + 16 * helpDialog_text_height - 26, &imagebuttons_unknown_5EF698, 1); } } } void fun_handleHelpDialogClick() { int v0; // [sp+4Ch] [bp-4h]@81 if ( helpDialog_showVideo ) { switch ( message_msgAdvisorId ) { case MessageAdvisor_Labor: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_labor, 1) ) return; break; case MessageAdvisor_Trade: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_trade, 1) ) return; break; case MessageAdvisor_Population: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_population, 1) ) return; break; case MessageAdvisor_Imperial: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_imperial, 1) ) return; break; case MessageAdvisor_Military: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_military, 1) ) return; break; case MessageAdvisor_Health: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_health, 1) ) return; break; case MessageAdvisor_Religion: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_religion, 1) ) return; break; default: if ( fun_handleImageButtonClick(xOffset + 16, yOffset + 408, &imagebuttons_message_help, 1) ) return; break; } if ( !fun_handleImageButtonClick(xOffset + 372, yOffset + 410, &imagebuttons_message_close, 1) ) video_refreshRequested = 0; } else { if ( help_type[40 * currentHelpId] || (fun_isImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_unknown_5EF620, 1, 10), !fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_unknown_5EF620, 1)) ) { if ( help_type[40 * currentHelpId] != 2 ) goto LABEL_87; switch ( message_msgAdvisorId ) { case 1: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_labor, 1) ) return; break; case 2: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_trade, 1) ) return; break; case 3: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_population, 1) ) return; break; case 4: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_imperial, 1) ) return; break; case 5: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_military, 1) ) return; break; case 6: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_health, 1) ) return; break; case 7: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_religion, 1) ) return; break; default: if ( fun_handleImageButtonClick( xOffset + 16, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_help, 1) ) return; break; } if ( help_messageType[40 * currentHelpId] != 1 && help_messageType[40 * currentHelpId] != 7 || (fun_isImageButtonClick(xOffset + 64, helpDialog_text_y + 36, &imagebuttons_message_gotoArea, 1, 15), !fun_handleImageButtonClick(xOffset + 64, helpDialog_text_y + 36, &imagebuttons_message_gotoArea, 1)) ) { LABEL_87: fun_isImageButtonClick( xOffset + 16 * help_width[40 * currentHelpId] - 38, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_close, 1, 11); if ( !fun_handleImageButtonClick( xOffset + 16 * help_width[40 * currentHelpId] - 38, yOffset + 16 * help_height[40 * currentHelpId] - 36, &imagebuttons_message_close, 1) ) { fun_isImageButtonClick( helpDialog_text_x + 16 * helpDialog_text_width - 1, helpDialog_text_y, &imagebuttons_unknown_5EF670, 1, 12); if ( !fun_handleImageButtonClick( helpDialog_text_x + 16 * helpDialog_text_width - 1, helpDialog_text_y, &imagebuttons_unknown_5EF670, 1) ) { fun_isImageButtonClick( helpDialog_text_x + 16 * helpDialog_text_width - 1, helpDialog_text_y + 16 * helpDialog_text_height - 26, &imagebuttons_unknown_5EF698, 1, 13); if ( !fun_handleImageButtonClick( helpDialog_text_x + 16 * helpDialog_text_width - 1, helpDialog_text_y + 16 * helpDialog_text_height - 26, &imagebuttons_unknown_5EF698, 1) ) { if ( !sub_4C5FE0() ) { v0 = sub_4C62F0(); if ( v0 >= 0 ) { if ( dword_7E2C14 < 199 ) { byte_7E2C40[dword_7E2C14] = currentHelpId; byte_7E3180[dword_7E2C14++] = helpDialog_value; } currentHelpId = v0; helpDialog_value = 0; dword_7E2C10 = 0; dword_7E314C = 0; sub_4C64A0(); window_redrawRequest = 1; } } } } } } } } } void sub_4C5E40() { imagebuttons_redraw = 1; if ( helpDialog_max ) { fun_drawImageButtonCollection(dword_7E2C28 + 544, dword_7E2C2C + 152, &imagebuttons_unknown_5EF670, 1); fun_drawImageButtonCollection(dword_7E2C28 + 544, dword_7E2C2C + 366, &imagebuttons_unknown_5EF698, 1); sub_4C4CC0(); } } void sub_4C5EE0() { fun_isImageButtonClick(dword_7E2C28 + 544, dword_7E2C2C + 152, &imagebuttons_unknown_5EF670, 1, 12); if ( !fun_handleImageButtonClick(dword_7E2C28 + 544, dword_7E2C2C + 152, &imagebuttons_unknown_5EF670, 1) ) { fun_isImageButtonClick(dword_7E2C28 + 544, dword_7E2C2C + 366, &imagebuttons_unknown_5EF698, 1, 13); if ( !fun_handleImageButtonClick(dword_7E2C28 + 544, dword_7E2C2C + 366, &imagebuttons_unknown_5EF698, 1) ) sub_4C5FE0(); } } signed int sub_4C5FE0() { signed int result; // eax@2 int v1; // ST5C_4@15 int v2; // [sp+4Ch] [bp-Ch]@13 signed int v3; // [sp+50h] [bp-8h]@5 if ( helpDialog_max > 0 ) { if ( mouse_isLeftClick ) { v3 = 16 * helpDialog_text_height - 52; if ( mouseclick_x >= helpDialog_text_x + 16 * helpDialog_text_width + 1 ) { if ( mouseclick_x <= helpDialog_text_x + 16 * helpDialog_text_width + 41 ) { if ( mouseclick_y >= helpDialog_text_y + 26 ) { if ( mouseclick_y <= helpDialog_text_y + v3 + 26 ) { v2 = mouseclick_y - helpDialog_text_y - 11; if ( mouseclick_y - helpDialog_text_y - 11 > v3 ) v2 = 16 * helpDialog_text_height - 52; v1 = getPercentage(v2, v3); helpDialog_value = fun_adjustWithPercentage(helpDialog_max, v1); dword_7E314C = 1; dword_7E2D0C = v2 - 25; sub_4C64A0(); if ( dword_7E2D0C < 0 ) dword_7E2D0C = 0; window_redrawRequest = 2; result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } void sub_4C6170() { if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) { if ( helpDialog_value < helpDialog_max ) ++helpDialog_value; } } else { if ( helpDialog_value > 0 ) --helpDialog_value; } sub_4C64A0(); dword_7E314C = 0; window_redrawRequest = 2; } void sub_4C6200() { if ( dword_7E2C14 > 0 ) { --dword_7E2C14; currentHelpId = byte_7E2C40[dword_7E2C14]; helpDialog_value = byte_7E3180[dword_7E2C14]; sub_4C64A0(); dword_7E2C10 = 0; dword_7E314C = 0; window_redrawRequest = 1; } } void fun_message_close() { if ( helpDialog_showVideo ) fun_smackCancelVideo(); window_id = helpDialog_windowId; helpDialog_showVideo = 0; message_msgAdvisorId = 0; window_redrawRequest = 1; } int sub_4C62F0() { int result; // eax@2 int i; // [sp+4Ch] [bp-4h]@3 if ( byte_660B94[0] ) { for ( i = 0; i < dword_7E2C1C; ++i ) { if ( mouseclick_x >= dword_7E2D40[5 * i] && mouseclick_x <= dword_7E2D44[5 * i] && mouseclick_y >= dword_7E2D48[5 * i] && mouseclick_y <= dword_7E2D4C[5 * i] ) return dword_7E2D50[5 * i]; } result = -1; } else { result = -1; } return result; } void sub_4C63D0(int a1, int a2, int a3, int a4) { if ( dword_7E2C1C < 50 ) { dword_7E2D40[5 * dword_7E2BFC] = a2 - 2; dword_7E2D44[5 * dword_7E2BFC] = a3 + 2; dword_7E2D48[5 * dword_7E2BFC] = a4 - 1; dword_7E2D4C[5 * dword_7E2BFC] = a4 + 13; dword_7E2D50[5 * dword_7E2BFC++] = a1; ++dword_7E2C1C; } } void sub_4C64A0() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 50; ++i ) { dword_7E2D40[5 * i] = 0; dword_7E2D44[5 * i] = 0; dword_7E2D48[5 * i] = 0; dword_7E2D4C[5 * i] = 0; dword_7E2D50[5 * i] = 0; } dword_7E2BFC = 0; dword_7E2C1C = 0; } void fun_drawScrollableText(char *text, int x, int y, int width, int a5) { __int64 v5; // qax@59 char v6; // [sp+4Ch] [bp-4Ch]@22 char v7; // [sp+4Ch] [bp-4Ch]@31 signed int v8; // [sp+50h] [bp-48h]@1 signed int v9; // [sp+54h] [bp-44h]@1 int v10; // [sp+58h] [bp-40h]@1 int v11; // [sp+5Ch] [bp-3Ch]@31 signed int v12; // [sp+64h] [bp-34h]@48 int v13; // [sp+68h] [bp-30h]@1 signed int v14; // [sp+6Ch] [bp-2Ch]@10 signed int v15; // [sp+74h] [bp-24h]@1 signed int v16; // [sp+78h] [bp-20h]@12 signed int v17; // [sp+7Ch] [bp-1Ch]@10 signed int v18; // [sp+80h] [bp-18h]@1 signed int v19; // [sp+84h] [bp-14h]@1 int v20; // [sp+88h] [bp-10h]@12 signed int i; // [sp+8Ch] [bp-Ch]@6 int j; // [sp+8Ch] [bp-Ch]@19 int v23; // [sp+90h] [bp-8h]@59 int v24; // [sp+94h] [bp-4h]@1 char *v25; // [sp+A0h] [bp+8h]@31 v10 = 0; v9 = 0; v8 = 0; v15 = 0; v19 = 1; v24 = y; v18 = 0; v13 = 0; if ( a5 == 1 ) dword_7E2C10 = 0; while ( v19 || v10 ) { ++v18; if ( v18 >= 1000 ) break; for ( i = 0; i < 200; ++i ) textmultiline_line[i] = 0; if ( v15 ) { v17 = 50; v14 = 50; } else { v17 = 0; v14 = 0; } v20 = 0; v16 = 1; v15 = 0; while ( (v19 || v10) && v17 < width ) { if ( v10 ) { --v10; break; } v17 += fun_getRichTextWordWidth(text); if ( v17 >= width ) { if ( !v17 ) v19 = 0; } else { for ( j = 0; j < font_wordWidth; ++j ) { v6 = *text++; if ( v6 == '@' ) { if ( *text == 'P' ) { v15 = 1; ++text; v17 = width; break; } if ( *text == 'L' ) { ++text; v17 = width; break; } if ( *text == 'G' ) { if ( v20 ) { if ( a5 == 1 ) ++dword_7E2C10; } v25 = text + 1; v17 = width; v11 = strToInt(v25); v7 = *v25; text = v25 + 1; while ( v7 >= '0' && v7 <= '9' ) v7 = *text++; v10 = c3_sg2[word_6E6CEE + v11 - 1].height / 16 + 2; v9 = word_6E6CEE + v11 - 1; if ( v13 > 0 ) v8 = 1; break; } } if ( !v16 || v6 != ' ' ) { textmultiline_line[v20++] = v6; v16 = 0; } } if ( !*text ) v19 = 0; } } drawtext_wrap = 1; text_xoffset = 0; multiline_something_flag = 1; v12 = 0; if ( !a5 ) { if ( v13 < helpDialog_value ) v12 = 1; if ( v13 >= dword_7E3128 + helpDialog_value ) v12 = 1; } if ( !v12 ) sub_4C6DE0((unsigned __int8 *)textmultiline_line, v14 + x, v24, a5); if ( !a5 ) { if ( v9 ) { if ( v8 ) { --v8; } else { v10 = c3_sg2[v9].height / 16 + 2; v5 = 16 * helpDialog_text_width - 4 - c3_sg2[v9].width; v23 = x + (((_DWORD)v5 - _HIDWORD(v5)) >> 1) - 4; if ( v13 < dword_7E3128 + helpDialog_value ) { if ( v13 >= helpDialog_value ) drawGraphic(v9, v23, v24 + 8); else drawGraphic(v9, v23, v24 + 8 - 16 * (helpDialog_value - v13)); } v9 = 0; } } } if ( text_xoffset > textmultiline_longestLineLength ) textmultiline_longestLineLength = text_xoffset; ++v13; if ( a5 == 1 ) ++dword_7E2C10; if ( !v12 ) { v24 += 16; text_yoffset += 16; } } } int fun_getRichTextWordWidth(char *str) { unsigned __int8 c; // [sp+4Ch] [bp-10h]@3 char v3; // [sp+4Ch] [bp-10h]@13 signed int v4; // [sp+50h] [bp-Ch]@1 signed int v5; // [sp+54h] [bp-8h]@1 int width; // [sp+58h] [bp-4h]@1 char *v7; // [sp+64h] [bp+8h]@13 font_wordWidth = 0; width = 0; v4 = 0; v5 = 0; while ( 1 ) { ++v4; if ( v4 >= 2000 ) return width; c = *str++; if ( !c ) return width; if ( c == '@' ) { c = *str++; if ( !v5 ) break; } LABEL_22: if ( c == ' ' ) { if ( v5 ) return width; width += 4; } else { if ( c >= ' ' ) { width += fun_getCharWidth(c, font_currentFontId); v5 = 1; } } ++font_wordWidth; } if ( c == 'P' ) { font_wordWidth += 2; return 0; } if ( c == 'L' ) { font_wordWidth += 2; return 0; } if ( c != 'G' ) { ++font_wordWidth; while ( c >= '0' && c <= '9' ) { c = *str++; ++font_wordWidth; } goto LABEL_22; } font_wordWidth += 2; v3 = *str; v7 = str + 1; while ( v3 >= '0' && v3 <= '9' ) { v3 = *v7++; ++font_wordWidth; } return 0; } int sub_4C6DE0(unsigned __int8 *a1, int a2, int a3, int a4) { int result; // eax@2 int v5; // ST6C_4@8 int v6; // [sp+4Ch] [bp-18h]@1 int v7; // [sp+50h] [bp-14h]@11 int v8; // [sp+54h] [bp-10h]@4 int v9; // [sp+5Ch] [bp-8h]@14 unsigned __int8 j; // [sp+60h] [bp-4h]@1 unsigned __int8 v11; // [sp+60h] [bp-4h]@10 char *i; // [sp+6Ch] [bp+8h]@1 v6 = 0; j = *a1; for ( i = (char *)(a1 + 1); ; ++i ) { result = j; if ( !j ) break; if ( j == 64 ) { v8 = strToInt(i); for ( j = *i++; j >= '0' && j <= '9'; j = *i++ ) ; v5 = fun_getRichTextWordWidth(i - 1); v6 = font_wordWidth + 1; sub_4C63D0(v8, a2, v5 + a2, a3); } if ( j >= ' ' ) { v11 = j - ' '; if ( v6 <= 0 ) { v7 = font_currentFontId; } else { --v6; v7 = dword_7E2C08; } if ( map_printChar_to_fontGraphic[v11] <= 0 ) v9 = 6; else v9 = sub_4C6FA0(v7, v11, a2, a3, a4); a2 += v9; } j = *i; } return result; } int sub_4C6FA0(int a1, unsigned __int8 a2, int a3, int a4, int a5) { int result; // eax@2 int v6; // [sp+4Ch] [bp-4h]@3 graphic_currentGraphicId = map_printChar_to_fontGraphic[a2]; if ( graphic_currentGraphicId ) { v6 = c3_sg2[a1 + graphic_currentGraphicId - 1].height - 11; if ( v6 < 0 ) v6 = 0; if ( a2 < 96 ) v6 = 0; if ( a2 == 199 ) v6 = 0; if ( a2 == 231 ) v6 = 0; if ( !a5 ) drawGraphic(a1 + graphic_currentGraphicId - 1, a3, a4 - v6); result = c3_sg2[a1 + graphic_currentGraphicId - 1].width; } else { result = 0; } return result; } signed int fun_getButtonTooltipText() { signed int result; // eax@2 int time_since_last_update; // [sp+4Ch] [bp-Ch]@3 signed int v2; // [sp+50h] [bp-8h]@123 int v3; // [sp+50h] [bp-8h]@175 int v4; // [sp+54h] [bp-4h]@24 if ( !setting_mouse_tooltips ) { mouseover_last_update = time_current; return 0; } time_since_last_update = time_current - mouseover_last_update; if ( window_id != 1 ) { if ( window_id == 7 ) { if ( mouseover_button_id_main ) { mouseover_info_id = mouseover_button_id_main + 69; } else { if ( mouseover_imagebutton_id[0] < 10 || mouseover_imagebutton_id[0] >= 30 ) { switch ( currentAdvisor ) { case 1: if ( mouseover_button_id ) { mouseover_info_id = 90; } else { if ( !arrowbutton_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 91; } break; case 3: if ( mouseover_button_id && mouseover_button_id <= 2 ) { mouseover_info_id = mouseover_button_id + 93; } else { if ( !mouseover_button_id || mouseover_button_id != 3 ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 131; } break; case 4: switch ( mouseover_button_id ) { case 1: mouseover_info_id = 102; break; case 2: mouseover_info_id = 103; break; case 3: mouseover_info_id = 104; break; default: if ( mouseover_button_id != 4 ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 105; break; } break; case 5: if ( mouseover_button_id == 1 ) { mouseover_info_id = 106; } else { if ( !mouseover_button_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 107; } break; case 6: if ( !mouseover_button_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 111; break; case 9: if ( !mouseover_button_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 112; break; default: if ( currentAdvisor != 11 ) { mouseover_last_update = time_current; return 0; } if ( !arrowbutton_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 120; break; } } else { mouseover_info_id = mouseover_imagebutton_id[0] - 9; } } } else { if ( window_id == 42 ) { if ( mouseover_button_id == 1 ) { mouseover_info_id = 92; } else { if ( !mouseover_button_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 93; } } else { if ( window_id == 44 ) { mouseover_last_update = time_current; return 0; } if ( window_id == 45 ) { if ( mouseover_button_id == 1 ) { mouseover_info_id = 98; } else { if ( mouseover_button_id == 2 ) { mouseover_info_id = 99; } else { if ( mouseover_button_id ) { mouseover_info_id = 100; } else { if ( !arrowbutton_id ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 101; } } } } else { if ( window_id == 40 ) { mouseover_last_update = time_current; return 0; } switch ( window_id ) { case 41u: v2 = fun_getButtonTooltipText_TradePrices(); if ( !v2 ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = v2 + 131; break; case 43u: switch ( mouseover_imagebutton_id[0] ) { case 0xA: mouseover_info_id = 1; break; case 0xB: mouseover_info_id = 2; break; case 0xC: mouseover_info_id = 113; break; case 0xD: mouseover_info_id = 114; break; default: switch ( mouseover_button_id ) { case 1: mouseover_info_id = 115; break; case 2: mouseover_info_id = 116; break; case 3: mouseover_info_id = 117; break; case 4: mouseover_info_id = 118; break; default: if ( mouseover_button_id != 5 ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 119; break; } break; } break; case 9u: if ( dword_64E35C == 4 ) { if ( mouseover_imagebutton_id[0] < 10 || mouseover_imagebutton_id[0] >= 30 ) { if ( mouseover_button_id ) mouseover_info_id = 147; } else { mouseover_info_id = mouseover_imagebutton_id[0] - 9; } } else { if ( mouseover_imagebutton_id[0] < 10 || mouseover_imagebutton_id[0] >= 30 ) { if ( dword_64E35C != 2 ) { mouseover_last_update = time_current; return 0; } if ( buildings[currentlySelectedBuilding].type < 10 || buildings[currentlySelectedBuilding].type > 29 ) { mouseover_last_update = time_current; return 0; } if ( mouseover_button_id ) { mouseover_info_id = 121; } else { if ( !mouseover_button_id_main ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = 122; } } else { mouseover_info_id = mouseover_imagebutton_id[0] - 9; } } break; default: if ( window_id == 13 ) return 0; if ( window_id == 16 ) return 0; if ( window_id == 20 ) { v3 = fun_getButtonTooltipText_EmpireMap(/*window_id*/); if ( v3 ) { mouseover_info_id = v3 + 131; } else { if ( mouseover_imagebutton_id[0] == 12 ) { mouseover_info_id = 69; } else { if ( mouseover_imagebutton_id[0] < 10 || mouseover_imagebutton_id[0] >= 30 ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = mouseover_imagebutton_id[0] - 9; } } } else { if ( window_id != 17 ) { mouseover_last_update = time_current; return 0; } if ( mouseover_imagebutton_id[0] == 10 ) { mouseover_info_id = 1; } else { if ( mouseover_imagebutton_id[0] == 11 ) { mouseover_info_id = 2; } else { if ( !mouseover_button_id ) { mouseover_last_update = time_current; return 0; } currentMessage_id = dword_659C18 + mouseover_button_id - 1; if ( currentMessage_id >= playermessageTotal ) { mouseover_last_update = time_current; return 0; } } } } break; } } } } goto LABEL_196; } if ( mode_editor == 1 ) { mouseover_last_update = time_current; return 0; } if ( sidepanel_collapsed ) { if ( sidepanel_collapsed != 1 ) return 0; if ( mouseover_imagebutton_id[0] < 10 || mouseover_imagebutton_id[0] >= 30 ) { if ( mouseover_imagebutton_id[0] < 30 || mouseover_imagebutton_id[0] >= 50 ) { if ( menuClickedItem ) { mouseover_info_id = menuClickedItem + 49; } else { if ( !topmenu_fundsPopDateHit ) { mouseover_last_update = time_current; return 0; } mouseover_info_id = topmenu_fundsPopDateHit + 59; } } else { mouseover_info_id = mouseover_imagebutton_id[0] - 10; } } else { mouseover_info_id = 12; } goto LABEL_196; } if ( mouseover_imagebutton_id[0] >= 10 && mouseover_imagebutton_id[0] < 30 ) { mouseover_info_id = mouseover_imagebutton_id[0]; goto LABEL_196; } if ( mouseover_imagebutton_id[0] >= 30 && mouseover_imagebutton_id[0] < 50 ) { mouseover_info_id = mouseover_imagebutton_id[0] - 10; goto LABEL_196; } if ( mouseover_imagebutton_id[0] >= 50 && mouseover_imagebutton_id[0] < 70 ) { mouseover_info_id = mouseover_imagebutton_id[0] - 10; goto LABEL_196; } if ( minimap_clicked ) { mouseover_info_id = 35; goto LABEL_196; } if ( menuClickedItem ) { mouseover_info_id = menuClickedItem + 49; goto LABEL_196; } if ( topmenu_fundsPopDateHit ) { mouseover_info_id = topmenu_fundsPopDateHit + 59; LABEL_196: if ( setting_mouse_tooltips == 2 ) { if ( time_since_last_update >= 150 ) { dword_7E29E4 = helpDialog_value; dword_7E312C = dword_7E3128; dword_7E2C18 = dword_7E2C10; dword_7E2C00 = 0; dword_7E2D10 = window_id; dword_7E2D1C = 0; if ( !window_redrawRequest ) window_redrawRequest = 2; result = 1; } else { mouseover_info_id = 0; result = 0; } } else { mouseover_info_id = 0; mouseover_last_update = time_current; result = 0; } return result; } if ( !dword_8C79EC || currentOverlay ) { mouseover_last_update = time_current; result = 0; } else { v4 = grid_buildingIds[dword_8C79EC]; if ( v4 > 0 ) { if ( buildings[v4].type == B_SenateUpgraded ) { mouseover_info_id = 1; dword_7E2D1C = 2; dword_7E2D10 = window_id; dword_7E29E4 = helpDialog_value; dword_7E312C = dword_7E3128; dword_7E2C18 = dword_7E2C10; window_redrawRequest = 2; result = 1; } else { mouseover_last_update = time_current; result = 0; } } else { mouseover_last_update = time_current; result = 0; } } return result; } signed int fun_getButtonTooltipText_TradePrices() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= 15; ++i ) { if ( fun_isMouseHit(dialog_x + 30 * i + 124, dialog_y + 192, 24, 24) ) return i; } return 0; } int fun_getButtonTooltipText_EmpireMap() { int result; // eax@2 int v1; // [sp+4Ch] [bp-1Ch]@30 int v2; // [sp+4Ch] [bp-1Ch]@37 int i; // [sp+50h] [bp-18h]@15 int j; // [sp+50h] [bp-18h]@22 int v5; // [sp+50h] [bp-18h]@30 int v6; // [sp+50h] [bp-18h]@37 int v7; // [sp+54h] [bp-14h]@1 int v8; // [sp+60h] [bp-8h]@14 int v9; // [sp+64h] [bp-4h]@14 v7 = empire_selectedCity - 1; if ( tradeRoutes[trade_selectedCity].cityType ) { switch ( tradeRoutes[trade_selectedCity].cityType ) { case City_FutureTrade: result = 0; break; case City_DistantForeign: result = 0; break; case City_VulnerableRoman: result = 0; break; case City_FutureRoman: result = 0; break; case City_Ours: result = 0; break; default: // = City_Trade if ( tradeRoutes[trade_selectedCity].cityType == 2 ) { v9 = (screen_width - 500) / 2; v8 = screen_height - 108; if ( tradeRoutes[trade_selectedCity].isOpen ) { v5 = 1; v1 = 0; while ( v5 <= 15 ) { if ( canEmpireCitySellsGood(v7, v5) ) { if ( fun_isMouseHit(v9 + 100 * v1 + 120, v8 + 21, 26, 26) ) return v5; ++v1; } ++v5; } v6 = 1; v2 = 0; while ( v6 <= 15 ) { if ( canEmpireCityBuysGood(v7, v6) ) { if ( fun_isMouseHit(v9 + 100 * v2 + 120, v8 + 51, 26, 26) ) return v6; ++v2; } ++v6; } } else { text_xoffset = 0; text_xoffset += fun_getGameTextStringWidth(47, 5, graphic_font + F_NormalBlack); for ( i = 1; i <= 15; ++i ) { if ( canEmpireCitySellsGood(v7, i) ) { if ( fun_isMouseHit(v9 + text_xoffset + 60, v8 + 35, 26, 26) ) return i; text_xoffset += 32; } } text_xoffset += fun_getGameTextStringWidth(47, 4, graphic_font + F_NormalBlack); for ( j = 1; j <= 15; ++j ) { if ( canEmpireCityBuysGood(v7, j) ) { if ( fun_isMouseHit(v9 + text_xoffset + 110, v8 + 35, 26, 26) ) return j; text_xoffset += 32; } } } } result = 0; break; } } else { result = 0; } return result; } signed int fun_getOverlayTooltipText() { __int16 v1; // ax@34 int v2; // [sp+4Ch] [bp-28h]@33 int v3; // [sp+54h] [bp-20h]@1 int v4; // [sp+58h] [bp-1Ch]@23 signed int v5; // [sp+60h] [bp-14h]@230 int v6; // [sp+60h] [bp-14h]@266 int v7; // [sp+64h] [bp-10h]@246 int v8; // [sp+68h] [bp-Ch]@242 signed int v9; // [sp+6Ch] [bp-8h]@240 signed int i; // [sp+70h] [bp-4h]@242 v3 = 0; if ( !setting_mouse_tooltips ) return 0; if ( mouse_isRightClick ) return 0; if ( window_id != 1 ) return 0; if ( mode_editor == 1 ) return 0; if ( !dword_8C79EC ) return 0; if ( !currentOverlay ) return 0; if ( currentOverlay == 1 ) return 0; if ( currentOverlay == 3 ) return 0; if ( currentOverlay == 5 ) return 0; if ( currentOverlay == 6 ) return 0; if ( currentOverlay == 7 ) return 0; v4 = dword_8C79EC; if ( byte_5FD6D4[currentOverlay] ) { if ( !grid_buildingIds[dword_8C79EC] ) return 0; v3 = grid_buildingIds[dword_8C79EC]; } if ( byte_5FD6B4[currentOverlay] == 1 && buildings[v3].house_size <= 0 ) return 0; if ( byte_5FD6B4[currentOverlay] == Overlay_Water && buildings[v3].house_size ) return 0; v2 = 0; fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 0); switch ( currentOverlay ) { case Overlay_Water: v1 = grid_terrain[v4]; if ( v1 & 0x80 ) { if ( grid_terrain[v4] & 0x2000 ) fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 2); else fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 1); } else { if ( !(grid_terrain[v4] & 0x2000) ) return 0; fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 3); } break; case Overlay_Religion: if ( buildings[v3].house_numGods > 0 ) { if ( buildings[v3].house_numGods > 1 ) { if ( buildings[v3].house_numGods > 2 ) { if ( buildings[v3].house_numGods > 3 ) { if ( buildings[v3].house_numGods > 4 ) { if ( buildings[v3].house_numGods > 5 ) fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 18); else fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 17); } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 16); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 15); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 14); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 13); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 12); } break; case Overlay_Fire: if ( buildings[v3].fireRisk > 0 ) { if ( buildings[v3].fireRisk > 20 ) { if ( buildings[v3].fireRisk > 40 ) { if ( buildings[v3].fireRisk > 60 ) { if ( buildings[v3].fireRisk > 80 ) fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 51); else fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 50); } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 49); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 48); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 47); } } else { fun_getGameTextString(GAMETEXT_OVERLAY_INFO, 46); } break; case Overlay_Damage: if ( buildings[v3].damageRisk > 0 ) { if ( buildings[v3].damageRisk > 40 ) { if ( buildings[v3].damageRisk > 80 ) { if ( buildings[v3].damageRisk > 120 ) { if ( buildings[v3].damageRisk > 160 ) fun_getGameTextString(66, 57); else fun_getGameTextString(66, 56); } else { fun_getGameTextString(66, 55); } } else { fun_getGameTextString(66, 54); } } else { fun_getGameTextString(66, 53); } } else { fun_getGameTextString(66, 52); } break; case Overlay_Crime: if ( buildings[v3].house_crimeRisk > 0 ) { if ( buildings[v3].house_crimeRisk > 10 ) { if ( buildings[v3].house_crimeRisk > 20 ) { if ( buildings[v3].house_crimeRisk > 30 ) { if ( buildings[v3].house_crimeRisk >= 50 ) fun_getGameTextString(66, 58); else fun_getGameTextString(66, 59); } else { fun_getGameTextString(66, 60); } } else { fun_getGameTextString(66, 61); } } else { fun_getGameTextString(66, 62); } } else { fun_getGameTextString(66, 63); } break; case Overlay_Entertainment: if ( buildings[v3].house_entertainment > 0 ) { if ( buildings[v3].house_entertainment >= 10 ) { if ( buildings[v3].house_entertainment >= 20 ) { if ( buildings[v3].house_entertainment >= 30 ) { if ( buildings[v3].house_entertainment >= 40 ) { if ( buildings[v3].house_entertainment >= 50 ) { if ( buildings[v3].house_entertainment >= 60 ) { if ( buildings[v3].house_entertainment >= 70 ) { if ( buildings[v3].house_entertainment >= 80 ) { if ( buildings[v3].house_entertainment >= 90 ) fun_getGameTextString(66, 74); else fun_getGameTextString(66, 73); } else { fun_getGameTextString(66, 72); } } else { fun_getGameTextString(66, 71); } } else { fun_getGameTextString(66, 70); } } else { fun_getGameTextString(66, 69); } } else { fun_getGameTextString(66, 68); } } else { fun_getGameTextString(66, 67); } } else { fun_getGameTextString(66, 66); } } else { fun_getGameTextString(66, 65); } } else { fun_getGameTextString(66, 64); } break; case Overlay_Theater: if ( LOBYTE(buildings[v3].house_theater_amphi_wine) > 0 ) { if ( LOBYTE(buildings[v3].house_theater_amphi_wine) < 80 ) { if ( LOBYTE(buildings[v3].house_theater_amphi_wine) >= 20 ) fun_getGameTextString(66, 77); else fun_getGameTextString(66, 78); } else { fun_getGameTextString(66, 76); } } else { fun_getGameTextString(66, 75); } break; case Overlay_Amphiheater: if ( HIBYTE(buildings[v3].house_theater_amphi_wine) > 0 ) { if ( HIBYTE(buildings[v3].house_theater_amphi_wine) < 80 ) { if ( HIBYTE(buildings[v3].house_theater_amphi_wine) >= 20 ) fun_getGameTextString(66, 81); else fun_getGameTextString(66, 82); } else { fun_getGameTextString(66, 80); } } else { fun_getGameTextString(66, 79); } break; case Overlay_Colosseum: if ( HIBYTE(buildings[v3].house_amphiGlad_colo) > 0 ) { if ( HIBYTE(buildings[v3].house_amphiGlad_colo) < 80 ) { if ( HIBYTE(buildings[v3].house_amphiGlad_colo) >= 20 ) fun_getGameTextString(66, 85); else fun_getGameTextString(66, 86); } else { fun_getGameTextString(66, 84); } } else { fun_getGameTextString(66, 83); } break; case Overlay_Hippodrome: if ( HIBYTE(buildings[v3].house_coloLion_hippo) > 0 ) { if ( HIBYTE(buildings[v3].house_coloLion_hippo) < 80 ) { if ( HIBYTE(buildings[v3].house_coloLion_hippo) >= 20 ) fun_getGameTextString(66, 89); else fun_getGameTextString(66, 90); } else { fun_getGameTextString(66, 88); } } else { fun_getGameTextString(66, 87); } break; case Overlay_Education: if ( buildings[v3].house_education ) { switch ( buildings[v3].house_education ) { case 1: fun_getGameTextString(66, 101); break; case 2: fun_getGameTextString(66, 102); break; case 3: fun_getGameTextString(66, 103); break; } } else { fun_getGameTextString(66, 100); } break; case Overlay_School: if ( LOBYTE(buildings[v3].house_school_library) > 0 ) { if ( LOBYTE(buildings[v3].house_school_library) < 80 ) { if ( LOBYTE(buildings[v3].house_school_library) >= 20 ) fun_getGameTextString(66, 21); else fun_getGameTextString(66, 22); } else { fun_getGameTextString(66, 20); } } else { fun_getGameTextString(66, 19); } break; case Overlay_Library: if ( HIBYTE(buildings[v3].house_school_library) > 0 ) { if ( HIBYTE(buildings[v3].house_school_library) < 80 ) { if ( HIBYTE(buildings[v3].house_school_library) >= 20 ) fun_getGameTextString(66, 25); else fun_getGameTextString(66, 26); } else { fun_getGameTextString(66, 24); } } else { fun_getGameTextString(66, 23); } break; case Overlay_Academy: if ( LOBYTE(buildings[v3].house_academy_barber) > 0 ) { if ( LOBYTE(buildings[v3].house_academy_barber) < 80 ) { if ( LOBYTE(buildings[v3].house_academy_barber) >= 20 ) fun_getGameTextString(66, 29); else fun_getGameTextString(66, 30); } else { fun_getGameTextString(66, 28); } } else { fun_getGameTextString(66, 27); } break; case Overlay_Barber: if ( HIBYTE(buildings[v3].house_academy_barber) > 0 ) { if ( HIBYTE(buildings[v3].house_academy_barber) < 80 ) { if ( HIBYTE(buildings[v3].house_academy_barber) >= 20 ) fun_getGameTextString(66, 33); else fun_getGameTextString(66, 34); } else { fun_getGameTextString(66, 32); } } else { fun_getGameTextString(66, 31); } break; case Overlay_Bathhouse: if ( buildings[v3].house_bathhouse_dock_numships_entert_days > 0 ) { if ( buildings[v3].house_bathhouse_dock_numships_entert_days < 80 ) { if ( buildings[v3].house_bathhouse_dock_numships_entert_days >= 20 ) fun_getGameTextString(66, 10); else fun_getGameTextString(66, 11); } else { fun_getGameTextString(66, 9); } } else { fun_getGameTextString(66, 8); } break; case Overlay_Clinic: if ( buildings[v3].house_clinic > 0 ) { if ( buildings[v3].house_clinic < 80 ) { if ( buildings[v3].house_clinic >= 20 ) fun_getGameTextString(66, 37); else fun_getGameTextString(66, 38); } else { fun_getGameTextString(66, 36); } } else { fun_getGameTextString(66, 35); } break; case Overlay_Hospital: if ( buildings[v3].house_hospital_entert_days2 > 0 ) { if ( buildings[v3].house_hospital_entert_days2 < 80 ) { if ( buildings[v3].house_hospital_entert_days2 >= 20 ) fun_getGameTextString(66, 41); else fun_getGameTextString(66, 42); } else { fun_getGameTextString(66, 40); } } else { fun_getGameTextString(66, 39); } break; case Overlay_TaxIncome: v5 = fun_adjustWithPercentage( building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * v3] / 2, city_inform[ciid].taxrate); if ( v5 > 0 ) { v2 = fun_intToString(v5, 0, 0); strcpy(byte_7E2A00, intToString_result); fun_getGameTextString(66, 45); } else { if ( buildings[v3].house_taxcollector > 0 ) fun_getGameTextString(66, 44); else fun_getGameTextString(66, 43); } break; case Overlay_FoodStocks: if ( buildings[v3].house_population <= 0 ) return 0; v9 = model_houses[buildings[v3].level_resourceId].foodtypes; if ( v9 ) v9 = buildings[v3].house_population; v8 = 0; for ( i = 0; i < 4; ++i ) v8 += buildings[v3].grow_value_house_foodstocks[i]; if ( v9 ) v7 = getPercentage(v8, v9); else v7 = 400; if ( v9 > 0 ) { if ( v7 <= 200 ) { if ( v7 < 100 ) { if ( v7 <= 0 ) fun_getGameTextString(66, 4); else fun_getGameTextString(66, 5); } else { fun_getGameTextString(66, 6); } } else { fun_getGameTextString(66, 7); } } else { fun_getGameTextString(66, 104); } break; case Overlay_Desirability: if ( grid_desirability[v4] > -1 ) { if ( grid_desirability[v4] ) fun_getGameTextString(66, 93); else fun_getGameTextString(66, 92); } else { fun_getGameTextString(66, 91); } break; case Overlay_Workers: v6 = getPercentage(buildings[v3].walkerServiceAccess, 300); if ( buildings[v3].walkerServiceAccess > 0 ) { if ( v6 > 20 ) { if ( v6 > 40 ) { if ( v6 > 60 ) { if ( v6 > 80 ) fun_getGameTextString(66, 99); else fun_getGameTextString(66, 98); } else { fun_getGameTextString(66, 97); } } else { fun_getGameTextString(66, 96); } } else { fun_getGameTextString(66, 95); } } else { fun_getGameTextString(66, 94); } break; default: if ( currentOverlay == 28 ) return 0; if ( currentOverlay == Overlay_Problems ) return 0; break; } strcpy(&byte_7E2A00[v2], gametext_result); dword_7E29E4 = helpDialog_value; dword_7E312C = dword_7E3128; dword_7E2C18 = dword_7E2C10; dword_7E2838[0] = dword_8C79EC; dword_7E2C00 = 0; dword_7E2D10 = window_id; mouseover_info_id = 1; dword_7E2D1C = 1; window_redrawRequest = 1; return 1; } signed int sub_4C9710() { signed int result; // eax@2 if ( mouseover_info_id > 0 ) { mouseover_info_id = 0; helpDialog_value = dword_7E29E4; dword_7E3128 = dword_7E312C; dword_7E2C10 = dword_7E2C18; if ( !window_redrawRequest ) window_redrawRequest = 2; result = 1; } else { result = 0; } return result; } signed int unused_4C9790() { signed int result; // eax@8 signed int v1; // [sp+4Ch] [bp-4h]@1 v1 = 0; if ( !mouse_moved ) v1 = 1; if ( dword_7E2838[0] == dword_8C79EC ) v1 = 1; if ( mouse_isRightClick ) v1 = 0; if ( v1 ) { result = 0; } else { mouseover_last_update = time_current; mouseover_info_id = 0; window_id = dword_7E2D10; helpDialog_value = dword_7E29E4; dword_7E3128 = dword_7E312C; dword_5FFF58[0] = 1; window_redrawRequest = 1; result = 1; } return result; } void fun_drawTooltip() { bool v0; // [sp+4Ch] [bp-8h]@8 bool v1; // [sp+50h] [bp-4h]@11 if ( dword_7E2D1C == 1 ) { sub_4C9FE0(); } else { if ( dword_7E2D1C == 2 ) { fun_drawSenateTooltip(); } else { dword_7E3150 = 200; helpDialog_value = 0; dword_7E3128 = 30; font_currentFontId = graphic_font + 938; dword_7E2C08 = graphic_font + 938; drawtext_color = 0x4208u; fun_getGameTextString(GAMETEXT_MOUSEOVER_INFO, mouseover_info_id); fun_drawScrollableText(gametext_result, dword_7E3148 + 5, dword_7E3144 + 5, dword_7E3150 - 5, 1); dword_7E3154 = 16 * dword_7E2C10 + 10; if ( dword_7E2C10 > 2 ) { dword_7E3150 = 300; helpDialog_value = 0; dword_7E3128 = 30; fun_getGameTextString(GAMETEXT_MOUSEOVER_INFO, mouseover_info_id); fun_drawScrollableText(gametext_result, dword_7E3148 + 5, dword_7E3144 + 5, dword_7E3150 - 5, 1); dword_7E3154 = 16 * dword_7E2C10 + 10; } v0 = button_x < screen_640x480_x + dword_7E3150 + 100; v1 = button_y < screen_640x480_y + 200; if ( v0 ) { if ( window_id == 7 ) dword_7E3148 = button_x + 50; else dword_7E3148 = button_x + 20; } else { dword_7E3148 = button_x - dword_7E3150 - 20; } switch ( window_id ) { case 7u: if ( button_y < screen_640x480_y + 432 ) { switch ( currentAdvisor ) { case 1: dword_7E3144 = button_y - 74; break; case 5: dword_7E3144 = button_y - 54; break; case 6: dword_7E3144 = button_y - 58; break; default: dword_7E3144 = button_y - 64; break; } } else { dword_7E3144 = screen_640x480_y + 432; } break; case 45u: dword_7E3144 = button_y - 52; break; case 42u: if ( v1 ) dword_7E3144 = button_y + 40; else dword_7E3144 = button_y - 72; dword_7E3148 = button_x - dword_7E3150 / 2 - 10; break; default: if ( v1 ) dword_7E3144 = button_y + 40; else dword_7E3144 = button_y - 62; break; } fun_drawRect(dword_7E3148, dword_7E3144, dword_7E3150, dword_7E3154, 0); fun_fillRect(dword_7E3148 + 1, dword_7E3144 + 1, dword_7E3150 - 2, dword_7E3154 - 2, 65535); fun_drawScrollableText(gametext_result, dword_7E3148 + 5, dword_7E3144 + 7, dword_7E3150 - 5, 0); } } } void unused_4C9D00() { if ( window_id == 7 ) { graphic_xOffset = dword_7E3148; graphic_yOffset = dword_7E3144; _LOWORD(drawGraphic_width) = dword_7E3150; _LOWORD(drawGraphic_height) = dword_7E3154; sub_413060(screen_buffer + 10, ddraw_scanline - 2 * (signed __int16)drawGraphic_width, 0); fun_memcpy8((int *)"1234", (int *)screen_buffer, 4); fun_memcpy8(&dword_7E3148, (int *)screen_buffer + 1, 4); fun_memcpy8(&dword_7E3144, (int *)screen_buffer + 2, 4); fun_memcpy8(&dword_7E3150, (int *)screen_buffer + 3, 4); fun_memcpy8(&dword_7E3154, (int *)screen_buffer + 4, 4); } } void unused_4C9E30() { if ( window_id == 7 ) { if ( window_redrawRequest != 1 ) { if ( !fun_strFirstDifferenceIndex("1234", (const char *)screen_buffer, 4) ) { fun_memcpy8((int *)screen_buffer + 1, &graphic_xOffset, 4); fun_memcpy8((int *)screen_buffer + 2, &graphic_yOffset, 4); fun_memcpy8((int *)screen_buffer + 3, &drawGraphic_width, 4); fun_memcpy8((int *)screen_buffer + 4, &drawGraphic_height, 4); if ( (signed __int16)drawGraphic_width > 0 ) { if ( (signed __int16)drawGraphic_width <= 300 ) { if ( (signed __int16)drawGraphic_height > 0 ) { if ( (signed __int16)drawGraphic_height <= 40 ) { if ( graphic_xOffset >= 0 ) { if ( graphic_xOffset <= ddraw_width - (signed __int16)drawGraphic_width ) { if ( graphic_yOffset >= 0 ) { if ( graphic_yOffset <= ddraw_height - (signed __int16)drawGraphic_height ) sub_412FF0(screen_buffer + 10, ddraw_scanline - 2 * (signed __int16)drawGraphic_width, 0); } } } } } } } } } } } void sub_4C9FE0() { bool v0; // [sp+4Ch] [bp-8h]@4 bool v1; // [sp+50h] [bp-4h]@7 dword_7E3150 = 200; helpDialog_value = 0; dword_7E3128 = 30; font_currentFontId = graphic_font + F_SmallPlain; dword_7E2C08 = graphic_font + F_SmallPlain; drawtext_color = 0x4208u; fun_drawScrollableText(byte_7E2A00, dword_7E3148 + 5, dword_7E3144 + 5, dword_7E3150 - 5, 1); dword_7E3154 = 16 * dword_7E2C10 + 10; if ( dword_7E2C10 > 2 ) { dword_7E3150 = 300; helpDialog_value = 0; dword_7E3128 = 30; fun_drawScrollableText(byte_7E2A00, dword_7E3148 + 5, dword_7E3144 + 5, dword_7E3150 - 5, 1); dword_7E3154 = 16 * dword_7E2C10 + 10; } v0 = mouseclick_x < dword_7E3150 + 20; v1 = mouseclick_y < 200; if ( v0 ) dword_7E3148 = mouseclick_x + 20; else dword_7E3148 = mouseclick_x - dword_7E3150 - 20; if ( v1 ) dword_7E3144 = mouseclick_y + 50; else dword_7E3144 = mouseclick_y - 72; fun_drawRect(dword_7E3148, dword_7E3144, dword_7E3150, dword_7E3154, 0); fun_fillRect(dword_7E3148 + 1, dword_7E3144 + 1, dword_7E3150 - 2, dword_7E3154 - 2, 65535); fun_drawScrollableText(byte_7E2A00, dword_7E3148 + 5, dword_7E3144 + 7, dword_7E3150 - 5, 0); } void fun_drawSenateTooltip() { bool v0; // [sp+4Ch] [bp-8h]@2 bool v1; // [sp+50h] [bp-4h]@5 dword_7E3150 = 180; dword_7E3154 = 80; v0 = mouseclick_x < dword_7E3150 + 20; v1 = mouseclick_y < 200; if ( v0 ) dword_7E3148 = mouseclick_x + 20; else dword_7E3148 = mouseclick_x - dword_7E3150 - 20; if ( v1 ) dword_7E3144 = mouseclick_y + 10; else dword_7E3144 = mouseclick_y - 32; fun_drawRect(dword_7E3148, dword_7E3144, dword_7E3150, dword_7E3154, 0); fun_fillRect(dword_7E3148 + 1, dword_7E3144 + 1, dword_7E3150 - 2, dword_7E3154 - 2, 0xFFFFu); fun_drawGameText(68, 148, dword_7E3148 + 5, dword_7E3144 + 5, graphic_font + 938, 0x4208u); drawNumber( city_inform[ciid].unemploymentPercentage, 64, "%", dword_7E3148 + 140, dword_7E3144 + 5, graphic_font + 938, 0x4208u); fun_drawGameText(68, 149, dword_7E3148 + 5, dword_7E3144 + 19, graphic_font + 938, 0x4208u); drawNumber( city_inform[ciid].cultureRating, 64, " ", dword_7E3148 + 140, dword_7E3144 + 19, graphic_font + 938, 0x4208u); fun_drawGameText(68, 150, dword_7E3148 + 5, dword_7E3144 + 33, graphic_font + 938, 0x4208u); drawNumber( city_inform[ciid].prosperityRating, 64, " ", dword_7E3148 + 140, dword_7E3144 + 33, graphic_font + 938, 0x4208u); fun_drawGameText(68, 151, dword_7E3148 + 5, dword_7E3144 + 47, graphic_font + 938, 0x4208u); drawNumber( city_inform[ciid].peaceRating, 64, " ", dword_7E3148 + 140, dword_7E3144 + 47, graphic_font + 938, 0x4208u); fun_drawGameText(68, 152, dword_7E3148 + 5, dword_7E3144 + 61, graphic_font + 938, 0x4208u); drawNumber( city_inform[ciid].favorRating, 64, " ", dword_7E3148 + 140, dword_7E3144 + 61, graphic_font + 938, 0x4208u); } int fun_strnpos(const char *haystack, const char *needle, int haystackSize) { int len; // [sp+4Ch] [bp-8h]@1 int i; // [sp+50h] [bp-4h]@1 len = strlen(needle); for ( i = 0; i < haystackSize; ++i ) { if ( haystack[i] == *needle && !fun_strFirstDifferenceIndex(&haystack[i], needle, len) ) return i; } return 0; } //----- (004CA770) -------------------------------------------------------- int fun_strnchr(const char *s, unsigned __int8 c, int len) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < len; ++i ) { if ( *s == c ) return i + 1; ++s; } return 0; } //----- (004CA7E0) -------------------------------------------------------- int fun_strFirstDifferenceIndex(const char *s1, const char *s2, int len) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < len; ++i ) { if ( s2[i] != s1[i] ) return i + 1; } return 0; } //----- (004CA8A0) -------------------------------------------------------- unsigned __int8 unused_toupper(unsigned __int8 c) { if ( c >= 'a' ) { if ( c <= 'z' ) c -= 32; } return c; } //----- (004CA8F0) -------------------------------------------------------- unsigned __int8 unused_tolower(unsigned __int8 c) { if ( c >= 'A' ) { if ( c <= 'Z' ) c += 32; } return c; } //----- (004CA9B0) -------------------------------------------------------- unsigned __int8 * unused_strtolower(unsigned __int8 *a1) { unsigned __int8 *result; // eax@1 unsigned __int8 v2; // [sp+4Ch] [bp-4h]@2 while ( 1 ) { result = a1; if ( !*a1 ) break; v2 = *a1; if ( *a1 >= 'A' ) { if ( v2 <= 'Z' ) v2 += 32; } *a1++ = v2; } return result; } //----- (004CAA20) -------------------------------------------------------- void unused_strCutAtFirstNonCharacter(char *a1) { while ( *a1 ) { if ( *a1 < ' ' ) { *a1 = 0; return; } if ( *a1 > 166 ) { *a1 = 0; return; } ++a1; } } void fun_strMoveRight(char *start, char *end) { end[1] = 0; while ( end > start ) { *end = *(end - 1); --end; } } //----- (004CAB40) -------------------------------------------------------- void unused_strTrimSpacesLeft(char *a1) { int i; // [sp+4Ch] [bp-4h]@2 while ( *a1 == ' ' ) { for ( i = 0; a1[i]; ++i ) a1[i] = a1[i + 1]; } } //----- (004CABB0) -------------------------------------------------------- void unused_strTrimSpacesRight(char *a1) { int len; // [sp+4Ch] [bp-4h]@1 int i; // [sp+4Ch] [bp-4h]@4 for ( len = 0; a1[len]; ++len ) ; for ( i = len - 1; a1[i] == ' '; --i ) a1[i] = 0; } //----- (004CAC30) -------------------------------------------------------- void unused_strRemoveDoubleSpaces(char *str) { signed int v1; // [sp+4Ch] [bp-Ch]@1 signed int max; // [sp+50h] [bp-8h]@7 signed int i; // [sp+54h] [bp-4h]@1 signed int j; // [sp+54h] [bp-4h]@6 v1 = 0; for ( i = 0; i < 64000; ++i ) { if ( !str[i] ) { max = i; break; } } for ( j = 0; j < max && str[j]; ++j ) { if ( str[j] == ' ' ) { if ( v1 ) { --j; fun_strMoveLeft(&str[j], &str[max]); } else { v1 = 1; } } else { v1 = 0; } } } //----- (004CAD20) -------------------------------------------------------- //----- (004CB540) -------------------------------------------------------- void fun_inputDetermineCursorPosition() { int stringWidth; // [sp+4Ch] [bp-4h]@3 input_atEnd = 0; if ( inputtext_lastUsed > 0 ) { stringWidth = fun_getStringWidth(input_text[inputtext_lastUsed], input_font[inputtext_lastUsed]); if ( input_cursorPosition[inputtext_lastUsed] >= input_length[inputtext_lastUsed] + 1 ) { input_cursorPosition[inputtext_lastUsed] = input_length[inputtext_lastUsed] + 1; input_atEnd = 1; } if ( input_cursorPosition[inputtext_lastUsed] >= input_maxlength[inputtext_lastUsed] ) { input_cursorPosition[inputtext_lastUsed] = input_maxlength[inputtext_lastUsed]; input_atEnd = 2; } if ( stringWidth >= input_textboxwidth[inputtext_lastUsed] ) input_atEnd = 2; if ( input_cursorPosition[inputtext_lastUsed] < 0 ) input_cursorPosition[inputtext_lastUsed] = 0; } } // 6DEC3C: using guessed type int input_atEnd; // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CB6A0) -------------------------------------------------------- void fun_inputKeyPressed(unsigned __int8 keyValue) { if ( keyValue == ' ' ) { fun_inputAddCharacter(keyValue); } else { if ( keyValue != ',' || input_allowPunctuation[inputtext_lastUsed] ) { if ( keyValue != '.' || input_allowPunctuation[inputtext_lastUsed] ) { if ( keyValue != '?' || input_allowPunctuation[inputtext_lastUsed] ) { if ( keyValue != '!' || input_allowPunctuation[inputtext_lastUsed] ) { if ( keyValue == '-' ) { fun_inputAddCharacter(keyValue); } else { if ( keyValue < '0' || keyValue > '9' ) { if ( keyValue < 'a' || keyValue > 'z' ) { if ( keyValue < 'A' || keyValue > 'Z' ) { if ( keyValue < 128 || keyValue > 154 ) { if ( keyValue < 160 || keyValue > 167 ) { if ( keyValue == 225 ) fun_inputAddCharacter(keyValue); } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } else { fun_inputAddCharacter(keyValue); } } fun_inputDetermineCursorPosition(); } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CB930) -------------------------------------------------------- void unused_inputAddCharacter(char value) { fun_inputAddCharacter(value); fun_inputDetermineCursorPosition(); } //----- (004CB960) -------------------------------------------------------- void fun_inputReturnPressed() { input_accepted = 1; } // 7E27A0: using guessed type int input_accepted; //----- (004CB980) -------------------------------------------------------- void fun_inputBackspacePressed() { if ( input_cursorPosition[inputtext_lastUsed] > 0 ) { --input_cursorPosition[inputtext_lastUsed]; fun_inputRemoveCurrentChar(); } } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CB9D0) -------------------------------------------------------- void fun_inputDeletePressed() { fun_inputRemoveCurrentChar(); } //----- (004CB9F0) -------------------------------------------------------- void fun_inputInsertPressed() { input_isInsert ^= 1u; } // 7E1EF8: using guessed type char input_isInsert; //----- (004CBA20) -------------------------------------------------------- void fun_inputLeftPressed() { if ( input_cursorPosition[inputtext_lastUsed] > 0 ) --input_cursorPosition[inputtext_lastUsed]; } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CBA70) -------------------------------------------------------- void fun_inputRightPressed() { if ( input_cursorPosition[inputtext_lastUsed] < input_length[inputtext_lastUsed] ) ++input_cursorPosition[inputtext_lastUsed]; } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CBAD0) -------------------------------------------------------- void fun_inputHomePressed() { input_cursorPosition[inputtext_lastUsed] = 0; } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CBB00) -------------------------------------------------------- void fun_inputEndPressed() { input_cursorPosition[inputtext_lastUsed] = input_length[inputtext_lastUsed]; } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CBB40) -------------------------------------------------------- void fun_inputAddCharacter(char value) { if ( inputtext_lastUsed > 0 ) { fun_inputDetermineCursorPosition(); if ( input_atEnd != 2 ) { if ( input_isInsert ) { if ( input_length[inputtext_lastUsed] < input_maxlength[inputtext_lastUsed] ) { fun_strMoveRight( &input_text[inputtext_lastUsed][input_cursorPosition[inputtext_lastUsed]], (char *)&(&input_text[inputtext_lastUsed])[input_length[inputtext_lastUsed] + 1]); input_text[inputtext_lastUsed][input_cursorPosition[inputtext_lastUsed]++] = value; } } else { input_text[inputtext_lastUsed][input_cursorPosition[inputtext_lastUsed]++] = value; } } } } // 6DEC3C: using guessed type int input_atEnd; // 6E6B00: using guessed type int inputtext_lastUsed; // 7E1EF8: using guessed type char input_isInsert; //----- (004CBCA0) -------------------------------------------------------- void fun_inputRemoveCurrentChar() { if ( inputtext_lastUsed > 0 ) { fun_strMoveLeft( &input_text[inputtext_lastUsed][input_cursorPosition[inputtext_lastUsed]], &input_text[inputtext_lastUsed][input_length[inputtext_lastUsed]]); fun_inputDetermineCursorPosition(); } } // 6E6B00: using guessed type int inputtext_lastUsed; //----- (004CBD20) -------------------------------------------------------- void fun_inputInit(int id) { int i; // [sp+4Ch] [bp-4h]@1 inputtext_lastUsed = id; input_length[inputtext_lastUsed] = 0; for ( i = 0; i <= input_maxlength[inputtext_lastUsed] && input_text[inputtext_lastUsed][i]; ++i ) ++input_length[inputtext_lastUsed]; } void sub_4CBDD0() { drawtext_input_cursorSeen = 0; drawtext_input_position = 0; drawtext_input_cursor_width = 0; text_xoffset = 0; text_yoffset = 0; } void fun_initInputTextbox(int inputId, char *text, int maxlength, int textboxwidth, char allowPunctuation, int font) { input_font[inputId] = font; input_maxlength[inputId] = maxlength; input_length[inputId] = 0; input_textboxwidth[inputId] = textboxwidth; input_allowPunctuation[inputId] = allowPunctuation; input_cursorPosition[inputId] = 0; input_text[inputId] = text; input_atEnd = 0; input_cursorOffset = 0; } //----- (004CC240) -------------------------------------------------------- void fun_drawTextCentered(const char *str, int x, int y, int boxWidth, int fontId, __int16 color) { draw_centeredTextOffset = (boxWidth - fun_getStringWidth(str, fontId)) / 2; if ( draw_centeredTextOffset < 0 ) draw_centeredTextOffset = 0; fun_drawText(str, draw_centeredTextOffset + x, y, fontId, color); } void fun_drawText(const char *str, int x, int y, int fontId, __int16 color) { signed int letterSpacing; // [sp+4Ch] [bp-24h]@2 signed int spaceWidth; // [sp+50h] [bp-20h]@2 int width; // [sp+60h] [bp-10h]@44 char origCurCh; // [sp+64h] [bp-Ch]@14 char numCharsProcessed; // [sp+68h] [bp-8h]@12 char curCh; // [sp+6Ch] [bp-4h]@12 unsigned __int8 printable; // [sp+6Ch] [bp-4h]@22 if ( fontId == graphic_font + F_LargePlain ) { spaceWidth = 8; font_currentLineHeight[0] = 23; letterSpacing = 1; } else { if ( fontId == graphic_font + F_LargeBlack ) { spaceWidth = 8; font_currentLineHeight[0] = 23; letterSpacing = 0; } else { if ( fontId == graphic_font + F_LargeBrown ) { spaceWidth = 8; font_currentLineHeight[0] = 24; letterSpacing = 0; } else { if ( fontId == graphic_font + F_SmallPlain ) { spaceWidth = 4; font_currentLineHeight[0] = 9; letterSpacing = 1; } else { if ( fontId == graphic_font ) { spaceWidth = 6; font_currentLineHeight[0] = 11; letterSpacing = 1; } else { spaceWidth = 6; font_currentLineHeight[0] = 11; letterSpacing = 0; } } } } } drawtext_color = color; curCh = *str; numCharsProcessed = 0; while ( curCh ) { origCurCh = curCh; if ( curCh == '#' ) { if ( drawtext_wrap == 1 ) curCh = unused_drawText_hashCharAndWrap(); else curCh = ' '; } if ( curCh == '_' ) curCh = ' '; if ( curCh >= ' ' ) { printable = curCh - ' '; if ( map_printChar_to_fontGraphic[printable] <= 0 ) { width = spaceWidth; } else { if ( drawtext_forceColor ) { drawtext_color = color; width = letterSpacing + fun_drawCharacter(fontId, printable, x, y); } else { if ( drawtext_useDoubleShadow ) { drawtext_color = 0; fun_drawCharacter(fontId, printable, x, y - 1); drawtext_color = 0; fun_drawCharacter(fontId, printable, x, y + 1); drawtext_color = color; width = letterSpacing + fun_drawCharacter(fontId, printable, x, y); } else { if ( drawtext_useSingleShadow ) { drawtext_color = 0; fun_drawCharacter(fontId, printable, x + 1, y + 1); drawtext_color = color; width = letterSpacing + fun_drawCharacter(fontId, printable, x - 1, y); } else { drawtext_color = color; width = letterSpacing + fun_drawCharacter(fontId, printable, x, y); } } } } if ( drawtext_input_position == input_cursorPosition[inputtext_lastUsed] ) { if ( !drawtext_input_cursorSeen ) { drawtext_input_cursor_width = width; dword_6AD9D0 = text_xoffset; input_cursorOffset = text_yoffset; drawtext_input_cursorSeen = 1; } } x += width; text_xoffset += width; } if ( drawtext_hashCharAndWrap ) { curCh = unused_drawText_hashCharAndWrap(); } else { ++str; curCh = *str; } ++numCharsProcessed; ++drawtext_input_position; if ( !multiline_something_flag ) { if ( drawtext_alwaysZero ) // never triggered { if ( origCurCh == curCh ) { if ( curCh == ' ' || curCh == '_' ) { text_xoffset -= width; x -= width; } } } } } if ( !drawtext_input_cursorSeen ) { drawtext_input_cursor_width = 4; dword_6AD9D0 = text_xoffset; input_cursorOffset = text_yoffset; drawtext_input_cursorSeen = 1; } text_xoffset += spaceWidth; drawtext_wrap = 0; drawtext_hashCharAndWrap = 0; multiline_something_flag = 0; draw_setToZero = 0; } int fun_drawCharacter(int fontId, unsigned __int8 printableChar, int x, int y) { int result; // eax@2 int height; // [sp+4Ch] [bp-4h]@3 graphic_currentGraphicId = map_printChar_to_fontGraphic[printableChar]; if ( graphic_currentGraphicId ) { height = c3_sg2[fontId + graphic_currentGraphicId - 1].height - font_currentLineHeight[0]; if ( height < 0 ) height = 0; if ( printableChar < 96 ) height = 0; if ( printableChar == 199 ) height = 0; if ( printableChar == 231 ) height = 0; drawGraphic(fontId + graphic_currentGraphicId - 1, x, y - height); result = c3_sg2[fontId + graphic_currentGraphicId - 1].width; } else { result = 0; } return result; } // 660C8C: using guessed type int font_currentLineHeight[65819]; //----- (004CC9C0) -------------------------------------------------------- char unused_drawText_hashCharAndWrap() { char result; // al@2 char v1; // [sp+4Ch] [bp-4h]@1 v1 = drawtext_hashSomething[drawtext_hashCharAndWrap]; if ( v1 ) { ++drawtext_hashCharAndWrap; result = v1; } else { drawtext_hashCharAndWrap = 0; result = ' '; } return result; } // 78802C: using guessed type int drawtext_hashCharAndWrap; //----- (004CCA20) -------------------------------------------------------- void fun_drawGameTextCentered(int group, int number, int x, int y, int boxWidth, int fontId, __int16 color) { gametext_result = (char *)&c3eng_data + c3eng_index[group].offset; while ( number > 0 ) { if ( !*gametext_result ) { if ( *(gametext_result - 1) >= ' ' || !*(gametext_result - 1) ) --number; } ++gametext_result; } while ( *gametext_result < ' ' ) ++gametext_result; fun_drawTextCentered(gametext_result, x, y, boxWidth, fontId, color); draw_setToZero = 0; } // 6E6B1C: using guessed type int draw_setToZero; //----- (004CCB10) -------------------------------------------------------- void fun_drawGameText(int group, int number, int x, int y, int fontId, __int16 color) { gametext_result = (char *)&c3eng_data + c3eng_index[group].offset; while ( number > 0 ) { if ( !*gametext_result ) { if ( *(gametext_result - 1) >= 32 || !*(gametext_result - 1) ) --number; } ++gametext_result; } while ( *gametext_result < 32 ) ++gametext_result; fun_drawText(gametext_result, x, y, fontId, color); draw_setToZero = 0; } // 6E6B1C: using guessed type int draw_setToZero; //----- (004CCC00) -------------------------------------------------------- void fun_drawNumberSingularPlural(int group, int number, int amount, int x, int y, int fontId, __int16 color) { signed int v7; // [sp+4Ch] [bp-4h]@1 v7 = 1; if ( amount == 1 || amount == -1 ) v7 = 0; text_xoffset = 0; if ( amount >= 0 ) drawNumber(amount, ' ', " ", x, y, fontId, color); else drawNumber(-amount, '-', " ", x, y, fontId, color); fun_drawGameText(group, v7 + number, text_xoffset + x, y, fontId, color); } // 7E2724: using guessed type int text_xoffset; //----- (004CCCE0) -------------------------------------------------------- void fun_drawGameYearWithBcAd(int resolution, int value, int x, int y, int fontId, __int16 color) { text_xoffset = 0; if ( value >= 0 ) { fun_drawGameText(20, 1, text_xoffset + x, y, fontId, color); drawNumber(value, ' ', " ", text_xoffset + x, y, fontId, color); } else { drawNumber(-value, ' ', " ", text_xoffset + x, y, fontId, color); if ( resolution == 1 ) { text_xoffset -= 8; } else { if ( resolution == 2 ) text_xoffset -= 11; } fun_drawGameText(20, 0, text_xoffset + x, y, fontId, color); } } // 7E2724: using guessed type int text_xoffset; //----- (004CCE00) -------------------------------------------------------- void unused_drawNumberWithPrefixPostfix(int value, int showZero, const char *prefix, const char *postfix, int x, int y, int fontId, __int16 colorPositive, __int16 colorNegative) { int v9; // [sp+4Ch] [bp-4h]@1 v9 = text_xoffset; text_xoffset = 0; if ( value || showZero ) { if ( value >= 0 ) fun_drawText(prefix, x, y, fontId, colorPositive); else fun_drawText(prefix, x, y, fontId, colorNegative); if ( showZero == 2 ) { drawNumber(value, '@', postfix, text_xoffset + x, y, fontId, colorPositive); } else { if ( value >= 0 ) { if ( value <= 0 ) drawNumber(value, '@', postfix, text_xoffset + x, y, fontId, colorPositive); else drawNumber(value, '+', postfix, text_xoffset + x, y, fontId, colorPositive); } else { drawNumber(-value, '-', postfix, text_xoffset + x, y, fontId, colorNegative); } } text_xoffset += v9; } } // 7E2724: using guessed type int text_xoffset; //----- (004CCF90) -------------------------------------------------------- void drawNumber(signed int value, char prefix, const char *postfix, int x, int y, int fontId, __int16 color) { int numChars; // [sp+4Ch] [bp-4h]@1 numChars = 0; fun_intToString(value, 1, 0); if( prefix ) intToString_result[0] = prefix; while ( *(&intToString_result + numChars) ) ++numChars; while ( *postfix ) intToString_result[numChars++] = *postfix++; intToString_result[numChars] = 0; fun_drawText(intToString_result, x, y, fontId, color); draw_setToZero = 0; } // 6E6B1C: using guessed type int draw_setToZero; //----- (004CD080) -------------------------------------------------------- void fun_drawNumberCentered(signed int value, char a2, const char *postfix, int x, int y, int boxWidth, int fontId, __int16 color) { int v8; // ecx@3 int length; // [sp+4Ch] [bp-8h]@1 int len; // [sp+50h] [bp-4h]@1 len = 0; length = 0; fun_intToString(value, 1, 0); if ( a2 ) intToString_result[0] = a2; do v8 = intToString_result[len++]; while ( v8 ); while ( postfix[length] ) intToString_result[len++] = postfix[length++]; intToString_result[len] = 0; fun_drawTextCentered(intToString_result, x, y, boxWidth, fontId, color); draw_setToZero = 0; } // 6E6B1C: using guessed type int draw_setToZero; //----- (004CD190) -------------------------------------------------------- void unused_drawNumberCenteredColored(signed int value, int showZero, char a3, const char *postfix, int x, int y, int boxWidth, int fontId, __int16 positiveColor, __int16 negativeColor) { int v10; // eax@9 __int16 color; // [sp+4Ch] [bp-Ch]@5 int v12; // [sp+50h] [bp-8h]@1 int v13; // [sp+54h] [bp-4h]@1 v13 = 0; v12 = 0; if ( value || showZero ) { if ( value >= 0 ) color = positiveColor; else color = negativeColor; fun_intToString(value, 1, 1); if ( a3 ) intToString_result[0] = a3; do v10 = intToString_result[ v13++ ]; while ( v10 ); while ( postfix[v12] ) intToString_result[v13++] = postfix[v12++]; intToString_result[v13] = 0; fun_drawTextCentered(intToString_result, x, y, boxWidth, fontId, color); draw_setToZero = 0; } } // 6E6B1C: using guessed type int draw_setToZero; //----- (004CD2C0) -------------------------------------------------------- void unused_drawGameTextWrappedTwoBoxes(int group, int number, int xOffset, int yOffset, int boxWidth, int maxLines, int box2_xOffset, int box2_boxWidth, int fontId, __int16 a10) { char v10; // [sp+4Ch] [bp-24h]@23 signed int v11; // [sp+50h] [bp-20h]@16 int lines; // [sp+54h] [bp-1Ch]@10 int v13; // [sp+58h] [bp-18h]@16 signed int v14; // [sp+5Ch] [bp-14h]@10 signed int v15; // [sp+60h] [bp-10h]@10 int v16; // [sp+64h] [bp-Ch]@16 signed int i; // [sp+68h] [bp-8h]@13 int j; // [sp+68h] [bp-8h]@20 int y; // [sp+6Ch] [bp-4h]@10 textmultiline_longestLineLength = 0; draw_setToZero = 0; gametext_result = (char *)&c3eng_data + c3eng_index[group].offset; while ( number > 0 ) { if ( !*gametext_result ) { if ( *(gametext_result - 1) >= 32 || !*(gametext_result - 1) ) --number; } ++gametext_result; } while ( *gametext_result < 32 ) ++gametext_result; v15 = 1; lines = 0; y = yOffset; v14 = 0; while ( v15 ) { ++v14; if ( v14 >= 100 ) break; for ( i = 0; i < 2000; ++i ) str[i] = 0; v13 = 0; v16 = 0; v11 = 1; while ( v15 && v13 < boxWidth ) { v13 += fun_getWordWidth(gametext_result, fontId); if ( v13 >= boxWidth ) { if ( !v13 ) v15 = 0; } else { for ( j = 0; j < font_wordWidth; ++j ) { v10 = *gametext_result++; if ( !v11 || v10 != 32 ) { str[v16++] = v10; v11 = 0; } } if ( !*gametext_result ) v15 = 0; } } drawtext_wrap = 1; text_xoffset = 0; multiline_something_flag = 1; fun_drawText(str, xOffset, y, fontId, a10); if ( text_xoffset > textmultiline_longestLineLength ) textmultiline_longestLineLength = text_xoffset; ++lines; y += font_currentLineHeight[0] + 5; text_yoffset += font_currentLineHeight[0] + 5; if ( lines >= maxLines ) { xOffset = box2_xOffset; boxWidth = box2_boxWidth; } } } // 660C8C: using guessed type int font_currentLineHeight[65819]; // 6E6B1C: using guessed type int draw_setToZero; // 6E6B20: using guessed type int textmultiline_longestLineLength; // 788040: using guessed type int drawtext_wrap; // 7880CE: using guessed type char multiline_something_flag; // 7E2704: using guessed type int font_wordWidth; // 7E2724: using guessed type int text_xoffset; // 7E2824: using guessed type int text_yoffset; //----- (004CD5E0) -------------------------------------------------------- void fun_drawGameTextWrapped(int group, int number, int x, int y, int boxWidth, int fontId, __int16 a7) { fun_getGameTextString(group, number); fun_drawTextWrapped(gametext_result, x, y, boxWidth, fontId, a7); } //----- (004CD640) -------------------------------------------------------- void fun_drawTextWrapped(char *str, int xOffset, int yOffset, int boxWidth, int fontId, __int16 color) { char curCh; // [sp+4Ch] [bp-24h]@14 int v7; // [sp+50h] [bp-20h]@7 int v8; // [sp+54h] [bp-1Ch]@1 int currentWidth; // [sp+58h] [bp-18h]@7 signed int totalLines; // [sp+5Ch] [bp-14h]@1 signed int canContinue; // [sp+60h] [bp-10h]@1 int lineCharIndex; // [sp+64h] [bp-Ch]@7 signed int i; // [sp+68h] [bp-8h]@4 int j; // [sp+68h] [bp-8h]@11 int y; // [sp+6Ch] [bp-4h]@1 canContinue = 1; v8 = 0; y = yOffset; totalLines = 0; while ( canContinue ) { ++totalLines; if ( totalLines >= 100 ) break; for ( i = 0; i < 200; ++i ) textmultiline_line[i] = 0; currentWidth = 0; lineCharIndex = 0; v7 = 0; while ( canContinue && currentWidth < boxWidth ) { currentWidth += fun_getWordWidth(str, fontId); if ( currentWidth >= boxWidth ) { if ( !currentWidth ) canContinue = 0; } else { for ( j = 0; j < font_wordWidth; ++j ) { curCh = *str++; if ( !v7 || curCh != ' ' ) { textmultiline_line[lineCharIndex++] = curCh; v7 = 0; } } if ( !*str ) canContinue = 0; } } drawtext_wrap = 1; text_xoffset = 0; multiline_something_flag = 1; fun_drawText(textmultiline_line, xOffset, y, fontId, color);// draw line if ( text_xoffset > textmultiline_longestLineLength ) textmultiline_longestLineLength = text_xoffset; ++v8; y += font_currentLineHeight[0] + 5; text_yoffset += font_currentLineHeight[0] + 5; } } // 660C8C: using guessed type int font_currentLineHeight[65819]; // 6E6B20: using guessed type int textmultiline_longestLineLength; // 788040: using guessed type int drawtext_wrap; // 7880CE: using guessed type char multiline_something_flag; // 7E2704: using guessed type int font_wordWidth; // 7E2724: using guessed type int text_xoffset; // 7E2824: using guessed type int text_yoffset; //----- (004CD880) -------------------------------------------------------- int fun_getWordWidth(char *str, int fontId) { unsigned __int8 c; // [sp+4Ch] [bp-10h]@3 signed int numChars; // [sp+50h] [bp-Ch]@1 signed int shouldStop; // [sp+54h] [bp-8h]@1 int width; // [sp+58h] [bp-4h]@1 font_wordWidth = 0; width = 0; numChars = 0; shouldStop = 0; while ( 1 ) { ++numChars; if ( numChars >= 2000 ) break; c = *str++; if ( !c ) return width; if ( c == ' ' ) { if ( shouldStop ) return width; width += 4; } else { if ( c == '$' ) { if ( shouldStop ) return width; } else { if ( c >= ' ' ) { width += fun_getCharWidth(c, fontId); shouldStop = 1; } } } ++font_wordWidth; } return width; } // 7E2704: using guessed type int font_wordWidth; //----- (004CD9C0) -------------------------------------------------------- void fun_drawLine_setHelperVars(int x1, int y1, int x2, int y2) { drawline_ydir = 1; drawline_xdir = drawline_ydir; if ( x1 <= x2 ) drawline_xlen = x2 - x1; else drawline_xlen = x1 - x2; if ( y1 <= y2 ) drawline_ylen = y2 - y1; else drawline_ylen = y1 - y2; if ( drawline_ylen <= drawline_xlen ) { if ( x1 <= x2 ) { drawline_ymin = y1; drawline_ymax = y2; drawline_xmin = x1; drawline_xmax = x2; } else { drawline_ymin = y2; drawline_ymax = y1; drawline_xmin = x2; drawline_xmax = x1; } } else { if ( y1 <= y2 ) { drawline_ymin = y1; drawline_ymax = y2; drawline_xmin = x1; drawline_xmax = x2; } else { drawline_ymin = y2; drawline_ymax = y1; drawline_xmin = x2; drawline_xmax = x1; } } if ( drawline_xmax < drawline_xmin ) drawline_xdir = -1; if ( drawline_ymax < drawline_ymin ) drawline_ydir = -1; } // 6DED3C: using guessed type int drawline_xlen; // 6DED40: using guessed type int drawline_ylen; // 6DED44: using guessed type int drawline_xmax; // 6DED48: using guessed type int drawline_ymax; // 6DED50: using guessed type int drawline_xdir; // 6DED54: using guessed type int drawline_ydir; // 6DED5C: using guessed type int drawline_xmin; // 6DED60: using guessed type int drawline_ymin; //----- (004CDB60) -------------------------------------------------------- void fun_drawLine_something(int a1) { if ( a1 ) { if ( drawline_something >= 0 ) drawline_something += 2 * (drawline_xlen - drawline_ylen); else drawline_something += 2 * drawline_xlen; } else { if ( drawline_something >= 0 ) drawline_something += 2 * (drawline_ylen - drawline_xlen); else drawline_something += 2 * drawline_ylen; } } // 6AD9D4: using guessed type int drawline_something; // 6DED3C: using guessed type int drawline_xlen; // 6DED40: using guessed type int drawline_ylen; //----- (004CDC10) -------------------------------------------------------- void fun_drawDot(int x, int y, int color) { if ( x >= 0 ) { if ( x < ddraw_width ) { if ( y >= 0 ) { if ( y < ddraw_height ) fun_setPixel(x, y, color); } } } } //----- (004CDC80) -------------------------------------------------------- void unused_setIsometricPixel_safe(int x, int y, int color) { if ( x >= 0 ) { if ( x < ddraw_width ) { if ( y >= 0 ) { if ( y < ddraw_height ) unused_setIsometricPixel(x, y, color); } } } } //----- (004CDCF0) -------------------------------------------------------- void fun_drawLine(int x1, int y1, int x2, int y2, int color) { int v5; // [sp+4Ch] [bp-8h]@1 int i; // [sp+4Ch] [bp-8h]@10 int v7; // [sp+4Ch] [bp-8h]@16 int v8; // [sp+50h] [bp-4h]@1 int v9; // [sp+50h] [bp-4h]@10 int v10; // [sp+50h] [bp-4h]@16 fun_drawLine_setHelperVars(x1, y1, x2, y2); v5 = drawline_ymin; v8 = drawline_xmin; if ( x1 == x2 ) { while ( v5 <= drawline_ymax ) fun_drawDot(x1, v5++, color); } else { if ( y1 == y2 ) { while ( v8 <= drawline_xmax ) fun_drawDot(v8++, y1, color); } else { if ( drawline_ylen <= drawline_xlen ) { drawline_something = 2 * drawline_ylen - drawline_xlen; v10 = drawline_xmin; v7 = drawline_ymin; while ( v10 <= drawline_xmax ) { fun_drawDot(v10, v7, color); fun_drawLine_something(0); --drawline_xlen; if ( drawline_something >= 1 ) { --drawline_ylen; v7 += drawline_ydir; } ++v10; } } else { drawline_something = 2 * drawline_xlen - drawline_ylen; v9 = drawline_xmin; for ( i = drawline_ymin; i <= drawline_ymax; ++i ) { fun_drawDot(v9, i, color); fun_drawLine_something(1); --drawline_ylen; if ( drawline_something >= 1 ) { --drawline_xlen; v9 += drawline_xdir; } } } } } } // 6AD9D4: using guessed type int drawline_something; // 6DED3C: using guessed type int drawline_xlen; // 6DED40: using guessed type int drawline_ylen; // 6DED44: using guessed type int drawline_xmax; // 6DED48: using guessed type int drawline_ymax; // 6DED50: using guessed type int drawline_xdir; // 6DED54: using guessed type int drawline_ydir; // 6DED5C: using guessed type int drawline_xmin; // 6DED60: using guessed type int drawline_ymin; //----- (004CDF40) -------------------------------------------------------- void unused_drawDottedLine(int x1, int y1, int x2, int y2, int color) { int y; // [sp+4Ch] [bp-8h]@1 int x; // [sp+50h] [bp-4h]@1 fun_drawLine_setHelperVars(x1, y1, x2, y2); y = drawline_ymin; x = drawline_xmin; if ( x1 == x2 ) { while ( y <= drawline_ymax ) { fun_drawDot(x1, y, color); y += 2; } } else { if ( y1 == y2 ) { while ( x <= drawline_xmax ) { fun_drawDot(x, y1, color); x += 2; } } } } // 6DED44: using guessed type int drawline_xmax; // 6DED48: using guessed type int drawline_ymax; // 6DED5C: using guessed type int drawline_xmin; // 6DED60: using guessed type int drawline_ymin; //----- (004CE010) -------------------------------------------------------- void fun_drawRect(int x, int y, int width, int height, int color) { if ( x <= 0 ) x = 0; if ( width + x >= ddraw_width ) width = ddraw_width - x; if ( y <= 0 ) y = 0; if ( height + y >= ddraw_height ) height = ddraw_height - y; fun_drawLine(x, y, x + width - 1, y, color); fun_drawLine(x, y + height - 1, x + width - 1, y + height - 1, color); fun_drawLine(x, y, x, y + height - 1, color); fun_drawLine(x + width - 1, y, x + width - 1, y + height - 1, color); } //----- (004CE160) -------------------------------------------------------- void unused_setLineTransparencyOutline(int xOffset, int yOffset, int width) { int i; // [sp+4Ch] [bp-4h]@1 for ( i = xOffset; i < width + xOffset; ++i ) fun_setPixelTransparencyOutline(i, yOffset); } //----- (004CE1B0) -------------------------------------------------------- void fun_drawSelectionAnts(int xOffset, int yOffset, int width, int height) { int k; // [sp+4Ch] [bp-8h]@11 int l; // [sp+4Ch] [bp-8h]@16 int i; // [sp+50h] [bp-4h]@1 int j; // [sp+50h] [bp-4h]@6 selectAnts_color = selectAntsLong_color; selectAnts_index = 0; for ( i = xOffset; i < width + xOffset; ++i ) // top border { if ( fun_pixelWithinClipBounds(i, yOffset) ) fun_drawSelectionAntsPixel(i, yOffset); fun_nextSelectAntsColor(); } for ( j = xOffset; j < width + xOffset; ++j ) { if ( fun_pixelWithinClipBounds(j, yOffset + height - 1) ) fun_drawSelectionAntsPixel(j, yOffset + height - 1); fun_nextSelectAntsColor(); } for ( k = yOffset; k < height + yOffset; ++k ) { if ( fun_pixelWithinClipBounds(xOffset, k) ) fun_drawSelectionAntsPixel(xOffset, k); fun_nextSelectAntsColor(); } for ( l = yOffset; l < height + yOffset; ++l ) { if ( fun_pixelWithinClipBounds(j + width - 1, l) ) fun_drawSelectionAntsPixel(xOffset + width - 1, l); fun_nextSelectAntsColor(); } } // 6ADA48: using guessed type int selectAnts_color; // 6ADAC8: using guessed type int selectAnts_index; // 6ADCF4: using guessed type int selectAntsLong_color; //----- (004CE360) -------------------------------------------------------- void fun_nextSelectAntsColorLong() { ++selectAntsLong_index; if ( selectAntsLong_index >= 20 ) { selectAntsLong_index = 0; if ( selectAntsLong_color == 0xF800 ) { selectAntsLong_color = 0; } else { if ( selectAntsLong_color ) selectAntsLong_color = 0xF800u; else selectAntsLong_color = 0xFFFFu; } } } // 607FE0: using guessed type int selectAntsLong_index; // 6ADCF4: using guessed type int selectAntsLong_color; //----- (004CE3F0) -------------------------------------------------------- // Used for the edit empire -> selected city "ants" border void fun_nextSelectAntsColor() { ++selectAnts_index; if ( selectAnts_index >= 4 ) { selectAnts_index = 0; if ( selectAnts_color == 0xF800 ) { selectAnts_color = 0; } else { if ( selectAnts_color ) selectAnts_color = 0xF800u; else selectAnts_color = 0xFFFFu; } } } // 6ADA48: using guessed type int selectAnts_color; // 6ADAC8: using guessed type int selectAnts_index; //----- (004CE480) -------------------------------------------------------- void fun_drawInsetRect(int x, int y, int width, int height) { if ( x > 0 ) { if ( width + x >= ddraw_width ) width = ddraw_width - x; } else { x = 0; } if ( y > 0 ) { if ( height + y >= ddraw_height ) height = ddraw_height - y; } else { y = 0; } fun_drawLine(x, y, x + width - 1, y, 0x8410u); fun_drawLine(x + width - 1, y, x + width - 1, y + height - 1, 0xFFFFu); fun_drawLine(x, y + height - 1, x + width - 1, y + height - 1, 0xFFFFu); fun_drawLine(x, y, x, y + height - 1, 0x8410u); } //----- (004CE5D0) -------------------------------------------------------- void unused_drawDarkRect(int x, int y, int width, int height) { if ( x > 0 ) { if ( width + x >= ddraw_width ) width = ddraw_width - x; } else { x = 0; } if ( y > 0 ) { if ( height + y >= ddraw_height ) height = ddraw_height - y; } else { y = 0; } fun_drawLine(x, y, x + width - 1, y, 0x35u); fun_drawLine(x + width - 1, y, x + width - 1, y + height - 1, 0x35u); fun_drawLine(x, y + height - 1, x + width - 1, y + height - 1, 0x28u); fun_drawLine(x, y, x, y + height - 1, 0x28u); } //----- (004CE720) -------------------------------------------------------- void fun_drawOutsetRect(int x, int y, int width, int height) { if ( x > 0 ) { if ( width + x >= ddraw_width ) width = ddraw_width - x; } else { x = 0; } if ( y > 0 ) { if ( height + y >= ddraw_height ) height = ddraw_height - y; } else { y = 0; } fun_drawLine(x, y, x + width - 1, y, 0xFFFFu); fun_drawLine(x + width - 1, y, x + width - 1, y + height - 1, 0x8410u); fun_drawLine(x, y + height - 1, x + width - 1, y + height - 1, 0x8410u); fun_drawLine(x, y, x, y + height - 1, 0xFFFFu); } //----- (004CE870) -------------------------------------------------------- void unused_setIsometricTileOutlineColor(int xOffset, int yOffset, int width, signed int height, int color) { int yRight; // [sp+4Ch] [bp-Ch]@1 signed int yLeft2; // [sp+4Ch] [bp-Ch]@4 int yLeft; // [sp+50h] [bp-8h]@1 int yRight2; // [sp+50h] [bp-8h]@4 int xTop; // [sp+54h] [bp-4h]@1 int xBottom; // [sp+54h] [bp-4h]@4 signed int absWidth; // [sp+68h] [bp+10h]@1 absWidth = width + 2; xTop = 0; yLeft = height / 2 - 1; yRight = height / 2; while ( xTop < absWidth / 2 ) { unused_setIsometricPixel_safe(xTop + xOffset, yLeft + yOffset, color); unused_setIsometricPixel_safe(xTop + xOffset, yRight + yOffset, color); xTop += 2; --yLeft; ++yRight; } xBottom = absWidth / 2; yRight2 = height - 2; yLeft2 = 1; while ( xBottom < absWidth - 2 ) { unused_setIsometricPixel_safe(xBottom + xOffset, yRight2 + yOffset, color); unused_setIsometricPixel_safe(xBottom + xOffset, yLeft2 + yOffset, color); xBottom += 2; --yRight2; ++yLeft2; } } //----- (004CE9D0) -------------------------------------------------------- int unused_4CE9D0(int a1, int a2, int a3, signed int a4, int a5) { int result; // eax@4 int v6; // [sp+4Ch] [bp-Ch]@1 signed int v7; // [sp+4Ch] [bp-Ch]@4 int v8; // [sp+50h] [bp-8h]@1 int v9; // [sp+50h] [bp-8h]@4 int v10; // [sp+54h] [bp-4h]@1 int v11; // [sp+54h] [bp-4h]@4 signed int v12; // [sp+68h] [bp+10h]@1 v12 = a3 + 2; v10 = 0; v8 = a4 / 2 - 1; v6 = a4 / 2; while ( v10 < v12 / 2 ) { unused_413240(v10 + a1, v8 + a2, a5); v10 += 2; --v8; ++v6; } result = v12 / 2; v11 = v12 / 2; v9 = a4 - 2; v7 = 1; while ( v11 < v12 - 2 ) { unused_413240(v11 + a1, v7 + a2, a5); v11 += 2; result = v9-- - 1; ++v7; } return result; } //----- (004CEAF0) -------------------------------------------------------- int unused_4CEAF0(int a1, int a2, int a3, signed int a4, int a5) { int result; // eax@2 int i; // [sp+4Ch] [bp-Ch]@1 int v7; // [sp+50h] [bp-8h]@1 int v8; // [sp+54h] [bp-4h]@1 signed int v9; // [sp+68h] [bp+10h]@1 v9 = a3 + 2; v8 = 0; v7 = a4 / 2 - 1; for ( i = a4 / 2; ; ++i ) { result = v9 / 2; if ( v8 >= v9 / 2 ) break; unused_413240(v8 + a1, v7 + a2, a5); v8 += 2; --v7; } return result; } //----- (004CEB90) -------------------------------------------------------- int unused_4CEB90(int a1, int a2, int a3, int a4, int a5) { int result; // eax@1 signed int v6; // [sp+4Ch] [bp-Ch]@1 int v7; // [sp+50h] [bp-8h]@1 int v8; // [sp+54h] [bp-4h]@1 signed int v9; // [sp+68h] [bp+10h]@1 v9 = a3 + 2; result = v9 / 2; v8 = v9 / 2; v7 = a4 - 2; v6 = 1; while ( v8 < v9 - 2 ) { unused_413240(v8 + a1, v6 + a2, a5); v8 += 2; result = v7-- - 1; ++v6; } return result; } //----- (004CEC30) -------------------------------------------------------- void fun_fillRect(int x, int y, int width, int height, int color) { int i; // [sp+4Ch] [bp-4h]@12 if ( width > 0 ) { if ( height > 0 ) { if ( x <= 0 ) x = 0; if ( width + x >= ddraw_width ) width = ddraw_width - x; if ( y <= 0 ) y = 0; if ( height + y >= ddraw_height ) height = ddraw_height - y; for ( i = y; i < height + y; ++i ) fun_drawLine(x, i, x + width - 1, i, color); } } } //----- (004CED10) -------------------------------------------------------- void unused_andRect(int x, int y, int width, int height, __int16 color) { int v5; // ST00_4@16 int j; // [sp+50h] [bp-8h]@14 int i; // [sp+54h] [bp-4h]@12 if ( width > 0 ) { if ( height > 0 ) { if ( x <= 0 ) x = 0; if ( width + x >= ddraw_width ) width = ddraw_width - x; if ( y <= 0 ) y = 0; if ( height + y >= ddraw_height ) height = ddraw_height - y; for ( i = y; i < height + y; ++i ) { j = x; while ( j < width + x ) { v5 = j++; fun_andPixel(v5, i, color); } } } } } //----- (004CEE10) -------------------------------------------------------- void unused_fillGreenGraphicRectWithBorder(int x, int y, int widthBlocks, int heightBlocks) { int j; // [sp+4Ch] [bp-8h]@3 int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < heightBlocks; ++i ) { for ( j = 0; j < widthBlocks; ++j ) { if ( i ) { if ( i == heightBlocks - 1 ) graphic_currentGraphicId = 12; else graphic_currentGraphicId = 9; } else { graphic_currentGraphicId = 6; } if ( j ) { if ( j == widthBlocks - 1 ) graphic_currentGraphicId += 2; else ++graphic_currentGraphicId; } drawGraphic(graphic_currentGraphicId, 16 * j + x, 16 * i + y); } } } //----- (004CEF40) -------------------------------------------------------- void unused_fillGreenGraphicRect(int x, int y, int widthBlocks, int heightBlocks) { int j; // [sp+4Ch] [bp-8h]@3 int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < heightBlocks; ++i ) { for ( j = 0; j < widthBlocks; ++j ) drawGraphic(10, 16 * j + x, 16 * i + y); } } //----- (004CEFD0) -------------------------------------------------------- void unused_4CEFD0(int a1, int a2, int a3, int a4) { signed int v4; // [sp+4Ch] [bp-18h]@1 signed int v5; // [sp+50h] [bp-14h]@1 int v6; // [sp+54h] [bp-10h]@6 int v7; // [sp+58h] [bp-Ch]@6 int i; // [sp+5Ch] [bp-8h]@6 int j; // [sp+60h] [bp-4h]@8 v5 = 1; v4 = 1; while ( c3maps_width > v5 * a3 ) ++v5; while ( c3maps_height > v4 * a4 ) ++v4; v7 = c3maps_width / v5; v6 = c3maps_height / v4; for ( i = 0; i < v6; ++i ) { for ( j = 0; j < v7; ++j ) { *((_BYTE *)&ddraw_buffer[a1] + 2 * j + ddraw_scanline * (a2 + i)) = *(_BYTE *)(dword_607FD8 + 2 * v5 * j + 2 * c3maps_width * v4 * i); *((_BYTE *)&ddraw_buffer[j] + 2 * a1 + ddraw_scanline * (a2 + i) + 1) = *(_BYTE *)(dword_607FD8 + 2 * v5 * j + 2 * c3maps_width * v4 * i + 1); } } } // 607FD8: using guessed type int dword_607FD8; // 60803C: using guessed type int c3maps_width; // 608040: using guessed type int c3maps_height; // 6606AC: using guessed type int ddraw_scanline; //----- (004CF150) -------------------------------------------------------- int drawGraphic(signed int graphicId, int xOffset, int yOffset) { int result; // eax@2 LONG v4; // [sp+50h] [bp-8h]@43 drawGraphic_graphicId = graphicId; drawGraphic_xOffset = xOffset; drawGraphic_yOffset = yOffset; if ( graphicId <= 0 ) return 0; if ( graphicId >= 10000 ) return 0; drawGraphic_fileOffset = c3_sg2[graphicId].offset; if ( drawGraphic_fileOffset <= 0 ) return 0; _LOWORD(drawGraphic_width) = c3_sg2[graphicId].width; _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height; drawGraphic_type = c3_sg2[graphicId].type; graphic_xOffset = xOffset; graphic_yOffset = yOffset; drawGraphic_visiblePixelsClipX = (signed __int16)drawGraphic_width; if ( c3_sg2[graphicId].extern_flag && (signed __int16)drawGraphic_width <= ddraw_width ) { strcpy(drawGraphic_555file, &c3sg2_bitmaps[200 * c3_sg2[graphicId].bitmap_id]); fun_changeFileExtensionTo(drawGraphic_555file, &extension_555[4 * graphics_format_id]); if ( !fun_readDataFromFilename( drawGraphic_555file, screen_buffer, c3_sg2[graphicId].data_length, c3_sg2[graphicId].offset - 1) ) { fun_changeFileExtensionTo(drawGraphic_555file, "555"); if ( !fun_readDataFromFilename( drawGraphic_555file, screen_buffer, c3_sg2[graphicId].data_length, c3_sg2[graphicId].offset - 1) ) return 0; if ( c3_sg2[graphicId].compr_flag ) fun_convertCompressedGraphicToSurfaceFormat(screen_buffer, c3_sg2[graphicId].data_length); else fun_convertGraphicToSurfaceFormat(screen_buffer, c3_sg2[graphicId].data_length); } fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode == 5 ) return 0; if ( drawGraphic_type ) { if ( drawGraphic_clipYCode == 5 ) return 0; drawGraphic_fileOffset = 2 * (signed __int16)drawGraphic_width * drawGraphic_invisibleHeightClipTop; drawGraphic_fileOffset += 2 * drawGraphic_invisibleWidthClipLeft; if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicUncompressedClipLeft((char *)screen_buffer + drawGraphic_fileOffset); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicUncompressedClipRight((char *)screen_buffer + drawGraphic_fileOffset); else fun_drawGraphicUncompressedClipY((char *)screen_buffer + drawGraphic_fileOffset); } } else { if ( c3_sg2[graphicId].compr_flag ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedClipLeft((char *)screen_buffer); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedClipRight((char *)screen_buffer); else fun_drawGraphicCompressedFull((char *)screen_buffer); } } else { drawGraphic_fileOffset = 2 * (signed __int16)drawGraphic_width * drawGraphic_invisibleHeightClipTop; drawGraphic_fileOffset += 2 * drawGraphic_invisibleWidthClipLeft; if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicUncompressedClipLeft((char *)screen_buffer + drawGraphic_fileOffset); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicUncompressedClipRight((char *)screen_buffer + drawGraphic_fileOffset); else fun_drawGraphicUncompressedClipY((char *)screen_buffer + drawGraphic_fileOffset); } } } result = (signed __int16)drawGraphic_width; } else { if ( c3_sg2[graphicId].extern_flag ) { if ( window_id == 21 || window_id == 20 ) { drawGraphic_visiblePixelsClipX = fullscreenImage_width; drawGraphic_visiblePixelsClipY = fullscreenImage_height; drawGraphic_copyBytesInBufferForClipX = 2 * ((signed __int16)drawGraphic_width - drawGraphic_visiblePixelsClipX); drawGraphic_skipBytesInBufferForClipX = 2 * (ddraw_width - drawGraphic_visiblePixelsClipX); fun_drawGraphicUncompressedFull(&c3_555[2 * fullscreenImage_xOffset + 13000000] + 2 * (signed __int16)drawGraphic_width * fullscreenImage_yOffset); return drawGraphic_visiblePixelsClipX; } v4 = 2 * (signed __int16)drawGraphic_width * fullscreenImage_yOffset + 2 * fullscreenImage_xOffset; drawGraphic_visiblePixelsClipX = fullscreenImage_width; drawGraphic_visiblePixelsClipY = fullscreenImage_height; strcpy(drawGraphic_555file, &c3sg2_bitmaps[200 * c3_sg2[graphicId].bitmap_id]); fun_changeFileExtensionTo(drawGraphic_555file, &extension_555[4 * graphics_format_id]); if ( !fun_readUncompressedImageData( drawGraphic_555file, screen_buffer, 2 * drawGraphic_visiblePixelsClipX, drawGraphic_visiblePixelsClipY, v4) ) { fun_changeFileExtensionTo(drawGraphic_555file, "555"); if ( !fun_readUncompressedImageData( drawGraphic_555file, screen_buffer, 2 * drawGraphic_visiblePixelsClipX, drawGraphic_visiblePixelsClipY, v4) ) return 0; fun_convertGraphicToSurfaceFormat( screen_buffer, drawGraphic_visiblePixelsClipY * 2 * drawGraphic_visiblePixelsClipX); } drawGraphic_copyBytesInBufferForClipX = 0; drawGraphic_skipBytesInBufferForClipX = 0; fun_drawGraphicUncompressedFull((char *)screen_buffer); result = drawGraphic_visiblePixelsClipX; } else // internal { if ( drawGraphic_type == 30 )// isometric { switch ( (signed __int16)drawGraphic_width ) { case 58: _LOWORD(drawGraphic_height) = 30; break; case 26: _LOWORD(drawGraphic_height) = 14; break; case 10: _LOWORD(drawGraphic_height) = 6; break; default: if ( (signed __int16)drawGraphic_width == 118 ) return fun_drawBuildingFootprintSize2(); if ( (signed __int16)drawGraphic_width == 178 ) return fun_drawBuildingFootprintSize3(); if ( (signed __int16)drawGraphic_width == 238 ) return fun_drawBuildingFootprintSize4(); if ( (signed __int16)drawGraphic_width == 298 ) return fun_drawBuildingFootprintSize5(); break; } } fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode == 5 ) { result = 0; } else { if ( drawGraphic_type ) { if ( drawGraphic_type == 30 ) { if ( drawGraphic_clipXCode == 1 ) { switch ( (signed __int16)drawGraphic_width ) { case 58: fun_drawBuildingFootprint_xClipRight((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); break; case 26: fun_drawBuildingFootprint_26px_xClipRight(); break; case 10: fun_drawBuildingFootprint_10px_xClipRight(); break; default: fun_drawGraphicUncompressedClipLeft(&c3_555[drawGraphic_fileOffset]); break; } } else { if ( drawGraphic_clipXCode == 2 ) { switch ( (signed __int16)drawGraphic_width ) { case 58: fun_drawBuildingFootprint_xClipLeft((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); break; case 26: fun_drawBuildingFootprint_26px_xClipLeft(); break; case 10: fun_drawBuildingFootprint_10px_xClipLeft(); break; default: fun_drawGraphicUncompressedClipRight(&c3_555[drawGraphic_fileOffset]); break; } } else { switch ( (signed __int16)drawGraphic_width ) { case 58: fun_drawBuildingFootprint_xFull((int*)&c3_555[drawGraphic_fileOffset], drawGraphic_clipYCode); break; case 26: fun_drawBuildingFootprint_26px_xFull(); break; case 10: fun_drawBuildingFootprint_10px_xFull(); break; default: fun_drawGraphicUncompressedClipY(&c3_555[drawGraphic_fileOffset]); break; } } } } else { if ( drawGraphic_type == 13 && drawGraphic_clipXCode ) { fun_drawImage_32x32((int *)&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_type == 12 && drawGraphic_clipXCode ) { fun_drawImage_24x24((int *)&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_type == 10 && drawGraphic_clipXCode ) { fun_drawImage_16x16((int *)&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_type == 2 && drawGraphic_clipXCode ) { fun_drawGraphicType2(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_type == 20 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicLetterColoredClipLeft(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicLetterColoredClipRight(&c3_555[drawGraphic_fileOffset]); else fun_drawGraphicLetterColoredFull(&c3_555[drawGraphic_fileOffset]); } } else { drawGraphic_fileOffset += 2 * (signed __int16)drawGraphic_width * drawGraphic_invisibleHeightClipTop; drawGraphic_fileOffset += 2 * drawGraphic_invisibleWidthClipLeft; if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicUncompressedClipLeft(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipXCode == 2 ) { fun_drawGraphicUncompressedClipRight(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipYCode ) fun_drawGraphicUncompressedClipY(&c3_555[drawGraphic_fileOffset]); else fun_drawGraphicUncompressedFull(&c3_555[drawGraphic_fileOffset]); } } } } } } } } } else // type == 0 { if ( c3_sg2[graphicId].compr_flag ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedClipLeft(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedClipRight(&c3_555[drawGraphic_fileOffset]); else fun_drawGraphicCompressedFull(&c3_555[drawGraphic_fileOffset]); } if ( drawGraphic_colorMask ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedColorMaskClipLeft(&c3_555[drawGraphic_fileOffset], drawGraphic_colorMask); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedColorMaskClipRight(&c3_555[drawGraphic_fileOffset], drawGraphic_colorMask); else fun_drawGraphicCompressedColorMaskFull(&c3_555[drawGraphic_fileOffset], drawGraphic_colorMask); } } } else // not compressed { drawGraphic_fileOffset += 2 * (signed __int16)drawGraphic_width * drawGraphic_invisibleHeightClipTop; drawGraphic_fileOffset += 2 * drawGraphic_invisibleWidthClipLeft; if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicUncompressedClipLeft(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicUncompressedClipRight(&c3_555[drawGraphic_fileOffset]); else fun_drawGraphicUncompressedClipY(&c3_555[drawGraphic_fileOffset]); } } } result = drawGraphic_visiblePixelsClipX; } } } return result; } // 607FF4: using guessed type int graphics_format_id; // 6AD9C4: using guessed type int drawGraphic_invisibleWidthClipLeft; // 6ADAC4: using guessed type int drawGraphic_fileOffset; // 6ADBE8: using guessed type int drawGraphic_invisibleHeightClipTop; // 6ADC00: using guessed type int drawGraphic_copyBytesInBufferForClipX; // 6ADC08: using guessed type int drawGraphic_visiblePixelsClipX; // 6ADCD0: using guessed type int fullscreenImage_width; // 6ADD28: using guessed type char drawGraphic_type; // 6DEC38: using guessed type int drawGraphic_graphicId; // 6E6AFC: using guessed type int drawGraphic_xOffset; // 6E6B10: using guessed type int drawGraphic_yOffset; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2720: using guessed type int drawGraphic_skipBytesInBufferForClipX; // 7E2734: using guessed type int fullscreenImage_height; //----- (004D0090) -------------------------------------------------------- int fun_drawEnemyGraphic(signed int a1, int x, int y) { int result; // eax@2 if ( a1 > 0 ) { if ( a1 < 801 ) { drawGraphic_fileOffset = enemy_sg2[a1].offset; if ( drawGraphic_fileOffset > 0 ) { _LOWORD(drawGraphic_width) = enemy_sg2[a1].width; _LOWORD(drawGraphic_height) = enemy_sg2[a1].height; drawGraphic_type = enemy_sg2[a1].type; graphic_xOffset = x; graphic_yOffset = y; drawGraphic_visiblePixelsClipX = (signed __int16)drawGraphic_width; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode == 5 ) { result = 0; } else { if ( !drawGraphic_type ) { if ( enemy_sg2[a1].compr_flag ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedClipLeft(&c3_555[drawGraphic_fileOffset + 12100000]); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedClipRight(&c3_555[drawGraphic_fileOffset + 12100000]); else fun_drawGraphicCompressedFull(&c3_555[drawGraphic_fileOffset + 12100000]); } } } result = drawGraphic_visiblePixelsClipX; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } // 6ADAC4: using guessed type int drawGraphic_fileOffset; // 6ADC08: using guessed type int drawGraphic_visiblePixelsClipX; // 6ADD28: using guessed type char drawGraphic_type; //----- (004D0240) -------------------------------------------------------- void unused_4D0240(signed int graphicId, int a2, int a3) { if ( graphicId > 0 ) { if ( graphicId < 10000 ) { drawGraphic_fileOffset = c3_sg2[graphicId].offset; if ( drawGraphic_fileOffset > 0 ) { drawGraphic_fileOffset += c3_sg2[graphicId].uncompressed_length; _LOWORD(drawGraphic_width) = c3_sg2[graphicId].width; _LOWORD(drawGraphic_height) = c3_sg2[graphicId].has_compressed_part; graphic_xOffset = a2; graphic_yOffset = a3 - c3_sg2[graphicId].has_compressed_part; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedClipLeft(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedClipRight(&c3_555[drawGraphic_fileOffset]); else fun_drawGraphicCompressedFull(&c3_555[drawGraphic_fileOffset]); } } } } } } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (004D03B0) -------------------------------------------------------- void fun_drawBuilding(signed int graphicId, int a2, int a3) { if ( c3_sg2[graphicId].has_compressed_part > 0 ) { if ( graphicId > 0 ) { if ( graphicId < 10000 ) { drawGraphic_fileOffset = c3_sg2[graphicId].offset; if ( drawGraphic_fileOffset > 0 ) { drawGraphic_fileOffset += c3_sg2[graphicId].uncompressed_length; _LOWORD(drawGraphic_width) = c3_sg2[graphicId].width; switch ( (signed __int16)drawGraphic_width ) { case 298: graphic_xOffset = a2 - 120; graphic_yOffset = a3 - (c3_sg2[graphicId].height - 150); _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height - 76; break; case 238: graphic_xOffset = a2 - 90; graphic_yOffset = a3 - (c3_sg2[graphicId].height - 120); _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height - 61; break; case 178: graphic_xOffset = a2 - 60; graphic_yOffset = a3 - (c3_sg2[graphicId].height - 90); _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height - 46; break; case 118: graphic_xOffset = a2 - 30; graphic_yOffset = a3 - (c3_sg2[graphicId].height - 60); _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height - 31; break; case 58: graphic_xOffset = a2; graphic_yOffset = a3 - (c3_sg2[graphicId].height - 30); _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height - 16; break; } fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode != 5 ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedClipLeft(&c3_555[drawGraphic_fileOffset]); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedClipRight(&c3_555[drawGraphic_fileOffset]); else fun_drawGraphicCompressedFull(&c3_555[drawGraphic_fileOffset]); } if ( drawGraphic_colorMask ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedColorMaskClipLeft(&c3_555[drawGraphic_fileOffset], drawGraphic_colorMask); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedColorMaskClipRight(&c3_555[drawGraphic_fileOffset], drawGraphic_colorMask); else fun_drawGraphicCompressedColorMaskFull(&c3_555[drawGraphic_fileOffset], drawGraphic_colorMask); } } } } } } } } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (004D0780) -------------------------------------------------------- void fun_drawMinimapPixelGraphic(signed int graphicId, int x, int y) { if ( graphicId > 0 ) { if ( graphicId < 10000 ) { drawGraphic_fileOffset = c3_sg2[graphicId].offset; if ( drawGraphic_fileOffset > 0 ) { graphic_xOffset = x; graphic_yOffset = y; fun_drawMinimapPixel((int)&c3_555[drawGraphic_fileOffset]); } } } } // 6ADAC4: using guessed type int drawGraphic_fileOffset; //----- (004D0800) -------------------------------------------------------- void unused_4D0800() { ; } //----- (004D0820) -------------------------------------------------------- void fun_setGraphicXClipCode() { drawGraphic_clipXCode = 0; drawGraphic_invisibleWidthClipLeft = 0; drawGraphic_visibleWidthClipRight = (signed __int16)drawGraphic_width; if ( (signed __int16)drawGraphic_width > 0 ) { if ( graphic_xOffset >= draw_clip_x ) { if ( graphic_xOffset > draw_clip_xEnd - (signed __int16)drawGraphic_width ) { if ( graphic_xOffset < draw_clip_xEnd ) { drawGraphic_clipXCode = 2; drawGraphic_visibleWidthClipRight = draw_clip_xEnd - graphic_xOffset; } else { drawGraphic_clipXCode = 5; } } } else { if ( (signed __int16)drawGraphic_width + graphic_xOffset > draw_clip_x ) { drawGraphic_clipXCode = 1; drawGraphic_invisibleWidthClipLeft = draw_clip_x - graphic_xOffset; graphic_xOffset = draw_clip_x; } else { drawGraphic_clipXCode = 5; } } } else { drawGraphic_clipXCode = 5; } if ( drawGraphic_clipXCode == 5 ) drawGraphic_visiblePixelsClipX = 0; else drawGraphic_visiblePixelsClipX = drawGraphic_visibleWidthClipRight - drawGraphic_invisibleWidthClipLeft; drawGraphic_copyBytesInBufferForClipX = 2 * ((signed __int16)drawGraphic_width - drawGraphic_visiblePixelsClipX); drawGraphic_skipBytesInBufferForClipX = 2 * (ddraw_width - drawGraphic_visiblePixelsClipX); } // 6AD9C4: using guessed type int drawGraphic_invisibleWidthClipLeft; // 6ADBC4: using guessed type int drawGraphic_visibleWidthClipRight; // 6ADC00: using guessed type int drawGraphic_copyBytesInBufferForClipX; // 6ADC08: using guessed type int drawGraphic_visiblePixelsClipX; // 6ADD2C: using guessed type int draw_clip_x; // 6E6B4C: using guessed type int draw_clip_xEnd; // 7E2720: using guessed type int drawGraphic_skipBytesInBufferForClipX; //----- (004D09A0) -------------------------------------------------------- void fun_setGraphicYClipCode() { drawGraphic_clipYCode = 0; drawGraphic_invisibleHeightClipTop = 0; drawGraphic_visibleHeightClipBottom = (signed __int16)drawGraphic_height; if ( (signed __int16)drawGraphic_height > 0 ) { if ( graphic_yOffset >= draw_clip_y ) { if ( graphic_yOffset > draw_clip_yEnd - (signed __int16)drawGraphic_height ) { if ( graphic_yOffset < draw_clip_yEnd ) { drawGraphic_clipYCode = 4; drawGraphic_visibleHeightClipBottom = draw_clip_yEnd - graphic_yOffset; } else { drawGraphic_clipYCode = 5; } } } else { if ( (signed __int16)drawGraphic_height + graphic_yOffset > draw_clip_y ) { drawGraphic_clipYCode = 3; drawGraphic_invisibleHeightClipTop = draw_clip_y - graphic_yOffset; graphic_yOffset = draw_clip_y; } else { drawGraphic_clipYCode = 5; } } } else { drawGraphic_clipYCode = 5; } if ( drawGraphic_clipYCode == 5 ) drawGraphic_visiblePixelsClipY = 0; else drawGraphic_visiblePixelsClipY = drawGraphic_visibleHeightClipBottom - drawGraphic_invisibleHeightClipTop; if ( drawGraphic_clipXCode == 5 ) drawGraphic_clipYCode = 5; } // 6ADBE4: using guessed type int draw_clip_y; // 6ADBE8: using guessed type int drawGraphic_invisibleHeightClipTop; // 6DED4C: using guessed type int drawGraphic_visibleHeightClipBottom; // 7E26F8: using guessed type int draw_clip_yEnd; //----- (004D0B00) -------------------------------------------------------- bool fun_pixelWithinClipBounds(int xOffset, int yOffset) { bool result; // eax@2 if ( xOffset >= draw_clip_x ) { if ( xOffset <= draw_clip_xEnd ) { if ( yOffset >= draw_clip_y ) result = yOffset <= draw_clip_yEnd; else result = 0; } else { result = 0; } } else { result = 0; } return result; } // 6ADBE4: using guessed type int draw_clip_y; // 6ADD2C: using guessed type int draw_clip_x; // 6E6B4C: using guessed type int draw_clip_xEnd; // 7E26F8: using guessed type int draw_clip_yEnd; //----- (004D0B70) -------------------------------------------------------- int sub_4D0B70(signed int graphicId, int xOffset, int yOffset, __int16 colorMask) { int result; // eax@2 if ( graphicId > 0 && graphicId < 10000) { drawGraphic_fileOffset = c3_sg2[graphicId].offset; if ( drawGraphic_fileOffset > 0 ) { _LOWORD(drawGraphic_width) = c3_sg2[graphicId].width; _LOWORD(drawGraphic_height) = c3_sg2[graphicId].height; drawGraphic_type = c3_sg2[graphicId].type; graphic_xOffset = xOffset; graphic_yOffset = yOffset; drawGraphic_visiblePixelsClipX = (signed __int16)drawGraphic_width; fun_setGraphicXClipCode(); fun_setGraphicYClipCode(); if ( drawGraphic_clipYCode == 5 ) { result = 0; } else { if ( c3_sg2[graphicId].compr_flag ) { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicCompressedColorMaskClipLeft(&c3_555[drawGraphic_fileOffset], colorMask); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicCompressedColorMaskClipRight(&c3_555[drawGraphic_fileOffset], colorMask); else fun_drawGraphicCompressedColorMaskFull(&c3_555[drawGraphic_fileOffset], colorMask); } } else { if ( drawGraphic_clipXCode == 1 ) { fun_drawGraphicUncompressedColorMaskClipLeft(&c3_555[drawGraphic_fileOffset], colorMask); } else { if ( drawGraphic_clipXCode == 2 ) fun_drawGraphicUncompressedColorMaskClipRight(&c3_555[drawGraphic_fileOffset], colorMask); else fun_drawGraphicUncompressedColorMaskFull(&c3_555[drawGraphic_fileOffset], colorMask); } } result = drawGraphic_visiblePixelsClipX; } } else { result = 0; } } else { result = 0; } return result; } // 6ADAC4: using guessed type int drawGraphic_fileOffset; // 6ADC08: using guessed type int drawGraphic_visiblePixelsClipX; // 6ADD28: using guessed type char drawGraphic_type; //----- (004D0D90) -------------------------------------------------------- void fun_increaseSomeRandomCounters() { ++randomcounter_4; if ( randomcounter_4 >= 4 ) randomcounter_4 = 0; ++randomcounter_8; if ( randomcounter_8 >= 8 ) randomcounter_8 = 0; ++randomcounter_16; if ( randomcounter_16 >= 16 ) randomcounter_16 = 0; ++randomcounter_24; if ( randomcounter_24 >= 24 ) randomcounter_24 = 0; ++randomcounter_32; if ( randomcounter_32 >= 32 ) randomcounter_32 = 0; ++randomcounter_64; if ( randomcounter_64 >= 64 ) randomcounter_64 = 0; ++randomcounter_128; if ( randomcounter_128 >= 128 ) randomcounter_128 = 0; ++randomcounter_256; if ( randomcounter_256 >= 256 ) randomcounter_256 = 0; ++randomcounter_384; if ( randomcounter_384 >= 384 ) randomcounter_384 = 0; ++randomcounter_768; if ( randomcounter_768 >= 768 ) randomcounter_768 = 0; } // 6E6B30: using guessed type int randomcounter_16; // 6E6B34: using guessed type int randomcounter_24; // 6E6B38: using guessed type int randomcounter_32; // 6E6B44: using guessed type int randomcounter_64; // 7E1E88: using guessed type int randomcounter_4; // 7E1E8C: using guessed type int randomcounter_8; // 7E1EFC: using guessed type int randomcounter_128; // 7E1F04: using guessed type int randomcounter_256; // 7E2700: using guessed type int randomcounter_384; // 7E279C: using guessed type int randomcounter_768; //----- (004D0F60) -------------------------------------------------------- void unused_4D0F60() { ++dword_6E6AF8; if ( dword_6E6AF8 >= 128 ) dword_6E6AF8 = 0; dword_7E272C = dword_6E6AF8 >> 1; dword_7E271C = dword_7E272C >> 1; dword_7E2718 = dword_7E271C >> 1; dword_6ADA44 = dword_7E2718 >> 1; dword_6ADA38 = dword_7E2718 >> 1; ++dword_7E2794; if ( dword_7E2794 >= 96 ) dword_7E2794 = 0; dword_7E2728 = dword_7E2794 >> 1; dword_7E2714 = dword_7E2728 >> 1; dword_7E2710 = dword_7E2714 >> 1; dword_6ADA40 = dword_7E2710 >> 1; } void fun_generateRandomness() { unsigned int v0; // ST50_4@5 unsigned int v1; // [sp+4Ch] [bp-Ch]@5 signed int i; // [sp+54h] [bp-4h]@3 random_pool[random_poolIndex++] = random_7f_1; if ( random_poolIndex >= 100 ) random_poolIndex = 0; for ( i = 0; i < 31; ++i ) { v0 = ((random_iv1 & 0x10u) >> 4) ^ random_iv1 & 1; v1 = ((random_iv2 & 0x10u) >> 4) ^ random_iv2 & 1; random_iv1 = (unsigned int)random_iv1 >> 1; random_iv2 = (unsigned int)random_iv2 >> 1; if ( v0 ) random_iv1 |= 0x40000000u; if ( v1 ) random_iv2 |= 0x40000000u; } random_7fff_1 = random_iv1 & 0x7FFF; random_7f_1 = random_iv1 & 0x7F; unused_random_7_1 = random_iv1 & 7; unused_random_7fff_2 = random_iv2 & 0x7FFF; random_7f_2 = random_iv2 & 0x7F; unused_random_7_2 = random_iv2 & 7; } void fun_generateRandomnessPool() { signed int i; // [sp+4Ch] [bp-4h]@1 random_poolIndex = 0; for ( i = 0; i < 100; ++i ) fun_generateRandomness(); } void unused_4D1240() { unsigned int v0; // ST4C_4@3 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 31; ++i ) { v0 = ((dword_6ADD24 & 0x10u) >> 4) ^ dword_6ADD24 & 1; dword_6ADD24 = (unsigned int)dword_6ADD24 >> 1; if ( v0 ) dword_6ADD24 |= 0x40000000u; } dword_7E270C = dword_6ADD24 & 0x7F; } // 6ADD24: using guessed type int dword_6ADD24; // 7E270C: using guessed type int dword_7E270C; //----- (004D12E0) -------------------------------------------------------- int unused_4D12E0(int a1) { int result; // eax@2 signed int v2; // eax@35 int v3; // [sp+50h] [bp-8h]@34 signed int v4; // [sp+54h] [bp-4h]@4 if ( a1 > 0 ) { if ( a1 > 1 ) { if ( a1 > 3 ) { if ( a1 > 7 ) { if ( a1 > 15 ) { if ( a1 > 31 ) { if ( a1 > 63 ) { if ( a1 > 127 ) { if ( a1 > 255 ) { if ( a1 > 511 ) { if ( a1 > 1023 ) { if ( a1 > 2047 ) { if ( a1 > 4095 ) { if ( a1 > 8191 ) { if ( a1 > 16383 ) { if ( a1 > 32767 ) v4 = 65535; else v4 = 32767; } else { v4 = 16383; } } else { v4 = 8191; } } else { v4 = 4095; } } else { v4 = 2047; } } else { v4 = 1023; } } else { v4 = 511; } } else { v4 = 255; } } else { v4 = 127; } } else { v4 = 63; } } else { v4 = 31; } } else { v4 = 15; } } else { v4 = 7; } } else { v4 = 3; } } else { v4 = 1; } v3 = 0; while ( 1 ) { v2 = v3++; if ( v2 >= 10 ) break; if ( (v4 & random_7fff_1) <= a1 ) return v4 & random_7fff_1; fun_generateRandomness(); } result = 0; } else { result = 0; } return result; } // 6DEC40: using guessed type int random_7fff_1; int fun_adjustWithPercentage(int value, int percentage) { return percentage * value / 100; } int unused_adjustWithPromille(int value, int promille) { return promille * value / 10000; } int getPercentage(int value, signed int max) { signed int value100; // [sp+54h] [bp+8h]@1 int percentage; // [sp+54h] [bp+8h]@2 value100 = 100 * value; if ( max ) percentage = value100 / max; else percentage = 0; return percentage; } int unused_divideAndRoundUp(signed int value, signed int divisor) { int result; // eax@2 int v3; // [sp+50h] [bp-4h]@3 if ( divisor ) { v3 = value / divisor; if ( value % divisor ) ++v3; result = v3; } else { result = 0; } return result; } //----- (004D15D0) -------------------------------------------------------- int unused_4D15D0(int a1, int *a2, int a3, int a4) { int v4; // ST50_4@3 int v6; // [sp+4Ch] [bp-Ch]@3 int i; // [sp+54h] [bp-4h]@1 int *v8; // [sp+64h] [bp+Ch]@3 for ( i = 0; i < a3; ++i ) { v4 = *a2; v8 = a2 + 1; v6 = *v8; a2 = v8 + 1; if ( a1 < v4 ) return v6; } return a4; } //----- (004D1650) -------------------------------------------------------- int fun_getDistanceXplusY(int x1, int y1, int x2, int y2) { if ( x1 <= x2 ) { if ( x1 >= x2 ) distance_x = 0; else distance_x = x2 - x1; } else { distance_x = x1 - x2; } if ( y1 <= y2 ) { if ( y1 >= y2 ) distance_y = 0; else distance_y = y2 - y1; } else { distance_y = y1 - y2; } return distance_y + distance_x; } // 6ADBD0: using guessed type int distance_y; // 6ADD20: using guessed type int distance_x; //----- (004D1700) -------------------------------------------------------- int fun_getDistanceMaximum(int x1, int y1, int x2, int y2) { int result; // eax@12 if ( x1 <= x2 ) { if ( x1 >= x2 ) distance_x = 0; else distance_x = x2 - x1; } else { distance_x = x1 - x2; } if ( y1 <= y2 ) { if ( y1 >= y2 ) distance_y = 0; else distance_y = y2 - y1; } else { distance_y = y1 - y2; } if ( distance_x >= distance_y ) result = distance_x; else result = distance_y; return result; } // 6ADBD0: using guessed type int distance_y; // 6ADD20: using guessed type int distance_x; //----- (004D17C0) -------------------------------------------------------- int fun_getDistanceMinimum(int x1, int y1, int x2, int y2) { int result; // eax@12 if ( x1 <= x2 ) { if ( x1 >= x2 ) distance_x = 0; else distance_x = x2 - x1; } else { distance_x = x1 - x2; } if ( y1 <= y2 ) { if ( y1 >= y2 ) distance_y = 0; else distance_y = y2 - y1; } else { distance_y = y1 - y2; } if ( distance_x >= distance_y ) result = distance_y; else result = distance_x; return result; } // 6ADBD0: using guessed type int distance_y; // 6ADD20: using guessed type int distance_x; //----- (004D1880) -------------------------------------------------------- void unused_clearSg2Records() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 300; ++i ) graphic_id_start[i] = 0; fun_memset(c3sg2_bitmaps, 20000, 0); fun_memset(c3_sg2, 640000, 0); fun_memset(enemy_sg2, 51264, 0); } // 6E6BB0: using guessed type __int16 graphic_id_start[]; //----- (004D1920) -------------------------------------------------------- void fun_prepareClimateGraphics() { signed int i; // [sp+4Ch] [bp-4h]@1 graphicPrepare_offset = 4; for ( i = 1; i < 10000; ++i ) { if ( c3_sg2[i].extern_flag ) { if ( !c3_sg2[i].offset ) c3_sg2[i].offset = 1; } else { c3_sg2[i].offset = graphicPrepare_offset; graphicPrepare_offset += c3_sg2[i].data_length; if ( c3_sg2[i].data_length > 0 ) { if ( c3_sg2[i].type == 30 ) { if ( c3_sg2[i].has_compressed_part ) { fun_convertGraphicToSurfaceFormat((__int16 *)&c3_555[c3_sg2[i].offset], c3_sg2[i].uncompressed_length); fun_convertCompressedGraphicToSurfaceFormat( (__int16 *)(&c3_555[c3_sg2[i].offset] + c3_sg2[i].uncompressed_length), c3_sg2[i].data_length - c3_sg2[i].uncompressed_length); } else { fun_convertGraphicToSurfaceFormat((__int16 *)&c3_555[c3_sg2[i].offset], c3_sg2[i].data_length); } } else { if ( c3_sg2[i].compr_flag ) fun_convertCompressedGraphicToSurfaceFormat((__int16 *)&c3_555[c3_sg2[i].offset], c3_sg2[i].data_length); else fun_convertGraphicToSurfaceFormat((__int16 *)&c3_555[c3_sg2[i].offset], c3_sg2[i].data_length); } } } } } // 6E6B54: using guessed type int graphicPrepare_offset; //----- (004D1B60) -------------------------------------------------------- void fun_prepareEnemyGraphics() { signed int i; // [sp+4Ch] [bp-4h]@1 graphicPrepare_offset = 4; for ( i = 1; i < 801; ++i ) { if ( enemy_sg2[i].extern_flag ) { if ( !enemy_sg2[i].offset ) enemy_sg2[i].offset = 1; } else { enemy_sg2[i].offset = graphicPrepare_offset; graphicPrepare_offset += enemy_sg2[i].data_length; if ( enemy_sg2[i].data_length > 0 ) { if ( enemy_sg2[i].compr_flag ) fun_convertCompressedGraphicToSurfaceFormat( (__int16 *)&c3_555[enemy_sg2[i].offset + 12100000], enemy_sg2[i].data_length); else fun_convertGraphicToSurfaceFormat( (__int16 *)&c3_555[enemy_sg2[i].offset + 12100000], enemy_sg2[i].data_length); } } } } // 6E6B54: using guessed type int graphicPrepare_offset; //----- (004D1CD0) -------------------------------------------------------- void unused_prepareUnknownGraphics() { ; } //----- (004D1CF0) -------------------------------------------------------- void fun_convertCompressedGraphicToSurfaceFormat(__int16 *graphicData, int dataLength) { int bytesToGo; // edx@3 __int16 *ptr; // esi@3 char length; // cl@6 if ( graphics_format_id == 2 ) { ptr = graphicData; bytesToGo = dataLength; while ( bytesToGo && bytesToGo >= 0 ) { length = *(_BYTE *)ptr; if ( *(_BYTE *)ptr == -1 ) { ++ptr; bytesToGo -= 2; } else { ptr = (__int16 *)((char *)ptr + 1); --bytesToGo; while ( length > 0 ) { *ptr = *ptr & 0x1F | 2 * (*ptr & 0x7FE0); ++ptr; bytesToGo -= 2; --length; } } } } } // 607FF4: using guessed type int graphics_format_id; //----- (004D1D80) -------------------------------------------------------- void fun_convertGraphicToSurfaceFormat(__int16 *graphicData, int dataLength) { int i; // edx@3 __int16 *ptr; // esi@3 if ( graphics_format_id == 2 ) { ptr = graphicData; for ( i = dataLength; i > 0; i -= 2 ) { if ( *ptr != 0xF81Fu ) *ptr = *ptr & 0x1F | 2 * (*ptr & 0xFFE0); ++ptr; } } } // 607FF4: using guessed type int graphics_format_id; //----- (004D1DF0) -------------------------------------------------------- signed int unused_4D1DF0(const CHAR *filename, int a2) { signed int v3; // [sp+4Ch] [bp-4h]@1 dword_607FD4 = 0; v3 = 0; dword_607FD4 = malloc(3100000u); if ( dword_607FD4 ) { if ( fun_readFileIntoBuffer(filename, (void *)dword_607FD4) ) unused_4D3E10((const char *)dword_607FD4, a2, 3000000); else v3 = 6; } else { v3 = 3; } if ( dword_607FD4 ) j_freeMemory((void *)dword_607FD4); return v3; } //----- (004D1EB0) -------------------------------------------------------- signed int unused_rectangleIsNotWhite(char *buffer, int width, int height, int xMin, int yMin, int xMax, int yMax) { if ( xMin < 0 ) xMin = 0; if ( yMin < 0 ) yMin = 0; if ( xMax >= width ) xMax = width - 1; if ( yMax >= height ) yMax = height - 1; for ( drawline_ydir = yMin; drawline_ydir <= yMax; ++drawline_ydir ) { for ( drawline_xdir = xMin; drawline_xdir <= xMax; ++drawline_xdir ) { if ( *(&buffer[2 * drawline_xdir] + 2 * width * drawline_ydir) != -1 ) return 1; if ( *(&buffer[2 * width * drawline_ydir + 1] + 2 * drawline_xdir) != -1 ) return 1; } } return 0; } // 6DED50: using guessed type int drawline_xdir; // 6DED54: using guessed type int drawline_ydir; //----- (004D2000) -------------------------------------------------------- signed int unused_rectangleIsWhite(char *buffer, int width, int height, int xMin, int yMin, int xMax, int yMax) { if ( xMin < 0 ) xMin = 0; if ( yMin < 0 ) yMin = 0; if ( xMax >= width ) xMax = width - 1; if ( yMax >= height ) yMax = height - 1; for ( drawline_ydir = yMin; drawline_ydir <= yMax; ++drawline_ydir ) { for ( drawline_xdir = xMin; drawline_xdir <= xMax; ++drawline_xdir ) { if ( *(&buffer[2 * drawline_xdir] + 2 * width * drawline_ydir) == -1 ) return 1; if ( *(&buffer[2 * width * drawline_ydir + 1] + 2 * drawline_xdir) == -1 ) return 1; } } return 0; } // 6DED50: using guessed type int drawline_xdir; // 6DED54: using guessed type int drawline_ydir; //----- (004D2150) -------------------------------------------------------- void fun_findFiles(const char *mask) { signed int i; // [sp+4Ch] [bp-14Ch]@1 signed int j; // [sp+50h] [bp-148h]@7 HANDLE fileptr; // [sp+54h] [bp-144h]@4 struct _WIN32_FIND_DATAA FindFileData; // [sp+58h] [bp-140h]@4 findfiles_flag_unused = 0; findfiles_numFiles = 0; for ( i = 0; i < 100; ++i ) findfiles_filenames[65 * i] = 0; fileptr = FindFirstFileA(mask, &FindFileData); if ( fileptr != (HANDLE)-1 ) { do { if ( findfiles_numFiles >= 100 ) break; for ( j = 0; j < 34; ++j ) *(&findfiles_filenames[65 * findfiles_numFiles] + j) = FindFileData.cFileName[j]; fun_removeFileExtension(&findfiles_filenames[65 * findfiles_numFiles++]); } while ( FindNextFileA(fileptr, &FindFileData) ); FindClose(fileptr); fun_findFiles_sort(); findfiles_flag_unused = 0; } } // 66056C: using guessed type int findfiles_flag_unused; // 660BF8: using guessed type int findfiles_numFiles; //----- (004D22E0) -------------------------------------------------------- void fun_findFiles_sort() { int v0; // eax@2 char src; // [sp+50h] [bp-34h]@11 int v2; // [sp+78h] [bp-Ch]@1 int change; // [sp+7Ch] [bp-8h]@1 int i; // [sp+80h] [bp-4h]@4 change = 1; v2 = 0; while ( 1 ) { v0 = v2++; if ( v0 >= 101 ) break; if ( !change ) break; change = 0; for ( i = 0; i < 99 && findfiles_filenames[65 * i] && findfiles_filenames[65 * (i + 1)]; ++i ) { if ( findfiles_filenames[65 * i] > findfiles_filenames[65 * (i + 1)] ) { change = 1; fun_strncpy(&findfiles_filenames[65 * i], &src, 34); fun_strncpy(&findfiles_filenames[65 * (i + 1)], &findfiles_filenames[65 * i], 34); fun_strncpy(&src, &findfiles_filenames[65 * (i + 1)], 34); } } } } //----- (004D2680) -------------------------------------------------------- void fun_changeFileExtensionTo(char *filename, char *extension) { fun_strncpy(extension, current_fileExtension, 3); fun_changeFileExtension(filename); } // 660B81: using guessed type char getextension_result_1; // 660B82: using guessed type char getextension_result_2; // 660B83: using guessed type char getextension_result_3; //----- (004D2770) -------------------------------------------------------- void fun_changeFileExtension(char *a1) { char v1; // [sp+4Ch] [bp-4h]@1 //char *v2; // [sp+58h] [bp+8h]@4 do v1 = *a1++; while ( v1 != '.' && v1 ); if ( v1 == '.' ) { fun_strncpy( current_fileExtension, a1, 3); /*v2 = a1 + 1; *v2++ = getextension_result_1; *v2 = getextension_result_2; v2[1] = 0;*/ } } // 660B81: using guessed type char getextension_result_1; // 660B82: using guessed type char getextension_result_2; //----- (004D2830) -------------------------------------------------------- void fun_removeFileExtension(char *filename) { unsigned __int8 v1; // [sp+4Ch] [bp-4h]@1 do v1 = *filename++; while ( v1 != '.' && v1 ); if ( v1 == '.' ) *(filename - 1) = 0; } //----- (004D28A0) -------------------------------------------------------- void fun_appendFileExtension(char *filename) { char v1; // ST4C_1@1 do v1 = *filename++; while ( v1 ); *(filename - 1) = '.'; *filename = *current_fileExtension; filename[1] = getextension_result_1; filename[2] = getextension_result_2; filename[3] = 0; } // 660B81: using guessed type char getextension_result_1; // 660B82: using guessed type char getextension_result_2; //----- (004D2920) -------------------------------------------------------- char unused_getIndexOfFileExtension(char *filename) { char index; // [sp+4Ch] [bp-8h]@1 unsigned __int8 c; // [sp+50h] [bp-4h]@2 index = 0; do { c = *filename++; ++index; } while ( c != '.' && c ); return index; } //----- (004D2980) -------------------------------------------------------- signed int fun_fileExists(const char *filename) { signed int result; // eax@2 signed int v2; // [sp+4Ch] [bp-8h]@1 int fd; // [sp+50h] [bp-4h]@1 int fd2; // [sp+50h] [bp-4h]@3 v2 = 0; fd = _open(filename, 0x8000u); if ( fd < 0 ) { fun_chdirToCdBasedOnExtension(filename); fd2 = _open(filename, 0x8000u); if ( fd2 >= 0 ) { v2 = 1; _close(fd2); } fun_chdirHome(); result = v2; } else { _close(fd); result = 1; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D2A30) -------------------------------------------------------- signed int fun_fileExistsHome(const char *filename) { signed int result; // eax@2 int fd; // [sp+50h] [bp-4h]@1 fun_chdirHome(); fd = _open(filename, 0x8000u); if ( fd < 0 ) { result = 0; } else { _close(fd); result = 1; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D2AA0) -------------------------------------------------------- signed int fun_fileExistsOnCdWithMinimumLength(const char *filename, int length) { signed int result; // eax@2 signed int v3; // [sp+50h] [bp-8h]@1 int fd; // [sp+54h] [bp-4h]@3 v3 = 0; if ( fun_chdirToCdBasedOnExtension(filename) ) { fd = _open(filename, 32768); if ( fd >= 0 ) { if ( _filelength(fd) > length ) v3 = 1; _close(fd); } fun_chdirHome(); result = v3; } else { result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 53F926: using guessed type _DWORD _filelength(_DWORD); //----- (004D2B40) -------------------------------------------------------- int fun_readDataFromFilename(const char *filename, void *buffer, DWORD nNumberOfBytesToRead, LONG lDistanceToMove) { int bytesRead; // [sp+4Ch] [bp-54h]@1 char cdFilename[65]; // [sp+50h] [bp-50h]@9 int seekResult; // [sp+94h] [bp-Ch]@2 int i; // [sp+98h] [bp-8h]@7 int fd; // [sp+9Ch] [bp-4h]@1 bytesRead = 0; fd = _open(filename, 0x8000u); if ( fd != -1 ) { seekResult = _lseek(fd, lDistanceToMove, SEEK_SET); if ( seekResult != -1 ) bytesRead = _read(fd, buffer, nNumberOfBytesToRead); _close(fd); } if ( bytesRead <= 0 ) // look in subfolder based on extension { for ( i = 0; i < 65; ++i ) cdFilename[i] = 0; fun_storeFileExtension(filename); fun_strtoupper(current_fileExtension); if ( strcmp("555", current_fileExtension) ) { strcpy(cdFilename, filename); } else { strcpy(cdFilename, "555\\"); strcpy(&cdFilename[4], filename); } fd = _open(cdFilename, 0x8000u); if ( fd != -1 ) { seekResult = _lseek(fd, lDistanceToMove, 0); if ( seekResult != -1 ) bytesRead = _read(fd, buffer, nNumberOfBytesToRead); _close(fd); } if ( bytesRead <= 0 ) // last resort: try the cd { fun_chdirToCdBasedOnExtension(cdFilename); fd = _open(cdFilename, 32768); if ( fd != -1 ) { seekResult = _lseek(fd, lDistanceToMove, 0); if ( seekResult != -1 ) bytesRead = _read(fd, buffer, nNumberOfBytesToRead); _close(fd); } fun_chdirHome(); } } return bytesRead; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D2D80) -------------------------------------------------------- int fun_readUncompressedImageData(const char *Source, void *buffer, DWORD nNumberOfBytesToRead, int times, LONG lDistanceToMove) { int bytesRead; // [sp+4Ch] [bp-58h]@1 char filename[68]; // [sp+50h] [bp-54h]@11 LONG v8; // [sp+94h] [bp-10h]@1 int seekResult; // [sp+98h] [bp-Ch]@2 int i; // [sp+9Ch] [bp-8h]@3 int fd; // [sp+A0h] [bp-4h]@1 bytesRead = 0; v8 = 2 * (signed __int16)drawGraphic_width - nNumberOfBytesToRead; fd = _open(Source, 32768); if ( fd != -1 ) { seekResult = _lseek(fd, lDistanceToMove, SEEK_SET); if ( seekResult != -1 ) { for ( i = 0; i < times; ++i ) { bytesRead += _read(fd, buffer, nNumberOfBytesToRead); seekResult = _lseek(fd, v8, SEEK_CUR); buffer = (char *)buffer + nNumberOfBytesToRead; } } _close(fd); } if ( bytesRead <= 0 ) { for ( i = 0; i < 65; ++i ) filename[i] = 0; fun_storeFileExtension(Source); fun_strtoupper(current_fileExtension); if ( strcmp("555", current_fileExtension) ) { strcpy(filename, Source); } else { strcpy(filename, "555\\"); strcpy(&filename[4], Source); } fd = _open(filename, 32768); if ( fd != -1 ) { seekResult = _lseek(fd, lDistanceToMove, 0); if ( seekResult != -1 ) { for ( i = 0; i < times; ++i ) { bytesRead += _read(fd, buffer, nNumberOfBytesToRead); seekResult = _lseek(fd, v8, 1u); buffer = (char *)buffer + nNumberOfBytesToRead; } } _close(fd); } if ( bytesRead <= 0 ) { fun_chdirToCdBasedOnExtension(filename); fd = _open(filename, 0x8000u); if ( fd != -1 ) { seekResult = _lseek(fd, lDistanceToMove, 0); if ( seekResult != -1 ) { for ( i = 0; i < times; ++i ) { bytesRead += _read(fd, buffer, nNumberOfBytesToRead); seekResult = _lseek(fd, v8, 1u); buffer = (char *)buffer + nNumberOfBytesToRead; } } _close(fd); } fun_chdirHome(); } } return bytesRead; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D30D0) -------------------------------------------------------- int unused_writeToFilename(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite) { int result; // eax@2 int written; // ST58_4@3 int fd; // [sp+50h] [bp-4h]@1 fd = _open(filename, 0x8301u); if ( fd == -1 ) { result = 0; } else { written = _write(fd, buffer, nNumberOfBytesToWrite); _close(fd); result = written; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D3650) -------------------------------------------------------- int unused_traceEnabled() { return 0; } //----- (004D3670) -------------------------------------------------------- void fun_writeTraceMessage() { ; } //----- (004D3720) -------------------------------------------------------- int fun_writeToFilenameAtOffset(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite, LONG offset) { int result; // eax@2 int v5; // ST5C_4@5 int fd; // [sp+54h] [bp-4h]@1 fd = _open(filename, 0x8101u); if ( fd == -1 ) { result = 0; } else { if ( _lseek(fd, offset, 0) == -1 ) { result = 0; } else { v5 = _write(fd, buffer, nNumberOfBytesToWrite); _close(fd); result = v5; } } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D37C0) -------------------------------------------------------- int fun_writeToFilenameAppend(const char *filename, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite) { int result; // eax@2 int written; // ST5C_4@5 int fd; // [sp+54h] [bp-4h]@1 fd = _open(filename, 0x8101u); if ( fd == -1 ) { result = 0; } else { if ( _lseek(fd, 0, SEEK_END) == -1 ) { result = 0; } else { written = _write(fd, lpBuffer, nNumberOfBytesToWrite); _close(fd); result = written; } } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D3860) -------------------------------------------------------- char unused_findResaudVersionNumberInFile(const char *filename, char *buffer) { char result; // al@2 signed int len; // [sp+4Ch] [bp-4h]@1 len = 1000; if ( fun_readDataFromFilename(filename, buffer, 0x3E8u, 0) ) { while ( len > 0 && fun_strFirstDifferenceIndex(buffer, "resaud", 6) ) { --len; ++buffer; } if ( len > 0 ) result = buffer[7]; else result = 0; } else { result = 1; } return result; } //----- (004D3910) -------------------------------------------------------- signed int unused_readFileIntoBufferFromFileDialog(char *filter, void *buffer, char *filename, char *title) { signed int result; // eax@2 DWORD len; // ST58_4@5 int fd; // [sp+50h] [bp-54h]@3 OPENFILENAMEA Dst; // [sp+58h] [bp-4Ch]@1 memset(&Dst, 0, 76u); Dst.lStructSize = 76; Dst.hwndOwner = main_window; Dst.lpstrFilter = filter; Dst.nFilterIndex = 1; Dst.lpstrFile = filename; Dst.nMaxFile = 256; Dst.lpstrFileTitle = title; Dst.nMaxFileTitle = 64; Dst.Flags = 8; Dst.lpstrDefExt = filter; if ( GetOpenFileNameA((LPOPENFILENAMEA)&Dst) ) { fd = _open(filename, 0x8000u); if ( fd == -1 ) { result = 0; } else { len = _filelength(fd); _read(fd, buffer, len); _close(fd); result = 1; } } else { CommDlgExtendedError(); result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 53F926: using guessed type _DWORD _filelength(_DWORD); //----- (004D3A20) -------------------------------------------------------- int fun_readFileIntoBuffer(const CHAR *filename, void *buffer) { signed int result; // eax@2 DWORD len; // ST58_4@3 int fd; // [sp+50h] [bp-4h]@1 fd = _open(filename, 0x8000u); if ( fd == -1 ) { result = 0; } else { len = _filelength(fd); _read(fd, buffer, len); _close(fd); result = 1; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 53F926: using guessed type _DWORD _filelength(_DWORD); //----- (004D3AA0) -------------------------------------------------------- signed int fun_readLanguageTextFiles(const CHAR *c3eng_filename, const CHAR *c3mm_filename) { signed int result; // eax@2 DWORD filesize; // [sp+4Ch] [bp-8h]@3 DWORD v4; // [sp+4Ch] [bp-8h]@7 int fd_eng; // [sp+50h] [bp-4h]@1 int fd_mm; // [sp+50h] [bp-4h]@5 fd_eng = _open(c3eng_filename, 0x8000u); if ( fd_eng == -1 ) { result = 0; } else { filesize = _filelength(fd_eng) - 8028; if ( filesize <= 200000 ) { _read(fd_eng, &c3eng_header, C3ENG_HEADER_SIZE); _read(fd_eng, c3eng_index, C3ENG_INDEX_LENGTH); ANTBCODE c3eng_data = (char*)malloc(filesize); _read(fd_eng, c3eng_data, filesize); _close(fd_eng); fd_mm = _open(c3mm_filename, 0x8000u); if ( fd_mm == -1 ) { result = 0; } else { v4 = _filelength(fd_mm) - 32024; if ( v4 <= 360000 ) { _read(fd_mm, c3mm_index, C3MM_INDEX_SIZE); ANTBCODE c3mm_data = (char*)malloc( v4 ); _read(fd_mm, c3mm_data, v4); _close(fd_mm); result = 1; } else { _close(fd_mm); result = 0; } } } else { _close(fd_eng); result = 0; } } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 53F926: using guessed type _DWORD _filelength(_DWORD); //----- (004D3C40) -------------------------------------------------------- int fun_getFilesize(const CHAR *filename) { int result; // eax@2 int len; // ST54_4@3 int fd; // [sp+50h] [bp-4h]@1 fd = _open(filename, 32768); if ( fd == -1 ) { result = 0; } else { len = _filelength(fd); _close(fd); result = len; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 53F926: using guessed type _DWORD _filelength(_DWORD); //----- (004D3CA0) -------------------------------------------------------- signed int unused_writeBufferToFile_Dialog(const char *a1, LPCVOID lpBuffer, char *filename, char *a4, DWORD nNumberOfBytesToWrite) { signed int result; // eax@2 int v6; // [sp+4Ch] [bp-54h]@3 OPENFILENAMEA Dst; // [sp+54h] [bp-4Ch]@1 memset(&Dst, 0, 76u); Dst.lStructSize = 76; Dst.hwndOwner = main_window; Dst.lpstrFilter = a1; Dst.nFilterIndex = 1; Dst.lpstrFile = filename; Dst.nMaxFile = 256; Dst.lpstrFileTitle = a4; Dst.nMaxFileTitle = 64; Dst.Flags = 8; Dst.lpstrDefExt = a1; if ( GetSaveFileNameA((LPOPENFILENAMEA)&Dst) ) { v6 = _open(filename, 0x8301u); if ( v6 == -1 ) { result = 0; } else { _write(v6, lpBuffer, nNumberOfBytesToWrite); _close(v6); result = 1; } } else { CommDlgExtendedError(); result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D3DA0) -------------------------------------------------------- signed int fun_writeBufferToFile(const char *filename, void *buffer, DWORD nNumberOfBytesToWrite) { signed int result; // eax@2 int fd; // [sp+4Ch] [bp-4h]@1 fd = _open(filename, 0x8301u); if ( fd == -1 ) { result = 0; } else { _write(fd, buffer, nNumberOfBytesToWrite); _close(fd); result = 1; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); //----- (004D3E10) -------------------------------------------------------- signed int unused_4D3E10(const char *a1, int a2, signed int a3) { signed int result; // eax@2 unsigned __int16 v4; // ax@26 int v5; // [sp+4Ch] [bp-54h]@17 int v6; // [sp+50h] [bp-50h]@16 int v7; // [sp+54h] [bp-4Ch]@16 int v8; // [sp+58h] [bp-48h]@16 int v9; // [sp+5Ch] [bp-44h]@11 int i; // [sp+60h] [bp-40h]@6 int v11; // [sp+64h] [bp-3Ch]@11 char v12; // [sp+68h] [bp-38h]@1 int v13; // [sp+6Ch] [bp-34h]@1 int v14; // [sp+70h] [bp-30h]@1 int v15; // [sp+76h] [bp-2Ah]@1 char dst; // [sp+90h] [bp-10h]@1 int v17; // [sp+9Ah] [bp-6h]@6 const char *v18; // [sp+A8h] [bp+8h]@6 int v19; // [sp+A8h] [bp+8h]@9 int v20; // [sp+A8h] [bp+8h]@14 int v21; // [sp+A8h] [bp+8h]@16 fun_strncpy(a1, &dst, 14); fun_strncpy(a1 + 14, &v12, 40); c3maps_width = v13; c3maps_height = v14; c3maps_imageDataSize = 3 * c3maps_height * c3maps_width; dword_5FD84C = (unsigned __int16)v15; if ( c3maps_imageDataSize <= a3 ) { if ( c3maps_imageDataSize > 0 ) { if ( dword_5FD84C == 8 ) { v18 = &a1[v17] + c3maps_imageDataSize; for ( i = 0; i < c3maps_height; ++i ) { v11 = 0; v9 = c3maps_width - 1; while ( v11 < c3maps_width ) { --v18; *(_BYTE *)(v9 + a2) = *v18; ++v11; --v9; } a2 += c3maps_width; } result = 1; } else { if ( dword_5FD84C >= 16 ) { v19 = (int)(&a1[v17] + c3maps_imageDataSize); for ( i = 0; i < c3maps_height; ++i ) { v11 = 0; v9 = 2 * c3maps_width - 2; while ( v11 < c3maps_width ) { if ( dword_5FD84C == 16 ) { v20 = v19 - 1; *(_BYTE *)(v9 + a2) = *(_BYTE *)v20; v19 = v20 - 1; *(_BYTE *)(v9 + a2 + 1) = *(_BYTE *)v19; } else { if ( dword_5FD84C == 24 ) { v21 = v19 - 1; _LOWORD(v8) = *(_BYTE *)v21--; _LOWORD(v7) = *(_BYTE *)v21; v19 = v21 - 1; _LOWORD(v6) = *(_BYTE *)v19; _LOWORD(v8) = v8; _LOWORD(v7) = v7; _LOWORD(v6) = v6; switch ( graphics_format_hex ) { case 0x655: _LOWORD(v8) = (_WORD)v8 >> 2; _LOWORD(v7) = (_WORD)v7 >> 3; _LOWORD(v6) = (_WORD)v6 >> 3; _LOWORD(v8) = (_WORD)v8 << 10; _LOWORD(v7) = 32 * v7; _LOWORD(v5) = v6 + v7 + (_WORD)v8; if ( (unsigned __int16)((_WORD)v6 + v7 + (_WORD)v8) == 64543 ) _LOWORD(v5) = -2017; break; case 0x565: _LOWORD(v8) = (_WORD)v8 >> 3; _LOWORD(v7) = (_WORD)v7 >> 2; _LOWORD(v6) = (_WORD)v6 >> 3; _LOWORD(v8) = (_WORD)v8 << 11; _LOWORD(v7) = 32 * v7; _LOWORD(v5) = v6 + v7 + (_WORD)v8; break; case 0x556: _LOWORD(v8) = (_WORD)v8 >> 3; _LOWORD(v7) = (_WORD)v7 >> 3; _LOWORD(v6) = (_WORD)v6 >> 2; _LOWORD(v8) = (_WORD)v8 << 11; _LOWORD(v7) = (_WORD)v7 << 6; _LOWORD(v5) = v6 + v7 + (_WORD)v8; if ( (unsigned __int16)((_WORD)v6 + v7 + (_WORD)v8) == 63551 ) _LOWORD(v5) = -2017; break; default: _LOWORD(v8) = (_WORD)v8 >> 3; _LOWORD(v7) = (_WORD)v7 >> 3; _LOWORD(v6) = (_WORD)v6 >> 3; _LOWORD(v8) = (_WORD)v8 << 10; _LOWORD(v7) = 32 * v7; v4 = v6 + v7 + (_WORD)v8; _HIBYTE(v4) |= 0x80u; _LOWORD(v5) = v4; if ( v4 == 64543 ) _LOWORD(v5) = -2017; break; } fun_strncpy((const char *)&v5, (char *)(v9 + a2), 2); } } ++v11; v9 -= 2; } a2 += 2 * c3maps_width; } result = 1; } else { result = 0; } } } else { result = 0; } } else { result = 0; } return result; } // 5FD84C: using guessed type int dword_5FD84C; // 60803C: using guessed type int c3maps_width; // 608040: using guessed type int c3maps_height; // 6608E0: using guessed type int graphics_format_hex; //----- (004D43C0) -------------------------------------------------------- DWORD fun_getBmpDataOffset(struct WindowsBitmap *a1) { BITMAPFILEHEADER dst; // [sp+4Ch] [bp-10h]@1 fun_strncpy((const char *)a1, (char *)&dst, 14); return dst.bfOffBits; } //----- (004D43F0) -------------------------------------------------------- signed int fun_flipBitmap( WindowsBitmap *bmp) { signed int result; // eax@2 char *v2; // [sp+4Ch] [bp-50h]@3 char *v3; // [sp+50h] [bp-4Ch]@3 void *buf; // [sp+54h] [bp-48h]@1 BITMAPINFOHEADER bmpinfo; // [sp+58h] [bp-44h]@1 BITMAPFILEHEADER bmpheader; // [sp+80h] [bp-1Ch]@1 int v7; // [sp+90h] [bp-Ch]@5 int i; // [sp+94h] [bp-8h]@3 int v9; // [sp+98h] [bp-4h]@5 fun_strncpy((const char *)bmp, (char *)&bmpheader, 14); fun_strncpy((const char *)&bmp->info, (char *)&bmpinfo, 40); c3maps_width = bmpinfo.biWidth; c3maps_height = bmpinfo.biHeight; c3maps_imageDataSize = bmpinfo.biSizeImage; buf = malloc(c3maps_imageDataSize); if ( buf ) { v3 = (char *)bmp + bmpheader.bfOffBits + c3maps_imageDataSize; v2 = (char *)buf; for ( i = 0; i < c3maps_height; ++i ) { v9 = 0; v7 = c3maps_width - 1; while ( v9 < c3maps_width ) { --v3; v2[v7] = *v3; ++v9; --v7; } v2 += c3maps_width; } fun_strncpy((const char *)buf, (char *)bmp + bmpheader.bfOffBits, c3maps_imageDataSize); if ( buf ) j_freeMemory(buf); result = 1; } else { result = 0; } return result; } // 60803C: using guessed type int c3maps_width; // 608040: using guessed type int c3maps_height; //----- (004D4590) -------------------------------------------------------- signed int unused_4D4590(const CHAR *a1) { signed int result; // eax@2 __int16 v2; // ST60_2@9 int v3; // ST58_4@9 int v4; // [sp+4Ch] [bp-64h]@5 __int16 *v5; // [sp+50h] [bp-60h]@5 char src[4]; // [sp+64h] [bp-4Ch]@3 int v7; // [sp+68h] [bp-48h]@3 int v8; // [sp+6Ch] [bp-44h]@3 __int16 v9; // [sp+70h] [bp-40h]@3 __int16 v10; // [sp+72h] [bp-3Eh]@3 int v11; // [sp+74h] [bp-3Ch]@3 int v12; // [sp+78h] [bp-38h]@3 int v13; // [sp+7Ch] [bp-34h]@3 int v14; // [sp+80h] [bp-30h]@3 int v15; // [sp+84h] [bp-2Ch]@3 int v16; // [sp+88h] [bp-28h]@3 char Dst; // [sp+8Ch] [bp-24h]@3 int v18; // [sp+8Eh] [bp-22h]@3 int v19; // [sp+96h] [bp-1Ah]@3 int v20; // [sp+9Ch] [bp-14h]@7 int v21; // [sp+A0h] [bp-10h]@3 int v22; // [sp+A4h] [bp-Ch]@3 int i; // [sp+A8h] [bp-8h]@5 int v24; // [sp+ACh] [bp-4h]@7 dword_607FD4 = 0; dword_607FD4 = malloc(3100000u); if ( dword_607FD4 ) { memset(&Dst, 0, 0xEu); memset(src, 0, 0x28u); v21 = 54; fun_strncpy("BM", &Dst, 2); v18 = v21 + 3 * screen_height * screen_width; v19 = v21; *(_DWORD *)src = 40; v7 = screen_width; v8 = screen_height; v9 = 1; v10 = 24; v11 = 0; v12 = 3 * screen_height * screen_width; v13 = 0; v14 = 0; v15 = 0; v16 = 0; v22 = _open(a1, 0x8301u); if ( v22 != -1 ) { fun_strncpy(&Dst, (char *)dword_607FD4, 14); fun_strncpy(src, (char *)dword_607FD4 + 14, 40); v5 = &ddraw_buffer[screen_height * screen_width]; v4 = (int)((char *)dword_607FD4 + v21); for ( i = 0; i < screen_height; ++i ) { v20 = screen_width; v24 = 0; while ( v24 < screen_width ) { v2 = v5[-v20]; *(_BYTE *)v4 = 8 * (v2 & 0x1F); v3 = v4 + 1; *(_BYTE *)v3++ = 4 * ((v2 & 0x7E0) >> 5); *(_BYTE *)v3 = 8 * ((v2 & 0xF800) >> 11); v4 = v3 + 1; ++v24; --v20; } v5 -= screen_width; } _write(v22, dword_607FD4, v21 + 3 * screen_height * screen_width); _close(v22); } if ( dword_607FD4 ) j_freeMemory((void *)dword_607FD4); result = 1; } else { result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 65E6D4: using guessed type int screen_height; //----- (004D4900) -------------------------------------------------------- void unused_4D4900() { ; } //----- (004D4920) -------------------------------------------------------- void unused_4D4920() { ; } //----- (004D4940) -------------------------------------------------------- void unused_4D4940() { ; } //----- (004D4960) -------------------------------------------------------- void unused_4D4960() { ; } //----- (004D4980) -------------------------------------------------------- void unused_4D4980() { ; } //----- (004D49A0) -------------------------------------------------------- void unused_4D49A0() { ; } //----- (004D49C0) -------------------------------------------------------- void unused_4D49C0() { ; } //----- (004D49E0) -------------------------------------------------------- void unused_4D49E0() { ; } //----- (004D4A00) -------------------------------------------------------- void unused_4D4A00() { ; } //----- (004D4A20) -------------------------------------------------------- void unused_4D4A20() { unused_65E6D0 = 1; } // 65E6D0: using guessed type int unused_65E6D0; //----- (004D4A40) -------------------------------------------------------- void unused_4D4A40() { ; } //----- (004D4A60) -------------------------------------------------------- void unused_4D4A60() { ; } //----- (004D4A80) -------------------------------------------------------- void unused_4D4A80() { ; } //----- (004D4AA0) -------------------------------------------------------- void unused_4D4AA0() { ; } //----- (004D4AC0) -------------------------------------------------------- void unused_4D4AC0() { ; } //----- (004D4AE0) -------------------------------------------------------- signed int unused_4D4AE0() { DWORD i; // [sp+4Ch] [bp-18h]@1 DWORD j; // [sp+50h] [bp-14h]@3 RECT vRect; // [sp+54h] [bp-10h]@1 vRect.left = 0; vRect.top = 0; vRect.right = 16; vRect.bottom = 16; for ( i = 0; i < 480; i += 16 ) { for ( j = 0; j < 640; j += 16 ) { vRect.left = j; vRect.top = i; vRect.right = j + 16; vRect.bottom = i + 16; ddraw_surface->BltFast(j,i,ddraw_backSurface,&vRect,16); } } return 1; } //----- (004D4BC0) -------------------------------------------------------- signed int unused_4D4BC0() { ddraw_surface->Blt(&ddraw_rect,ddraw_backSurface,0,16777216,0); return 1; } //----- (004D4C10) -------------------------------------------------------- signed int unused_4D4C10() { return 1; } //----- (004D4C30) -------------------------------------------------------- void unused_4D4C30() { ; } //----- (004D4C50) -------------------------------------------------------- void fun_greyRectangle(int xOffset, int yOffset, int width, int height, char blackness) { int grey; // [sp+4Ch] [bp-18h]@9 int b; // [sp+50h] [bp-14h]@9 int g; // [sp+54h] [bp-10h]@9 int r; // [sp+58h] [bp-Ch]@9 int y; // [sp+5Ch] [bp-8h]@1 int x; // [sp+60h] [bp-4h]@3 for ( y = yOffset; y < height + yOffset; ++y ) { for ( x = xOffset; x < width + xOffset; ++x ) { if ( graphics_format_hex == 0x565 ) { r = fun_getPixelMasked(x, y, 0xF800u) >> 11; g = fun_getPixelMasked(x, y, 0x7E0u) >> 6; b = fun_getPixelMasked(x, y, 0x1Fu); } else { if ( graphics_format_hex == 0x555 ) { r = fun_getPixelMasked(x, y, 0x7C00u) >> 10; g = fun_getPixelMasked(x, y, 0x3E0u) >> 5; b = fun_getPixelMasked(x, y, 0x1Fu); } } grey = (b + g + r) / 3 >> blackness; fun_andPixel(x, y, 0); if ( graphics_format_hex == 0x565 ) { r = grey << 11; fun_orPixel(x, y, (_WORD)grey << 11); g = grey << 6; fun_orPixel(x, y, (_WORD)grey << 6); b = grey; fun_orPixel(x, y, grey); } else { if ( graphics_format_hex == 0x555 ) { r = grey << 10; fun_orPixel(x, y, (_WORD)grey << 10); g = 32 * grey; fun_orPixel(x, y, 32 * grey); b = grey; fun_orPixel(x, y, grey); } } } } } // 6608E0: using guessed type int graphics_format_hex; //----- (004D4F00) -------------------------------------------------------- void unused_4D4F00() { ; } //----- (004D4F20) -------------------------------------------------------- void fun_clearScreen() { if ( ddraw_buffer ) fun_memset(ddraw_buffer, 2 * screen_height * screen_width, 0); } // 65E6D4: using guessed type int screen_height; //----- (004D4F70) -------------------------------------------------------- void unused_4D4F70() { ; } //----- (004D4F90) -------------------------------------------------------- signed int unused_4D4F90(HINSTANCE hInstance, unsigned __int16 a2, LPVOID lpvBits) { signed int result; // eax@2 int Dst; // [sp+50h] [bp-74h]@5 int v5; // [sp+54h] [bp-70h]@5 int v6; // [sp+58h] [bp-6Ch]@5 __int16 v7; // [sp+5Ch] [bp-68h]@5 __int16 v8; // [sp+5Eh] [bp-66h]@5 int v9; // [sp+60h] [bp-64h]@5 struct tagBITMAPINFO bmi; // [sp+78h] [bp-4Ch]@5 char pv; // [sp+A4h] [bp-20h]@3 int v12; // [sp+A8h] [bp-1Ch]@5 UINT cLines; // [sp+ACh] [bp-18h]@5 __int16 v14; // [sp+B4h] [bp-10h]@5 __int16 v15; // [sp+B6h] [bp-Eh]@5 HDC hDC; // [sp+BCh] [bp-8h]@5 HBITMAP hbm; // [sp+C0h] [bp-4h]@1 hbm = LoadBitmapA(hInstance, (LPCSTR)a2); if ( hbm ) { if ( GetObjectA(hbm, 24, &pv) ) { hDC = GetDC(0); memset(&Dst, 0, 0x28u); Dst = 40; v5 = v12; v6 = -cLines; v7 = v14; v8 = v15; v9 = 0; memcpy(&bmi, &Dst, 0x28u); if ( GetDIBits(hDC, hbm, 0, cLines, lpvBits, &bmi, 0) ) { ReleaseDC(0, hDC); DeleteObject(hbm); result = 1; } else { ReleaseDC(0, hDC); DeleteObject(hbm); result = 0; } } else { DeleteObject(hbm); result = 0; } } else { result = 0; } return result; } //----- (004D50F0) -------------------------------------------------------- signed int unused_4D50F0() { return 1; } //----- (004D5110) -------------------------------------------------------- void unused_4D5110() { ; } //----- (004D5130) -------------------------------------------------------- void unused_4D5130() { ; } //----- (004D5150) -------------------------------------------------------- void unused_4D5150() { ; } //----- (004D5170) -------------------------------------------------------- void unused_4D5170() { ; } //----- (004D5190) -------------------------------------------------------- void fun_redrawScreen_doNothing() { dword_65E6D8 = 0; mouseInfo_buttonIsDown = 0; byte_660584 = 0; } // 65E6D8: using guessed type int dword_65E6D8; // 660584: using guessed type char byte_660584; // 66078D: using guessed type char mouseInfo_buttonIsDown; //----- (004D51D0) -------------------------------------------------------- BOOL unused_4D51D0(__int16 a1, __int16 a2) { return PostMessageA(main_window, 0x200u, a1, a2); } //----- (004D5210) -------------------------------------------------------- void fun_getMouseCursorStatus() { signed int v0; // ST5C_4@12 int v1; // ST58_4@12 int v2; // ST54_4@12 int v3; // [sp+5Ch] [bp-Ch]@12 struct tagPOINT Point; // [sp+60h] [bp-8h]@1 GetCursorPos(&Point); mousecursor_x[0] = Point.x; mousecursor_y = Point.y; if ( shouldScrollMap ) { mouseInfo_x = LOWORD(mousecursor_x[0]); mouseInfo_y = mousecursor_y; } if ( dword_6608AC[0] == 1 ) { if ( mouseclick_x > dword_66057C + 50 ) dword_6608AC[0] = 2; if ( mouseclick_x < dword_66057C - 50 ) dword_6608AC[0] = 2; if ( mouseclick_y > dword_660578 + 50 ) dword_6608AC[0] = 2; if ( mouseclick_y < dword_660578 - 50 ) dword_6608AC[0] = 2; } v3 = time_current; mouse_moved = 0; dword_660568 = mouseclick_x; dword_660564 = mouseclick_y; byte_660731[0] = mouse_isLeftClick; byte_660787 = mouse_isRightClick; v0 = ddraw_bottomright.y - dword_660554; v1 = getPercentage(ddraw_width, ddraw_bottomright.x - ddraw_rect.left); v2 = getPercentage(ddraw_height, v0); mouseclick_x = fun_adjustWithPercentage(mouseInfo_x, v1); mouseclick_y = fun_adjustWithPercentage(mouseInfo_y, v2); dword_660C44 = 0; mouse_isLeftClick = 0; mouse_isRightClick = 0; byte_660B94[0] = 0; byte_65E6C8 = byte_660B94[0]; is_right_click = 0; handleClick_isRightClick = is_right_click; if ( mouseInfo_type & 2 ) mouse_isRightClick = 1; if ( mouseInfo_type & 1 ) mouse_isLeftClick = 1; if ( dword_660568 != mouseclick_x ) mouse_moved = 1; if ( dword_660564 != mouseclick_y ) mouse_moved = 1; if ( mouse_moved ) { dword_607FEC = v3; dword_6608EC = 0; } else { dword_6608EC = v3 - dword_607FEC; } if ( mouse_isLeftClick != byte_660731[0] ) { mouse_moved = 1; dword_660C44 = 1; if ( mouse_isLeftClick == 1 ) { byte_660B94[0] = 1; } else { if ( !mouse_isLeftClick ) byte_65E6C8 = 1; } } if ( mouse_isRightClick != byte_660787 ) { mouse_moved = 1; dword_660C44 = 1; if ( mouse_isRightClick == 1 ) { is_right_click = 1; } else { if ( !mouse_isRightClick ) handleClick_isRightClick = 1; } } byte_660904 = 0; } // 607FEC: using guessed type int dword_607FEC; // 608008: using guessed type int time_current; // 65DF44: using guessed type int mousecursor_x[470]; // 65E69C: using guessed type int mousecursor_y; // 65E6BC: using guessed type char mouse_isLeftClick; // 65E6C8: using guessed type char byte_65E6C8; // 65E934: using guessed type char handleClick_isRightClick; // 65EB21: using guessed type char mouse_isRightClick; // 660554: using guessed type int dword_660554; // 660564: using guessed type int dword_660564; // 660568: using guessed type int dword_660568; // 660578: using guessed type int dword_660578; // 66057C: using guessed type int dword_66057C; // 660782: using guessed type __int16 mouseInfo_x; // 660784: using guessed type __int16 mouseInfo_y; // 660786: using guessed type char mouseInfo_type; // 660787: using guessed type char byte_660787; // 6608A1: using guessed type char is_right_click; // 6608AC: using guessed type int dword_6608AC[13]; // 6608EC: using guessed type int dword_6608EC; // 660904: using guessed type char byte_660904; // 660C44: using guessed type int dword_660C44; // 660C4C: using guessed type int shouldScrollMap; //----- (004D55B0) -------------------------------------------------------- void fun_setCursor(int cursorId) { HCURSOR v1; // [sp+4Ch] [bp-4h]@2 if ( cursorId ) { if ( cursorId == 1 ) { v1 = cursor_sword; } else { if ( cursorId == 2 ) v1 = cursor_shovel; else v1 = cursor_normal; } } else { v1 = cursor_normal; } hCursor = v1; SetCursor(hCursor); } //----- (004D5630) -------------------------------------------------------- bool fun_isMouseHit(int x, int y, int width, int height) { return x <= mouseclick_x && width + x > mouseclick_x && y <= mouseclick_y && height + y > mouseclick_y; } //----- (004D5690) -------------------------------------------------------- signed int fun_getMapScrollDirection() { signed int result; // eax@2 signed int bottomEdge; // [sp+4Ch] [bp-10h]@3 signed int topEdge; // [sp+50h] [bp-Ch]@3 signed int rightEdge; // [sp+54h] [bp-8h]@3 signed int leftEdge; // [sp+58h] [bp-4h]@3 if ( fun_shouldScrollMap() ) { shouldScrollMap = 0; bottomEdge = 0; topEdge = 0; rightEdge = 0; leftEdge = 0; if ( mousecursor_x[0] <= 0 ) { leftEdge = 1; shouldScrollMap = 1; } if ( mousecursor_x[0] >= system_screen_width - 1 ) { rightEdge = 1; shouldScrollMap = 1; } if ( mousecursor_y <= 0 ) { topEdge = 1; shouldScrollMap = 1; } if ( mousecursor_y >= system_screen_height - 1 ) { bottomEdge = 1; shouldScrollMap = 1; } if ( arrowkey_left_pressed ) { leftEdge = 1; shouldScrollMap = 1; } if ( arrowkey_right_pressed ) { rightEdge = 1; shouldScrollMap = 1; } if ( arrowkey_up_pressed ) { topEdge = 1; shouldScrollMap = 1; } if ( arrowkey_down_pressed ) { bottomEdge = 1; shouldScrollMap = 1; } arrowkey_right_pressed = 0; arrowkey_left_pressed = 0; arrowkey_down_pressed = 0; arrowkey_up_pressed = 0; if ( leftEdge && topEdge ) { result = Direction_NorthWest; } else { if ( leftEdge && bottomEdge ) { result = Direction_SouthWest; } else { if ( rightEdge && topEdge ) { result = Direction_NorthEast; } else { if ( rightEdge && bottomEdge ) { result = Direction_SouthEast; } else { if ( leftEdge ) { result = Direction_West; } else { if ( topEdge ) { result = Direction_North; } else { if ( bottomEdge ) { result = Direction_South; } else { if ( rightEdge ) result = Direction_East; else result = 8; } } } } } } } } else { result = Direction_None; } return result; } // 60802C: using guessed type int arrowkey_right_pressed; // 608030: using guessed type int arrowkey_left_pressed; // 608034: using guessed type int arrowkey_down_pressed; // 608038: using guessed type int arrowkey_up_pressed; // 65DF44: using guessed type int mousecursor_x[470]; // 65E69C: using guessed type int mousecursor_y; // 65E6A4: using guessed type int system_screen_width; // 6606B8: using guessed type int system_screen_height; // 660C4C: using guessed type int shouldScrollMap; //----- (004D58E0) -------------------------------------------------------- char unused_4D58E0() { char result; // al@1 byte_65E6A8 = 0; result = byte_65E6A8; byte_660795 = byte_65E6A8; byte_66078C = 1; byte_6608FD = 0; return result; } // 65E6A8: using guessed type char byte_65E6A8; // 66078C: using guessed type char byte_66078C; // 660795: using guessed type char byte_660795; // 6608FD: using guessed type char byte_6608FD; //----- (004D5930) -------------------------------------------------------- int unused_4D5930() { int result; // eax@2 unused_4D5960(); do { unused_4D58E0(); result = byte_66078C; } while ( !byte_66078C ); return result; } // 402266: using guessed type int j_unused_4D5960(void); // 40276B: using guessed type int j_unused_4D58E0(void); // 66078C: using guessed type char byte_66078C; //----- (004D5960) -------------------------------------------------------- int unused_4D5960() { int result; // eax@2 byte_66078C = 1; while ( 1 ) { result = byte_66078C; if ( !byte_66078C ) break; unused_4D58E0(); } return result; } // 40276B: using guessed type int j_unused_4D58E0(void); // 66078C: using guessed type char byte_66078C; //----- (004D59A0) -------------------------------------------------------- int unused_4D59A0(int a1, int a2, int a3, int a4) { int result; // eax@3 if ( !input_cursorOffset ) { result = byte_660B94[0]; if ( byte_660B94[0] ) { if ( mouseclick_x >= a1 ) { if ( mouseclick_x < a3 + a1 ) { result = mouseclick_y; if ( mouseclick_y >= a2 ) { if ( mouseclick_y < a4 + a2 ) input_cursorOffset = a2; } } } } } return result; } // 6AD9C8: using guessed type int input_cursorOffset; //----- (004D5A20) -------------------------------------------------------- void unused_4D5A20(int a3) { signed int k; // [sp+4Ch] [bp-Ch]@6 int j; // [sp+50h] [bp-8h]@4 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < 1000; ++i ) fun_getMouseCursorStatus(); for ( j = 0; j < a3; ++j ) { for ( k = 0; k < 8000; ++k ) { fun_getMouseCursorStatus(); if ( byte_65E6C8 || handleClick_isRightClick ) { fun_redrawScreen_doNothing(); return; } } } } // 65E6C8: using guessed type char byte_65E6C8; // 65E934: using guessed type char handleClick_isRightClick; //----- (004D5AE0) -------------------------------------------------------- signed int unused_4D5AE0(int a3) { signed int k; // [sp+4Ch] [bp-Ch]@6 int j; // [sp+50h] [bp-8h]@4 signed int i; // [sp+54h] [bp-4h]@1 for ( i = 0; i < 1000; ++i ) fun_getMouseCursorStatus(); for ( j = 0; j < a3; ++j ) { for ( k = 0; k < 8000; ++k ) { fun_getMouseCursorStatus(); if ( byte_65E6C8 || handleClick_isRightClick ) { fun_redrawScreen_doNothing(); return 1; } } } return 0; } // 65E6C8: using guessed type char byte_65E6C8; // 65E934: using guessed type char handleClick_isRightClick; //----- (004D5BA0) -------------------------------------------------------- void fun_measureCpuSpeed(int times) { signed int j; // [sp+4Ch] [bp-Ch]@3 int i; // [sp+50h] [bp-8h]@1 int dummy; // [sp+54h] [bp-4h]@1 dummy = 0; for ( i = 0; i < times; ++i ) { for ( j = 0; j < 10000; ++j ) dummy += 3; } } //----- (004D5C10) -------------------------------------------------------- signed int unused_4D5C10(int a1, int a2) { signed int result; // eax@2 if ( time_current >= a2 + *(_DWORD *)a1 ) { *(_DWORD *)a1 = time_current; result = 1; } else { result = 0; } return result; } // 608008: using guessed type int time_current; //----- (004D5C50) -------------------------------------------------------- void fun_drawLoadingText(char *lpString) { __int32 v1; // [sp+4Ch] [bp-24h]@3 __int32 v2; // [sp+50h] [bp-20h]@3 __int32 v3; // [sp+54h] [bp-1Ch]@3 __int32 v4; // [sp+58h] [bp-18h]@3 int v5; // [sp+5Ch] [bp-14h]@1 struct tagSIZE sz; // [sp+64h] [bp-Ch]@3 HDC hdc; // [sp+6Ch] [bp-4h]@3 v5 = fun_strlen(lpString); if ( v5 > 0 ) { hdc = GetDC(0); GetTextExtentPointA(hdc, lpString, v5, &sz); v4 = (system_screen_width - sz.cx) / 2; v3 = (system_screen_height - sz.cy) / 2; v2 = (screen_width - sz.cx) / 2; v1 = (screen_height - sz.cy) / 2; if ( system_screen_height != screen_height ) v1 -= 24; fun_fillRect(v2 - 51, v1 - 21, sz.cx + 102, sz.cy + 42, 0); fun_fillRect(v2 - 50, v1 - 20, sz.cx + 100, sz.cy + 40, 65535); SetBkColor(hdc, 0xFFFFFFu); TextOutA(hdc, v4, v3, lpString, v5); } } // 65E6A4: using guessed type int system_screen_width; // 65E6D4: using guessed type int screen_height; // 6606B8: using guessed type int system_screen_height; //----- (004D5DC0) -------------------------------------------------------- void fun_measureComputerSpeed() { DWORD t1; // [sp+4Ch] [bp-8h]@1 DWORD t2; // [sp+4Ch] [bp-8h]@10 signed int i; // [sp+50h] [bp-4h]@1 signed int j; // [sp+50h] [bp-4h]@10 t1 = timeGetTime(); for ( i = 0; i < 3; ++i ) { switch ( setting_resolution ) { case 1: fun_measureCpuSpeed(20); break; case 2: fun_measureCpuSpeed(30); break; case 3: fun_measureCpuSpeed(40); break; } } speed_time_cpu = timeGetTime() - t1; t2 = timeGetTime(); for ( j = 0; j < 3; ++j ) fun_refreshVideoBuffer(1); speed_time_video = timeGetTime() - t2; speed_time_overall = speed_time_video + speed_time_cpu; } // 65E710: using guessed type int setting_resolution; // 660560: using guessed type int speed_time_cpu; // 660570: using guessed type int speed_time_video; // 6608A4: using guessed type int speed_time_overall; //----- (004D5EC0) -------------------------------------------------------- void unused_nothing1() { ; } //----- (004D5EE0) -------------------------------------------------------- void unused_nothing2() { ; } //----- (004D5F00) -------------------------------------------------------- void unused_nothing3() { ; } //----- (004D5F20) -------------------------------------------------------- void unused_nothing2Times(int times) { while ( times ) { unused_nothing2(); --times; } } //----- (004D5F50) -------------------------------------------------------- void unused_nothing3Times(int times) { while ( times ) { unused_nothing3(); --times; } } //----- (004D5F80) -------------------------------------------------------- void unused_5nothing() { unused_nothing1(); unused_nothing2(); unused_nothing3(); unused_nothing2(); unused_nothing1(); } //----- (004D5FC0) -------------------------------------------------------- signed int fun_setupMainWindow(HINSTANCE hInstance) { signed int result; // eax@7 int v2; // ST1C_4@8 int v3; // eax@8 WNDCLASSA WndClass; // [sp+50h] [bp-28h]@6 _getcwd(chdir_home, 100); random_iv1 = 1415935623; random_iv2 = 1919161955; dword_6ADD24 = 877758002; byte_6E6B52 = 0; byte_6E6B53 = byte_6E6B52; byte_6E6B50 = byte_6E6B53; byte_6E6B51 = byte_6E6B50; byte_65E6A8 = 0; drawtext_useDoubleShadow = 0; dword_7E2730 = 0; drawtext_forceColor = 0; dword_6608AC[0] = 0; byte_6604A4 = 1; if ( setting_resolution == 2 ) { screen_width = 800; screen_height = 600; } else { if ( setting_resolution == 3 ) { screen_width = 1024; screen_height = 768; } else { screen_width = 640; screen_height = 480; } } screen_640x480_x = (screen_width - 640) / 2; screen_640x480_y = (screen_height - 480) / 2; ddraw_width = screen_width; ddraw_height = screen_height; ddraw_scanline = 2 * screen_width; ddraw_scanheight = screen_height; dword_6608E8 = ddraw_scanheight * ddraw_scanline; draw_clip_x = 0; draw_clip_xEnd = ddraw_width; draw_clip_y = 0; draw_clip_yEnd = ddraw_height; system_screen_width = GetSystemMetrics(0); system_screen_height = GetSystemMetrics(1); fun_logDebugMessage("Debug and status report on ", 0, 0); CoInitialize(0); WndClass.style = 0; WndClass.lpfnWndProc = fun_wndproc; WndClass.cbClsExtra = 0; WndClass.cbWndExtra = 0; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIconA(hInstance, (LPCSTR)0x8D); WndClass.hCursor = 0; WndClass.hbrBackground = (HBRUSH)GetStockObject(4); WndClass.lpszMenuName = 0; WndClass.lpszClassName = "WinSJBClass"; if ( RegisterClassA(&WndClass) ) { cursor_normal = LoadCursorA(hInstance, (LPCSTR)0x66); cursor_sword = LoadCursorA(hInstance, (LPCSTR)0x88); cursor_shovel = LoadCursorA(hInstance, (LPCSTR)0x82); fun_getGameTextString(9, 0); // Caesar III main_instance = (int)hInstance; v2 = GetSystemMetrics(1); v3 = GetSystemMetrics(0); main_window = CreateWindowExA( 0x40000u, "WinSJBClass", gametext_result, 0x90080000u, 0, 0, v3, v2, 0, 0, hInstance, 0); if ( main_window ) { UpdateWindow(main_window); SetFocus(main_window); ddraw_surface = 0; ddraw_backSurface = 0; ddraw_funcs = 0; ddraw_clipper = 0; result = fun_initDirectDraw(); } else { result = 0; } } else { result = 0; } return result; } // 534F20: using guessed type _DWORD _getcwd(_DWORD, _DWORD); // 65E6A4: using guessed type int system_screen_width; // 65E6A8: using guessed type char byte_65E6A8; // 65E6D4: using guessed type int screen_height; // 65E710: using guessed type int setting_resolution; // 6604A4: using guessed type char byte_6604A4; // 660588: using guessed type int main_instance; // 6606AC: using guessed type int ddraw_scanline; // 6606B8: using guessed type int system_screen_height; // 6608AC: using guessed type int dword_6608AC[13]; // 6608E8: using guessed type int dword_6608E8; // 6ADACC: using guessed type int random_iv2; // 6ADB4C: using guessed type int random_iv1; // 6ADBCC: using guessed type int drawtext_useDoubleShadow; // 6ADBE4: using guessed type int draw_clip_y; // 6ADD24: using guessed type int dword_6ADD24; // 6ADD2C: using guessed type int draw_clip_x; // 6DEC20: using guessed type int drawtext_forceColor; // 6E6B4C: using guessed type int draw_clip_xEnd; // 6E6B50: using guessed type char byte_6E6B50; // 6E6B51: using guessed type char byte_6E6B51; // 6E6B52: using guessed type char byte_6E6B52; // 6E6B53: using guessed type char byte_6E6B53; // 7E26F8: using guessed type int draw_clip_yEnd; // 7E2730: using guessed type int dword_7E2730; //----- (004D6390) -------------------------------------------------------- void fun_setResolution(int resolutionId) { LONG v1; // ST18_4@8 bool v2; // ST14_4@8 LONG v3; // eax@8 struct tagRECT rc; // [sp+4Ch] [bp-10h]@8 if ( resolutionId == 1 ) { screen_width = 640; screen_height = 480; LABEL_8: setting_resolution = resolutionId; screen_640x480_x = (screen_width - 640) / 2; screen_640x480_y = (screen_height - 480) / 2; ddraw_width = screen_width; ddraw_height = screen_height; ddraw_scanline = 2 * screen_width; ddraw_scanheight = screen_height; dword_6608E8 = ddraw_scanheight * ddraw_scanline; draw_clip_x = 0; draw_clip_xEnd = ddraw_width; draw_clip_y = 0; draw_clip_yEnd = ddraw_height; SetRect(&rc, 0, 0, ddraw_width, ddraw_height); v1 = GetWindowLongA(main_window, -20); v2 = GetMenu(main_window) != 0; v3 = GetWindowLongA(main_window, -16); AdjustWindowRectEx(&rc, v3, v2, v1); windowedMode_xOffset = (system_screen_width - screen_width) / 2; windowedMode_yOffset = (system_screen_height - screen_height) / 2; SetWindowPos(main_window, 0, 0, 0, rc.right - rc.left, rc.bottom - rc.top, 0x16u); SetWindowPos(main_window, (HWND)0xFFFFFFFE, 0, 0, 0, 0, 0x13u); UpdateWindow(main_window); SetFocus(main_window); return; } if ( resolutionId == 2 ) { screen_width = 800; screen_height = 600; goto LABEL_8; } if ( resolutionId == 3 ) { screen_width = 1024; screen_height = 768; goto LABEL_8; } } // 65E6A4: using guessed type int system_screen_width; // 65E6D4: using guessed type int screen_height; // 65E710: using guessed type int setting_resolution; // 6606AC: using guessed type int ddraw_scanline; // 6606B8: using guessed type int system_screen_height; // 660724: using guessed type int windowedMode_yOffset; // 66072C: using guessed type int windowedMode_xOffset; // 6608E8: using guessed type int dword_6608E8; // 6ADBE4: using guessed type int draw_clip_y; // 6ADD2C: using guessed type int draw_clip_x; // 6E6B4C: using guessed type int draw_clip_xEnd; // 7E26F8: using guessed type int draw_clip_yEnd; //----- (004D65F0) -------------------------------------------------------- SIZE_T fun_getAvailablePhysicalMem() { memset(&physMemBuffer, 0, 0x20u); physMemBuffer.dwLength = 32; GlobalMemoryStatus(&physMemBuffer); return physMemBuffer.dwAvailPhys; } //----- (004D6640) -------------------------------------------------------- void fun_coUninitializeOnNormalExit() { CoUninitialize(); fun_logDebugMessage("OK :Exited Normally ", 0, 0); } //----- (004D6670) -------------------------------------------------------- void fun_pauseApp() { fun_logDebugMessage("OK :Paused. ", 0, 0); app_paused = 1; InvalidateRect(main_window, 0, 1); } // 65E6C0: using guessed type int app_paused; //----- (004D66C0) -------------------------------------------------------- void fun_resumeApp() { if ( GetForegroundWindow() == main_window ) app_paused = 0; } // 65E6C0: using guessed type int app_paused; //----- (004D6700) -------------------------------------------------------- signed int fun_directDrawRestoreSurfaces() { signed int result; // eax@3 if ( ddraw_surface && !ddraw_surface->Restore() ) { if ( ddraw_backSurface && !ddraw_backSurface->Restore() ) { result = 1; } else { fun_logDebugMessage("ERR:Can't restore back buffer. ", 0, 0); result = 0; } } else { fun_logDebugMessage("ERR:Can't restore front buffer. ", 0, 0); result = 0; } return result; } //----- (004D67A0) -------------------------------------------------------- int fun_timeVideo() { int result; // eax@1 DWORD time; // ST50_4@1 time = timeGetTime(); result = time - videotimer_last; videotimer_last = time; return result; } // 607FE8: using guessed type int videotimer_last; //----- (004D67E0) -------------------------------------------------------- signed int fun_enableGfxDirectDraw() { signed int result; // eax@2 if ( fun_enableDirectDraw() ) { fun_logDebugMessage("OK :GFX DirectDraw enabled.", 0, 0); if ( fun_directDrawCreateSurface() ) { result = 1; } else { fun_logDebugMessage("ERR:GFX could't create flipping surface.", 0, 0); fun_disableDirectDraw(1); result = 0; } } else { fun_logDebugMessage("ERR:GFX DirectDraw not enabled.", 0, 0); result = 0; } return result; } // 4029D2: using guessed type _DWORD fun_disableDirectDraw(_DWORD); //----- (004D6870) -------------------------------------------------------- void fun_deinitDirectDraw(int release) { if ( dword_607FF8 ) { (*(void (__stdcall **)(_DWORD))(*(_DWORD *)dword_607FF8 + 8))(dword_607FF8); dword_607FF8 = 0; } if ( ddraw_enabled ) { fun_disableDirectDraw(release); ddraw_enabled = 0; } } // 4029D2: using guessed type _DWORD fun_disableDirectDraw(_DWORD); // 607FF8: using guessed type int dword_607FF8; // 65E6DC: using guessed type int ddraw_enabled; //----- (004D68E0) -------------------------------------------------------- signed int fun_initDirectDraw() { signed int result; // eax@2 video_busySwitching = 1; fun_deinitDirectDraw(0); ddraw_enabled = fun_enableGfxDirectDraw(); if ( ddraw_enabled ) { fun_directDrawClearFill(); video_busySwitching = 0; app_active = 1; window_redrawRequest = 1; result = 1; } else { fun_logDebugMessage("ERR:gfxBegin failed.", 0, 0); result = 0; } return result; } // 5FD848: using guessed type int video_busySwitching; // 65E6AC: using guessed type int app_active; // 65E6DC: using guessed type int ddraw_enabled; // 660C5C: using guessed type char window_redrawRequest; //----- (004D6970) -------------------------------------------------------- void fun_refreshVideoBuffer(int forceRefresh) { struct tagRECT rect; // [sp+4Ch] [bp-20h]@12 RECT dst; // [sp+5Ch] [bp-10h]@12 if ( video_busySwitching != 1 ) { if ( !smack_videoPlaying || !ddraw_busy ) { paintVideo_last += fun_timeVideo(); if ( forceRefresh == 1 ) paintVideo_last = 50; if ( video_refreshRequested ) paintVideo_last = 50; if ( paintVideo_last >= 50 ) { paintVideo_last = 0; video_refreshRequested = 0; fun_strncpy((const char *)&ddraw_rect, (char *)&dst, 16); rect.left = 0; rect.top = 0; rect.right = screen_width; rect.bottom = screen_height; if ( setting_fullscreen ) ddraw_surface->BltFast(0,0,ddraw_backSurface,&ddraw_rect,16); else ddraw_surface->Blt(&dst,ddraw_backSurface,&rect,0x1000000u,0); } } } } // 5FD848: using guessed type int video_busySwitching; // 608000: using guessed type int ddraw_busy; // 608004: using guessed type int paintVideo_last; // 60856C: using guessed type int smack_videoPlaying; // 65E6D4: using guessed type int screen_height; // 65E704: using guessed type int setting_fullscreen; // 66071C: using guessed type char video_refreshRequested; //----- (004D6AF0) -------------------------------------------------------- signed int fun_deleteSavedGame(const char *Filename) { signed int result; // eax@2 if ( remove(Filename) == -1 ) { result = 1; } else { fun_findFiles("*.sav"); filelist_numFiles = findfiles_numFiles; filelist_selectedIndex = 0; if ( filelist_scrollPosition + 12 >= filelist_numFiles ) --filelist_scrollPosition; if ( filelist_scrollPosition < 0 ) filelist_scrollPosition = 0; result = 0; } return result; } // 660BF8: using guessed type int findfiles_numFiles; // 9DA7B8: using guessed type int filelist_selectedIndex; // 9DA8C0: using guessed type int filelist_numFiles; //----- (004D6B90) -------------------------------------------------------- signed int fun_writeSavedGame(const char *filename) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-Ch]@3 int length; // [sp+50h] [bp-8h]@7 int fd; // [sp+54h] [bp-4h]@1 savedgame_version = savedgame_fileversion; strcpy(save_playername, setting_player_name); fun_chdirHome(); fd = _open(filename, 0x8301u); if ( fd == -1 ) { result = 1; } else { for ( i = 0; i < 300 && savedgame_fields[i].length; ++i ) { length = savedgame_fields[i].length; if ( savedgame_fields[i].compressed ) fun_writeCompressedChunk(fd, (void*)savedgame_fields[i].offset, length); else _write(fd, (void*)savedgame_fields[i].offset, length); } _close(fd); result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 5FD878: using guessed type int savedgame_fileversion; // 608060: using guessed type int savedgame_version; //----- (004D6CC0) -------------------------------------------------------- signed int fun_loadSavedGame(const char *filename) { signed int result; // eax@2 signed int i; // [sp+50h] [bp-Ch]@3 signed int j; // [sp+50h] [bp-Ch]@6 int length; // [sp+54h] [bp-8h]@10 int fd; // [sp+58h] [bp-4h]@1 fun_chdirHome(); byte_6A10F8 = 0; fd = _open(filename, 0x8000u); if ( fd == -1 ) { result = 1; } else { fun_soundStopChannel(0); for ( i = 0; i < 2; ++i ) _read(fd, (void*)savedgame_fields[i].offset, savedgame_fields[i].length); for ( j = 2; j < 300 && savedgame_fields[j].length; ++j ) { length = savedgame_fields[j].length; if ( savedgame_fields[j].compressed ) fun_readCompressedChunk(fd, (void*)savedgame_fields[j].offset, length); else _read(fd, (void*)savedgame_fields[j].offset, length); } _close(fd); byte_6A10F8 = 1; fun_setupFromSavedGame(); fun_setStorageBuildingIds(); strcpy(setting_player_name, save_playername); result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 6A10F8: using guessed type char byte_6A10F8; //----- (004D6E80) -------------------------------------------------------- void fun_setupFromSavedGame() { scenario_map_empire = scn_empire; sub_4E1250(); if ( setting_isCustomScenario ) fun_readEmpireFile(1); else fun_readEmpireFile(0); fun_calculateDistantBattleRomanTravelTime(1); fun_calculateDistantBattleEnemyTravelTime(1); setting_map_width = scn_sizeX; setting_map_height = scn_sizeY; setting_map_startGridOffset = scn_gridFirstElement; setting_map_gridBorderSize = scn_gridBorderSize; if ( mapOrientation >= 0 ) { if ( mapOrientation > 6 ) mapOrientation = 0; } else { mapOrientation = 0; } setting_map_orientation = mapOrientation; sub_42DB70(mapOrientation); sub_4DC600(); fun_clearGroundTypeGrid(); fun_determineGroundType(); sub_5001A0(); sub_4FFDF0(); sub_500420(); sub_46F260(); fun_garbageCollectDestinationPaths(); sub_466880(); sub_453140(); sub_45CAF0(); fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); sub_4DE8B0(); sub_41C670(); fun_resetBackgroundMusic(); dword_8E1484 = 0; currentOverlay = 0; previousOverlay = 0; dword_9DA7B0 = 1; city_inform[ciid].dword_654644 = 1; city_inform[ciid].dword_654640 = 1; fun_loadClimateGraphics(scn_climate); fun_loadEnemyGraphics(scn_enemy); fun_determineDistantBattleCity(); sub_479600(); dword_658DD0 = 0; dword_659C18 = 0; setting_game_paused = 0; } // 4017CB: using guessed type _DWORD sub_4017CB(_DWORD); // 402AC2: using guessed type int sub_402AC2(void); // 608074: using guessed type int previousOverlay; // 654640: using guessed type int dword_654640[]; // 654644: using guessed type int dword_654644[]; // 65DEF8: using guessed type int mapOrientation; // 65E708: using guessed type char setting_game_paused; // 65E764: using guessed type int setting_isCustomScenario; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; // 98E884: using guessed type __int16 scn_empire; // 98E9FC: using guessed type __int16 scn_enemy; // 98EA04: using guessed type int scn_sizeX; // 98EA08: using guessed type int scn_sizeY; // 98EA0C: using guessed type int scn_gridFirstElement; // 98EA10: using guessed type int scn_gridBorderSize; // 98EF28: using guessed type char scn_climate; // 990608: using guessed type int scenario_map_empire; // 9DA7B0: using guessed type int dword_9DA7B0; //----- (004D70A0) -------------------------------------------------------- void fun_writeMissionSavedGame() { signed int missionId; // [sp+4Ch] [bp-4h]@1 missionId = setting_currentMissionId; if ( setting_currentMissionId > 11 ) missionId = 11; if ( !city_inform[ciid].missionSavedGameWritten ) { city_inform[ciid].missionSavedGameWritten = 1; if ( !fun_fileExistsHome(&aCitizen_sav[40 * missionId]) ) fun_writeSavedGame(&aCitizen_sav[40 * missionId]); } } // 65463C: using guessed type int cityinfo_missionSavedGameWritten[]; // 65E760: using guessed type int setting_currentMissionId; //----- (004D7150) -------------------------------------------------------- signed int fun_writeScenarioFile(const char *filename) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-Ch]@3 int fd; // [sp+54h] [bp-4h]@1 map_graphic_nativeHut = graphic_nativeBuilding; map_graphic_nativeMeeting = graphic_nativeBuilding + 2; map_graphic_nativeCrops = graphic_nativeCrops; fun_chdirHome(); fd = _open(filename, 0x8301u); if ( fd == -1 ) { result = 1; } else { for ( i = 0; i < 12 && scenario_fields[i].length; ++i ) _write(fd, (void*)scenario_fields[i].offset, scenario_fields[i].length); _close(fd); result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 6E6C78: using guessed type __int16 graphic_nativeCrops; // 6E6D1E: using guessed type __int16 graphic_nativeBuilding; // 990CBC: using guessed type int map_graphic_nativeHut; // 990CC0: using guessed type int map_graphic_nativeMeeting; // 990CC4: using guessed type int map_graphic_nativeCrops; //----- (004D7250) -------------------------------------------------------- signed int fun_loadScenarioFile(const char *filename) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-Ch]@3 int fd; // [sp+54h] [bp-4h]@1 fun_chdirHome(); fd = _open(filename, 32768); if ( fd == -1 ) { result = 1; } else { for ( i = 0; i < 12 && scenario_fields[i].length; ++i ) _read(fd, (void*)scenario_fields[i].offset, scenario_fields[i].length); _close(fd); scenario_map_empire = map_empire; fun_readEmpireFile(1); fun_calculateDistantBattleRomanTravelTime(1); fun_calculateDistantBattleEnemyTravelTime(1); result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 990608: using guessed type int scenario_map_empire; // 990624: using guessed type __int16 map_empire; //----- (004D7350) -------------------------------------------------------- signed int fun_loadSavedGameFromMissionPack(int a1) { signed int result; // eax@2 signed int i; // [sp+4Ch] [bp-10h]@7 signed int j; // [sp+4Ch] [bp-10h]@10 int v4; // [sp+50h] [bp-Ch]@14 int v5; // [sp+54h] [bp-8h]@5 LONG Buffer; // [sp+58h] [bp-4h]@1 fun_chdirHome(); if ( fun_readDataFromFilename(&aMission1_pak[20 * a1], &Buffer, 4u, 4 * savedgame_missionId) ) { if ( Buffer > 0 ) { v5 = _open(&aMission1_pak[20 * a1], 32768); if ( v5 == -1 ) { result = 0; } else { _lseek(v5, Buffer, 0); for ( i = 0; i < 2; ++i ) _read(v5, (void*)savedgame_fields[i].offset, savedgame_fields[i].length); for ( j = 2; j < 300 && savedgame_fields[j].length; ++j ) { v4 = savedgame_fields[j].length; if ( savedgame_fields[j].compressed ) fun_readCompressedChunk(v5, (void*)savedgame_fields[j].offset, v4); else _read(v5, (void*)savedgame_fields[j].offset, v4); } _close(v5); fun_setupFromSavedGame(); result = 1; } } else { result = 0; } } else { result = 0; } return result; } // 53F440: using guessed type _DWORD _close(_DWORD); // 65E750: using guessed type int savedgame_missionId; //----- (004D7520) -------------------------------------------------------- void fun_redrawScreen() { signed int v0; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 ++dword_788048; time_current = timeGetTime(); sub_412320(); v0 = fun_getElapsedGameTicks(); for ( i = 0; i < v0; ++i ) { ++dword_65DF2C; sub_4D76B0(); if ( byte_660585 <= 0 ) v0 = 0; fun_writeMissionSavedGame(); } fun_getMouseCursorStatus(); fun_drawWindow(0); fun_drawWindowButtons(); fun_handleMouseClick(); fun_redrawScreen_doNothing(); fun_getButtonTooltipText(); fun_getOverlayTooltipText(); fun_drawTopMenu(0); fun_drawCitySidepanelNumMessages(1); fun_drawWarnings(); if ( mouseover_info_id ) { fun_drawTooltip(); if ( dword_7E2D1C == 35 ) sub_40AC20(); sub_4C9710(); } fun_drawDebugInfoNetwork(); fun_refreshVideoBuffer(0); sub_41C210(); if ( window_id == 30 ) { fun_setCursor(1); } else { if ( window_id != 1 || toPlace_buildingType != B_ClearLand ) fun_setCursor(0); else fun_setCursor(2); } } // 401019: using guessed type int fun_drawDebugInfoNetwork(void); // 401FDC: using guessed type int sub_401FDC(void); // 402072: using guessed type int fun_drawWarnings(void); // 402865: using guessed type int fun_getOverlayTooltipText(void); // 608008: using guessed type int time_current; // 65DF2C: using guessed type int dword_65DF2C; // 660585: using guessed type char byte_660585; // 788048: using guessed type int dword_788048; // 7E2D1C: using guessed type int dword_7E2D1C; //----- (004D76B0) -------------------------------------------------------- void sub_4D76B0() { fun_generateRandomness(); fun_increaseSomeRandomCounters(); sub_4918A0(); if ( !mode_editor ) { fun_doGameTick(); sub_4E1300(); } sub_492870(); fun_handleEarthquakeEvent(); fun_handleGladiatorRevoltEvent(); fun_handleEmperorChangeEvent(); fun_handleScenarioWinLoseEvent(); } // 4022D9: using guessed type int fun_handleEmperorChangeEvent(void); // 402EC8: using guessed type int fun_handleEarthquakeEvent(void); // 40349F: using guessed type int fun_doGameTick(void); // 9DA898: using guessed type int mode_editor; //----- (004D7710) -------------------------------------------------------- void fun_drawWindow(int force) { int v1; // [sp+4Ch] [bp-4h]@6 if ( force ) window_redrawRequest = 1; if ( window_redrawRequest ) { if ( mouseover_info_id ) v1 = dword_7E2D10; else v1 = window_id; if ( v1 ) { switch ( v1 ) { case 4: sub_5091E0(); break; case 63: fun_drawDialogConfirm(); break; case 1: fun_drawCityScreenForeground(); break; case 22: fun_drawCityScreenForeground(); break; case 23: fun_drawCityScreenForeground(); break; case 24: fun_drawCityScreenForeground(); break; case 25: fun_drawCityScreenForeground(); break; case 26: fun_drawCityScreenForeground(); break; case 27: fun_drawCityScreenForeground(); break; case 28: fun_drawCityScreenForeground(); break; case 29: fun_drawCityScreenForeground(); break; case 31: fun_drawCityScreenForeground(); break; case 32: fun_drawCityScreenForeground(); break; case 33: fun_drawCityScreenForeground(); break; case 34: fun_drawCityScreenForeground(); break; case 37: fun_drawCityScreenForeground(); break; default: if ( v1 != 36 ) { switch ( v1 ) { case 6: sub_507750(); break; case 5: fun_drawHelpDialog(); break; case 35: sub_4C9FE0(); break; case 3: fun_drawCityScreenForeground(); break; case 17: fun_drawCityScreenForeground(); fun_drawDialogMessages(); break; case 13: fun_drawDialogFileSavedGame(); break; case 16: fun_drawDialogFileScenario(); break; case 7: fun_drawAdvisorScreen(); break; case 8: sub_507EF0(); break; case 9: fun_drawCityScreenForeground(); fun_showRightClickInfo(); break; case 20: fun_drawEmpireInfoPanel(); break; case 21: empty_51C8D0(); break; case 38: fun_drawDialogTradeRouteOpened(); break; case 30: fun_drawCityScreenForeground(); break; case 40: fun_drawAdvisorBackgroundAndButtons(); fun_drawTradeAdvisor(); fun_drawTradeAdvisorButtons(); fun_drawDialogResourceSettings(); break; case 41: fun_drawDialogTradePrices(); break; case 42: fun_drawAdvisorBackgroundAndButtons(); fun_drawLaborAdvisor(); fun_drawLaborAdvisorCategories(); fun_drawLaborPriorityDialog(); break; case 43: fun_drawAdvisorBackgroundAndButtons(); fun_drawDialogHoldFestival(); break; case 44: fun_drawAdvisorBackgroundAndButtons(); fun_drawDialogSetSalary(); break; case 45: fun_drawAdvisorBackgroundAndButtons(); fun_drawDialogDonateToCity(); break; case 46: fun_drawAdvisorBackgroundAndButtons(); fun_drawDialogSendGift(); break; case 67: fun_showGameFinishedScreen(); break; case 51: fun_showVictoryScreen(); break; case 53: fun_drawMissionBriefingForeground(); break; case 52: sub_50A290(); break; case 54: fun_drawStartNewCareerBackground(); break; case 59: fun_drawMissionBriefingForeground(); break; case 60: fun_drawLogoScreen(); break; case 55: fun_drawDemoExitScreen1(); break; case 56: fun_drawDemoExitScreen2(); break; case 57: fun_drawDemoExitScreen3(); break; case 58: fun_drawWinGameScreen(); break; case 61: fun_drawCckSelectionScreen(); break; case 62: fun_drawConfirmResolutionDialog(); break; } } break; } } else { fun_drawMainMenu(0); } window_redrawRequest = 0; } } // 401E6F: using guessed type int fun_showVictoryScreen(void); // 402397: using guessed type int sub_402397(void); // 4026BC: using guessed type int fun_drawMissionBriefingForeground(void); // 4029F5: using guessed type int j_empty_51C8D0(void); // 660C5C: using guessed type char window_redrawRequest; // 7E2D10: using guessed type int dword_7E2D10; //----- (004D7BC0) -------------------------------------------------------- void fun_drawWindowButtons() { if ( window_id ) { if ( window_id != 4 ) { switch ( window_id ) { case 63u: fun_drawDialogConfirmButtons(); break; case 1u: if ( mode_editor ) { if ( imagebuttonunknown_flag ) { fun_editor_drawMainDialog(); fun_drawArrowButtonCollection( screen_640x480_x + 12, screen_640x480_y + 40, &arrowbuttons_editorSettings, 2); } else { sub_4DC1B0(); } fun_drawCitySidepanelMinimap(0); fun_drawCitySidepanelEditorConsole(); fun_drawDebugInfoBuildings(); } else { sub_4DC1B0(); fun_drawCitySidepanelButtons(); fun_drawCitySidepanelOverlayButtonText(0, cityscreen_width_withControlpanel + 4); fun_drawCitySidepanelMinimap(0); fun_drawCityScreen_PausedAndTime(); fun_drawSelectedCost(); fun_drawDebugInfoPopulation(); fun_drawDebugInfoEvolve(); fun_drawDebugInfoBuildings(); fun_drawDebugInfoFigures(); sub_4DDF20(); } break; case 3u: sub_4DC1B0(); fun_drawOpenSubMenu(); break; case 17u: fun_drawMessageListButtons(); break; case 6u: sub_4DC1B0(); fun_editor_drawControlPanelSubmenuButtons(); break; case 8u: sub_4DC1B0(); fun_drawOverlayMenuButtons(); break; case 5u: fun_drawHelpDialogButtons(); break; case 19u: fun_smackDoFrame(); if ( helpDialog_showVideo ) fun_drawHelpDialogButtons(); break; default: if ( window_id != 18 ) { switch ( window_id ) { case 35u: if ( dword_7E2D10 == 1 ) sub_4DC1B0(); sub_4C9FE0(); break; case 9u: imagebuttons_redraw = 1; sub_4E92D0(); if ( storage_specialOrdersShown ) fun_drawImageButtonCollection(rightclickInfoDialog_x, 432, &imagebuttons_rightClickInfo, 2); else fun_drawImageButtonCollection( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo, 2); if ( rightclickInfoDialog_advisor ) fun_drawImageButtonCollection( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo_advisor, 1); break; case 2u: fun_drawCitySidepanel(); break; case 10u: fun_drawDisplayOptionsDialog(); break; case 69u: fun_drawDifficultyOptionsDialog(); break; case 11u: fun_drawSoundOptionsDialog(); if ( button_something_3 > 20 ) fun_drawArrowButtonCollection( screen_640x480_x + 208, screen_640x480_y + 60, &arrowbuttons_soundOptions, 8); break; case 12u: fun_drawSpeedOptionsDialog(); if ( button_something_4 > 20 ) fun_drawArrowButtonCollection( screen_640x480_x + 128, screen_640x480_y + 40, &arrowbuttons_speedOptions, 4); break; case 13u: fun_drawDialogFileSavedGame(); break; case 16u: fun_drawDialogFileScenario(); break; case 22u: fun_drawEditorEditStartDate(); break; case 23u: fun_drawEditorRequests(); break; case 24u: fun_drawEditorEditRequest(); break; case 25u: fun_drawEditorInvasions(); break; case 26u: fun_drawEditorEditInvasion(); break; case 27u: fun_editor_drawAllowedBuildingsDialog(); break; case 29u: fun_editor_drawSpecialEventsDialog(); break; case 28u: fun_editor_drawWinCriteriaDialog(); break; case 31u: fun_editor_drawDemandChangesDialog(); break; case 32u: fun_editor_drawEditDemandChangeDialog(); break; case 33u: fun_editor_drawPriceChangesDialog(); break; case 34u: fun_editor_drawEditPriceChangeDialog(); break; case 37u: fun_editor_drawStartingConditionsDialog(); break; case 36u: fun_editor_drawSupplyDemandDialog(); break; case 20u: imagebuttons_redraw = 1; fun_drawEmpire(); fun_drawEmpireInfoPanelCityName(); fun_drawImageButtonCollection(20, screen_height - 44, &imagebuttons_empireMap_help, 1); fun_drawImageButtonCollection(screen_width - 44, screen_height - 44, &imagebuttons_empireMap_exit, 1); fun_drawImageButtonCollection( screen_width - 44, screen_height - 100, &imagebuttons_empireMap_advisor, 1); if ( empire_selectedCity ) { if ( empire[empire_selectedCity - 1].type == 1 ) { trade_selectedCity = fun_getTradeCityFromEmpireObject(empire_selectedCity - 1); if ( tradeRoutes[trade_selectedCity].cityType == City_Trade ) { if ( !tradeRoutes[trade_selectedCity].isOpen ) { if ( mouseover_button_id_main ) fun_drawBorderedButton(0, (screen_width - 500) / 2 + 50, screen_height - 40, 400, 20, 1); else fun_drawBorderedButton(0, (screen_width - 500) / 2 + 50, screen_height - 40, 400, 20, 0); } } } } break; case 21u: fun_drawEmpire(); fun_drawEmpireInfoPanelCityName(); fun_drawEditEmpireObjectButtons(); fun_drawEditEmpireObjectPanel(); fun_editor_drawEmpireUnsavedDataWarning(); switch ( editEmpire_selectedObjectButton ) { case 1: fun_drawArrowButtonCollection(223, screen_height - 114, &arrowbuttons_editEmpireMap, 5); break; case 2: fun_drawArrowButtonCollection(223, screen_height - 114, &arrowbuttons_editEmpireMap, 5); break; case 4: fun_drawArrowButtonCollection(223, screen_height - 114, arrowbuttons_editEmpire, 2); break; } break; case 38u: imagebuttons_redraw = 1; fun_drawImageButtonCollection(screen_640x480_x, screen_640x480_y, &imagebuttons_tradeRouteOpened, 2); break; case 14u: fun_editor_drawNumericInputDialog(numericInput_x, numericInput_y); break; case 15u: fun_editor_drawSelectListDialog(selectList_x, selectList_y); break; case 7u: imagebuttons_redraw = 1; fun_advisorPrepareSomeButton(); fun_drawImageButtonCollection( dialog_x, 16 * (advisor_dialog_height - 2) + dialog_y, &imagebuttons_advisors, 1); switch ( currentAdvisor ) { case Adv_Labor: fun_drawArrowButtonCollection(dialog_x, dialog_y, &arrowbuttons_laborAdvisor, 2); fun_drawLaborAdvisorCategories(); break; case Adv_Military: fun_drawMilitaryAdvisorButtons(); break; case Adv_Imperial: fun_drawImperialAdvisorButtons(); break; case Adv_Ratings: fun_drawRatingsAdvisorButtons(); break; case Adv_Trade: fun_drawTradeAdvisorButtons(); break; case Adv_Population: fun_drawPopulationAdvisorButtons(); break; default: if ( currentAdvisor != Adv_Health ) { if ( currentAdvisor != Adv_Education ) { if ( currentAdvisor == Adv_Entertainment ) { fun_drawEntertainmentAdvisorHoldFestivalButton(); } else { if ( currentAdvisor != Adv_Religion ) { if ( currentAdvisor == Adv_Financial ) fun_drawArrowButtonCollection(dialog_x, dialog_y, &arrowbuttons_financeAdvisor, 2); } } } } break; } break; case 40u: imagebuttons_redraw = 1; fun_drawDialogResourceSettings(); fun_drawImageButtonCollection(dialog_x, dialog_y, &imagebuttons_resourceSettings, 2); if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId] == 2 ) fun_drawArrowButtonCollection(dialog_x, dialog_y, &arrowbuttons_resourceSettings, 2); break; default: if ( window_id != W_TradePricesDialog ) { switch ( window_id ) { case 42u: fun_drawLaborPriorityDialogButtons(); break; case 43u: imagebuttons_redraw = 1; fun_drawDialogHoldFestivalButtons(); fun_drawImageButtonCollection(dialog_x, dialog_y, &imagebuttons_holdFestival, 4); break; case 44u: imagebuttons_redraw = 1; fun_drawDialogSetSalary(); break; case 45u: imagebuttons_redraw = 1; fun_drawDialogDonateToCityButtons(); fun_drawArrowButtonCollection(dialog_x, dialog_y, &arrowbuttons_donateToCity, 2); break; case 46u: imagebuttons_redraw = 1; fun_drawDialogSendGiftButtons(); break; case 67u: fun_drawWinLoseScreenButtons(); break; case 51u: if ( winState != 1 ) fun_drawWinLoseScreenButtons(); break; case 53u: imagebuttons_redraw = 1; sub_4C5E40(); fun_drawImageButtonCollection( dword_7E2C28 + 500, dword_7E2C2C + 394, &imagebuttons_newCampaign, 1); if ( setting_currentMissionId >= 2 ) fun_drawImageButtonCollection( dword_7E2C28 + 10, dword_7E2C2C + 396, &imagebuttons_missionBriefing, 1); break; case 52u: imagebuttons_redraw = 1; if ( selectMission_choice > 0 ) fun_drawImageButtonCollection( dword_7E2C28 + 580, dword_7E2C2C + 410, &imagebuttons_newCampaign, 1); sub_411BA0(); break; case 59u: imagebuttons_redraw = 1; sub_4C5E40(); fun_drawImageButtonCollection( dword_7E2C28 + 500, dword_7E2C2C + 394, &imagebuttons_newCampaign, 1); break; case 61u: imagebuttons_redraw = 1; fun_drawImageButtonCollection(screen_640x480_x, screen_640x480_y, &imagebuttons_cckSelection, 3); fun_drawCckFileList(); break; case 62u: fun_drawConfirmResolutionDialogButtons(); break; case 54u: imagebuttons_redraw = 1; fun_drawStartNewCareerDialog(); fun_drawImageButtonCollection( screen_640x480_x + 464, screen_640x480_y + 249, &imagebuttons_newCampaign, 1); break; case 30u: sub_4DC1B0(); fun_drawCitySidepanelMinimap(0); fun_drawCityScreen_PausedAndTime(); break; } } break; } } break; } } } else { empty_drawMainMenuBackground(); fun_drawMainMenuForeground(); } imagebuttons_redraw = 0; } // 4010BE: using guessed type int __fastcall fun_editor_drawAllowedBuildingsDialog(_DWORD, _DWORD); // 401E83: using guessed type int sub_401E83(void); // 401FC8: using guessed type int fun_drawOpenSubMenu(void); // 4028E7: using guessed type int fun_editor_drawSpecialEventsDialog(void); // 402CF2: using guessed type int fun_drawDifficultyOptionsDialog(void); // 403076: using guessed type int fun_drawOverlayMenuButtons(void); // 40320B: using guessed type int __thiscall fun_editor_drawWinCriteriaDialog(_DWORD); // 607740: using guessed type int currentAdvisor; // 607744: using guessed type int selectMission_choice; // 607F70: using guessed type int empire_selectedCity; // 607F74: using guessed type int trade_selectedCity; // 607FD0: using guessed type int helpDialog_showVideo; // 60872C: using guessed type int button_something_3; // 608730: using guessed type int button_something_4; // 64E340: using guessed type int storage_specialOrdersShown; // 64E394: using guessed type int rightclickInfoDialog_advisor; // 65286A: using guessed type __int16 cityinfo_resourceTradeStatus[]; // 65E6D4: using guessed type int screen_height; // 65E760: using guessed type int setting_currentMissionId; // 660730: using guessed type char winState; // 660905: using guessed type char imagebuttons_redraw; // 7E2D10: using guessed type int dword_7E2D10; // 993F08: using guessed type int editEmpire_selectedObjectButton; // 9D7B2C: using guessed type int mouseover_button_id_main; // 9DA7D0: using guessed type int numericInput_y; // 9DA7D8: using guessed type int numericInput_x; // 9DA88C: using guessed type int imagebuttonunknown_flag; // 9DA898: using guessed type int mode_editor; // 9DA8E0: using guessed type int selectList_x; // 9DA8E4: using guessed type int selectList_y; //----- (004D8A70) -------------------------------------------------------- void fun_handleMouseClick() { int scrollDirection; // eax@30 int v1; // eax@31 int v2; // eax@47 int v3; // eax@143 int v4; // eax@241 int v5; // eax@261 int v6; // eax@488 int v7; // eax@490 int numButtonsVictory; // [sp+50h] [bp-10h]@20 int v9; // [sp+54h] [bp-Ch]@34 int v10; // [sp+54h] [bp-Ch]@95 signed int v11; // [sp+58h] [bp-8h]@247 int v12; // [sp+58h] [bp-8h]@268 int v13; // [sp+58h] [bp-8h]@276 int v14; // [sp+58h] [bp-8h]@304 inputtext_lastUsed = 0; mouseover_imagebutton_id[0] = 0; arrowbutton_id = 0; menuClickedItem = 0; button_x = mouseclick_x; button_y = mouseclick_y; if ( dword_6608AC[0] == 2 ) { dword_6608AC[0] = 0; window_redrawRequest = 1; } if ( !window_id ) // main menu { mouseover_button_id = fun_isCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_mainMenu, 4); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_mainMenu, 4); return; } if ( window_id == 4 ) { sub_509410(); return; } if ( window_id == W_GeneralConfirmDialog ) { fun_handleConfirmDialogClick(); return; } if ( window_id == W_VideoLogo ) { message_useVideo = 2; fun_clearScreen(); fun_startVideo("smk\\logo.smk", (screen_width - 500) / 2, (screen_height - 292) / 2, 1, 64); return; } if ( window_id == W_VideoIntro ) { message_useVideo = 2; fun_clearScreen(); fun_startVideo("smk\\intro.smk", (screen_width - 500) / 2, (screen_height - 292) / 2, 1, 65); return; } if ( window_id == W_VideoCredits ) { message_useVideo = 2; fun_clearScreen(); fun_startVideo("smk\\credits.smk", (screen_width - 640) / 2, (screen_height - 480) / 2, 1, 60); return; } if ( window_id == 66 ) { music_currentlyPlayingBackground = 0; sub_5093B0(2, 51, 1000); return; } if ( window_id == 67 ) { if ( setting_currentMissionId >= 2 || setting_isCustomScenario ) numButtonsVictory = 3; else numButtonsVictory = 1; mouseover_button_id = fun_isCustomButtonClick( victoryScreen_x, victoryScreen_y, &buttons_victoryDialog, numButtonsVictory); fun_handleCustomButtonClick(victoryScreen_x, victoryScreen_y, &buttons_victoryDialog, numButtonsVictory); return; } if ( window_id != 1 ) { if ( window_id == 18 ) { if ( mode_editor != 1 ) { if ( !sidepanel_collapsed ) !fun_handleCustomButtonClick(cityscreen_width_withControlpanel, 24, &buttons_sidepanel_problem, 1); } return; } if ( window_id == 6 ) { if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { if ( !fun_sidePanel_submenuClick() ) { if ( mode_editor == 1 && (imagebuttonunknown_flag ? (v10 = 2) : (v10 = 17), fun_handleImageButtonClick(cityscreen_width_withControlpanel, 24, &imagebuttons_unknown_5EEF00, v10)) ) { imagebuttons_redraw = 1; } else { if ( sidepanel_collapsed ) { if ( sidepanel_collapsed == 1 ) { if ( fun_handleImageButtonClick( cityscreen_width_withoutControlpanel, 24, imagebuttons_sidebar_buildCollapsed, 12) ) imagebuttons_redraw = 1; } } else { if ( !fun_handleCustomButtonClick(cityscreen_width_withControlpanel, 24, &buttons_sidepanel_problem, 1) ) { if ( fun_handleImageButtonClick(cityscreen_width_withControlpanel, 24, imagebuttons_sidebar_build, 15) ) imagebuttons_redraw = 1; } } } } } return; } if ( window_id == W_OverlaySelectionMenu ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( cityscreen_width_withControlpanel - 170, buildmenu_X + 32, &buttons_overlayMenu, 8); if ( !fun_handleCustomButtonClick( cityscreen_width_withControlpanel - 170, buildmenu_X + 32, &buttons_overlayMenu, 8) ) { sub_40F330(); if ( selectedOverlaySubMenu ) { mouseover_button_id_main = fun_isCustomButtonClick( cityscreen_width_withControlpanel - 348, buildmenu_X + 24 * dword_9D7B34 + 32, &buttons_overlaySubMenu, selectedOverlaySubMenuNumItems); !fun_handleCustomButtonClick( cityscreen_width_withControlpanel - 348, buildmenu_X + 24 * dword_9D7B34 + 32, &buttons_overlaySubMenu, selectedOverlaySubMenuNumItems); } } } return; } if ( window_id == 5 ) { fun_handleHelpDialogClick(); return; } if ( window_id == 19 ) { if ( helpDialog_showVideo ) { fun_handleHelpDialogClick(); } else { if ( handleClick_isRightClick ) fun_smackCancelVideo(); if ( byte_65E6C8 ) fun_smackCancelVideo(); } return; } if ( window_id == 9 ) { fun_handleMouseClickRightClickInfo(); return; } if ( window_id == 3 ) { if ( mode_editor == 1 ) { if ( sub_41FEC0(&topmenu_editor, 4) ) return; } else { if ( sub_41FEC0(&topmenu_game, 4) ) return; } if ( handleClick_isRightClick ) sub_420130(); } else { if ( window_id == W_MessageList ) { fun_handleClickMessages(); return; } if ( window_id == 2 ) { v3 = fun_getMapScrollDirection(); fun_scrollMap(v3); return; } if ( window_id == W_DisplayOptionsDialog ) { if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_displayOptions, 5); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_displayOptions, 5); } return; } if ( window_id == W_DifficultyOptionsDialog ) { if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { fun_handleArrowButtonClick( screen_640x480_x + 288, screen_640x480_y + 80, &arrowbuttons_difficultyOptions, 3); } return; } if ( window_id == W_SoundOptionsDialog ) { if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_soundOptions, 6); if ( !fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_soundOptions, 6) ) fun_handleArrowButtonClick(screen_640x480_x + 208, screen_640x480_y + 60, &arrowbuttons_soundOptions, 8); } return; } if ( window_id == W_SpeedOptionsDialog ) { if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_speedOptions, 2); if ( !fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_speedOptions, 2) ) fun_handleArrowButtonClick(screen_640x480_x + 128, screen_640x480_y + 40, &arrowbuttons_speedOptions, 4); } return; } if ( window_id == W_SavedGame_LoadSaveDeleteDialog ) { fun_inputInit(2); if ( input_accepted ) { input_accepted = 0; currentButton_parameter = 1; fun_dialogFileSavedGame_okCancel(); } if ( is_right_click ) { window_id = fileDialogSave_from_window; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_fileSavedGame, 12); if ( !fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_fileSavedGame, 12) ) { fun_isImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_fileSavedGame, 4, 10); if ( !fun_handleImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_fileSavedGame, 4) ) fun_dialogFile_handleScrollbarClick(); } } return; } if ( window_id == 16 ) { fun_inputInit(4); if ( input_accepted ) { input_accepted = 0; currentButton_parameter = 1; fun_dialogFileScenario_okCancel(); } if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_fileSavedGame, 12); if ( !fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_fileSavedGame, 12) ) { fun_isImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_fileScenario, 4, 10); if ( !fun_handleImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_fileScenario, 4) ) fun_dialogFile_handleScrollbarClick(); } } return; } if ( window_id == W_EditorEditStartDate ) { if ( is_right_click ) { window_id = 37; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 160, screen_640x480_y + 44, &buttons_editor_startDate, 2); fun_handleCustomButtonClick(screen_640x480_x + 160, screen_640x480_y + 44, &buttons_editor_startDate, 2); } return; } if ( window_id == W_EditorRequests ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_editor_requests, 20); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_editor_requests, 20); } return; } if ( window_id == W_EditorEditRequest ) { if ( is_right_click ) { fun_editor_editRequest_ok(); } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editRequest, 7); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editRequest, 7); } return; } if ( window_id == 25 ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_editor_invasions, 20); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_editor_invasions, 20); } return; } if ( window_id == 26 ) { if ( is_right_click ) { fun_editor_editInvasion_ok(); } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editInvasion, 7); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editInvasion, 7); } return; } if ( window_id == W_EditorAllowedBuildings ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_allowedBuildings, 48); fun_handleCustomButtonClick( screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_allowedBuildings, 48); } return; } if ( window_id == W_EditorSpecialEvents ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_specialEvents, 13); fun_handleCustomButtonClick(screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_specialEvents, 13); } return; } if ( window_id == W_EditorWinCriteria ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_winCriteria, 16); fun_handleCustomButtonClick(screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_winCriteria, 16); } return; } if ( window_id == 37 ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 12, screen_640x480_y + 40, &buttons_editor_startCond, 9); fun_handleCustomButtonClick(screen_640x480_x + 12, screen_640x480_y + 40, &buttons_editor_startCond, 9); } return; } if ( window_id == W_EditorDemandChanges ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_editor_demandChanges, 20); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_editor_demandChanges, 20); } return; } if ( window_id == W_EditorEditDemandChange ) { if ( is_right_click ) { fun_sortDemandChanges(); window_id = W_EditorDemandChanges; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editDemandChange, 6); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editDemandChange, 6); } return; } if ( window_id == W_EditorPriceChanges ) { if ( is_right_click ) { window_id = 1; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_editor_priceChanges, 20); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_editor_priceChanges, 20); } return; } if ( window_id == W_EditorEditPriceChange ) { if ( is_right_click ) { fun_sortPriceChanges(); window_id = W_EditorPriceChanges; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editPriceChange, 6); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y + 100, &buttons_editor_editPriceChange, 6); } return; } if ( window_id == 36 ) { if ( is_right_click ) { window_id = 21; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_setSupplyDemand, 15); fun_handleCustomButtonClick( screen_640x480_x + 16, screen_640x480_y + 32, &buttons_editor_setSupplyDemand, 15); } return; } if ( window_id == W_EmpireMap ) { v4 = fun_getMapScrollDirection(); fun_scrollEmpireMap(v4); fun_isImageButtonClick(20, screen_height - 44, &imagebuttons_empireMap_help, 1, 10); if ( !fun_handleImageButtonClick(20, screen_height - 44, &imagebuttons_empireMap_help, 1) ) { fun_isImageButtonClick(screen_width - 44, screen_height - 44, &imagebuttons_empireMap_exit, 1, 11); if ( !fun_handleImageButtonClick(screen_width - 44, screen_height - 44, &imagebuttons_empireMap_exit, 1) ) { fun_isImageButtonClick(screen_width - 44, screen_height - 100, &imagebuttons_empireMap_advisor, 1, 12); if ( !fun_handleImageButtonClick( screen_width - 44, screen_height - 100, &imagebuttons_empireMap_advisor, 1) ) { v11 = fun_editor_editEmpire_something3(); if ( v11 ) { if ( v11 > 0 ) empire_selectedCity = v11; } else { empire_selectedCity = 0; } if ( is_right_click ) { empire_selectedCity = 0; window_redrawRequest = 1; } if ( empire_selectedCity ) { if ( empire[empire_selectedCity - 1].type == 1 ) { trade_selectedCity = fun_getTradeCityFromEmpireObject(empire_selectedCity - 1); if ( tradeRoutes[trade_selectedCity].cityType == 2 ) { if ( !tradeRoutes[trade_selectedCity].isOpen ) { mouseover_button_id_main = fun_isCustomButtonClick( (screen_width - 500) / 2, screen_height - 105, &buttons_empireMap_city, 1); !fun_handleCustomButtonClick( (screen_width - 500) / 2, screen_height - 105, &buttons_empireMap_city, 1); } } } } } } } return; } switch ( window_id ) { case 21u: fun_editor_empire_determineMaxEntryInUse(); fun_editor_empire_determineGraphicSize(); v5 = fun_getMapScrollDirection(); fun_scrollEmpireMap(v5); mouseover_button_id = fun_isCustomButtonClick(15, screen_height - 116, &buttons_editEmpireMap_general, 6); if ( fun_handleCustomButtonClick(15, screen_height - 116, &buttons_editEmpireMap_general, 6) ) return; if ( editEmpire_selectedObjectButton == 1 ) { if ( !fun_handleArrowButtonClick(223, screen_height - 114, &arrowbuttons_editEmpireMap, 5) ) { if ( !fun_handleCustomButtonClick(223, screen_height - 114, &buttons_editEmpireMap_addObject, 8) ) { fun_editor_editEmpire_something(edit_empire_max_inUse, 0); v12 = fun_editor_editEmpire_something2(); if ( v12 ) { currentEmpireEntryId = v12 - 1; editEmpire_selectedObjectButton = 2; editEmpire_addObjectGraphicID = empire[v12 - 1].graphicID; } } } return; } if ( editEmpire_selectedObjectButton == 2 ) { if ( dword_660B90 > 0 ) { --dword_660B90; return; } if ( !fun_handleArrowButtonClick(223, screen_height - 114, &arrowbuttons_editEmpireMap, 5) ) { v13 = currentEmpireEntryId; switch ( empire[currentEmpireEntryId].type ) { case Emp_City: if ( fun_handleCustomButtonClick(223, screen_height - 114, &buttons_editEmpireMap_editCity, 5) ) return; if ( empire[v13].cityType == City_Ours ) { if ( fun_handleCustomButtonClick(223, screen_height - 114, &buttons_editEmpireMap_editOwnCity, 10) ) return; } else { if ( empire[v13].cityType == City_Trade ) { if ( fun_handleCustomButtonClick( 223, screen_height - 114, &buttons_editEmpireMap_editCityTrade, 16) ) return; } else { if ( empire[v13].cityType == City_FutureTrade && fun_handleCustomButtonClick( 223, screen_height - 114, &buttons_editEmpireMap_editCityTrade, 16) ) return; } } if ( empire[v13].cityType == City_Ours || empire[v13].cityType == City_Trade || empire[v13].cityType == City_FutureTrade ) fun_editor_empire_fixBuySell(v13); fun_editor_empire_fixOwnCity(); break; case Emp_BattleIcon: if ( fun_handleCustomButtonClick(223, screen_height - 114, &buttons_editEmpireMap_editBattle, 2) ) return; break; case Emp_LandTradeRoute: case Emp_SeaTradeRoute: if ( fun_handleCustomButtonClick(223, screen_height - 114, &buttons_editEmpireMap_editRoute, 1) ) return; fun_empireObjectsCorrectOwnerCity(v13); fun_empireObjectsCorrectTradeStatus(); empireScreen_selectedRouteId = empire[v13].tradeRouteId; break; } fun_editor_editEmpire_something(currentEmpireEntryId, 1); v14 = fun_editor_editEmpire_something2(); if ( v14 ) { currentEmpireEntryId = v14 - 1; editEmpire_addObjectGraphicID = empire[v14-1].graphicID; } return; } } else { if ( editEmpire_selectedObjectButton == 4 ) { if ( !fun_handleArrowButtonClick(223, screen_height - 114, arrowbuttons_editEmpire, 2) ) !fun_handleCustomButtonClick(223, screen_height - 114, &buttons_editEmpireMap_expand, 3); } } break; case 38u: fun_isImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_tradeRouteOpened, 2, 10); fun_handleImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_tradeRouteOpened, 2); break; case 14u: if ( is_right_click ) { window_id = numericInput_fromWindow; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick(numericInput_x, numericInput_y, &buttons_numericInput, 12); fun_handleCustomButtonClick(numericInput_x, numericInput_y, &buttons_numericInput, 12); } break; case 15u: if ( is_right_click ) { window_id = selectList_fromWindow; window_redrawRequest = 1; } else { if ( selectList_extraParameter == 1 ) { mouseover_button_id = fun_isCustomButtonClick( selectList_x, selectList_y, &buttons_selectList2, selectList_numItems); !fun_handleCustomButtonClick(selectList_x, selectList_y, &buttons_selectList2, selectList_numItems); } else { mouseover_button_id = fun_isCustomButtonClick( selectList_x, selectList_y, &buttons_selectList1, selectList_numItems); !fun_handleCustomButtonClick(selectList_x, selectList_y, &buttons_selectList1, selectList_numItems); } } break; case 7u: mouseover_button_id_main = fun_isCustomButtonClick(screen_640x480_x, dialog_y + 440, &buttons_advisors, 13); if ( !fun_handleCustomButtonClick(screen_640x480_x, dialog_y + 440, &buttons_advisors, 13) ) { fun_isImageButtonClick( dialog_x, 16 * (advisor_dialog_height - 2) + dialog_y, &imagebuttons_advisors, 1, 10); if ( !fun_handleImageButtonClick( dialog_x, 16 * (advisor_dialog_height - 2) + dialog_y, &imagebuttons_advisors, 1) ) { if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { switch ( currentAdvisor ) { case Adv_Labor: mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_laborAdvisor, 9); if ( !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_laborAdvisor, 9) ) { fun_isArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_laborAdvisor, 2, 10); !fun_handleArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_laborAdvisor, 2); } break; case Adv_Military: mouseover_button_id = fun_isCustomButtonClick( dialog_x, dialog_y, &buttons_militaryAdvisor, 3 * milAdv_numForts[0]); !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_militaryAdvisor, 3 * milAdv_numForts[0]); break; case Adv_Imperial: mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_imperialAdvisor, 8); !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_imperialAdvisor, 8); break; case Adv_Ratings: mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_ratingsAdvisor, 4); !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_ratingsAdvisor, 4); break; case Adv_Trade: mouseover_button_id = fun_isCustomButtonClick( dialog_x, dialog_y, &buttons_tradeAdvisor, availableGoods_count + 2); !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_tradeAdvisor, availableGoods_count + 2); break; case Adv_Population: mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_populationAdvisor, 2); !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_populationAdvisor, 2); break; default: if ( currentAdvisor != Adv_Health ) { if ( currentAdvisor != Adv_Education ) { if ( currentAdvisor == Adv_Entertainment ) { mouseover_button_id = fun_isCustomButtonClick( dialog_x, dialog_y, &buttons_entertainmentAdvisor, 1); !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_entertainmentAdvisor, 1); } else { if ( currentAdvisor != Adv_Religion ) { if ( currentAdvisor == Adv_Financial ) { fun_isArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_financeAdvisor, 2, 10); !fun_handleArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_financeAdvisor, 2); } } } } } break; } } } } break; case 40u: mouseover_button_id = 0; mouseover_button_id_main = mouseover_button_id; dword_9D7B90 = mouseover_button_id_main; if ( handleClick_isRightClick ) { window_id = 7; window_redrawRequest = 1; } else { fun_isImageButtonClick(dialog_x, dialog_y, &imagebuttons_resourceSettings, 2, 10); if ( !fun_handleImageButtonClick(dialog_x, dialog_y, &imagebuttons_resourceSettings, 2) ) { if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId] != 2 || (fun_isArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_resourceSettings, 2, 10), !fun_handleArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_resourceSettings, 2)) ) { mouseover_button_id = fun_isCustomButtonClick( dialog_x, dialog_y, &buttons_resourceSettings_industry, 1); if ( !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_resourceSettings_industry, 1) ) { mouseover_button_id_main = fun_isCustomButtonClick( dialog_x, dialog_y, &buttons_resourceSettings_trade, 1); if ( !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_resourceSettings_trade, 1) ) { dword_9D7B90 = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_resourceSettings_stockpile, 1); fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_resourceSettings_stockpile, 1); } } } } } break; case 41u: if ( handleClick_isRightClick ) { window_id = W_Advisors; window_redrawRequest = 1; } break; case 42u: if ( handleClick_isRightClick ) { window_id = W_Advisors; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick( dialog_x, dialog_y, &buttons_setLaborPriority, laborPriority_maxPriorities + 1); fun_handleCustomButtonClick( dialog_x, dialog_y, &buttons_setLaborPriority, laborPriority_maxPriorities + 1); } break; case 43u: if ( handleClick_isRightClick ) { window_id = W_Advisors; window_redrawRequest = 1; } else { fun_isImageButtonClick(dialog_x, dialog_y, &imagebuttons_holdFestival, 4, 10); if ( !fun_handleImageButtonClick(dialog_x, dialog_y, &imagebuttons_holdFestival, 4) ) { mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_holdFestival, 8); fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_holdFestival, 8); } } break; case 44u: if ( handleClick_isRightClick ) { window_id = 7; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_setSalary, 12); fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_setSalary, 12); } break; case 45u: if ( handleClick_isRightClick ) { window_id = 7; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_donateToCity, 7); if ( !fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_donateToCity, 7) ) { fun_isArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_donateToCity, 2, 10); fun_handleArrowButtonClick(dialog_x, dialog_y, &arrowbuttons_donateToCity, 2); } } break; case 46u: if ( handleClick_isRightClick ) { window_id = W_Advisors; window_redrawRequest = 1; } else { mouseover_button_id = fun_isCustomButtonClick(dialog_x, dialog_y, &buttons_giftToCaesar, 5); fun_handleCustomButtonClick(dialog_x, dialog_y, &buttons_giftToCaesar, 5); } break; case 51u: if ( winState == 1 ) { if ( handleClick_isRightClick ) { fun_soundStopChannel(0); fun_soundStopChannel(1); sub_4E6B40(); } } else { mouseover_button_id = fun_isCustomButtonClick( victoryScreen_x, victoryScreen_y - 112, &buttons_unknown_5EE7B8, 1); !fun_handleCustomButtonClick(victoryScreen_x, victoryScreen_y - 112, &buttons_unknown_5EE7B8, 1); } break; case 53u: if ( !fun_handleImageButtonClick(dword_7E2C28 + 500, dword_7E2C2C + 394, &imagebuttons_newCampaign, 1) ) { if ( setting_currentMissionId < 2 || !fun_handleImageButtonClick(dword_7E2C28 + 10, dword_7E2C2C + 396, &imagebuttons_missionBriefing, 1) ) sub_4C5EE0(); } break; case 52u: if ( handleClick_isRightClick ) { sub_4117C0(); window_redrawRequest = 1; } if ( selectMission_choice <= 0 || !fun_handleImageButtonClick(dword_7E2C28 + 580, dword_7E2C2C + 410, &imagebuttons_newCampaign, 1) ) fun_selectMission_type(); break; case 59u: if ( !fun_handleImageButtonClick(dword_7E2C28 + 500, dword_7E2C2C + 394, &imagebuttons_newCampaign, 1) ) sub_4C5EE0(); break; case 61u: if ( !fun_dialogCckSelection_scrollbarClick() ) { if ( !fun_handleImageButtonClick(screen_640x480_x, screen_640x480_y, &imagebuttons_cckSelection, 3) ) { mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x, screen_640x480_y, &buttons_cckSelection, 15); fun_handleCustomButtonClick(screen_640x480_x, screen_640x480_y, &buttons_cckSelection, 15); } } break; case 62u: mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 80, screen_640x480_y + 64, &buttons_resolutionConfirmDialog, 1); if ( !fun_handleCustomButtonClick( screen_640x480_x + 80, screen_640x480_y + 64, &buttons_resolutionConfirmDialog, 1) ) { if ( timeGetTime() > resolutionConfirm_startTime + 10000 ) fun_changeBackToLastResolution(); } break; case 54u: fun_inputInit(1); if ( !fun_handleImageButtonClick( screen_640x480_x + 464, screen_640x480_y + 249, &imagebuttons_newCampaign, 1) ) { if ( input_accepted ) { sub_4117C0(); window_redrawRequest = 1; } } break; case 60u: if ( handleClick_isRightClick || byte_65E6C8 ) { window_id = 0; window_redrawRequest = 1; } break; case 55u: if ( handleClick_isRightClick || byte_660B94[0] ) { window_id = 56; window_redrawRequest = 1; } break; case 56u: if ( handleClick_isRightClick || byte_660B94[0] ) { window_id = 57; window_redrawRequest = 1; } break; case 57u: if ( handleClick_isRightClick || byte_660B94[0] ) { wndproc_closeStatus = 1; window_redrawRequest = 1; } break; case 58u: if ( handleClick_isRightClick || byte_660B94[0] ) { window_id = 0; window_redrawRequest = 1; } break; case 30u: sub_40AC20(); if ( sidepanel_collapsed || (fun_minimap_hasBeenClicked(), fun_minimap_handleClick(), !v6) ) { v7 = fun_getMapScrollDirection(); fun_scrollMap(v7); if ( handleClick_isRightClick ) { window_id = 1; fun_clearWarnings(); window_redrawRequest = 1; } else { sub_40AC20(); if ( byte_660B94[0] ) sub_412180(); } } break; } } return; } dword_608078 = 0; if ( mode_editor == 1 ) { menuClickedItem = fun_isMenubarClick(&topmenu_editor, 4); if ( fun_handleMenubarClick(&topmenu_editor, 4) ) return; } else { menuClickedItem = fun_isMenubarClick(&topmenu_game, 4); if ( fun_handleMenubarClick(&topmenu_game, 4) ) return; } scrollDirection = fun_getMapScrollDirection(); fun_scrollMap(scrollDirection); if ( mode_editor != 1 ) { if ( sidepanel_collapsed ) { if ( sidepanel_collapsed == 1 ) { fun_topmenu_isFundsPopDateHit(); if ( topmenu_fundsPopDateHit && handleClick_isRightClick ) { fun_topmenu_rightClick(); return; } fun_isImageButtonClick(cityscreen_width_withoutControlpanel, 24, &imagebuttons_unknown_5EEB08, 1, 10); if ( fun_handleImageButtonClick(cityscreen_width_withoutControlpanel, 24, &imagebuttons_unknown_5EEB08, 1) ) { imagebuttons_redraw = 1; return; } fun_isImageButtonClick(cityscreen_width_withoutControlpanel, 24, imagebuttons_sidebar_buildCollapsed, 12, 30); if ( fun_handleImageButtonClick( cityscreen_width_withoutControlpanel, 24, imagebuttons_sidebar_buildCollapsed, 12) ) { imagebuttons_redraw = 1; return; } } } else { fun_minimap_hasBeenClicked(); fun_minimap_handleClick(); if ( v2 ) return; fun_topmenu_isFundsPopDateHit(); if ( topmenu_fundsPopDateHit && handleClick_isRightClick ) { fun_topmenu_rightClick(); return; } fun_isImageButtonClick(cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_overlayCollapse, 2, 10); if ( fun_handleImageButtonClick(cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_overlayCollapse, 2) ) { imagebuttons_redraw = 1; return; } fun_isImageButtonClick(cityscreen_width_withControlpanel, 24, imagebuttons_sidebar_build, 15, 30); if ( fun_handleCustomButtonClick(cityscreen_width_withControlpanel, 24, &buttons_sidepanel_problem, 1) ) return; if ( fun_handleImageButtonClick(cityscreen_width_withControlpanel, 24, imagebuttons_sidebar_build, 15) ) { imagebuttons_redraw = 1; return; } fun_isImageButtonClick(cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_advEmpOri, 6, 50); if ( fun_handleImageButtonClick(cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_advEmpOri, 6) ) { imagebuttons_redraw = 1; return; } } LABEL_69: sub_40AC20(); dword_9DA7C8 = 0; if ( byte_660B94[0] ) { if ( !sub_4120D0() ) sub_40A7B0(); } else { if ( mouse_isLeftClick ) { sub_40A930(); } else { if ( byte_65E6C8 ) { sub_40AB00(); } else { if ( handleClick_isRightClick ) { if ( !sub_40A700() ) sub_4E6EC0(); } } } } return; } fun_minimap_hasBeenClicked(); fun_minimap_handleClick(); if ( v1 ) return; if ( imagebuttonunknown_flag ) { if ( is_right_click ) { imagebuttonunknown_flag = 0; window_redrawRequest = 1; return; } fun_inputInit(5); v9 = 2; mouseover_button_id = fun_isCustomButtonClick( screen_640x480_x + 12, screen_640x480_y + 40, &buttons_editor_main, 10); if ( fun_handleCustomButtonClick(screen_640x480_x + 12, screen_640x480_y + 40, &buttons_editor_main, 10) || fun_handleArrowButtonClick(screen_640x480_x + 12, screen_640x480_y + 40, &arrowbuttons_editorSettings, 2) ) return; } else { v9 = 17; } if ( fun_handleImageButtonClick(cityscreen_width_withControlpanel, 24, &imagebuttons_unknown_5EEF00, v9) ) { imagebuttons_redraw = 1; return; } if ( imagebuttonunknown_flag != 1 ) goto LABEL_69; } // 4014A6: using guessed type int sub_4014A6(void); // 40343B: using guessed type int sub_40343B(void); // 607740: using guessed type int currentAdvisor; // 607744: using guessed type int selectMission_choice; // 607F70: using guessed type int empire_selectedCity; // 607F74: using guessed type int trade_selectedCity; // 607FD0: using guessed type int helpDialog_showVideo; // 608078: using guessed type int dword_608078; // 6080A8: using guessed type int sidepanel_collapsed; // 60812C: using guessed type int message_useVideo; // 608620: using guessed type int milAdv_numForts[7]; // 6086EC: using guessed type int availableGoods_count; // 65286A: using guessed type __int16 cityinfo_resourceTradeStatus[]; // 65E6BC: using guessed type char mouse_isLeftClick; // 65E6C8: using guessed type char byte_65E6C8; // 65E6D4: using guessed type int screen_height; // 65E760: using guessed type int setting_currentMissionId; // 65E764: using guessed type int setting_isCustomScenario; // 65E934: using guessed type char handleClick_isRightClick; // 660730: using guessed type char winState; // 6608A1: using guessed type char is_right_click; // 6608AC: using guessed type int dword_6608AC[13]; // 660905: using guessed type char imagebuttons_redraw; // 660B90: using guessed type int dword_660B90; // 660C50: using guessed type int button_y; // 660C54: using guessed type int button_x; // 660C5C: using guessed type char window_redrawRequest; // 6ADBC8: using guessed type int fileDialogSave_from_window; // 6DEDD0: using guessed type char wndproc_closeStatus; // 6E6B00: using guessed type int inputtext_lastUsed; // 7E27A0: using guessed type int input_accepted; // 990CE0: using guessed type int editEmpire_addObjectGraphicID; // 990D0C: using guessed type __int16 empire_graphicID[]; // 993F00: using guessed type int empireScreen_selectedRouteId; // 993F08: using guessed type int editEmpire_selectedObjectButton; // 9D77F0: using guessed type int mouseover_imagebutton_id[202]; // 9D7B28: using guessed type int mouseover_button_id; // 9D7B2C: using guessed type int mouseover_button_id_main; // 9D7B34: using guessed type int dword_9D7B34; // 9D7B44: using guessed type int dword_9D7B44; // 9D7B50: using guessed type int topmenu_fundsPopDateHit; // 9D7B6C: using guessed type int menuClickedItem; // 9D7B90: using guessed type int dword_9D7B90; // 9D7BA0: using guessed type int selectedOverlaySubMenuNumItems; // 9D7BA4: using guessed type int arrowbutton_id; // 9DA5E0: using guessed type int music_currentlyPlayingBackground; // 9DA7B4: using guessed type int laborPriority_maxPriorities; // 9DA7C8: using guessed type int dword_9DA7C8; // 9DA7D0: using guessed type int numericInput_y; // 9DA7D8: using guessed type int numericInput_x; // 9DA818: using guessed type int resolutionConfirm_startTime; // 9DA82C: using guessed type int numericInput_fromWindow; // 9DA88C: using guessed type int imagebuttonunknown_flag; // 9DA894: using guessed type int selectList_fromWindow; // 9DA898: using guessed type int mode_editor; // 9DA8BC: using guessed type int selectList_numItems; // 9DA8E0: using guessed type int selectList_x; // 9DA8E4: using guessed type int selectList_y; // 9DA8E8: using guessed type int selectList_extraParameter; //----- (004DBFE0) -------------------------------------------------------- signed int fun_getElapsedGameTicks() { signed int result; // eax@4 int timeDiff; // [sp+54h] [bp-Ch]@1 DWORD currentTime; // [sp+58h] [bp-8h]@1 int invertedGameSpeed; // [sp+5Ch] [bp-4h]@3 currentTime = timeGetTime(); timeDiff = currentTime - lastGameTickTime; if ( (currentTime - lastGameTickTime) < 0 ) timeDiff = 10000; invertedGameSpeed = (100 - setting_speed_game) / 10; if ( invertedGameSpeed >= 10 ) return 0; // gamespeed = 0 if ( setting_game_paused ) return 0; if ( window_id != 18 && window_id != 35 ) { if ( dword_5FECC8[window_id] ) return 0; } else { if ( dword_7E2D10 != 1 ) return 0; } if ( dword_9DA918 ) { result = 0; } else { if ( shouldScrollMap ) { result = 0; } else { if ( invertedGameSpeed < 0 ) invertedGameSpeed = 0; if ( timeDiff < millisecondsPerGameTickAtInvertedSpeed[invertedGameSpeed] + 2 ) { result = 0; } else { lastGameTickTime = currentTime; result = 10000; } } } return result; } // 608064: using guessed type int lastGameTickTime; // 65E708: using guessed type char setting_game_paused; // 660C4C: using guessed type int shouldScrollMap; // 7E2D10: using guessed type int dword_7E2D10; //----- (004DC120) -------------------------------------------------------- signed int fun_shouldScrollMap() { signed int result; // eax@4 int timeDiff; // [sp+4Ch] [bp-Ch]@1 DWORD currentTime; // [sp+50h] [bp-8h]@1 int timeBetweenScrolls; // [sp+54h] [bp-4h]@3 currentTime = timeGetTime(); timeDiff = currentTime - shouldScrollMap_lastUpdateTime; if ( (currentTime - shouldScrollMap_lastUpdateTime) < 0 ) timeDiff = 10000; timeBetweenScrolls = (100 - setting_speed_scroll) / 10; if ( timeBetweenScrolls < 10 ) { if ( timeDiff < 12 * timeBetweenScrolls + 2 ) { result = 0; } else { shouldScrollMap_lastUpdateTime = currentTime; result = 1; } } else { result = 0; } return result; } // 608068: using guessed type int shouldScrollMap_lastUpdateTime; // 8C79E4: using guessed type int setting_map_camera_x; // 8C79E8: using guessed type int setting_map_camera_y; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (004DC1F0) -------------------------------------------------------- void fun_scrollMap(int scrollDirection) { signed int yChange; // [sp+4Ch] [bp-8h]@2 signed int xChange; // [sp+50h] [bp-4h]@2 if ( scrollMap_one ) { xChange = 1; yChange = 4; } else { xChange = 1; yChange = 1; } if ( scrollDirection != Direction_None ) { if ( scrollDirection ) { switch ( scrollDirection ) { case Direction_NorthEast: setting_map_camera_y -= yChange; setting_map_camera_x += xChange; break; case Direction_East: setting_map_camera_x += xChange; break; case Direction_SouthEast: setting_map_camera_y += yChange; setting_map_camera_x += xChange; break; case Direction_South: setting_map_camera_y += yChange; break; case Direction_SouthWest: setting_map_camera_y += yChange; setting_map_camera_x -= xChange; break; case Direction_West: setting_map_camera_x -= xChange; break; case Direction_NorthWest: setting_map_camera_y -= yChange; setting_map_camera_x -= xChange; break; } } else { setting_map_camera_y -= yChange; } sub_41C5D0(); sub_4DC600(); } } // 5FF5C0: using guessed type int scrollMap_one; // 8C79E4: using guessed type int setting_map_camera_x; // 8C79E8: using guessed type int setting_map_camera_y; //----- (004DC380) -------------------------------------------------------- int unused_4DC380() { return fun_getCityScreenWidth(); } //----- (004DC3A0) -------------------------------------------------------- int unused_4DC3A0() { return unused_42E480(); } // 401FE1: using guessed type int j_unused_42E480(void); //----- (004DC3C0) -------------------------------------------------------- int fun_getIsometricViewportWidth2() { return fun_getIsometricViewportWidth(); } //----- (004DC3E0) -------------------------------------------------------- int fun_getIsometricViewportHeight2() { return fun_getIsometricViewportHeight(); } //----- (004DC400) -------------------------------------------------------- void fun_setCityViewport_withoutPanel() { switch ( screen_width ) { case 640: fun_setIsometricViewport(162, 162, 0, 24, 10, 31, 58, 30); break; case 800: fun_setIsometricViewport(162, 162, 0, 24, 12, 39, 58, 30); break; case 1024: fun_setIsometricViewport(162, 162, 0, 24, 16, 50, 58, 30); break; default: fun_setIsometricViewport(162, 162, 0, 24, 8, 31, 58, 30); break; } } //----- (004DC4E0) -------------------------------------------------------- void fun_setCityViewport_withPanel() { switch ( screen_width ) { case 640: fun_setIsometricViewport(162, 162, 0, 24, 8, 31, 58, 30); break; case 800: fun_setIsometricViewport(162, 162, 0, 24, 10, 39, 58, 30); break; case 1024: fun_setIsometricViewport(162, 162, 0, 24, 14, 50, 58, 30); break; default: fun_setIsometricViewport(162, 162, 0, 24, 8, 31, 58, 30); break; } } //----- (004DC5C0) -------------------------------------------------------- void sub_4DC5C0() { fun_setIsometricViewport(162, 162, 0, 24, 5, 15, 58, 30); } //----- (004DC600) -------------------------------------------------------- void sub_4DC600() { int v0; // [sp+4Ch] [bp-8h]@1 int v1; // [sp+50h] [bp-4h]@1 v1 = (165 - setting_map_width) / 2; v0 = (323 - 2 * setting_map_height) / 2; if ( setting_map_camera_x < (165 - setting_map_width) / 2 - 1 ) setting_map_camera_x = v1 - 1; if ( fun_getIsometricViewportWidth2() + setting_map_camera_x > 165 - v1 ) setting_map_camera_x = 165 - v1 - fun_getIsometricViewportWidth2(); if ( setting_map_camera_y < v0 ) setting_map_camera_y = v0; if ( fun_getIsometricViewportHeight2() + setting_map_camera_y > 327 - v0 ) setting_map_camera_y = 327 - v0 - fun_getIsometricViewportHeight2(); setting_map_camera_y &= 0xFFFEu; } // 8C79E4: using guessed type int setting_map_camera_x; // 8C79E8: using guessed type int setting_map_camera_y; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; //----- (004DC710) -------------------------------------------------------- void fun_clearBookmarks() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 4; ++i ) { mapBookmarks_x[2 * i] = -1; mapBookmarks_y[2 * i] = -1; } } // 65DF00: using guessed type int mapBookmarks_x[]; //----- (004DC770) -------------------------------------------------------- void fun_loadFromC3mapsBmp(int a1) { fun_strncpy(&byte_5FEE50[48 * a1], (char *)&setting_map_start, 48); c3maps_bitmap = (struct WindowsBitmap *)malloc(1500000u); if ( c3maps_bitmap ) // bitmap should be 1000 pixels wide, 256-color { if ( fun_readFileIntoBuffer("c3maps.bmp", c3maps_bitmap) ) { c3maps_dataOffset = fun_getBmpDataOffset(c3maps_bitmap); fun_flipBitmap(c3maps_bitmap); fun_initNewScenarioMap(); fun_loadTerrainFromC3maps(a1); sub_478B80(0, 0, setting_map_width - 1, setting_map_height - 1); sub_478CE0(0, 0, setting_map_width - 1, setting_map_height - 1); sub_478E40(); sub_479DE0(0, 0, setting_map_width - 1, setting_map_height - 1); sub_479C80(0, 0, setting_map_width - 1, setting_map_height - 1); sub_47F400(); sub_479720(0, 0, setting_map_width - 1, setting_map_height - 1); j_freeMemory(c3maps_bitmap); } else { j_freeMemory(c3maps_bitmap); } } } // 401F00: using guessed type _DWORD sub_401F00(_DWORD, _DWORD, _DWORD, _DWORD); // 403058: using guessed type _DWORD sub_403058(_DWORD, _DWORD, _DWORD, _DWORD); // 65DF28: using guessed type int c3maps_dataOffset; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; //----- (004DC930) -------------------------------------------------------- void fun_loadTerrainFromC3maps(int a1) { int v1; // [sp+4Ch] [bp-20h]@5 int offset; // [sp+50h] [bp-1Ch]@1 int v3; // [sp+54h] [bp-18h]@1 int v4; // [sp+58h] [bp-14h]@1 int y; // [sp+5Ch] [bp-10h]@1 int x; // [sp+60h] [bp-Ch]@3 int v7; // [sp+64h] [bp-8h]@1 int v8; // [sp+68h] [bp-4h]@3 v4 = c3maps_mission_x[2 * a1]; v3 = c3maps_mission_y[2 * a1]; offset = setting_map_startGridOffset; v7 = 0; y = 0; while ( v7 < setting_map_height ) { v8 = 0; x = 0; while ( v8 < setting_map_width ) { v1 = *((_BYTE *)&c3maps_bitmap->header.bfType + 1000 * (y + v3) + x + v4 + c3maps_dataOffset); if ( v1 == 16 ) grid_terrain[offset] = T_Rock; if ( v1 == 11 ) grid_terrain[offset] = T_Tree; if ( v1 == 9 ) grid_terrain[offset] = T_Scrub; if ( v1 == 4 ) grid_terrain[offset] = T_Water; if ( v1 == 8 ) grid_terrain[offset] = T_Road; if ( v1 == 3 ) grid_bitfields[offset] |= 0x20u; ++v8; ++x; ++offset; } ++v7; offset += setting_map_gridBorderSize; ++y; } } // 5FF4B0: using guessed type int c3maps_mission_x[]; // 65DF28: using guessed type int c3maps_dataOffset; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; //----- (004DCAE0) -------------------------------------------------------- void fun_writeToC3mapsBmp(int missionId) { DWORD filesize; // eax@24 char color; // [sp+4Ch] [bp-20h]@10 int offset; // [sp+50h] [bp-1Ch]@5 int yOffset; // [sp+54h] [bp-18h]@5 int xOffset; // [sp+58h] [bp-14h]@5 int v6; // [sp+5Ch] [bp-10h]@5 int v7; // [sp+60h] [bp-Ch]@7 int y; // [sp+64h] [bp-8h]@5 int x; // [sp+68h] [bp-4h]@7 c3maps_bitmap = (struct WindowsBitmap *)malloc(1500000u); if ( c3maps_bitmap ) // bitmap should be 1000 pixels wide, 256-color { if ( fun_readFileIntoBuffer("c3maps.bmp", c3maps_bitmap) ) { c3maps_dataOffset = fun_getBmpDataOffset(c3maps_bitmap); fun_flipBitmap(c3maps_bitmap); xOffset = c3maps_mission_x[2 * missionId]; yOffset = c3maps_mission_y[2 * missionId]; offset = setting_map_startGridOffset; y = 0; v6 = 0; while ( y < setting_map_height ) { x = 0; v7 = 0; while ( x < setting_map_width ) { switch ( grid_terrain[offset] ) { case T_Tree: color = 11; break; case T_Rock: color = 16; break; case T_Scrub: color = 9; break; case T_Water: color = 4; break; case T_Road: color = 8; break; default: if ( grid_bitfields[offset] & 0x20 ) color = 3; else color = 2; break; } *((_BYTE *)&c3maps_bitmap->header.bfType + 1000 * (v6 + yOffset) + v7 + xOffset + c3maps_dataOffset) = color; ++x; ++v7; ++offset; } ++y; offset += setting_map_gridBorderSize; ++v6; } fun_flipBitmap(c3maps_bitmap); filesize = fun_getFilesize("c3maps.bmp"); fun_writeBufferToFile("c3maps.bmp", c3maps_bitmap, filesize); j_freeMemory(c3maps_bitmap); } else { j_freeMemory(c3maps_bitmap); } } } // 5FF4B0: using guessed type int c3maps_mission_x[]; // 65DF28: using guessed type int c3maps_dataOffset; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; //----- (004DCD90) -------------------------------------------------------- void fun_createNewScenario(int mapsize) { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 signed int k; // [sp+4Ch] [bp-4h]@7 signed int l; // [sp+4Ch] [bp-4h]@10 signed int m; // [sp+4Ch] [bp-4h]@13 signed int n; // [sp+4Ch] [bp-4h]@16 signed int ii; // [sp+4Ch] [bp-4h]@19 signed int jj; // [sp+4Ch] [bp-4h]@22 signed int kk; // [sp+4Ch] [bp-4h]@25 signed int ll; // [sp+4Ch] [bp-4h]@28 map_unknown_0a = *(&mapsizes.field_10 + 12 * mapsize); map_unknown_0c = *(&mapsizes.field_14 + 12 * mapsize); map_sizeX = *(&mapsizes.field_0 + 6 * mapsize); map_sizeY = *(&mapsizes.field_4 + 6 * mapsize); map_gridFirstElement = *(&mapsizes.field_8 + 6 * mapsize); map_gridBorderSize = *(&mapsizes.field_C + 6 * mapsize); fun_getGameTextString(44, 37); // brief description strcpy(map_briefDescription, gametext_result); fun_getGameTextString(44, 38); // brief description of this map... strcpy(map_briefing, gametext_result); map_startFunds = 1000; map_settings_startYear = -500; map_rescueLoan = 500; map_milestone25[0] = 10; map_milestone50 = 20; map_milestone75 = 30; for ( i = 0; i < 50; ++i ) map_allowedBuildings[i] = 1; map_romeSuppliesWheat = 0; for ( j = 0; j < 4; ++j ) map_win_culture[j] = 10; for ( k = 0; k < 4; ++k ) map_win_culture_on[k] = 1; map_win_timeLimitYears_on = 0; map_win_timeLimitYears = 0; map_win_survivalYears_on = 0; map_win_survivalYears = 0; map_event_earthquake_severity = 0; map_event_earthquake_year = 0; map_win_population_flag = 0; map_win_population = 0; map_earthquake_x = -1; map_earthquake_y = -1; map_entry_x[0] = -1; map_entry_y = -1; map_exit_x = -1; map_exit_y[0] = -1; map_riverEntry_x = -1; map_riverEntry_y = -1; map_riverExit_x = -1; map_riverExit_y = -1; for ( l = 0; l < 8; ++l ) map_invasionPoints_x[l] = -1; for ( m = 0; m < 8; ++m ) map_invasionPoints_y[m] = -1; for ( n = 0; n < 8; ++n ) map_fish_x[n] = -1; for ( ii = 0; ii < 8; ++ii ) map_fish_y[ii] = -1; for ( jj = 0; jj < 4; ++jj ) map_herd_x[jj] = -1; for ( kk = 0; kk < 4; ++kk ) map_herd_y[kk] = -1; for ( ll = 0; ll < 20; ++ll ) { map_requests_deadline[ll] = 5; map_invasions_type[ll] = 0; map_invasions_from[ll] = 8; map_invasions_attack[ll] = 0; map_requests_favor[ll] = 8; } setting_map_width = map_sizeX; setting_map_height = map_sizeY; setting_map_startGridOffset = map_gridFirstElement; setting_map_gridBorderSize = map_gridBorderSize; fun_initNewScenarioMap(); fun_initMapEdges(); sub_42DB70(mapOrientation); sub_479720(0, 0, setting_map_width - 1, setting_map_height - 1); sub_4DC600(); fun_clearGroundTypeGrid(); fun_determineGroundType(); sub_4FFDF0(); sub_500420(); setting_map_camera_x = 76; setting_map_camera_y = 152; setting_map_orientation = 0; event_earthquake_state = 0; } // 4017CB: using guessed type _DWORD sub_4017CB(_DWORD); // 65DEF8: using guessed type int mapOrientation; // 8C79E4: using guessed type int setting_map_camera_x; // 8C79E8: using guessed type int setting_map_camera_y; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; // 8E1480: using guessed type int event_earthquake_state; // 990620: using guessed type __int16 map_settings_startYear; // 99062A: using guessed type __int16 map_unknown_0a; // 9907A4: using guessed type int map_sizeX; // 9907A8: using guessed type int map_sizeY; // 9907AC: using guessed type int map_gridFirstElement; // 9907B0: using guessed type int map_gridBorderSize; // 990C44: using guessed type int map_win_culture[]; // 990C78: using guessed type __int16 map_earthquake_x; // 990C7A: using guessed type __int16 map_earthquake_y; // 990C7C: using guessed type __int16 map_entry_x[]; // 990C7E: using guessed type __int16 map_entry_y; // 990C80: using guessed type __int16 map_exit_x; // 990C82: using guessed type __int16 map_exit_y[]; // 990CA4: using guessed type __int16 map_riverEntry_x; // 990CA6: using guessed type __int16 map_riverEntry_y; // 990CA8: using guessed type __int16 map_riverExit_x; // 990CAA: using guessed type __int16 map_riverExit_y; // 990CB0: using guessed type int map_milestone25[]; //----- (004DD2A0) -------------------------------------------------------- void sub_4DD2A0() { fun_initNewScenarioMap(); fun_removeFileExtension(currentScenarioFilename); fun_strncpy("map", current_fileExtension, 3); fun_appendFileExtension(currentScenarioFilename); fun_loadScenarioFile(currentScenarioFilename); fun_removeFileExtension(currentScenarioFilename); sub_445880(); setting_map_width = map_sizeX; setting_map_height = map_sizeY; setting_map_startGridOffset = map_gridFirstElement; setting_map_gridBorderSize = map_gridBorderSize; fun_initInputTextbox(5, map_briefDescription, 24, 280, 0, graphic_font); fun_initInputTextbox(6, map_briefing, 500, 400, 0, graphic_font); sub_42DB70(mapOrientation); if ( mode_editor == 1 ) { fun_generateMapFlagWalkers(); if ( map_riverEntry_x != -1 ) { if ( map_riverEntry_y != -1 ) { if ( map_riverExit_x != -1 ) { if ( map_riverExit_y != -1 ) fun_createFishHerdFlotsamWalkers(map_riverEntry_x, map_riverEntry_y, 1); } } } } sub_47C480(0, 0, setting_map_width - 2, setting_map_height - 2); sub_478CE0(0, 0, setting_map_width - 1, setting_map_height - 1); sub_479C80(0, 0, setting_map_width - 1, setting_map_height - 1); sub_478E40(); if ( !mode_editor ) sub_4837C0(0); sub_479720(0, 0, setting_map_width - 1, setting_map_height - 1); sub_479F40(0, 0, setting_map_width - 1, setting_map_height - 1); sub_47F400(); sub_478310(0, 0, setting_map_width - 1, setting_map_height - 1, 1); sub_47E590(); sub_47FAF0(0, 0, setting_map_width - 1, setting_map_height - 1, 0); sub_46E9E0(); sub_4DC600(); fun_clearGroundTypeGrid(); fun_determineGroundType(); sub_4FFDF0(); sub_5001A0(); sub_500420(); } void fun_loadScenario(const char *filename) { int v1; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@22 v1 = 0; ciid = 1; strcpy(currentScenarioFilename, filename); sub_4DD2A0(); memcpy(&map_settings_startYear, &scn_settings_startYear, 1720); if ( !mode_editor ) { if ( map_riverEntry_x != -1 ) { if ( map_riverEntry_y != -1 ) { if ( map_riverExit_x != -1 ) { if ( map_riverExit_y != -1 ) v1 = 1; } } } fun_createFishHerdFlotsamWalkers(map_riverEntry_x, map_riverEntry_y, v1); } fun_determineGroundType(); sub_4FFDF0(); sub_5001A0(); sub_500420(); if ( scn_entryPoint_x == -1 || scn_entryPoint_y == -1 ) { scn_entryPoint_x = setting_map_width - 1; scn_entryPoint_y = setting_map_height / 2; } city_inform[ciid].entry_x = scn_entryPoint_x; city_inform[ciid].entry_y = scn_entryPoint_y; city_inform[ciid].entry_gridOffset = 162 * city_inform[ciid].entry_y + city_inform[ciid].entry_x + (_WORD)setting_map_startGridOffset; if ( scn_exitPoint_x == -1 || scn_exitPoint_y == -1 ) { scn_exitPoint_x = scn_entryPoint_x; scn_exitPoint_y = scn_entryPoint_y; } city_inform[ciid].exit_x = scn_exitPoint_x; city_inform[ciid].exit_y = scn_exitPoint_y; city_inform[ciid].exit_gridOffset = 162 * city_inform[ciid].exit_y +city_inform[ciid].exit_x + (_WORD)setting_map_startGridOffset; city_inform[ciid].treasury = fun_adjustWithPercentage(scn_startFunds, difficulty_moneypct[setting_difficulty]); city_inform[ciid].finance_balance_lastyear = city_inform[ciid].treasury; gametime_year = scn_settings_startYear; event_earthquake_gameYear = scn_event_earthquake_year + scn_settings_startYear; event_earthquake_month = (random_7f_1 & 7) + 2; if ( scn_event_earthquake_severity ) { switch ( scn_event_earthquake_severity ) { case 1: event_earthquake_maxDuration = (random_7f_1 & 0x1F) + 25; event_earthquake_maxDamage = 10; break; case 2: event_earthquake_maxDuration = (random_7f_1 & 0x3F) + 100; event_earthquake_maxDamage = 8; break; case 3: event_earthquake_maxDuration = random_7f_1 + 250; event_earthquake_maxDamage = 6; break; } } else { event_earthquake_maxDuration = 0; event_earthquake_maxDamage = 0; } event_earthquake_state = 0; for ( i = 0; i < 4; ++i ) { dword_929660[2 * i] = scn_earthquake_x; dword_929664[2 * i] = scn_earthquake_y; } event_gladiatorRevolt_gameYear = scn_event_gladiatorRevolt_year + scn_settings_startYear; event_gladiatorRevolt_month = (random_7f_1 & 3) + 3; event_gladiatorRevold_endMonth = event_gladiatorRevolt_month + 3; event_gladiatorRevolt_state = 0; event_emperorChange_gameYear = scn_event_emperorChange_year + scn_settings_startYear; event_emperorChange_month = (random_7f_1 & 7) + 1; event_emperorChange_state = 0; if ( scn_win_timeLimit_on ) { timeLimit_maxGameYear = scn_win_timeLimit + scn_settings_startYear; } else { if ( scn_win_survivalTime_on ) timeLimit_maxGameYear = scn_win_survivalTime + scn_settings_startYear; else timeLimit_maxGameYear = scn_settings_startYear + 1000000; } scenario_map_empire = scn_empire; fun_readEmpireFile(1); fun_initializeTradeRoutes(); sub_4459F0(); fun_setInvasionMonthsAndPaths(); fun_setDistantBattleCity(); fun_setRequestsMonths(); fun_setDemandChangesMonths(); fun_setPriceChangesMonths(); empire_scroll_x = empireindex_xOffset[16 * scenario_map_empire]; empire_scroll_y = empireindex_yOffset[16 * scenario_map_empire]; fun_checkEmpireMapScrollBoundaries(); fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); fun_loadClimateGraphics(scn_climate); fun_loadEnemyGraphics(scn_enemy); } void fun_postMessageToPlayer(signed int messageId, int param1, __int16 param2) { int helpId; // [sp+4Ch] [bp-Ch]@3 signed int scrollId; // [sp+50h] [bp-8h]@1 signed int i; // [sp+54h] [bp-4h]@18 scrollId = fun_createPlayerMessage(); if ( scrollId != -1 ) { ++playermessageTotal; currentMessage_id = scrollId; playermessage_messageTypeId[8 * currentMessage_id] = messageId; playermessage_read[16 * currentMessage_id] = 0; playermessage_year[8 * currentMessage_id] = gametime_year; playermessage_month[16 * currentMessage_id] = gametime_month; playermessage_param1[4 * currentMessage_id] = param1; playermessage_param2[8 * currentMessage_id] = param2; playermessage_id[8 * currentMessage_id] = playermessageId_next++; helpId = fun_getHelpTextIdFromMessageId(messageId); if ( window_id == 1 ) fun_determineAdvisorForMessage(messageId); if ( help_messageType[40 * helpId] == HelpMessage_Disaster || help_messageType[40 * helpId] == HelpMessage_Invasion ) { playermessageHotspot = 1; window_redrawRequest = 1; } if ( message_usePopup && window_id == 1 ) { dword_608080 = 5; byte_660585 = 0; message_id = currentMessage_id; playermessage_read[16 * currentMessage_id] = 1; message_year = playermessage_year[8 * currentMessage_id]; message_month = playermessage_month[16 * currentMessage_id]; message_param1 = playermessage_param1[4 * currentMessage_id]; message_paramResourceId = playermessage_param2[8 * currentMessage_id]; message_helpId = helpId; fun_resetTooltipTimer(); if ( fun_fileExists(&c3mm_data[help_videoLink[20 * helpId]]) ) { message_useVideo = 1; } else { if ( help_isUrgent[20 * helpId] == 1 ) sound_playChannel(7); else sound_playChannel(6); } fun_showHelpDialog(message_helpId, 0); } else { if ( message_usePopup ) { for ( i = 0; i < 20; ++i ) { if ( !dword_659BA0[i] ) { dword_659BA0[i] = playermessage_id[8 * currentMessage_id]; break; } } } else { if ( dword_65DED0 == 1 ) { if ( help_isUrgent[20 * helpId] == 1 ) sound_playChannel(7); else sound_playChannel(6); } } } dword_65DED0 = 1; message_usePopup = 0; imagebuttons_redraw = 1; } } // 608080: using guessed type int dword_608080; // 60812C: using guessed type int message_useVideo; // 659B50: using guessed type int message_usePopup; // 659B7C: using guessed type int currentMessage_id; // 659E8C: using guessed type int playermessageId_next; // 659F80: using guessed type int playermessage_param1[]; // 659F84: using guessed type __int16 playermessage_year[]; // 659F86: using guessed type __int16 playermessage_param2[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 659F8A: using guessed type __int16 playermessage_id[]; // 65DE00: using guessed type int message_id; // 65DED0: using guessed type int dword_65DED0; // 660585: using guessed type char byte_660585; // 660905: using guessed type char imagebuttons_redraw; // 660C5C: using guessed type char window_redrawRequest; // 6DEDFA: using guessed type __int16 help_messageType[]; // 6DEE30: using guessed type int help_isUrgent[]; // 6DEE34: using guessed type int help_videoLink[]; //----- (004DDF20) -------------------------------------------------------- void sub_4DDF20() { signed int messageType; // ST60_4@21 int v1; // [sp+4Ch] [bp-18h]@5 int helpId; // [sp+50h] [bp-14h]@21 signed int msgId; // [sp+5Ch] [bp-8h]@19 signed int i; // [sp+60h] [bp-4h]@5 signed int j; // [sp+60h] [bp-4h]@12 if ( window_id == 1 ) { if ( dword_608080 <= 0 ) { v1 = 0; for ( i = 0; i < 20; ++i ) { if ( dword_659BA0[i] ) { v1 = dword_659BA0[i]; dword_659BA0[i] = 0; break; } } if ( v1 > 0 ) { for ( j = 0; j < 999; ++j ) { if ( !playermessage_messageTypeId[8 * j] ) return; if ( playermessage_id[8 * j] == v1 ) { msgId = j; break; } } if ( msgId > -1 ) { dword_608080 = 5; messageType = playermessage_messageTypeId[8 * msgId]; helpId = fun_getHelpTextIdFromMessageId(messageType); fun_determineAdvisorForMessage(messageType); byte_660585 = 0; message_id = msgId; playermessage_read[16 * msgId] = 1; message_year = playermessage_year[8 * msgId]; message_month = playermessage_month[16 * msgId]; message_param1 = playermessage_param1[4 * msgId]; message_paramResourceId = playermessage_param2[8 * msgId]; message_helpId = helpId; fun_resetTooltipTimer(); if ( fun_fileExists(&c3mm_data[help_videoLink[20 * helpId]]) ) { message_useVideo = 1; } else { if ( help_isUrgent[20 * helpId] == 1 ) sound_playChannel(7); else sound_playChannel(6); } message_usePopup = 1; fun_showHelpDialog(message_helpId, 0); message_usePopup = 0; imagebuttons_redraw = 1; } } } else { --dword_608080; } } } // 608080: using guessed type int dword_608080; // 60812C: using guessed type int message_useVideo; // 659B50: using guessed type int message_usePopup; // 659F80: using guessed type int playermessage_param1[]; // 659F84: using guessed type __int16 playermessage_year[]; // 659F86: using guessed type __int16 playermessage_param2[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 659F8A: using guessed type __int16 playermessage_id[]; // 65DE00: using guessed type int message_id; // 660585: using guessed type char byte_660585; // 660905: using guessed type char imagebuttons_redraw; // 6DEE30: using guessed type int help_isUrgent[]; // 6DEE34: using guessed type int help_videoLink[]; //----- (004DE1C0) -------------------------------------------------------- void fun_determineAdvisorForMessage(int messageTypeId) { switch ( messageTypeId ) { case 36: message_msgAdvisorId = MessageAdvisor_Labor; break; case 37: message_msgAdvisorId = MessageAdvisor_Labor; break; case 28: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 29: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 30: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 31: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 32: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 33: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 34: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 35: message_msgAdvisorId = MessageAdvisor_Imperial; break; case 49: message_msgAdvisorId = MessageAdvisor_Population; break; case 50: message_msgAdvisorId = MessageAdvisor_Population; break; case 22: message_msgAdvisorId = MessageAdvisor_Military; break; case 23: message_msgAdvisorId = MessageAdvisor_Military; break; case 24: message_msgAdvisorId = MessageAdvisor_Military; break; case 25: message_msgAdvisorId = MessageAdvisor_Military; break; case 26: message_msgAdvisorId = MessageAdvisor_Military; break; case 27: message_msgAdvisorId = MessageAdvisor_Military; break; case 102: message_msgAdvisorId = MessageAdvisor_Health; break; case 103: message_msgAdvisorId = MessageAdvisor_Health; break; case 104: message_msgAdvisorId = MessageAdvisor_Health; break; default: message_msgAdvisorId = 0; break; } } // 7E2D08: using guessed type int message_msgAdvisorId; //----- (004DE3F0) -------------------------------------------------------- int fun_getHelpTextIdFromMessageId(signed int messageId) { int helpId; // [sp+4Ch] [bp-4h]@2 if ( messageId > 50 ) helpId = messageId + 199; else helpId = messageId + 99; return helpId; } //----- (004DE430) -------------------------------------------------------- void sub_4DE430() { fun_sortAndCompactPlayerMessages(); window_id = W_MessageList; window_redrawRequest = 1; } // 660C5C: using guessed type char window_redrawRequest; //----- (004DE460) -------------------------------------------------------- void fun_sortAndCompactPlayerMessages() { signed int swap; // [sp+50h] [bp-Ch]@6 signed int i; // [sp+54h] [bp-8h]@1 signed int j; // [sp+58h] [bp-4h]@3 signed int k; // [sp+58h] [bp-4h]@17 for ( i = 0; i < 1000; ++i ) { for ( j = 0; j < 999; ++j ) { swap = 0; if ( playermessage_messageTypeId[8 * j] ) { if ( playermessage_id[8 * j] < playermessage_id[8 * (j + 1)] ) { if ( playermessage_messageTypeId[8 * (j + 1)] ) swap = 1; } } else { if ( playermessage_messageTypeId[8 * (j + 1)] ) swap = 1; } if ( swap ) { fun_memcpy8(&playermessage_param1[4 * j], &tmp_playermessage, 16); fun_memcpy8(&playermessage_param1[4 * (j + 1)], &playermessage_param1[4 * j], 16); fun_memcpy8(&tmp_playermessage, &playermessage_param1[4 * (j + 1)], 16); } } } playermessageTotal = 0; dword_658DD0 = 0; for ( k = 0; k < 1000; ++k ) { if ( playermessage_messageTypeId[8 * k] ) ++playermessageTotal; } if ( playermessageTotal <= 10 ) dword_659C18 = 0; else dword_658DD0 = playermessageTotal - 10; } // 659F80: using guessed type int playermessage_param1[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 659F8A: using guessed type __int16 playermessage_id[]; //----- (004DE680) -------------------------------------------------------- signed int fun_createPlayerMessage() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 1000; ++i ) { if ( !playermessage_messageTypeId[8 * i] ) return i; } return -1; } // 659F88: using guessed type __int16 playermessage_messageTypeId[]; //----- (004DE6E0) -------------------------------------------------------- void sub_4DE6E0() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 signed int k; // [sp+4Ch] [bp-4h]@7 signed int l; // [sp+4Ch] [bp-4h]@10 signed int m; // [sp+4Ch] [bp-4h]@13 for ( i = 0; i < 1000; ++i ) playermessage_messageTypeId[8 * i] = 0; for ( j = 0; j < 10; ++j ) populationMessage_0_shown[j] = 0; for ( k = 0; k < 20; ++k ) dword_65DE20[k] = 0; for ( l = 0; l < 20; ++l ) dword_65DE80[l] = 0; for ( m = 0; m < 20; ++m ) dword_659BA0[m] = 0; dword_608080 = 0; playermessageId_next = 0; playermessageTotal = 0; currentMessage_id = -1; message_id = 0; dword_658DD0 = 0; dword_659C18 = 0; dword_65DED0 = 1; dword_659B68 = 0; dword_65DE10 = 0; dword_659F70 = 0; dword_659C14 = 0; sub_4DE8B0(); dword_659B4C = 0; dword_65DED4 = 0; } // 608080: using guessed type int dword_608080; // 659B4C: using guessed type int dword_659B4C; // 659B68: using guessed type int dword_659B68; // 659B7C: using guessed type int currentMessage_id; // 659C14: using guessed type int dword_659C14; // 659E8C: using guessed type int playermessageId_next; // 659F70: using guessed type int dword_659F70; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 65DE00: using guessed type int message_id; // 65DE10: using guessed type int dword_65DE10; // 65DE20: using guessed type int dword_65DE20[]; // 65DE80: using guessed type int dword_65DE80[]; // 65DED0: using guessed type int dword_65DED0; // 65DED4: using guessed type int dword_65DED4; //----- (004DE8B0) -------------------------------------------------------- void sub_4DE8B0() { playermessageHotspot = 0; dword_659F68 = 0; dword_65DE0C = timeGetTime() - 10000; } // 65DE0C: using guessed type int dword_65DE0C; //----- (004DE900) -------------------------------------------------------- void sub_4DE900() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 20; ++i ) { if ( dword_65DE80[i] > 0 ) --dword_65DE80[i]; } } // 65DE80: using guessed type int dword_65DE80[]; //----- (004DE970) -------------------------------------------------------- void fun_drawDialogMessages() { dword_659B74 = screen_640x480_x; dword_659B78 = screen_640x480_y + 32; widthBlocks = 30; heightBlocks = 22; dword_659B60 = dword_659B74 + 16; dword_659B64 = dword_659B78 + 80; dword_659B5C = widthBlocks - 4; dword_659B54 = heightBlocks - 9; sub_4DC1B0(); fun_drawDialogBackground(dword_659B74, dword_659B78, widthBlocks, heightBlocks); fun_drawGameTextCentered(63, 0, dword_659B74, dword_659B78 + 16, 16 * widthBlocks, graphic_font + 670, -1); fun_drawSunkenTextBox(dword_659B60, dword_659B64, dword_659B5C, dword_659B54); if ( playermessageTotal > 0 ) { fun_drawGameText(63, 2, dword_659B60 + 42, dword_659B64 - 12, graphic_font + 938, 0); fun_drawGameText(63, 3, dword_659B60 + 180, dword_659B64 - 12, graphic_font + 938, 0); fun_drawGameTextWrapped( 63, 4, dword_659B60 + 50, dword_659B64 + 16 * dword_659B54 + 12, 16 * dword_659B5C - 100, graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 63, 1, dword_659B60 + 16, dword_659B64 + 80, 16 * dword_659B5C - 48, graphic_font + 1072, -1); } } // 6E6BD0: using guessed type __int16 graphic_font; //----- (004DEBE0) -------------------------------------------------------- void fun_drawMessageListButtons() { int v0; // [sp+4Ch] [bp-20h]@25 int v1; // [sp+54h] [bp-18h]@21 signed int v2; // [sp+58h] [bp-14h]@4 signed int v3; // [sp+5Ch] [bp-10h]@9 int v4; // [sp+60h] [bp-Ch]@15 int v5; // [sp+64h] [bp-8h]@6 signed int v6; // [sp+68h] [bp-4h]@6 imagebuttons_redraw = 1; fun_drawImageButtonCollection( dword_659B74 + 16, dword_659B78 + 16 * heightBlocks - 42, &imagebuttons_messages_help, 1); fun_drawImageButtonCollection( dword_659B74 + 16 * widthBlocks - 38, dword_659B78 + 16 * heightBlocks - 36, &imagebuttons_messages_close, 1); if ( playermessageTotal > 0 ) { if ( playermessageTotal <= 10 ) v2 = playermessageTotal; else v2 = 10; v5 = dword_659C18; v6 = 0; while ( v6 < v2 ) { message_helpId = fun_getHelpTextIdFromMessageId(playermessage_messageTypeId[8 * v5]); if ( help_messageType[40 * message_helpId] == 1 ) v3 = 2; else v3 = 0; if ( playermessage_read[16 * v5] ) drawGraphic(word_6E6C64 + v3 + 15, dword_659B60 + 12, dword_659B64 + 20 * v6 + 6); else drawGraphic(word_6E6C64 + v3 + 14, dword_659B60 + 8, dword_659B64 + 20 * v6 + 6); if ( mouseover_button_id == v6 + 1 ) v4 = graphic_font + 402; else v4 = graphic_font + 268; text_xoffset = 0; fun_drawGameText( 25, playermessage_month[16 * v5], dword_659B60 + 42, dword_659B64 + 20 * v6 + 8, v4, 0); fun_drawGameYearWithBcAd( 0, playermessage_year[8 * v5], dword_659B60 + text_xoffset + 46, dword_659B64 + 20 * v6 + 8, v4, 0); fun_drawText( &c3mm_data[help_title[20 * message_helpId]], dword_659B60 + 180, dword_659B64 + 20 * v6++ + 8, v4, 0); ++v5; } if ( dword_658DD0 > 0 ) { fun_drawImageButtonCollection(16 * dword_659B5C + dword_659B60, dword_659B64, &imagebuttons_messages_up, 1); fun_drawImageButtonCollection( 16 * dword_659B5C + dword_659B60, dword_659B64 + 16 * dword_659B54 - 26, &imagebuttons_messages_down, 1); if ( dword_659C18 > 0 ) { if ( dword_659C18 < dword_658DD0 ) v1 = getPercentage(dword_659C18, dword_658DD0); else v1 = 100; } else { v1 = 0; } v0 = fun_adjustWithPercentage(16 * dword_659B54 - 77, v1); if ( dword_659BF0 ) v0 = dword_659B80; drawGraphic(graphic_buttons + 39, dword_659B60 + 16 * dword_659B5C + 9, dword_659B64 + v0 + 26); } } } // 659B80: using guessed type int dword_659B80; // 659BF0: using guessed type int dword_659BF0; // 659F84: using guessed type __int16 playermessage_year[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 660905: using guessed type char imagebuttons_redraw; // 6DEDFA: using guessed type __int16 help_messageType[]; // 6DEE3C: using guessed type int help_title[]; // 6E6BCE: using guessed type __int16 graphic_buttons; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6C64: using guessed type __int16 word_6E6C64; // 7E2724: using guessed type int text_xoffset; // 9D7B28: using guessed type int mouseover_button_id; //----- (004DF060) -------------------------------------------------------- int fun_handleClickMessages() { int result; // eax@1 fun_isImageButtonClick(dword_659B74 + 16, dword_659B78 + 16 * heightBlocks - 42, &imagebuttons_messages_help, 1, 10); result = fun_handleImageButtonClick( dword_659B74 + 16, dword_659B78 + 16 * heightBlocks - 42, &imagebuttons_messages_help, 1); if ( !result ) { fun_isImageButtonClick( dword_659B74 + 16 * widthBlocks - 38, dword_659B78 + 16 * heightBlocks - 36, &imagebuttons_messages_close, 1, 11); result = fun_handleImageButtonClick( dword_659B74 + 16 * widthBlocks - 38, dword_659B78 + 16 * heightBlocks - 36, &imagebuttons_messages_close, 1); if ( !result ) { fun_isImageButtonClick(16 * dword_659B5C + dword_659B60, dword_659B64, &imagebuttons_messages_up, 1, 12); result = fun_handleImageButtonClick( 16 * dword_659B5C + dword_659B60, dword_659B64, &imagebuttons_messages_up, 1); if ( !result ) { fun_isImageButtonClick( 16 * dword_659B5C + dword_659B60, dword_659B64 + 16 * dword_659B54 - 26, &imagebuttons_messages_down, 1, 12); result = fun_handleImageButtonClick( 16 * dword_659B5C + dword_659B60, dword_659B64 + 16 * dword_659B54 - 26, &imagebuttons_messages_down, 1); if ( !result ) { mouseover_button_id = fun_isCustomButtonClick(dword_659B60, dword_659B64 + 4, &buttons_messages, 10); result = fun_handleCustomButtonClick(dword_659B60, dword_659B64 + 4, &buttons_messages, 10); if ( !result ) result = sub_4DF2E0(); } } } } return result; } // 401C03: using guessed type int sub_401C03(void); // 9D7B28: using guessed type int mouseover_button_id; //----- (004DF2E0) -------------------------------------------------------- signed int sub_4DF2E0() { signed int result; // eax@2 int v1; // ST5C_4@15 int v2; // [sp+4Ch] [bp-Ch]@13 signed int v3; // [sp+50h] [bp-8h]@5 if ( dword_658DD0 > 0 ) { if ( mouse_isLeftClick ) { v3 = 16 * dword_659B54 - 52; if ( mouseclick_x >= dword_659B60 + 16 * dword_659B5C + 1 ) { if ( mouseclick_x <= dword_659B60 + 16 * dword_659B5C + 41 ) { if ( mouseclick_y >= dword_659B64 + 26 ) { if ( mouseclick_y <= dword_659B64 + v3 + 26 ) { v2 = mouseclick_y - dword_659B64 - 11; if ( mouseclick_y - dword_659B64 - 11 > v3 ) v2 = 16 * dword_659B54 - 52; v1 = getPercentage(v2, v3); dword_659C18 = fun_adjustWithPercentage(dword_658DD0, v1); dword_659BF0 = 1; dword_659B80 = v2 - 25; if ( dword_659B80 < 0 ) dword_659B80 = 0; window_redrawRequest = 1; result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } // 659B80: using guessed type int dword_659B80; // 659BF0: using guessed type int dword_659BF0; // 65E6BC: using guessed type char mouse_isLeftClick; // 660C5C: using guessed type char window_redrawRequest; //----- (004DF460) -------------------------------------------------------- void fun_dialogMessages_scrollUpDown() { if ( currentButton_parameter ) { if ( currentButton_parameter == 1 ) { if ( dword_659C18 < dword_658DD0 ) ++dword_659C18; } } else { if ( dword_659C18 > 0 ) --dword_659C18; } dword_659BF0 = 0; window_redrawRequest = 1; } // 659BF0: using guessed type int dword_659BF0; // 660C5C: using guessed type char window_redrawRequest; //----- (004DF4F0) -------------------------------------------------------- void fun_dialogMessages_help() { fun_showHelpDialog(34, 0); window_redrawRequest = 1; } // 660C5C: using guessed type char window_redrawRequest; //----- (004DF520) -------------------------------------------------------- void fun_dialogMessages_close() { window_id = 1; window_redrawRequest = 1; } // 660C5C: using guessed type char window_redrawRequest; //----- (004DF550) -------------------------------------------------------- void fun_messages_select() { currentMessage_id = currentButton_parameter + dword_659C18; message_id = currentMessage_id; if ( currentMessage_id < playermessageTotal ) { playermessage_read[16 * currentMessage_id] = 1; message_year = playermessage_year[8 * currentMessage_id]; message_month = playermessage_month[16 * currentMessage_id]; message_param1 = playermessage_param1[4 * currentMessage_id]; message_paramResourceId = playermessage_param2[8 * currentMessage_id]; message_helpId = fun_getHelpTextIdFromMessageId(playermessage_messageTypeId[8 * currentMessage_id]); fun_determineAdvisorForMessage(playermessage_messageTypeId[8 * currentMessage_id]); fun_showHelpDialog(message_helpId, 0); } } // 659B7C: using guessed type int currentMessage_id; // 659F80: using guessed type int playermessage_param1[]; // 659F84: using guessed type __int16 playermessage_year[]; // 659F86: using guessed type __int16 playermessage_param2[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 65DE00: using guessed type int message_id; //----- (004DF680) -------------------------------------------------------- void fun_messages_delete() { currentMessage_id = currentButton_parameter + dword_659C18; if ( currentMessage_id < playermessageTotal ) { playermessage_messageTypeId[8 * currentMessage_id] = 0; fun_sortAndCompactPlayerMessages(); if ( dword_659C18 >= dword_658DD0 ) --dword_659C18; if ( dword_659C18 < 0 ) dword_659C18 = 0; window_redrawRequest = 1; } } // 659B7C: using guessed type int currentMessage_id; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 660C5C: using guessed type char window_redrawRequest; //----- (004DF720) -------------------------------------------------------- void sub_4DF720() { playermessage_messageTypeId[8 * currentMessage_id] = 0; fun_sortAndCompactPlayerMessages(); if ( dword_659C18 >= dword_658DD0 ) --dword_659C18; if ( dword_659C18 < 0 ) dword_659C18 = 0; fun_message_close(); } // 659B7C: using guessed type int currentMessage_id; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; //----- (004DF7A0) -------------------------------------------------------- void fun_message_help() { fun_message_close(); fun_showHelpDialog(10, 0); } //----- (004DF7D0) -------------------------------------------------------- void fun_message_gotoProblemArea() { int v0; // [sp+4Ch] [bp-10h]@2 signed int gridOffset; // [sp+50h] [bp-Ch]@1 gridOffset = playermessage_param2[8 * message_id]; fun_getHelpTextIdFromMessageId(playermessage_messageTypeId[8 * message_id]); if ( help_messageType[40 * currentHelpId] == HelpMessage_Invasion ) { v0 = fun_getInvasionGridOffset(playermessage_param1[4 * message_id]); if ( v0 > 0 ) gridOffset = v0; } if ( gridOffset > 0 ) { if ( gridOffset < 26244 ) fun_gotoGridOffset(gridOffset); } window_id = 1; window_redrawRequest = 1; } // 659F80: using guessed type int playermessage_param1[]; // 659F86: using guessed type __int16 playermessage_param2[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 65DE00: using guessed type int message_id; // 660C5C: using guessed type char window_redrawRequest; // 6DEDFA: using guessed type __int16 help_messageType[]; // 7E2BF4: using guessed type int currentHelpId; //----- (004DF8B0) -------------------------------------------------------- void sub_4DF8B0() { int v0; // [sp+4Ch] [bp-1Ch]@19 int v1; // [sp+50h] [bp-18h]@8 int v2; // [sp+50h] [bp-18h]@26 int v3; // [sp+54h] [bp-14h]@34 signed int i; // [sp+64h] [bp-4h]@1 signed int v5; // [sp+64h] [bp-4h]@19 fun_sortAndCompactPlayerMessages(); playermessageHotspot = 0; for ( i = 0; i < 999; ++i ) { if ( playermessage_messageTypeId[8 * i] ) { if ( playermessage_year[8 * i] >= gametime_year - 1 ) { v1 = help_messageType[40 * fun_getHelpTextIdFromMessageId(playermessage_messageTypeId[8 * i])]; if ( v1 == HelpMessage_Disaster || v1 == HelpMessage_Invasion ) { if ( v1 != HelpMessage_Invasion || fun_getInvasionGridOffset(playermessage_param1[4 * i]) > 0 ) ++playermessageHotspot; } } } } if ( playermessageHotspot > 0 ) { if ( dword_659F68 >= playermessageHotspot ) dword_659F68 = 0; v5 = 0; v0 = 0; while ( v5 < 999 ) { if ( playermessage_messageTypeId[8 * v5] ) { if ( playermessage_year[8 * v5] >= gametime_year - 1 ) { v2 = help_messageType[40 * fun_getHelpTextIdFromMessageId(playermessage_messageTypeId[8 * v5])]; if ( v2 == HelpMessage_Disaster || v2 == HelpMessage_Invasion ) { if ( v2 != HelpMessage_Invasion || fun_getInvasionGridOffset(playermessage_param1[4 * v5]) > 0 ) { ++v0; if ( dword_659F68 < v0 ) { ++dword_659F68; _LOWORD(v3) = playermessage_param2[8 * v5]; if ( v2 != HelpMessage_Invasion || (v3 = fun_getInvasionGridOffset(playermessage_param1[4 * v5]), v3 > 0) ) { fun_gotoGridOffset(v3); window_id = 1; window_redrawRequest = 1; } return; } } } } } ++v5; } } else { dword_659F68 = 0; } } // 659F80: using guessed type int playermessage_param1[]; // 659F84: using guessed type __int16 playermessage_year[]; // 659F86: using guessed type __int16 playermessage_param2[]; // 659F88: using guessed type __int16 playermessage_messageTypeId[]; // 660C5C: using guessed type char window_redrawRequest; // 6DEDFA: using guessed type __int16 help_messageType[]; //----- (004DFBA0) -------------------------------------------------------- void fun_drawWarnings() { int topOffset; // [sp+4Ch] [bp-10h]@12 int middle; // [sp+50h] [bp-Ch]@11 int v2; // [sp+54h] [bp-8h]@14 signed int i; // [sp+58h] [bp-4h]@6 if ( window_id != 1 ) { if ( window_id != 18 ) fun_clearWarnings(); } warning_amount = 0; for ( i = 0; i < 5; ++i ) { if ( *(&warnings.inUse + 60 * i) ) { ++warning_amount; middle = *(&warnings.middle + 60 * i); if ( setting_game_paused ) // paused topOffset = *(&warnings.top + 60 * i) + 70; else topOffset = *(&warnings.top + 60 * i); v2 = i + 9; fun_drawSmallGreyButton( i + 9, middle - *(&warnings.warningboxWidth + 60 * i) / 2 + 1, topOffset, *(&warnings.warningboxWidth + 60 * i) / 16 + 1, 0, 1); if ( button_something_0[i + 9] > 40 ) { if ( *(&warnings.warningboxWidth + 60 * i) < 460 ) { drawGraphic(word_6E6CBC + 15, middle - *(&warnings.warningboxWidth + 60 * i) / 2 + 2, topOffset + 2); drawGraphic(word_6E6CBC + 15, middle + *(&warnings.warningboxWidth + 60 * i) / 2 - 30, topOffset + 2); } fun_drawTextCentered( &warnings.text[120 * i], middle - *(&warnings.warningboxWidth + 60 * i) / 2 + 1, topOffset + 4, *(&warnings.warningboxWidth + 60 * i), graphic_font + 268, 0); } if ( sub_52C7A0(v2) ) { video_refreshRequested = 1; button_something_0[v2] += 4; } if ( time_current > *(&warnings.time + 30 * i) + 15000 )// max 15s *(&warnings.inUse + 60 * i) = 0; } } } // 40284C: using guessed type _DWORD sub_40284C(_DWORD); // 608008: using guessed type int time_current; // 608720: using guessed type int button_something_0[]; // 659C10: using guessed type int warning_amount; // 65E708: using guessed type char setting_game_paused; // 66071C: using guessed type char video_refreshRequested; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CBC: using guessed type __int16 word_6E6CBC; //----- (004DFE80) -------------------------------------------------------- void showWarning(int warningId) { signed int i; // [sp+4Ch] [bp-4h]@6 if ( setting_warnings_on && (warningId != 2 || mode_editor != 1) ) { fun_memset(byte_659EA0, 200, 0); for ( i = 0; i < 5; ++i ) { if ( !*(&warnings.inUse + 60 * i) ) { *(&warnings.inUse + 60 * i) = 1; dword_608744[i] = 0; if ( warningId == 1 ) // orientation change fun_getGameTextString(GAMETEXT_ORIENTATION, setting_map_orientation); else fun_getGameTextString(GAMETEXT_WARNING, warningId - 2); noShowWarnings = 1; *(&warnings.warningTextId + 60 * i) = warningId; *(&warnings.warningboxWidth + 60 * i) = fun_getStringWidth(gametext_result, graphic_font + F_NormalBlack); *(&warnings.textLength + 60 * i) = fun_strlen(gametext_result); if ( *(&warnings.warningboxWidth + 60 * i) > 100 ) { if ( *(&warnings.warningboxWidth + 60 * i) > 200 ) { if ( *(&warnings.warningboxWidth + 60 * i) > 300 ) *(&warnings.warningboxWidth + 60 * i) = 460; else *(&warnings.warningboxWidth + 60 * i) = 400; } else { *(&warnings.warningboxWidth + 60 * i) = 300; } } else { *(&warnings.warningboxWidth + 60 * i) = 200; } *(&warnings.time + 30 * i) = time_current; fun_memset(&warnings.text[120 * i], 100, 0); fun_strncpy(gametext_result, &warnings.text[120 * i], *(&warnings.textLength + 60 * i)); return; } } } } // 608008: using guessed type int time_current; // 659F6C: using guessed type int dword_659F6C; // 65E769: using guessed type char setting_warnings_on; // 6E6BD0: using guessed type __int16 graphic_font; // 9DA898: using guessed type int mode_editor; //----- (004E00F0) -------------------------------------------------------- void fun_clearWarnings() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 5; ++i ) { warning_middleOffset[2 * i] = (screen_width - 180) / 2; *(&warnings.middle + 60 * i) = LOWORD(warning_middleOffset[2 * i]); *(&warnings.top + 60 * i) = warning_topOffset[4 * i]; *(&warnings.inUse + 60 * i) = 0; dword_608744[i] = 0; } } // 5FF7F0: using guessed type int warning_middleOffset[]; //----- (004E01B0) -------------------------------------------------------- void fun_showWarningBuildingRoadAccess(int buildingId, int a2, int a3, int a4) { if ( mode_editor != 1 ) { if ( buildingId != B_SmallStatue ) { if ( buildingId != B_MediumStatue ) { if ( buildingId != B_LargeStatue ) { if ( buildingId != B_Fountain ) { if ( buildingId != B_Well ) { if ( buildingId != B_Reservoir ) { if ( buildingId != B_FortGround__ ) { if ( buildingId != B_Gatehouse ) { if ( buildingId != B_TriumphalArch ) { if ( buildingId != B_HouseVacantLot ) { if ( buildingId != B_FortGround__ ) { if ( buildingId != B_FortLegionaries ) { if ( buildingId != B_FortJavelin ) { if ( buildingId != B_FortMounted ) { if ( !determineAccessRoad(a2, a3, a4) ) { if ( buildingId != B_Warehouse || !determineAccessRoad(a2, a3, 3) ) { if ( buildingId != B_Hippodrome || !sub_4898D0(a2, a3) ) { if ( dword_659B4C < 3 ) showWarning(11);// building needs road access } } } } } } } } } } } } } } } } } } } void fun_showWarningNoWaterInReservoir(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Reservoir ) { if ( numWorkingReservoirs ) showWarning(40); // next to water else showWarning(39); // connected to full reservoir } } } } void showWarningNoWorkers(int buildingType) { if ( mode_editor == 1 ) return; if ( buildingType == B_Well ) return; if ( !noShowWarnings ) return; if ( model_buildings[buildingType].laborers > 0 ) { if ( city_inform[ciid].numWorkersNeeded >= 10 ) showWarning(warnMesNoWorkers); } } void showWarningNoMarkets(int buildingType) { if( mode_editor == 1 ) return; if( !noShowWarnings ) return; if ( buildingType == B_Granary ) { if ( numWorkingMarkets <= 0 ) showWarning(warnMesNoMarkets); } } void showWarningNoActors(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Theater ) { if ( numWorkingActorColonies <= 0 ) showWarning(warnMesNoActors); } } } } void fun_showWarningNoGladiators(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Amphitheater ) { if ( numWorkingGladiatorSchools <= 0 ) showWarning(45); } } } } // 659F6C: using guessed type int dword_659F6C; // 9DA898: using guessed type int mode_editor; //----- (004E0520) -------------------------------------------------------- void fun_showWarningNoLions(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Colosseum ) { if ( numWorkingLionHouses <= 0 ) showWarning(46); } } } } // 659F6C: using guessed type int dword_659F6C; // 94A31C: using guessed type int numWorkingLionHouses; // 9DA898: using guessed type int mode_editor; //----- (004E0580) -------------------------------------------------------- void fun_showWarningNoChariots(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Hippodrome ) { if ( numWorkingChariotMakers <= 0 ) showWarning(47); } } } } // 659F6C: using guessed type int dword_659F6C; // 98BED0: using guessed type int numWorkingChariotMakers; // 9DA898: using guessed type int mode_editor; //----- (004E05E0) -------------------------------------------------------- void fun_showWarningNoBarracks(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_FortLegionaries || buildingId == B_FortJavelin || buildingId == B_FortMounted ) { if ( numWorkingBarracks <= 0 ) showWarning(42); } } } } void fun_showWarningNoWeapons(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Barracks ) { if ( city_inform[ciid].stock_weapons <= 0 ) showWarning(43); } } } } void fun_showWarningNoWall(int buildingId, int x, int y, int a4) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Tower ) { if ( !fun_isAdjacentToWall(x, y, a4) ) showWarning(41); // must be next to wall to send out sentry } } } } // 401352: using guessed type _DWORD fun_isAdjacentToWall(_DWORD, _DWORD, _DWORD); // 659F6C: using guessed type int dword_659F6C; // 9DA898: using guessed type int mode_editor; //----- (004E0730) -------------------------------------------------------- void fun_showWarningNoWaterAccess(int buildingId, int x, int y) { __int16 v3; // ax@8 __int16 v4; // dx@11 __int16 v5; // cx@13 __int16 v6; // ax@15 int v7; // [sp+4Ch] [bp-4h]@8 if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_Fountain || buildingId == B_Bathhouse ) { v7 = 162 * y + x + setting_map_startGridOffset; v3 = grid_terrain[162 * y + x + setting_map_startGridOffset]; if ( !(v3 & 0x80) ) { if ( buildingId != B_Bathhouse || (v4 = grid_terrain_xPlusOne_y[v7], !(v4 & 0x80)) && (v5 = grid_terrain_x_yPlusOne[v7], !(v5 & 0x80)) && (v6 = grid_terrain_xPlusOne_yPlusOne[v7], !(v6 & 0x80)) ) showWarning(38); } } } } } void fun_showWarningMoreFoodNeeded(int buildingId) { if ( mode_editor != 1 ) { if ( !noShowWarnings ) { if ( buildingId == B_HouseVacantLot ) { if ( city_inform[ciid].population >= 200 ) { if ( !scn_romeSuppliesWheat ) { if ( getPercentage( city_inform[ciid].plebsFoodInCityLastYear, city_inform[ciid].dword_654500 ) <= 95 ) showWarning(18); } } } } } } void fun_showWarningNoIron(int a1) { if ( mode_editor != 1 ) { if ( a1 == B_WeaponsWorkshop ) { if ( numWorkingIronMines <= 0 ) { if ( city_inform[ciid].stock_weapons <= 0 ) { if ( city_inform[ciid].stock_iron <= 0 ) { showWarning(26); if ( cityCanProduceGoodNow(G_Iron) ) { showWarning(33); } else { if ( fun_tradeCanBuyGoodNow(G_Iron) ) { if ( city_inform[ciid].resourceTradeStatus_iron != 1 ) showWarning(32); } else { showWarning(31); } } } } } } } } // 65285C: using guessed type __int16 cityinfo_stock_iron[]; // 652864: using guessed type __int16 cityinfo_stock_weapons[]; // 65287C: using guessed type __int16 cityinfo_resourceTradeStatus_iron[]; // 98BFE4: using guessed type int numWorkingIronMines; // 9DA898: using guessed type int mode_editor; //----- (004E0A10) -------------------------------------------------------- void fun_showWarningNoVines(int buildingId) { if ( mode_editor != 1 ) { if ( buildingId == B_WineWorkshop ) { if ( numWorkingVinesFarms <= 0 ) { if ( city_inform[ciid].stock_wine <= 0 ) { if ( city_inform[ciid].stock_vines <= 0 ) { showWarning(27); if ( cityCanProduceGoodNow(G_Vines) ) { showWarning(34); } else { if ( fun_tradeCanBuyGoodNow(G_Vines) ) { if ( city_inform[ciid].resourceTradeStatus_vines != 1 ) showWarning(32); } else { showWarning(31); } } } } } } } } void fun_showWarningNoOlives(int buildingId) { if ( mode_editor != 1 ) { if ( buildingId == B_OilWorkshop ) { if ( numWorkingOliveFarms <= 0 ) { if ( city_inform[ciid].stock_oil <= 0 ) { if ( city_inform[ciid].stock_olives <= 0 ) { showWarning(28); if ( cityCanProduceGoodNow(G_Olives) ) { showWarning(35); } else { if ( fun_tradeCanBuyGoodNow(G_Olives) ) { if ( city_inform[ciid].resourceTradeStatus_olives != 1 ) showWarning(32); } else { showWarning(31); } } } } } } } } void fun_showWarningNoTimber(int buildingId) { if ( mode_editor != 1 ) { if ( buildingId == B_FurnitureWorkshop ) { if ( numWorkingTimberYards <= 0 ) { if ( city_inform[ciid].stock_furniture <= 0 ) { if ( city_inform[ciid].stock_timber <= 0 ) { showWarning(30); if ( cityCanProduceGoodNow(G_Timber) ) { showWarning(37); } else { if ( fun_tradeCanBuyGoodNow(G_Timber) ) { if ( city_inform[ciid].resourceTradeStatus_timber != 1 ) showWarning(32); } else { showWarning(31); } } } } } } } } void fun_showWarningNoClay(int buildingId) { if ( mode_editor != 1 ) { if ( buildingId == B_PotteryWorkshop ) { if ( numWorkingClayPits <= 0 ) { if ( city_inform[ciid].stock_pottery <= 0 ) { if ( city_inform[ciid].stock_clay <= 0 ) { showWarning(29); // building needs clay if ( cityCanProduceGoodNow(G_Clay) ) { showWarning(36); // build a clay pit } else { if ( fun_tradeCanBuyGoodNow(G_Clay) ) { if ( city_inform[ciid].resourceTradeStatus_clay != 1 ) showWarning(32); // instruct trade advisor to import } else { showWarning(31); // set up a trade route to import } } } } } } } } void fun_clearCityInfo() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 fun_memset(&cityinfo_start__, 36136, 0); sub_4E1250(); for ( i = 0; i <= 1; ++i ) relatedToCityInfoAlwaysZero[i] = 0; for ( j = 1; j <= 1; ++j ) { city_inform[j].hapinessCity = 60; city_inform[j].calculatedTargetHealthRate = 50; city_inform[j].healthRate = 50; city_inform[j].dword_6500C0_always3or0 = 3; city_inform[j].wagesRome = 30; city_inform[j].wages = 30; city_inform[j].taxrate = 7; city_inform[j].dword_654220 = 1; city_inform[j].dword_654224 = 1; city_inform[j].populationPerMonthGraph_nextIndex = 0; city_inform[j].monthsSinceStart[0] = 0; city_inform[j].monthsSinceFestival = 1; city_inform[j].festivalSize = 1; city_inform[j].modestGiftCost = 0; city_inform[j].generousGiftCost = 0; city_inform[j].lavishGiftCost = 0; } fun_clearCityInfoGods(); } void fun_calculateGiftCosts() { city_inform[ciid].modestGiftCost = city_inform[ciid].personalSavings / 8 + 20; city_inform[ciid].generousGiftCost = city_inform[ciid].personalSavings / 4 + 50; city_inform[ciid].lavishGiftCost = city_inform[ciid].personalSavings / 2 + 100; } void fun_clearMissionSettings() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 0; i < 100; ++i ) setting_personalSavingsPerMission[i] = 0; startingFavor = difficulty_startingFavor[setting_difficulty]; setting_personalSavings_lastMission = 0; setting_currentMissionId = 0; savedgame_missionId = 0; } void sub_4E1200() { signed int i; // [sp+4Ch] [bp-4h]@1 dword_650004[0] = 0; for ( i = 1; i <= 1; ++i ) ; } void sub_4E1250() { signed int i; // [sp+4Ch] [bp-4h]@1 dword_650004[0] = 0; for ( i = 1; i <= 1; ++i ) { if ( city_inform[ciid].byte_6500A3_always1 ) ++dword_650004[0]; } } /*void unused_4E12C0(int ciid) { fun_memset((char *)&cityinfo_start__ + 18068 * ciid, 18068, 0); sub_4E1250(); }*/ void sub_4E1300() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= 1; ++i ) { if ( city_inform[ciid].word_652828 > 0 ) --city_inform[ciid].word_652828; } } void fun_calculateHealthRate() { int v0; // [sp+4Ch] [bp-18h]@1 signed int v1; // [sp+50h] [bp-14h]@1 int v2; // [sp+54h] [bp-10h]@45 int v3; // [sp+54h] [bp-10h]@47 int v4; // [sp+58h] [bp-Ch]@41 int v5; // [sp+5Ch] [bp-8h]@41 signed int i; // [sp+60h] [bp-4h]@6 int j; // [sp+60h] [bp-4h]@52 int k; // [sp+60h] [bp-4h]@66 int l; // [sp+60h] [bp-4h]@80 v1 = 0; v0 = 0; if ( city_inform[ciid].population >= 200 ) { if ( setting_currentMissionId >= 2 || setting_isCustomScenario ) { for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { if (buildings[i].house_population ) { v1 +=buildings[i].house_population; if ( buildings[i].level_resourceId > 1 ) { if ( buildings[i].house_clinic ) { if ( buildings[i].byte_94BDB8 > 0 ) v0 +=buildings[i].house_population / 4; else v0 +=buildings[i].house_population; } else { if ( buildings[i].byte_94BDB8 <= 0 ) v0 +=buildings[i].house_population / 4; } } else { if ( buildings[i].house_clinic ) v0 +=buildings[i].house_population; else v0 +=buildings[i].house_population / 4; } } } } } city_inform[ciid].calculatedTargetHealthRate = getPercentage(v0, v1); if ( city_inform[ciid].healthRate >= city_inform[ciid].calculatedTargetHealthRate ) { if ( city_inform[ciid].healthRate > city_inform[ciid].calculatedTargetHealthRate ) { city_inform[ciid].healthRate -= 2; if ( city_inform[ciid].healthRate < city_inform[ciid].calculatedTargetHealthRate ) city_inform[ciid].healthRate = city_inform[ciid].calculatedTargetHealthRate; } } else { city_inform[ciid].healthRate += 2; if ( city_inform[ciid].healthRate > city_inform[ciid].calculatedTargetHealthRate ) city_inform[ciid].healthRate = city_inform[ciid].calculatedTargetHealthRate; } if ( city_inform[ciid].healthRate > 100 ) city_inform[ciid].healthRate = 100; if ( city_inform[ciid].healthRate < 0 ) city_inform[ciid].healthRate = 0; if ( city_inform[ciid].healthRate < 40 ) { v5 = 40 - city_inform[ciid].healthRate; v4 = random_7f_1 & 0x3F; if ( city_inform[ciid].dword_6544E8 ) v4 = 0; city_inform[ciid].dword_6544E8 = 0; if ( v4 <= v5 ) { v2 = fun_adjustWithPercentage(v1, (random_7f_1 & 3) + 7); if ( v2 > 0 ) { v3 = v2 - city_inform[ciid].numHospitalWorkers; fun_changeHealthRate(10); message_usePopup = 1; if ( v3 > 0 ) { if ( city_inform[ciid].numHospitalWorkers > 0 ) fun_postMessageToPlayer(103, 0, 0); else fun_postMessageToPlayer(104, 0, 0); tutorial2_disease = 1; for ( j = 1; j < MAX_BUILDINGS; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].house_size ) { if ( buildings[j].house_population ) { if ( !buildings[j].house_clinic ) { v3 -= buildings[j].house_population; sub_46E3D0(j, 1); if ( v3 <= 0 ) return; } } } } } for ( k = 1; k < MAX_BUILDINGS; ++k ) { if ( buildings[k].inUse == 1 ) { if ( buildings[k].house_size ) { if ( buildings[k].house_population ) { if ( buildings[k].level_resourceId <= 1 ) { v3 -= buildings[k].house_population; sub_46E3D0(k, 1); if ( v3 <= 0 ) return; } } } } } for ( l = 1; ; ++l ) { if ( l < 2000 ) { if ( buildings[l].inUse != 1 ) continue; if ( !buildings[l].house_size ) continue; if ( !buildings[l].house_population ) continue; v3 -= buildings[l].house_population; sub_46E3D0(l, 1); if ( v3 > 0 ) continue; } break; } } else { fun_postMessageToPlayer(102, 0, 0); } } } } } else { city_inform[ciid].healthRate = 50; city_inform[ciid].calculatedTargetHealthRate = 50; } } else { city_inform[ciid].healthRate = 50; city_inform[ciid].calculatedTargetHealthRate = 50; } } void fun_changeHealthRate(int amount) { city_inform[ciid].healthRate += amount; if ( city_inform[ciid].healthRate > 100 ) city_inform[ciid].healthRate = 100; if ( city_inform[ciid].healthRate < 0 ) city_inform[ciid].healthRate = 0; } void fun_resetPopulationMax() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= 1; ++i ) { if ( city_inform[ciid].byte_6500A2_always1 ) { city_inform[ciid].populationRoomForMax = 0; city_inform[ciid].populationCanImmigrate = 0; } } } void fun_gametick_requestBirthsDeaths_calculateHousingTypes() { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i <= 1; ++i ) city_inform[i].populationYearlyBirthsDeathsCalculationNeeded = 1; fun_calculatePeopleInHousingTypes(ciid); } void fun_populationAdvanceAgesOneYear() { int numPeople; // eax@6 int numDeaths; // ST60_4@6 int peopleRemoved; // ST58_4@6 int centennials; // [sp+50h] [bp-Ch]@1 signed int i; // [sp+58h] [bp-4h]@1 int j; // [sp+58h] [bp-4h]@4 centennials = city_inform[ciid].censusGraph_peopleAged100; for ( i = 99; i > 0; --i ) city_inform[ciid].censusGraph[i] = city_inform[ciid].monthsSinceStart[i+1]; city_inform[ciid].censusGraph[0] = 0; city_inform[ciid].deaths = 0; for ( j = 9; j >= 0; --j ) { numPeople = fun_getPeopleInAgeDecennium(ciid, j); numDeaths = fun_adjustWithPercentage( numPeople, *(int *)((char *)&deathPercentagePerHealthRatePerAgeDecennium[10 * city_inform[ciid].healthRate / 10] + 4 * j)); peopleRemoved = fun_removePeopleFromCity(ciid, numDeaths + centennials); fun_removePeopleFromCensusInDecennium(ciid, j, peopleRemoved);// ghost bug found: kill aged 100, but don't remove them from the census city_inform[ciid].deaths += peopleRemoved; centennials = 0; } } void fun_populationBirths() { int numPeople; // eax@3 int numBirths; // eax@3 int newbornsAdded; // eax@3 int dec; // [sp+58h] [bp-4h]@1 city_inform[ciid].births = 0; for ( dec = 9; dec >= 0; --dec ) { numPeople = fun_getPeopleInAgeDecennium(ciid, dec); numBirths = fun_adjustWithPercentage(numPeople, birthPercentagePerAgeDecennium[dec]); newbornsAdded = fun_addBirthsToHouses(ciid, numBirths); city_inform[ciid].censusGraph[0] += newbornsAdded; city_inform[ciid].births += newbornsAdded; } } void fun_dispatchRequestedTroops(int amount) { int v1; // ST54_4@1 signed int i; // [sp+50h] [bp-4h]@1 v1 = fun_removePeopleFromCity(ciid, amount); fun_removePeopleFromCensus(ciid, v1); city_inform[ciid].dword_6543EC += v1; city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population += city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; } void fun_updatePopulationAfterBirthsDeaths(int ciid) { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].populationYearlyBirthsDeathsCalculationNeeded = 0; city_inform[ciid].previousPopulation = city_inform[ciid].population; city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population += city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; city_inform[ciid].dword_652784 = 0; city_inform[ciid].population_totalPopPerYear += city_inform[ciid].population; ++city_inform[ciid].population_totalYears; city_inform[ciid].population_averagePopPerYear = city_inform[ciid].population_totalPopPerYear / city_inform[ciid].population_totalYears; } void unused_4E2380(int numPeopleToRemove) { int numPeopleRemoved; // ST54_4@1 signed int i; // [sp+50h] [bp-4h]@1 numPeopleRemoved = fun_removePeopleFromCity(ciid, numPeopleToRemove); fun_removePeopleFromCensus(ciid, numPeopleRemoved); city_inform[ciid].deaths += numPeopleRemoved; city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population += city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; } int fun_calculateCityHappinessAndCrime() { int result; // eax@98 int totalPop; // [sp+4Ch] [bp-44h]@1 signed int i; // [sp+54h] [bp-3Ch]@27 signed int j; // [sp+54h] [bp-3Ch]@64 signed int v4; // [sp+58h] [bp-38h]@25 signed int diffWages; // [sp+5Ch] [bp-34h]@3 int v6; // [sp+60h] [bp-30h]@88 signed int numberHouse; // [sp+64h] [bp-2Ch]@64 signed int crimeRiskSum; // [sp+68h] [bp-28h]@64 int v9; // [sp+6Ch] [bp-24h]@3 signed int v10; // [sp+70h] [bp-20h]@27 signed int v11; // [sp+74h] [bp-1Ch]@27 int v12; // [sp+78h] [bp-18h]@3 signed int v13; // [sp+7Ch] [bp-14h]@27 signed int v14; // [sp+80h] [bp-10h]@27 int hpWagesInfluence; // [sp+84h] [bp-Ch]@3 bool hpUnemploymentInfluence; // [sp+88h] [bp-8h]@16 int hpTaxInfluence; // [sp+8Ch] [bp-4h]@3 totalPop = fun_calculatePeopleInHousingTypes(ciid); if ( totalPop < city_inform[ciid].population ) fun_removePeopleFromCensus(ciid, city_inform[ciid].population - totalPop); v9 = 0; v12 = 0; hpWagesInfluence = 0; hpTaxInfluence = taxrate_happiness_factor[city_inform[ciid].taxrate]; diffWages = city_inform[ciid].wages - city_inform[ciid].wagesRome; if ( diffWages < 0 ) { hpWagesInfluence = diffWages / 2; if ( !(diffWages / 2) ) hpWagesInfluence = -1; } else { if ( diffWages <= 7 ) { if ( diffWages <= 4 ) { if ( diffWages <= 1 ) { if ( diffWages > 0 ) hpWagesInfluence = 1; } else { hpWagesInfluence = 2; } } else { hpWagesInfluence = 3; } } else { hpWagesInfluence = 4; } } city_inform[ciid].dword_654558 = city_inform[ciid].wages; if ( city_inform[ciid].unemploymentPercentage <= 25 ) { if ( city_inform[ciid].unemploymentPercentage <= 17 ) { if ( city_inform[ciid].unemploymentPercentage <= 10 ) hpUnemploymentInfluence = city_inform[ciid].unemploymentPercentage < 5; else hpUnemploymentInfluence = -1; } else { hpUnemploymentInfluence = -2; } } else { hpUnemploymentInfluence = -3; } city_inform[ciid].dword_654458 = city_inform[ciid].unemploymentPercentage; if ( city_inform[ciid].byte_6545AB ) { v4 = sub_4E3140(); city_inform[ciid].byte_6545AB = 0; } else { v4 = 0; city_inform[ciid].byte_6545AB = 1; } v13 = 0; v10 = 0; v14 = 0; v11 = 0; for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size > 0 ) { if (buildings[i].house_population ) { if ( city_inform[ciid].population >= 300 ) { buildings[i].house_crimeRisk += hpTaxInfluence; buildings[i].house_crimeRisk += hpWagesInfluence; buildings[i].house_crimeRisk += hpUnemploymentInfluence; ++v10; v12 = 0; v9 = 0; if( model_houses[buildings[i].level_resourceId].foodtypes > 0 ) { ++v13; if ( HIBYTE(buildings[i].word_94BDAC) < 2 ) { if ( HIBYTE(buildings[i].word_94BDAC) <= 0 ) { ++buildings[i].byte_94BDB8; if ( buildings[i].byte_94BDB8 > 3 ) buildings[i].byte_94BDB8 = 3; if ( buildings[i].byte_94BDB8 < 3 ) { if ( buildings[i].byte_94BDB8 < 2 ) { v12 = -1; --v14; } else { v12 = -2; v14 -= 2; } } else { v12 = -3; v14 -= 3; } } else { v12 = 1; ++v14; buildings[i].byte_94BDB8 = 0; } } else { v12 = 2; v14 += 2; buildings[i].byte_94BDB8 = 0; } } else { buildings[i].byte_94BDB8 = 0; v9 = v4; v11 += v4; } buildings[i].house_crimeRisk += v12; buildings[i].house_crimeRisk += v9; if ( buildings[i].house_crimeRisk < 0 ) buildings[i].house_crimeRisk = 0; if ( buildings[i].house_crimeRisk > 100 ) buildings[i].house_crimeRisk = 100; } else { v12 = 0; hpUnemploymentInfluence = 0; hpTaxInfluence = 0; hpWagesInfluence = 0; v9 = 0; if ( city_inform[ciid].population >= 200 ) buildings[i].house_crimeRisk = LOBYTE(difficulty_happiness[setting_difficulty]); else buildings[i].house_crimeRisk = LOBYTE(difficulty_happiness[setting_difficulty]) + 10; } } else { buildings[i].house_crimeRisk = LOBYTE(difficulty_happiness[setting_difficulty]) + 10; } } } } if ( v13 ) v12 = v14 / v13; if ( v10 ) v9 = v11 / v10; crimeRiskSum = 0; numberHouse = 0; for ( j = 1; j < 2000; ++j ) { if ( buildings[j].inUse == 1 ) { if ( buildings[j].house_size > 0 ) { if ( buildings[j].house_population > 0 ) { ++numberHouse; crimeRiskSum += buildings[j].house_crimeRisk; } } } } if ( numberHouse ) city_inform[ciid].hapinessCity = crimeRiskSum / numberHouse; else city_inform[ciid].hapinessCity = 60; if ( city_inform[ciid].dword_654460 ) --city_inform[ciid].dword_654460; city_inform[ciid].dword_654464 = 0; if ( city_inform[ciid].hapinessCity < 48 ) { if ( city_inform[ciid].dword_65445C > city_inform[ciid].hapinessCity ) { if ( city_inform[ciid].dword_654460 <= 0 ) { city_inform[ciid].dword_654460 = 3; if ( city_inform[ciid].hapinessCity >= 35 ) { if ( city_inform[ciid].hapinessCity >= 40 ) { if ( city_inform[ciid].hapinessCity < 48 ) fun_postMessageToPlayer(46, 0, 0); } else { fun_postMessageToPlayer(47, 0, 0); } } else { fun_postMessageToPlayer(48, 0, 0); } } } } v6 = 0; if ( v12 < 0 ) { v6 = v12; city_inform[ciid].dword_654464 = 1; } if ( hpUnemploymentInfluence < v6 ) { v6 = hpUnemploymentInfluence; city_inform[ciid].dword_654464 = 2; } if ( hpTaxInfluence < v6 ) { v6 = hpTaxInfluence; city_inform[ciid].dword_654464 = 3; } if ( hpWagesInfluence < v6 ) { v6 = hpWagesInfluence; city_inform[ciid].dword_654464 = 4; } if ( v9 < v6 ) city_inform[ciid].dword_654464 = 5; result = ciid; city_inform[ciid].dword_65445C = city_inform[ciid].hapinessCity; return result; } void fun_decreaseCrimeRisk(char amount) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { buildings[i].house_crimeRisk += amount; if ( buildings[i].house_crimeRisk < 0 ) buildings[i].house_crimeRisk = 0; if ( buildings[i].house_crimeRisk > 100 ) buildings[i].house_crimeRisk = 100; } } } } void fun_setCrimeRiskForAllHouses(signed int targetCrimeRisk) { signed int i; // [sp+4Ch] [bp-4h]@1 for ( i = 1; i < 2000; ++i ) { if ( buildings[i].inUse == 1 ) { if ( buildings[i].house_size ) { if ( buildings[i].house_crimeRisk > targetCrimeRisk ) buildings[i].house_crimeRisk = targetCrimeRisk; if ( buildings[i].house_crimeRisk < 0 ) buildings[i].house_crimeRisk = 0; if ( buildings[i].house_crimeRisk > 100 ) buildings[i].house_crimeRisk = 100; } } } } //----- (004E3140) -------------------------------------------------------- signed int sub_4E3140() { signed int result; // eax@3 int pctTent; // [sp+4Ch] [bp-4h]@1 pctTent = getPercentage(city_inform[ciid].peopleInTents, city_inform[ciid].population); if ( city_inform[ciid].peopleInVillasAndPalaces <= 0 ) { if ( city_inform[ciid].peopleInLargeInsulaAndAbove <= 0 ) { if ( pctTent < 40 ) { if ( pctTent < 26 ) { if ( pctTent < 10 ) result = -3; else result = -2; } else { result = -1; } } else { result = 0; } } else // has people in large insula & up { if ( pctTent <= 56 ) { if ( pctTent < 40 ) { if ( pctTent < 26 ) { if ( pctTent < 10 ) result = -5; else result = -4; } else { result = -3; } } else { result = -2; } } else { result = 0; } } } else // has villas and palaces { if ( pctTent <= 56 ) { if ( pctTent < 40 ) { if ( pctTent < 26 ) { if ( pctTent < 10 ) result = -6; else result = -5; } else { result = -4; } } else { result = -3; } } else { result = 0; } } return result; } // 6500C4: using guessed type int cityinfo_population[]; // 6527AC: using guessed type int cityinfo_peopleInVillasAndPalaces[]; // 65455C: using guessed type int cityinfo_peopleInTents[]; // 654560: using guessed type int cityinfo_peopleInLargeInsulaAndAbove[]; //----- (004E3290) -------------------------------------------------------- void fun_determineHappinessEmigrationImmigration(int ciid) { int populationCap; // [sp+4Ch] [bp-4h]@14 if ( city_inform[ciid].hapinessCity <= 70 ) { if ( city_inform[ciid].hapinessCity <= 60 ) { if ( city_inform[ciid].hapinessCity < 50 ) { if ( city_inform[ciid].hapinessCity <= 40 ) { if ( city_inform[ciid].hapinessCity <= 30 ) { if ( city_inform[ciid].hapinessCity <= 20 ) city_inform[ciid].immigrationPercentageBasedOnHappiness = -50; else city_inform[ciid].immigrationPercentageBasedOnHappiness = -25; } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = -10; } } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = 0; } } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = 50; } } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = 75; } } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = 100; } city_inform[ciid].happiness_emigrationValue = 0; city_inform[ciid].happiness_immigrationAmount = 0; populationCap = 200000; if ( setting_currentMissionId || setting_isCustomScenario ) { if ( setting_currentMissionId == 1 ) { if ( !setting_isCustomScenario ) { if ( tutorial2_granaryBuilt ) { if ( !tutorial2_potteryMade ) populationCap = 520; } else { populationCap = 150; } } } } else { if ( tutorial1_fire ) { if ( tutorial1_prefectureBuilt ) { if ( !tutorial1_senateEngineerBuilt ) populationCap = 80; } else { populationCap = 80; } } else { populationCap = 80; } } if ( city_inform[::ciid].population < populationCap ) { if ( city_inform[::ciid].enemyDestroyedBuildings + city_inform[::ciid].imperialArmyComing <= 3 || city_inform[ciid].immigrationPercentageBasedOnHappiness <= 0 ) { if ( city_inform[ciid].immigrationPercentageBasedOnHappiness <= 0 ) { if ( city_inform[ciid].immigrationPercentageBasedOnHappiness < 0 ) { if ( city_inform[ciid].happiness_immigrationDuration ) { --city_inform[ciid].happiness_immigrationDuration; } else { if ( city_inform[ciid].population > 100 ) { city_inform[ciid].happiness_emigrationValue = fun_adjustWithPercentage( 12, -city_inform[ciid].immigrationPercentageBasedOnHappiness); city_inform[ciid].happiness_emigrationDuration = 2; } } } } else { if ( city_inform[ciid].happiness_emigrationDuration ) { --city_inform[ciid].happiness_emigrationDuration; } else { city_inform[ciid].happiness_immigrationAmount = fun_adjustWithPercentage( 12, city_inform[ciid].immigrationPercentageBasedOnHappiness); city_inform[ciid].happiness_immigrationDuration = 2; } } } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = 0; } } else { city_inform[ciid].immigrationPercentageBasedOnHappiness = 0; } } void fun_addPeopleToCityAndCensus(int ciid, int numPeople) { signed int i; // [sp+4Ch] [bp-4h]@5 city_inform[ciid].lastMigrationSize = numPeople; if ( numPeople >= 0 ) { if ( numPeople > 0 ) fun_addPeopleToCensus(ciid, numPeople); } else { fun_removePeopleFromCensus(ciid, -numPeople); } city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population += city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; } void sub_4E3800(int ciid, int a2) { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].dword_652784 += a2; fun_removePeopleFromCensus(ciid, a2); city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population += city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; } void sub_4E3920(int ciid, int a2) { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].x_cityinfo_dword_652798 -= a2; fun_addPeopleToCensus(ciid, a2); city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population +=city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; } void sub_4E3A40(int ciid, int numPeople) { signed int i; // [sp+4Ch] [bp-4h]@1 city_inform[ciid].x_cityinfo_dword_652798 += numPeople; fun_removePeopleFromCensus(ciid, numPeople); city_inform[ciid].population = 0; for ( i = 0; i < 100; ++i ) city_inform[ciid].population += city_inform[ciid].censusGraph[i]; if ( city_inform[ciid].population > city_inform[ciid].maxPopulationEver ) city_inform[ciid].maxPopulationEver = city_inform[ciid].population; } int fun_getPeopleInAgeDecennium(int ciid, int decennium) { int people; // [sp+4Ch] [bp-8h]@1 signed int i; // [sp+50h] [bp-4h]@1 people = 0; for ( i = 0; i < 10; ++i ) people += city_inform[ciid].censusGraph[ i + 10 * decennium ]; return people; } //----- (004E3BD0) -------------------------------------------------------- void unused_4E3BD0(int a1, int a2, int a3) { signed int v3; // [sp+4Ch] [bp-4h]@1 v3 = 0; while ( a3 ) { ++city_inform[a1].censusGraph[v3 + 10 * a2]; --a3; ++v3; if ( v3 >= 10 ) v3 = 0; } } //----- (004E3C70) -------------------------------------------------------- void fun_removePeopleFromCensusInDecennium(int ciid, int ageDecennium, int peopleRemoved) { signed int agesEmpty; // [sp+4Ch] [bp-8h]@1 signed int age; // [sp+50h] [bp-4h]@1 age = 0; agesEmpty = 0; do { if ( !peopleRemoved ) break; if ( city_inform[ciid].censusGraph[age + 10 * ageDecennium] <= 0 ) { ++agesEmpty; } else { --city_inform[ciid].censusGraph[age + 10 * ageDecennium]; --peopleRemoved; agesEmpty = 0; } ++age; if ( age >= 10 ) age = 0; } while ( agesEmpty < 10 ); } //----- (004E3D60) -------------------------------------------------------- void fun_removePeopleFromCensus(int ciid, int numPeople) { signed int consecutiveEmptyAges; // [sp+4Ch] [bp-Ch]@1 signed int consecutiveEmptyAges2; // [sp+4Ch] [bp-Ch]@11 signed int randomIndex; // [sp+50h] [bp-8h]@1 int age; // [sp+54h] [bp-4h]@3 signed int ageGroup; // [sp+54h] [bp-4h]@11 consecutiveEmptyAges = 0; randomIndex = random_poolIndex; do { if ( !numPeople ) break; age = random_pool[randomIndex] & 0x3F; // remove people from random age groups if ( city_inform[ciid].censusGraph[age] <= 0 ) { ++consecutiveEmptyAges; } else { --city_inform[ciid].censusGraph[age]; --numPeople; consecutiveEmptyAges = 0; } ++randomIndex; if ( randomIndex >= 100 ) randomIndex = 0; } while ( consecutiveEmptyAges < 100 ); consecutiveEmptyAges2 = 0; ageGroup = 10; do // random didn't work, just kill from age 10 upwards { if ( !numPeople ) break; if ( city_inform[ciid].censusGraph[ageGroup] <= 0 ) { ++consecutiveEmptyAges2; } else { --city_inform[ciid].censusGraph[ageGroup]; --numPeople; consecutiveEmptyAges2 = 0; } ++ageGroup; if ( ageGroup >= 100 ) ageGroup = 0; } while ( consecutiveEmptyAges2 < 100 ); } // 7E2798: using guessed type int random_poolIndex; //----- (004E3F20) -------------------------------------------------------- int fun_addPeopleToCensus(int ciid, int numPeople) { int result; // eax@1 bool v3; // [sp+4Ch] [bp-Ch]@1 signed int v4; // [sp+50h] [bp-8h]@1 int v5; // [sp+54h] [bp-4h]@3 v3 = 0; result = random_poolIndex; v4 = random_poolIndex; while ( numPeople ) { v5 = random_pool[v4] & 0x3F; if ( v5 <= 50 ) { if ( v5 < 10 ) { if ( v3 ) v5 += 20; } } else { v5 -= 30; } ++city_inform[ciid].censusGraph[v5]; --numPeople; result = v4++ + 1; if ( v4 >= 100 ) v4 = 0; v3 = v3 != 1; } return result; } int fun_getNumPeopleOfWorkingAge() { int twenties; // ST54_4@1 int twentiesThirties; // ST54_4@1 twenties = fun_getPeopleInAgeDecennium(ciid, 2); twentiesThirties = fun_getPeopleInAgeDecennium(ciid, 3) + twenties; return fun_getPeopleInAgeDecennium(ciid, 4) + twentiesThirties; } int fun_getNumberOfSchoolAgeChildren(int ciid) { int pop; // [sp+4Ch] [bp-8h]@1 signed int age; // [sp+50h] [bp-4h]@1 age = 0; pop = 0; while ( age < 14 ) pop += city_inform[ciid].censusGraph[age++]; return pop; } int fun_getNumberOfAcademyAgeChildren(int ciid) { int total; // [sp+4Ch] [bp-8h]@1 signed int age; // [sp+50h] [bp-4h]@1 age = 14; total = 0; while ( age < 21 ) total += city_inform[ciid].censusGraph[age++]; return total; } void fun_calculateCultureDemandLevel() { int healthMax; // [sp+4Ch] [bp-4h]@12 int religionMax; // [sp+4Ch] [bp-4h]@31 switch ( city_inform[ciid].dword_654464 ) { case 1: city_inform[ciid].immigrationState = 2; break; case 2: city_inform[ciid].immigrationState = 1; break; case 3: city_inform[ciid].immigrationState = 3; break; case 4: city_inform[ciid].immigrationState = 0; break; case 5: city_inform[ciid].immigrationState = 4; break; default: city_inform[ciid].immigrationState = 5; break; } city_inform[ciid].healthDemand = 0; healthMax = 0; if ( city_inform[ciid].evolveBathhouseRequired > 0 ) { city_inform[ciid].healthDemand = 1; healthMax = city_inform[ciid].evolveBathhouseRequired; } if ( city_inform[ciid].evolveBarberRequired > healthMax ) { city_inform[ciid].healthDemand = 2; healthMax = city_inform[ciid].evolveBarberRequired; } if ( city_inform[ciid].evolveClinicRequired > healthMax ) { city_inform[ciid].healthDemand = 3; healthMax = city_inform[ciid].evolveClinicRequired; } if ( city_inform[ciid].evolveHospitalRequired > healthMax ) city_inform[ciid].healthDemand = 4; city_inform[ciid].educationDemand = 0; if ( city_inform[ciid].evolveMoreEducationRequired <= city_inform[ciid].evolveEducationRequired ) { if ( city_inform[ciid].evolveMoreEducationRequired >= city_inform[ciid].evolveEducationRequired ) { if ( city_inform[ciid].evolveMoreEducationRequired || city_inform[ciid].evolveEducationRequired ) city_inform[ciid].educationDemand = 3; } else { city_inform[ciid].educationDemand = 2; } } else { city_inform[ciid].educationDemand = 1; } city_inform[ciid].entertainmentDemand = 0; if ( city_inform[ciid].evolveEntertainmentRequired <= city_inform[ciid].evolveMoreEntertainmentRequired ) { if ( city_inform[ciid].evolveMoreEntertainmentRequired ) city_inform[ciid].entertainmentDemand = 2; } else { city_inform[ciid].entertainmentDemand = 1; } city_inform[ciid].religionDemand = 0; religionMax = 0; if ( city_inform[ciid].evolveReligionRequired > 0 ) { city_inform[ciid].religionDemand = 1; religionMax = city_inform[ciid].evolveReligionRequired; } if ( city_inform[ciid].evolveMoreReligionRequired > religionMax ) { city_inform[ciid].religionDemand = 2; religionMax = city_inform[ciid].evolveMoreReligionRequired; } if ( city_inform[ciid].evolveEvenMoreReligionRequired > religionMax ) city_inform[ciid].religionDemand = 3; } void fun_setTreasuryAmount(int ciid, int amount) { if ( city_inform[ciid].byte_6500A2_always1 == 1 ) city_inform[ciid].treasury = amount; } void fun_spendMoneyConstruction(int ciid, int amount) { if ( city_inform[ciid].byte_6500A2_always1 == 1 ) { if ( mode_editor != 1 ) { city_inform[ciid].treasury -= amount; city_inform[ciid].finance_construction_thisyear += amount; } } } void fun_increaseFavorRating(int amount) { city_inform[ciid].favorRating += amount; if ( city_inform[ciid].favorRating < 0 ) city_inform[ciid].favorRating = 0; if ( city_inform[ciid].favorRating > 100 ) city_inform[ciid].favorRating = 100; } void fun_setFavorRatingMax(int max) { if ( city_inform[ciid].favorRating > max ) city_inform[ciid].favorRating = max; } void fun_recordMonthlyPopulation() { city_inform[ciid].populationPerMonthGraph[ city_inform[ciid].populationPerMonthGraph_nextIndex++ ] = city_inform[ciid].population; if ( city_inform[ciid].populationPerMonthGraph_nextIndex >= 2400 ) city_inform[ciid].populationPerMonthGraph_nextIndex = 0; ++city_inform[ciid].monthsSinceStart[0]; } int fun_getPopulationAtMonth(int maxMonths, int month) { int startMonth; // [sp+4Ch] [bp-4h]@2 int monthIndex; // [sp+5Ch] [bp+Ch]@4 if ( city_inform[ciid].monthsSinceStart[0] > maxMonths ) startMonth = city_inform[ciid].populationPerMonthGraph_nextIndex - maxMonths; else startMonth = 0; monthIndex = startMonth + ((char)-(startMonth < 0) & 2400) + month; if ( monthIndex >= 2400 ) monthIndex -= 2400; return city_inform[ciid].populationPerMonthGraph[ monthIndex ]; } void fun_drawPopulationHistoryGraph_determineMinMaxMonthYear(signed int maxMonths) { if ( city_inform[ciid].monthsSinceStart[0] > maxMonths ) { drawPopHistoryGraph_endMonth = gametime_month - 1; drawPopHistoryGraph_endYear = gametime_year; if ( drawPopHistoryGraph_endMonth < 0 ) { drawPopHistoryGraph_endMonth += 12; --drawPopHistoryGraph_endYear; } drawPopHistoryGraph_startMonth -= maxMonths % 12; drawPopHistoryGraph_startMonth += drawPopHistoryGraph_startMonth < 0 ? 12 : 0; drawPopHistoryGraph_startYear = drawPopHistoryGraph_endYear - maxMonths / 12; } else { drawPopHistoryGraph_startMonth = 0; drawPopHistoryGraph_startYear = scn_settings_startYear; drawPopHistoryGraph_endMonth = (maxMonths + drawPopHistoryGraph_startMonth) % 12; drawPopHistoryGraph_endYear = (maxMonths + drawPopHistoryGraph_startMonth) / 12 + scn_settings_startYear; } } void fun_calculateGodHappiness(int includeBlessingsAndCurses) { int v1; // eax@94 signed int v2; // [sp+4Ch] [bp-28h]@38 signed int v3; // [sp+50h] [bp-24h]@154 int god; // [sp+54h] [bp-20h]@75 signed int i; // [sp+58h] [bp-1Ch]@1 signed int j; // [sp+58h] [bp-1Ch]@24 signed int k; // [sp+58h] [bp-1Ch]@48 signed int l; // [sp+58h] [bp-1Ch]@57 signed int m; // [sp+58h] [bp-1Ch]@68 signed int n; // [sp+58h] [bp-1Ch]@89 signed int ii; // [sp+58h] [bp-1Ch]@154 int v12; // [sp+5Ch] [bp-18h]@1 signed int minTemples; // [sp+60h] [bp-14h]@1 int v14; // [sp+64h] [bp-10h]@1 int maxTemples; // [sp+68h] [bp-Ch]@1 signed int v16; // [sp+6Ch] [bp-8h]@26 int numTemples; // [sp+70h] [bp-4h]@13 maxTemples = 0; v14 = 10; minTemples = 100000; v12 = 10; city_inform[ciid].pctReligionCoverageGod[0] = pctReligionCoverageCeres; city_inform[ciid].pctReligionCoverageGod[1] = pctReligionCoverageNeptune; city_inform[ciid].pctReligionCoverageGod[2] = pctReligionCoverageMercury; city_inform[ciid].pctReligionCoverageGod[3] = pctReligionCoverageMars; city_inform[ciid].pctReligionCoverageGod[4] = pctReligionCoverageVenus; for ( i = 0; i < 5; ++i ) { if ( i ) { switch ( i ) { case 1: numTemples = numLargeTemplesNeptune + numSmallTemplesNeptune; break; case 2: numTemples = numLargeTemplesMercury + numSmallTemplesMercury; break; case 3: numTemples = numLargeTemplesMars + numSmallTemplesMars; break; case 4: numTemples = numLargeTemplesVenus + numSmallTemplesVenus; break; } } else { numTemples = numLargeTemplesCeres + numSmallTemplesCeres; } if ( numTemples >= maxTemples ) { if ( numTemples == maxTemples ) v14 = 10; else v14 = i + 1; maxTemples = numTemples; } if ( numTemples <= minTemples ) { if ( numTemples == minTemples ) v12 = 10; else v12 = i + 1; minTemples = numTemples; } } for ( j = 0; j < 5; ++j ) { v16 = city_inform[ciid].monthsSinceFestivalCeres[j]; if ( v16 > 40 ) _LOBYTE(v16) = 40; city_inform[ciid].pctReligionCoverageGod[j] += 12; city_inform[ciid].pctReligionCoverageGod[j] -= v16; } if ( v14 ) { if ( v14 < 5 ) { if ( *((_BYTE *)&city_inform[ciid].monthsSinceFestival + v14 + 3) >= 50 ) *((_BYTE *)&city_inform[ciid].monthsSinceFestival + v14 + 3) = 100; else *((_BYTE *)&city_inform[ciid].monthsSinceFestival + v14 + 3) += 50; } } if ( v12 ) { if ( v12 < 5 ) *((_BYTE *)&city_inform[ciid].monthsSinceFestival + v12 + 3) -= 25; } if ( city_inform[ciid].population >= 100 ) { if ( city_inform[ciid].population >= 200 ) { if ( city_inform[ciid].population >= 300 ) { if ( city_inform[ciid].population >= 400 ) { if ( city_inform[ciid].population >= 500 ) v2 = 0; else v2 = 10; } else { v2 = 20; } } else { v2 = 30; } } else { v2 = 40; } } else { v2 = 50; } for ( k = 0; k < 5; ++k ) { if ( city_inform[ciid].pctReligionCoverageGod[k]> 100 ) city_inform[ciid].pctReligionCoverageGod[k] = 100; if ( city_inform[ciid].pctReligionCoverageGod[k] < v2 ) city_inform[ciid].pctReligionCoverageGod[k] = v2; } if ( includeBlessingsAndCurses ) { for ( l = 0; l < 5; ++l ) { if ( city_inform[ciid].happinessGod[l] <= city_inform[ciid].pctReligionCoverageGod[l] ) { if ( city_inform[ciid].happinessGod[ l ] < city_inform[ciid].pctReligionCoverageGod[l] ) ++city_inform[ciid].happinessGod[ l ]; } else { --city_inform[ciid].happinessGod[ l ]; } if ( !setting_currentMissionId ) { if ( !setting_isCustomScenario ) { if ( city_inform[ciid].happinessGod[ l ] < 50 ) city_inform[ciid].happinessGod[ l ] = 50; } } } for ( m = 0; m < 5; ++m ) { if ( city_inform[ciid].happinessGod[ m ]> 50 ) city_inform[ciid].byte_654308[m] = 0; if ( city_inform[ciid].happinessGod[ m ] < 50 ) city_inform[ciid].byte_654303[ m] = 0; } god = random_7f_1 & 7; if ( god <= 4 ) { if ( city_inform[ciid].happinessGod[ god ] < 50 ) { if ( city_inform[ciid].happinessGod[ god ] < 40 ) { if ( city_inform[ciid].happinessGod[ god ] < 20 ) { if ( city_inform[ciid].happinessGod[ god ] < 10 ) city_inform[ciid].numBoltsGod[ god ] += 5; else city_inform[ciid].numBoltsGod[ god ] += 2; } else { ++ city_inform[ciid].numBoltsGod[ god ]; } } } else { city_inform[ciid].numBoltsGod[ god] = 0; } if ( city_inform[ciid].numBoltsGod[ god ] >= 50 ) city_inform[ciid].numBoltsGod[ god ] = 50; } if ( !game_weeks ) { for ( n = 0; n < 5; ++n ) ++city_inform[ciid].monthsSinceFestivalCeres[n]; if ( god > 4 ) { fun_determineAngriestGod(); if ( v1 ) god = city_inform[ciid].religionAngryGod - 1; } if ( setting_godsOn ) { if ( god <= 4 ) { if ( city_inform[ciid].happinessGod[ god ] < 100 || city_inform[ciid].byte_654303[ god] ) { if ( city_inform[ciid].numBoltsGod[ god ] < 20 || city_inform[ciid].byte_654308[god] || city_inform[ciid].monthsSinceFestivalCeres[ god ] <= 3 ) { if ( city_inform[ciid].numBoltsGod[ god ] >= 50 && city_inform[ciid].monthsSinceFestivalCeres[ god ] > 3 ) { if ( setting_currentMissionId < 4 && !setting_isCustomScenario ) { city_inform[ciid].byte_654308[god] = 0; return; } city_inform[ciid].numBoltsGod[ god ] = 0; city_inform[ciid].happinessGod[ god ] += 30; message_usePopup = 1; if ( god ) // large curse { switch ( god ) { case God_Neptune: if ( city_inform[ciid].numOpenSeaTradeRoutes <= 0 ) { fun_postMessageToPlayer(42, 0, 0); return; } fun_postMessageToPlayer(81, 0, 0); fun_neptuneSinkAllShips(); city_inform[ciid].seaTradeProblemDuration = 80; city_inform[ciid].dword_654620 = 1; break; case God_Mercury: fun_postMessageToPlayer(43, 0, 0); fun_removeGoodsFromStorageForMercury(1); break; case God_Mars: if ( sub_4C02C0() ) { fun_postMessageToPlayer(82, 0, 0); fun_startLocalUprisingFromMars(); } else { fun_postMessageToPlayer(44, 0, 0); } break; case God_Venus: fun_postMessageToPlayer(45, 0, 0); fun_setCrimeRiskForAllHouses(40); fun_decreaseCrimeRisk(-10); if ( city_inform[ciid].healthRate < 80 ) { if ( city_inform[ciid].healthRate < 60 ) fun_changeHealthRate(-20); else fun_changeHealthRate(-40); } else { fun_changeHealthRate(-50); } city_inform[ciid].dword_6544E8 = 1; fun_calculateCityHappinessAndCrime(); break; } } else { fun_postMessageToPlayer(41, 0, 0); ceresWitherCrops(1); } } } else { // small curse city_inform[ciid].byte_654308[god] = 1; city_inform[ciid].numBoltsGod[ god ] = 0; city_inform[ciid].happinessGod[ god ] += 12; message_usePopup = 1; if ( god ) { switch ( god ) { case God_Neptune: fun_postMessageToPlayer(92, 0, 0); fun_neptuneSinkAllShips(); city_inform[ciid].dword_654620 = 1; break; case God_Mercury: fun_postMessageToPlayer(93, 0, 0); fun_removeGoodsFromStorageForMercury(0); break; case God_Mars: if ( fun_startLocalUprisingFromMars() ) fun_postMessageToPlayer(94, 0, 0); else fun_postMessageToPlayer(44, 0, 0); break; case God_Venus: fun_postMessageToPlayer(95, 0, 0); fun_setCrimeRiskForAllHouses(50); fun_decreaseCrimeRisk(-5); fun_changeHealthRate(-10); fun_calculateCityHappinessAndCrime(); break; } } else { fun_postMessageToPlayer(91, 0, 0); ceresWitherCrops(0); } } } else { city_inform[ciid].byte_654303[god] = 1; message_usePopup = 1; if ( god ) { switch ( god ) { case God_Neptune: fun_postMessageToPlayer(97, 0, 0); city_inform[ciid].dword_6544F0 = 1; break; case God_Mercury: fun_postMessageToPlayer(98, 0, 0); sub_468F00(); break; case God_Mars: fun_postMessageToPlayer(99, 0, 0); city_inform[ciid].dword_6544F4 = 10; break; case God_Venus: fun_postMessageToPlayer(100, 0, 0); fun_decreaseCrimeRisk(25); break; } } else // ceres { fun_postMessageToPlayer(96, 0, 0); ceresBlessingCrops(); } } } v3 = 100; for ( ii = 0; ii < 5; ++ii ) { if ( city_inform[ciid].happinessGod[ ii] < v3 ) v3 = city_inform[ciid].happinessGod[ii]; } if ( city_inform[ciid].dword_6544FC ) { --city_inform[ciid].dword_6544FC; } else { if ( v3 < 30 ) { city_inform[ciid].dword_6544FC = 20; if ( v3 >= 10 ) fun_postMessageToPlayer(55, 0, 0); else fun_postMessageToPlayer(101, 0, 0); } } } } } } void fun_clearCityInfoGods() { signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 5; ++i ) { city_inform[ciid].pctReligionCoverageGod[i] = 50; city_inform[ciid].happinessGod[i] = 50; city_inform[ciid].numBoltsGod[i] = 0; city_inform[ciid].byte_654303[i] = 0; city_inform[ciid].byte_654308[i ] = 0; city_inform[ciid].byte_65430D[i ] = 0; city_inform[ciid].byte_654312[i ] = 0; city_inform[ciid].byte_654317[i ] = 0; city_inform[1].monthsSinceFestivalCeres[i] = 0; } city_inform[ciid].dword_6544FC = 0; } void fun_determineAngriestGod() { signed int maxBolts; // [sp+4Ch] [bp-8h]@1 signed int minHappiness; // [sp+4Ch] [bp-8h]@13 int maxGod; // [sp+50h] [bp-4h]@1 maxGod = 0; maxBolts = 0; if ( city_inform[ciid].numBoltsGod[0] > 0 ) { maxGod = 1; maxBolts = city_inform[ciid].numBoltsGod[0]; } if ( city_inform[ciid].numBoltsGod[1] > maxBolts ) { maxGod = 2; maxBolts = city_inform[ciid].numBoltsGod[1]; } if ( city_inform[ciid].numBoltsGod[2] > maxBolts ) { maxGod = 3; maxBolts = city_inform[ciid].numBoltsGod[2]; } if ( city_inform[ciid].numBoltsGod[3] > maxBolts ) { maxGod = 4; maxBolts = city_inform[ciid].numBoltsGod[3]; } if ( city_inform[ciid].numBoltsGod[4] > maxBolts ) maxGod = 5; if ( maxGod <= 0 ) { minHappiness = 40; if ( city_inform[ciid].happinessGod[0] < 40 ) { maxGod = 1; minHappiness = city_inform[ciid].happinessGod[0]; } if ( city_inform[ciid].happinessGod[1] < minHappiness ) { maxGod = 2; minHappiness = city_inform[ciid].happinessGod[1]; } if ( city_inform[ciid].happinessGod[2]< minHappiness ) { maxGod = 3; minHappiness = city_inform[ciid].happinessGod[2]; } if ( city_inform[ciid].happinessGod[3] < minHappiness ) { maxGod = 4; minHappiness = city_inform[ciid].happinessGod[3]; } if ( city_inform[ciid].happinessGod[4] < minHappiness ) maxGod = 5; city_inform[ciid].religionAngryGod = maxGod; } else { city_inform[ciid].religionAngryGod = maxGod; } } // 654330: using guessed type int cityinfo_religionAngryGod[]; //----- (004E6140) -------------------------------------------------------- void fun_holdFestival() { if( city_inform[ciid].holdFestival_65444C ) --city_inform[ciid].holdFestival_65444C; if( city_inform[ciid].holdFestival_654450 ) --city_inform[ciid].holdFestival_654450; if ( city_inform[ciid].plannedFestival_size > 0 ) { --city_inform[ciid].plannedFestival_monthsToGo; if ( city_inform[ciid].plannedFestival_monthsToGo <= 0 ) { if ( city_inform[ciid].holdFestival_65444C > 0 ) { if ( city_inform[ciid].holdFestival_654450 <= 0 ) { city_inform[ciid].holdFestival_654450 = 12; switch ( city_inform[ciid].plannedFestival_size ) { case 1: fun_decreaseCrimeRisk(2); break; case 2: fun_decreaseCrimeRisk(3); break; case 3: fun_decreaseCrimeRisk(5); break; } } } else { city_inform[ciid].holdFestival_65444C = 12; switch ( city_inform[ciid].plannedFestival_size ) { case 1: fun_decreaseCrimeRisk(7); break; case 2: fun_decreaseCrimeRisk(9); break; case 3: fun_decreaseCrimeRisk(12); break; } } city_inform[ciid].monthsSinceFestival = 1; city_inform[ciid].monthsSinceFestivalCeres[ city_inform[ciid].plannedFestival_god ] = 0; message_usePopup = 1; switch ( city_inform[ciid].plannedFestival_size ) { case 1: fun_postMessageToPlayer(38, 0, 0); break; case 2: fun_postMessageToPlayer(39, 0, 0); break; case 3: fun_postMessageToPlayer(40, 0, 0); break; } city_inform[ciid].plannedFestival_size = 0; city_inform[ciid].plannedFestival_monthsToGo = 0; } } } // 6542F0: using guessed type int cityinfo_monthsSinceFestival[]; // 65431C: using guessed type int cityinfo_monthsSinceFestivalCeres[]; // 65441C: using guessed type int cityinfo_plannedFestival_size[]; // 654420: using guessed type int cityinfo_plannedFestival_monthsToGo[]; // 654424: using guessed type int cityinfo_plannedFestival_god[]; // 65444C: using guessed type int cityinfo_holdFestival_65444C[]; // 654450: using guessed type int cityinfo_holdFestival_654450[]; // 659B50: using guessed type int message_usePopup; //----- (004E64D0) -------------------------------------------------------- void fun_handleScenarioWinLoseEvent() { signed int numCriteria; // [sp+4Ch] [bp-4h]@1 numCriteria = 0; if ( !scn_isOpenPlay ) { winState = 1; if ( scn_win_culture_on ) { numCriteria = 1; if ( city_inform[ciid].cultureRating < scn_win_culture ) winState = 0; } if ( scn_win_prosperity_on ) { ++numCriteria; if ( city_inform[ciid].prosperityRating < scn_win_prosperity ) winState = 0; } if ( scn_win_peace_on ) { ++numCriteria; if ( city_inform[ciid].peaceRating < scn_win_peace ) winState = 0; } if ( scn_win_favor_on ) { ++numCriteria; if ( city_inform[ciid].favorRating < scn_win_favor ) winState = 0; } if ( scn_win_population_on ) { ++numCriteria; if ( city_inform[ciid].population < scn_win_population ) winState = 0; } if ( numCriteria <= 0 ) { winState = 0; if ( scn_win_timeLimit_on ) ++numCriteria; if ( scn_win_survivalTime_on ) ++numCriteria; } if ( gametime_year >= timeLimit_maxGameYear ) { if ( scn_win_timeLimit_on ) { winState = -1; } else { if ( scn_win_survivalTime_on ) winState = 1; } } if ( city_inform[ciid].enemyDestroyedBuildings + city_inform[ciid].imperialArmyComing > city_inform[ciid].dword_654598 + 2 ) { if ( city_inform[ciid].population < city_inform[ciid].maxPopulationEver / 4 ) winState = -1; } if ( city_inform[ciid].enemyDestroyedBuildings + city_inform[ciid].imperialArmyComing > 0 ) { if ( city_inform[ciid].population <= 0 ) winState = -1; } if ( mode_editor == 1 ) winState = 0; if ( numCriteria <= 0 ) winState = 0; if ( city_inform[ciid].hasWonScenario ) winState = (city_inform[ciid].victoryContinueMonths <= 0); if ( byte_65E6A0 ) winState = 1; if ( winState ) { toPlace_buildingType = B_none_building; byte_660585 = 0; if ( winState < 1 ) { if ( city_inform[ciid].dword_654634 ) { sub_5093B0(1, 51, 1000); } else { city_inform[ciid].dword_654634 = 1; message_usePopup = 1; fun_postMessageToPlayer(112, 0, 0); } byte_65E6A0 = 0; } else { fun_soundStopChannel(0); if ( city_inform[ciid].gameWinVideoShown ) { mouseInfo_type = 0; handleClick_isRightClick = 0; byte_65E6C8 = 0; message_useVideo = 2; fun_clearScreen(); if ( setting_currentMissionId > 1 || setting_isCustomScenario ) { if ( setting_currentMissionId < 10 || setting_isCustomScenario ) { if ( setting_winVideoAlternate ) fun_startVideo("smk\\victory_senate.smk", (screen_width - 400) / 2, (screen_height - 292) / 2, 1, 66); else fun_startVideo("smk\\victory_balcony.smk", (screen_width - 400) / 2, (screen_height - 292) / 2, 1, 66); if ( setting_winVideoAlternate ) setting_winVideoAlternate = 0; else setting_winVideoAlternate = 1; } else { fun_startVideo("smk\\win_game.smk", (screen_width - 400) / 2, (screen_height - 292) / 2, 1, 66); } } else { window_id = 66; } byte_65E6A0 = 0; } else { city_inform[ciid].gameWinVideoShown = 1; message_usePopup = 1; window_id = 67; window_redrawRequest = 1; } } } } } void fun_decreaseMonthsLeftToGovernAfterWin() { if ( city_inform[ciid].hasWonScenario ) --city_inform[ciid].victoryContinueMonths; } void fun_dialogVictory_accept() { window_id = 1; window_redrawRequest = 1; } void sub_4E6B40() { startingFavor = city_inform[ciid].favorRating; setting_personalSavings_lastMission = city_inform[ciid].personalSavings; setting_dword_65E798[setting_currentMissionId++] = city_inform[ciid].personalSavings; city_inform[ciid].hasWonScenario = 0; city_inform[ciid].victoryContinueMonths = 0; city_inform[ciid].continueGoverningSomething = 0; if ( setting_currentMissionId >= 11 || setting_isCustomScenario ) { window_id = 0; if ( !setting_isCustomScenario ) { fun_clearMissionSettings(); setting_currentMissionId = 2; } } else { savedgame_missionId = campaign_missionIds_peaceful[2 * setting_currentMissionId]; sub_4117C0(); } dword_8E1484 = 0; currentOverlay = 0; window_redrawRequest = 1; } // 605910: using guessed type int campaign_missionIds_peaceful[]; // 654234: using guessed type int cityinfo_favorRating[]; // 654370: using guessed type int cityinfo_personalSavings[]; // 6543F4: using guessed type int cityinfo_hasWonScenario[]; // 6543F8: using guessed type int cityinfo_victoryContinueMonths[]; // 6543FC: using guessed type int cityinfo_continueGoverningSomething[]; // 65E750: using guessed type int savedgame_missionId; // 65E758: using guessed type int startingFavor; // 65E75C: using guessed type int setting_personalSavings_lastMission; // 65E760: using guessed type int setting_currentMissionId; // 65E764: using guessed type int setting_isCustomScenario; // 660C5C: using guessed type char window_redrawRequest; //----- (004E6CA0) -------------------------------------------------------- void fun_dialogVictory_continueGoverning() { city_inform[ciid].hasWonScenario = 1; if ( currentButton_parameter == 1 ) { city_inform[ciid].victoryContinueMonths += 24; city_inform[ciid].continueGoverningSomething = 24; city_inform[ciid].salary_rank = 0; city_inform[ciid].salary_amount = 0; fun_updateFinanceSalary(); } else { if ( currentButton_parameter == 2 ) { city_inform[ciid].victoryContinueMonths += 60; city_inform[ciid].continueGoverningSomething = 60; city_inform[ciid].salary_rank = 0; city_inform[ciid].salary_amount = 0; fun_updateFinanceSalary(); } } window_id = 1; window_redrawRequest = 1; byte_65E6A0 = 0; winState = 0; } void sub_4E6E20() { city_inform[ciid].hasWonScenario = 0; city_inform[ciid].victoryContinueMonths = 0; city_inform[ciid].continueGoverningSomething = 0; if ( setting_isCustomScenario ) window_id = 0; else sub_4117C0(); dword_8E1484 = 0; window_redrawRequest = 1; } signed int sub_4E6EC0() { signed int result; // eax@2 __int16 v1; // ax@7 __int16 v2; // cx@12 __int16 v3; // dx@17 __int16 v4; // cx@19 __int16 v5; // ax@22 __int16 v6; // dx@24 __int16 v7; // ax@31 __int16 v8; // dx@32 __int16 v9; // cx@34 __int16 v10; // ax@36 __int16 v11; // dx@38 __int16 v12; // cx@39 int v13; // ecx@50 signed int v14; // [sp+4Ch] [bp-14h]@125 int v15; // [sp+50h] [bp-10h]@81 int v16; // [sp+50h] [bp-10h]@111 int v17; // [sp+58h] [bp-8h]@7 signed int i; // [sp+5Ch] [bp-4h]@76 signed int j; // [sp+5Ch] [bp-4h]@79 signed int k; // [sp+5Ch] [bp-4h]@108 if ( dword_8C79EC ) { if ( mode_editor == 1 ) { result = 0; } else { if ( warning_amount <= 0 ) { mouseover_button_id_main = 0; mouseover_button_id = mouseover_button_id_main; mouseover_imagebutton_id[0] = mouseover_button_id; canPlayCurrentSound = 1; storage_specialOrdersShown = 0; rightclickInfoDialog_advisor = 0; window_id = 9; window_redrawRequest = 1; dword_64E34C = 162 * setting_map_y + setting_map_x + setting_map_startGridOffset; dword_64E348 = setting_map_x; dword_64E344 = setting_map_y; v17 = dword_64E34C; currentlySelectedBuilding = grid_buildingIds[dword_64E34C]; dword_64E334 = rubble_originalBuildingType[dword_64E34C]; v1 = grid_terrain[dword_64E34C]; dword_64E390 = v1 & 0x80; dword_64E358 = grid_aqueducts[dword_64E34C]; if ( !currentlySelectedBuilding || buildings[currentlySelectedBuilding].inUse ) { fun_updateAvailableGoodsAndFoods(); dword_64E35C = 1; dword_64E328 = 0; if ( grid_buildingIds[v17] || grid_animation[v17] <= 0 ) { if ( grid_bitfields[v17] & 0x80 ) { v3 = grid_terrain[v17]; if ( v3 & 0x40 ) dword_64E38C = 13; v4 = grid_terrain[v17]; if ( v4 & 2 ) dword_64E38C = 5; } else { v5 = grid_terrain[v17]; if ( v5 & 1 ) { dword_64E38C = 1; } else { v6 = grid_terrain[v17]; if ( v6 & 2 ) { if ( v17 == dword_8E7B24 ) { dword_64E38C = 14; } else { if ( v17 == dword_89AA64 ) dword_64E38C = 15; else dword_64E38C = 2; } } else { v7 = grid_terrain[v17]; if ( !(v7 & 4) || (v8 = grid_terrain[v17], v8 & 8) ) { v9 = grid_terrain[v17]; if ( v9 & 0x10 ) { dword_64E38C = 4; } else { v10 = grid_terrain[v17]; if ( v10 & 0x20 ) { dword_64E38C = 12; } else { v11 = grid_terrain[v17]; if ( !(v11 & 0x40) || (v12 = grid_terrain[v17], v12 & 8) ) { if ( grid_terrain[v17] & T_Aqueduct ) { dword_64E38C = 7; } else { if ( grid_terrain[v17] & 0x1000 ) { dword_64E38C = 8; } else { if ( grid_terrain[v17] & T_Wall ) { dword_64E38C = 9; } else { if ( currentlySelectedBuilding ) { dword_64E35C = 2; currentBuilding_workerPercentage = getPercentage( buildings[currentlySelectedBuilding].num_workers, model_buildings[buildings[currentlySelectedBuilding].type].laborers); if ( buildings[currentlySelectedBuilding].type == 54 ) { currentlySelectedBuilding = buildings[currentlySelectedBuilding].warehouse_prevStorage; dword_64E34C = buildings[currentlySelectedBuilding].gridOffset; dword_64E348 = buildings[currentlySelectedBuilding].x; dword_64E344 = buildings[currentlySelectedBuilding].y; currentFormationID = buildings[currentlySelectedBuilding].formationId; } else { v13 = currentlySelectedBuilding << 7; switch ( buildings[currentlySelectedBuilding].type ) { case B_FortGround__: currentFormationID = buildings[currentlySelectedBuilding].formationId; break; case B_WarehouseSpace: currentlySelectedBuilding = sub_4789E0(currentlySelectedBuilding); dword_64E34C = buildings[currentlySelectedBuilding].gridOffset; dword_64E348 = buildings[currentlySelectedBuilding].x; dword_64E344 = buildings[currentlySelectedBuilding].y; break; case B_Hippodrome: currentlySelectedBuilding = sub_4789E0(currentlySelectedBuilding); dword_64E34C = buildings[currentlySelectedBuilding].gridOffset; dword_64E348 = buildings[currentlySelectedBuilding].x; dword_64E344 = buildings[currentlySelectedBuilding].y; break; default: if ( buildings[currentlySelectedBuilding].house_size ) { sub_4FE3E0(/*v13, currentlySelectedBuilding << 7*/); fun_determineHouseEvolveText(currentlySelectedBuilding); } else { if ( buildings[currentlySelectedBuilding].type == B_Barracks ) { dword_64E2C4[0] = sub_4BB5B0(/*v13, currentlySelectedBuilding << 7*/); dword_64E2C4[0] += dword_7FA224; } } break; } } dword_64E370 = 0; switch ( buildings[currentlySelectedBuilding].type ) { case B_Granary: if ( fun_granaryHasRoadAccess( buildings[currentlySelectedBuilding].x, buildings[currentlySelectedBuilding].y) ) dword_64E370 = 1; break; case B_Hippodrome: if ( sub_4898D0( buildings[currentlySelectedBuilding].x, buildings[currentlySelectedBuilding].y) ) dword_64E370 = 1; break; case B_Warehouse: if ( determineAccessRoad( buildings[currentlySelectedBuilding].x, buildings[currentlySelectedBuilding].y, 3) ) dword_64E370 = 1; dword_64E368 = sub_45B920(currentlySelectedBuilding); break; default: if ( determineAccessRoad( buildings[currentlySelectedBuilding].x, buildings[currentlySelectedBuilding].y, buildings[currentlySelectedBuilding].size) ) dword_64E370 = 1; break; } } else { dword_64E38C = 10; } } } } } else { dword_64E38C = 6; } } } } else { dword_64E38C = 3; } } } } } else { v2 = grid_terrain[v17]; if ( v2 & 4 ) dword_64E38C = 11; else dword_64E38C = 10; } walkerInfo_index = 0; rightClickInfoNumWalkers = 0; for ( i = 0; i < 7; ++i ) dword_64E300[i] = 0; for ( j = 0; ; ++j ) { if ( j < 9 ) { v15 = grid_walkerIds[dword_5FFADC[j] + v17]; do { if ( v15 <= 0 ) break; if ( walkers[v15].state != 2 ) { if ( walkers[v15].actionState != 149 ) { if ( walkers[v15].type ) { if ( walkers[v15].type != Walker_Explosion ) { if ( walkers[v15].type != Walker_MapFlag ) { if ( walkers[v15].type != Walker_Flotsam ) { if ( walkers[v15].type != Walker_Arrow ) { if ( walkers[v15].type != Walker_Javelin ) { if ( walkers[v15].type != Walker_Bolt ) { if ( walkers[v15].type != Walker_Ballista ) { if ( walkers[v15].type != Walker_Creature ) { if ( walkers[v15].type != Walker_FishGulls ) { if ( walkers[v15].type != Walker_Spear ) { if ( walkers[v15].type != Walker_HippodromeMiniHorses ) { dword_64E300[rightClickInfoNumWalkers++] = v15; fun_determineWalkerSoundPhrase(v15); } } } } } } } } } } } } } } v15 = walkers[v15].nextIdOnSameTile; } while ( rightClickInfoNumWalkers < 7 ); if ( rightClickInfoNumWalkers < 7 ) continue; } break; } for ( k = 0; k < 7; ++k ) { v16 = dword_64E300[k]; if ( v16 > 0 && (walkers[v16].type == Walker_FortStandard || walkers[v16].type == Walker_FortJavelin || walkers[v16].type == Walker_FortMounted || walkers[v16].type == Walker_FortLegionary) ) { dword_64E35C = 4; currentFormationID = walkers[v16].formationId; if ( formations[currentFormationID].walkerType == Walker_FortLegionary ) { if (formations[currentFormationID].hasMilitaryTraining ) dword_64E360 = 4; else dword_64E360 = 3; } else { dword_64E360 = 5; } break; } } rightclickInfoDialog_x = 8; rightclickInfoDialog_y = 32; rightclickInfoDialog_widthBlocks = 29; v14 = sub_4E7D40(); switch ( v14 ) { case 1: rightclickInfoDialog_heightBlocks = 16; break; case 2: rightclickInfoDialog_heightBlocks = 18; break; case 3: rightclickInfoDialog_heightBlocks = 19; break; case 4: rightclickInfoDialog_heightBlocks = 14; break; default: rightclickInfoDialog_heightBlocks = 22; break; } switch ( screen_height ) { case 480: rightclickInfoDialog_y = 32; if ( sidepanel_collapsed == 1 ) rightclickInfoDialog_x = 68; else rightclickInfoDialog_x = 8; break; case 600: if ( mouseclick_y <= (screen_height - 24) / 2 + 24 ) rightclickInfoDialog_y = screen_height - 16 * rightclickInfoDialog_heightBlocks - 8; else rightclickInfoDialog_y = 32; if ( sidepanel_collapsed == 1 ) rightclickInfoDialog_x = 128; else rightclickInfoDialog_x = 68; break; case 768: if ( mouseclick_y <= (screen_height - 24) / 2 + 24 ) rightclickInfoDialog_y = screen_height - 16 * rightclickInfoDialog_heightBlocks - 8; else rightclickInfoDialog_y = 32; if ( sidepanel_collapsed == 1 ) rightclickInfoDialog_x = 248; else rightclickInfoDialog_x = 188; break; } result = 1; } else { window_id = 1; result = 0; } } else { fun_clearWarnings(); result = 0; } } } else { result = 0; } return result; } // 40196F: using guessed type _DWORD sub_40196F(_DWORD); // 401C2B: using guessed type int __fastcall sub_401C2B(_DWORD, _DWORD); // 4028A1: using guessed type int __fastcall sub_4028A1(_DWORD, _DWORD); // 403233: using guessed type _DWORD sub_403233(_DWORD); // 4033AF: using guessed type _DWORD sub_4033AF(_DWORD, _DWORD); // 608084: using guessed type int dword_608084; // 6080A8: using guessed type int sidepanel_collapsed; // 64E2C4: using guessed type int dword_64E2C4[15]; // 64E324: using guessed type int dword_64E324; // 64E328: using guessed type int dword_64E328; // 64E340: using guessed type int storage_specialOrdersShown; // 64E344: using guessed type int dword_64E344; // 64E348: using guessed type int dword_64E348; // 64E34C: using guessed type int dword_64E34C; // 64E358: using guessed type int dword_64E358; // 64E35C: using guessed type int dword_64E35C; // 64E360: using guessed type int dword_64E360; // 64E368: using guessed type int dword_64E368; // 64E370: using guessed type int dword_64E370; // 64E37C: using guessed type int rightClickInfoNumWalkers; // 64E380: using guessed type int currentBuilding_workerPercentage; // 64E388: using guessed type int walkerInfo_index; // 64E38C: using guessed type int dword_64E38C; // 64E390: using guessed type int dword_64E390; // 64E394: using guessed type int rightclickInfoDialog_advisor; // 659C10: using guessed type int warning_amount; // 65E6D4: using guessed type int screen_height; // 660C5C: using guessed type char window_redrawRequest; // 7F87C4: using guessed type __int16 formation_walkerType[]; // 7F8800: using guessed type __int16 formation_hasMilitaryTraining[]; // 7FA224: using guessed type int dword_7FA224; // 7FA348: using guessed type __int16 walker_nextIdOnSameTile[]; // 7FA390: using guessed type __int16 walker_formationId[]; // 89AA64: using guessed type int dword_89AA64; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8E7B24: using guessed type int dword_8E7B24; // 8F61A0: using guessed type __int16 grid_buildingIds[]; // 94BD48: using guessed type __int16 building_08_gridOffset[]; // 94BD4A: using guessed type __int16 building_0a_type[]; // 94BD70: using guessed type __int16 building_30_warehouse_prevStorage[]; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD88: using guessed type __int16 building_48_word_94BD88[]; // 9D77F0: using guessed type int mouseover_imagebutton_id[202]; // 9D7B28: using guessed type int mouseover_button_id; // 9D7B2C: using guessed type int mouseover_button_id_main; // 9DA898: using guessed type int mode_editor; //----- (004E7D40) -------------------------------------------------------- signed int sub_4E7D40() { signed int result; // eax@2 if ( !dword_64E35C ) return 0; if ( dword_64E35C == 1 ) { switch ( dword_64E38C ) { case 12: result = 1; break; case 9: result = 1; break; case 8: result = 1; break; case 7: result = 4; break; default: result = 0; break; } } else { if ( dword_64E35C == 4 ) return 0; if ( dword_64E35C != 2 ) goto LABEL_141; if ( buildings[currentlySelectedBuilding].type == B_SmallTempleCeres ) return 1; if ( buildings[currentlySelectedBuilding].type == B_SmallTempleNeptune ) return 1; if ( buildings[currentlySelectedBuilding].type == B_SmallTempleMercury ) return 1; if ( buildings[currentlySelectedBuilding].type == B_SmallTempleMars ) return 1; if ( buildings[currentlySelectedBuilding].type == B_SmallTempleVenus ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LargeTempleCeres ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LargeTempleNeptune ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LargeTempleMercury ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LargeTempleMars ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LargeTempleVenus ) return 1; if ( buildings[currentlySelectedBuilding].type == B_SmallStatue ) return 1; if ( buildings[currentlySelectedBuilding].type == B_MediumStatue ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LargeStatue ) return 1; if ( buildings[currentlySelectedBuilding].type == B_GladiatorSchool ) return 1; if ( buildings[currentlySelectedBuilding].type == B_LionHouse ) return 1; if ( buildings[currentlySelectedBuilding].type == B_ActorColony ) return 1; if ( buildings[currentlySelectedBuilding].type == B_ChariotMaker ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Doctor ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Hospital ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Bathhouse ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Barber ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Oracle ) return 1; if ( buildings[currentlySelectedBuilding].type == B_BurningRuin ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Reservoir ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Fountain ) return 4; if ( buildings[currentlySelectedBuilding].type == B_Well ) return 4; if ( buildings[currentlySelectedBuilding].type == B_NativeHut ) return 1; if ( buildings[currentlySelectedBuilding].type == B_NativeMeeting ) return 1; if ( buildings[currentlySelectedBuilding].type == B_NativeCrops ) return 1; if ( buildings[currentlySelectedBuilding].type == B_MissionPost ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Amphitheater ) return 3; if ( buildings[currentlySelectedBuilding].type == B_Theater ) return 2; if ( buildings[currentlySelectedBuilding].type == B_Hippodrome ) return 2; if ( buildings[currentlySelectedBuilding].type == B_Colosseum ) return 2; if ( buildings[currentlySelectedBuilding].type == B_Prefecture ) return 1; if ( buildings[currentlySelectedBuilding].type == B_EngineersPost ) return 1; if ( buildings[currentlySelectedBuilding].type == B_School ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Academy ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Library ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Gatehouse ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Tower ) return 1; if ( buildings[currentlySelectedBuilding].type == B_FortGround__ ) return 1; if ( buildings[currentlySelectedBuilding].type == B_MilitaryAcademy ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Barracks ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Market ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Granary ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Shipyard ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Dock ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Wharf ) return 1; if ( buildings[currentlySelectedBuilding].type == B_GovernorsHouse ) return 1; if ( buildings[currentlySelectedBuilding].type == B_GovernorsVilla ) return 1; if ( buildings[currentlySelectedBuilding].type == B_GovernorsPalace ) return 1; if ( buildings[currentlySelectedBuilding].type == B_Senate ) return 2; if ( buildings[currentlySelectedBuilding].type == B_SenateUpgraded ) return 2; if ( buildings[currentlySelectedBuilding].type == B_Forum ) return 1; if ( buildings[currentlySelectedBuilding].type == B_ForumUpgraded ) return 1; if ( buildings[currentlySelectedBuilding].type == B_WineWorkshop ) return 1; if ( buildings[currentlySelectedBuilding].type == B_OilWorkshop ) return 1; if ( buildings[currentlySelectedBuilding].type == B_WeaponsWorkshop ) return 1; if ( buildings[currentlySelectedBuilding].type == B_FurnitureWorkshop ) return 1; if ( buildings[currentlySelectedBuilding].type != B_PotteryWorkshop ) LABEL_141: result = 0; else result = 1; } return result; } // 64E35C: using guessed type int dword_64E35C; // 64E38C: using guessed type int dword_64E38C; // 94BD4A: using guessed type __int16 building_0a_type[]; //----- (004E8710) -------------------------------------------------------- void fun_showRightClickInfo() { sub_4DC1B0(); if ( dword_64E35C ) { switch ( dword_64E35C ) { case 1: fun_showTerrainInfo(); break; case 4: fun_showFortInfo(currentFormationID); break; case 2: if ( buildings[currentlySelectedBuilding].type < B_HouseVacantLot || buildings[currentlySelectedBuilding].type > B_HouseLuxuryPalace ) { switch ( buildings[currentlySelectedBuilding].type ) { case B_Amphitheater: showBuildingInfoAmphitheater(); break; case B_Theater: fun_showBuildingInfoTheater(); break; case B_Hippodrome: fun_showBuildingInfoHippodrome(); break; case B_Colosseum: fun_showBuildingInfoColosseum(); break; case B_GladiatorSchool: fun_showBuildingInfoGladiatorSchool(); break; case B_LionHouse: fun_showBuildingInfoLionHouse(); break; case B_ActorColony: fun_showBuildingInfoActorColony(); break; case B_ChariotMaker: fun_showBuildingInfoChariotMaker(); break; case B_SmallStatue: fun_showBuildingInfoStatue(); break; case B_MediumStatue: fun_showBuildingInfoStatue(); break; case B_LargeStatue: fun_showBuildingInfoStatue(); break; case B_Doctor: fun_showBuildingInfoDoctor(); break; case B_Hospital: fun_showBuildingInfoHospital(); break; case B_Bathhouse: fun_showBuildingInfoBathhouse(); break; case B_Barber: fun_showBuildingInfoBarber(); break; case B_School: fun_showBuildingInfoSchool(); break; case B_Academy: fun_showBuildingInfoAcademy(); break; case B_Library: fun_showBuildingInfoLibrary(); break; case B_Prefecture: fun_showBuildingInfoPrefecture(); break; case B_TriumphalArch: fun_showBuildingInfoTriumphalArch(); break; case B_FortGround__: fun_showBuildingInfoFortGround(); break; case B_Gatehouse: fun_showBuildingInfoGatehouse(); break; case B_Tower: fun_showBuildingInfoTower(); break; case B_MilitaryAcademy: fun_showBuildingInfoMilitaryAcademy(); break; case B_Barracks: fun_showBuildingInfoBarracks(); break; case B_SmallTempleCeres: fun_showBuildingInfoTempleCeres(); break; case B_SmallTempleNeptune: fun_showBuildingInfoTempleNeptune(); break; case B_SmallTempleMercury: fun_showBuildingInfoTempleMercury(); break; case B_SmallTempleMars: fun_showBuildingInfoTempleMars(); break; case B_SmallTempleVenus: fun_showBuildingInfoTempleVenus(); break; case B_LargeTempleCeres: fun_showBuildingInfoTempleCeres(); break; case B_LargeTempleNeptune: fun_showBuildingInfoTempleNeptune(); break; case B_LargeTempleMercury: fun_showBuildingInfoTempleMercury(); break; case B_LargeTempleMars: fun_showBuildingInfoTempleMars(); break; case B_LargeTempleVenus: fun_showBuildingInfoTempleVenus(); break; case B_Market: fun_showBuildingInfoMarket(); break; case B_Granary: if ( storage_specialOrdersShown ) fun_showGranaryInstructionsDialog(); else fun_showBuildingInfoGranary(); break; case B_Warehouse: if ( storage_specialOrdersShown ) fun_showWarehouseInstructionsDialog(); else fun_showBuildingInfoWarehouse(); break; case B_Shipyard: fun_showBuildingInfoShipyard(); break; case B_Dock: fun_showBuildingInfoDock(); break; case B_Wharf: fun_showBuildingInfoWharf(); break; case B_GovernorsHouse: fun_showBuildingInfoGovernorsHome(); break; case B_GovernorsVilla: fun_showBuildingInfoGovernorsHome(); break; case B_GovernorsPalace: fun_showBuildingInfoGovernorsHome(); break; case B_EngineersPost: fun_showBuildingInfoEngineersPost(); break; case B_MissionPost: fun_showBuildingInfoMissionPost(); break; case B_NativeHut: fun_showBuildingInfoNativeHut(); break; case B_NativeMeeting: fun_showBuildingInfoNativeMeeting(); break; case B_NativeCrops: fun_showBuildingInfoNativeCrops(); break; case B_Senate: fun_showBuildingInfoSenate(); break; case B_SenateUpgraded: fun_showBuildingInfoSenate(); break; case B_Forum: fun_showBuildingInfoForum(); break; case B_ForumUpgraded: fun_showBuildingInfoForum(); break; case B_Reservoir: fun_showBuildingInfoReservoir(); break; case B_Fountain: fun_showBuildingInfoFountain(); break; case B_Well: fun_showBuildingInfoWell(); break; case B_Oracle: fun_showBuildingInfoOracle(); break; case B_BurningRuin: fun_showBuildingInfoBurningRuin(); break; case B_WheatFarm: fun_showBuildingInfoWheatFarm(); break; case B_VegetableFarm: fun_showBuildingInfoVegetableFarm(); break; case B_FruitFarm: fun_showBuildingInfoFruitFarm(); break; case B_OliveFarm: fun_showBuildingInfoOliveFarm(); break; case B_VinesFarm: fun_showBuildingInfoVinesFarm(); break; case B_PigFarm: fun_showBuildingInfoPigFarm(); break; case B_MarbleQuarry: fun_showBuildingInfoMarbleQuarry(); break; case B_IronMine: fun_showBuildingInfoIronMine(); break; case B_TimberYard: fun_showBuildingInfoTimberYard(); break; case B_ClayPit: fun_showBuildingInfoClayPit(); break; case B_WineWorkshop: fun_showBuildingInfoWineWorkshop(); break; case B_OilWorkshop: fun_showBuildingInfoOilWorkshop(); break; case B_WeaponsWorkshop: fun_showBuildingInfoWeaponsWorkshop(); break; case B_FurnitureWorkshop: fun_showBuildingInfoFurnitureWorkshop(); break; case B_PotteryWorkshop: fun_showBuildingInfoPotteryWorkshop(); break; } } else { showBuildingInfoHousing(); } break; } } else { fun_showInfoNoPeople(); } } // 64E324: using guessed type int dword_64E324; // 64E340: using guessed type int storage_specialOrdersShown; // 64E35C: using guessed type int dword_64E35C; // 94BD4A: using guessed type __int16 building_0a_type[]; //----- (004E92D0) -------------------------------------------------------- void sub_4E92D0() { if ( dword_64E35C ) { if ( dword_64E35C != 1 ) { if ( dword_64E35C == 4 ) { sub_4FF0B0(currentFormationID); } else { if ( dword_64E35C == 2 ) { if ( buildings[currentlySelectedBuilding].type < B_HouseVacantLot || buildings[currentlySelectedBuilding].type > B_HouseLuxuryPalace ) { if ( buildings[currentlySelectedBuilding].type == B_Granary ) { if ( storage_specialOrdersShown ) sub_4F29B0(); else fun_drawGranarySpecialOrdersButton(); } else { if ( buildings[currentlySelectedBuilding].type == B_Warehouse ) { if ( storage_specialOrdersShown ) sub_4F3640(); else fun_drawWarehouseSpecialOrdersButton(); } } } } } } } } // 40144C: using guessed type _DWORD sub_40144C(_DWORD); // 402540: using guessed type int sub_402540(void); // 64E324: using guessed type int dword_64E324; // 64E340: using guessed type int storage_specialOrdersShown; // 64E35C: using guessed type int dword_64E35C; // 94BD4A: using guessed type __int16 building_0a_type[]; //----- (004E93E0) -------------------------------------------------------- void fun_handleMouseClickRightClickInfo() { int numButtons; // [sp+4Ch] [bp-4h]@5 mouseover_button_id = 0; if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; return; } if ( !storage_specialOrdersShown ) { fun_isImageButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo, 2, 10); if ( fun_handleImageButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo, 2) ) return; if ( rightclickInfoDialog_advisor ) fun_handleImageButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo_advisor, 1); goto LABEL_16; } if ( buildings[currentlySelectedBuilding].type == B_Warehouse ) numButtons = availableGoods_count; else numButtons = availableFoods_count; mouseover_button_id_main = fun_isCustomButtonClick( rightclickInfoDialog_x + 180, 78, &buttons_buildingInfo_resources, numButtons); if ( !fun_handleCustomButtonClick(rightclickInfoDialog_x + 180, 78, &buttons_buildingInfo_resources, numButtons) ) { fun_isImageButtonClick(rightclickInfoDialog_x, 432, &imagebuttons_rightClickInfo, 2, 10); if ( !fun_handleImageButtonClick(rightclickInfoDialog_x, 432, &imagebuttons_rightClickInfo, 2) ) { LABEL_16: if ( handleClick_isRightClick ) { window_id = 1; window_redrawRequest = 1; } else { fun_isImageButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo, 2, 10); if ( !fun_handleImageButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 40, &imagebuttons_rightClickInfo, 2) ) { if ( dword_64E35C ) { if ( dword_64E35C == 4 ) { mouseover_button_id = fun_isCustomButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y, &buttons_fortInfo, 5); if ( !fun_handleCustomButtonClick(rightclickInfoDialog_x, rightclickInfoDialog_y, &buttons_fortInfo, 5) ) { mouseover_button_id_main = fun_isCustomButtonClick( 16 * (rightclickInfoDialog_widthBlocks - 18) / 2 + rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 48, &buttons_fortInfo_returnToFort, 1); fun_handleCustomButtonClick( 16 * (rightclickInfoDialog_widthBlocks - 18) / 2 + rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 48, &buttons_fortInfo_returnToFort, 1); } } else { if ( dword_64E328 ) { mouseover_button_id = fun_isCustomButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y, &buttons_walkerInfo, rightClickInfoNumWalkers); fun_handleCustomButtonClick( rightclickInfoDialog_x, rightclickInfoDialog_y, &buttons_walkerInfo, rightClickInfoNumWalkers); } else { if ( dword_64E35C == 2 ) { if ( buildings[currentlySelectedBuilding].type < B_HouseVacantLot || buildings[currentlySelectedBuilding].type > B_HouseLuxuryPalace || (mouseover_button_id_main = fun_isCustomButtonClick( rightclickInfoDialog_x + 112, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 32, &buttons_debug_housingEvolveInfo, 1), !fun_handleCustomButtonClick( rightclickInfoDialog_x + 112, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 32, &buttons_debug_housingEvolveInfo, 1)) ) { if ( buildings[currentlySelectedBuilding].type == B_Granary ) { if ( storage_specialOrdersShown ) { mouseover_button_id = fun_isCustomButtonClick( rightclickInfoDialog_x + 80, 436, &buttons_buildingInfo_granaryOrders, 1); !fun_handleCustomButtonClick( rightclickInfoDialog_x + 80, 436, &buttons_buildingInfo_granaryOrders, 1); } else { mouseover_button_id = fun_isCustomButtonClick( rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, &buttons_buildingInfo_granary, 1); !fun_handleCustomButtonClick( rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, &buttons_buildingInfo_granary, 1); } } else { if ( buildings[currentlySelectedBuilding].type == B_Warehouse ) { if ( storage_specialOrdersShown ) { mouseover_button_id = fun_isCustomButtonClick( rightclickInfoDialog_x + 80, 436, &buttons_buildingInfo_warehouseOrders, 2); fun_handleCustomButtonClick( rightclickInfoDialog_x + 80, 436, &buttons_buildingInfo_warehouseOrders, 2); } else { mouseover_button_id = fun_isCustomButtonClick( rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, &buttons_buildingInfo_warehouse, 1); fun_handleCustomButtonClick( rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, &buttons_buildingInfo_warehouse, 1); } } } } } } } } } } return; } } } // 608690: using guessed type int availableFoods_count; // 6086EC: using guessed type int availableGoods_count; // 64E328: using guessed type int dword_64E328; // 64E340: using guessed type int storage_specialOrdersShown; // 64E35C: using guessed type int dword_64E35C; // 64E37C: using guessed type int rightClickInfoNumWalkers; // 64E394: using guessed type int rightclickInfoDialog_advisor; // 65E934: using guessed type char handleClick_isRightClick; // 660C5C: using guessed type char window_redrawRequest; // 94BD4A: using guessed type __int16 building_0a_type[]; // 9D7B28: using guessed type int mouseover_button_id; // 9D7B2C: using guessed type int mouseover_button_id_main; //----- (004E9AE0) -------------------------------------------------------- void sub_4E9AE0(int a1, int a2) { int v2; // ST60_4@1 int v3; // ST5C_4@1 v2 = setting_map_camera_x; v3 = setting_map_camera_y; sub_42DAA0(a1); setting_map_camera_x = walkerGridX - 2; setting_map_camera_y = walkerGridY - 6; sub_4DC600(); sub_4DC5C0(); sub_42E6D0(setting_map_camera_x, setting_map_camera_y, setting_map_startGridOffset, a2); setting_map_camera_x = v2; setting_map_camera_y = v3; if ( sidepanel_collapsed == 1 ) fun_setCityViewport_withoutPanel(); else fun_setCityViewport_withPanel(); } void sub_4E9BA0() { int i; // [sp+50h] [bp-4h]@3 if ( rightClickInfoNumWalkers > 0 ) { for ( i = 0; i < rightClickInfoNumWalkers; ++i ) { sub_4E9AE0(walkers[dword_64E300[i]].gridOffset, dword_64E300[i]); graphic_xOffset = dword_9D4B50; graphic_yOffset = dword_9D4B48; _LOWORD(drawGraphic_width) = 12; _LOWORD(drawGraphic_height) = 48; sub_413060((char *)screen_buffer + dword_5FFB00[i], ddraw_scanline - 96, 0); } sub_4DC1B0(); } } void fun_showInfoNoPeople() { fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 70, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 8, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextCentered( 13, 1, rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 22, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 134, 0); } // 6E6BD0: using guessed type __int16 graphic_font; //----- (004E9D70) -------------------------------------------------------- void fun_showTerrainInfo() { switch ( dword_64E38C ) { case 1: dialog_help_id = 0; break; case 2: dialog_help_id = 0; break; case 3: dialog_help_id = 0; break; case 4: dialog_help_id = 0; break; case 5: dialog_help_id = 0; break; case 6: dialog_help_id = 57; break; case 7: dialog_help_id = 60; break; case 8: dialog_help_id = 0; break; case 9: dialog_help_id = 85; break; case 11: dialog_help_id = 58; break; default: dialog_help_id = 0; break; } if ( dword_64E38C == 12 ) { fun_showBuildingInfoGarden(); } else { if ( dword_64E38C != 13 || rightClickInfoNumWalkers > 0 ) { switch ( dword_64E38C ) { case 9: fun_showBuildingInfoWall(); break; case 7: fun_showBuildingInfoAqueduct(); break; case 8: fun_showBuildingInfoRubble(); break; default: if ( canPlayCurrentSound ) { canPlayCurrentSound = 0; if ( rightClickInfoNumWalkers > 0 ) fun_playWalkerInfoSound(); else fun_playSound("wavs\\empty_land.wav", 1, 0); } if ( rightClickInfoNumWalkers > 0 ) { if ( dword_64E300[walkerInfo_index] ) { if ( walkers[dword_64E300[walkerInfo_index]].type < 67 ) dialog_help_id = 42; else dialog_help_id = 330; } } sub_4E9BA0(); fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); if ( !rightClickInfoNumWalkers ) fun_drawGameTextCentered( 70, dword_64E38C + 10, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E38C == 3 ) { fun_drawGameTextWrapped( 70, dword_64E38C + 25, rightclickInfoDialog_x + 36, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( dword_64E38C != 6 ) { if ( dword_64E38C != 13 ) fun_drawGameTextWrapped( 70, dword_64E38C + 25, rightclickInfoDialog_x + 36, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } sub_4EA150(); break; } } else { fun_showBuildingInfoPlaza(); } } } // 402680: using guessed type int fun_showBuildingInfoPlaza(void); // 4029F0: using guessed type int fun_showBuildingInfoAqueduct(void); // 402A1D: using guessed type int fun_showBuildingInfoWall(void); // 608084: using guessed type int dword_608084; // 64E37C: using guessed type int rightClickInfoNumWalkers; // 64E388: using guessed type int walkerInfo_index; // 64E38C: using guessed type int dword_64E38C; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EA150) -------------------------------------------------------- void sub_4EA150() { int selected; // [sp+4Ch] [bp-8h]@6 int i; // [sp+50h] [bp-4h]@3 fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 40, rightclickInfoDialog_widthBlocks - 2, 12); if ( rightClickInfoNumWalkers > 0 ) { for ( i = 0; i < rightClickInfoNumWalkers; ++i ) { selected = i == walkerInfo_index; fun_drawBorderedButton(0, rightclickInfoDialog_x + 60 * i + 25, rightclickInfoDialog_y + 45, 52, 52, selected); graphic_xOffset = rightclickInfoDialog_x + 60 * i + 27; graphic_yOffset = rightclickInfoDialog_y + 47; _LOWORD(drawGraphic_width) = 12; _LOWORD(drawGraphic_height) = 48; sub_412FF0((char *)screen_buffer + dword_5FFB00[i], ddraw_scanline - 96, 0); } fun_drawWalkerRightClickInfoText(dword_64E300[walkerInfo_index]); } else { fun_drawGameTextCentered( 70, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 120, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 1206, 0); } dword_64E328 = 1; } // 64E328: using guessed type int dword_64E328; // 64E37C: using guessed type int rightClickInfoNumWalkers; // 64E388: using guessed type int walkerInfo_index; // 6606AC: using guessed type int ddraw_scanline; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EA310) -------------------------------------------------------- void fun_drawWalkerRightClickInfoText(int walkerId) { int v1; // ST18_4@36 int v2; // ST14_4@36 int v3; // esi@36 signed int v4; // eax@36 int v5; // ST18_4@41 int v6; // ST14_4@41 int v7; // esi@41 signed int v8; // eax@41 int v9; // ST18_4@47 int v10; // ST14_4@47 int v11; // esi@47 signed int v12; // eax@47 int v13; // ST18_4@52 int v14; // ST14_4@52 int v15; // esi@52 signed int v16; // eax@52 int v17; // ST18_4@113 int v18; // ST14_4@113 int v19; // esi@113 signed int v20; // eax@113 int v21; // ST80_4@134 int resource_y; // ST18_4@134 int resource_x; // ST14_4@134 int v24; // esi@134 signed int v25; // eax@134 int v26; // ST80_4@136 int v27; // ST18_4@136 int v28; // ST14_4@136 int v29; // esi@136 signed int v30; // eax@136 int v31; // [sp+4Ch] [bp-28h]@115 int v32; // [sp+50h] [bp-24h]@115 int v33; // [sp+54h] [bp-20h]@57 bool v34; // [sp+58h] [bp-1Ch]@116 signed int enemyGraphic; // [sp+5Ch] [bp-18h]@57 int v36; // [sp+5Ch] [bp-18h]@140 int v37; // [sp+60h] [bp-14h]@11 int k; // [sp+68h] [bp-Ch]@33 int l; // [sp+68h] [bp-Ch]@38 int i; // [sp+68h] [bp-Ch]@44 int j; // [sp+68h] [bp-Ch]@49 int v42; // [sp+6Ch] [bp-8h]@9 int v43; // [sp+70h] [bp-4h]@8 fun_drawBorderedButton( 0, rightclickInfoDialog_x + 24, rightclickInfoDialog_y + 102, 16 * (rightclickInfoDialog_widthBlocks - 3), 122, 0); if ( walkers[walkerId].type != Walker_TradeCaravan && walkers[walkerId].type != Walker_TradeCaravanDonkey && walkers[walkerId].type != Walker_TradeShip ) { if ( walkers[walkerId].type < Walker_Enemy43 || walkers[walkerId].type > Walker_Enemy53 ) { if ( walkers[walkerId].type != Walker_FishingBoat && walkers[walkerId].type != Walker_Shipwreck && walkers[walkerId].type != Walker_Sheep && walkers[walkerId].type != Walker_Wolf && walkers[walkerId].type != Walker_Zebra ) { if ( walkers[walkerId].type != Walker_CartPusher && walkers[walkerId].type != Walker_Warehouseman && walkers[walkerId].type != Walker_Dockman ) { if ( walkers[walkerId].type == Walker_MarketBuyer ) { drawGraphic( bigPeopleGraphicFromWalkerType[walkers[walkerId].type] - 1 + graphic_bigpeople, rightclickInfoDialog_x + 28, rightclickInfoDialog_y + 112); text_xoffset = 0; fun_drawGameText( 65, walker_name[64 * walkerId], rightclickInfoDialog_x + text_xoffset + 90, rightclickInfoDialog_y + 108, graphic_font + 804, 0); text_xoffset = 0; fun_drawGameText( 64, walkers[walkerId].type, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 139, graphic_font + F_SmallBlack, 0); if ( walkers[walkerId].actionState == 145 ) { v21 = fun_convertCollectIdToResourceId(walkers[walkerId].itemCollecting); fun_drawGameText( 129, 17, rightclickInfoDialog_x + text_xoffset + 90, rightclickInfoDialog_y + 139, graphic_font + F_SmallBlack, 0); resource_y = rightclickInfoDialog_y + 135; resource_x = rightclickInfoDialog_x + text_xoffset + 90; v24 = v21 + graphic_resourceIcons; v25 = fun_getResourceGraphicIdOffset(v21, 3); drawGraphic(v25 + v24, resource_x, resource_y); } else { if ( walkers[walkerId].actionState == 146 ) { v26 = fun_convertCollectIdToResourceId(walkers[walkerId].itemCollecting); fun_drawGameText( 129, 18, rightclickInfoDialog_x + text_xoffset + 90, rightclickInfoDialog_y + 139, graphic_font + F_SmallBlack, 0); v27 = rightclickInfoDialog_y + 135; v28 = rightclickInfoDialog_x + text_xoffset + 90; v29 = v26 + graphic_resourceIcons; v30 = fun_getResourceGraphicIdOffset(v26, 3); drawGraphic(v30 + v29, v28, v27); } } if ( currentMoodSoundId >= 0 ) fun_drawGameTextWrapped( 130, 21 * (currentWalkerSoundId - 1) + currentMoodSoundId + 1, rightclickInfoDialog_x + 90, rightclickInfoDialog_y + 160, 16 * (rightclickInfoDialog_widthBlocks - 9), graphic_font + F_SmallBlack, 0); } else { v36 = bigPeopleGraphicFromWalkerType[walkers[walkerId].type] - 1; if ( walkers[walkerId].actionState == 74 || walkers[walkerId].actionState == 75 ) v36 = 18; drawGraphic(v36 + graphic_bigpeople, rightclickInfoDialog_x + 28, rightclickInfoDialog_y + 112); text_xoffset = 0; fun_drawGameText( 65, walker_name[64 * walkerId], rightclickInfoDialog_x + text_xoffset + 90, rightclickInfoDialog_y + 108, graphic_font + 804, 0); text_xoffset = 0; fun_drawGameText( 64, walkers[walkerId].type, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 139, graphic_font + 1206, 0); if ( currentMoodSoundId >= 0 ) fun_drawGameTextWrapped( 130, 21 * (currentWalkerSoundId - 1) + currentMoodSoundId + 1, rightclickInfoDialog_x + 90, rightclickInfoDialog_y + 160, 16 * (rightclickInfoDialog_widthBlocks - 9), graphic_font + 1206, 0); } } else { drawGraphic( bigPeopleGraphicFromWalkerType[walkers[walkerId].type] - 1 + graphic_bigpeople, rightclickInfoDialog_x + 28, rightclickInfoDialog_y + 112); text_xoffset = 0; fun_drawGameText( 65, walker_name[64 * walkerId], rightclickInfoDialog_x + text_xoffset + 90, rightclickInfoDialog_y + 108, graphic_font + 804, 0); text_xoffset = 0; fun_drawGameText( 64, walkers[walkerId].type, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 139, graphic_font + 1206, 0); if ( walkers[walkerId].actionState != 132 ) { if ( walkers[walkerId].cartPusherGoodType ) { v17 = rightclickInfoDialog_y + 135; v18 = rightclickInfoDialog_x + text_xoffset + 92; v19 = walkers[walkerId].cartPusherGoodType + graphic_resourceIcons; v20 = fun_getResourceGraphicIdOffset(walkers[walkerId].cartPusherGoodType, 3); drawGraphic(v20 + v19, v18, v17); } } fun_drawGameTextWrapped( 130, 21 * (currentWalkerSoundId - 1) + currentMoodSoundId + 1, rightclickInfoDialog_x + 90, rightclickInfoDialog_y + 160, 16 * (rightclickInfoDialog_widthBlocks - 9), graphic_font + 1206, 0); if ( walkers[walkerId].buildingId ) { v32 = walkers[walkerId].buildingId; v31 = walkers[walkerId].baseWorkingBuildingId; text_xoffset = 0; if ( walkers[walkerId].actionState == 27 ) { v34 = 1; } else { if ( walkers[walkerId].actionState != 53 && walkers[walkerId].actionState != 56 && walkers[walkerId].actionState != 59 ) v34 = walkers[walkerId].actionState == 134 || walkers[walkerId].actionState == 137 || walkers[walkerId].actionState == 138; else v34 = 1; } if ( walkers[walkerId].actionState != 132 ) { if ( v34 ) { fun_drawGameText( 129, 16, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); fun_drawGameText( 41, buildings[v32].type, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); fun_drawGameText( 129, 14, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); fun_drawGameText( 41, buildings[v31].type, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); } else { fun_drawGameText( 129, 15, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); fun_drawGameText( 41, buildings[v31].type, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); fun_drawGameText( 129, 14, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); fun_drawGameText( 41, buildings[v32].type, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); } } } } } else { drawGraphic( graphic_bigpeople + bigPeopleGraphicFromWalkerType[walkers[walkerId].type] - 1, rightclickInfoDialog_x + 28, rightclickInfoDialog_y + 112); text_xoffset = 0; fun_drawGameText( 64, walkers[walkerId].type, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 139, graphic_font + 1206, 0); } } else { enemyGraphic = 8; v33 = walkers[walkerId].formationId; switch ( walkers[walkerId].type ) { case Walker_Enemy43: switch ( formations[v33].enemyType ) { case 8: enemyGraphic = 36; break; case 7: enemyGraphic = 32; break; case 5: enemyGraphic = 44; break; case 6: enemyGraphic = 46; break; } break; case Walker_Enemy44: switch ( formations[v33].enemyType ) { case 5: enemyGraphic = 45; break; case 6: enemyGraphic = 47; break; case 9: enemyGraphic = 29; break; } break; case Walker_Enemy45: switch ( formations[v33].enemyType ) { case 8: enemyGraphic = 37; break; case 0xA: enemyGraphic = 22; break; case 7: enemyGraphic = 31; break; } break; case Walker_Enemy49: if ( formations[v33].enemyType ) { if ( formations[v33].enemyType == 1 ) { enemyGraphic = 20; } else { if ( formations[v33].enemyType == 4 ) enemyGraphic = 35; } } else { enemyGraphic = 21; } break; case Walker_Enemy50: if ( formations[v33].enemyType == 3 ) { enemyGraphic = 24; } else { if ( formations[v33].enemyType == 2 ) enemyGraphic = 40; } break; case Walker_Enemy51: if ( formations[v33].enemyType == 1 ) enemyGraphic = 20; break; } drawGraphic(graphic_bigpeople + enemyGraphic - 1, rightclickInfoDialog_x + 28, rightclickInfoDialog_y + 112); text_xoffset = 0; fun_drawGameText( 65, walker_name[64 * walkerId], rightclickInfoDialog_x + text_xoffset + 90, rightclickInfoDialog_y + 108, graphic_font + 804, 0); text_xoffset = 0; fun_drawGameText( 37, scn_enemy + 20, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 149, graphic_font + 1206, 0); } } else { if ( walkers[walkerId].type == Walker_TradeCaravanDonkey ) walkerId = walkers[walkerId].tradeCaravanNextId; if ( walkers[walkerId].type == Walker_TradeCaravanDonkey ) walkerId = walkers[walkerId].tradeCaravanNextId; v43 = walkers[walkerId].tradeCityId; text_xoffset = 0; fun_drawGameText( 64, walkers[walkerId].type, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 110, graphic_font + 1206, 0); fun_drawGameText( 21, tradeRoutes[v43].cityNameId, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 110, graphic_font + 1206, 0); text_xoffset = 0; fun_drawGameText( 129, 1, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 130, graphic_font + 1206, 0); if ( walkers[walkerId].type == Walker_TradeShip ) v42 = 12; else v42 = 8; fun_drawNumberSingularPlural( 8, 10, v42, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 130, graphic_font + 1206, 0); v37 = byte_7FA3AD[128 * walkerId]; if ( walkers[walkerId].type == Walker_TradeShip ) { switch ( walkers[walkerId].actionState ) { case 114: fun_drawGameText(129, 6, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; case 112: fun_drawGameText(129, 7, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; case 115: fun_drawGameText(129, 8, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; default: fun_drawGameText(129, 9, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; } } else { switch ( walkers[walkerId].actionState ) { case 102: fun_drawGameText(129, 10, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; case 103: if ( dword_993F64[12 * v37] || dword_993F60[12 * v37] ) fun_drawGameText( 129, 11, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); else fun_drawGameText( 129, 13, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; case 101: fun_drawGameText(129, 12, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; default: fun_drawGameText(129, 11, rightclickInfoDialog_x + 40, rightclickInfoDialog_y + 150, graphic_font + 1206, 0); break; } } if ( dword_993F64[12 * v37] || dword_993F60[12 * v37] ) { text_xoffset = 0; fun_drawGameText( 129, 4, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 170, graphic_font + 1206, 0); for ( i = 1; i < 16; ++i ) { if ( *(&byte_993F68[48 * v37] + i) ) { drawNumber( *(&byte_993F68[48 * v37] + i), 64, " ", rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 170, graphic_font + 1206, 0); v9 = rightclickInfoDialog_y + 167; v10 = rightclickInfoDialog_x + text_xoffset + 40; v11 = i + graphic_resourceIcons; v12 = fun_getResourceGraphicIdOffset(i, 3); drawGraphic(v12 + v11, v10, v9); text_xoffset += 25; } } text_xoffset = 0; fun_drawGameText( 129, 5, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); for ( j = 1; j < 16; ++j ) { if ( *(&byte_993F78[48 * v37] + j) ) { drawNumber( *(&byte_993F78[48 * v37] + j), 64, " ", rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); v13 = rightclickInfoDialog_y + 197; v14 = rightclickInfoDialog_x + text_xoffset + 40; v15 = j + graphic_resourceIcons; v16 = fun_getResourceGraphicIdOffset(j, 3); drawGraphic(v16 + v15, v14, v13); text_xoffset += 25; } } } else { text_xoffset = 0; fun_drawGameText( 129, 2, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 170, graphic_font + 1206, 0); for ( k = 1; k < 16; ++k ) { if ( tradeRoutes[v43].buysFlag[k] ) { v1 = rightclickInfoDialog_y + 167; v2 = rightclickInfoDialog_x + text_xoffset + 40; v3 = k + graphic_resourceIcons; v4 = fun_getResourceGraphicIdOffset(k, 3); drawGraphic(v4 + v3, v2, v1); text_xoffset += 25; } } text_xoffset = 0; fun_drawGameText( 129, 3, rightclickInfoDialog_x + text_xoffset + 40, rightclickInfoDialog_y + 200, graphic_font + 1206, 0); for ( l = 1; l < 16; ++l ) { if ( tradeRoutes[v43].sellsFlag[l] ) { v5 = rightclickInfoDialog_y + 197; v6 = rightclickInfoDialog_x + text_xoffset + 40; v7 = l + graphic_resourceIcons; v8 = fun_getResourceGraphicIdOffset(l, 3); drawGraphic(v8 + v7, v6, v5); text_xoffset += 25; } } } } } GoodType fun_convertCollectIdToResourceId(int collectId) { GoodType resourceId; // [sp+4Ch] [bp-4h]@1 resourceId = (GoodType)0; if ( !collectId ) resourceId = G_Wheat; if ( collectId == 1 ) resourceId = G_Vegetables; if ( collectId == 2 ) resourceId = G_Fruit; if ( collectId == 3 ) resourceId = G_MeatFish; if ( collectId == 4 ) resourceId = G_Wine; if ( collectId == 5 ) resourceId = G_Oil; if ( collectId == 6 ) resourceId = G_Furniture; if ( collectId == 7 ) resourceId = G_Pottery; return resourceId; } //----- (004EBF50) -------------------------------------------------------- void sub_4EBF50(int a1) { text_xoffset = 0; drawGraphic(word_6E6CBC + 13, rightclickInfoDialog_x + 34, a1 + 4); drawNumber( buildings[currentlySelectedBuilding].house_population, 64, " ", rightclickInfoDialog_x + text_xoffset + 50, a1 + 14, graphic_font + 1206, 0); fun_drawGameText(127, 20, rightclickInfoDialog_x + text_xoffset + 50, a1 + 14, graphic_font + 1206, 0); if ( buildings[currentlySelectedBuilding].house_roomForPeople >= 0 ) { if ( buildings[currentlySelectedBuilding].house_roomForPeople > 0 ) { fun_drawGameText(127, 22, rightclickInfoDialog_x + text_xoffset + 50, a1 + 14, graphic_font + 1206, 0); drawNumber( buildings[currentlySelectedBuilding].house_roomForPeople, 64, " ", rightclickInfoDialog_x + text_xoffset + 50, a1 + 14, graphic_font + 1206, 0); } } else { drawNumber( -buildings[currentlySelectedBuilding].house_roomForPeople, 64, " ", rightclickInfoDialog_x + text_xoffset + 50, a1 + 14, graphic_font + 1206, 0); fun_drawGameText(127, 21, rightclickInfoDialog_x + text_xoffset + 50, a1 + 14, graphic_font + 1206, 0); } } void sub_4EC1B0(int a1) { int v1; // ST6C_4@3 int v2; // ST68_4@3 text_xoffset = 0; if ( buildings[currentlySelectedBuilding].house_taxcollector ) { v1 = fun_adjustWithPercentage( building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * currentlySelectedBuilding] / 2, city_inform[ciid].taxrate); fun_drawGameText(127, 24, rightclickInfoDialog_x + text_xoffset + 36, a1, graphic_font + 1206, 0); v2 = text_xoffset; fun_drawNumberSingularPlural(8, 0, v1, rightclickInfoDialog_x + text_xoffset + 36, a1, graphic_font + 1206, 0); text_xoffset += v2; fun_drawGameText(127, 25, rightclickInfoDialog_x + text_xoffset + 36, a1, graphic_font + 1206, 0); } else { fun_drawGameText(127, 23, rightclickInfoDialog_x + text_xoffset + 36, a1, graphic_font + 1206, 0); } } void sub_4EC350(int a1) { if ( buildings[currentlySelectedBuilding].house_crimeRisk < 50 ) { if ( buildings[currentlySelectedBuilding].house_crimeRisk < 40 ) { if ( buildings[currentlySelectedBuilding].house_crimeRisk < 30 ) { if ( buildings[currentlySelectedBuilding].house_crimeRisk < 20 ) { if ( buildings[currentlySelectedBuilding].house_crimeRisk < 10 ) { if ( buildings[currentlySelectedBuilding].house_crimeRisk < 1 ) fun_drawGameText(127, 32, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); else fun_drawGameText(127, 31, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); } else { fun_drawGameText(127, 30, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); } } else { fun_drawGameText(127, 29, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); } } else { fun_drawGameText(127, 28, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); } } else { fun_drawGameText(127, 27, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); } } else { fun_drawGameText(127, 26, rightclickInfoDialog_x + 36, a1, graphic_font + 1206, 0); } } void fun_drawRightClickWorkerInfo(int a1) { int v1; // [sp+4Ch] [bp-4h]@2 if ( model_buildings[buildings[currentlySelectedBuilding].type].laborers > buildings[currentlySelectedBuilding].num_workers ) { if ( city_inform[ciid].population > 0 ) { if ( buildings[currentlySelectedBuilding].walkerServiceAccess > 0 ) { if ( buildings[currentlySelectedBuilding].walkerServiceAccess >= 40 ) { if( city_inform[ciid].labor_category_priority[ buildings[currentlySelectedBuilding].laborCategory ].workersAllocated > 0 ) v1 = 19; // too few people allocated else v1 = 18; // no people allocated } else { v1 = 20; // poor access to employees } } else { v1 = 17; // no employees nearby } } else { v1 = 16; // no people in city } } else { v1 = 0; // fully staffed } if ( !v1 ) { if ( buildings[currentlySelectedBuilding].walkerServiceAccess < 40 ) v1 = 20; // warning poor access to employees } drawGraphic(word_6E6CBC + 14, rightclickInfoDialog_x + 40, a1 + 6); if ( v1 ) { text_xoffset = 0; fun_drawNumberSingularPlural( 8, 12, buildings[currentlySelectedBuilding].num_workers, rightclickInfoDialog_x + 60, a1 + 10, graphic_font + F_SmallBlack, 0); drawNumber( model_buildings[buildings[currentlySelectedBuilding].type].laborers, 40, " ", rightclickInfoDialog_x + text_xoffset + 70, a1 + 10, graphic_font + F_SmallBlack, 0); fun_drawGameText(69, 0, rightclickInfoDialog_x + text_xoffset + 70, a1 + 10, graphic_font + F_SmallBlack, 0); text_xoffset = 0; fun_drawGameText(69, v1, rightclickInfoDialog_x + text_xoffset + 70, a1 + 26, graphic_font + F_SmallBlack, 0); } else { text_xoffset = 0; fun_drawNumberSingularPlural( 8, 12, buildings[currentlySelectedBuilding].num_workers, rightclickInfoDialog_x + 60, a1 + 16, graphic_font + 1206, 0); drawNumber( model_buildings[buildings[currentlySelectedBuilding].type].laborers, 40, " ", rightclickInfoDialog_x + text_xoffset + 70, a1 + 16, graphic_font + 1206, 0); fun_drawGameText(69, 0, rightclickInfoDialog_x + text_xoffset + 70, a1 + 16, graphic_font + 1206, 0); } } void showBuildingInfoAmphitheater() { dialog_help_id = 72; if ( canPlayCurrentSound ) { fun_playSound("wavs\\ampitheatre.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 71, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].house_clinic ) { if ( buildings[currentlySelectedBuilding].house_clinic == 2 ) { fun_drawGameTextWrapped( 71, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days ) { fun_drawGameTextWrapped( 71, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_hospital_entert_days2 ) fun_drawGameTextWrapped( 71, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 71, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 71, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 7); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 138); if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days > 0 ) { text_xoffset = 0; fun_drawGameText(71, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); fun_drawNumberSingularPlural( 8, 44, 2 * buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); } else { fun_drawGameText(71, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); } if ( buildings[currentlySelectedBuilding].house_hospital_entert_days2 > 0 ) { text_xoffset = 0; fun_drawGameText(71, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); fun_drawNumberSingularPlural( 8, 44, 2 * buildings[currentlySelectedBuilding].house_hospital_entert_days2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); fun_drawGameText( 72, buildings[currentlySelectedBuilding].house_ceres + 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 222, graphic_font + 1206, 0); } else { fun_drawGameText(71, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); } } void fun_showBuildingInfoTheater() { dialog_help_id = 71; if ( canPlayCurrentSound ) { fun_playSound("wavs\\theatre.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 72, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].house_clinic ) { if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days ) fun_drawGameTextWrapped( 72, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 72, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 72, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 6); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 138); if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days > 0 ) { text_xoffset = 0; fun_drawGameText(72, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); fun_drawNumberSingularPlural( 8, 44, 2 * buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); fun_drawGameText( 72, buildings[currentlySelectedBuilding].house_ceres + 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); } else { fun_drawGameText(72, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); } } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004ED330) -------------------------------------------------------- void fun_showBuildingInfoHippodrome() { dialog_help_id = 74; if ( canPlayCurrentSound ) { fun_playSound("wavs\\hippodrome.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 73, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].house_clinic ) { if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days ) fun_drawGameTextWrapped( 73, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 73, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 73, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 6); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 138); if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days > 0 ) { text_xoffset = 0; fun_drawGameText(73, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); fun_drawNumberSingularPlural( 8, 44, 2 * buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); } else { fun_drawGameText(73, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); } } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004ED6D0) -------------------------------------------------------- void fun_showBuildingInfoColosseum() { dialog_help_id = 73; if ( canPlayCurrentSound ) { fun_playSound("wavs\\colloseum.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 74, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].house_clinic ) { if ( buildings[currentlySelectedBuilding].house_clinic == 2 ) { fun_drawGameTextWrapped( 74, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days ) { fun_drawGameTextWrapped( 74, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_hospital_entert_days2 ) fun_drawGameTextWrapped( 74, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 74, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 74, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 6); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 138); if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days > 0 ) { text_xoffset = 0; fun_drawGameText(74, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); fun_drawNumberSingularPlural( 8, 44, 2 * buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); } else { fun_drawGameText(74, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 182, graphic_font + 1206, 0); } if ( buildings[currentlySelectedBuilding].house_hospital_entert_days2 > 0 ) { text_xoffset = 0; fun_drawGameText(74, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); fun_drawNumberSingularPlural( 8, 44, 2 * buildings[currentlySelectedBuilding].house_hospital_entert_days2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); } else { fun_drawGameText(74, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 202, graphic_font + 1206, 0); } } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EDC50) -------------------------------------------------------- void fun_showBuildingInfoGladiatorSchool() { dialog_help_id = 75; if ( canPlayCurrentSound ) { fun_playSound("wavs\\glad_pit.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 75, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 75, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 75, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 75, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 75, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 75, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 75, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EDFE0) -------------------------------------------------------- void fun_showBuildingInfoLionHouse() { dialog_help_id = 75; if ( canPlayCurrentSound ) { fun_playSound("wavs\\lion_pit.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 76, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 76, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 76, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 76, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 76, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 76, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 76, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EE370) -------------------------------------------------------- void fun_showBuildingInfoActorColony() { dialog_help_id = 75; if ( canPlayCurrentSound ) { fun_playSound("wavs\\art_pit.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 77, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 77, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 77, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 77, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 77, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 77, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 77, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EE700) -------------------------------------------------------- void fun_showBuildingInfoChariotMaker() { dialog_help_id = 75; if ( canPlayCurrentSound ) { fun_playSound("wavs\\char_pit.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 78, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 78, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 78, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 78, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 78, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 78, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 78, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EEA90) -------------------------------------------------------- void fun_showBuildingInfoGarden() { dialog_help_id = 80; if ( canPlayCurrentSound ) { fun_playSound("wavs\\park.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 79, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 79, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EEBB0) -------------------------------------------------------- void fun_showBuildingInfoWall() { dialog_help_id = 85; if ( canPlayCurrentSound ) { fun_playSound("wavs\\wall.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 139, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 139, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EECD0) -------------------------------------------------------- void fun_showBuildingInfoAqueduct() { dialog_help_id = 60; if ( canPlayCurrentSound ) { fun_playSound("wavs\\aquaduct.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 141, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E358 ) fun_drawGameTextWrapped( 141, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 141, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E358: using guessed type int dword_64E358; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EEE60) -------------------------------------------------------- void fun_showBuildingInfoPlaza() { dialog_help_id = 80; if ( canPlayCurrentSound ) { fun_playSound("wavs\\plaza.wav", 1, 0); canPlayCurrentSound = 0; } sub_4E9BA0(); fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 137, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); sub_4EA150(); fun_drawGameTextWrapped( 137, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EEF90) -------------------------------------------------------- void fun_showBuildingInfoStatue() { dialog_help_id = 79; if ( canPlayCurrentSound ) { fun_playSound("wavs\\statue.wav", 1, 0); canPlayCurrentSound = 0; } sub_4E9BA0(); fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 80, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 80, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EF0B0) -------------------------------------------------------- void fun_showBuildingInfoTriumphalArch() { dialog_help_id = 79; if ( canPlayCurrentSound ) { fun_playSound("wavs\\statue.wav", 1, 0); canPlayCurrentSound = 0; } sub_4E9BA0(); fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 80, 2, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 80, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004EF1D0) -------------------------------------------------------- void fun_showBuildingInfoDoctor() { dialog_help_id = 65; if ( canPlayCurrentSound ) { fun_playSound("wavs\\clinic.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 81, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 81, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 81, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EF3F0) -------------------------------------------------------- void fun_showBuildingInfoHospital() { dialog_help_id = 66; if ( canPlayCurrentSound ) { fun_playSound("wavs\\hospital.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 82, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 82, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 82, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EF610) -------------------------------------------------------- void fun_showBuildingInfoBathhouse() { dialog_help_id = 64; if ( canPlayCurrentSound ) { fun_playSound("wavs\\baths.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 83, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( buildings[currentlySelectedBuilding].hasFountain ) { if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 83, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 83, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 83, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EF8A0) -------------------------------------------------------- void fun_showBuildingInfoBarber() { dialog_help_id = 63; if ( canPlayCurrentSound ) { fun_playSound("wavs\\barber.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 84, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 84, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 84, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EFAC0) -------------------------------------------------------- void fun_showBuildingInfoSchool() { dialog_help_id = 68; if ( canPlayCurrentSound ) { fun_playSound("wavs\\school.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 85, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 85, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 85, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EFCE0) -------------------------------------------------------- void fun_showBuildingInfoAcademy() { dialog_help_id = 69; if ( canPlayCurrentSound ) { fun_playSound("wavs\\academy.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 86, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 86, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 86, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004EFF00) -------------------------------------------------------- void fun_showBuildingInfoLibrary() { dialog_help_id = 70; if ( canPlayCurrentSound ) { fun_playSound("wavs\\library.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 87, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 87, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 87, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004F0120) -------------------------------------------------------- void fun_showBuildingInfoPrefecture() { dialog_help_id = 86; if ( canPlayCurrentSound ) { fun_playSound("wavs\\prefecture.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 88, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( buildings[currentlySelectedBuilding].walkerId ) fun_drawGameTextWrapped( 88, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 88, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 88, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 88, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 88, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 88, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 88, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 88, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD62: using guessed type __int16 building_22_walkerId[]; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004F0560) -------------------------------------------------------- void fun_showBuildingInfoFortGround() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = currentFormationID; dialog_help_id = 87; if ( canPlayCurrentSound ) { fun_playSound("wavs\\fort.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 89, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( formations[v0].cursedByMars ) fun_drawGameTextWrapped( 89, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 89, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E324: using guessed type int dword_64E324; // 6E6BD0: using guessed type __int16 graphic_font; // 7F881C: using guessed type __int16 formation_cursedByMars[]; //----- (004F0700) -------------------------------------------------------- void fun_showBuildingInfoGatehouse() { dialog_help_id = 85; if ( canPlayCurrentSound ) { fun_playSound("wavs\\gatehouse.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 90, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 90, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 158, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004F0820) -------------------------------------------------------- void fun_showBuildingInfoTower() { dialog_help_id = 85; if ( canPlayCurrentSound ) { fun_playSound("wavs\\tower.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 91, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].walkerId > 0 ) fun_drawGameTextWrapped( 91, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 91, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 91, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD62: using guessed type __int16 building_22_walkerId[]; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004F0AA0) -------------------------------------------------------- void fun_showBuildingInfoMilitaryAcademy() { dialog_help_id = 88; if ( canPlayCurrentSound ) { fun_playSound("wavs\\mil_acad.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 135, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers >= model_buildings[buildings[currentlySelectedBuilding].type].laborers ) fun_drawGameTextWrapped( 135, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 135, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 135, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD4A: using guessed type __int16 building_0a_type[]; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004F0D50) -------------------------------------------------------- void fun_showBuildingInfoBarracks() { dialog_help_id = 37; if ( canPlayCurrentSound ) { fun_playSound("wavs\\barracks.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 136, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); drawGraphic(graphic_resourceIcons + 13, rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 38); text_xoffset = 0; fun_drawGameText(136, 2, rightclickInfoDialog_x + 92, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].industry_unitsStored < 1 ) fun_drawNumberSingularPlural( 8, 10, 0, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 44, graphic_font + 134, 0); else fun_drawNumberSingularPlural( 8, 10, buildings[currentlySelectedBuilding].industry_unitsStored, rightclickInfoDialog_x + text_xoffset + 92, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( dword_64E2C4[0] ) { if ( buildings[currentlySelectedBuilding].industry_unitsStored > 0 ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 66 ) { if ( currentBuilding_workerPercentage < 33 ) fun_drawGameTextWrapped( 136, 12, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 136, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 136, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 136, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 66 ) { if ( currentBuilding_workerPercentage < 33 ) fun_drawGameTextWrapped( 136, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 136, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 136, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 136, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 136, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 136, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E2C4: using guessed type int dword_64E2C4[15]; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD74: using guessed type __int16 building_34_industry_unitsStored[]; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004F13C0) -------------------------------------------------------- void fun_showBuildingInfoTempleCeres() { dialog_help_id = 67; if ( canPlayCurrentSound ) { fun_playSound("wavs\\temple_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 92, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 12, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 56, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 62); if ( dword_64E370 > 0 ) drawGraphic( graphic_panelwindows + 21, rightclickInfoDialog_x + 190, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 118); else fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6C6E: using guessed type __int16 graphic_panelwindows; //----- (004F1570) -------------------------------------------------------- void fun_showBuildingInfoTempleNeptune() { dialog_help_id = 67; if ( canPlayCurrentSound ) { fun_playSound("wavs\\temple_ship.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 93, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 12, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 56, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 62); if ( dword_64E370 > 0 ) drawGraphic( graphic_panelwindows + 22, rightclickInfoDialog_x + 190, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 118); else fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6C6E: using guessed type __int16 graphic_panelwindows; //----- (004F1720) -------------------------------------------------------- void fun_showBuildingInfoTempleMercury() { dialog_help_id = 67; if ( canPlayCurrentSound ) { fun_playSound("wavs\\temple_comm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 94, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 12, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 56, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 62); if ( dword_64E370 > 0 ) drawGraphic( graphic_panelwindows + 23, rightclickInfoDialog_x + 190, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 118); else fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6C6E: using guessed type __int16 graphic_panelwindows; //----- (004F18D0) -------------------------------------------------------- void fun_showBuildingInfoTempleMars() { dialog_help_id = 67; if ( canPlayCurrentSound ) { fun_playSound("wavs\\temple_war.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 95, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 12, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 56, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 62); if ( dword_64E370 > 0 ) drawGraphic( graphic_panelwindows + 24, rightclickInfoDialog_x + 190, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 118); else fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6C6E: using guessed type __int16 graphic_panelwindows; //----- (004F1A80) -------------------------------------------------------- void fun_showBuildingInfoTempleVenus() { dialog_help_id = 67; if ( canPlayCurrentSound ) { fun_playSound("wavs\\temple_love.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 96, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 12, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 56, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 62); if ( dword_64E370 > 0 ) drawGraphic( graphic_panelwindows + 25, rightclickInfoDialog_x + 190, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 118); else fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 128, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoMarket() { int v0; // ST18_4@12 int v1; // ST14_4@12 int v2; // esi@12 signed int v3; // eax@12 dialog_help_id = 2; if ( canPlayCurrentSound ) { fun_playSound("wavs\\market.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 97, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].granary_capacity[0] || buildings[currentlySelectedBuilding].house_wheat || buildings[currentlySelectedBuilding].house_vegetables || buildings[currentlySelectedBuilding].house_wine ) { drawGraphic(graphic_resourceIcons + 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 64); drawNumber( buildings[currentlySelectedBuilding].granary_capacity[0], 64, " ", rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 70, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 2, rightclickInfoDialog_x + 142, rightclickInfoDialog_y + 64); drawNumber( buildings[currentlySelectedBuilding].house_wheat, 64, " ", rightclickInfoDialog_x + 174, rightclickInfoDialog_y + 70, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 3, rightclickInfoDialog_x + 252, rightclickInfoDialog_y + 64); drawNumber( buildings[currentlySelectedBuilding].house_vegetables, 64, " ", rightclickInfoDialog_x + 284, rightclickInfoDialog_y + 70, graphic_font + 134, 0); v0 = rightclickInfoDialog_y + 64; v1 = rightclickInfoDialog_x + 362; v2 = graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(6, 3); drawGraphic(v2 + v3 + 6, v1, v0); drawNumber( buildings[currentlySelectedBuilding].house_wine, 64, " ", rightclickInfoDialog_x + 394, rightclickInfoDialog_y + 70, graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 97, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 48, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } drawGraphic(graphic_resourceIcons + 15, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 104); drawNumber( buildings[currentlySelectedBuilding].house_theater_amphi_wine, 64, " ", rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 110, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 14, rightclickInfoDialog_x + 142, rightclickInfoDialog_y + 104); drawNumber( buildings[currentlySelectedBuilding].house_pottery, 64, " ", rightclickInfoDialog_x + 174, rightclickInfoDialog_y + 110, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 8, rightclickInfoDialog_x + 252, rightclickInfoDialog_y + 104); drawNumber( buildings[currentlySelectedBuilding].house_furniture, 64, " ", rightclickInfoDialog_x + 284, rightclickInfoDialog_y + 110, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 7, rightclickInfoDialog_x + 362, rightclickInfoDialog_y + 104); drawNumber( buildings[currentlySelectedBuilding].house_oil, 64, " ", rightclickInfoDialog_x + 394, rightclickInfoDialog_y + 110, graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 97, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoGranary() { int v0; // esi@23 signed int v1; // eax@23 int v2; // [sp+4Ch] [bp-10h]@23 int v3; // [sp+50h] [bp-Ch]@18 int v4; // [sp+54h] [bp-8h]@7 signed int v5; // [sp+58h] [bp-4h]@7 int i; // [sp+58h] [bp-4h]@10 dialog_help_id = 3; if ( canPlayCurrentSound ) { fun_playSound("wavs\\granary.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 98, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( scn_romeSuppliesWheat ) { fun_drawGameTextWrapped( 98, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 40, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { v5 = 1; v4 = 0; while ( v5 < 7 ) v4 += buildings[currentlySelectedBuilding].granary_capacity[v5++]; text_xoffset = 0; fun_drawGameText( 98, 2, rightclickInfoDialog_x + text_xoffset + 34, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawNumberSingularPlural( 8, 16, v4, rightclickInfoDialog_x + text_xoffset + 34, rightclickInfoDialog_y + 40, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText( 98, 3, rightclickInfoDialog_x + text_xoffset + 220, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawNumberSingularPlural( 8, 16, buildings[currentlySelectedBuilding].granary_capacity[0], rightclickInfoDialog_x + text_xoffset + 220, rightclickInfoDialog_y + 40, graphic_font + 134, 0); for ( i = 1; i < 7; ++i ) { if ( i != 4 ) { if ( i != 5 ) { if ( i >= 3 ) { v3 = rightclickInfoDialog_x + 240; if ( i == 3 ) { v2 = rightclickInfoDialog_y + 68; } else { if ( i == 6 ) v2 = rightclickInfoDialog_y + 92; } } else { v3 = rightclickInfoDialog_x + 34; v2 = rightclickInfoDialog_y + 24 * (i - 1) + 68; } v0 = i + graphic_resourceIcons; v1 = fun_getResourceGraphicIdOffset(i, 3); drawGraphic(v1 + v0, v3, v2); text_xoffset = 0; drawNumber( buildings[currentlySelectedBuilding].granary_capacity[i], 64, " ", v3 + 34, v2 + 7, graphic_font + 134, 0); fun_drawGameText(23, i, v3 + text_xoffset + 34, v2 + 7, graphic_font + 134, 0); } } } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 40, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_drawGranarySpecialOrdersButton() { if ( mouseover_button_id == 1 ) fun_drawBorderedButton( 0, rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 1); else fun_drawBorderedButton( 0, rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 0); fun_drawGameTextCentered( 98, 5, rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 30, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); } void fun_showGranaryInstructionsDialog() { dialog_help_id = 3; fun_drawDialogBackground(rightclickInfoDialog_x, 32, 29, 28); fun_drawGameTextCentered( 98, 6, rightclickInfoDialog_x, 42, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox(rightclickInfoDialog_x + 16, 74, rightclickInfoDialog_widthBlocks - 2, 21); } void sub_4F29B0() { int v0; // ST14_4@9 int v1; // esi@9 signed int v2; // eax@9 int v3; // ST14_4@9 int v4; // esi@9 signed int v5; // eax@9 int v6; // [sp+50h] [bp-10h]@1 int v7; // [sp+54h] [bp-Ch]@10 int v8; // [sp+58h] [bp-8h]@9 int i; // [sp+5Ch] [bp-4h]@7 v6 = buildings[currentlySelectedBuilding].storageId; if ( mouseover_button_id == 1 ) fun_drawBorderedButton(0, rightclickInfoDialog_x + 80, 436, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 1); else fun_drawBorderedButton(0, rightclickInfoDialog_x + 80, 436, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 0); if ( storages[v6].emptyAll ) { fun_drawGameTextCentered( 98, 8, rightclickInfoDialog_x + 80, 440, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); fun_drawGameTextCentered( 98, 9, rightclickInfoDialog_x + 80, 416, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); } else { fun_drawGameTextCentered( 98, 7, rightclickInfoDialog_x + 80, 440, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); } for ( i = 0; i < availableFoods_count; ++i ) { v8 = foodlist_indexToResourceId1[i]; v0 = rightclickInfoDialog_x + 32; v1 = v8 + graphic_resourceIcons; v2 = fun_getResourceGraphicIdOffset(v8, 3); drawGraphic(v2 + v1, v0, 22 * i + 78); v3 = rightclickInfoDialog_x + 408; v4 = v8 + graphic_resourceIcons; v5 = fun_getResourceGraphicIdOffset(v8, 3); drawGraphic(v5 + v4, v3, 22 * i + 78); fun_drawGameText(23, v8, rightclickInfoDialog_x + 72, 22 * i + 82, graphic_font + 268, 0); v7 = mouseover_button_id_main == i + 1; fun_drawBorderedButton(0, rightclickInfoDialog_x + 180, 22 * i + 78, 210, 22, v7); if ( storages[v6].resourceState[v8] ) { if ( storages[v6].resourceState[v8] == 1 ) { fun_drawGameText(99, 8, rightclickInfoDialog_x + 230, 22 * i + 83, graphic_font + 402, 0); } else { if ( storages[v6].resourceState[v8] == 2 ) { drawGraphic(word_6E6CBC + 12, rightclickInfoDialog_x + 186, 22 * i + 81); fun_drawGameText(99, 10, rightclickInfoDialog_x + 230, 22 * i + 83, graphic_font + 268, 0); } } } else { fun_drawGameText(99, 7, rightclickInfoDialog_x + 230, 22 * i + 83, graphic_font + 268, 0); } } } void fun_showBuildingInfoWarehouse() { int v0; // esi@12 signed int v1; // eax@12 int v2; // ST18_4@20 int v3; // ST14_4@20 int v4; // esi@20 signed int v5; // eax@20 int v6; // ST18_4@24 int v7; // ST14_4@24 int v8; // esi@24 signed int v9; // eax@24 int v10; // [sp+4Ch] [bp-14h]@13 int v11; // [sp+50h] [bp-10h]@8 int v12; // [sp+54h] [bp-Ch]@8 int v13; // [sp+58h] [bp-8h]@7 int i; // [sp+5Ch] [bp-4h]@5 dialog_help_id = 4; if ( canPlayCurrentSound ) { fun_playSound("wavs\\warehouse.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 99, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { for ( i = 1; i < GoodCount; ++i ) { v13 = fun_getGoodAmountStoredInWarehouse(currentlySelectedBuilding, i); if ( i > 5 ) { if ( i > 10 ) { v12 = rightclickInfoDialog_x + 320; v11 = rightclickInfoDialog_y + 24 * (i - 11) + 36; } else { v12 = rightclickInfoDialog_x + 170; v11 = rightclickInfoDialog_y + 24 * (i - 6) + 36; } } else { v12 = rightclickInfoDialog_x + 20; v11 = rightclickInfoDialog_y + 24 * (i - 1) + 36; } v0 = i + graphic_resourceIcons; v1 = fun_getResourceGraphicIdOffset(i, 3); drawGraphic(v1 + v0, v12, v11); text_xoffset = 0; drawNumber(v13, 64, " ", v12 + 24, v11 + 7, graphic_font + 938, 0); fun_drawGameText(23, i, v12 + text_xoffset + 24, v11 + 7, graphic_font + 938, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 168, rightclickInfoDialog_widthBlocks - 2, 5); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 173); v10 = buildings[currentlySelectedBuilding].walkerId; if ( buildings[currentlySelectedBuilding].walkerId && walkers[v10].state == 1 ) { if ( walkers[v10].actionState != 53 && walkers[v10].actionState != 56 && walkers[v10].actionState != 59 ) { if ( buildings[currentlySelectedBuilding].walkerId ) { if ( walkers[v10].state == 1 ) { v6 = rightclickInfoDialog_y + 220; v7 = rightclickInfoDialog_x + 32; v8 = walkers[v10].cartPusherGoodType + graphic_resourceIcons; v9 = fun_getResourceGraphicIdOffset(walkers[v10].cartPusherGoodType, 3); drawGraphic(v9 + v8, v7, v6); } } fun_drawGameTextWrapped( 99, 17, rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 223, 16 * (rightclickInfoDialog_widthBlocks - 6), graphic_font + 1206, 0); } else { if ( buildings[currentlySelectedBuilding].walkerId ) { if ( walkers[v10].state == 1 ) { v2 = rightclickInfoDialog_y + 220; v3 = rightclickInfoDialog_x + 32; v4 = walkers[v10].cartPusherGoodType + graphic_resourceIcons; v5 = fun_getResourceGraphicIdOffset(walkers[v10].cartPusherGoodType, 3); drawGraphic(v5 + v4, v3, v2); } } fun_drawGameTextWrapped( 99, 17, rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 223, 16 * (rightclickInfoDialog_widthBlocks - 6), graphic_font + 1206, 0); } } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 99, 15, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 223, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 1206, 0); } if ( dword_64E368 == 1 ) { fun_drawGameTextWrapped( 99, 13, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 93, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( dword_64E368 == 2 ) fun_drawGameTextWrapped( 99, 14, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 93, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } void fun_drawWarehouseSpecialOrdersButton() { if ( mouseover_button_id == 1 ) fun_drawBorderedButton( 0, rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 1); else fun_drawBorderedButton( 0, rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 34, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 0); fun_drawGameTextCentered( 99, 2, rightclickInfoDialog_x + 80, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 30, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); } void fun_showWarehouseInstructionsDialog() { dialog_help_id = 4; fun_drawDialogBackground(rightclickInfoDialog_x, 32, 29, 28); fun_drawGameTextCentered( 99, 3, rightclickInfoDialog_x, 42, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawSunkenTextBox(rightclickInfoDialog_x + 16, 74, rightclickInfoDialog_widthBlocks - 2, 21); } void sub_4F3640() { int v0; // ST14_4@15 int v1; // esi@15 signed int v2; // eax@15 int v3; // ST14_4@15 int v4; // esi@15 signed int v5; // eax@15 int storageId; // [sp+50h] [bp-10h]@1 int v7; // [sp+54h] [bp-Ch]@16 int v8; // [sp+58h] [bp-8h]@15 int i; // [sp+5Ch] [bp-4h]@13 storageId = buildings[currentlySelectedBuilding].storageId; if ( mouseover_button_id == 1 ) fun_drawBorderedButton(0, rightclickInfoDialog_x + 80, 436, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 1); else fun_drawBorderedButton(0, rightclickInfoDialog_x + 80, 436, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 0); if ( storages[storageId].emptyAll ) { fun_drawGameTextCentered( 99, 5, rightclickInfoDialog_x + 80, 440, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); fun_drawGameTextCentered( 99, 6, rightclickInfoDialog_x + 80, 458, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 938, 0); } else { fun_drawGameTextCentered( 99, 4, rightclickInfoDialog_x + 80, 440, 16 * (rightclickInfoDialog_widthBlocks - 10), graphic_font + 134, 0); } if ( mouseover_button_id == 2 ) fun_drawBorderedButton(0, rightclickInfoDialog_x + 80, 414, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 1); else fun_drawBorderedButton(0, rightclickInfoDialog_x + 80, 414, 16 * (rightclickInfoDialog_widthBlocks - 10), 20, 0); if ( currentlySelectedBuilding == city_inform[ciid].tradeCenterId ) fun_drawGameTextCentered(99,11,rightclickInfoDialog_x + 80,418,16 * (rightclickInfoDialog_widthBlocks - 10),graphic_font + 134,0); else fun_drawGameTextCentered(99,12,rightclickInfoDialog_x + 80,418,16 * (rightclickInfoDialog_widthBlocks - 10),graphic_font + 134,0); for ( i = 0; i < availableGoods_count; ++i ) { v8 = goodlist_indexToResourceId1[i]; v0 = rightclickInfoDialog_x + 32; v1 = v8 + graphic_resourceIcons; v2 = fun_getResourceGraphicIdOffset(v8, 3); drawGraphic(v2 + v1, v0, 22 * i + 78); v3 = rightclickInfoDialog_x + 408; v4 = v8 + graphic_resourceIcons; v5 = fun_getResourceGraphicIdOffset(v8, 3); drawGraphic(v5 + v4, v3, 22 * i + 78); fun_drawGameText(23, v8, rightclickInfoDialog_x + 72, 22 * i + 82, graphic_font + 268, 0); v7 = mouseover_button_id_main == i + 1; fun_drawBorderedButton(0, rightclickInfoDialog_x + 180, 22 * i + 78, 210, 22, v7); if ( storages[storageId].resourceState[ v8] ) { if ( storages[storageId].resourceState[ v8 ] == 1 ) { fun_drawGameText(99, 8, rightclickInfoDialog_x + 230, 22 * i + 83, graphic_font + 402, 0); } else { if ( storages[storageId].resourceState[ v8 ] == 2 ) { drawGraphic(word_6E6CBC + 12, rightclickInfoDialog_x + 186, 22 * i + 81); fun_drawGameText(99, 9, rightclickInfoDialog_x + 230, 22 * i + 83, graphic_font + 268, 0); } } } else { fun_drawGameText(99, 7, rightclickInfoDialog_x + 230, 22 * i + 83, graphic_font + 268, 0); } } } void fun_showBuildingInfoShipyard() { int v0; // ST68_4@5 dialog_help_id = 82; if ( canPlayCurrentSound ) { fun_playSound("wavs\\shipyard.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 100, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { v0 = getPercentage( buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 160); text_xoffset = 0; fun_drawGameText( 100, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 56, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 56, graphic_font + 134, 0); fun_drawGameText( 100, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 56, graphic_font + 134, 0); if ( city_inform[ciid].shipyardBoatsRequested ) fun_drawGameTextWrapped(100,5,rightclickInfoDialog_x + 32,rightclickInfoDialog_y + 80,16 * (rightclickInfoDialog_widthBlocks - 6),graphic_font + 134,0); else fun_drawGameTextWrapped(100,4,rightclickInfoDialog_x + 32,rightclickInfoDialog_y + 80,16 * (rightclickInfoDialog_widthBlocks - 6),graphic_font + 134,0); } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoDock() { dialog_help_id = 83; if ( canPlayCurrentSound ) { fun_playSound("wavs\\dock.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 101, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir ) { if ( currentBuilding_workerPercentage > 0 ) { if ( currentBuilding_workerPercentage >= 50 ) { if ( currentBuilding_workerPercentage >= 75 ) fun_drawGameTextWrapped( 101, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 101, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 101, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 101, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { if ( currentBuilding_workerPercentage > 0 ) { if ( currentBuilding_workerPercentage >= 50 ) { if ( currentBuilding_workerPercentage >= 75 ) fun_drawGameTextWrapped( 101, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 101, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 101, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 101, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoWharf() { int v0; // ST18_4@3 int v1; // ST14_4@3 int v2; // esi@3 signed int v3; // eax@3 int v4; // [sp+4Ch] [bp-4h]@7 dialog_help_id = 84; if ( canPlayCurrentSound ) { fun_playSound("wavs\\wharf.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 102, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = rightclickInfoDialog_y + 10; v1 = rightclickInfoDialog_x + 10; v2 = graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(6, 3); drawGraphic(v2 + v3 + 6, v1, v0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir > 0 ) { v4 = buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir; switch ( walkers[v4].actionState ) { case 0xBF: fun_drawGameTextWrapped( 102, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); break; case 0xC0: fun_drawGameTextWrapped( 102, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); break; case 0xC1: fun_drawGameTextWrapped( 102, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); break; case 0xC2: fun_drawGameTextWrapped( 102, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); break; case 0xC3: fun_drawGameTextWrapped( 102, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); break; default: fun_drawGameTextWrapped( 102, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); break; } } else { fun_drawGameTextWrapped( 102, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoGovernorsHome() { dialog_help_id = 78; if ( canPlayCurrentSound ) { fun_playSound("wavs\\gov_palace.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 103, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 103, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoEngineersPost() { dialog_help_id = 81; if ( canPlayCurrentSound ) { fun_playSound("wavs\\eng_post.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 104, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( buildings[currentlySelectedBuilding].walkerId ) fun_drawGameTextWrapped( 104, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 104, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 104, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 104, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 104, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 104, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 104, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 104, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoMissionPost() { dialog_help_id = 8; if ( canPlayCurrentSound ) { fun_playSound("wavs\\mission.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 134, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 134, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 106, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoNativeHut() { dialog_help_id = 0; if ( canPlayCurrentSound ) { fun_playSound("wavs\\empty_land.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 131, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 131, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoNativeMeeting() { dialog_help_id = 0; if ( canPlayCurrentSound ) { fun_playSound("wavs\\empty_land.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 132, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 132, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoNativeCrops() { dialog_help_id = 0; if ( canPlayCurrentSound ) { fun_playSound("wavs\\empty_land.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 133, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextWrapped( 133, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoSenate() { rightclickInfoDialog_advisor = 1; dialog_help_id = 77; if ( canPlayCurrentSound ) { fun_playSound("wavs\\senate.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 105, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); drawGraphic(graphic_resourceIcons + 16, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 36); text_xoffset = 0; fun_drawGameText( 105, 2, rightclickInfoDialog_x + text_xoffset + 44, rightclickInfoDialog_y + 43, graphic_font + 134, 0); fun_drawNumberSingularPlural( 8, 0, building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * currentlySelectedBuilding], rightclickInfoDialog_x + text_xoffset + 44, rightclickInfoDialog_y + 43, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 106, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 106, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 106, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 106, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 106, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 106, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameText(105, 3, rightclickInfoDialog_x + 60, rightclickInfoDialog_y + 220, graphic_font + 134, 0); } void fun_showBuildingInfoForum() { dialog_help_id = 76; if ( canPlayCurrentSound ) { fun_playSound("wavs\\forum.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 106, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); drawGraphic(graphic_resourceIcons + 16, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 36); text_xoffset = 0; fun_drawGameText( 106, 2, rightclickInfoDialog_x + text_xoffset + 44, rightclickInfoDialog_y + 43, graphic_font + 134, 0); fun_drawNumberSingularPlural( 8, 0, building_74_house_taxIncomeThisYear_senateForum_treasureStore[32 * currentlySelectedBuilding], rightclickInfoDialog_x + text_xoffset + 44, rightclickInfoDialog_y + 43, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 106, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 106, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 106, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 106, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 106, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 106, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 72, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BDB4: using guessed type int building_74_house_taxIncomeThisYear_senateForum_treasureStore[]; //----- (004F5AA0) -------------------------------------------------------- void fun_showBuildingInfoReservoir() { dialog_help_id = 59; if ( canPlayCurrentSound ) { fun_playSound("wavs\\resevoir.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 107, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextCentered( 13, 1, rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 24, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].hasFountain > 0 ) fun_drawGameTextWrapped( 107, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 173, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 107, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 173, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004F5C80) -------------------------------------------------------- void fun_showBuildingInfoFountain() { dialog_help_id = 61; if ( canPlayCurrentSound ) { fun_playSound("wavs\\fountain.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 108, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); if ( buildings[currentlySelectedBuilding].hasFountain ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) fun_drawGameTextWrapped( 108, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 108, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( dword_64E390 ) fun_drawGameTextWrapped( 108, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 108, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } // 608084: using guessed type int dword_608084; // 64E390: using guessed type int dword_64E390; // 6E6BD0: using guessed type __int16 graphic_font; // 94BD78: using guessed type __int16 building_38_num_workers[]; //----- (004F5EF0) -------------------------------------------------------- void fun_showBuildingInfoWell() { int v0; // [sp+4Ch] [bp-4h]@3 dialog_help_id = 62; if ( canPlayCurrentSound ) { fun_playSound("wavs\\well.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 109, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = sub_488240(currentlySelectedBuilding, 2); if ( v0 == 1 ) { fun_drawGameTextWrapped( 109, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( v0 == 2 ) fun_drawGameTextWrapped( 109, 3, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 109, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 126, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } // 4027D9: using guessed type _DWORD sub_4027D9(_DWORD, _DWORD); // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004F60E0) -------------------------------------------------------- void fun_showBuildingInfoOracle() { dialog_help_id = 67; if ( canPlayCurrentSound ) { fun_playSound("wavs\\oracle.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 110, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 12, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextCentered( 13, 1, rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 24, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 134, 0); fun_drawGameTextWrapped( 110, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004F6250) -------------------------------------------------------- void fun_showBuildingInfoBurningRuin() { dialog_help_id = 0; if ( canPlayCurrentSound ) { fun_playSound("wavs\\ruin.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 111, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameText( 41, dword_64E334, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 173, graphic_font + 134, 0); fun_drawGameTextWrapped( 111, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 6E6BD0: using guessed type __int16 graphic_font; //----- (004F63C0) -------------------------------------------------------- void fun_showBuildingInfoRubble() { dialog_help_id = 0; if ( canPlayCurrentSound ) { fun_playSound("wavs\\ruin.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 140, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameText( 41, dword_64E334, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 173, graphic_font + 134, 0); fun_drawGameTextWrapped( 140, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 143, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoWheatFarm() { int v0; // ST68_4@3 dialog_help_id = 89; if ( canPlayCurrentSound ) { fun_playSound("wavs\\wheat_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 1, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 112, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 112, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 112, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_wheat ) { fun_drawGameTextWrapped( 112, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_venus <= 4 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 112, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 112, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 112, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 112, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 112, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 112, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 112, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 112, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6528AC: using guessed type __int16 cityinfo_industryMonthballed_wheat[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD8A: using guessed type __int16 building_4a_grow_value_house_foodstocks[]; //----- (004F6B40) -------------------------------------------------------- void fun_showBuildingInfoVegetableFarm() { int v0; // ST68_4@3 dialog_help_id = 90; if ( canPlayCurrentSound ) { fun_playSound("wavs\\veg_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 2, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 113, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 113, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 113, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_vegetables ) { fun_drawGameTextWrapped( 113, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_venus <= 4 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 113, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 113, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 113, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 113, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 113, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 113, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 113, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 113, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6528AE: using guessed type __int16 cityinfo_industryMonthballed_vegetables[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD8A: using guessed type __int16 building_4a_grow_value_house_foodstocks[]; //----- (004F7150) -------------------------------------------------------- void fun_showBuildingInfoFruitFarm() { int v0; // ST68_4@3 dialog_help_id = 90; if ( canPlayCurrentSound ) { fun_playSound("wavs\\figs_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 3, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 114, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 114, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 114, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_fruit ) { fun_drawGameTextWrapped( 114, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_venus <= 4 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 114, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 114, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 114, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 114, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 114, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 114, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 114, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 114, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6528B0: using guessed type __int16 cityinfo_industryMonthballed_fruit[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD8A: using guessed type __int16 building_4a_grow_value_house_foodstocks[]; //----- (004F7760) -------------------------------------------------------- void fun_showBuildingInfoOliveFarm() { int pctDone; // ST68_4@3 dialog_help_id = 91; if ( canPlayCurrentSound ) { fun_playSound("wavs\\olives_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 4, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 115, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + F_LargeBlack, 0); pctDone = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 115, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + F_NormalBlack, 0); drawNumber( pctDone, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + F_NormalBlack, 0); fun_drawGameText( 115, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + F_NormalBlack, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_olives ) { fun_drawGameTextWrapped( 115, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + F_NormalBlack, 0); } else { if ( buildings[currentlySelectedBuilding].house_venus <= 4 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 115, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 115, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 115, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 115, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 115, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + F_NormalBlack, 0); } } } else { fun_drawGameTextWrapped( 115, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + F_NormalBlack, 0); } } else { fun_drawGameTextWrapped( 115, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + F_NormalBlack, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + F_NormalBlack, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 115, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + F_NormalBlack, 0); } void fun_showBuildingInfoVinesFarm() { int v0; // ST68_4@3 dialog_help_id = 91; if ( canPlayCurrentSound ) { fun_playSound("wavs\\vines_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 5, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 116, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 116, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 116, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_vines ) { fun_drawGameTextWrapped( 116, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_venus <= 4 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 116, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 116, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 116, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 116, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 116, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 116, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 116, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 116, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoPigFarm() { int v0; // ST68_4@3 dialog_help_id = 90; if ( canPlayCurrentSound ) { fun_playSound("wavs\\meat_farm.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 6, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 117, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 112, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 112, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_meat ) { fun_drawGameTextWrapped( 117, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].house_venus <= 4 ) { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 117, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 117, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 117, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 117, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 117, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 117, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 117, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 117, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoMarbleQuarry() { int v0; // ST68_4@3 dialog_help_id = 95; if ( canPlayCurrentSound ) { fun_playSound("wavs\\quarry.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 12, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 118, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 118, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 118, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_marble ) { fun_drawGameTextWrapped( 118, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 118, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 118, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 118, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 118, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 118, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 118, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 118, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoIronMine() { int v0; // ST68_4@3 dialog_help_id = 93; if ( canPlayCurrentSound ) { fun_playSound("wavs\\mine.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 9, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 119, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 119, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 119, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_iron ) { fun_drawGameTextWrapped( 119, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 119, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 119, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 119, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 119, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 119, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 119, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 119, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6528BC: using guessed type __int16 cityinfo_industryMonthballed_iron[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD8A: using guessed type __int16 building_4a_grow_value_house_foodstocks[]; //----- (004F94D0) -------------------------------------------------------- void fun_showBuildingInfoTimberYard() { int v0; // ST68_4@3 dialog_help_id = 94; if ( canPlayCurrentSound ) { fun_playSound("wavs\\timber.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 10, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 120, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 120, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 120, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_timber ) { fun_drawGameTextWrapped( 120, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 120, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 120, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 120, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 120, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 120, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 120, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 120, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6528BE: using guessed type __int16 cityinfo_industryMonthballed_timber[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD8A: using guessed type __int16 building_4a_grow_value_house_foodstocks[]; //----- (004F9A70) -------------------------------------------------------- void fun_showBuildingInfoClayPit() { int v0; // ST68_4@3 dialog_help_id = 92; if ( canPlayCurrentSound ) { fun_playSound("wavs\\clay.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 11, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 121, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 200); text_xoffset = 0; fun_drawGameText( 121, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); fun_drawGameText( 121, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 44, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_clay ) { fun_drawGameTextWrapped( 121, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 121, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 121, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 121, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 121, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 121, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 121, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); fun_drawGameTextWrapped( 121, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } void fun_showBuildingInfoWineWorkshop() { int v0; // ST68_4@3 dialog_help_id = 96; if ( canPlayCurrentSound ) { fun_playSound("wavs\\wine_workshop.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 7, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 122, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 400); text_xoffset = 0; fun_drawGameText( 122, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawGameText( 122, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56); text_xoffset = 0; fun_drawGameText(122, 12, rightclickInfoDialog_x + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].industry_unitsStored < 1 ) fun_drawNumberSingularPlural( 8, 10, 0, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); else fun_drawNumberSingularPlural( 8, 10, buildings[currentlySelectedBuilding].industry_unitsStored, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_wine ) { fun_drawGameTextWrapped( 122, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].industry_unitsStored > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 122, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 122, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 122, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 122, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 122, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 122, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 122, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoOilWorkshop() { int v0; // ST68_4@3 dialog_help_id = 97; if ( canPlayCurrentSound ) { fun_playSound("wavs\\oil_workshop.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 8, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 123, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 400); text_xoffset = 0; fun_drawGameText( 123, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawGameText( 123, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56); text_xoffset = 0; fun_drawGameText(123, 12, rightclickInfoDialog_x + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].industry_unitsStored < 1 ) fun_drawNumberSingularPlural( 8, 10, 0, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); else fun_drawNumberSingularPlural( 8, 10, buildings[currentlySelectedBuilding].industry_unitsStored, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_oil ) { fun_drawGameTextWrapped( 123, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].industry_unitsStored > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 123, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 123, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 123, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 123, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 123, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 123, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 123, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoWeaponsWorkshop() { int v0; // ST68_4@3 dialog_help_id = 98; if ( canPlayCurrentSound ) { fun_playSound("wavs\\weapons_workshop.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 13, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 124, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 400); text_xoffset = 0; fun_drawGameText( 124, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawGameText( 124, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56); text_xoffset = 0; fun_drawGameText(124, 12, rightclickInfoDialog_x + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].industry_unitsStored < 1 ) fun_drawNumberSingularPlural( 8, 10, 0, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); else fun_drawNumberSingularPlural( 8, 10, buildings[currentlySelectedBuilding].industry_unitsStored, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_weapons ) { fun_drawGameTextWrapped( 124, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].industry_unitsStored > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 124, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 124, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 124, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 124, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 124, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 124, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 124, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void fun_showBuildingInfoFurnitureWorkshop() { int v0; // ST68_4@3 dialog_help_id = 99; if ( canPlayCurrentSound ) { fun_playSound("wavs\\furniture_workshop.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 14, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 125, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 400); text_xoffset = 0; fun_drawGameText( 125, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawGameText( 125, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56); text_xoffset = 0; fun_drawGameText(125, 12, rightclickInfoDialog_x + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].industry_unitsStored < 1 ) fun_drawNumberSingularPlural( 8, 10, 0, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); else fun_drawNumberSingularPlural( 8, 10, buildings[currentlySelectedBuilding].industry_unitsStored, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_furniture ) { fun_drawGameTextWrapped( 125, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].industry_unitsStored > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 125, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 125, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 125, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 125, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 125, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 125, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 125, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } // 608084: using guessed type int dword_608084; // 64E370: using guessed type int dword_64E370; // 64E380: using guessed type int currentBuilding_workerPercentage; // 6528C6: using guessed type __int16 cityinfo_industryMonthballed_furniture[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 94BD74: using guessed type __int16 building_34_industry_unitsStored[]; // 94BD78: using guessed type __int16 building_38_num_workers[]; // 94BD8A: using guessed type __int16 building_4a_grow_value_house_foodstocks[]; //----- (004FBBD0) -------------------------------------------------------- void fun_showBuildingInfoPotteryWorkshop() { int v0; // ST68_4@3 dialog_help_id = 1; if ( canPlayCurrentSound ) { fun_playSound("wavs\\pottery_workshop.wav", 1, 0); canPlayCurrentSound = 0; } fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); drawGraphic(graphic_resourceIcons + 15, rightclickInfoDialog_x + 10, rightclickInfoDialog_y + 10); fun_drawGameTextCentered( 126, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v0 = getPercentage(buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 400); text_xoffset = 0; fun_drawGameText( 126, 2, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawNumber( v0, 64, "%", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); fun_drawGameText( 126, 3, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 40, graphic_font + 134, 0); drawGraphic(graphic_resourceIcons + 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 56); text_xoffset = 0; fun_drawGameText(126, 12, rightclickInfoDialog_x + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( buildings[currentlySelectedBuilding].industry_unitsStored < 1 ) fun_drawNumberSingularPlural( 8, 10, 0, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); else fun_drawNumberSingularPlural( 8, 10, buildings[currentlySelectedBuilding].industry_unitsStored, rightclickInfoDialog_x + text_xoffset + 60, rightclickInfoDialog_y + 60, graphic_font + 134, 0); if ( dword_64E370 > 0 ) { if ( city_inform[ciid].industryMonthballed_pottery ) { fun_drawGameTextWrapped( 126, 4, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( buildings[currentlySelectedBuilding].num_workers > 0 ) { if ( buildings[currentlySelectedBuilding].industry_unitsStored > 0 ) { if ( buildings[currentlySelectedBuilding].num_workers ) { if ( currentBuilding_workerPercentage < 100 ) { if ( currentBuilding_workerPercentage < 75 ) { if ( currentBuilding_workerPercentage < 50 ) { if ( currentBuilding_workerPercentage < 25 ) fun_drawGameTextWrapped( 126, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 126, 9, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 126, 8, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 126, 7, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 126, 6, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 126, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } else { fun_drawGameTextWrapped( 126, 5, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_drawGameTextWrapped( 69, 25, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 86, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 136, rightclickInfoDialog_widthBlocks - 2, 4); fun_drawRightClickWorkerInfo(rightclickInfoDialog_y + 142); } void showBuildingInfoHousing() { int v0; // ST1C_4@60 int v1; // ST18_4@60 int v2; // esi@60 signed int v3; // eax@60 __int16 v5; // [sp+54h] [bp-4h]@7 __int16 v6; // [sp+54h] [bp-4h]@10 __int16 v7; // [sp+54h] [bp-4h]@13 __int16 v8; // [sp+54h] [bp-4h]@28 __int16 v9; // [sp+54h] [bp-4h]@31 __int16 v10; // [sp+54h] [bp-4h]@34 __int16 v11; // [sp+54h] [bp-4h]@37 __int16 v12; // [sp+54h] [bp-4h]@40 __int16 v13; // [sp+54h] [bp-4h]@43 __int16 v14; // [sp+54h] [bp-4h]@46 __int16 v15; // [sp+54h] [bp-4h]@49 __int16 v16; // [sp+54h] [bp-4h]@52 __int16 v17; // [sp+54h] [bp-4h]@55 int houseLevel = buildings[currentlySelectedBuilding].type - 10; dialog_help_id = 56; if( canPlayCurrentSound ) { fun_playSound("wavs\\housing.wav", 1, 0); canPlayCurrentSound = 0; } if ( buildings[currentlySelectedBuilding].house_population > 0 ) { fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 29, houseLevel, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); debug_showHousingEvolveInfo = 0; if ( debug_showHousingEvolveInfo ) { text_xoffset = 0; drawNumber( houseLevel + 1, 32, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 8, graphic_font + 536, 0); drawNumber( 20, 40, ")", rightclickInfoDialog_x + text_xoffset + 350, rightclickInfoDialog_y + 8, graphic_font + 536, 0); fun_drawGameText(127, 17, rightclickInfoDialog_x + 178, rightclickInfoDialog_y + 45, graphic_font, 0); fun_drawGameText(127, 18, rightclickInfoDialog_x + 264, rightclickInfoDialog_y + 45, graphic_font, 0); fun_drawGameText(127, 19, rightclickInfoDialog_x + 376, rightclickInfoDialog_y + 45, graphic_font, 0); if ( buildings[currentlySelectedBuilding].desirability < model_houses[houseLevel].des_evolve ) v5 = 0; else v5 = 31; fun_drawGameText(127, 3, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 67, graphic_font, v5); fun_drawNumberCentered( buildings[currentlySelectedBuilding].desirability, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 67, 100, graphic_font, v5); fun_drawNumberCentered( model_houses[houseLevel].des_evolve, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 67, 100, graphic_font, v5); fun_drawNumberCentered( model_houses[houseLevel].des_devolve[0] + 1, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 67, 100, graphic_font, v5); if ( buildings[currentlySelectedBuilding].house_entertainment < model_houses[houseLevel+1].entertainment ) v6 = 0; else v6 = 31; text_xoffset = 0; fun_drawGameText(127, 4, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 84, graphic_font, v6); drawNumber( LOBYTE(buildings[currentlySelectedBuilding].house_theater_amphi_wine), 40, ")", rightclickInfoDialog_x + text_xoffset + 16, rightclickInfoDialog_y + 84, graphic_font, 0); drawNumber( HIBYTE(buildings[currentlySelectedBuilding].house_theater_amphi_wine), 40, ")", rightclickInfoDialog_x + text_xoffset + 16, rightclickInfoDialog_y + 84, graphic_font, 0); drawNumber( HIBYTE(buildings[currentlySelectedBuilding].house_amphiGlad_colo), 40, ")", rightclickInfoDialog_x + text_xoffset + 16, rightclickInfoDialog_y + 84, graphic_font, 0); drawNumber( HIBYTE(buildings[currentlySelectedBuilding].house_coloLion_hippo), 40, ")", rightclickInfoDialog_x + text_xoffset + 16, rightclickInfoDialog_y + 84, graphic_font, 0); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_entertainment, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 84, 100, graphic_font, v6); fun_drawNumberCentered( model_houses[houseLevel+1].entertainment, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 84, 100, graphic_font, v6); fun_drawNumberCentered( model_houses[houseLevel].entertainment, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 84, 100, graphic_font, v6); if ( buildings[currentlySelectedBuilding].hasFountain ) { v7 = 31; } else { if ( buildings[currentlySelectedBuilding].house_hasWell ) { if ( model_houses[houseLevel+1].water == 2 ) v7 = 0; else v7 = 31; } else { if ( model_houses[houseLevel+1].water ) v7 = 0; else v7 = 31; } } fun_drawGameText(127, 5, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 101, graphic_font, v7); if ( buildings[currentlySelectedBuilding].hasFountain ) { fun_drawNumberCentered( 2, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 101, 100, graphic_font, v7); } else { if ( buildings[currentlySelectedBuilding].house_hasWell ) fun_drawNumberCentered( 1, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 101, 100, graphic_font, v7); else fun_drawNumberCentered( 0, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 101, 100, graphic_font, v7); } fun_drawNumberCentered( model_houses[houseLevel+1].water, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 101, 100, graphic_font, v7); fun_drawNumberCentered( model_houses[houseLevel].water, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 101, 100, graphic_font, v7); if ( buildings[currentlySelectedBuilding].house_numGods < model_houses[houseLevel+1].religion ) v8 = 0; else v8 = 31; fun_drawGameText(127, 6, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 118, graphic_font, v8); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_numGods, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 118, 100, graphic_font, v8); fun_drawNumberCentered( model_houses[houseLevel+1].religion, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 118, 100, graphic_font, v8); fun_drawNumberCentered( model_houses[houseLevel].religion, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 118, 100, graphic_font, v8); if ( buildings[currentlySelectedBuilding].house_education < model_houses[houseLevel+1].education ) v9 = 0; else v9 = 31; fun_drawGameText(127, 7, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 135, graphic_font, v9); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_education, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 135, 100, graphic_font, v9); fun_drawNumberCentered( model_houses[houseLevel+1].education, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 135, 100, graphic_font, v9); fun_drawNumberCentered( model_houses[houseLevel].education, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 135, 100, graphic_font, v9); if ( HIBYTE(buildings[currentlySelectedBuilding].house_academy_barber) < model_houses[houseLevel+1].barber ) v10 = 0; else v10 = 31; fun_drawGameText(127, 9, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 169, graphic_font, v10); fun_drawNumberCentered( HIBYTE(buildings[currentlySelectedBuilding].house_academy_barber), 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 169, 100, graphic_font, v10); fun_drawNumberCentered( model_houses[houseLevel+1].barber, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 169, 100, graphic_font, v10); fun_drawNumberCentered( model_houses[houseLevel].barber, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 169, 100, graphic_font, v10); if ( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days < model_houses[houseLevel+1].bathhouse ) v11 = 0; else v11 = 31; fun_drawGameText(127, 10, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 186, graphic_font, v11); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_bathhouse_dock_numships_entert_days, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 186, 100, graphic_font, v11); fun_drawNumberCentered( model_houses[houseLevel+1].bathhouse, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 186, 100, graphic_font, v11); fun_drawNumberCentered( model_houses[houseLevel].bathhouse, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 186, 100, graphic_font, v11); if ( buildings[currentlySelectedBuilding].house_health < model_houses[houseLevel+1].health ) v12 = 0; else v12 = 31; fun_drawGameText(127, 11, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 203, graphic_font, v12); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_health, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 203, 100, graphic_font, v12); fun_drawNumberCentered( model_houses[houseLevel+1].health, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 203, 100, graphic_font, v12); fun_drawNumberCentered( model_houses[houseLevel].health, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 203, 100, graphic_font, v12); if ( HIBYTE(buildings[currentlySelectedBuilding].word_94BDAC[0]) < model_houses[houseLevel+1].foodtypes ) v13 = 0; else v13 = 31; fun_drawGameText(127, 12, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 220, graphic_font, v13); fun_drawNumberCentered( HIBYTE(buildings[currentlySelectedBuilding].word_94BDAC[0]), 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 220, 100, graphic_font, v13); fun_drawNumberCentered( model_houses[houseLevel+1].foodtypes, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 220, 100, graphic_font, v13); fun_drawNumberCentered( model_houses[houseLevel].foodtypes, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 220, 100, graphic_font, v13); if ( buildings[currentlySelectedBuilding].house_pottery < model_houses[houseLevel+1].pottery ) v14 = 0; else v14 = 31; fun_drawGameText(127, 13, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 237, graphic_font, v14); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_pottery, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 237, 100, graphic_font, v14); fun_drawNumberCentered( model_houses[houseLevel+1].pottery, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 237, 100, graphic_font, v14); fun_drawNumberCentered( model_houses[houseLevel].pottery, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 237, 100, graphic_font, v14); if ( buildings[currentlySelectedBuilding].house_oil < model_houses[houseLevel+1].oil ) v15 = 0; else v15 = 31; fun_drawGameText(127, 14, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 254, graphic_font, v15); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_oil, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 254, 100, graphic_font, v15); fun_drawNumberCentered( model_houses[houseLevel+1].oil, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 254, 100, graphic_font, v15); fun_drawNumberCentered( model_houses[houseLevel].oil, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 254, 100, graphic_font, v15); if ( buildings[currentlySelectedBuilding].house_furniture < model_houses[houseLevel+1].furniture ) v16 = 0; else v16 = 31; fun_drawGameText(127, 15, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 271, graphic_font, v16); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_furniture, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 271, 100, graphic_font, v16); fun_drawNumberCentered( model_houses[houseLevel+1].furniture, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 271, 100, graphic_font, v16); fun_drawNumberCentered( model_houses[houseLevel].furniture, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 271, 100, graphic_font, v16); if ( buildings[currentlySelectedBuilding].house_wine < model_houses[houseLevel+1].wine ) v17 = 0; else v17 = 31; fun_drawGameText(127, 16, rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 288, graphic_font, v17); fun_drawNumberCentered( buildings[currentlySelectedBuilding].house_wine, 64, " ", rightclickInfoDialog_x + 140, rightclickInfoDialog_y + 288, 100, graphic_font, v17); fun_drawNumberCentered( model_houses[houseLevel+1].wine, 64, " ", rightclickInfoDialog_x + 240, rightclickInfoDialog_y + 288, 100, graphic_font, v17); fun_drawNumberCentered( model_houses[houseLevel].wine, 64, " ", rightclickInfoDialog_x + 350, rightclickInfoDialog_y + 288, 100, graphic_font, v17); } else { fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 148, rightclickInfoDialog_widthBlocks - 2, 10); sub_4EBF50(rightclickInfoDialog_y + 154); sub_4EC1B0(rightclickInfoDialog_y + 194); sub_4EC350(rightclickInfoDialog_y + 214); if ( model_houses[buildings[currentlySelectedBuilding].level_resourceId].foodtypes ) { drawGraphic(graphic_resourceIcons + 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 234); drawNumber( buildings[currentlySelectedBuilding].grow_value_house_foodstocks[0], 64, " ", rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 238, graphic_font + 1206, 0); drawGraphic(graphic_resourceIcons + 2, rightclickInfoDialog_x + 142, rightclickInfoDialog_y + 234); drawNumber( buildings[currentlySelectedBuilding].granary_capacity[0], 64, " ", rightclickInfoDialog_x + 174, rightclickInfoDialog_y + 238, graphic_font + 1206, 0); drawGraphic(graphic_resourceIcons + 3, rightclickInfoDialog_x + 252, rightclickInfoDialog_y + 234); drawNumber( buildings[currentlySelectedBuilding].house_wheat, 64, " ", rightclickInfoDialog_x + 284, rightclickInfoDialog_y + 238, graphic_font + 1206, 0); v0 = rightclickInfoDialog_y + 234; v1 = rightclickInfoDialog_x + 362; v2 = graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(6, 3); drawGraphic(v2 + v3 + 6, v1, v0); drawNumber( buildings[currentlySelectedBuilding].house_vegetables, 64, " ", rightclickInfoDialog_x + 394, rightclickInfoDialog_y + 238, graphic_font + 1206, 0); } else { fun_drawGameTextWrapped( 127, 33, rightclickInfoDialog_x + 36, rightclickInfoDialog_y + 234, 16 * (rightclickInfoDialog_widthBlocks - 6), graphic_font + 1206, 0); } drawGraphic(graphic_resourceIcons + 15, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 274); drawNumber( buildings[currentlySelectedBuilding].house_pottery, 64, " ", rightclickInfoDialog_x + 64, rightclickInfoDialog_y + 278, graphic_font + 1206, 0); drawGraphic(graphic_resourceIcons + 14, rightclickInfoDialog_x + 142, rightclickInfoDialog_y + 274); drawNumber( buildings[currentlySelectedBuilding].house_furniture, 64, " ", rightclickInfoDialog_x + 174, rightclickInfoDialog_y + 278, graphic_font + 1206, 0); drawGraphic(graphic_resourceIcons + 8, rightclickInfoDialog_x + 252, rightclickInfoDialog_y + 274); drawNumber( buildings[currentlySelectedBuilding].house_oil, 64, " ", rightclickInfoDialog_x + 284, rightclickInfoDialog_y + 278, graphic_font + 1206, 0); drawGraphic(graphic_resourceIcons + 7, rightclickInfoDialog_x + 362, rightclickInfoDialog_y + 274); drawNumber( buildings[currentlySelectedBuilding].house_wine, 64, " ", rightclickInfoDialog_x + 394, rightclickInfoDialog_y + 278, graphic_font + 1206, 0); if ( HIBYTE(buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir) == 62 ) { text_xoffset = 0; text_yoffset = 0; fun_drawGameText( 127, HIBYTE(buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir) + 40, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 60, graphic_font + 134, 0); fun_drawGameText( 41, buildings[dword_64E378].type, rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 60, graphic_font, -2048); fun_drawText(")", rightclickInfoDialog_x + text_xoffset + 32, rightclickInfoDialog_y + 60, graphic_font, 0); fun_drawGameTextWrapped( 127, HIBYTE(buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir) + 41, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 76, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { fun_drawGameTextWrapped( 127, HIBYTE(buildings[currentlySelectedBuilding].wharf_hasBoat_house_evolveStatusDesir) + 40, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 70, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } else { fun_showBuildingInfoVacantLot(); } } void fun_showBuildingInfoVacantLot() { sub_4E9BA0(); fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 128, 0, rightclickInfoDialog_x, rightclickInfoDialog_y + 8, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); fun_drawGameTextCentered( 13, 1, rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 22, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 134, 0); sub_4EA150(); if ( sub_489070(buildings[currentlySelectedBuilding].x, buildings[currentlySelectedBuilding].y, 1, 2) ) fun_drawGameTextWrapped( 128, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 128, 2, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 113, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } // 6E6BD0: using guessed type __int16 graphic_font; //----- (004FE3E0) -------------------------------------------------------- void sub_4FE3E0() { int v0; // ST7C_4@1 int v1; // ST78_4@1 int v2; // ST60_4@25 signed int v3; // eax@27 int v4; // [sp+4Ch] [bp-3Ch]@25 int v5; // [sp+54h] [bp-34h]@25 int desirability; // [sp+5Ch] [bp-2Ch]@23 int v7; // [sp+60h] [bp-28h]@1 int v8; // [sp+64h] [bp-24h]@1 int v9; // [sp+68h] [bp-20h]@1 int v10; // [sp+6Ch] [bp-1Ch]@1 int v11; // [sp+70h] [bp-18h]@9 int v12; // [sp+74h] [bp-14h]@11 int v13; // [sp+7Ch] [bp-Ch]@14 int v14; // [sp+80h] [bp-8h]@9 dword_64E384 = 0; dword_64E378 = 0; v0 = buildings[currentlySelectedBuilding].x; v1 = buildings[currentlySelectedBuilding].y; v8 = v0 + 6; v7 = v1 + 6; v10 = v0 - 6; v9 = v1 - 6; if ( v10 < 0 ) v10 = 0; if ( v9 < 0 ) v9 = 0; if ( v8 >= setting_map_width ) v8 = setting_map_width - 1; if ( v7 >= setting_map_height ) v7 = setting_map_height - 1; v14 = 162 * v9 + v10 + setting_map_startGridOffset; v11 = v9; while ( v11 <= v7 ) { v12 = v10; while ( v12 <= v8 ) { v13 = grid_buildingIds[v14]; if ( v13 > 0 ) { if ( buildings[v13].inUse == 1 ) { if ( v13 != currentlySelectedBuilding ) { if ( !buildings[v13].house_size || buildings[v13].type < buildings[currentlySelectedBuilding].type ) { desirability = model_buildings[buildings[v13].type].desirability; if ( desirability < 0 ) { v5 = model_buildings[buildings[v13].type].des_stepSize; v2 = model_buildings[buildings[v13].type].des_range; v4 = fun_getDistanceMaximum( v12, v11, buildings[currentlySelectedBuilding].x, buildings[currentlySelectedBuilding].y); if ( v4 <= v2 ) { while ( 1 ) { v3 = v4--; if ( v3 <= 1 ) break; desirability += v5; } if ( desirability < dword_64E384 ) { dword_64E384 = desirability; dword_64E378 = v13; } } } } } } } ++v12; ++v14; } ++v11; v14 += 162 - (v8 - v10 + 1); } } // 5F6CD8: using guessed type int model_buildings_desirability[]; // 5F6CE0: using guessed type int model_buildings_des_stepSize[]; // 5F6CE4: using guessed type int model_buildings_des_range[]; // 64E378: using guessed type int dword_64E378; // 64E384: using guessed type int dword_64E384; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8F61A0: using guessed type __int16 grid_buildingIds[]; // 94BD4A: using guessed type __int16 building_0a_type[]; //----- (004FE720) -------------------------------------------------------- void fun_showFortInfo(int fortId) { signed int v1; // ST70_4@1 int v2; // ST7C_4@8 signed int v3; // ST70_4@8 int v4; // [sp+50h] [bp-1Ch]@39 signed int v5; // [sp+54h] [bp-18h]@2 int v6; // [sp+58h] [bp-14h]@8 int v7; // [sp+64h] [bp-8h]@1 signed int v8; // [sp+68h] [bp-4h]@37 dialog_help_id = 87; fun_drawDialogBackground( rightclickInfoDialog_x, rightclickInfoDialog_y, rightclickInfoDialog_widthBlocks, rightclickInfoDialog_heightBlocks); fun_drawGameTextCentered( 138, formations[fortId].fortId, rightclickInfoDialog_x, rightclickInfoDialog_y + 10, 16 * rightclickInfoDialog_widthBlocks, graphic_font + 670, 0); v1 = formations[fortId].fortId + word_6E6CAE; v7 = c3_sg2[v1].height; drawGraphic(v1, rightclickInfoDialog_x + (40 - c3_sg2[v1].width) / 2 + 16, rightclickInfoDialog_y + 16); if ( formations[fortId].walkerType == 13 ) { v5 = word_6E6CAC; } else { if ( formations[fortId].walkerType == 12 ) v5 = word_6E6CAC + 18; else v5 = word_6E6CAC + 9; } if ( formations[fortId].formation_52 ) v5 += 8; v2 = c3_sg2[v5].height; drawGraphic(v5, rightclickInfoDialog_x + (40 - c3_sg2[v5].width) / 2 + 16, rightclickInfoDialog_y + v7 + 16); v3 = 20 - formations[fortId].morale / 5 + word_6E6D92; drawGraphic( v3, rightclickInfoDialog_x + (40 - c3_sg2[v3].width) / 2 + 16, v2 + rightclickInfoDialog_y + v7 + 16); fun_drawGameText(138, 23, rightclickInfoDialog_x + 100, rightclickInfoDialog_y + 60, graphic_font + 134, 0); drawNumber( formations[fortId].numWalkers, 64, " ", rightclickInfoDialog_x + 294, rightclickInfoDialog_y + 60, graphic_font + 134, 0); v6 = getPercentage(formations[fortId].formation_42, formations[fortId].formation_44); fun_drawGameText(138, 24, rightclickInfoDialog_x + 100, rightclickInfoDialog_y + 80, graphic_font + 134, 0); if ( v6 > 0 ) { if ( v6 > 20 ) { if ( v6 > 40 ) { if ( v6 > 55 ) { if ( v6 > 70 ) { if ( v6 > 90 ) fun_drawGameText( 138, 32, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); else fun_drawGameText( 138, 31, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); } else { fun_drawGameText( 138, 30, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); } } else { fun_drawGameText(138, 29, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); } } else { fun_drawGameText(138, 28, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); } } else { fun_drawGameText(138, 27, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); } } else { fun_drawGameText(138, 26, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 80, graphic_font + 134, 0); } fun_drawGameText(138, 25, rightclickInfoDialog_x + 100, rightclickInfoDialog_y + 100, graphic_font + 134, 0); fun_drawGameText( 18, formations[fortId].hasMilitaryTraining, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 100, graphic_font + 134, 0); if ( formations[fortId].cursedByMars ) { fun_drawGameText(138, 59, rightclickInfoDialog_x + 100, rightclickInfoDialog_y + 120, graphic_font + 134, 0); } else { fun_drawGameText(138, 36, rightclickInfoDialog_x + 100, rightclickInfoDialog_y + 120, graphic_font + 134, 0); fun_drawGameText( 138, formations[fortId].morale / 5 + 37, rightclickInfoDialog_x + 300, rightclickInfoDialog_y + 120, graphic_font + 134, 0); } if ( formations[fortId].numWalkers ) { switch ( dword_64E360 ) { case 5: v8 = 0; break; case 4: v8 = 1; break; case 3: v8 = 2; break; } while ( v8 < 5 ) { graphic_xOffset = rightclickInfoDialog_x + 85 * v8 + 21; graphic_yOffset = rightclickInfoDialog_y + 141; if ( formations[fortId].walkerType == 13 ) v4 = *(int *)((char *)&dword_5FFD18[5 * setting_map_orientation / 2] + 4 * v8); else v4 = *(int *)((char *)&dword_5FFD68[5 * setting_map_orientation / 2] + 4 * v8); drawGraphic(v4 + word_6E6D3A, graphic_xOffset, graphic_yOffset); ++v8; } sub_4FF0B0(fortId); } else { if ( formations[fortId].cursedByMars ) { fun_drawGameTextWrapped( 89, 1, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 172, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } else { if ( numWorkingBarracks ) fun_drawGameTextWrapped( 138, 10, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 172, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); else fun_drawGameTextWrapped( 138, 11, rightclickInfoDialog_x + 32, rightclickInfoDialog_y + 172, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 134, 0); } } } // 40144C: using guessed type _DWORD sub_40144C(_DWORD); // 64E360: using guessed type int dword_64E360; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CAC: using guessed type __int16 word_6E6CAC; // 6E6CAE: using guessed type __int16 word_6E6CAE; // 6E6D3A: using guessed type __int16 word_6E6D3A; // 6E6D92: using guessed type __int16 word_6E6D92; // 7F87C4: using guessed type __int16 formation_walkerType[]; // 7F87EC: using guessed type __int16 formation_morale[]; // 7F8800: using guessed type __int16 formation_hasMilitaryTraining[]; // 7F8802: using guessed type __int16 formation_42[]; // 7F8804: using guessed type __int16 formation_44[]; // 7F8812: using guessed type __int16 formation_52[]; // 7F881C: using guessed type __int16 formation_cursedByMars[]; // 98BF50: using guessed type int numWorkingBarracks; //----- (004FF0B0) -------------------------------------------------------- void sub_4FF0B0(int a1) { int v1; // [sp+4Ch] [bp-10h]@90 int v2; // [sp+50h] [bp-Ch]@90 int v3; // [sp+54h] [bp-8h]@10 int v4; // [sp+54h] [bp-8h]@92 signed int v5; // [sp+58h] [bp-4h]@9 if ( formations[a1].numWalkers > 0 ) { switch ( dword_64E360 ) { case 5: v5 = 0; break; case 4: v5 = 1; break; case 3: v5 = 2; break; } while ( v5 < 5 ) { v3 = 0; if ( mouseover_button_id ) { if ( v5 == mouseover_button_id - 1 ) v3 = 1; } else { if ( formations[a1].walkerType == Walker_FortLegionary ) { if ( formations[a1].layout != 5 || v5 ) { if ( formations[a1].layout || v5 != 1 ) { if ( formations[a1].layout != 1 || v5 != 2 ) { if ( formations[a1].layout != 2 || v5 != 3 ) { if ( formations[a1].layout == 6 ) { if ( v5 == 4 ) v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { if ( formations[a1].layout != 3 || v5 ) { if ( formations[a1].layout != 4 || v5 != 1 ) { if ( formations[a1].layout != 1 || v5 != 2 ) { if ( formations[a1].layout != 2 || v5 != 3 ) { if ( formations[a1].layout == 6 ) { if ( v5 == 4 ) v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } else { v3 = 1; } } } fun_drawBorderedButton(0, rightclickInfoDialog_x + 85 * v5++ + 19, rightclickInfoDialog_y + 139, 84, 84, v3); } fun_drawSunkenTextBox( rightclickInfoDialog_x + 16, rightclickInfoDialog_y + 230, rightclickInfoDialog_widthBlocks - 2, 4); if ( mouseover_button_id == 1 ) { if ( formations[a1].walkerType == 13 ) mouseover_button_id = 0; } if ( mouseover_button_id == 2 ) { if ( formations[a1].walkerType == 13 ) { if ( dword_64E360 == 3 ) mouseover_button_id = 0; } } switch ( mouseover_button_id ) { case 1: if ( formations[a1].walkerType == 13 ) { if ( formations[a1].hasMilitaryTraining ) { v2 = 18; v1 = 12; } else { v2 = 17; v1 = 12; } } else { v2 = 22; v1 = 16; } break; case 2: if ( formations[a1].walkerType == 13 ) { if ( formations[a1].hasMilitaryTraining ) { v2 = 19; v1 = 13; } else { v2 = 17; v1 = 13; } } else { v2 = 22; v1 = 16; } break; case 3: v2 = 20; v1 = 14; break; case 4: v2 = 20; v1 = 14; break; case 5: v2 = 21; v1 = 15; break; default: if ( formations[a1].layout == 5 ) { v2 = 18; v1 = 12; } else { if ( formations[a1].layout ) { switch ( formations[a1].layout ) { case 1: v2 = 20; v1 = 14; break; case 2: v2 = 20; v1 = 14; break; case 3: v2 = 22; v1 = 16; break; case 4: v2 = 22; v1 = 16; break; case 6: v2 = 21; v1 = 15; break; } } else { v2 = 19; v1 = 13; } } break; } fun_drawGameText(138, v1, rightclickInfoDialog_x + 24, rightclickInfoDialog_y + 236, graphic_font + 268, 0); fun_drawGameTextWrapped( 138, v2, rightclickInfoDialog_x + 24, rightclickInfoDialog_y + 252, 16 * (rightclickInfoDialog_widthBlocks - 4), graphic_font + 1072, 0); if ( !formations[a1].f03_flag ) { v4 = mouseover_button_id_main == 1; fun_drawBorderedButton( 0, 16 * (rightclickInfoDialog_widthBlocks - 18) / 2 + rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 48, 288, 32, v4); fun_drawGameTextCentered( 138, 58, 16 * (rightclickInfoDialog_widthBlocks - 18) / 2 + rightclickInfoDialog_x, rightclickInfoDialog_y + 16 * rightclickInfoDialog_heightBlocks - 39, 288, graphic_font + 134, 0); } } } // 64E360: using guessed type int dword_64E360; // 6E6BD0: using guessed type __int16 graphic_font; // 7F87C4: using guessed type __int16 formation_walkerType[]; // 7F87EA: using guessed type __int16 formation_layout[]; // 7F8800: using guessed type __int16 formation_hasMilitaryTraining[]; // 9D7B28: using guessed type int mouseover_button_id; // 9D7B2C: using guessed type int mouseover_button_id_main; //----- (004FF820) -------------------------------------------------------- void fun_determineGroundType() { __int16 v0; // dx@11 int v1; // [sp+4Ch] [bp-1Ch]@63 int v2; // [sp+50h] [bp-18h]@18 int v3; // [sp+50h] [bp-18h]@26 int v4; // [sp+50h] [bp-18h]@35 int v5; // [sp+50h] [bp-18h]@50 int buildingId; // [sp+58h] [bp-10h]@10 int offset; // [sp+5Ch] [bp-Ch]@1 int v8; // [sp+60h] [bp-8h]@1 int v9; // [sp+64h] [bp-4h]@3 offset = setting_map_startGridOffset; fun_memset(grid_groundType, 26244, -1); v8 = 0; while ( v8 < setting_map_height ) { v9 = 0; while ( v9 < setting_map_width ) { if ( grid_terrain[offset] & T_Road ) { grid_groundType[offset] = 0; } else { if ( grid_terrain[offset] & 0x1420 ) // unknown, access ramp, garden { grid_groundType[offset] = 2; } else { if ( grid_terrain[offset] & 0x8008 ) { buildingId = grid_buildingIds[offset]; if ( grid_buildingIds[offset] ) { switch ( buildings[buildingId].type ) { case B_Warehouse: grid_groundType[offset] = 0; break; case B_Gatehouse: grid_groundType[offset] = 0; break; case B_TriumphalArch: if ( buildings[buildingId].level_resourceId == 3 ) { v2 = grid_edge[offset] & 0x3F; switch ( v2 ) { case 8: grid_groundType[offset] = 0; break; case 10: grid_groundType[offset] = 0; break; case 9: grid_groundType[offset] = 0; break; default: grid_groundType[offset] = -1; break; } } else { v3 = grid_edge[offset] & 0x3F; switch ( v3 ) { case 17: grid_groundType[offset] = 0; break; case 1: grid_groundType[offset] = 0; break; case 9: grid_groundType[offset] = 0; break; default: grid_groundType[offset] = -1; break; } } break; case B_Granary: v4 = grid_edge[offset] & 0x3F; switch ( v4 ) { case 17: grid_groundType[offset] = 0; break; case 8: grid_groundType[offset] = 0; break; case 1: grid_groundType[offset] = 0; break; case 10: grid_groundType[offset] = 0; break; case 9: grid_groundType[offset] = 0; break; default: grid_groundType[offset] = -1; break; } break; case B_FortGround: grid_groundType[offset] = 2; break; case B_Reservoir: v5 = grid_edge[offset] & 0x3F; switch ( v5 ) { case 17: grid_groundType[offset] = -4; break; case 8: grid_groundType[offset] = -4; break; case 1: grid_groundType[offset] = -4; break; case 10: grid_groundType[offset] = -4; break; default: grid_groundType[offset] = -1; break; } break; default: grid_groundType[offset] = -1; break; } } else { byte_6415A0[offset] = 4; v0 = grid_terrain[offset]; _LOBYTE(v0) = v0 & 0xF7; grid_terrain[offset] = v0; grid_graphicIds[offset] = (grid_random[offset] & 7) + graphic_terrain_grass1; grid_edge[offset] = 64; grid_bitfields[offset] &= 0xF0u; ++dword_608094; } } else { if ( grid_terrain[offset] & T_Aqueduct ) { v1 = grid_graphicIds[offset] - graphic_aqueduct; if ( v1 > 3 ) { if ( v1 > 7 ) { if ( v1 > 9 ) { if ( v1 > 14 ) { if ( v1 > 18 ) { if ( v1 > 22 ) { if ( v1 > 24 ) grid_groundType[offset] = -1; else grid_groundType[offset] = -3; } else { grid_groundType[offset] = -1; } } else { grid_groundType[offset] = -3; } } else { grid_groundType[offset] = -1; } } else { grid_groundType[offset] = -3; } } else { grid_groundType[offset] = -1; } } else { grid_groundType[offset] = -3; } } else { if ( grid_terrain[offset] & 0xD77F ) grid_groundType[offset] = -1; else grid_groundType[offset] = 4; } } } } ++v9; ++offset; } ++v8; offset += setting_map_gridBorderSize; } } // 6E6BC4: using guessed type __int16 graphic_terrain_grass1; // 6E6BD6: using guessed type __int16 graphic_aqueduct; // 8B4620: using guessed type __int16 grid_graphicIds[]; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; // 8F61A0: using guessed type __int16 grid_buildingIds[]; // 94BD4A: using guessed type __int16 building_0a_type[]; // 94BD4C: using guessed type __int16 building_0c_level_resourceId[]; //----- (004FFDF0) -------------------------------------------------------- void sub_4FFDF0() { int v0; // [sp+4Ch] [bp-18h]@27 __int16 v1; // [sp+50h] [bp-14h]@5 int v2; // [sp+54h] [bp-10h]@12 int v3; // [sp+58h] [bp-Ch]@1 int v4; // [sp+5Ch] [bp-8h]@1 int v5; // [sp+60h] [bp-4h]@3 v3 = setting_map_startGridOffset; fun_memset(byte_6415A0, 26244, -1); v4 = 0; while ( v4 < setting_map_height ) { v5 = 0; while ( v5 < setting_map_width ) { v1 = grid_terrain[v3] & 0xD77F; if ( grid_terrain[v3] & 0x8000u ) { byte_6415A0[v3] = 4; } else { if ( v1 & 0x40 ) { byte_6415A0[v3] = 0; } else { if ( grid_terrain[v3] & 0x1420 ) { byte_6415A0[v3] = 2; } else { if ( v1 & 8 ) { v2 = grid_buildingIds[v3]; switch ( buildings[v2].type ) { case B_Warehouse: byte_6415A0[v3] = 0; break; case B_BurningRuin: byte_6415A0[v3] = -1; break; case B_NativeHut: byte_6415A0[v3] = -1; break; case B_NativeMeeting: byte_6415A0[v3] = -1; break; case B_NativeCrops: byte_6415A0[v3] = -1; break; case B_FortGround__: byte_6415A0[v3] = 5; break; case B_FortGround: byte_6415A0[v3] = 0; break; case B_Granary: v0 = grid_edge[v3] & 0x3F; switch ( v0 ) { case 17: byte_6415A0[v3] = 0; break; case 8: byte_6415A0[v3] = 0; break; case 1: byte_6415A0[v3] = 0; break; case 10: byte_6415A0[v3] = 0; break; default: byte_6415A0[v3] = v0 != 9; break; } break; default: byte_6415A0[v3] = 1; break; } } else { if ( grid_terrain[v3] & T_Aqueduct ) { byte_6415A0[v3] = 2; } else { if ( grid_terrain[v3] & T_Wall ) { byte_6415A0[v3] = 3; } else { if ( grid_terrain[v3] & 0xD77F ) byte_6415A0[v3] = -1; else byte_6415A0[v3] = 0; } } } } } } ++v5; ++v3; } ++v4; v3 += setting_map_gridBorderSize; } } // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; // 8F61A0: using guessed type __int16 grid_buildingIds[]; // 94BD4A: using guessed type __int16 building_0a_type[]; //----- (005001A0) -------------------------------------------------------- void sub_5001A0() { __int16 v0; // ax@7 __int16 v1; // ax@9 __int16 v2; // ax@11 __int16 v3; // ax@13 int v4; // [sp+50h] [bp-Ch]@1 int v5; // [sp+54h] [bp-8h]@1 int v6; // [sp+58h] [bp-4h]@3 v4 = setting_map_startGridOffset; fun_memset(byte_614180, 26244, -1); v5 = 0; while ( v5 < setting_map_height ) { v6 = 0; while ( v6 < setting_map_width ) { if ( grid_terrain[v4] & T_Water ) { v0 = grid_terrain_x_yMinusOne[v4]; if ( v0 & 4 ) { v1 = grid_terrain_xPlusOne_y[v4]; if ( v1 & 4 ) { v2 = grid_terrain_x_yPlusOne[v4]; if ( v2 & 4 ) { v3 = grid_terrain_xMinusOne_y[v4]; if ( v3 & 4 ) { if ( v5 >= 1 ) { if ( v6 >= 1 ) { if ( v5 <= setting_map_height - 2 ) { if ( v6 <= setting_map_width - 2 ) { switch ( grid_animation[v4] ) { case 0xD: byte_614180[v4] = -1; break; case 5: byte_614180[v4] = -3; break; case 6: byte_614180[v4] = -3; break; default: byte_614180[v4] = 0; break; } } else { byte_614180[v4] = -2; } } else { byte_614180[v4] = -2; } } else { byte_614180[v4] = -2; } } else { byte_614180[v4] = -2; } } else { byte_614180[v4] = -1; } } else { byte_614180[v4] = -1; } } else { byte_614180[v4] = -1; } } else { byte_614180[v4] = -1; } } else { byte_614180[v4] = -1; } ++v6; ++v4; } ++v5; v4 += setting_map_gridBorderSize; } } // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; // 90941C: using guessed type __int16 grid_terrain_x_yMinusOne[]; // 90955E: using guessed type __int16 grid_terrain_xMinusOne_y[]; // 909562: using guessed type __int16 grid_terrain_xPlusOne_y[]; // 9096A4: using guessed type __int16 grid_terrain_x_yPlusOne[]; //----- (00500420) -------------------------------------------------------- void sub_500420() { signed int v0; // [sp+4Ch] [bp-14h]@6 int offset; // [sp+54h] [bp-Ch]@1 int y; // [sp+58h] [bp-8h]@1 int x; // [sp+5Ch] [bp-4h]@3 offset = setting_map_startGridOffset; fun_memset(byte_61AA20, 26244, -1); y = 0; while ( y < setting_map_height ) { x = 0; while ( x < setting_map_width ) { if ( grid_terrain[offset] & T_Wall ) { v0 = 0; if ( mapOrientation ) { switch ( mapOrientation ) { case 2: if ( grid_terrain_x_yPlusOne[offset] & 0xC000 ) v0 = 1; if ( grid_terrain_xMinusOne_yPlusOne[offset] & 0xC000 ) ++v0; if ( grid_terrain_xMinusOne_y[offset] & 0xC000 ) ++v0; break; case 4: if ( grid_terrain_x_yMinusOne[offset] & 0xC000 ) v0 = 1; if ( grid_terrain_xMinusOne_yMinusOne[offset] & 0xC000 ) ++v0; if ( grid_terrain_xMinusOne_y[offset] & 0xC000 ) ++v0; break; case 6: if ( grid_terrain_x_yMinusOne[offset] & 0xC000 ) v0 = 1; if ( grid_terrain_xPlusOne_yMinusOne[offset] & 0xC000 ) ++v0; if ( grid_terrain_xPlusOne_y[offset] & 0xC000 ) ++v0; break; } } else { if ( grid_terrain_x_yPlusOne[offset] & 0xC000 ) v0 = 1; if ( grid_terrain_xPlusOne_yPlusOne[offset] & 0xC000 ) ++v0; if ( grid_terrain_xPlusOne_y[offset] & 0xC000 ) ++v0; } if ( v0 == 3 ) byte_61AA20[offset] = 0; else byte_61AA20[offset] = -1; } else { if ( grid_terrain[offset] & 0x8000u ) // gatehouse byte_61AA20[offset] = 0; else byte_61AA20[offset] = -1; } ++x; ++offset; } ++y; offset += setting_map_gridBorderSize; } } // 65DEF8: using guessed type int mapOrientation; // 8C79F8: using guessed type int setting_map_width; // 8C79FC: using guessed type int setting_map_height; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8C7A04: using guessed type int setting_map_gridBorderSize; // 90941A: using guessed type __int16 grid_terrain_xMinusOne_yMinusOne[]; // 90941C: using guessed type __int16 grid_terrain_x_yMinusOne[]; // 90955E: using guessed type __int16 grid_terrain_xMinusOne_y[]; // 909562: using guessed type __int16 grid_terrain_xPlusOne_y[]; // 9096A2: using guessed type __int16 grid_terrain_xMinusOne_yPlusOne[]; // 9096A4: using guessed type __int16 grid_terrain_x_yPlusOne[]; // 9096A6: using guessed type __int16 grid_terrain_xPlusOne_yPlusOne[]; //----- (00500760) -------------------------------------------------------- void fun_clearGroundTypeGrid() { int offset; // [sp+4Ch] [bp-Ch]@1 signed int y; // [sp+50h] [bp-8h]@1 signed int x; // [sp+54h] [bp-4h]@3 offset = 0; for ( y = 0; y < 162; ++y ) { x = 0; while ( x < 162 ) { grid_groundType[offset] = -1; ++x; ++offset; } } } //----- (005007F0) -------------------------------------------------------- signed int sub_5007F0(int x, int y, int a3, int a4) { signed int result; // eax@25 int v5; // [sp+50h] [bp-Ch]@5 int v6; // [sp+54h] [bp-8h]@1 int v7; // [sp+58h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * y + x + setting_map_startGridOffset; ++dword_634468; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; v6 = 162 * a4 + a3 + setting_map_startGridOffset; while ( dword_634464 != dword_608780[0] ) { v7 = word_6210C0[dword_634464]; if ( v7 == v6 ) break; v5 = grid_pathingDistance[v7] + 1; if ( !grid_pathingDistance[v7 - 162] ) { if ( grid_groundType_162[v7] >= 0 ) { grid_pathingDistance[v7 - 162] = v5; word_6210C0[dword_608780[0]++] = v7 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 + 1] ) { if ( grid_groundType1[v7] >= 0 ) { grid_pathingDistance[v7 + 1] = v5; word_6210C0[dword_608780[0]++] = v7 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 + 162] ) { if ( grid_groundType162[v7] >= 0 ) { grid_pathingDistance[v7 + 162] = v5; word_6210C0[dword_608780[0]++] = v7 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 - 1] ) { if ( grid_groundType_1[v7] >= 0 ) { grid_pathingDistance[v7 - 1] = v5; word_6210C0[dword_608780[0]++] = v7 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } if ( grid_pathingDistance[v6] ) result = 1; else result = 0; return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (00500B60) -------------------------------------------------------- signed int sub_500B60(int a1, int a2, int a3, int a4) { signed int result; // eax@11 int v5; // [sp+50h] [bp-Ch]@5 int v6; // [sp+54h] [bp-8h]@1 int v7; // [sp+58h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; ++dword_634468; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; v6 = 162 * a4 + a3 + setting_map_startGridOffset; while ( dword_634464 != dword_608780[0] ) { v7 = word_6210C0[dword_634464]; if ( v7 == v6 ) break; v5 = grid_pathingDistance[v7] + 1; if ( !grid_pathingDistance[v7 - 162] ) { if ( grid_groundType_162[v7] < 0 ) { if ( grid_terrain_x_yMinusOne[v7] & 0x4100 ) { grid_terrain_x_yMinusOne[v7] &= 0x2E80u; return 0; } } else { grid_pathingDistance[v7 - 162] = v5; word_6210C0[dword_608780[0]++] = v7 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 + 1] ) { if ( grid_groundType1[v7] < 0 ) { if ( grid_terrain_xPlusOne_y[v7] & 0x4100 ) { grid_terrain_xPlusOne_y[v7] &= 0x2E80u; return 0; } } else { grid_pathingDistance[v7 + 1] = v5; word_6210C0[dword_608780[0]++] = v7 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 + 162] ) { if ( grid_groundType162[v7] < 0 ) { if ( grid_terrain_x_yPlusOne[v7] & 0x4100 ) { grid_terrain_x_yPlusOne[v7] &= 0x2E80u; return 0; } } else { grid_pathingDistance[v7 + 162] = v5; word_6210C0[dword_608780[0]++] = v7 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 - 1] ) { if ( grid_groundType_1[v7] < 0 ) { if ( grid_terrain_xMinusOne_y[v7] & 0x4100 ) { grid_terrain_xMinusOne_y[v7] &= 0x2E80u; return 0; } } else { grid_pathingDistance[v7 - 1] = v5; word_6210C0[dword_608780[0]++] = v7 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } if ( grid_pathingDistance[v6] ) result = 1; else result = 0; return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; // 90941C: using guessed type __int16 grid_terrain_x_yMinusOne[]; // 90955E: using guessed type __int16 grid_terrain_xMinusOne_y[]; // 909562: using guessed type __int16 grid_terrain_xPlusOne_y[]; // 9096A4: using guessed type __int16 grid_terrain_x_yPlusOne[]; //----- (00501000) -------------------------------------------------------- signed int sub_501000(int x1, int y1, int x2, int y2) { signed int result; // eax@29 int v5; // [sp+50h] [bp-Ch]@5 int v6; // [sp+54h] [bp-8h]@1 int v7; // [sp+58h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * y1 + x1 + setting_map_startGridOffset; ++dword_634468; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; v6 = 162 * y2 + x2 + setting_map_startGridOffset; while ( dword_634464 != dword_608780[0] ) { v7 = word_6210C0[dword_634464]; if ( v7 == v6 ) break; v5 = grid_pathingDistance[v7] + 1; if ( !grid_pathingDistance[v7 - 162] ) { if ( sub_502470(v7 - 162) ) { if ( grid_groundType_162[v7] >= 0 ) { grid_pathingDistance[v7 - 162] = v5; word_6210C0[dword_608780[0]++] = v7 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v7 + 1] ) { if ( sub_502470(v7 + 1) ) { if ( grid_groundType1[v7] >= 0 ) { grid_pathingDistance[v7 + 1] = v5; word_6210C0[dword_608780[0]++] = v7 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v7 + 162] ) { if ( sub_502470(v7 + 162) ) { if ( grid_groundType162[v7] >= 0 ) { grid_pathingDistance[v7 + 162] = v5; word_6210C0[dword_608780[0]++] = v7 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v7 - 1] ) { if ( sub_502470(v7 - 1) ) { if ( grid_groundType_1[v7] >= 0 ) { grid_pathingDistance[v7 - 1] = v5; word_6210C0[dword_608780[0]++] = v7 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } if ( grid_pathingDistance[v6] ) result = 1; else result = 0; return result; } // 401307: using guessed type _DWORD sub_401307(_DWORD); // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (005013E0) -------------------------------------------------------- signed int fun_canTravelToDestinationOverRoadGarden(int curX, int curY, int destX, int destY) { signed int result; // eax@29 int v5; // [sp+50h] [bp-Ch]@5 int destGridOffset; // [sp+54h] [bp-8h]@1 int gridOffset; // [sp+58h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * curY + curX + setting_map_startGridOffset; ++dword_634468; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; destGridOffset = 162 * destY + destX + setting_map_startGridOffset; while ( dword_634464 != dword_608780[0] ) { gridOffset = word_6210C0[dword_634464]; if ( gridOffset == destGridOffset ) break; v5 = grid_pathingDistance[gridOffset] + 1; if ( !grid_pathingDistance[gridOffset - 162] ) { if ( grid_groundType_162[gridOffset] >= 0 ) { if ( grid_groundType_162[gridOffset] <= 2 ) { grid_pathingDistance[gridOffset - 162] = v5; word_6210C0[dword_608780[0]++] = gridOffset - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[gridOffset + 1] ) { if ( grid_groundType1[gridOffset] >= 0 ) { if ( grid_groundType1[gridOffset] <= 2 ) { grid_pathingDistance[gridOffset + 1] = v5; word_6210C0[dword_608780[0]++] = gridOffset + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[gridOffset + 162] ) { if ( grid_groundType162[gridOffset] >= 0 ) { if ( grid_groundType162[gridOffset] <= 2 ) { grid_pathingDistance[gridOffset + 162] = v5; word_6210C0[dword_608780[0]++] = gridOffset + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[gridOffset - 1] ) { if ( grid_groundType_1[gridOffset] >= 0 ) { if ( grid_groundType_1[gridOffset] <= 2 ) { grid_pathingDistance[gridOffset - 1] = v5; word_6210C0[dword_608780[0]++] = gridOffset - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } if ( grid_pathingDistance[destGridOffset] ) result = 1; else result = 0; return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (005017A0) -------------------------------------------------------- signed int sub_5017A0(int a1, int a2, int a3, int a4) { signed int result; // eax@29 int v5; // [sp+50h] [bp-Ch]@5 int v6; // [sp+54h] [bp-8h]@1 int v7; // [sp+58h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; ++dword_634468; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; v6 = 162 * a4 + a3 + setting_map_startGridOffset; while ( dword_634464 != dword_608780[0] ) { v7 = word_6210C0[dword_634464]; if ( v7 == v6 ) break; v5 = grid_pathingDistance[v7] + 1; if ( !grid_pathingDistance[v7 - 162] ) { if ( byte_61A97E[v7] >= 0 ) { if ( byte_61A97E[v7] <= 2 ) { grid_pathingDistance[v7 - 162] = v5; word_6210C0[dword_608780[0]++] = v7 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v7 + 1] ) { if ( byte_61AA21[v7] >= 0 ) { if ( byte_61AA21[v7] <= 2 ) { grid_pathingDistance[v7 + 1] = v5; word_6210C0[dword_608780[0]++] = v7 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v7 + 162] ) { if ( byte_61AAC2[v7] >= 0 ) { if ( byte_61AAC2[v7] <= 2 ) { grid_pathingDistance[v7 + 162] = v5; word_6210C0[dword_608780[0]++] = v7 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v7 - 1] ) { if ( byte_61AA1F[v7] >= 0 ) { if ( byte_61AA1F[v7] <= 2 ) { grid_pathingDistance[v7 - 1] = v5; word_6210C0[dword_608780[0]++] = v7 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } if ( grid_pathingDistance[v6] ) result = 1; else result = 0; return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (00501B60) -------------------------------------------------------- signed int sub_501B60(int a1, int a2, int a3, int a4, int a5, int a6) { signed int result; // eax@74 int v7; // [sp+50h] [bp-10h]@1 int v8; // [sp+54h] [bp-Ch]@7 int v9; // [sp+54h] [bp-Ch]@38 int v10; // [sp+58h] [bp-8h]@1 int v11; // [sp+5Ch] [bp-4h]@3 int v12; // [sp+5Ch] [bp-4h]@36 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; ++dword_634468; ++dword_614158; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; v7 = 0; v10 = 162 * a4 + a3 + setting_map_startGridOffset; if ( a5 ) { while ( dword_634464 != dword_608780[0] ) { v12 = word_6210C0[dword_634464]; if ( v12 == v10 ) break; v9 = grid_pathingDistance[v12] + 1; if ( !grid_pathingDistance[v12 - 162] ) { if ( sub_5023D0(v12 - 162) ) { if ( !byte_6414FE[v12] || byte_6414FE[v12] == 2 || byte_6414FE[v12] == 1 && word_8F605C[v12] == a5 ) { grid_pathingDistance[v12 - 162] = v9; word_6210C0[dword_608780[0]++] = v12 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v12 + 1] ) { if ( sub_5023D0(v12 + 1) ) { if ( !byte_6415A1[v12] || byte_6415A1[v12] == 2 || byte_6415A1[v12] == 1 && word_8F61A2[v12] == a5 ) { grid_pathingDistance[v12 + 1] = v9; word_6210C0[dword_608780[0]++] = v12 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v12 + 162] ) { if ( sub_5023D0(v12 + 162) ) { if ( !byte_641642[v12] || byte_641642[v12] == 2 || byte_641642[v12] == 1 && word_8F62E4[v12] == a5 ) { grid_pathingDistance[v12 + 162] = v9; word_6210C0[dword_608780[0]++] = v12 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } if ( !grid_pathingDistance[v12 - 1] ) { if ( sub_5023D0(v12 - 1) ) { if ( !byte_64159F[v12] || byte_64159F[v12] == 2 || byte_64159F[v12] == 1 && word_8F619E[v12] == a5 ) { grid_pathingDistance[v12 - 1] = v9; word_6210C0[dword_608780[0]++] = v12 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } } else { while ( dword_634464 != dword_608780[0] ) { v11 = word_6210C0[dword_634464]; if ( v11 == v10 ) break; ++v7; if ( v7 > a6 ) break; v8 = grid_pathingDistance[v11] + 1; if ( !grid_pathingDistance[v11 - 162] ) { if ( sub_5023D0(v11 - 162) ) { if ( byte_6414FE[v11] >= 0 ) { if ( byte_6414FE[v11] < 5 ) { grid_pathingDistance[v11 - 162] = v8; word_6210C0[dword_608780[0]++] = v11 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } } if ( !grid_pathingDistance[v11 + 1] ) { if ( sub_5023D0(v11 + 1) ) { if ( byte_6415A1[v11] >= 0 ) { if ( byte_6415A1[v11] < 5 ) { grid_pathingDistance[v11 + 1] = v8; word_6210C0[dword_608780[0]++] = v11 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } } if ( !grid_pathingDistance[v11 + 162] ) { if ( sub_5023D0(v11 + 162) ) { if ( byte_641642[v11] >= 0 ) { if ( byte_641642[v11] < 5 ) { grid_pathingDistance[v11 + 162] = v8; word_6210C0[dword_608780[0]++] = v11 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } } if ( !grid_pathingDistance[v11 - 1] ) { if ( sub_5023D0(v11 - 1) ) { if ( byte_64159F[v11] >= 0 ) { if ( byte_64159F[v11] < 5 ) { grid_pathingDistance[v11 - 1] = v8; word_6210C0[dword_608780[0]++] = v11 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } } if ( grid_pathingDistance[v10] ) result = 1; else result = 0; return result; } signed int sub_5023D0(int gridOffset) { signed int result; // eax@2 int walkerId; // [sp+4Ch] [bp-4h]@1 walkerId = grid_walkerIds[gridOffset]; if ( walkerId > 0 ) { while ( walkerId ) { if ( !walkers[walkerId].byte_7FA34D && walkers[walkerId].actionState == 150 ) return 0; walkerId = walkers[walkerId].nextIdOnSameTile; } result = 1; } else { result = 1; } return result; } signed int sub_502470(int gridOffset) { signed int result; // eax@2 int walkerId; // [sp+4Ch] [bp-4h]@1 walkerId = grid_walkerIds[gridOffset]; if ( walkerId > 0 ) { while ( walkerId ) { if ( walkers[walkerId].byte_7FA34D == 1 && walkers[walkerId].actionState == 150 ) return 0; walkerId = walkers[walkerId].nextIdOnSameTile; } result = 1; } else { result = 1; } return result; } signed int sub_502510(int a1, int a2, int a3, int a4) { signed int result; // eax@25 int v5; // [sp+50h] [bp-Ch]@5 int v6; // [sp+54h] [bp-8h]@1 int v7; // [sp+58h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; ++dword_634468; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; v6 = 162 * a4 + a3 + setting_map_startGridOffset; while ( dword_634464 != dword_608780[0] ) { v7 = word_6210C0[dword_634464]; if ( v7 == v6 ) break; v5 = grid_pathingDistance[v7] + 1; if ( !grid_pathingDistance[v7 - 162] ) { if ( byte_6414FE[v7] >= 0 ) { grid_pathingDistance[v7 - 162] = v5; word_6210C0[dword_608780[0]++] = v7 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 + 1] ) { if ( byte_6415A1[v7] >= 0 ) { grid_pathingDistance[v7 + 1] = v5; word_6210C0[dword_608780[0]++] = v7 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 + 162] ) { if ( byte_641642[v7] >= 0 ) { grid_pathingDistance[v7 + 162] = v5; word_6210C0[dword_608780[0]++] = v7 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v7 - 1] ) { if ( byte_64159F[v7] >= 0 ) { grid_pathingDistance[v7 - 1] = v5; word_6210C0[dword_608780[0]++] = v7 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } if ( grid_pathingDistance[v6] ) result = 1; else result = 0; return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (00502880) -------------------------------------------------------- signed int fun_determineShortestPathFromDistanceGraph(int a1, int destinationPathId, int curX, int curY, int destX, int destY) { signed int result; // eax@3 int v7; // eax@14 signed int v8; // [sp+4Ch] [bp-30h]@5 int y; // [sp+50h] [bp-2Ch]@1 int x; // [sp+54h] [bp-28h]@1 signed int i; // [sp+58h] [bp-24h]@9 signed int j; // [sp+58h] [bp-24h]@48 signed int lastDirection; // [sp+5Ch] [bp-20h]@7 int v14; // [sp+60h] [bp-1Ch]@9 signed int direction; // [sp+64h] [bp-18h]@9 int forwardDirection; // [sp+64h] [bp-18h]@43 signed int v17; // [sp+68h] [bp-14h]@14 signed int v18; // [sp+6Ch] [bp-10h]@1 signed int numTiles; // [sp+70h] [bp-Ch]@7 int gridOffset; // [sp+74h] [bp-8h]@1 x = destX; y = destY; destinationGridOffset = 162 * destY + destX + setting_map_startGridOffset; gridOffset = destinationGridOffset; v18 = grid_pathingDistance[destinationGridOffset]; if ( v18 > 0 && v18 < 998 ) { if ( a1 == 8 ) v8 = 1; else v8 = 2; numTiles = 0; lastDirection = -1; while ( v18 > 1 ) { v18 = grid_pathingDistance[gridOffset]; direction = -1; v14 = fun_walkerGetSimpleDestinationDirection(x, y, curX, curY); for ( i = 0; i < 8; i += v8 ) { if ( i != lastDirection ) { v7 = dword_5FFE4C[i] + gridOffset; v17 = grid_pathingDistance[v7]; if ( grid_pathingDistance[v7] ) { if ( v17 >= v18 ) { if ( v17 != v18 || i != v14 ) { if ( v17 == v18 ) { if ( direction == -1 ) { v18 = grid_pathingDistance[v7]; direction = i; } } } else { v18 = grid_pathingDistance[v7]; direction = i; } } else { v18 = grid_pathingDistance[v7]; direction = i; } } } } if ( direction == -1 ) return 0; if ( direction ) { switch ( direction ) { case 1: --y; ++x; gridOffset -= 161; break; case 2: ++x; ++gridOffset; break; case 3: ++x; ++y; gridOffset += 163; break; case 4: ++y; gridOffset += 162; break; case 5: ++y; --x; gridOffset += 161; break; case 6: --x; --gridOffset; break; case 7: --x; --y; gridOffset -= 163; break; } } else { --y; gridOffset -= 162; } forwardDirection = direction + 4; if ( forwardDirection >= 8 ) forwardDirection -= 8; reverseDestinationPath[numTiles++] = forwardDirection; lastDirection = forwardDirection; if ( numTiles >= 500 ) return 0; } for ( j = 0; j < numTiles; ++j ) *(&destinationpath_data[500 * destinationPathId] + j) = reverseDestinationPath[numTiles - 1 - j]; result = numTiles; } else { result = 0; } return result; } // 614150: using guessed type int destinationGridOffset; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (00502C50) -------------------------------------------------------- signed int sub_502C50(int a1, int a2, int a3, int a4, int a5, signed int a6) { signed int result; // eax@3 int v7; // eax@16 signed int v8; // [sp+4Ch] [bp-30h]@5 int v9; // [sp+50h] [bp-2Ch]@1 int v10; // [sp+54h] [bp-28h]@1 signed int i; // [sp+58h] [bp-24h]@11 signed int v12; // [sp+5Ch] [bp-20h]@7 int v13; // [sp+60h] [bp-1Ch]@11 signed int v14; // [sp+64h] [bp-18h]@11 int v15; // [sp+64h] [bp-18h]@45 signed int v16; // [sp+68h] [bp-14h]@16 signed int v17; // [sp+6Ch] [bp-10h]@1 signed int v18; // [sp+70h] [bp-Ch]@7 int v19; // [sp+74h] [bp-8h]@1 v10 = a4; v9 = a5; destinationGridOffset = 162 * a5 + a4 + setting_map_startGridOffset; v19 = destinationGridOffset; v17 = grid_pathingDistance[destinationGridOffset]; if ( v17 > 0 && v17 < 998 ) { if ( a1 == 8 ) v8 = 1; else v8 = 2; v18 = 0; v12 = -1; while ( v17 > 1 ) { v17 = grid_pathingDistance[v19]; walkerGridX = v10; walkerGridY = v9; if ( v17 <= a6 ) return 1; v14 = -1; v13 = fun_walkerGetSimpleDestinationDirection(v10, v9, a2, a3); for ( i = 0; i < 8; i += v8 ) { if ( i != v12 ) { v7 = dword_5FFE4C[i] + v19; v16 = grid_pathingDistance[v7]; if ( grid_pathingDistance[v7] ) { if ( v16 >= v17 ) { if ( v16 != v17 || i != v13 ) { if ( v16 == v17 ) { if ( v14 == -1 ) { v17 = grid_pathingDistance[v7]; v14 = i; } } } else { v17 = grid_pathingDistance[v7]; v14 = i; } } else { v17 = grid_pathingDistance[v7]; v14 = i; } } } } if ( v14 == -1 ) return 0; if ( v14 ) { switch ( v14 ) { case 1: --v9; ++v10; v19 -= 161; break; case 2: ++v10; ++v19; break; case 3: ++v10; ++v9; v19 += 163; break; case 4: ++v9; v19 += 162; break; case 5: ++v9; --v10; v19 += 161; break; case 6: --v10; --v19; break; case 7: --v10; --v9; v19 -= 163; break; } } else { --v9; v19 -= 162; } v15 = v14 + 4; if ( v15 >= 8 ) v15 -= 8; reverseDestinationPath[v18++] = v15; v12 = v15; if ( v18 >= 500 ) return 0; } result = 0; } else { result = 0; } return result; } signed int sub_503000(int a1, int a2, int a3, int a4) { signed int result; // eax@3 __int16 v5; // ax@6 __int16 v6; // dx@18 __int16 v7; // ax@35 __int16 v8; // cx@40 __int16 v9; // cx@60 __int16 v10; // dx@65 __int16 v11; // dx@85 __int16 v12; // ax@90 __int16 v13; // ax@110 __int16 v14; // cx@115 int v15; // [sp+50h] [bp-1Ch]@1 signed int v16; // [sp+5Ch] [bp-10h]@25 signed int v17; // [sp+5Ch] [bp-10h]@50 signed int v18; // [sp+5Ch] [bp-10h]@75 signed int v19; // [sp+5Ch] [bp-10h]@100 int v20; // [sp+64h] [bp-8h]@24 int v21; // [sp+68h] [bp-4h]@24 v15 = 0; fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; if ( grid_groundType[destinationGridOffset] == -1 ) { if ( !a4 ) return 0; if ( !(grid_terrain[destinationGridOffset] & 0x100) ) { v5 = grid_terrain[destinationGridOffset]; if ( !(v5 & 8) ) return 0; if ( buildings[grid_buildingIds[destinationGridOffset]].type != 90 ) return 0; } } if ( grid_groundType[destinationGridOffset] == 2 ) return 0; if ( grid_groundType[destinationGridOffset] != -3 ) goto LABEL_130; if ( a4 ) return 0; if ( sub_503A40(destinationGridOffset) ) { LABEL_130: v6 = grid_terrain[destinationGridOffset]; if ( v6 & 0x40 && a4 && !sub_503D30(destinationGridOffset) ) { result = 0; } else { ++dword_634468; fun_memset(byte_62DDE0, 26244, 0); grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; while ( dword_634464 != dword_608780[0] ) { ++v15; v21 = word_6210C0[dword_634464]; v20 = grid_pathingDistance[v21] + 1; if ( !grid_pathingDistance[v21 - 162] ) { v16 = 0; switch ( grid_groundType_162[v21] ) { case -3: if ( a4 ) { v16 = 1; } else { if ( !sub_503A40(v21 - 162) ) { grid_pathingDistance[v21 - 162] = -1; v16 = 1; } } break; case -254: v16 = 1; break; case -1: v16 = 1; break; default: v7 = grid_terrain_x_yMinusOne[v21]; if ( v7 & 8 ) { if ( grid_groundType_162[v21] != -4 || a4 != 1 ) v16 = 1; } break; } v8 = grid_terrain_x_yMinusOne[v21]; if ( v8 & 0x40 ) { if ( a4 ) { if ( !sub_503D30(v21 - 162) ) { grid_pathingDistance[v21 - 162] = -1; v16 = 1; } } } if ( !v16 ) { grid_pathingDistance[v21 - 162] = v20; if ( grid_groundType_162[v21] == -2 ) grid_pathingDistance[v21 - 162] += 4; word_6210C0[dword_608780[0]++] = v21 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v21 + 1] ) { v17 = 0; switch ( grid_groundType1[v21] ) { case -3: if ( a4 ) { v17 = 1; } else { if ( !sub_503A40(v21 + 1) ) { grid_pathingDistance[v21 + 1] = -1; v17 = 1; } } break; case -254: v17 = 1; break; case -1: v17 = 1; break; default: v9 = grid_terrain_xPlusOne_y[v21]; if ( v9 & 8 ) { if ( grid_groundType1[v21] != -4 || a4 != 1 ) v17 = 1; } break; } v10 = grid_terrain_xPlusOne_y[v21]; if ( v10 & 0x40 ) { if ( a4 ) { if ( !sub_503D30(v21 + 1) ) { grid_pathingDistance[v21 + 1] = -1; v17 = 1; } } } if ( !v17 ) { grid_pathingDistance[v21 + 1] = v20; if ( grid_groundType1[v21] == -2 ) grid_pathingDistance[v21 + 1] += 4; word_6210C0[dword_608780[0]++] = v21 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v21 + 162] ) { v18 = 0; switch ( grid_groundType162[v21] ) { case -3: if ( a4 ) { v18 = 1; } else { if ( !sub_503A40(v21 + 162) ) { grid_pathingDistance[v21 + 162] = -1; v18 = 1; } } break; case -254: v18 = 1; break; case -1: v18 = 1; break; default: v11 = grid_terrain_x_yPlusOne[v21]; if ( v11 & 8 ) { if ( grid_groundType162[v21] != -4 || a4 != 1 ) v18 = 1; } break; } v12 = grid_terrain_x_yPlusOne[v21]; if ( v12 & 0x40 ) { if ( a4 ) { if ( !sub_503D30(v21 + 162) ) { grid_pathingDistance[v21 + 162] = -1; v18 = 1; } } } if ( !v18 ) { grid_pathingDistance[v21 + 162] = v20; if ( grid_groundType162[v21] == -2 ) grid_pathingDistance[v21 + 162] += 4; word_6210C0[dword_608780[0]++] = v21 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v21 - 1] ) { v19 = 0; switch ( grid_groundType_1[v21] ) { case -3: if ( a4 ) { v19 = 1; } else { if ( !sub_503A40(v21 - 1) ) { grid_pathingDistance[v21 - 1] = -1; v19 = 1; } } break; case -254: v19 = 1; break; case -1: v19 = 1; break; default: v13 = grid_terrain_xMinusOne_y[v21]; if ( v13 & 8 ) { if ( grid_groundType_1[v21] != -4 || a4 != 1 ) v19 = 1; } break; } v14 = grid_terrain_xMinusOne_y[v21]; if ( v14 & 0x40 ) { if ( a4 ) { if ( !sub_503D30(v21 - 1) ) { grid_pathingDistance[v21 - 1] = -1; v19 = 1; } } } if ( !v19 ) { grid_pathingDistance[v21 - 1] = v20; if ( grid_groundType_1[v21] == -2 ) grid_pathingDistance[v21 - 1] += 4; word_6210C0[dword_608780[0]++] = v21 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } result = 1; } } else { result = 0; } return result; } // 401857: using guessed type _DWORD sub_401857(_DWORD); // 402FA4: using guessed type _DWORD sub_402FA4(_DWORD); // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; // 8F61A0: using guessed type __int16 grid_buildingIds[]; // 90941C: using guessed type __int16 grid_terrain_x_yMinusOne[]; // 90955E: using guessed type __int16 grid_terrain_xMinusOne_y[]; // 909562: using guessed type __int16 grid_terrain_xPlusOne_y[]; // 9096A4: using guessed type __int16 grid_terrain_x_yPlusOne[]; // 94BD4A: using guessed type __int16 building_0a_type[]; //----- (00503A40) -------------------------------------------------------- signed int sub_503A40(int a1) { __int16 v2; // dx@24 __int16 v3; // ax@28 __int16 v4; // cx@33 __int16 v5; // dx@37 bool v6; // [sp+4Ch] [bp-8h]@16 int v7; // [sp+50h] [bp-4h]@1 v7 = grid_graphicIds[a1] - graphic_aqueduct; if ( v7 >= 4 && v7 <= 7 ) return 0; if ( v7 >= 19 && v7 <= 22 ) return 0; if ( v7 < 0 || v7 >= 30 ) return 0; v6 = grid_graphicIds[a1] == graphic_aqueduct || v7 == 2 || v7 == 8 || v7 == 15 || v7 == 17 || v7 == 23; if ( setting_map_orientation == 2 || setting_map_orientation == 6 ) v6 = v6 != 1; if ( v6 ) { v2 = grid_terrain_x_yMinusOne[a1]; if ( v2 & 0x40 ) return 0; if ( word_63433C[a1] > 0 ) return 0; v3 = grid_terrain_x_yPlusOne[a1]; if ( v3 & 0x40 ) return 0; if ( word_6345C4[a1] > 0 ) return 0; } else { v4 = grid_terrain_xPlusOne_y[a1]; if ( v4 & 0x40 ) return 0; if ( word_634482[a1] > 0 ) return 0; v5 = grid_terrain_xMinusOne_y[a1]; if ( v5 & 0x40 ) return 0; if ( word_63447E[a1] > 0 ) return 0; } return 1; } // 63433C: using guessed type __int16 word_63433C[]; // 63447E: using guessed type __int16 word_63447E[]; // 6345C4: using guessed type __int16 word_6345C4[]; // 6E6BD6: using guessed type __int16 graphic_aqueduct; // 8B4620: using guessed type __int16 grid_graphicIds[]; // 90941C: using guessed type __int16 grid_terrain_x_yMinusOne[]; // 90955E: using guessed type __int16 grid_terrain_xMinusOne_y[]; // 909562: using guessed type __int16 grid_terrain_xPlusOne_y[]; // 9096A4: using guessed type __int16 grid_terrain_x_yPlusOne[]; //----- (00503C20) -------------------------------------------------------- signed int sub_503C20(int a1) { signed int result; // eax@2 int v2; // [sp+4Ch] [bp-4h]@1 v2 = grid_graphicIds[a1] - graphic_aqueduct; if ( grid_graphicIds[a1] == graphic_aqueduct ) { result = 0; } else { switch ( v2 ) { case 2: result = 8; break; case 8: result = 8; break; case 15: result = 15; break; case 17: result = 17; break; case 23: result = 23; break; case 1: result = 1; break; case 3: result = 9; break; case 9: result = 9; break; case 16: result = 16; break; case 18: result = 18; break; case 24: result = 24; break; default: result = 8; break; } } return result; } // 6E6BD6: using guessed type __int16 graphic_aqueduct; // 8B4620: using guessed type __int16 grid_graphicIds[]; //----- (00503D30) -------------------------------------------------------- signed int sub_503D30(int a1) { bool v2; // [sp+4Ch] [bp-Ch]@13 signed int v3; // [sp+50h] [bp-8h]@1 int v4; // [sp+54h] [bp-4h]@1 v4 = grid_graphicIds[a1] - word_6E6C90; v3 = 0; if ( grid_graphicIds[a1] == word_6E6C90 ) v3 = 1; if ( v4 == 1 ) v3 = 1; if ( v4 == 49 ) v3 = 1; if ( v4 == 50 ) v3 = 1; if ( v3 != 1 ) return 0; v2 = grid_graphicIds[a1] == word_6E6C90 || v4 == 49; if ( setting_map_orientation == 2 || setting_map_orientation == 6 ) v2 = v2 != 1; if ( v2 == 1 ) { if ( word_63433C[a1] > 0 ) return 0; if ( word_6345C4[a1] > 0 ) return 0; } else { if ( word_634482[a1] > 0 ) return 0; if ( word_63447E[a1] > 0 ) return 0; } return 1; } // 63433C: using guessed type __int16 word_63433C[]; // 63447E: using guessed type __int16 word_63447E[]; // 6345C4: using guessed type __int16 word_6345C4[]; // 6E6C90: using guessed type __int16 word_6E6C90; // 8B4620: using guessed type __int16 grid_graphicIds[]; //----- (00503E80) -------------------------------------------------------- int unused_503E80() { return 0; } //----- (00503EA0) -------------------------------------------------------- signed int sub_503EA0(int a1, int a2, int a3) { int v4; // [sp+50h] [bp-8h]@3 int v5; // [sp+54h] [bp-4h]@3 fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a3 + a2 + setting_map_startGridOffset; grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; while ( dword_634464 != dword_608780[0] ) { v5 = word_6210C0[dword_634464]; v4 = grid_pathingDistance[v5] + 1; if ( !grid_pathingDistance[v5 - 162] ) { if ( grid_groundType_162[v5] == 4 ) { grid_pathingDistance[v5 - 162] = v4; word_6210C0[dword_608780[0]++] = v5 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 + 1] ) { if ( grid_groundType1[v5] == 4 ) { grid_pathingDistance[v5 + 1] = v4; word_6210C0[dword_608780[0]++] = v5 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 + 162] ) { if ( grid_groundType162[v5] == 4 ) { grid_pathingDistance[v5 + 162] = v4; word_6210C0[dword_608780[0]++] = v5 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 - 1] ) { if ( grid_groundType_1[v5] == 4 ) { grid_pathingDistance[v5 - 1] = v4; word_6210C0[dword_608780[0]++] = v5 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } return 1; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (005041C0) -------------------------------------------------------- signed int sub_5041C0(int a1, int a2, int a3, int a4, int a5, int a6) { signed int v7; // [sp+54h] [bp-24h]@1 int v8; // [sp+60h] [bp-18h]@20 signed int i; // [sp+64h] [bp-14h]@18 int v10; // [sp+68h] [bp-10h]@20 int v11; // [sp+6Ch] [bp-Ch]@16 int v12; // [sp+70h] [bp-8h]@3 v7 = 0; multipleConstruction_itemsPlaced = 0; dword_62DDC8[0] = 162 * a5 + a4 + setting_map_startGridOffset; while ( 1 ) { ++v7; if ( v7 >= 400 ) return 0; v12 = grid_pathingDistance[dword_62DDC8[0]]; if ( v12 <= 0 ) return 0; if ( a6 ) { switch ( a6 ) { case 1: sub_47DF20(a4, a5, 1); break; case 2: sub_47F830(a4, a5); break; case 3: sub_47F8C0(a4, a5, 1); break; case 4: ++multipleConstruction_itemsPlaced; break; default: sub_47EDE0(a4, a5, 1); break; } } else { sub_47EDE0(a4, a5, 1); } v11 = fun_walkerGetSimpleDestinationDirection(a4, a5, a2, a3); if ( v11 == 8 ) return 1; for ( i = 0; i < 4; ++i ) { v10 = *(int *)((char *)&dword_5FFEAC[4 * v11] + 4 * i); v8 = grid_pathingDistance[dword_5FFE4C[v10] + dword_62DDC8[0]]; if ( v8 > 0 && v8 < v12 ) { dword_62DDC8[0] += dword_5FFE4C[v10]; a4 += dword_5FFE6C[2 * v10]; a5 += dword_5FFE70[2 * v10]; break; } } if ( i >= 4 ) return 0; } } // 4020A9: using guessed type _DWORD sub_4020A9(_DWORD, _DWORD, _DWORD); // 40231F: using guessed type _DWORD sub_40231F(_DWORD, _DWORD); // 402DAB: using guessed type _DWORD sub_402DAB(_DWORD, _DWORD, _DWORD); // 403102: using guessed type _DWORD sub_403102(_DWORD, _DWORD, _DWORD); // 5FFE6C: using guessed type int dword_5FFE6C[]; // 62DDC8: using guessed type int dword_62DDC8[6]; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8B45F0: using guessed type int multipleConstruction_itemsPlaced; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (00504440) -------------------------------------------------------- char fun_walkerGetSimpleDestinationDirection(int x1, int y1, int x2, int y2) { if ( x1 <= x2 ) { if ( x1 == x2 ) { if ( y1 > y2 ) return 0; if ( y1 < y2 ) return 4; } else { if ( x1 < x2 ) { if ( y1 > y2 ) return 1; if ( y1 == y2 ) return 2; if ( y1 < y2 ) return 3; } } } else { if ( y1 > y2 ) return 7; if ( y1 == y2 ) return 6; if ( y1 < y2 ) return 5; } return 8; } //----- (00504500) -------------------------------------------------------- char fun_pathing_getDirection16(int xFrom, int yFrom, int xTo, int yTo) { char result; // al@14 int percentage; // [sp+4Ch] [bp-Ch]@8 int deltaY; // [sp+50h] [bp-8h]@5 signed int deltaX; // [sp+54h] [bp-4h]@2 if ( xFrom <= xTo ) deltaX = xTo - xFrom; else deltaX = xFrom - xTo; if ( yFrom <= yTo ) deltaY = yTo - yFrom; else deltaY = yFrom - yTo; if ( deltaX <= deltaY ) { if ( deltaX >= deltaY ) percentage = 100; else percentage = -getPercentage(deltaY, deltaX); } else { percentage = getPercentage(deltaX, deltaY); } if ( xFrom != xTo ) goto LABEL_64; if ( yFrom > yTo ) return 0; if ( yFrom >= yTo ) { LABEL_64: if ( xFrom <= xTo ) { if ( xFrom >= xTo ) { result = 0; } else { if ( yFrom == yTo ) { result = 4; } else { if ( yFrom <= yTo ) { if ( percentage < 500 ) { if ( percentage < 200 ) { if ( percentage <= -200 ) { if ( percentage <= -500 ) result = 8; else result = 7; } else { result = 6; } } else { result = 5; } } else { result = 4; } } else { if ( percentage < 500 ) { if ( percentage < 200 ) { if ( percentage <= -200 ) result = percentage > -500; else result = 2; } else { result = 3; } } else { result = 4; } } } } } else { if ( yFrom == yTo ) { result = 12; } else { if ( yFrom <= yTo ) { if ( percentage < 500 ) { if ( percentage < 200 ) { if ( percentage <= -200 ) { if ( percentage <= -500 ) result = 8; else result = 9; } else { result = 10; } } else { result = 11; } } else { result = 12; } } else { if ( percentage < 500 ) { if ( percentage < 200 ) { if ( percentage <= -200 ) { if ( percentage <= -500 ) result = 0; else result = 15; } else { result = 14; } } else { result = 13; } } else { result = 12; } } } } } else { result = 8; } return result; } //----- (00504780) -------------------------------------------------------- signed int unused_pathing_getDirection4(int x1, int y1, int x2, int y2, int min) { int dy_; // [sp+4Ch] [bp-8h]@5 int dx_; // [sp+50h] [bp-4h]@2 if ( x1 <= x2 ) dx_ = x2 - x1; else dx_ = x1 - x2; if ( y1 <= y2 ) dy_ = y2 - y1; else dy_ = y1 - y2; if ( dx_ <= dy_ ) { if ( dy_ <= min ) return 8; if ( y1 > y2 ) return 0; if ( y1 < y2 ) return 4; } else { if ( dx_ <= min ) return 8; if ( x1 > x2 ) return 6; if ( x1 < x2 ) return 2; } return 8; } //----- (00504860) -------------------------------------------------------- char fun_pathing_getDirection8(int xFrom, int yFrom, int xTo, int yTo) { char result; // al@14 int v5; // [sp+4Ch] [bp-Ch]@8 int d_y; // [sp+50h] [bp-8h]@5 signed int d_x; // [sp+54h] [bp-4h]@2 if ( xFrom <= xTo ) d_x = xTo - xFrom; else d_x = xFrom - xTo; if ( yFrom <= yTo ) d_y = yTo - yFrom; else d_y = yFrom - yTo; if ( d_x <= d_y ) { if ( d_x >= d_y ) v5 = 100; else v5 = -getPercentage(d_y, d_x); } else { v5 = getPercentage(d_x, d_y); } if ( xFrom != xTo ) goto LABEL_48; if ( yFrom > yTo ) return 0; if ( yFrom >= yTo ) { LABEL_48: if ( xFrom <= xTo ) { if ( xFrom >= xTo ) { result = Direction_North; } else { if ( yFrom == yTo ) { result = Direction_East; } else { if ( yFrom <= yTo ) { if ( v5 < 400 ) { if ( v5 <= -400 ) result = Direction_South; else result = Direction_SouthEast; } else { result = Direction_East; } } else { if ( v5 < 400 ) result = v5 > -400; else result = Direction_East; } } } } else { if ( yFrom == yTo ) { result = Direction_West; } else { if ( yFrom <= yTo ) { if ( v5 < 400 ) { if ( v5 <= -400 ) result = Direction_South; else result = Direction_SouthWest; } else { result = Direction_West; } } else { if ( v5 < 400 ) { if ( v5 <= -400 ) result = Direction_North; else result = Direction_NorthWest; } else { result = Direction_West; } } } } } else { result = Direction_South; } return result; } //----- (00504A30) -------------------------------------------------------- signed int fun_determineOpenWaterTiles(int riverEntryX, int riverEntryY) { signed int result; // eax@2 signed int v3; // ecx@11 int v4; // [sp+4Ch] [bp-1Ch]@1 signed int v5; // [sp+50h] [bp-18h]@1 signed int v6; // [sp+58h] [bp-10h]@18 signed int v7; // [sp+58h] [bp-10h]@28 signed int v8; // [sp+58h] [bp-10h]@38 signed int v9; // [sp+58h] [bp-10h]@48 signed int v10; // [sp+5Ch] [bp-Ch]@8 int v11; // [sp+60h] [bp-8h]@17 int v12; // [sp+64h] [bp-4h]@7 v4 = 0; v5 = 0; fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * riverEntryY + riverEntryX + setting_map_startGridOffset; if ( byte_614180[destinationGridOffset] == -1 ) { result = 0; } else { fun_memset(byte_62DDE0, 26244, 0); grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; while ( dword_634464 != dword_608780[0] ) { ++v5; if ( v5 > 50000 ) break; v12 = word_6210C0[dword_634464]; if ( byte_614180[v12] == -2 ) v10 = 4; else v10 = 0; if ( v10 && (v3 = byte_62DDE0[v12], ++byte_62DDE0[v12], v3 < v10) ) { ++v4; word_6210C0[dword_608780[0]++] = v12; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } else { v11 = grid_pathingDistance[v12] + 1; if ( !grid_pathingDistance[v12 - 162] ) { v6 = 0; if ( byte_6140DE[v12] == -1 ) v6 = 1; if ( byte_6140DE[v12] == -3 ) v6 = 1; if ( !v6 ) { grid_pathingDistance[v12 - 162] = v11; if ( byte_6140DE[v12] == -2 ) grid_pathingDistance[v12 - 162] += 4; word_6210C0[dword_608780[0]++] = v12 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v12 + 1] ) { v7 = 0; if ( byte_614181[v12] == -1 ) v7 = 1; if ( byte_614181[v12] == -3 ) v7 = 1; if ( !v7 ) { grid_pathingDistance[v12 + 1] = v11; if ( byte_614181[v12] == -2 ) grid_pathingDistance[v12 + 1] += 4; word_6210C0[dword_608780[0]++] = v12 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v12 + 162] ) { v8 = 0; if ( byte_614222[v12] == -1 ) v8 = 1; if ( byte_614222[v12] == -3 ) v8 = 1; if ( !v8 ) { grid_pathingDistance[v12 + 162] = v11; if ( byte_614222[v12] == -2 ) grid_pathingDistance[v12 + 162] += 4; word_6210C0[dword_608780[0]++] = v12 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v12 - 1] ) { v9 = 0; if ( byte_61417F[v12] == -1 ) v9 = 1; if ( byte_61417F[v12] == -3 ) v9 = 1; if ( !v9 ) { grid_pathingDistance[v12 - 1] = v11; if ( byte_61417F[v12] == -2 ) grid_pathingDistance[v12 - 1] += 4; word_6210C0[dword_608780[0]++] = v12 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } } result = 1; } return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (00505060) -------------------------------------------------------- signed int sub_505060(int a1, int a2) { signed int result; // eax@2 signed int v3; // [sp+50h] [bp-10h]@1 int v4; // [sp+58h] [bp-8h]@7 int v5; // [sp+5Ch] [bp-4h]@7 v3 = 0; fun_memset(grid_pathingDistance, 52488, 0); destinationGridOffset = 162 * a2 + a1 + setting_map_startGridOffset; if ( byte_614180[destinationGridOffset] == -1 ) { result = 0; } else { grid_pathingDistance[destinationGridOffset] = 1; word_6210C0[0] = destinationGridOffset; dword_634464 = 0; dword_608780[0] = 1; while ( dword_634464 != dword_608780[0] ) { ++v3; if ( v3 > 50000 ) break; v5 = word_6210C0[dword_634464]; v4 = grid_pathingDistance[v5] + 1; if ( !grid_pathingDistance[v5 - 162] ) { if ( byte_6140DE[v5] != -1 ) { grid_pathingDistance[v5 - 162] = v4; word_6210C0[dword_608780[0]++] = v5 - 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 + 1] ) { if ( byte_614181[v5] != -1 ) { grid_pathingDistance[v5 + 1] = v4; word_6210C0[dword_608780[0]++] = v5 + 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 + 162] ) { if ( byte_614222[v5] != -1 ) { grid_pathingDistance[v5 + 162] = v4; word_6210C0[dword_608780[0]++] = v5 + 162; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 - 1] ) { if ( byte_61417F[v5] != -1 ) { grid_pathingDistance[v5 - 1] = v4; word_6210C0[dword_608780[0]++] = v5 - 1; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 - 161] ) { if ( byte_6140DF[v5] != -1 ) { grid_pathingDistance[v5 - 161] = v4; word_6210C0[dword_608780[0]++] = v5 - 161; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 + 163] ) { if ( byte_614223[v5] != -1 ) { grid_pathingDistance[v5 + 163] = v4; word_6210C0[dword_608780[0]++] = v5 + 163; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 + 161] ) { if ( byte_614221[v5] != -1 ) { grid_pathingDistance[v5 + 161] = v4; word_6210C0[dword_608780[0]++] = v5 + 161; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } if ( !grid_pathingDistance[v5 - 163] ) { if ( byte_6140DD[v5] != -1 ) { grid_pathingDistance[v5 - 163] = v4; word_6210C0[dword_608780[0]++] = v5 - 163; if ( dword_608780[0] > 26243 ) dword_608780[0] = 0; } } ++dword_634464; if ( dword_634464 > 26243 ) dword_634464 = 0; } result = 1; } return result; } // 608780: using guessed type int dword_608780[11863]; // 614150: using guessed type int destinationGridOffset; // 634464: using guessed type int dword_634464; // 634480: using guessed type __int16 grid_pathingDistance[]; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (005055F0) -------------------------------------------------------- signed int fun_determineShortestPathOnWater(int destinationPathId, int curX, int curY, int destX, int destY, int isFlotsam) { signed int result; // eax@3 int v7; // ST74_4@9 int v8; // ecx@14 int v9; // [sp+4Ch] [bp-34h]@7 int rand; // [sp+50h] [bp-30h]@1 int y; // [sp+54h] [bp-2Ch]@1 int x; // [sp+58h] [bp-28h]@1 signed int i; // [sp+5Ch] [bp-24h]@9 signed int j; // [sp+5Ch] [bp-24h]@45 signed int lastDirection; // [sp+60h] [bp-20h]@4 signed int direction; // [sp+68h] [bp-18h]@9 int forwardDirection; // [sp+68h] [bp-18h]@40 signed int v18; // [sp+6Ch] [bp-14h]@14 signed int distance; // [sp+70h] [bp-10h]@1 signed int numTiles; // [sp+74h] [bp-Ch]@4 int gridOffset; // [sp+78h] [bp-8h]@1 rand = random_7f_1 & 3; x = destX; y = destY; destinationGridOffset = 162 * destY + destX + setting_map_startGridOffset; gridOffset = destinationGridOffset; distance = grid_pathingDistance[destinationGridOffset]; if ( distance > 0 && distance < 998 ) { numTiles = 0; lastDirection = -1; while ( distance > 1 ) { distance = grid_pathingDistance[gridOffset]; if ( isFlotsam == 1 ) v9 = grid_random[gridOffset] & 3; else v9 = rand; direction = -1; v7 = fun_walkerGetSimpleDestinationDirection(x, y, curX, curY); for ( i = 0; i < 8; ++i ) { if ( i != lastDirection ) { v8 = dword_5FFE4C[i] + gridOffset; v18 = grid_pathingDistance[v8]; if ( grid_pathingDistance[v8] ) { if ( v18 >= distance ) { if ( v18 == distance ) { if ( rand == v9 ) { distance = grid_pathingDistance[v8]; direction = i; } } } else { distance = grid_pathingDistance[v8]; direction = i; } } } } if ( direction == -1 ) return 0; if ( direction ) { switch ( direction ) { case 1: --y; ++x; gridOffset -= 161; break; case 2: ++x; ++gridOffset; break; case 3: ++x; ++y; gridOffset += 163; break; case 4: ++y; gridOffset += 162; break; case 5: ++y; --x; gridOffset += 161; break; case 6: --x; --gridOffset; break; case 7: --x; --y; gridOffset -= 163; break; } } else { --y; gridOffset -= 162; } forwardDirection = direction + 4; if ( forwardDirection >= 8 ) forwardDirection -= 8; reverseDestinationPath[numTiles++] = forwardDirection; lastDirection = forwardDirection; if ( numTiles >= 500 ) return 0; } for ( j = 0; j < numTiles; ++j ) *(&destinationpath_data[500 * destinationPathId] + j) = reverseDestinationPath[numTiles - 1 - j]; result = numTiles; } else { result = 0; } return result; } // 614150: using guessed type int destinationGridOffset; // 634480: using guessed type __int16 grid_pathingDistance[]; // 6AD9EC: using guessed type int random_7f_1; // 8C7A00: using guessed type int setting_map_startGridOffset; //----- (005059B0) -------------------------------------------------------- void fun_setCityScreenWidths() { switch ( screen_width ) { case 640: cityscreen_width_withControlpanel = 478; cityscreen_width_withoutControlpanel = 598; break; case 800: cityscreen_width_withControlpanel = 598; cityscreen_width_withoutControlpanel = 718; break; case 1024: cityscreen_width_withControlpanel = 838; cityscreen_width_withoutControlpanel = 958; break; } } //----- (00505A50) -------------------------------------------------------- void fun_drawCityScreenForeground() { if ( screen_width == 1024 ) { fun_drawCitySidepanelBorder_1024(); } else { if ( screen_width == 800 ) fun_drawCitySidepanelBorder_800(); } if ( screen_width == 1024 ) // black border at bottom fun_fillRect(0, screen_height - 9, screen_width, 9, 0); else fun_fillRect(0, screen_height - 6, screen_width, 6, 0); imagebuttons_redraw = 1; if ( mode_editor ) { sub_4DC1B0(); drawGraphic(word_6E6C50, cityscreen_width_withControlpanel, 24); if ( screen_width == 1024 ) { drawGraphic(word_6E6C50 + 2, cityscreen_width_withControlpanel, 474); } else { if ( screen_width == 800 ) drawGraphic(word_6E6C50 + 1, cityscreen_width_withControlpanel, 474); } fun_drawCitySidepanelEditorConsole(); fun_drawImageButtonCollection(cityscreen_width_withControlpanel, 24, &imagebuttons_unknown_5EEF00, 17); fun_drawCitySidepanelMinimap(1); } else { if ( sidepanel_collapsed ) // sidepanel background image drawGraphic(graphic_sidepanel, cityscreen_width_withoutControlpanel, 24); else drawGraphic(graphic_sidepanel + 1, cityscreen_width_withControlpanel, 24); fun_drawCitySidepanelButtons(); fun_drawCitySidepanelOverlayButtonText(1, cityscreen_width_withControlpanel + 4); fun_drawCitySidepanelBuildingGraphic(0, cityscreen_width_withControlpanel + 6); fun_drawCitySidepanelMinimap(1); if ( screen_width == 1024 ) // relief image below panel buttons { if ( sidepanel_collapsed ) { if ( sidepanel_collapsed == 1 ) drawGraphic(graphic_sidepanel + 5, cityscreen_width_withoutControlpanel, 474); } else { drawGraphic(graphic_sidepanel + 4, cityscreen_width_withControlpanel, 474); } } else { if ( screen_width == 800 ) // relief image below panel buttons { if ( sidepanel_collapsed ) { if ( sidepanel_collapsed == 1 ) drawGraphic(graphic_sidepanel + 3, cityscreen_width_withoutControlpanel, 474); } else { drawGraphic(graphic_sidepanel + 2, cityscreen_width_withControlpanel, 474); } } } } fun_drawTopMenu(1); fun_drawCitySidepanelNumMessages(1); } // 6080A8: using guessed type int sidepanel_collapsed; // 65E6D4: using guessed type int screen_height; // 660905: using guessed type char imagebuttons_redraw; // 6E6BC8: using guessed type __int16 graphic_sidepanel; // 6E6C50: using guessed type __int16 word_6E6C50; // 9DA898: using guessed type int mode_editor; //----- (00505D70) -------------------------------------------------------- void fun_drawCitySidepanelButtons() { imagebuttons_sidebar_build[12].state_enabled = dword_9363B0 && dword_8E1484; if ( sidepanel_collapsed ) { if ( sidepanel_collapsed == 1 ) { fun_drawImageButtonCollection(cityscreen_width_withoutControlpanel, 24, &imagebuttons_unknown_5EEB08, 1); fun_drawImageButtonCollection(cityscreen_width_withoutControlpanel, 24, imagebuttons_sidebar_buildCollapsed, 12); } } else { fun_drawImageButtonCollection(cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_overlayCollapse, 2); fun_drawImageButtonCollection(cityscreen_width_withControlpanel, 24, imagebuttons_sidebar_build, 15); fun_drawImageButtonCollection(cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_advEmpOri, 6); } } // 6080A8: using guessed type int sidepanel_collapsed; //----- (00505E60) -------------------------------------------------------- void fun_drawCitySidepanelOverlayButtonText(signed int forceRedraw, int xOffset) { if ( currentOverlay != sidebarOverlayTextId ) forceRedraw = 1; if ( fun_drawImageButtonCollection ) forceRedraw = 1; if ( !sidepanel_collapsed ) { if ( forceRedraw ) { sidebarOverlayTextId = currentOverlay; if ( currentOverlay ) fun_drawGameTextCentered(14, currentOverlay, xOffset, 32, 117, graphic_font + F_SmallBrown, -1); else fun_drawGameTextCentered(6, 4, xOffset, 32, 117, graphic_font + F_SmallBrown, -1); } } } void fun_drawCitySidepanelBuildingGraphic(int forceRedraw, int xOffset) { if ( forceRedraw || !sidepanel_collapsed ) { if ( toPlace_buildingType ) { switch ( buildmenu.selectedSubMenu ) { case 1: drawGraphic(graphic_panelwindows, xOffset, 239); break; case 4: if ( scn_climate == 2 ) drawGraphic(word_6E6DAA + 2, xOffset, 239); else drawGraphic(graphic_panelwindows + 3, xOffset, 239); break; case 5: drawGraphic(graphic_panelwindows + 5, xOffset, 239); break; case 6: drawGraphic(graphic_panelwindows + 1, xOffset, 239); break; case 7: drawGraphic(graphic_panelwindows + 6, xOffset, 239); break; case 8: drawGraphic(graphic_panelwindows + 4, xOffset, 239); break; case 9: drawGraphic(graphic_panelwindows + 2, xOffset, 239); break; case 10: drawGraphic(graphic_panelwindows + 7, xOffset, 239); break; case 11: if ( scn_climate == 2 ) drawGraphic(word_6E6DAA + 3, xOffset, 239); else drawGraphic(graphic_panelwindows + 8, xOffset, 239); break; case 12: drawGraphic(graphic_panelwindows + 9, xOffset, 239); break; case 3: if ( scn_climate == 2 ) drawGraphic(word_6E6DAA + 1, xOffset, 239); else drawGraphic(graphic_panelwindows + 10, xOffset, 239); break; case 2: if ( scn_climate == 2 ) drawGraphic(word_6E6DAA, xOffset, 239); else drawGraphic(graphic_panelwindows + 11, xOffset, 239); break; default: drawGraphic(graphic_panelwindows, xOffset, 239); break; } } else { drawGraphic(graphic_panelwindows + 12, xOffset, 239); } } } // 6080A8: using guessed type int sidepanel_collapsed; // 6E6C6E: using guessed type __int16 graphic_panelwindows; // 6E6DAA: using guessed type __int16 word_6E6DAA; // 98EF28: using guessed type char scn_climate; // 9D7B48: using guessed type int buildmenu.selectedSubMenu; //----- (00506300) -------------------------------------------------------- void fun_drawCitySidepanelMinimap(int forceRedraw) { signed int draw; // [sp+4Ch] [bp-4h]@1 draw = 0; if ( !sidepanel_collapsed ) { if ( dword_608100 ) { dword_608100 = 0; draw = 1; } if ( mode_editor == 1 ) { if ( dword_9DA918 ) draw = 1; } if ( shouldScrollMap ) draw = 1; if ( forceRedraw ) draw = 1; if ( draw ) { if ( mode_editor ) { fun_drawMinimap(cityscreen_width_withControlpanel + 8, 30, 73, 111); fun_drawLine(cityscreen_width_withControlpanel + 7, 29, cityscreen_width_withControlpanel + 153, 29, 16904); fun_drawLine(cityscreen_width_withControlpanel + 7, 30, cityscreen_width_withControlpanel + 7, 141, 16904); fun_drawLine(cityscreen_width_withControlpanel + 153, 30, cityscreen_width_withControlpanel + 153, 141, 50712); } else { fun_drawMinimap(cityscreen_width_withControlpanel + 8, 59, 73, 111); fun_drawLine(cityscreen_width_withControlpanel + 7, 58, cityscreen_width_withControlpanel + 153, 58, 16904); fun_drawLine(cityscreen_width_withControlpanel + 7, 59, cityscreen_width_withControlpanel + 7, 170, 16904); fun_drawLine(cityscreen_width_withControlpanel + 153, 59, cityscreen_width_withControlpanel + 153, 170, 50712); } } } } // 6080A8: using guessed type int sidepanel_collapsed; // 608100: using guessed type int dword_608100; // 660C4C: using guessed type int shouldScrollMap; // 9DA898: using guessed type int mode_editor; //----- (00506530) -------------------------------------------------------- void fun_drawTopMenu(signed int a1) { unsigned __int16 treasureColor; // [sp+4Ch] [bp-4h]@62 if ( window_id ) { if ( window_id != 20 ) { if ( window_id != 21 ) { if ( window_id != 7 ) { if ( window_id != 14 ) { if ( window_id != 15 ) { if ( window_id != 40 ) { if ( window_id != 41 ) { if ( window_id != 42 ) { if ( window_id != 43 ) { if ( window_id != 44 ) { if ( window_id != 45 ) { if ( window_id != 46 ) { if ( window_id != 16 ) { if ( window_id != 17 ) { if ( window_id != 19 ) { if ( window_id != 18 ) { if ( window_id != 13 ) { if ( window_id != 5 ) { if ( window_id != 4 ) { if ( window_id != 63 ) { if ( window_id < 50 ) { if ( city_inform[ciid].population != topmenu_populationValue ) a1 = 1; if ( city_inform[ciid].treasury != topmenu_treasuryValue ) a1 = 1; if ( gametime_month != topmenu_monthValue ) a1 = 1; if ( a1 ) dword_5FFF58[0] = 1; if ( dword_5FFF58[0] > 0 ) { if ( dword_5FFF58[0] == 1 ) { fun_drawTopMenuBackground(); } else { if ( dword_5FFF58[0] == 2 ) fun_drawTopMenuBackground(); } dword_5FFF58[0] = 0; topmenu_populationValue = city_inform[ciid].population; topmenu_treasuryValue = city_inform[ciid].treasury; if ( mode_editor == 1 ) { fun_drawMenuBar(&topmenu_editor, 4); } else { fun_drawMenuBar(&topmenu_game, 4); text_xoffset = 0; if ( city_inform[ciid].treasury < 0 ) treasureColor = 0xF800u; else treasureColor = 0xFFFFu; switch ( screen_width ) { case 640: topmenu_offsetFunds = 338; topmenu_offsetPopulation = 453; topmenu_offsetDate = 547; fun_drawGameText(6, 0, 350, 5, graphic_font, treasureColor); drawNumber( city_inform[ciid].treasury, 64, " ", text_xoffset + 346, 5, graphic_font, treasureColor); text_xoffset = 0; fun_drawGameText(6, 1, 458, 5, graphic_font + 1072, -1); drawNumber( city_inform[ciid].population, 64, " ", text_xoffset + 450, 5, graphic_font + 1072, -1); text_xoffset = 0; fun_drawGameText( 25, gametime_month, 552, 5, graphic_font + 1072, -6389); fun_drawGameYearWithBcAd( 2, gametime_year, text_xoffset + 541, 5, graphic_font + 1072, 0); break; case 800: topmenu_offsetFunds = 338; topmenu_offsetPopulation = 458; topmenu_offsetDate = 652; fun_drawGameText(6, 0, 350, 5, graphic_font, treasureColor); drawNumber( city_inform[ciid].treasury, 64, " ", text_xoffset + 346, 5, graphic_font, treasureColor); text_xoffset = 0; fun_drawGameText(6, 1, 470, 5, graphic_font, -1); drawNumber( city_inform[ciid].population, 64, " ", text_xoffset + 466, 5, graphic_font, -1); text_xoffset = 0; fun_drawGameText( GAMETEXT_MONTHS, gametime_month, 655, 5, graphic_font, -6389); fun_drawGameYearWithBcAd( 0, gametime_year, text_xoffset + 655, 5, graphic_font, -6389); break; case 1024: topmenu_offsetFunds = 493; topmenu_offsetPopulation = 637; topmenu_offsetDate = 852; fun_drawGameText(6, 0, 495, 5, graphic_font, treasureColor); drawNumber( city_inform[ciid].treasury, 64, " ", text_xoffset + 501, 5, graphic_font, treasureColor); text_xoffset = 0; fun_drawGameText(6, 1, 645, 5, graphic_font, -1); drawNumber( city_inform[ciid].population, 64, " ", text_xoffset + 651, 5, graphic_font, 0xFFFFu); text_xoffset = 0; fun_drawGameText( GAMETEXT_MONTHS, gametime_month, 850, 5, graphic_font, 0xE70Bu); fun_drawGameYearWithBcAd( 0, gametime_year, text_xoffset + 850, 5, graphic_font, 0xE70Bu); break; } } } } } } } } } } } } } } } } } } } } } } } } } } // 5FFF58: using guessed type int dword_5FFF58[2]; // 6086F0: using guessed type int topmenu_populationValue; // 6086FC: using guessed type int topmenu_offsetDate; // 608700: using guessed type int topmenu_offsetPopulation; // 608704: using guessed type int topmenu_offsetFunds; // 608778: using guessed type int topmenu_monthValue; // 60877C: using guessed type int topmenu_treasuryValue; // 6500AC: using guessed type int cityinfo_treasury[]; // 6500C4: using guessed type int cityinfo_population[]; // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 9DA898: using guessed type int mode_editor; //----- (00506DB0) -------------------------------------------------------- void fun_drawCitySidepanelNumMessages(signed int forceRedraw) { if ( mode_editor != 1 ) { if ( window_id == 1 ) { if ( !sidepanel_collapsed ) { if ( playermessageTotal != dword_608708 ) forceRedraw = 1; if ( forceRedraw ) { dword_608708 = playermessageTotal; imagebuttons_sidebar_build[12].state_enabled = dword_9363B0 && dword_8E1484; imagebuttons_sidebar_build[13].state_enabled = playermessageTotal > 0; imagebuttons_sidebar_build[14].state_enabled = playermessageHotspot > 0; if ( playermessageTotal ) { fun_drawNumberCentered( playermessageTotal, 64, " ", cityscreen_width_withControlpanel + 72, 452, 32, graphic_font + 938, 0); fun_drawNumberCentered( playermessageTotal, 64, " ", cityscreen_width_withControlpanel + 71, 453, 32, graphic_font + 938, -1); } } } } } } // 6080A8: using guessed type int sidepanel_collapsed; // 608708: using guessed type int dword_608708; // 6E6BD0: using guessed type __int16 graphic_font; // 9DA898: using guessed type int mode_editor; //----- (00506F40) -------------------------------------------------------- void empty_drawMainMenuBackground() { ; } //----- (00506F60) -------------------------------------------------------- void fun_editor_drawEmpireUnsavedDataWarning() { if ( !editEmpire_isSaved ) { fun_drawText("UNSAVED DATA ", 40, 40, graphic_font + 536, 0); fun_drawText("UNSAVED DATA ", 39, 39, graphic_font + 536, -2048); } } // 5F96BC: using guessed type int editEmpire_isSaved; // 6E6BD0: using guessed type __int16 graphic_font; //----- (00506FE0) -------------------------------------------------------- void fun_drawCityScreen_PausedAndTime() { int v0; // ST6C_4@5 int v1; // ST6C_4@10 int v2; // ST68_4@16 int v3; // [sp+54h] [bp-4h]@3 int v4; // [sp+54h] [bp-4h]@8 if ( scn_win_timeLimit_on ) { if ( timeLimit_maxGameYear <= gametime_year + 1 ) v3 = 0; else v3 = timeLimit_maxGameYear - gametime_year - 1; v0 = 12 - gametime_month + 12 * v3; fun_drawSmallGreyButton(6, 1, 25, 15, 1, 1); text_xoffset = 0; fun_drawGameText(6, 2, 6, 29, graphic_font + 134, -2048); drawNumber(v0, 64, " ", text_xoffset + 6, 29, graphic_font + 134, -2048); } else { if ( scn_win_survivalTime_on ) { if ( timeLimit_maxGameYear <= gametime_year + 1 ) v4 = 0; else v4 = timeLimit_maxGameYear - gametime_year - 1; v1 = 12 - gametime_month + 12 * v4; fun_drawSmallGreyButton(6, 1, 25, 15, 1, 1); text_xoffset = 0; fun_drawGameText(6, 3, 6, 29, graphic_font + 134, -2048); drawNumber(v1, 64, " ", text_xoffset + 6, 29, graphic_font + 134, -2048); } } text_xoffset = 0; if ( setting_isCustomScenario == 1 ) fun_drawText("Map creation mode ", text_xoffset + 10, 41, graphic_font, -1); if ( debug_showHappinessProsperityInfo ) { drawNumber(city_inform[ciid].hapinessCity, 64, " Happiness", 2, 60, graphic_font, 0); drawNumber(city_inform[ciid].hapinessCity, 64, " Happiness", 1, 61, graphic_font, -1); drawNumber(city_inform[ciid].maxProsperity[0], 64, " Max prosperity", 2, 80, graphic_font, 0); drawNumber(city_inform[ciid].maxProsperity[0], 64, " Max prosperity", 1, 81, graphic_font, -1); } if ( setting_game_paused ) { v2 = fun_getCityScreenWidth(); fun_drawDialogBackground((v2 - 448) / 2, 40, 28, 3); fun_drawGameTextCentered(13, 2, (v2 - 448) / 2, 58, 448, graphic_font + 134, 0); } } void fun_drawCitySidepanel() { signed int v0; // [sp+4Ch] [bp-8h]@21 int v1; // [sp+50h] [bp-4h]@14 if ( speed_time_overall > 24 ) { if ( speed_time_overall > 60 ) { if ( speed_time_overall > 96 ) sidepanel_slide_progress[0] += 4; else sidepanel_slide_progress[0] += 3; } else { sidepanel_slide_progress[0] += 2; } } else { ++sidepanel_slide_progress[0]; } if ( sidepanel_slide_progress[0] < 47 ) { if ( sidepanel_collapsed == 1 ) v1 = dword_5FFFDC[47 - sidepanel_slide_progress[0]]; else v1 = dword_5FFFDC[sidepanel_slide_progress[0]]; sub_4DC1B0(); if ( screen_width == 1024 ) { draw_clip_xEnd = 1000; } else { if ( screen_width == 800 ) draw_clip_xEnd = 760; } imagebuttons_redraw = 1; drawGraphic(graphic_sidepanel, cityscreen_width_withoutControlpanel, 24); fun_drawImageButtonCollection(cityscreen_width_withoutControlpanel, 24, imagebuttons_sidebar_buildCollapsed, 12); fun_drawImageButtonCollection(cityscreen_width_withoutControlpanel, 24, &imagebuttons_unknown_5EEB08, 1); drawGraphic(graphic_sidepanel + 1, v1 + cityscreen_width_withControlpanel, 24); fun_drawImageButtonCollection(v1 + cityscreen_width_withControlpanel, 24, imagebuttons_sidebar_build, 15); fun_drawImageButtonCollection( v1 + cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_overlayCollapse, 2); fun_drawImageButtonCollection(v1 + cityscreen_width_withControlpanel, 24, &imagebuttons_sidebar_advEmpOri, 6); fun_drawCitySidepanelOverlayButtonText(1, cityscreen_width_withControlpanel + v1 + 4); fun_drawCitySidepanelBuildingGraphic(1, cityscreen_width_withControlpanel + v1 + 6); if ( v1 <= 8 ) v0 = v1; else v0 = 8; fun_fillRect(cityscreen_width_withControlpanel + v1 + 8, 59, v0 + 145 - v1, 111, 0); if ( screen_width == 1024 ) { drawGraphic(graphic_sidepanel + 5, cityscreen_width_withoutControlpanel, 474); drawGraphic(graphic_sidepanel + 4, v1 + cityscreen_width_withControlpanel, 474); } else { if ( screen_width == 800 ) { drawGraphic(graphic_sidepanel + 3, cityscreen_width_withoutControlpanel, 474); drawGraphic(graphic_sidepanel + 2, v1 + cityscreen_width_withControlpanel, 474); } } draw_clip_xEnd = screen_width; } else { if ( sidepanel_collapsed ) { fun_setCityViewport_withPanel(); sidepanel_collapsed = 0; } else { fun_setCityViewport_withoutPanel(); sidepanel_collapsed = 1; } window_id = 1; sub_4DC600(); fun_drawWindow(1); } } // 6080A8: using guessed type int sidepanel_collapsed; // 6080AC: using guessed type int sidepanel_slide_progress[21]; // 6608A4: using guessed type int speed_time_overall; // 660905: using guessed type char imagebuttons_redraw; // 6E6B4C: using guessed type int draw_clip_xEnd; // 6E6BC8: using guessed type __int16 graphic_sidepanel; //----- (00507750) -------------------------------------------------------- void sub_507750() { fun_drawCityScreenForeground(); sub_4DC1B0(); if ( window_redrawRequest >= 2 ) { button_something_8 = 0; fun_editor_drawControlPanelSubmenuButtons(); } } void fun_editor_drawControlPanelSubmenuButtons() { int v0; // [sp+4Ch] [bp-24h]@29 signed int v1; // [sp+50h] [bp-20h]@27 int v2; // [sp+5Ch] [bp-14h]@5 int v3; // [sp+60h] [bp-10h]@1 __int16 v4; // [sp+64h] [bp-Ch]@11 int v5; // [sp+68h] [bp-8h]@8 int i; // [sp+6Ch] [bp-4h]@5 v3 = cityscreen_width_withControlpanel; if ( sidepanel_collapsed == 1 ) v3 = cityscreen_width_withoutControlpanel; if ( mode_editor == 1 ) v3 = cityscreen_width_withControlpanel; v2 = -1; for ( i = 0; i < buildmenu.submenuNumItems; ++i ) { v2 = fun_sidePanel_submenuGetNextIndex(buildmenu.selectedSubMenu - 1, v2); if ( mouseover_button_id == i + 1 ) v5 = 1; else v5 = 2; if ( mouseover_button_id == i + 1 ) v4 = -1343; else v4 = 16122; switch ( buildmenu.selectedSubMenu ) { case 14: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) - 1, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; case 15: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) + 4, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; case 17: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) + 9, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; case 16: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) + 6, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; case 18: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) + 17, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; case 19: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) + 19, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; case 26: fun_drawSmallGreyButton(6, v3 - 170, buildmenu_X + 24 * i + 110, 10, 1, v5); fun_drawGameTextCentered( 48, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2) + 22, v3 - 170, buildmenu_X + 24 * i + 113, 160, graphic_font + 1072, v4); break; default: fun_drawSmallGreyButton(6, v3 - 266, buildmenu_X + 24 * i + 110, 16, 1, v5); fun_drawGameTextCentered( 28, *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2), v3 - 266, buildmenu_X + 24 * i + 113, 176, graphic_font + 1072, v4); v1 = *(int *)((char *)&buildingMenu_buildingId[30 * (buildmenu.selectedSubMenu - 1)] + 4 * v2); if ( v1 == 7 ) v1 = 90; v0 = model_buildings[v1].cost; if ( v1 == 57 ) v0 = 0; if ( v0 ) drawNumber(v0, 64, "Dn", v3 - 82, buildmenu_X + 24 * i + 114, graphic_font + 1072, 0); break; } } } void sub_507EF0() { int result; // eax@1 fun_drawCityScreenForeground(); sub_4DC1B0(); result = window_redrawRequest; if ( window_redrawRequest >= 2 ) { button_something_8 = 0; //result = fun_drawOverlayMenuButtons(); fun_drawOverlayMenuButtons(); } //return result; } // 403076: using guessed type int fun_drawOverlayMenuButtons(void); // 608740: using guessed type int button_something_8; // 660C5C: using guessed type char window_redrawRequest; //----- (00507F40) -------------------------------------------------------- void fun_drawOverlayMenuButtons() { int v0; // [sp+54h] [bp-Ch]@1 int v1; // [sp+58h] [bp-8h]@6 int v2; // [sp+58h] [bp-8h]@15 signed int i; // [sp+5Ch] [bp-4h]@3 int j; // [sp+5Ch] [bp-4h]@12 v0 = cityscreen_width_withControlpanel; if ( sidepanel_collapsed == 1 ) v0 = cityscreen_width_withoutControlpanel; for ( i = 0; i < 8; ++i ) { if ( mouseover_button_id == i + 1 ) v1 = 1; else v1 = 2; if ( selectedOverlaySubMenu > 0 ) v1 = 2; fun_drawSmallGreyButton(6, v0 - 170, buildmenu_X + 24 * i + 34, 10, 1, v1); fun_drawGameTextCentered( 14, overlayMenuIDToOverlayID[i], v0 - 170, buildmenu_X + 24 * i + 37, 160, graphic_font + 1072, 0); } if ( selectedOverlaySubMenu > 0 ) { drawGraphic(graphic_bullet, v0 - 185, buildmenu_X + 24 * dword_9D7B34 + 40); for ( j = 0; j < selectedOverlaySubMenuNumItems; ++j ) { if ( mouseover_button_id_main == j + 1 ) v2 = 1; else v2 = 2; fun_drawSmallGreyButton(6, v0 - 348, buildmenu_X + 24 * (dword_9D7B34 + j) + 34, 10, 1, v2); fun_drawGameTextCentered( 14, *(int *)((char *)&overlaySubMenuIDToOverlayID[30 * selectedOverlaySubMenu] + 4 * j), v0 - 348, buildmenu_X + 24 * (dword_9D7B34 + j) + 37, 160, graphic_font + 1072, 0); } } } // 6080A8: using guessed type int sidepanel_collapsed; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CEC: using guessed type __int16 graphic_bullet; // 9D7B28: using guessed type int mouseover_button_id; // 9D7B2C: using guessed type int mouseover_button_id_main; // 9D7B34: using guessed type int dword_9D7B34; // 9D7B44: using guessed type int dword_9D7B44; // 9D7BA0: using guessed type int selectedOverlaySubMenuNumItems; //----- (005081D0) -------------------------------------------------------- void fun_drawMainMenu(int overwrite) { if ( !overwrite ) fun_clearScreen(); drawGraphic(graphic_mainMenuBg, screen_640x480_x, screen_640x480_y); button_something_6 = 100; } // 608738: using guessed type int button_something_6; // 6E6BCC: using guessed type __int16 graphic_mainMenuBg; //----- (00508230) -------------------------------------------------------- void fun_drawLoadingScreen(int number) { if ( !number ) fun_clearScreen(); if ( number ) { switch ( number ) { case 1: drawGraphic(graphic_loadingScreen + 1, screen_640x480_x, screen_640x480_y); break; case 2: drawGraphic(graphic_loadingScreen + 2, screen_640x480_x, screen_640x480_y); break; case 3: drawGraphic(graphic_loadingScreen + 3, screen_640x480_x, screen_640x480_y); break; } } else { drawGraphic(graphic_loadingScreen, screen_640x480_x, screen_640x480_y); } button_something_6 = 100; } // 608738: using guessed type int button_something_6; // 6E6DA6: using guessed type __int16 graphic_loadingScreen; //----- (00508320) -------------------------------------------------------- void fun_drawMainMenuForeground() { int v0; // [sp+4Ch] [bp-4h]@2 int v1; // [sp+4Ch] [bp-4h]@5 int v2; // [sp+4Ch] [bp-4h]@8 int v3; // [sp+4Ch] [bp-4h]@11 v0 = mouseover_button_id == 1; fun_drawGreyButton(6, screen_640x480_x + 192, screen_640x480_y + 100, 16, v0); v1 = mouseover_button_id == 2; fun_drawGreyButton(6, screen_640x480_x + 192, screen_640x480_y + 140, 16, v1); v2 = mouseover_button_id == 3; fun_drawGreyButton(6, screen_640x480_x + 192, screen_640x480_y + 180, 16, v2); v3 = mouseover_button_id == 4; fun_drawGreyButton(6, screen_640x480_x + 192, screen_640x480_y + 220, 16, v3); fun_drawGameTextCentered(30, 1, screen_640x480_x + 192, screen_640x480_y + 106, 256, graphic_font + F_SmallBrown, 0); fun_drawGameTextCentered(30, 2, screen_640x480_x + 192, screen_640x480_y + 146, 256, graphic_font + F_SmallBrown, 0); fun_drawGameTextCentered(30, 3, screen_640x480_x + 192, screen_640x480_y + 186, 256, graphic_font + F_SmallBrown, 0); fun_drawGameTextCentered(30, 5, screen_640x480_x + 192, screen_640x480_y + 226, 256, graphic_font + F_SmallBrown, 0); } // 6E6BD0: using guessed type __int16 graphic_font; // 9D7B28: using guessed type int mouseover_button_id; //----- (005085A0) -------------------------------------------------------- void fun_showGameFinishedScreen() { victoryScreen_x = screen_640x480_x + 48; victoryScreen_y = screen_640x480_y + 128; fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; fun_drawDialogBackground(victoryScreen_x, victoryScreen_y, 34, 15); if ( setting_currentMissionId < 10 || setting_isCustomScenario ) { fun_drawGameTextCentered(62, 0, victoryScreen_x, victoryScreen_y + 16, 544, graphic_font + 670, 0); fun_drawGameTextCentered(62, 2, victoryScreen_x, victoryScreen_y + 47, 544, graphic_font + 134, 0); fun_drawGameTextCentered( 32, city_inform[ciid].player_rank + 1, victoryScreen_x, victoryScreen_y + 66, 544, graphic_font + 670, 0); } else { fun_drawTextCentered(setting_player_name, victoryScreen_x, victoryScreen_y + 16, 512, graphic_font + 670, 0); fun_drawGameTextWrapped(62, 26, victoryScreen_x + 16, victoryScreen_y + 47, 480, graphic_font + 134, 0); } } // 65436C: using guessed type int cityinfo_player_rank[]; // 65E6D4: using guessed type int screen_height; // 65E760: using guessed type int setting_currentMissionId; // 65E764: using guessed type int setting_isCustomScenario; // 6ADCD0: using guessed type int fullscreenImage_width; // 6E6BD0: using guessed type __int16 graphic_font; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2734: using guessed type int fullscreenImage_height; //----- (005087C0) -------------------------------------------------------- void fun_showVictoryScreen() { victoryScreen_x = screen_640x480_x + 48; victoryScreen_y = screen_640x480_y + 128; fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; if ( winState == 1 ) { fun_drawDialogBackground(victoryScreen_x, victoryScreen_y, 34, 18); fun_drawGameTextCentered(62, 0, victoryScreen_x, victoryScreen_y + 16, 544, graphic_font + 670, 0); fun_drawSunkenTextBox(victoryScreen_x + 16, victoryScreen_y + 56, 32, 7); if ( setting_isCustomScenario ) fun_drawGameTextWrapped(147, 20, victoryScreen_x + 32, victoryScreen_y + 64, 496, graphic_font + 268, 0); else fun_drawGameTextWrapped( 147, savedgame_missionId, victoryScreen_x + 32, victoryScreen_y + 64, 496, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText(148, 0, victoryScreen_x + 40, victoryScreen_y + 180, graphic_font + 134, 0); drawNumber( city_inform[ciid].cultureRating, 64, " ", victoryScreen_x + text_xoffset + 40, victoryScreen_y + 180, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(148, 1, victoryScreen_x + text_xoffset + 300, victoryScreen_y + 180, graphic_font + 134, 0); drawNumber( city_inform[ciid].prosperityRating, 64, " ", victoryScreen_x + text_xoffset + 300, victoryScreen_y + 180, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(148, 2, victoryScreen_x + 40, victoryScreen_y + 200, graphic_font + 134, 0); drawNumber( city_inform[ciid].peaceRating, 64, " ", victoryScreen_x + text_xoffset + 40, victoryScreen_y + 200, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(148, 3, victoryScreen_x + 300, victoryScreen_y + 200, graphic_font + 134, 0); drawNumber( city_inform[ciid].favorRating, 64, " ", victoryScreen_x + text_xoffset + 300, victoryScreen_y + 200, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(148, 4, victoryScreen_x + 40, victoryScreen_y + 220, graphic_font + 134, 0); drawNumber( city_inform[ciid].population, 64, " ", victoryScreen_x + text_xoffset + 40, victoryScreen_y + 220, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(148, 5, victoryScreen_x + 300, victoryScreen_y + 220, graphic_font + 134, 0); drawNumber( city_inform[ciid].treasury, 64, " ", victoryScreen_x + text_xoffset + 300, victoryScreen_y + 220, graphic_font + 134, 0); fun_drawGameTextCentered(13, 1, victoryScreen_x + 16, victoryScreen_y + 260, 512, graphic_font + 134, 0); } else { fun_drawDialogBackground(victoryScreen_x, victoryScreen_y - 112, 34, 16); fun_drawGameTextCentered(62, 1, victoryScreen_x, victoryScreen_y - 96, 544, graphic_font + 670, 0); text_yoffset = 0; fun_drawGameTextWrapped(62, 16, victoryScreen_x + 16, victoryScreen_y - 56, 496, graphic_font + 134, 0); } } // 6500AC: using guessed type int cityinfo_treasury[]; // 6500C4: using guessed type int cityinfo_population[]; // 654228: using guessed type int cityinfo_cultureRating[]; // 65422C: using guessed type int cityinfo_prosperityRating[]; // 654230: using guessed type int cityinfo_peaceRating[]; // 654234: using guessed type int cityinfo_favorRating[]; // 65E6D4: using guessed type int screen_height; // 65E750: using guessed type int savedgame_missionId; // 65E764: using guessed type int setting_isCustomScenario; // 660730: using guessed type char winState; // 6ADCD0: using guessed type int fullscreenImage_width; // 6E6BD0: using guessed type __int16 graphic_font; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2724: using guessed type int text_xoffset; // 7E2734: using guessed type int fullscreenImage_height; // 7E2824: using guessed type int text_yoffset; //----- (00508EC0) -------------------------------------------------------- void fun_drawWinLoseScreenButtons() { victoryScreen_x = screen_640x480_x + 48; victoryScreen_y = screen_640x480_y + 128; if ( winState == 1 ) { drawWinLoseButtons_isSelected = mouseover_button_id == 1; fun_drawGreyButton( 6, victoryScreen_x + 32, victoryScreen_y + 112, 30, drawWinLoseButtons_isSelected); if ( setting_currentMissionId < 10 || setting_isCustomScenario ) fun_drawGameTextCentered(62, 3, victoryScreen_x + 32, victoryScreen_y + 118, 480, graphic_font + 1072, 0); else fun_drawGameTextCentered(62, 27, victoryScreen_x + 32, victoryScreen_y + 118, 480, graphic_font + 1072, 0); if ( setting_currentMissionId >= 2 || setting_isCustomScenario ) { drawWinLoseButtons_isSelected = mouseover_button_id == 2; fun_drawGreyButton( 6, victoryScreen_x + 32, victoryScreen_y + 144, 30, drawWinLoseButtons_isSelected); fun_drawGameTextCentered(62, 4, victoryScreen_x + 32, victoryScreen_y + 150, 480, graphic_font + 1072, 0); drawWinLoseButtons_isSelected = mouseover_button_id == 3; fun_drawGreyButton( 6, victoryScreen_x + 32, victoryScreen_y + 176, 30, drawWinLoseButtons_isSelected); fun_drawGameTextCentered(62, 5, victoryScreen_x + 32, victoryScreen_y + 182, 480, graphic_font + 1072, 0); } } else { drawWinLoseButtons_isSelected = mouseover_button_id == 1; fun_drawGreyButton( 6, victoryScreen_x + 32, victoryScreen_y + 96, 30, drawWinLoseButtons_isSelected); fun_drawGameTextCentered(62, 6, victoryScreen_x + 32, victoryScreen_y + 102, 480, graphic_font + 1072, 0); } } // 65E760: using guessed type int setting_currentMissionId; // 65E764: using guessed type int setting_isCustomScenario; // 660730: using guessed type char winState; // 6E6BD0: using guessed type __int16 graphic_font; // 788034: using guessed type char drawWinLoseButtons_isSelected; // 9D7B28: using guessed type int mouseover_button_id; //----- (005091E0) -------------------------------------------------------- void sub_5091E0() { fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; if ( dword_60868C ) { if ( dword_60868C == 1 ) { drawGraphic(graphic_firedScreenBg, 0, 0); } else { if ( dword_60868C == 2 ) { fun_soundStopChannel(0); fun_soundStopChannel(1); if ( setting_isCustomScenario ) { drawGraphic(graphic_firedScreenBg + 2, 0, 0); } else { drawGraphic(graphic_firedScreenBg + 2 * savedgame_missionId + 2, 0, 0); fun_playSound(&aWavs01w_wav[40 * savedgame_missionId], 1, 0); } window_redrawRequest = 1; } } } else { fun_soundStopChannel(0); fun_soundStopChannel(1); if ( setting_isCustomScenario ) { drawGraphic(graphic_firedScreenBg + 1, 0, 0); } else { drawGraphic(graphic_firedScreenBg + 2 * savedgame_missionId + 1, 0, 0); fun_playSound(&soundFilesMissionBriefing[40 * savedgame_missionId], 1, 0); } window_redrawRequest = 1; } } // 60868C: using guessed type int dword_60868C; // 65E6D4: using guessed type int screen_height; // 65E750: using guessed type int savedgame_missionId; // 65E764: using guessed type int setting_isCustomScenario; // 660C5C: using guessed type char window_redrawRequest; // 6ADCD0: using guessed type int fullscreenImage_width; // 6E6DA8: using guessed type __int16 graphic_firedScreenBg; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2734: using guessed type int fullscreenImage_height; //----- (005093B0) -------------------------------------------------------- void sub_5093B0(int a1, int a2, int a3) { dword_60868C = a1; dword_6086E8 = timeGetTime(); dword_6086E0 = a3 + dword_6086E8; dword_6085D0[0] = a2; window_id = 4; window_redrawRequest = 1; } // 6085D0: using guessed type int dword_6085D0[19]; // 60868C: using guessed type int dword_60868C; // 6086E0: using guessed type int dword_6086E0; // 6086E8: using guessed type int dword_6086E8; // 660C5C: using guessed type char window_redrawRequest; //----- (00509410) -------------------------------------------------------- void sub_509410() { signed int v0; // [sp+4Ch] [bp-8h]@1 DWORD v1; // [sp+50h] [bp-4h]@1 v0 = 0; v1 = timeGetTime(); if ( handleClick_isRightClick ) v0 = 1; if ( v1 > dword_6086E0 ) v0 = 1; if ( v0 > 0 ) { window_id = LOBYTE(dword_6085D0[0]); window_redrawRequest = 1; } } // 6085D0: using guessed type int dword_6085D0[19]; // 6086E0: using guessed type int dword_6086E0; // 65E934: using guessed type char handleClick_isRightClick; // 660C5C: using guessed type char window_redrawRequest; //----- (00509490) -------------------------------------------------------- void fun_drawMissionBriefingForeground() { int v0; // ST70_4@8 int v1; // ST6C_4@8 int v2; // ST70_4@10 int v3; // ST6C_4@10 int v4; // ST70_4@12 int v5; // ST6C_4@12 int v6; // ST70_4@14 int v7; // ST6C_4@14 int v8; // ST70_4@16 int v9; // ST6C_4@16 signed int v10; // [sp+4Ch] [bp-Ch]@7 int v11; // [sp+50h] [bp-8h]@19 int v12; // [sp+50h] [bp-8h]@30 int v13; // [sp+54h] [bp-4h]@19 int v14; // [sp+54h] [bp-4h]@30 if ( dword_9DA7B0 || (dword_9DA7B0 = 1, fun_initScenario(currentScenarioFilename), window_id != 1) ) { currentHelpId = savedgame_missionId + 200; dword_7E2C28 = screen_640x480_x + 16; dword_7E2C2C = screen_640x480_y + 32; fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; fun_drawDialogBackground(dword_7E2C28, dword_7E2C2C, 38, 27); fun_drawText( &c3mm_data[help_title[20 * currentHelpId]], dword_7E2C28 + 16, dword_7E2C2C + 16, graphic_font + 670, 0); fun_drawText( &c3mm_data[help_subtitle[20 * currentHelpId]], dword_7E2C28 + 16, dword_7E2C2C + 46, graphic_font + 134, 0); fun_drawGameText(62, 7, dword_7E2C28 + 360, dword_7E2C2C + 401, graphic_font + 134, 0); if ( window_id == 53 ) { if ( setting_currentMissionId >= 2 ) fun_drawGameText(13, 4, dword_7E2C28 + 50, dword_7E2C2C + 403, graphic_font + 134, 0); } fun_drawSunkenTextBox(dword_7E2C28 + 16, dword_7E2C2C + 64, 33, 5); fun_drawGameText(62, 10, dword_7E2C28 + 32, dword_7E2C2C + 72, graphic_font + 268, 0); button_something_6 = 100; v10 = 0; if ( scn_win_population_on ) { v0 = dword_600098[0]; v1 = dword_60009C[0]; v10 = 1; fun_drawSmallGreyButton(6, dword_600098[0] + dword_7E2C28, dword_60009C[0] + dword_7E2C2C, 15, 0, 1); text_xoffset = 0; fun_drawGameText(62, 11, dword_7E2C28 + v0 + 8, dword_7E2C2C + v1 + 3, graphic_font + 402, 0); drawNumber( scn_win_population, 64, " ", v0 + dword_7E2C28 + text_xoffset + 8, dword_7E2C2C + v1 + 3, graphic_font + 402, 0); } if ( scn_win_culture_on ) { v2 = dword_600098[2 * v10]; v3 = dword_60009C[2 * v10++]; fun_drawSmallGreyButton(6, v2 + dword_7E2C28, v3 + dword_7E2C2C, 15, 0, 1); text_xoffset = 0; fun_drawGameText(62, 12, dword_7E2C28 + v2 + 8, dword_7E2C2C + v3 + 3, graphic_font + 402, 0); drawNumber( scn_win_culture, 64, " ", v2 + dword_7E2C28 + text_xoffset + 8, dword_7E2C2C + v3 + 3, graphic_font + 402, 0); } if ( scn_win_prosperity_on ) { v4 = dword_600098[2 * v10]; v5 = dword_60009C[2 * v10++]; fun_drawSmallGreyButton(6, v4 + dword_7E2C28, v5 + dword_7E2C2C, 15, 0, 1); text_xoffset = 0; fun_drawGameText(62, 13, dword_7E2C28 + v4 + 8, dword_7E2C2C + v5 + 3, graphic_font + 402, 0); drawNumber( scn_win_prosperity, 64, " ", v4 + dword_7E2C28 + text_xoffset + 8, dword_7E2C2C + v5 + 3, graphic_font + 402, 0); } if ( scn_win_peace_on ) { v6 = dword_600098[2 * v10]; v7 = dword_60009C[2 * v10++]; fun_drawSmallGreyButton(6, v6 + dword_7E2C28, v7 + dword_7E2C2C, 15, 0, 1); text_xoffset = 0; fun_drawGameText(62, 14, dword_7E2C28 + v6 + 8, dword_7E2C2C + v7 + 3, graphic_font + 402, 0); drawNumber( scn_win_peace, 64, " ", v6 + dword_7E2C28 + text_xoffset + 8, dword_7E2C2C + v7 + 3, graphic_font + 402, 0); } if ( scn_win_favor_on ) { v8 = dword_600098[2 * v10]; v9 = dword_60009C[2 * v10]; fun_drawSmallGreyButton(6, v8 + dword_7E2C28, v9 + dword_7E2C2C, 15, 0, 1); text_xoffset = 0; fun_drawGameText(62, 15, dword_7E2C28 + v8 + 8, dword_7E2C2C + v9 + 3, graphic_font + 402, 0); drawNumber( scn_win_favor, 64, " ", v8 + dword_7E2C28 + text_xoffset + 8, dword_7E2C2C + v9 + 3, graphic_font + 402, 0); } if ( setting_currentMissionId || setting_isCustomScenario ) { if ( setting_currentMissionId == 1 ) { if ( !setting_isCustomScenario ) { v14 = dword_6000A8; v12 = dword_6000AC[0]; fun_drawSmallGreyButton(6, dword_6000A8 + dword_7E2C28, dword_6000AC[0] + dword_7E2C2C, 31, 0, 1); if ( tutorial2_granaryBuilt ) { if ( tutorial2_population250reached ) { if ( tutorial2_population450reached ) { if ( tutorial2_potteryMade ) fun_drawGameText(62, 25, dword_7E2C28 + v14 + 8, dword_7E2C2C + v12 + 3, graphic_font + 402, 0); else fun_drawGameText(62, 24, dword_7E2C28 + v14 + 8, dword_7E2C2C + v12 + 3, graphic_font + 402, 0); } else { fun_drawGameText(62, 23, dword_7E2C28 + v14 + 8, dword_7E2C2C + v12 + 3, graphic_font + 402, 0); } } else { fun_drawGameText(62, 22, dword_7E2C28 + v14 + 8, dword_7E2C2C + v12 + 3, graphic_font + 402, 0); } } else { fun_drawGameText(62, 21, dword_7E2C28 + v14 + 8, dword_7E2C2C + v12 + 3, graphic_font + 402, 0); } } } } else { v13 = dword_6000A8; v11 = dword_6000AC[0]; fun_drawSmallGreyButton(6, dword_6000A8 + dword_7E2C28, dword_6000AC[0] + dword_7E2C2C, 31, 0, 1); if ( tutorial1_fire || tutorial1_crime ) { if ( tutorial1_prefectureBuilt ) { if ( tutorial1_senateEngineerBuilt ) fun_drawGameText(62, 20, dword_7E2C28 + v13 + 8, dword_7E2C2C + v11 + 3, graphic_font + 402, 0); else fun_drawGameText(62, 19, dword_7E2C28 + v13 + 8, dword_7E2C2C + v11 + 3, graphic_font + 402, 0); } else { fun_drawGameText(62, 18, dword_7E2C28 + v13 + 8, dword_7E2C2C + v11 + 3, graphic_font + 402, 0); } } else { fun_drawGameText(62, 17, dword_7E2C28 + v13 + 8, dword_7E2C2C + v11 + 3, graphic_font + 402, 0); } } fun_drawSunkenTextBox(dword_7E2C28 + 16, dword_7E2C2C + 152, 33, 15); font_currentFontId = graphic_font + 268; dword_7E2C08 = graphic_font + 402; helpDialog_text_x = dword_7E2C28 + 48; helpDialog_text_y = dword_7E2C2C + 152; if ( !dword_7E2C10 ) { helpDialog_text_height = 15; dword_7E3128 = helpDialog_text_height - 1; helpDialog_text_width = 31; imagebuttons_unknown_5EF670.state_enabled = 1; imagebuttons_unknown_5EF698.state_enabled = 1; fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], dword_7E2C28 + 32, dword_7E2C2C + 168, 16 * helpDialog_text_width - 16, 1); if ( dword_7E2C10 <= dword_7E3128 ) { helpDialog_max = 0; imagebuttons_unknown_5EF670.state_enabled = 0; imagebuttons_unknown_5EF698.state_enabled = 0; } else { helpDialog_max = dword_7E2C10 - dword_7E3128; } } draw_clip_x = dword_7E2C28 + 19; draw_clip_xEnd = dword_7E2C28 + 541; draw_clip_y = dword_7E2C2C + 155; draw_clip_yEnd = dword_7E2C2C + 389; fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], dword_7E2C28 + 32, dword_7E2C2C + 164, 496, 0); draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } } // 600098: using guessed type int dword_600098[]; // 6000A8: using guessed type int dword_6000A8; // 6000AC: using guessed type int dword_6000AC[7]; // 608738: using guessed type int button_something_6; // 65E6D4: using guessed type int screen_height; // 65E750: using guessed type int savedgame_missionId; // 65E760: using guessed type int setting_currentMissionId; // 65E764: using guessed type int setting_isCustomScenario; // 6ADBE4: using guessed type int draw_clip_y; // 6ADCD0: using guessed type int fullscreenImage_width; // 6ADD2C: using guessed type int draw_clip_x; // 6DEE3C: using guessed type int help_title[]; // 6DEE40: using guessed type int help_subtitle[]; // 6E6B4C: using guessed type int draw_clip_xEnd; // 6E6BD0: using guessed type __int16 graphic_font; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26F8: using guessed type int draw_clip_yEnd; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2724: using guessed type int text_xoffset; // 7E2734: using guessed type int fullscreenImage_height; // 7E2BF4: using guessed type int currentHelpId; // 7E2C08: using guessed type int dword_7E2C08; // 7E2C10: using guessed type int dword_7E2C10; // 7E3128: using guessed type int dword_7E3128; // 949EE0: using guessed type int tutorial2_population250reached; // 949EF8: using guessed type int tutorial1_prefectureBuilt; // 94A314: using guessed type int tutorial2_population450reached; // 98A544: using guessed type int tutorial2_potteryMade; // 98BED4: using guessed type int tutorial1_senateEngineerBuilt; // 98BEEC: using guessed type int tutorial1_crime; // 98BEF4: using guessed type int tutorial2_granaryBuilt; // 98BEFC: using guessed type int tutorial1_fire; // 98EEB4: using guessed type char scn_win_culture_on; // 98EEB5: using guessed type char scn_win_prosperity_on; // 98EEB6: using guessed type char scn_win_peace_on; // 98EEB7: using guessed type char scn_win_favor_on; // 98EED0: using guessed type int scn_win_population_on; // 9DA7B0: using guessed type int dword_9DA7B0; //----- (0050A290) -------------------------------------------------------- void sub_50A290() { dword_7E2C28 = screen_640x480_x; dword_7E2C2C = screen_640x480_y; fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; drawGraphic(word_6E6D98, 0, 0); drawGraphic(dword_6007A8[setting_currentMissionId] + word_6E6D9A, dword_7E2C28, dword_7E2C2C); fun_drawGameText( 144, 3 * setting_currentMissionId + 1, dword_7E2C28 + 20, dword_7E2C2C + 410, graphic_font + 670, 0); if ( selectMission_choice ) fun_drawGameTextWrapped( 144, 3 * setting_currentMissionId + selectMission_choice + 1, dword_7E2C28 + 20, dword_7E2C2C + 440, 560, graphic_font + 134, 0); else fun_drawGameTextWrapped(144, 0, dword_7E2C28 + 20, dword_7E2C2C + 440, 560, graphic_font + 134, 0); } // 607744: using guessed type int selectMission_choice; // 65E6D4: using guessed type int screen_height; // 65E760: using guessed type int setting_currentMissionId; // 6ADCD0: using guessed type int fullscreenImage_width; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6D98: using guessed type __int16 word_6E6D98; // 6E6D9A: using guessed type __int16 word_6E6D9A; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2734: using guessed type int fullscreenImage_height; //----- (0050A470) -------------------------------------------------------- void fun_drawCckSelectionScreen() { int v0; // [sp+50h] [bp-18h]@1 int v1; // [sp+54h] [bp-14h]@1 int v2; // [sp+58h] [bp-10h]@1 signed int numInvasions; // [sp+5Ch] [bp-Ch]@14 signed int i; // [sp+64h] [bp-4h]@14 v2 = screen_640x480_x + 320; v1 = screen_640x480_y + 20; v0 = screen_640x480_x; fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; if ( window_redrawRequest == 1 ) drawGraphic(word_6E6D9C, 0, 0); imagebuttons_redraw = 1; fun_drawSunkenTextBox(screen_640x480_x + 280, screen_640x480_y + 242, 2, 12); fun_drawCckFileList(); fun_drawScrollbarDot(); drawGraphic(scn_image + word_6E6D9E, v0 + 78, v0 + 16); fun_drawTextCentered(currentScenarioFilename, v2 + 15, v1 + 5, 260, graphic_font + 670, 0); fun_drawTextCentered(scn_briefDescription, v2 + 15, v1 + 40, 260, graphic_font + 268, 0); fun_drawGameYearWithBcAd(1, scn_settings_startYear, v2 + 90, v1 + 70, graphic_font + 670, 0); fun_drawGameTextCentered(44, scn_climate + 77, v2 + 15, v1 + 130, 260, graphic_font + 134, 0); switch ( scn_sizeX ) { case 40: fun_drawGameTextCentered(44, 121, v2 + 15, v1 + 150, 260, graphic_font + 134, 0); break; case 60: fun_drawGameTextCentered(44, 122, v2 + 15, v1 + 150, 260, graphic_font + 134, 0); break; case 80: fun_drawGameTextCentered(44, 123, v2 + 15, v1 + 150, 260, graphic_font + 134, 0); break; case 100: fun_drawGameTextCentered(44, 124, v2 + 15, v1 + 150, 260, graphic_font + 134, 0); break; case 120: fun_drawGameTextCentered(44, 125, v2 + 15, v1 + 150, 260, graphic_font + 134, 0); break; default: fun_drawGameTextCentered(44, 126, v2 + 15, v1 + 150, 260, graphic_font + 134, 0); break; } numInvasions = 0; for ( i = 0; i < 20; ++i ) { if ( scn_invasions_type[i] ) ++numInvasions; } if ( numInvasions > 0 ) { if ( numInvasions > 2 ) { if ( numInvasions > 4 ) { if ( numInvasions > 10 ) fun_drawGameTextCentered(44, 116, v2 + 15, v1 + 170, 260, graphic_font + 134, 0); else fun_drawGameTextCentered(44, 115, v2 + 15, v1 + 170, 260, graphic_font + 134, 0); } else { fun_drawGameTextCentered(44, 114, v2 + 15, v1 + 170, 260, graphic_font + 134, 0); } } else { fun_drawGameTextCentered(44, 113, v2 + 15, v1 + 170, 260, graphic_font + 134, 0); } } else { fun_drawGameTextCentered(44, 112, v2 + 15, v1 + 170, 260, graphic_font + 134, 0); } fun_drawGameTextCentered(32, scn_playerRank + 11, v2 + 15, v1 + 190, 260, graphic_font + 134, 0); if ( scn_isOpenPlay ) { fun_drawGameTextWrapped( 145, scn_openPlayScenarioId, v2 + 25, v1 + 250, 260, graphic_font + 134, 0); } else { fun_drawGameTextCentered(44, 127, v2 + 15, v1 + 242, 260, graphic_font + 134, 0); text_xoffset = 0; if ( scn_win_culture_on ) { drawNumber(scn_win_culture, 64, " ", v2 + text_xoffset + 90, v1 + 270, graphic_font + 134, 0); fun_drawGameText(44, 129, v2 + text_xoffset + 90, v1 + 270, graphic_font + 134, 0); } text_xoffset = 0; if ( scn_win_prosperity_on ) { drawNumber(scn_win_prosperity, 64, " ", v2 + text_xoffset + 90, v1 + 286, graphic_font + 134, 0); fun_drawGameText(44, 130, v2 + text_xoffset + 90, v1 + 286, graphic_font + 134, 0); } text_xoffset = 0; if ( scn_win_peace_on ) { drawNumber(scn_win_peace, 64, " ", v2 + text_xoffset + 90, v1 + 302, graphic_font + 134, 0); fun_drawGameText(44, 131, v2 + text_xoffset + 90, v1 + 302, graphic_font + 134, 0); } text_xoffset = 0; if ( scn_win_favor_on ) { drawNumber(scn_win_favor, 64, " ", v2 + text_xoffset + 90, v1 + 318, graphic_font + 134, 0); fun_drawGameText(44, 132, v2 + text_xoffset + 90, v1 + 318, graphic_font + 134, 0); } if ( scn_win_population_on ) { text_xoffset = 0; drawNumber(scn_win_population, 64, " ", v2 + text_xoffset + 90, v1 + 334, graphic_font + 134, 0); fun_drawGameText(44, 133, v2 + text_xoffset + 90, v1 + 334, graphic_font + 134, 0); } if ( scn_win_timeLimit_on ) { text_xoffset = 0; drawNumber(scn_win_timeLimit, 64, " ", v2 + text_xoffset + 90, v1 + 350, graphic_font + 134, 0); fun_drawGameText(44, 134, v2 + text_xoffset + 90, v1 + 350, graphic_font + 134, 0); } if ( scn_win_survivalTime_on ) { text_xoffset = 0; drawNumber(scn_win_survivalTime, 64, " ", v2 + text_xoffset + 90, v1 + 366, graphic_font + 134, 0); fun_drawGameText(44, 135, v2 + text_xoffset + 90, v1 + 366, graphic_font + 134, 0); } } fun_drawGameText(44, 136, v2 + 100, v1 + 426, graphic_font + 134, 0); } // 65E6D4: using guessed type int screen_height; // 660905: using guessed type char imagebuttons_redraw; // 660C5C: using guessed type char window_redrawRequest; // 6ADCD0: using guessed type int fullscreenImage_width; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6D9C: using guessed type __int16 word_6E6D9C; // 6E6D9E: using guessed type __int16 word_6E6D9E; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2724: using guessed type int text_xoffset; // 7E2734: using guessed type int fullscreenImage_height; // 98E880: using guessed type __int16 scn_settings_startYear; // 98EA04: using guessed type int scn_sizeX; // 98EC72: using guessed type __int16 scn_image; // 98EC74: using guessed type __int16 scn_isOpenPlay; // 98EC76: using guessed type __int16 scn_playerRank; // 98EEB4: using guessed type char scn_win_culture_on; // 98EEB5: using guessed type char scn_win_prosperity_on; // 98EEB6: using guessed type char scn_win_peace_on; // 98EEB7: using guessed type char scn_win_favor_on; // 98EEB8: using guessed type int scn_win_timeLimit_on; // 98EEC0: using guessed type int scn_win_survivalTime_on; // 98EED0: using guessed type int scn_win_population_on; // 98EF28: using guessed type char scn_climate; // 98EF36: using guessed type char scn_openPlayScenarioId; //----- (0050AFE0) -------------------------------------------------------- void fun_drawCckFileList() { char str; // [sp+4Ch] [bp-10Ch]@8 int fontId; // [sp+150h] [bp-8h]@3 int i; // [sp+154h] [bp-4h]@1 fun_drawSunkenTextBox(screen_640x480_x + 16, screen_640x480_y + 210, 16, 16); for ( i = 1; i <= 15; ++i ) { fontId = graphic_font + 1072; if ( mouseover_button_id == i ) { fontId = graphic_font + 268; } else { if ( !mouseover_button_id ) { if ( filelist_scrollPosition + i - 1 == dword_9DA8B8 ) fontId = graphic_font + 268; } } strcpy(&str, &findfiles_filenames[65 * (filelist_scrollPosition + i - 1)]); fun_removeFileExtension(&str); fun_drawText(&str, screen_640x480_x + 24, screen_640x480_y + 16 * (i - 1) + 220, fontId, 0); } } // 6E6BD0: using guessed type __int16 graphic_font; // 9D7B28: using guessed type int mouseover_button_id; // 9DA8B8: using guessed type int dword_9DA8B8; //----- (0050B140) -------------------------------------------------------- void fun_drawStartNewCareerBackground() { fun_clearScreen(); drawGraphic(graphic_mainMenuBg, screen_640x480_x, screen_640x480_y); button_something_6 = 100; } // 608738: using guessed type int button_something_6; // 6E6BCC: using guessed type __int16 graphic_mainMenuBg; //----- (0050B190) -------------------------------------------------------- void fun_drawStartNewCareerDialog() { fun_drawDialogBackground(screen_640x480_x + 128, screen_640x480_y + 160, 24, 8); fun_drawGameTextCentered(31, 0, screen_640x480_x + 128, screen_640x480_y + 172, 384, graphic_font + 670, 0); fun_drawGameText(13, 5, screen_640x480_x + 352, screen_640x480_y + 256, graphic_font + 134, 0); fun_drawSunkenTextBox(screen_640x480_x + 160, screen_640x480_y + 208, 20, 2); sub_4CBDD0(); fun_drawText(setting_player_name, screen_640x480_x + 176, screen_640x480_y + 216, graphic_font + 268, 0); fun_drawTextCursor(screen_640x480_x + 176, screen_640x480_y + 217, 65535); } // 6E6BD0: using guessed type __int16 graphic_font; //----- (0050B300) -------------------------------------------------------- void fun_drawLogoScreen() { fun_playSound("wavs\\setup.wav", 0, 1); fun_clearScreen(); drawGraphic(graphic_logo, screen_640x480_x, screen_640x480_y); fun_drawGameTextCentered(13, 7, (ddraw_width - 320) / 2, screen_640x480_y + 462, 320, graphic_font, -1); } // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CF4: using guessed type __int16 graphic_logo; //----- (0050B3A0) -------------------------------------------------------- void fun_drawDemoExitScreen1() { fun_clearScreen(); drawGraphic(graphic_demo1, screen_640x480_x, screen_640x480_y); } // 6E6D24: using guessed type __int16 graphic_demo1; //----- (0050B3E0) -------------------------------------------------------- void fun_drawDemoExitScreen2() { fun_clearScreen(); drawGraphic(graphic_demo2, screen_640x480_x, screen_640x480_y); } // 6E6D26: using guessed type __int16 graphic_demo2; //----- (0050B420) -------------------------------------------------------- void fun_drawDemoExitScreen3() { fun_clearScreen(); drawGraphic(graphic_demo3, screen_640x480_x, screen_640x480_y); } // 6E6D28: using guessed type __int16 graphic_demo3; //----- (0050B460) -------------------------------------------------------- void fun_drawWinGameScreen() { victoryScreen_x = screen_640x480_x + 96; victoryScreen_y = screen_640x480_y + 160; fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; drawGraphic(graphic_winGame, 0, 0); fun_drawDialogBackground(victoryScreen_x, victoryScreen_y, 28, 10); fun_drawGameTextCentered(62, 8, victoryScreen_x + 32, victoryScreen_y + 24, 384, graphic_font + 670, 0); fun_drawGameTextWrapped(62, 9, victoryScreen_x + 32, victoryScreen_y + 80, 384, graphic_font + 134, 0); } // 65E6D4: using guessed type int screen_height; // 6ADCD0: using guessed type int fullscreenImage_width; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CF0: using guessed type __int16 graphic_winGame; // 788044: using guessed type int fullscreenImage_xOffset; // 7E26FC: using guessed type int fullscreenImage_yOffset; // 7E2734: using guessed type int fullscreenImage_height; //----- (0050B5B0) -------------------------------------------------------- void fun_drawAdvisorScreen() { fun_drawAdvisorBackgroundAndButtons(); if ( currentAdvisor ) { switch ( currentAdvisor ) { case Adv_Labor: fun_drawLaborAdvisor(); break; case Adv_Military: fun_drawMilitaryAdvisor(); break; case Adv_Imperial: fun_drawImperialAdvisor(); break; case Adv_Ratings: fun_drawRatingsAdvisor(); break; case Adv_Trade: fun_drawTradeAdvisor(); break; case Adv_Population: fun_drawPopulationAdvisor(); break; case Adv_Health: fun_drawHealthAdvisor(); break; case Adv_Education: fun_drawEducationAdvisor(); break; case Adv_Entertainment: fun_drawEntertainmentAdvisor(); break; case Adv_Religion: fun_drawReligionAdvisor(); break; case Adv_Financial: fun_drawFinancialAdvisor(); break; case Adv_Chief: fun_drawChiefAdvisor(); break; } } } // 607740: using guessed type int currentAdvisor; //----- (0050B6E0) -------------------------------------------------------- void fun_drawAdvisorBackgroundAndButtons() { signed int v0; // [sp+4Ch] [bp-8h]@6 signed int i; // [sp+50h] [bp-4h]@3 fullscreenImage_xOffset = (1024 - screen_width) / 2; fullscreenImage_yOffset = (768 - screen_height) / 2; fullscreenImage_width = screen_width; fullscreenImage_height = screen_height; if ( window_redrawRequest == 1 ) drawGraphic(graphic_advisorBackground, 0, 0); drawGraphic(graphic_panelwindows + 13, screen_640x480_x, screen_640x480_y + 432); for ( i = 0; i < 13; ++i ) { if ( currentAdvisor ) { if ( i == currentAdvisor - 1 ) v0 = 13; else v0 = 0; } else { v0 = 0; } drawGraphic(v0 + i + graphic_advisorIcons, screen_640x480_x + 48 * i + 12, screen_640x480_y + 441); } } void fun_advisorPrepareSomeButton() { if ( advisor_ifSomething <= 5 ) { advisor_ifSomething = 6; window_redrawRequest = 1; } } void fun_drawLaborAdvisor() { int v0; // [sp+4Ch] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 26; v0 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v0 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons, dialog_x + 10, dialog_y + 10); fun_drawGameText(50, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawGameText(50, 21, dialog_x + 60, dialog_y + 56, graphic_font + 938, 0); fun_drawGameText(50, 22, dialog_x + 170, dialog_y + 56, graphic_font + 938, 0); fun_drawGameText(50, 23, dialog_x + 400, dialog_y + 56, graphic_font + 938, 0); fun_drawGameText(50, 24, dialog_x + 500, dialog_y + 56, graphic_font + 938, 0); text_xoffset = 0; drawNumber( city_inform[ciid].numEmployedWorkers, 64, " ", dialog_x + 32, dialog_y + 320, graphic_font + 134, 0); fun_drawGameText(50, 12, dialog_x + text_xoffset + 32, dialog_y + 320, graphic_font + 134, 0); drawNumber( city_inform[ciid].numUnemployedWorkers, 64, " ", dialog_x + text_xoffset + 50, dialog_y + 320, graphic_font + 134, 0); fun_drawGameText(50, 13, dialog_x + text_xoffset + 50, dialog_y + 320, graphic_font + 134, 0); drawNumber( city_inform[ciid].unemploymentPercentage, 64, "%)", dialog_x + text_xoffset + 50, dialog_y + 320, graphic_font + 134, 0); fun_drawSunkenTextBox(dialog_x + 64, dialog_y + 350, 32, 2); text_xoffset = 0; fun_drawGameText(50, 14, dialog_x + text_xoffset + 70, dialog_y + 359, graphic_font + 268, 0); text_xoffset = 0; drawNumber(city_inform[ciid].wages,64," ",dialog_x + text_xoffset + 230,dialog_y + 359,graphic_font + 268,0); fun_drawGameText(50, 15, dialog_x + text_xoffset + 230, dialog_y + 359, graphic_font + 268, 0); fun_drawGameText(50, 18, dialog_x + text_xoffset + 230, dialog_y + 359, graphic_font + 268, 0); drawNumber( city_inform[ciid].wagesRome, 64, " )", dialog_x + text_xoffset + 230, dialog_y + 359, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText(50, 19, dialog_x + text_xoffset + 64, dialog_y + 390, graphic_font + 134, 0); drawNumber( city_inform[ciid].estimatedWageCost, 64, " Dn", dialog_x + text_xoffset + 64, dialog_y + 390, graphic_font + 134, 0); } else { fun_drawRect( 16 * v0 + dialog_x, dialog_y + 8 * v0, 16 * (advisor_dialog_width - 2 * v0), 16 * (advisor_dialog_height - 2 * v0), 0); } } } void fun_drawLaborAdvisorCategories() { int font; // [sp+4Ch] [bp-Ch]@10 int focus; // [sp+50h] [bp-8h]@6 signed int i; // [sp+54h] [bp-4h]@3 if ( advisor_ifSomething > 5 ) { fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 70, 36, 15); for ( i = 0; i < 9; ++i ) { focus = i == mouseover_button_id - 1; fun_drawBorderedButton(0, dialog_x + 40, dialog_y + 25 * i + 77, 560, 22, focus); if( city_inform[ciid].labor_category_priority[ i ].priority ) { drawGraphic(graphic_laborPriorityLock, dialog_x + 70, dialog_y + 25 * i + 80); drawNumber( city_inform[ciid].labor_category_priority[ i ].priority, 64, " ", dialog_x + 90, dialog_y + 25 * i + 82, graphic_font + F_NormalWhite, 0); } text_xoffset = 0; fun_drawGameText(50, i + 1, dialog_x + 170, dialog_y + 25 * i + 82, graphic_font + F_NormalWhite, 0); drawNumber( city_inform[ciid].labor_category_priority[i].numWorkersNeeded, 64, " ", dialog_x + 410, dialog_y + 25 * i + 82, graphic_font + F_NormalWhite, 0); font = graphic_font + F_NormalWhite; if( city_inform[ciid].labor_category_priority[i].workersAllocated != city_inform[ciid].labor_category_priority[i].numWorkersNeeded ) font = graphic_font + F_NormalRed; drawNumber( city_inform[ciid].labor_category_priority[i].workersAllocated, 64, " ", dialog_x + 510, dialog_y + 25 * i + 82, font, 0); } } } void fun_drawLaborPriorityDialog() { signed int i; // [sp+4Ch] [bp-4h]@1 fun_drawDialogBackground(dialog_x + 160, dialog_y + 176, 20, 9); fun_drawGameTextCentered(50, 25, dialog_x + 160, dialog_y + 185, 320, graphic_font + 670, 0); for ( i = 0; i < 9; ++i ) { fun_drawRect(dialog_x + 32 * i + 178, dialog_y + 221, 27, 27, 0); fun_drawGameTextCentered(50, i + 27, dialog_x + 32 * i + 178, dialog_y + 224, 27, graphic_font + 670, 0); if ( i >= laborPriority_maxPriorities ) fun_greyRectangle(dialog_x + 32 * i + 179, dialog_y + 222, 25, 25, 1); } fun_drawRect(dialog_x + 180, dialog_y + 256, 280, 25, 0); fun_drawGameTextCentered(50, 26, dialog_x + 180, dialog_y + 263, 280, graphic_font + 134, 0); fun_drawGameTextCentered(13, 3, dialog_x + 160, dialog_y + 296, 320, graphic_font + 134, 0); } void fun_drawLaborPriorityDialogButtons() { int v0; // [sp+4Ch] [bp-8h]@4 int v1; // [sp+4Ch] [bp-8h]@9 signed int i; // [sp+50h] [bp-4h]@1 for ( i = 0; i < 9; ++i ) { if ( i == mouseover_button_id - 2 ) v0 = 0xF800u; else v0 = 0; fun_drawRect(dialog_x + 32 * i + 178, dialog_y + 221, 27, 27, v0); } while ( i < 10 ) { if ( mouseover_button_id == 1 ) v1 = 0xF800u; else v1 = 0; fun_drawRect(dialog_x + 180, dialog_y + 256, 280, 25, v1); ++i; } } void fun_drawMilitaryAdvisor() { int v0; // ecx@6 int i; // [sp+4Ch] [bp-14h]@36 int v2; // [sp+50h] [bp-10h]@38 int v3; // [sp+58h] [bp-8h]@36 int v4; // [sp+5Ch] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 26; v4 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v4 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 1, dialog_x + 10, dialog_y + 10); fun_drawGameText(51, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawGameText(51, 1, dialog_x + 390, dialog_y + 43, graphic_font + 938, 0); fun_drawGameText(51, 2, dialog_x + 390, dialog_y + 58, graphic_font + 938, 0); fun_drawGameText(51, 3, dialog_x + 470, dialog_y + 43, graphic_font + 938, 0); fun_drawGameText(51, 4, dialog_x + 470, dialog_y + 58, graphic_font + 938, 0); fun_drawGameText(51, 5, dialog_x + 550, dialog_y + 43, graphic_font + 938, 0); fun_drawGameText(51, 6, dialog_x + 550, dialog_y + 58, graphic_font + 938, 0); fun_drawGameText(138, 36, dialog_x + 290, dialog_y + 58, graphic_font + 938, 0); milAdv_numForts[0] = fun_calculateNumForts(); if ( milAdv_numForts[0] <= 0 ) { drawGraphic(graphic_bullet, dialog_x + 100, dialog_y + 359); if ( city_inform[ciid].enemyDestroyedBuildings ) { fun_drawGameText(51, 11, dialog_x + 120, dialog_y + 358, graphic_font + 134, 0); } else { if ( city_inform[ciid].imperialArmyComing ) { fun_drawGameText(51, 10, dialog_x + 120, dialog_y + 358, graphic_font + 134, 0); } else { if ( sub_449C60(/*18068 * ciid, 18068 * ciid*/) ) fun_drawGameText(51, 9, dialog_x + 120, dialog_y + 358, graphic_font + 134, 0); else fun_drawGameText(51, 8, dialog_x + 120, dialog_y + 358, graphic_font + 134, 0); } } drawGraphic(graphic_bullet, dialog_x + 100, dialog_y + 379); if ( city_inform[ciid].byte_654584 <= 0 ) { if ( city_inform[ciid].byte_654585 <= 0 ) { if ( city_inform[ciid].byte_654583 <= 0 ) fun_drawGameText(51, 12, dialog_x + 120, dialog_y + 378, graphic_font + 134, 0); else fun_drawGameText(51, 13, dialog_x + 120, dialog_y + 378, graphic_font + 134, 0); } else { fun_drawGameText(51, 14, dialog_x + 120, dialog_y + 378, graphic_font + 134, 0); } } else { fun_drawGameText(51, 15, dialog_x + 120, dialog_y + 378, graphic_font + 134, 0); } } else { drawGraphic(graphic_bullet, dialog_x + 100, dialog_y + 349); text_xoffset = 0; fun_drawNumberSingularPlural( 8, 46, city_inform[ciid].byte_65458F, dialog_x + text_xoffset + 120, dialog_y + 348, graphic_font + 134, 0); fun_drawGameText(51, 7, dialog_x + text_xoffset + 120, dialog_y + 348, graphic_font + 134, 0); fun_drawNumberSingularPlural( 8, 48, city_inform[ciid].byte_65458C, dialog_x + text_xoffset + 120, dialog_y + 348, graphic_font + 134, 0); drawGraphic(graphic_bullet, dialog_x + 100, dialog_y + 369); if ( city_inform[ciid].enemyDestroyedBuildings ) { fun_drawGameText(51, 11, dialog_x + 120, dialog_y + 368, graphic_font + 134, 0); } else { if ( city_inform[ciid].imperialArmyComing ) { fun_drawGameText(51, 10, dialog_x + 120, dialog_y + 368, graphic_font + 134, 0); } else { if ( sub_449C60(/*v0, 18068 * ciid*/) ) fun_drawGameText(51, 9, dialog_x + 120, dialog_y + 368, graphic_font + 134, 0); else fun_drawGameText(51, 8, dialog_x + 120, dialog_y + 368, graphic_font + 134, 0); } } drawGraphic(graphic_bullet, dialog_x + 100, dialog_y + 389); if ( city_inform[ciid].byte_654584 <= 0 ) { if ( city_inform[ciid].byte_654585 <= 0 ) { if ( city_inform[ciid].byte_654583 <= 0 ) fun_drawGameText(51, 12, dialog_x + 120, dialog_y + 388, graphic_font + 134, 0); else fun_drawGameText(51, 13, dialog_x + 120, dialog_y + 388, graphic_font + 134, 0); } else { fun_drawGameText(51, 14, dialog_x + 120, dialog_y + 388, graphic_font + 134, 0); } } else { fun_drawGameText(51, 15, dialog_x + 120, dialog_y + 388, graphic_font + 134, 0); } } fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 70, 36, 17); if ( milAdv_numForts[0] <= 0 ) { fun_drawGameTextWrapped(51, 16, dialog_x + 64, dialog_y + 200, 496, graphic_font + 1072, 0); } else { v3 = 0; for ( i = 0; i < milAdv_numForts[0]; ++i ) { v2 = fun_getFormationIdOfLegion(i + 1); fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 44 * v3 + 77, 560, 40, 0); drawGraphic( formations[v2].fortId + word_6E6CAE, dialog_x + 48, dialog_y + 44 * v3 + 82); fun_drawGameText( 138, formations[v2].fortId, dialog_x + 100, dialog_y + 44 * v3 + 83, graphic_font + 268, 0); text_xoffset = 0; drawNumber( formations[v2].numWalkers, 64, " ", dialog_x + 100, dialog_y + 44 * v3 + 100, graphic_font + 1072, 0); if ( formations[v2].walkerType == Walker_FortLegionary ) { fun_drawGameText(138, 33, dialog_x + text_xoffset + 100, dialog_y + 44 * v3 + 100, graphic_font + 1072, 0); } else { if ( formations[v2].walkerType == Walker_FortJavelin ) fun_drawGameText( 138, 35, dialog_x + text_xoffset + 100, dialog_y + 44 * v3 + 100, graphic_font + 1072, 0); else fun_drawGameText( 138, 34, dialog_x + text_xoffset + 100, dialog_y + 44 * v3 + 100, graphic_font + 1072, 0); } fun_drawGameTextCentered( 138, formations[v2].morale / 5 + 37, dialog_x + 240, dialog_y + 44 * v3 + 91, 150, graphic_font + 1072, 0); fun_drawBorderedButton(0, dialog_x + 400, dialog_y + 44 * v3 + 83, 30, 30, 0); drawGraphic(word_6E6D6C, dialog_x + 403, dialog_y + 44 * v3 + 86); fun_drawBorderedButton(0, dialog_x + 480, dialog_y + 44 * v3 + 83, 30, 30, 0); if ( formations[v2].f03_flag ) drawGraphic(word_6E6D6C + 2, dialog_x + 483, dialog_y + 44 * v3 + 86); else drawGraphic(word_6E6D6C + 1, dialog_x + 483, dialog_y + 44 * v3 + 86); fun_drawBorderedButton(0, dialog_x + 560, dialog_y + 44 * v3 + 83, 30, 30, 0); if ( formations[v2].fortEmpireServiceFlag ) drawGraphic(word_6E6D6C + 3, dialog_x + 563, dialog_y + 44 * v3 + 86); else drawGraphic(word_6E6D6C + 4, dialog_x + 563, dialog_y + 44 * v3 + 86); ++v3; } } } else { fun_drawRect( 16 * v4 + dialog_x, dialog_y + 8 * v4, 16 * (advisor_dialog_width - 2 * v4), 16 * (advisor_dialog_height - 2 * v4), 0); } } } void fun_drawMilitaryAdvisorButtons() { int v0; // [sp+4Ch] [bp-14h]@6 int v1; // [sp+4Ch] [bp-14h]@9 int v2; // [sp+4Ch] [bp-14h]@12 int i; // [sp+50h] [bp-10h]@3 int v4; // [sp+58h] [bp-8h]@3 if ( 5 - advisor_ifSomething <= 0 ) { dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 26; milAdv_numForts[0] = fun_calculateNumForts(); v4 = 0; for ( i = 0; i < milAdv_numForts[0]; ++i ) { fun_getFormationIdOfLegion(i + 1); v0 = mouseover_button_id == 3 * i + 1; fun_drawBorderedButton(0, dialog_x + 400, dialog_y + 44 * v4 + 83, 30, 30, v0); v1 = mouseover_button_id == 3 * i + 2; fun_drawBorderedButton(0, dialog_x + 480, dialog_y + 44 * v4 + 83, 30, 30, v1); v2 = mouseover_button_id == 3 * i + 3; fun_drawBorderedButton(0, dialog_x + 560, dialog_y + 44 * v4++ + 83, 30, 30, v2); } } } void fun_drawImperialAdvisor() { int v0; // ST18_4@26 int v1; // ST14_4@26 int v2; // esi@26 signed int v3; // eax@26 int v4; // [sp+4Ch] [bp-10h]@8 signed int v5; // [sp+50h] [bp-Ch]@5 signed int i; // [sp+54h] [bp-8h]@13 int v7; // [sp+58h] [bp-4h]@1 fun_calculateGiftCosts(); dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 27; v7 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v7 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 2, dialog_x + 10, dialog_y + 10); text_xoffset = 0; fun_drawText(setting_player_name, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); text_xoffset = 0; fun_drawGameText(52, 0, dialog_x + text_xoffset + 60, dialog_y + 44, graphic_font + 134, 0); drawNumber( city_inform[ciid].favorRating, 64, " ", dialog_x + text_xoffset + 60, dialog_y + 44, graphic_font + 134, 0); fun_drawGameTextWrapped( 52, city_inform[ciid].favorRating / 5 + 22, dialog_x + 60, dialog_y + 60, 544, graphic_font + 134, 0); fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 90, 36, 14); v5 = 0; if ( city_inform[ciid].byte_654583 > 0 ) { if ( city_inform[ciid].byte_654585 <= 0 ) { fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 96, 560, 40, 0); drawGraphic(graphic_resourceIcons + 13, dialog_x + 50, dialog_y + 106); text_xoffset = 0; fun_drawGameText(52, 72, dialog_x + text_xoffset + 80, dialog_y + 102, graphic_font + 268, 0); fun_drawGameText( 21, tradeRoutes[city_inform[ciid].distantBattleCity].cityNameId, dialog_x + text_xoffset + 80, dialog_y + 102, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].byte_654581 >= 46 ) { if ( city_inform[ciid].byte_654581 >= 89 ) v4 = 75; else v4 = 74; } else { v4 = 73; } fun_drawGameText(52, v4, dialog_x + text_xoffset + 80, dialog_y + 120, graphic_font + 268, 0); fun_drawNumberSingularPlural( 8, 4, city_inform[ciid].byte_654583, dialog_x + text_xoffset + 80, dialog_y + 120, graphic_font + 268, 0); v5 = 1; } } for ( i = 0; i < 20; ++i ) { if ( scn_requests_good[i] ) { if ( scn_requests_isVisible[i] ) { if ( v5 < 5 ) { fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 42 * v5 + 96, 560, 40, 0); if ( scn_requests_good[i] != 16 && scn_requests_good[i] != 17 ) drawNumber( scn_requests_amount[i], 64, " ", dialog_x + 40, dialog_y + 42 * v5 + 102, graphic_font + 268, 0); else drawNumber( scn_requests_amount[i], 64, " ", dialog_x + 40, dialog_y + 42 * v5 + 102, graphic_font + 268, 0); v0 = dialog_y + 42 * v5 + 100; v1 = dialog_x + 110; v2 = scn_requests_good[i] + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(scn_requests_good[i], 3); drawGraphic(v3 + v2, v1, v0); fun_drawGameText( 23, scn_requests_good[i], dialog_x + 150, dialog_y + 42 * v5 + 102, graphic_font + 268, 0); fun_drawNumberSingularPlural( 8, 4, scn_requests_monthsToComply[i], dialog_x + 310, dialog_y + 42 * v5 + 102, graphic_font + 268, 0); fun_drawGameText(12, 2, dialog_x + text_xoffset + 310, dialog_y + 42 * v5 + 102, graphic_font + 268, 0); text_xoffset = 0; if ( scn_requests_good[i] == 16 ) { drawNumber( city_inform[ciid].treasury, 64, " ", dialog_x + 40, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); fun_drawGameText( 52, 44, dialog_x + text_xoffset + 40, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); if ( city_inform[ciid].treasury < scn_requests_amount[i] ) fun_drawGameText( 52, 48, dialog_x + text_xoffset + 80, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); else fun_drawGameText( 52, 47, dialog_x + text_xoffset + 80, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); } else { drawNumber( city_inform[ciid].resourceInStock[ scn_requests_good[i]], 64, " ", dialog_x + 40, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); fun_drawGameText( 52, 43, dialog_x + text_xoffset + 40, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); if( city_inform[ciid].resourceInStock[ scn_requests_good[i]] < scn_requests_amount[i] ) fun_drawGameText( 52, 48, dialog_x + text_xoffset + 80, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); else fun_drawGameText( 52, 47, dialog_x + text_xoffset + 80, dialog_y + 42 * v5 + 120, graphic_font + 268, 0); } ++v5; } } } } if ( !v5 ) fun_drawGameTextWrapped(52, 21, dialog_x + 64, dialog_y + 160, 512, graphic_font + 268, 0); } else { fun_drawRect( 16 * v7 + dialog_x, dialog_y + 8 * v7, 16 * (advisor_dialog_width - 2 * v7), 16 * (advisor_dialog_height - 2 * v7), 0); } } } void fun_drawImperialAdvisorButtons() { int v0; // [sp+4Ch] [bp-4h]@4 int v1; // [sp+4Ch] [bp-4h]@7 int v2; // [sp+4Ch] [bp-4h]@10 int v3; // [sp+4Ch] [bp-4h]@13 int v4; // [sp+4Ch] [bp-4h]@18 int v5; // [sp+4Ch] [bp-4h]@23 int v6; // [sp+4Ch] [bp-4h]@28 int v7; // [sp+4Ch] [bp-4h]@33 if ( advisor_ifSomething > 5 ) { fun_drawSunkenTextBox(dialog_x + 64, dialog_y + 324, 32, 6); fun_drawGameText(32, city_inform[ciid].player_rank, dialog_x + 72, dialog_y + 338, graphic_font + 804, 0); text_xoffset = 0; fun_drawGameText(52, 1, dialog_x + 72, dialog_y + 372, graphic_font + 268, 0); drawNumber( city_inform[ciid].personalSavings, 64, " Dn", dialog_x + text_xoffset + 80, dialog_y + 372, graphic_font + 268, 0); v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 320, dialog_y + 367, 250, 20, v0); fun_drawGameTextCentered(52, 2, dialog_x + 320, dialog_y + 372, 250, graphic_font + 268, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, dialog_x + 70, dialog_y + 393, 500, 20, v1); text_xoffset = 0; fun_drawGameText(52, city_inform[ciid].salary_rank + 4, dialog_x + 120, dialog_y + 398, graphic_font + 268, 0); drawNumber( city_inform[ciid].salary_amount, 64, " ", dialog_x + text_xoffset + 120, dialog_y + 398, graphic_font + 268, 0); fun_drawGameText(52, 3, dialog_x + text_xoffset + 120, dialog_y + 398, graphic_font + 268, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(0, dialog_x + 320, dialog_y + 341, 250, 20, v2); fun_drawGameTextCentered(52, 49, dialog_x + 320, dialog_y + 346, 250, graphic_font + 268, 0); v3 = mouseover_button_id == 4; if ( sub_44AA30(0) ) fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 96, 560, 40, v3); v4 = mouseover_button_id == 5; if ( sub_44AA30(1) ) fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 138, 560, 40, v4); v5 = mouseover_button_id == 6; if ( sub_44AA30(2) ) fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 180, 560, 40, v5); v6 = mouseover_button_id == 7; if ( sub_44AA30(3) ) fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 222, 560, 40, v6); v7 = mouseover_button_id == 8; if ( sub_44AA30(4) ) fun_drawBorderedButton(0, dialog_x + 38, dialog_y + 264, 560, 40, v7); } } void fun_drawDialogSetSalary() { int v0; // [sp+4Ch] [bp-Ch]@13 int v1; // [sp+50h] [bp-8h]@4 signed int i; // [sp+54h] [bp-4h]@1 fun_drawDialogBackground(dialog_x + 128, dialog_y + 32, 24, 25); drawGraphic(graphic_resourceIcons + 16, dialog_x + 144, dialog_y + 48); fun_drawGameTextCentered(52, 15, dialog_x + 144, dialog_y + 48, 368, graphic_font + 670, 0); fun_drawSunkenTextBox(dialog_x + 144, dialog_y + 80, 22, 15); for ( i = 0; i < 11; ++i ) { text_xoffset = 0; if ( mouseover_button_id == i + 2 ) v1 = graphic_font + 402; else v1 = graphic_font + 268; fun_drawGameText(52, i + 4, dialog_x + 176, dialog_y + 20 * i + 90, v1, 0); drawNumber(salaryAmounts[i], 64, " Dn", dialog_x + text_xoffset + 176, dialog_y + 20 * i + 90, v1, 0); } if ( city_inform[ciid].victoryContinueMonths <= 0 ) { if ( city_inform[ciid].salary_rank <= city_inform[ciid].player_rank ) fun_drawGameTextWrapped(52, 76, dialog_x + 152, dialog_y + 336, 336, graphic_font + 134, 0); else fun_drawGameTextWrapped(52, 71, dialog_x + 152, dialog_y + 336, 336, graphic_font + 134, 0); } else { fun_drawGameTextWrapped(52, 77, dialog_x + 152, dialog_y + 336, 336, graphic_font + 134, 0); } v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 240, dialog_y + 395, 160, 20, v0); fun_drawGameTextCentered(13, 4, dialog_x + 176, dialog_y + 400, 288, graphic_font + 134, 0); } void fun_drawDialogDonateToCity() { fun_drawDialogBackground(dialog_x + 64, dialog_y + 160, 32, 10); drawGraphic(graphic_resourceIcons + 16, dialog_x + 96, dialog_y + 176); fun_drawGameTextCentered(52, 16, dialog_x + 80, dialog_y + 176, 496, graphic_font + 670, 0); fun_drawSunkenTextBox(dialog_x + 112, dialog_y + 208, 26, 4); fun_drawNumberCentered(0, 64, " ", dialog_x + 124, dialog_y + 221, 64, graphic_font + 268, 0); fun_drawNumberCentered(500, 64, " ", dialog_x + 204, dialog_y + 221, 64, graphic_font + 268, 0); fun_drawNumberCentered(2000, 64, " ", dialog_x + 284, dialog_y + 221, 64, graphic_font + 268, 0); fun_drawNumberCentered(5000, 64, " ", dialog_x + 364, dialog_y + 221, 64, graphic_font + 268, 0); fun_drawGameTextCentered(52, 19, dialog_x + 444, dialog_y + 221, 64, graphic_font + 268, 0); fun_drawGameText(52, 17, dialog_x + 128, dialog_y + 248, graphic_font + 268, 0); drawNumber(city_inform[ciid].donateAmount, 64, " ", dialog_x + 316, dialog_y + 248, graphic_font + 268, 0); fun_drawGameTextCentered(13, 4, dialog_x + 336, dialog_y + 288, 160, graphic_font + 134, 0); fun_drawGameTextCentered(52, 18, dialog_x + 144, dialog_y + 288, 160, graphic_font + 134, 0); } void fun_drawDialogDonateToCityButtons() { int v0; // [sp+4Ch] [bp-4h]@2 int v1; // [sp+4Ch] [bp-4h]@5 int v2; // [sp+4Ch] [bp-4h]@8 int v3; // [sp+4Ch] [bp-4h]@11 int v4; // [sp+4Ch] [bp-4h]@14 int v5; // [sp+4Ch] [bp-4h]@17 int v6; // [sp+4Ch] [bp-4h]@20 v0 = mouseover_button_id == 3; fun_drawBorderedButton(0, dialog_x + 128, dialog_y + 216, 64, 20, v0); v1 = mouseover_button_id == 4; fun_drawBorderedButton(0, dialog_x + 208, dialog_y + 216, 64, 20, v1); v2 = mouseover_button_id == 5; fun_drawBorderedButton(0, dialog_x + 288, dialog_y + 216, 64, 20, v2); v3 = mouseover_button_id == 6; fun_drawBorderedButton(0, dialog_x + 368, dialog_y + 216, 64, 20, v3); v4 = mouseover_button_id == 7; fun_drawBorderedButton(0, dialog_x + 448, dialog_y + 216, 64, 20, v4); v5 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 336, dialog_y + 283, 160, 20, v5); v6 = mouseover_button_id == 2; fun_drawBorderedButton(0, dialog_x + 144, dialog_y + 283, 160, 20, v6); } void fun_drawDialogSendGift() { fun_drawDialogBackground(dialog_x + 96, dialog_y + 144, 30, 15); drawGraphic(graphic_resourceIcons + 16, dialog_x + 128, dialog_y + 160); fun_drawGameTextCentered(52, 69, dialog_x + 128, dialog_y + 160, 432, graphic_font + 670, 0); fun_drawSunkenTextBox(dialog_x + 112, dialog_y + 208, 28, 5); text_xoffset = 0; fun_drawGameText(52, 50, dialog_x + 144, dialog_y + 304, graphic_font + 134, 0); fun_drawNumberSingularPlural( 8, 4, city_inform[ciid].favor_monthsSinceGift, dialog_x + text_xoffset + 144, dialog_y + 304, graphic_font + 134, 0); fun_drawGameTextCentered(13, 4, dialog_x + 400, dialog_y + 341, 160, graphic_font + 134, 0); } void fun_drawDialogSendGiftButtons() { int v0; // [sp+4Ch] [bp-8h]@19 int v1; // [sp+4Ch] [bp-8h]@23 int v2; // [sp+50h] [bp-4h]@3 int v3; // [sp+50h] [bp-4h]@9 int v4; // [sp+50h] [bp-4h]@14 if ( city_inform[ciid].modestGiftCost > city_inform[ciid].personalSavings ) { fun_drawGameTextWrapped(52, 70, dialog_x + 160, dialog_y + 224, 352, graphic_font + 268, 0); } else { fun_drawGameText(52, 63, dialog_x + 128, dialog_y + 218, graphic_font + 268, 0); if ( mouseover_button_id == 1 ) v2 = graphic_font + 402; else v2 = graphic_font + 268; text_xoffset = 0; fun_drawGameText(52, city_inform[ciid].modestGiftType + 51, dialog_x + 224, dialog_y + 218, v2, 0); drawNumber( city_inform[ciid].modestGiftCost, 64, "Dn", dialog_x + text_xoffset + 224, dialog_y + 218, v2, 0); } if ( city_inform[ciid].generousGiftCost <= city_inform[ciid].personalSavings ) { fun_drawGameText(52, 64, dialog_x + 128, dialog_y + 238, graphic_font + 268, 0); if ( mouseover_button_id == 2 ) v3 = graphic_font + 402; else v3 = graphic_font + 268; text_xoffset = 0; fun_drawGameText(52, city_inform[ciid].generousGiftType + 55, dialog_x + 224, dialog_y + 238, v3, 0); drawNumber( city_inform[ciid].generousGiftCost, 64, "Dn", dialog_x + text_xoffset + 224, dialog_y + 238, v3, 0); } if ( city_inform[ciid].lavishGiftCost <= city_inform[ciid].personalSavings ) { fun_drawGameText(52, 65, dialog_x + 128, dialog_y + 258, graphic_font + 268, 0); if ( mouseover_button_id == 3 ) v4 = graphic_font + 402; else v4 = graphic_font + 268; text_xoffset = 0; fun_drawGameText(52, city_inform[ciid].lavishGiftType + 59, dialog_x + 224, dialog_y + 258, v4, 0); drawNumber( city_inform[ciid].lavishGiftCost, 64, "Dn", dialog_x + text_xoffset + 224, dialog_y + 258, v4, 0); } if ( city_inform[ciid].modestGiftCost <= city_inform[ciid].personalSavings ) { fun_drawGameTextCentered(52,city_inform[ciid].giftToCaesarSize + 66,dialog_x + 128, dialog_y + 341, 240,graphic_font + 134,0); v0 = mouseover_button_id == 4; fun_drawBorderedButton(1, dialog_x + 128, dialog_y + 336, 240, 20, v0); } v1 = mouseover_button_id == 5; fun_drawBorderedButton(1, dialog_x + 400, dialog_y + 336, 160, 20, v1); } void fun_drawRatingsAdvisor() { int v0; // [sp+54h] [bp-Ch]@17 int v1; // [sp+54h] [bp-Ch]@27 int v2; // [sp+54h] [bp-Ch]@37 int v3; // [sp+54h] [bp-Ch]@47 int v4; // [sp+58h] [bp-8h]@10 int v5; // [sp+58h] [bp-8h]@20 int v6; // [sp+58h] [bp-8h]@30 int v7; // [sp+58h] [bp-8h]@40 int v8; // [sp+5Ch] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 27; v8 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v8 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 3, dialog_x + 10, dialog_y + 10); text_xoffset = 0; fun_drawGameText(53, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); if ( !scn_win_population_on || scn_isOpenPlay ) { fun_drawGameText(53, 7, dialog_x + text_xoffset + 80, dialog_y + 17, graphic_font + 134, 0); } else { fun_drawGameText(53, 6, dialog_x + text_xoffset + 80, dialog_y + 17, graphic_font + 134, 0); drawNumber( scn_win_population, 64, ")", dialog_x + text_xoffset + 80, dialog_y + 17, graphic_font + 134, 0); } drawGraphic(graphic_ratingsBackground, dialog_x + 60, dialog_y + 48); v4 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 80, dialog_y + 286, 110, 66, v4); fun_drawGameTextCentered(53, 1, dialog_x + 80, dialog_y + 294, 110, graphic_font + 134, 0); fun_drawNumberCentered( city_inform[ciid].cultureRating, 64, " ", dialog_x + 80, dialog_y + 309, 100, graphic_font + 670, 0); text_xoffset = 0; if ( scn_win_culture_on ) drawNumber(scn_win_culture, 64, " ", dialog_x + 85, dialog_y + 334, graphic_font + 134, 0); else drawNumber(0, 64, " ", dialog_x + 85, dialog_y + 334, graphic_font + 134, 0); fun_drawGameText(53, 5, dialog_x + text_xoffset + 85, dialog_y + 334, graphic_font + 134, 0); v0 = !scn_win_culture_on || city_inform[ciid].cultureRating > scn_win_culture; fun_drawRatingAdvisorColumn(dialog_x + 110, dialog_y + 274, city_inform[ciid].cultureRating, v0); v5 = mouseover_button_id == 2; fun_drawBorderedButton(0, dialog_x + 200, dialog_y + 286, 110, 66, v5); fun_drawGameTextCentered(53, 2, dialog_x + 200, dialog_y + 294, 110, graphic_font + 134, 0); fun_drawNumberCentered( city_inform[ciid].prosperityRating, 64, " ", dialog_x + 200, dialog_y + 309, 100, graphic_font + 670, 0); text_xoffset = 0; if ( scn_win_prosperity_on ) drawNumber(scn_win_prosperity, 64, " ", dialog_x + 205, dialog_y + 334, graphic_font + 134, 0); else drawNumber(0, 64, " ", dialog_x + 205, dialog_y + 334, graphic_font + 134, 0); fun_drawGameText(53, 5, text_xoffset + dialog_x + 205, dialog_y + 334, graphic_font + 134, 0); v1 = !scn_win_prosperity_on || city_inform[ciid].prosperityRating > scn_win_prosperity; fun_drawRatingAdvisorColumn(dialog_x + 230, dialog_y + 274, city_inform[ciid].prosperityRating, v1); v6 = mouseover_button_id == 3; fun_drawBorderedButton(0, dialog_x + 320, dialog_y + 286, 110, 66, v6); fun_drawGameTextCentered(53, 3, dialog_x + 320, dialog_y + 294, 110, graphic_font + 134, 0); fun_drawNumberCentered( city_inform[ciid].peaceRating, 64, " ", dialog_x + 320, dialog_y + 309, 100, graphic_font + 670, 0); text_xoffset = 0; if ( scn_win_peace_on ) drawNumber(scn_win_peace, 64, " ", dialog_x + 325, dialog_y + 334, graphic_font + 134, 0); else drawNumber(0, 64, " ", dialog_x + 325, dialog_y + 334, graphic_font + 134, 0); fun_drawGameText(53, 5, dialog_x + text_xoffset + 240 + 85, dialog_y + 334, graphic_font + 134, 0); v2 = !scn_win_peace_on || city_inform[ciid].peaceRating > scn_win_peace; fun_drawRatingAdvisorColumn(dialog_x + 350, dialog_y + 274, city_inform[ciid].peaceRating, v2); v7 = mouseover_button_id == 4; fun_drawBorderedButton(0, dialog_x + 440, dialog_y + 286, 110, 66, v7); fun_drawGameTextCentered(53, 4, dialog_x + 440, dialog_y + 294, 110, graphic_font + 134, 0); fun_drawNumberCentered( city_inform[ciid].favorRating, 64, " ", dialog_x + 440, dialog_y + 309, 100, graphic_font + 670, 0); text_xoffset = 0; if ( scn_win_favor_on ) drawNumber(scn_win_favor, 64, " ", dialog_x + 445, dialog_y + 334, graphic_font + 134, 0); else drawNumber(0, 64, " ", dialog_x + 445, dialog_y + 334, graphic_font + 134, 0); fun_drawGameText(53, 5, dialog_x + text_xoffset + 360 + 85, dialog_y + 334, graphic_font + 134, 0); v3 = !scn_win_favor_on || city_inform[ciid].favorRating > scn_win_favor; fun_drawRatingAdvisorColumn(dialog_x + 470, dialog_y + 274, city_inform[ciid].favorRating, v3); fun_drawSunkenTextBox(dialog_x + 64, dialog_y + 356, 32, 4); if ( city_inform[ciid].ratingAdvisorSelectedRating ) { switch ( city_inform[ciid].ratingAdvisorSelectedRating ) { case 1: fun_drawGameText(53, 1, dialog_x + 72, dialog_y + 359, graphic_font + 268, 0); if ( city_inform[ciid].cultureRating <= 90 ) fun_drawGameTextWrapped( 53, city_inform[ciid].cultureRatingExplanation + 9, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); else fun_drawGameTextWrapped(53, 50, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); break; case 2: fun_drawGameText(53, 2, dialog_x + 72, dialog_y + 359, graphic_font + 268, 0); if ( city_inform[ciid].prosperityRating <= 90 ) fun_drawGameTextWrapped( 53, city_inform[ciid].prosperityRatingExplanation + 16, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); else fun_drawGameTextWrapped(53, 51, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); break; case 3: fun_drawGameText(53, 3, dialog_x + 72, dialog_y + 359, graphic_font + 268, 0); if ( city_inform[ciid].peaceRating <= 90 ) fun_drawGameTextWrapped( 53, city_inform[ciid].peaceRatingExplanation + 41, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); else fun_drawGameTextWrapped(53, 52, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); break; case 4: fun_drawGameText(53, 4, dialog_x + 72, dialog_y + 359, graphic_font + 268, 0); if ( city_inform[ciid].favorRating <= 90 ) fun_drawGameTextWrapped( 53, city_inform[ciid].favorRatingExplanation + 27, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); else fun_drawGameTextWrapped(53, 53, dialog_x + 72, dialog_y + 374, 496, graphic_font + 268, 0); break; } } else { fun_drawGameTextCentered(53, 8, dialog_x + 72, dialog_y + 380, 496, graphic_font + 268, 0); } } else { fun_drawRect( 16 * v8 + dialog_x, dialog_y + 8 * v8, 16 * (advisor_dialog_width - 2 * v8), 16 * (advisor_dialog_height - 2 * v8), 0); } } } void fun_drawRatingsAdvisorButtons() { int v0; // [sp+54h] [bp-8h]@6 int v1; // [sp+54h] [bp-8h]@9 int v2; // [sp+54h] [bp-8h]@12 int v3; // [sp+54h] [bp-8h]@15 if ( 5 - advisor_ifSomething < 5 ) { if ( 5 - advisor_ifSomething <= 0 ) { v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 80, dialog_y + 286, 110, 66, v0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, dialog_x + 200, dialog_y + 286, 110, 66, v1); v2 = mouseover_button_id == 3; fun_drawBorderedButton(0, dialog_x + 320, dialog_y + 286, 110, 66, v2); v3 = mouseover_button_id == 4; fun_drawBorderedButton(0, dialog_x + 440, dialog_y + 286, 110, 66, v3); } } } void fun_drawRatingAdvisorColumn(int x, int y, signed int value, int hasReached) { int yOffset; // [sp+4Ch] [bp-10h]@1 signed int gid; // [sp+54h] [bp-8h]@1 int i; // [sp+58h] [bp-4h]@1 yOffset = y - c3_sg2[graphic_rating_column].height; drawGraphic(graphic_rating_column, x, yOffset); gid = graphic_rating_column + 1; for ( i = 0; i < 2 * value; ++i ) { --yOffset; drawGraphic(gid, x + 11, yOffset); } if ( value > 30 ) { if ( hasReached ) drawGraphic(graphic_rating_column + 2, x - 6, yOffset); } } void fun_drawTradeAdvisor() { int v0; // [sp+4Ch] [bp-4h]@1 fun_updateAvailableGoodsAndFoods(); dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 27; v0 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v0 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 4, dialog_x + 10, dialog_y + 10); fun_drawGameText(54, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawGameText(54, 1, dialog_x + 400, dialog_y + 38, graphic_font + 134, 0); } else { fun_drawRect( 16 * v0 + dialog_x, dialog_y + 8 * v0, 16 * (advisor_dialog_width - 2 * v0), 16 * (advisor_dialog_height - 2 * v0), 0); } } } void fun_drawTradeAdvisorButtons() { int v0; // ST1C_4@5 int v1; // ST18_4@5 int v2; // esi@5 signed int v3; // eax@5 int v4; // ST1C_4@5 int v5; // ST18_4@5 int v6; // esi@5 signed int v7; // eax@5 int v8; // [sp+4Ch] [bp-Ch]@5 signed int v9; // [sp+50h] [bp-8h]@6 int v10; // [sp+50h] [bp-8h]@23 int v11; // [sp+50h] [bp-8h]@26 int i; // [sp+54h] [bp-4h]@3 if ( advisor_ifSomething > 5 ) { fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 52, 36, 21); for ( i = 0; i < availableGoods_count; ++i ) { v8 = goodlist_indexToResourceId1[i]; v0 = dialog_y + 22 * i + 54; v1 = dialog_x + 48; v2 = v8 + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(v8, 3); drawGraphic(v3 + v2, v1, v0); v4 = dialog_y + 22 * i + 54; v5 = dialog_x + 568; v6 = v8 + graphic_resourceIcons; v7 = fun_getResourceGraphicIdOffset(v8, 3); drawGraphic(v7 + v6, v5, v4); if ( i == mouseover_button_id - 3 ) v9 = 63488; else v9 = 0; if ( v9 == 63488 ) fun_drawBorderedButton(0, dialog_x + 80, dialog_y + 22 * i + 54, 480, 24, 1); fun_drawGameText(23, v8, dialog_x + 88, dialog_y + 22 * i + 61, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].resourceInStock[v8], 64, " ", dialog_x + 180, dialog_y + 22 * i + 61, 100, graphic_font + 268, 0); if ( city_inform[ciid].industryMothballed[v8] == 1 ) fun_drawGameText(18, 5, dialog_x + 300, dialog_y + 22 * i + 61, graphic_font + 268, 0); if ( city_inform[ciid].resourceStockpile[ v8 ] ) { fun_drawGameText(54, 3, dialog_x + 380, dialog_y + 22 * i + 61, graphic_font + 268, 0); } else { if ( city_inform[ciid].resourceTradeStatus[ v8 ] ) { if ( city_inform[ciid].resourceTradeStatus[ v8 ] == 1 ) fun_drawGameText(54, 5, dialog_x + 380, dialog_y + 22 * i + 61, graphic_font + 268, 0); else fun_drawGameText(54, 6, dialog_x + 380, dialog_y + 22 * i + 61, graphic_font + 268, 0); } } if ( city_inform[ciid].resourceTradeStatus[ v8 ] == 2 ) drawNumber( city_inform[ciid].exportOver[v8], 64, " ", dialog_x + 500, dialog_y + 22 * i + 61, graphic_font + 268, 0); } v10 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 398, dialog_y + 396, 200, 24, v10); fun_drawGameTextCentered(54, 2, dialog_x + 400, dialog_y + 402, 200, graphic_font + 134, 0); v11 = mouseover_button_id == 2; fun_drawBorderedButton(0, dialog_x + 98, dialog_y + 396, 200, 24, v11); fun_drawGameTextCentered(54, 30, dialog_x + 100, dialog_y + 402, 200, graphic_font + 134, 0); } } void fun_drawDialogResourceSettings() { int v0; // ST18_4@1 int v1; // ST14_4@1 int v2; // esi@1 signed int v3; // eax@1 signed int v4; // [sp+4Ch] [bp-8h]@1 int v5; // [sp+50h] [bp-4h]@28 int v6; // [sp+50h] [bp-4h]@41 int v7; // [sp+50h] [bp-4h]@47 v4 = 0; fun_drawDialogBackground(dialog_x + 48, dialog_y + 128, 34, 15); v0 = dialog_y + 136; v1 = dialog_x + 58; v2 = selectedGoodId + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(selectedGoodId, 3); drawGraphic(v3 + v2, v1, v0); fun_drawGameText(23, selectedGoodId, dialog_x + 92, dialog_y + 137, graphic_font + 670, 0); if ( fun_tradeCanBuyGoodNow(selectedGoodId) ) v4 = 1; if ( fun_tradeCanSellGoodNow(selectedGoodId) ) v4 += 2; text_xoffset = 0; if ( cityCanProduceGoodNow(selectedGoodId) ) { if ( numIndustries[selectedGoodId] > 0 ) { if (city_inform[ciid].industryMothballed[selectedGoodId] == 1 ) { drawNumber(numIndustries[selectedGoodId], 64, " ", dialog_x + 98, dialog_y + 172, graphic_font + 134, 0); if ( numIndustries[selectedGoodId] == 1 ) fun_drawGameText(54, 10, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); else fun_drawGameText(54, 11, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); } else { if ( numIndustries[selectedGoodId] == numWorkingIndustries[selectedGoodId] ) { drawNumber( numIndustries[selectedGoodId], 64, " ", dialog_x + 98, dialog_y + 172, graphic_font + 134, 0); if ( numIndustries[selectedGoodId] == 1 ) fun_drawGameText(54, 8, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); else fun_drawGameText(54, 9, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); } else { drawNumber( numWorkingIndustries[selectedGoodId], 64, " ", dialog_x + 98, dialog_y + 172, graphic_font + 134, 0); fun_drawGameText(54, 12, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); drawNumber( numIndustries[selectedGoodId] - numWorkingIndustries[selectedGoodId], 64, " ", dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); if ( numWorkingIndustries[selectedGoodId] == 1 ) fun_drawGameText(54, 13, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); else fun_drawGameText(54, 14, dialog_x + text_xoffset + 98, dialog_y + 172, graphic_font + 134, 0); } } } else { fun_drawGameText(54, 7, dialog_x + 98, dialog_y + 172, graphic_font + 134, 0); } } else { if ( selectedGoodId != 6 || !scn_allow_wharves ) fun_drawGameText(54, 25, dialog_x + 98, dialog_y + 172, graphic_font + 134, 0); } text_xoffset = 0; fun_drawNumberSingularPlural( 8, 10, city_inform[ciid].resourceInStock[ selectedGoodId ], dialog_x + 98, dialog_y + 192, graphic_font + 134, 0); fun_drawGameText(54, 15, dialog_x + text_xoffset + 98, dialog_y + 192, graphic_font + 134, 0); if ( v4 ) { if ( mouseover_button_id_main ) v5 = 1; else v5 = 0; fun_drawBorderedButton(0, dialog_x + 98, dialog_y + 212, 432, 30, v5); if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId ] ) { if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId ] == 1 ) fun_drawGameTextCentered(54, 19, dialog_x + 114, dialog_y + 221, 400, graphic_font + 134, 0); else fun_drawGameTextCentered(54, 20, dialog_x + 114, dialog_y + 221, 200, graphic_font + 134, 0); } else { fun_drawGameTextCentered(54, 18, dialog_x + 114, dialog_y + 221, 400, graphic_font + 134, 0); } } else { fun_drawGameText(54, 24, dialog_x + 98, dialog_y + 212, graphic_font + 134, 0); } if ( city_inform[ciid].resourceTradeStatus[ selectedGoodId] == 2 ) fun_drawNumberSingularPlural( 8, 10, city_inform[ciid].exportOver[selectedGoodId], dialog_x + 386, dialog_y + 221, graphic_font + 134, 0); if ( numIndustries[selectedGoodId] > 0 ) { if ( mouseover_button_id ) v6 = 1; else v6 = 0; fun_drawBorderedButton(0, dialog_x + 98, dialog_y + 250, 432, 30, v6); if ( city_inform[ciid].industryMothballed[selectedGoodId] ) fun_drawGameTextCentered(54, 17, dialog_x + 114, dialog_y + 259, 400, graphic_font + 134, 0); else fun_drawGameTextCentered(54, 16, dialog_x + 114, dialog_y + 259, 400, graphic_font + 134, 0); } if ( dword_9D7B90 ) v7 = 1; else v7 = 0; fun_drawBorderedButton(0, dialog_x + 98, dialog_y + 288, 432, 50, v7); if( city_inform[ciid].resourceStockpile[ selectedGoodId ] ) { fun_drawGameTextCentered(54, 26, dialog_x + 114, dialog_y + 296, 400, graphic_font + 134, 0); fun_drawGameTextCentered(54, 27, dialog_x + 114, dialog_y + 316, 400, graphic_font + 938, 0); } else { fun_drawGameTextCentered(54, 28, dialog_x + 114, dialog_y + 296, 400, graphic_font + 134, 0); fun_drawGameTextCentered(54, 29, dialog_x + 114, dialog_y + 316, 400, graphic_font + 938, 0); } } void fun_drawDialogTradePrices() { int v0; // ST1C_4@3 int v1; // ST18_4@3 int v2; // esi@3 signed int v3; // eax@3 int i; // [sp+4Ch] [bp-4h]@1 fun_greyRectangle(dialog_x + 33, dialog_y + 53, 574, 334, 0); fun_drawDialogBackground(dialog_x + 16, dialog_y + 144, 38, 11); fun_drawGameText(54, 21, dialog_x + 26, dialog_y + 153, graphic_font + 670, 0); fun_drawGameText(54, 22, dialog_x + 26, dialog_y + 228, graphic_font + 134, 0); fun_drawGameText(54, 23, dialog_x + 26, dialog_y + 253, graphic_font + 134, 0); for ( i = 1; i <= 15; ++i ) { v0 = dialog_y + 194; v1 = dialog_x + 30 * i + 126; v2 = i + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(i, 3); drawGraphic(v3 + v2, v1, v0); fun_drawNumberCentered( tradeprices_buy[2 * i], 64, " ", dialog_x + 30 * i + 120, dialog_y + 229, 30, graphic_font + 938, 0); fun_drawNumberCentered( tradeprices_sell[2 * i], 64, " ", dialog_x + 30 * i + 120, dialog_y + 254, 30, graphic_font + 938, 0); } fun_drawGameTextCentered(13, 1, dialog_x + 16, dialog_y + 296, 608, graphic_font + 134, 0); } void fun_updateAvailableGoodsAndFoods() { signed int i; // [sp+4Ch] [bp-4h]@1 signed int j; // [sp+4Ch] [bp-4h]@4 int k; // [sp+4Ch] [bp-4h]@7 int l; // [sp+4Ch] [bp-4h]@17 for ( i = 0; i < 16; ++i ) goodlist_indexToResourceId1[i] = 0; availableGoods_count = 0; for ( j = 0; j < 16; ++j ) foodlist_indexToResourceId1[j] = 0; availableFoods_count = 0; for ( k = 1; k <= 15; ++k ) { if ( cityCanProduceGoodNow(k) ) { goodlist_indexToResourceId1[availableGoods_count++] = k; } else { if ( fun_tradeCanBuyGoodNow(k) ) { goodlist_indexToResourceId1[availableGoods_count++] = k; } else { if ( k == 6 ) { if ( scn_allow_wharves ) goodlist_indexToResourceId1[availableGoods_count++] = k; } } } } for ( l = 1; l <= 6; ++l ) { if ( l != G_Olives ) { if ( l != G_Vines ) { if ( cityCanProduceGoodNow(l) ) { foodlist_indexToResourceId1[availableFoods_count++] = l; } else { if ( fun_tradeCanBuyGoodNow(l) ) { foodlist_indexToResourceId1[availableFoods_count++] = l; } else { if ( l == G_MeatFish ) { if ( scn_allow_wharves ) foodlist_indexToResourceId1[availableFoods_count++] = l; } } } } } } } void fun_drawDialogTradeRouteOpened() { fun_drawDialogBackground(screen_640x480_x + 80, screen_640x480_y + 64, 30, 14); fun_drawGameTextCentered(142, 0, screen_640x480_x + 80, screen_640x480_y + 80, 480, graphic_font + 670, 0); if ( tradeRoutes[trade_selectedCity].isSeaTrade ) { fun_drawGameTextWrapped(142, 1, screen_640x480_x + 112, screen_640x480_y + 120, 416, graphic_font + 134, 0); fun_drawGameTextWrapped(142, 3, screen_640x480_x + 112, screen_640x480_y + 184, 416, graphic_font + 134, 0); } else { fun_drawGameTextWrapped(142, 1, screen_640x480_x + 112, screen_640x480_y + 152, 416, graphic_font + 134, 0); } fun_drawGameText(142, 2, screen_640x480_x + 128, screen_640x480_y + 256, graphic_font + 134, 0); } void fun_drawPopulationAdvisor() { int v0; // [sp+54h] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 27; v0 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v0 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 5, dialog_x + 10, dialog_y + 10); if ( populationAdvisor_graphOrder < 4 ) { if ( populationAdvisor_graphOrder < 2 ) { if ( populationAdvisor_graphOrder >= 0 ) fun_drawGameText(55, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); } else { fun_drawGameText(55, 1, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); } } else { fun_drawGameText(55, 2, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); } drawGraphic(graphic_panelwindows + 14, dialog_x + 56, dialog_y + 60); fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 60, 106, 57, 0); fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 160, 106, 57, 0); if ( populationAdvisor_graphOrder ) { switch ( populationAdvisor_graphOrder ) { case 1: fun_drawGameTextCentered(55, 6, dialog_x + 60, dialog_y + 295, 400, graphic_font + 134, 0); fun_drawGameTextCentered(55, 5, dialog_x + 504, dialog_y + 120, 100, graphic_font + 134, 0); fun_drawGameTextCentered(55, 4, dialog_x + 504, dialog_y + 220, 100, graphic_font + 134, 0); fun_drawPopulationHistoryGraph(1, dialog_x + 64, dialog_y + 64); fun_drawPopulationSocietyGraph(0, dialog_x + 505, dialog_y + 63); fun_drawPopulationCensusGraph(0, dialog_x + 505, dialog_y + 163); break; case 2: fun_drawGameTextCentered(55, 7, dialog_x + 60, dialog_y + 295, 400, graphic_font + 134, 0); fun_drawGameTextCentered(55, 3, dialog_x + 504, dialog_y + 120, 100, graphic_font + 134, 0); fun_drawGameTextCentered(55, 5, dialog_x + 504, dialog_y + 220, 100, graphic_font + 134, 0); fun_drawPopulationCensusGraph(1, dialog_x + 64, dialog_y + 64); fun_drawPopulationHistoryGraph(0, dialog_x + 505, dialog_y + 63); fun_drawPopulationSocietyGraph(0, dialog_x + 505, dialog_y + 163); break; case 3: fun_drawGameTextCentered(55, 7, dialog_x + 60, dialog_y + 295, 400, graphic_font + 134, 0); fun_drawGameTextCentered(55, 5, dialog_x + 504, dialog_y + 120, 100, graphic_font + 134, 0); fun_drawGameTextCentered(55, 3, dialog_x + 504, dialog_y + 220, 100, graphic_font + 134, 0); fun_drawPopulationCensusGraph(1, dialog_x + 64, dialog_y + 64); fun_drawPopulationSocietyGraph(0, dialog_x + 505, dialog_y + 63); fun_drawPopulationHistoryGraph(0, dialog_x + 505, dialog_y + 163); break; case 4: fun_drawGameTextCentered(55, 8, dialog_x + 60, dialog_y + 295, 400, graphic_font + 134, 0); fun_drawGameTextCentered(55, 3, dialog_x + 504, dialog_y + 120, 100, graphic_font + 134, 0); fun_drawGameTextCentered(55, 4, dialog_x + 504, dialog_y + 220, 100, graphic_font + 134, 0); fun_drawPopulationSocietyGraph(1, dialog_x + 64, dialog_y + 64); fun_drawPopulationHistoryGraph(0, dialog_x + 505, dialog_y + 63); fun_drawPopulationCensusGraph(0, dialog_x + 505, dialog_y + 163); break; case 5: fun_drawGameTextCentered(55, 8, dialog_x + 60, dialog_y + 295, 400, graphic_font + 134, 0); fun_drawGameTextCentered(55, 4, dialog_x + 504, dialog_y + 120, 100, graphic_font + 134, 0); fun_drawGameTextCentered(55, 3, dialog_x + 504, dialog_y + 220, 100, graphic_font + 134, 0); fun_drawPopulationSocietyGraph(1, dialog_x + 64, dialog_y + 64); fun_drawPopulationCensusGraph(0, dialog_x + 505, dialog_y + 63); fun_drawPopulationHistoryGraph(0, dialog_x + 505, dialog_y + 163); break; } } else { fun_drawGameTextCentered(55, 6, dialog_x + 60, dialog_y + 295, 400, graphic_font + 134, 0); fun_drawGameTextCentered(55, 4, dialog_x + 504, dialog_y + 120, 100, graphic_font + 134, 0); fun_drawGameTextCentered(55, 5, dialog_x + 504, dialog_y + 220, 100, graphic_font + 134, 0); fun_drawPopulationHistoryGraph(1, dialog_x + 64, dialog_y + 64); fun_drawPopulationCensusGraph(0, dialog_x + 505, dialog_y + 63); fun_drawPopulationSocietyGraph(0, dialog_x + 505, dialog_y + 163); } fun_drawSunkenTextBox(dialog_x + 48, dialog_y + 336, 34, 5); drawGraphic(graphic_bullet, dialog_x + 56, dialog_y + 344); drawGraphic(graphic_bullet, dialog_x + 56, dialog_y + 362); drawGraphic(graphic_bullet, dialog_x + 56, dialog_y + 380); drawGraphic(graphic_bullet, dialog_x + 56, dialog_y + 398); if ( scn_romeSuppliesWheat ) { fun_drawGameText(55, 11, dialog_x + 75, dialog_y + 342, graphic_font + 268, 0); } else { text_xoffset = 0; fun_drawNumberSingularPlural( 8, 6, city_inform[ciid].granaries_3orMoreWorkers, dialog_x + text_xoffset + 75, dialog_y + 342, graphic_font + 268, 0); if ( city_inform[ciid].foodSupplyMonths > 0 ) { fun_drawGameText(55, 12, dialog_x + text_xoffset + 75, dialog_y + 342, graphic_font + 268, 0); fun_drawNumberSingularPlural( 8, 4, city_inform[ciid].foodSupplyMonths, dialog_x + text_xoffset + 75, dialog_y + 342, graphic_font + 268, 0); } else { if ( city_inform[ciid].totalFoodStoredInGranaries <= city_inform[ciid].unitsOfFoodNeededPerMonth / 2 ) { if ( city_inform[ciid].totalFoodStoredInGranaries > 0 ) fun_drawGameText(55, 15, dialog_x + text_xoffset + 75, dialog_y + 342, graphic_font + 268, 0); else fun_drawGameText(55, 14, dialog_x + text_xoffset + 75, dialog_y + 342, graphic_font + 268, 0); } else { fun_drawGameText(55, 13, dialog_x + text_xoffset + 75, dialog_y + 342, graphic_font + 268, 0); } } } text_xoffset = 0; fun_drawGameText(55, 16, dialog_x + text_xoffset + 75, dialog_y + 360, graphic_font + 268, 0); drawNumber( city_inform[ciid].foodTypesEaten, 64, " ", dialog_x + text_xoffset + 75, dialog_y + 360, graphic_font + 268, 0); if ( city_inform[ciid].relatedToImmigration_always0 ) { if ( city_inform[ciid].relatedToImmigration_always0 == 1 ) { fun_drawGameText(55, 25, dialog_x + 75, dialog_y + 378, graphic_font + 268, 0); if ( !city_inform[ciid].immigrationState ) fun_drawGameText(55, 20, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 1 ) fun_drawGameText(55, 21, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 2 ) fun_drawGameText(55, 22, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 3 ) fun_drawGameText(55, 23, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 4 ) fun_drawGameText(55, 31, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 5 ) fun_drawGameText(55, 32, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); } else { if ( city_inform[ciid].relatedToImmigration_always0 == 2 ) fun_drawGameTextWrapped(55, 29, dialog_x + 75, dialog_y + 378, 496, graphic_font + 268, 0); else fun_drawGameTextWrapped(55, 30, dialog_x + 75, dialog_y + 378, 496, graphic_font + 268, 0); } } else { text_xoffset = 0; if ( city_inform[ciid].newcomersThisMonth < 5 ) { if ( city_inform[ciid].wantedImmigrantsNoHousing || city_inform[ciid].populationCanImmigrate <= 0 ) { fun_drawGameText(55, 24, dialog_x + 75, dialog_y + 378, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText(55, 19, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); } else { if ( city_inform[ciid].immigrationPercentageBasedOnHappiness < 80 ) { // people are leaving fun_drawGameText(55, 25, dialog_x + 75, dialog_y + 378, graphic_font + 268, 0); text_xoffset = 0; if ( !city_inform[ciid].immigrationState ) fun_drawGameText(55, 20, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 1 ) fun_drawGameText(55, 21, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 2 ) fun_drawGameText(55, 22, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 3 ) fun_drawGameText(55, 23, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 4 ) fun_drawGameText(55, 31, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].immigrationState == 5 ) fun_drawGameText(55, 32, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); } else { // people are coming fun_drawGameText(55, 24, dialog_x + 75, dialog_y + 378, graphic_font + 268, 0); text_xoffset = 0; drawNumber( city_inform[ciid].newcomersThisMonth, 64, " ", dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); if ( city_inform[ciid].newcomersThisMonth == 1 ) fun_drawGameText(55, 18, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); else fun_drawGameText(55, 17, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); } } } else { fun_drawGameText(55, 24, dialog_x + 75, dialog_y + 378, graphic_font + 268, 0); text_xoffset = 0; drawNumber( city_inform[ciid].newcomersThisMonth, 64, " ", dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); fun_drawGameText(55, 17, dialog_x + text_xoffset + 75, dialog_y + 396, graphic_font + 268, 0); } } } else { fun_drawRect( 16 * v0 + dialog_x, dialog_y + 8 * v0, 16 * (advisor_dialog_width - 2 * v0), 16 * (advisor_dialog_height - 2 * v0), 0); } } } void fun_drawPopulationAdvisorButtons() { if ( mouseover_button_id != dword_5FFFD8 ) { if ( mouseover_button_id ) { if ( mouseover_button_id == 1 ) { dword_5FFFD8 = 1; fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 60, 106, 57, 1); fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 160, 106, 57, 0); } else { if ( mouseover_button_id == 2 ) { dword_5FFFD8 = 2; fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 60, 106, 57, 0); fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 160, 106, 57, 1); } } } else { dword_5FFFD8 = 0; fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 60, 106, 57, 0); fun_drawBorderedButton(0, dialog_x + 501, dialog_y + 160, 106, 57, 0); } } } // 5FFFD8: using guessed type int dword_5FFFD8; // 9D7B28: using guessed type int mouseover_button_id; //----- (00514350) -------------------------------------------------------- void fun_drawPopulationHistoryGraph(int isBig, int x, int y) { int maxMonths; // [sp+4Ch] [bp-10h]@2 signed int maxValue; // [sp+50h] [bp-Ch]@14 int value; // [sp+54h] [bp-8h]@16 signed int v6; // [sp+54h] [bp-8h]@25 int v7; // [sp+54h] [bp-8h]@26 int v8; // [sp+54h] [bp-8h]@44 int month; // [sp+58h] [bp-4h]@14 int i; // [sp+58h] [bp-4h]@22 int j; // [sp+58h] [bp-4h]@41 if ( city_inform[ciid].monthsSinceStart[0] > 20 ) { if ( city_inform[ciid].monthsSinceStart[0] > 40 ) { if ( city_inform[ciid].monthsSinceStart[0] > 100 ) { if ( city_inform[ciid].monthsSinceStart[0] > 200 ) maxMonths = 400; else maxMonths = 200; } else { maxMonths = 100; } } else { maxMonths = 40; } } else { maxMonths = 20; } if ( !isBig ) { if ( maxMonths > 40 ) maxMonths = 100; else maxMonths = 20; } month = 0; maxValue = 0; while ( month < maxMonths ) { value = fun_getPopulationAtMonth(maxMonths, month); if ( value > maxValue ) maxValue = value; ++month; } fun_setPopulationGraphYAxisMax(maxValue); if ( isBig ) { fun_drawNumberCentered(populationgraph_y_maxvalue, 64, " ", x - 66, y - 3, 60, graphic_font + 938, 0); fun_drawNumberCentered(populationgraph_y_maxvalue / 2, 64, " ", x - 66, y + 96, 60, graphic_font + 938, 0); fun_drawNumberCentered(0, 64, " ", x - 66, y + 196, 60, graphic_font + 938, 0); fun_drawPopulationHistoryGraph_determineMinMaxMonthYear(maxMonths); text_xoffset = 0; fun_drawGameText(25, drawPopHistoryGraph_startMonth, x + text_xoffset - 20, y + 210, graphic_font + 938, 0); fun_drawGameYearWithBcAd(0, drawPopHistoryGraph_startYear, x + text_xoffset - 20, y + 210, graphic_font + 938, 0); text_xoffset = 0; fun_drawGameText(25, drawPopHistoryGraph_endMonth, x + text_xoffset + 380, y + 210, graphic_font + 938, 0); fun_drawGameYearWithBcAd(0, drawPopHistoryGraph_endYear, x + text_xoffset + 380, y + 210, graphic_font + 938, 0); } if ( isBig ) { draw_clip_yEnd = y + 200; for ( i = 0; i < maxMonths; ++i ) { v6 = fun_getPopulationAtMonth(maxMonths, i); if ( populationgraph_y_valueshift == -1 ) v7 = 2 * v6; else v7 = v6 >> populationgraph_y_valueshift; if ( v7 > 0 ) { switch ( maxMonths ) { case 20: drawGraphic(graphic_graphBar, 20 * i + x, y + 200 - v7); break; case 40: drawGraphic(graphic_graphBar + 1, 10 * i + x, y + 200 - v7); break; case 100: drawGraphic(graphic_graphBar + 2, x + 4 * i, y + 200 - v7); break; case 200: drawGraphic(graphic_graphBar + 3, x + 2 * i, y + 200 - v7); break; default: fun_drawLine(i + x, y + 200 - v7, i + x, y + 199, 0xF800u); break; } } } draw_clip_yEnd = screen_height; } else { populationgraph_y_valueshift += 2; for ( j = 0; j < maxMonths; ++j ) { v8 = fun_getPopulationAtMonth(maxMonths, j) >> populationgraph_y_valueshift; if ( v8 > 0 ) { if ( maxMonths == 20 ) fun_fillRect(5 * j + x, y + 50 - v8, 4, v8 + 1, 0xF800u); else fun_drawLine(j + x, y + 50 - v8, j + x, y + 50, 0xF800u); } } } } void fun_drawPopulationCensusGraph(int isBig, int x, int y) { signed int maxValue; // [sp+4Ch] [bp-Ch]@1 signed int v4; // [sp+50h] [bp-8h]@14 int v5; // [sp+50h] [bp-8h]@15 int v6; // [sp+50h] [bp-8h]@24 signed int v7; // [sp+54h] [bp-4h]@1 signed int i; // [sp+54h] [bp-4h]@7 signed int j; // [sp+54h] [bp-4h]@11 signed int k; // [sp+54h] [bp-4h]@21 v7 = 0; maxValue = 0; while ( v7 < 100 ) { if( city_inform[ciid].censusGraph[v7] > maxValue ) maxValue = city_inform[ciid].censusGraph[v7]; ++v7; } fun_setPopulationGraphYAxisMax(maxValue); if ( isBig ) { fun_drawNumberCentered(populationgraph_y_maxvalue, 64, " ", x - 66, y - 3, 60, graphic_font + 938, 0); fun_drawNumberCentered(populationgraph_y_maxvalue / 2, 64, " ", x - 66, y + 96, 60, graphic_font + 938, 0); fun_drawNumberCentered(0, 64, " ", x - 66, y + 196, 60, graphic_font + 938, 0); for ( i = 0; i <= 10; ++i ) fun_drawNumberCentered(10 * i, 64, " ", x + 40 * i - 22, y + 210, 40, graphic_font + 938, 0); } if ( isBig ) { draw_clip_yEnd = y + 200; for ( j = 0; j < 100; ++j ) { v4 = city_inform[ciid].censusGraph[j]; if ( populationgraph_y_valueshift == -1 ) v5 = 2 * v4; else v5 = v4 >> populationgraph_y_valueshift; if ( v5 > 0 ) drawGraphic(graphic_graphBar + 2, x + 4 * j, y + 200 - v5); } draw_clip_yEnd = screen_height; } else { populationgraph_y_valueshift += 2; for ( k = 0; k < 100; ++k ) { v6 = city_inform[ciid].censusGraph[k] >> populationgraph_y_valueshift; if ( v6 > 0 ) fun_drawLine(k + x, y + 50 - v6, k + x, y + 50, 0xF800u); } } } void fun_drawPopulationSocietyGraph(int isBig, int x, int y) { signed int maxValue; // [sp+4Ch] [bp-Ch]@1 signed int v4; // [sp+50h] [bp-8h]@12 int v5; // [sp+50h] [bp-8h]@13 int v6; // [sp+50h] [bp-8h]@22 signed int type; // [sp+54h] [bp-4h]@1 signed int i; // [sp+54h] [bp-4h]@9 signed int j; // [sp+54h] [bp-4h]@19 type = 0; maxValue = 0; while ( type < 20 ) { if ( city_inform[ciid].societyGraph[type] > maxValue ) maxValue = city_inform[ciid].societyGraph[type]; ++type; } fun_setPopulationGraphYAxisMax(maxValue); if ( isBig ) { fun_drawNumberCentered(populationgraph_y_maxvalue, 64, " ", x - 66, y - 3, 60, graphic_font + 938, 0); fun_drawNumberCentered(populationgraph_y_maxvalue / 2, 64, " ", x - 66, y + 96, 60, graphic_font + 938, 0); fun_drawNumberCentered(0, 64, " ", x - 66, y + 196, 60, graphic_font + 938, 0); fun_drawGameTextCentered(55, 9, x - 80, y + 210, 200, graphic_font + 938, 0); fun_drawGameTextCentered(55, 10, x + 280, y + 210, 200, graphic_font + 938, 0); } if ( isBig ) { draw_clip_yEnd = y + 200; for ( i = 0; i < 20; ++i ) { v4 = city_inform[ciid].societyGraph[i]; if ( populationgraph_y_valueshift == -1 ) v5 = 2 * v4; else v5 = v4 >> populationgraph_y_valueshift; if ( v5 > 0 ) drawGraphic(graphic_graphBar, 20 * i + x, y + 200 - v5); } draw_clip_yEnd = screen_height; } else { populationgraph_y_valueshift += 2; for ( j = 0; j < 20; ++j ) { v6 = city_inform[ciid].societyGraph[j] >> populationgraph_y_valueshift; if ( v6 > 0 ) fun_fillRect(5 * j + x, y + 50 - v6, 4, v6 + 1, 0xF800u); } } } void fun_setPopulationGraphYAxisMax(signed int maxValue) { if ( maxValue > 100 ) { if ( maxValue > 200 ) { if ( maxValue > 400 ) { if ( maxValue > 800 ) { if ( maxValue > 1600 ) { if ( maxValue > 3200 ) { if ( maxValue > 6400 ) { if ( maxValue > 12800 ) { if ( maxValue > 25600 ) { populationgraph_y_maxvalue = 51200; populationgraph_y_valueshift = 8; } else { populationgraph_y_maxvalue = 25600; populationgraph_y_valueshift = 7; } } else { populationgraph_y_maxvalue = 12800; populationgraph_y_valueshift = 6; } } else { populationgraph_y_maxvalue = 6400; populationgraph_y_valueshift = 5; } } else { populationgraph_y_maxvalue = 3200; populationgraph_y_valueshift = 4; } } else { populationgraph_y_maxvalue = 1600; populationgraph_y_valueshift = 3; } } else { populationgraph_y_maxvalue = 800; populationgraph_y_valueshift = 2; } } else { populationgraph_y_maxvalue = 400; populationgraph_y_valueshift = 1; } } else { populationgraph_y_maxvalue = 200; populationgraph_y_valueshift = 0; } } else { populationgraph_y_maxvalue = 100; populationgraph_y_valueshift = -1; } } // 6086F4: using guessed type int populationgraph_y_valueshift; //----- (005151E0) -------------------------------------------------------- void fun_drawHealthAdvisor() { signed int v0; // [sp+4Ch] [bp-8h]@15 int v1; // [sp+50h] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 18; v1 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v1 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 6, dialog_x + 10, dialog_y + 10); fun_drawGameText(56, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); if ( city_inform[ciid].population >= 200 ) fun_drawGameTextWrapped( 56, city_inform[ciid].healthRate / 10 + 16, dialog_x + 60, dialog_y + 46, 512, graphic_font + 134, 0); else fun_drawGameTextWrapped(56, 15, dialog_x + 60, dialog_y + 46, 512, graphic_font + 134, 0); fun_drawGameText(56, 3, dialog_x + 180, dialog_y + 94, graphic_font + 938, 0); fun_drawGameText(56, 4, dialog_x + 290, dialog_y + 94, graphic_font + 938, 0); fun_drawGameText(56, 5, dialog_x + 478, dialog_y + 94, graphic_font + 938, 0); fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 108, 36, 5); fun_drawNumberSingularPlural(8, 24, numBathhouses, dialog_x + 40, dialog_y + 112, graphic_font + 1072, 0); fun_drawNumberCentered( numWorkingBathhouses, 64, " ", dialog_x + 150, dialog_y + 112, 100, graphic_font + 1072, 0); fun_drawGameText(56, 2, dialog_x + 300, dialog_y + 112, graphic_font + 1072, 0); fun_drawGameText(56, 2, dialog_x + 504, dialog_y + 112, graphic_font + 1072, 0); fun_drawNumberSingularPlural(8, 26, numBarbers, dialog_x + 40, dialog_y + 132, graphic_font + 1072, 0); fun_drawNumberCentered(numWorkingBarbers, 64, " ", dialog_x + 150, dialog_y + 132, 100, graphic_font + 1072, 0); fun_drawGameText(56, 2, dialog_x + 300, dialog_y + 132, graphic_font + 1072, 0); fun_drawGameText(56, 2, dialog_x + 504, dialog_y + 132, graphic_font + 1072, 0); fun_drawNumberSingularPlural(8, 28, numClinics, dialog_x + 40, dialog_y + 152, graphic_font + 1072, 0); fun_drawNumberCentered(numWorkingClinics, 64, " ", dialog_x + 150, dialog_y + 152, 100, graphic_font + 1072, 0); fun_drawGameText(56, 2, dialog_x + 300, dialog_y + 152, graphic_font + 1072, 0); fun_drawGameText(56, 2, dialog_x + 504, dialog_y + 152, graphic_font + 1072, 0); fun_drawNumberSingularPlural(8, 30, numHospitals, dialog_x + 40, dialog_y + 172, graphic_font + 1072, 0); fun_drawNumberCentered( numWorkingHospitals, 64, " ", dialog_x + 150, dialog_y + 172, 100, graphic_font + 1072, 0); text_xoffset = 0; drawNumber(1000 * numWorkingHospitals, 64, " ", dialog_x + 280, dialog_y + 172, graphic_font + 1072, 0); fun_drawGameText(56, 6, dialog_x + text_xoffset + 280, dialog_y + 172, graphic_font + 1072, 0); if ( pctHospitalCoverage ) { if ( pctHospitalCoverage < 100 ) fun_drawGameTextCentered( 57, pctHospitalCoverage / 10 + 11, dialog_x + 420, dialog_y + 172, 200, graphic_font + 1072, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 420, dialog_y + 172, 200, graphic_font + 1072, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 420, dialog_y + 172, 200, graphic_font + 1072, 0); } switch ( city_inform[ciid].healthDemand ) { case 1: if ( city_inform[ciid].serviceBathhouseRequired ) v0 = 1; else v0 = 0; break; case 2: if ( city_inform[ciid].serviceBarberRequired ) v0 = 3; else v0 = 2; break; case 3: if ( city_inform[ciid].serviceClinicRequired ) v0 = 5; else v0 = 4; break; case 4: v0 = 6; break; default: v0 = 7; break; } fun_drawGameTextWrapped(56, v0 + 7, dialog_x + 60, dialog_y + 194, 512, graphic_font + 134, 0); } else { fun_drawRect( 16 * v1 + dialog_x, dialog_y + 8 * v1, 16 * (advisor_dialog_width - 2 * v1), 16 * (advisor_dialog_height - 2 * v1), 0); } } } // 608758: using guessed type int advisor_ifSomething; // 6500B8: using guessed type int cityinfo_healthRate[]; // 6500C4: using guessed type int cityinfo_population[]; // 6542A8: using guessed type int cityinfo_serviceBarberRequired[]; // 6542AC: using guessed type int cityinfo_serviceBathhouseRequired[]; // 6542B0: using guessed type int cityinfo_serviceClinicRequired[]; // 654344: using guessed type int cityinfo_healthDemand[]; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB0: using guessed type __int16 graphic_advisorIcons; // 7E2724: using guessed type int text_xoffset; // 98A5A0: using guessed type int pctHospitalCoverage; //----- (00515BE0) -------------------------------------------------------- void fun_drawEducationAdvisor() { signed int v0; // [sp+4Ch] [bp-8h]@22 int v1; // [sp+50h] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 16; v1 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v1 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 7, dialog_x + 10, dialog_y + 10); fun_drawGameText(57, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); text_xoffset = 0; drawNumber(city_inform[ciid].population, 64," ", dialog_x + 60, dialog_y + 50, graphic_font + 134, 0); fun_drawGameText(57, 1, dialog_x + text_xoffset + 60, dialog_y + 50, graphic_font + 134, 0); drawNumber( city_inform[ciid].schoolAgeChildren, 64, " ", dialog_x + text_xoffset + 60, dialog_y + 50, graphic_font + 134, 0); fun_drawGameText(57, 2, dialog_x + text_xoffset + 60, dialog_y + 50, graphic_font + 134, 0); drawNumber( city_inform[ciid].academyAgeChildren, 64, " ", dialog_x + text_xoffset + 60, dialog_y + 50, graphic_font + 134, 0); fun_drawGameText(57, 3, dialog_x + text_xoffset + 60, dialog_y + 50, graphic_font + 134, 0); fun_drawGameText(57, 4, dialog_x + 180, dialog_y + 86, graphic_font + 938, 0); fun_drawGameText(57, 5, dialog_x + 290, dialog_y + 86, graphic_font + 938, 0); fun_drawGameText(57, 6, dialog_x + 478, dialog_y + 86, graphic_font + 938, 0); fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 100, 36, 4); fun_drawNumberSingularPlural(8, 18, numSchools, dialog_x + 40, dialog_y + 105, graphic_font + 268, 0); fun_drawNumberCentered(numWorkingSchools, 64, " ", dialog_x + 150, dialog_y + 105, 100, graphic_font + 268, 0); text_xoffset = 0; drawNumber(75 * numWorkingSchools, 64, " ", dialog_x + 280, dialog_y + 105, graphic_font + 268, 0); fun_drawGameText(57, 7, dialog_x + text_xoffset + 280, dialog_y + 105, graphic_font + 268, 0); if ( pctSchoolCoverage ) { if ( pctSchoolCoverage < 100 ) fun_drawGameTextCentered( 57, pctSchoolCoverage / 10 + 11, dialog_x + 420, dialog_y + 105, 200, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 420, dialog_y + 105, 200, graphic_font + 268, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 420, dialog_y + 105, 200, graphic_font + 268, 0); } fun_drawNumberSingularPlural(8, 20, numAcademies, dialog_x + 40, dialog_y + 125, graphic_font + 268, 0); fun_drawNumberCentered( numWorkingAcademies, 64, " ", dialog_x + 150, dialog_y + 125, 100, graphic_font + 268, 0); text_xoffset = 0; drawNumber(100 * numWorkingAcademies, 64, " ", dialog_x + 280, dialog_y + 125, graphic_font + 268, 0); fun_drawGameText(57, 8, dialog_x + text_xoffset + 280, dialog_y + 125, graphic_font + 268, 0); if ( pctAcademyCoverage ) { if ( pctAcademyCoverage < 100 ) fun_drawGameTextCentered( 57, pctAcademyCoverage / 10 + 11, dialog_x + 420, dialog_y + 125, 200, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 420, dialog_y + 125, 200, graphic_font + 268, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 420, dialog_y + 125, 200, graphic_font + 268, 0); } fun_drawNumberSingularPlural(8, 22, numLibraries, dialog_x + 40, dialog_y + 145, graphic_font + 268, 0); fun_drawNumberCentered( numWorkingLibraries, 64, " ", dialog_x + 150, dialog_y + 145, 100, graphic_font + 268, 0); text_xoffset = 0; drawNumber(800 * numWorkingLibraries, 64, " ", dialog_x + 280, dialog_y + 145, graphic_font + 268, 0); fun_drawGameText(57, 9, dialog_x + text_xoffset + 280, dialog_y + 145, graphic_font + 268, 0); if ( pctLibraryCoverage ) { if ( pctLibraryCoverage < 100 ) fun_drawGameTextCentered( 57, pctLibraryCoverage / 10 + 11, dialog_x + 420, dialog_y + 145, 200, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 420, dialog_y + 145, 200, graphic_font + 268, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 420, dialog_y + 145, 200, graphic_font + 268, 0); } switch ( city_inform[ciid].educationDemand ) { case 1: if ( city_inform[ciid].serviceSchoolRequired ) v0 = 1; else v0 = 0; break; case 2: if ( city_inform[ciid].serviceLibraryRequired ) v0 = 3; else v0 = 2; break; case 3: v0 = 4; break; default: if ( city_inform[ciid].serviceSchoolRequired ) { if ( city_inform[ciid].serviceLibraryRequired ) { if ( pctSchoolCoverage < 100 || pctAcademyCoverage < 100 || pctLibraryCoverage < 100 ) { if ( pctSchoolCoverage > pctAcademyCoverage || pctSchoolCoverage > pctLibraryCoverage ) { if ( pctAcademyCoverage > pctSchoolCoverage || pctAcademyCoverage > pctLibraryCoverage ) { if ( pctLibraryCoverage > pctAcademyCoverage || pctLibraryCoverage > pctSchoolCoverage ) v0 = 6; else v0 = 9; } else { v0 = 8; } } else { v0 = 7; } } else { v0 = 6; } } else { if ( pctSchoolCoverage < 100 || pctAcademyCoverage < 100 ) { if ( pctSchoolCoverage > pctAcademyCoverage ) { if ( pctAcademyCoverage >= pctSchoolCoverage ) v0 = 6; else v0 = 8; } else { v0 = 7; } } else { v0 = 6; } } } else { v0 = 5; } break; } fun_drawGameTextWrapped(57, v0 + 22, dialog_x + 60, dialog_y + 180, 512, graphic_font + 134, 0); } else { fun_drawRect( 16 * v1 + dialog_x, dialog_y + 8 * v1, 16 * (advisor_dialog_width - 2 * v1), 16 * (advisor_dialog_height - 2 * v1), 0); } } } void fun_drawEntertainmentAdvisor() { signed int textNumber; // [sp+4Ch] [bp-8h]@40 int v1; // [sp+50h] [bp-4h]@1 fun_calculateGodHappiness(0); gatherEntertainmentInfo(); dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 23; v1 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v1 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 8, dialog_x + 10, dialog_y + 10); fun_drawGameText(58, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawGameText(58, 1, dialog_x + 180, dialog_y + 46, graphic_font + 938, 0); fun_drawGameText(58, 2, dialog_x + 260, dialog_y + 46, graphic_font + 938, 0); fun_drawGameText(58, 3, dialog_x + 340, dialog_y + 46, graphic_font + 938, 0); fun_drawGameText(58, 4, dialog_x + 480, dialog_y + 46, graphic_font + 938, 0); fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 60, 36, 5); fun_drawNumberSingularPlural(8, 34, numTheaters, dialog_x + 40, dialog_y + 64, graphic_font + 268, 0); fun_drawNumberCentered(numWorkingTheaters, 64, " ", dialog_x + 150, dialog_y + 64, 100, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].theaterShows, 64, " ", dialog_x + 230, dialog_y + 64, 100, graphic_font + 268, 0); text_xoffset = 0; drawNumber(500 * numWorkingTheaters, 64, " ", dialog_x + 340, dialog_y + 64, graphic_font + 268, 0); fun_drawGameText(58, 5, dialog_x + text_xoffset + 340, dialog_y + 64, graphic_font + 268, 0); if ( pctTheaterCoverage ) { if ( pctTheaterCoverage < 100 ) fun_drawGameTextCentered( 57, pctTheaterCoverage / 10 + 11, dialog_x + 470, dialog_y + 64, 100, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 470, dialog_y + 64, 100, graphic_font + 268, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 470, dialog_y + 64, 100, graphic_font + 268, 0); } fun_drawNumberSingularPlural(8, 36, numAmphitheaters, dialog_x + 40, dialog_y + 84, graphic_font + 268, 0); fun_drawNumberCentered( numWorkingAmphitheaters, 64, " ", dialog_x + 150, dialog_y + 84, 100, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].amphitheaterShows, 64, " ", dialog_x + 230, dialog_y + 84, 100, graphic_font + 268, 0); text_xoffset = 0; drawNumber(800 * numWorkingAmphitheaters, 64, " ", dialog_x + 340, dialog_y + 84, graphic_font + 268, 0); fun_drawGameText(58, 5, dialog_x + text_xoffset + 340, dialog_y + 84, graphic_font + 268, 0); if ( pctAmphitheaterCoverage ) { if ( pctAmphitheaterCoverage < 100 ) fun_drawGameTextCentered( 57, pctAmphitheaterCoverage / 10 + 11, dialog_x + 470, dialog_y + 84, 100, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 470, dialog_y + 84, 100, graphic_font + 268, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 470, dialog_y + 84, 100, graphic_font + 268, 0); } fun_drawNumberSingularPlural(8, 38, numColosseums, dialog_x + 40, dialog_y + 104, graphic_font + 268, 0); fun_drawNumberCentered( numWorkingColosseums, 64, " ", dialog_x + 150, dialog_y + 104, 100, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].colosseumShows, 64, " ", dialog_x + 230, dialog_y + 104, 100, graphic_font + 268, 0); text_xoffset = 0; drawNumber(1500 * numWorkingColosseums, 64, " ", dialog_x + 340, dialog_y + 104, graphic_font + 268, 0); fun_drawGameText(58, 5, dialog_x + text_xoffset + 340, dialog_y + 104, graphic_font + 268, 0); if ( pctColosseumCoverage ) { if ( pctColosseumCoverage < 100 ) fun_drawGameTextCentered( 57, pctColosseumCoverage / 10 + 11, dialog_x + 470, dialog_y + 104, 100, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 21, dialog_x + 470, dialog_y + 104, 100, graphic_font + 268, 0); } else { fun_drawGameTextCentered(57, 10, dialog_x + 470, dialog_y + 104, 100, graphic_font + 268, 0); } fun_drawNumberSingularPlural(8, 40, numHippodromes, dialog_x + 40, dialog_y + 123, graphic_font + 268, 0); fun_drawNumberCentered( numWorkingHippodromes, 64, " ", dialog_x + 150, dialog_y + 123, 100, graphic_font + 268, 0); fun_drawNumberCentered(city_inform[ciid].hippodromeShows,64," ",dialog_x + 230,dialog_y + 123, 100,graphic_font + 268,0); text_xoffset = 0; fun_drawGameText(58, 6, dialog_x + text_xoffset + 360, dialog_y + 123, graphic_font + 268, 0); if ( pctHippodromeCoverage ) fun_drawGameTextCentered(57, 21, dialog_x + 470, dialog_y + 123, 100, graphic_font + 268, 0); else fun_drawGameTextCentered(57, 10, dialog_x + 470, dialog_y + 123, 100, graphic_font + 268, 0); if ( city_inform[ciid].evolveEntertainmentRequired <= city_inform[ciid].evolveMoreEntertainmentRequired ) { if ( city_inform[ciid].evolveMoreEntertainmentRequired ) { if ( city_inform[ciid].entertainmentNeedingShowsMost ) { switch ( city_inform[ciid].entertainmentNeedingShowsMost ) { case 1: textNumber = 4; break; case 2: textNumber = 5; break; case 3: textNumber = 6; break; case 4: textNumber = 7; break; } } else { textNumber = 2; } } else { if ( city_inform[ciid].entertainment_needsMet ) textNumber = 1; else textNumber = 0; } } else { textNumber = 3; } fun_drawGameTextWrapped(58, textNumber + 7, dialog_x + 60, dialog_y + 148, 512, graphic_font + 134, 0); fun_drawEntertainmentAdvisorFestivals(); } else { fun_drawRect( 16 * v1 + dialog_x, dialog_y + 8 * v1, 16 * (advisor_dialog_width - 2 * v1), 16 * (advisor_dialog_height - 2 * v1), 0); } } } void fun_drawEntertainmentAdvisorFestivals() { signed int v0; // [sp+4Ch] [bp-4h]@5 fun_drawSunkenTextBox(dialog_x + 48, dialog_y + 252, 34, 6); drawGraphic(graphic_panelwindows + 15, dialog_x + 460, dialog_y + 255); fun_drawGameText(58, 17, dialog_x + 52, dialog_y + 224, graphic_font + 670, 0); text_xoffset = 0; fun_drawNumberSingularPlural( 8, 4, city_inform[ciid].monthsSinceFestival, dialog_x + 112, dialog_y + 260, graphic_font + F_NormalWhite, 0); fun_drawGameText(58, 15, dialog_x + text_xoffset + 112, dialog_y + 260, graphic_font + 268, 0); fun_drawGameTextCentered(58, city_inform[ciid].plannedFestival_size ? 34 : 16, dialog_x + 102, dialog_y + 284, 300, graphic_font + 268, 0); if ( city_inform[ciid].monthsSinceFestival > 1 ) { if ( city_inform[ciid].monthsSinceFestival > 6 ) { if ( city_inform[ciid].monthsSinceFestival > 12 ) { if ( city_inform[ciid].monthsSinceFestival > 18 ) { if ( city_inform[ciid].monthsSinceFestival > 24 ) { if ( city_inform[ciid].monthsSinceFestival > 30 ) v0 = 6; else v0 = 5; } else { v0 = 4; } } else { v0 = 3; } } else { v0 = 2; } } else { v0 = 1; } } else { v0 = 0; } fun_drawGameTextWrapped(58, v0 + 18, dialog_x + 56, dialog_y + 305, 380, graphic_font + 268, 0); fun_drawEntertainmentAdvisorHoldFestivalButton(); } void fun_drawEntertainmentAdvisorHoldFestivalButton() { int v0; // [sp+4Ch] [bp-4h]@6 if ( advisor_ifSomething > 5 ) { if ( !city_inform[ciid].plannedFestival_size ) { v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, dialog_x + 102, dialog_y + 280, 300, 20, v0); } } } void fun_drawDialogHoldFestival() { signed int i; // [sp+4Ch] [bp-4h]@1 fun_drawDialogBackground(dialog_x + 48, dialog_y + 48, 34, 20); fun_drawGameTextCentered( 58, city_inform[ciid].festivalGod + 25, dialog_x + 48, dialog_y + 60, 544, graphic_font + 670, 0); for ( i = 0; i < 5; ++i ) { if ( i == city_inform[ciid].festivalGod ) { fun_drawBorderedButton(1, dialog_x + 100 * i + 66, dialog_y + 92, 90, 100, 1); drawGraphic(graphic_panelwindows + i + 21, dialog_x + 100 * i + 70, dialog_y + 96); } else { drawGraphic(graphic_panelwindows + i + 16, dialog_x + 100 * i + 70, dialog_y + 96); } } fun_drawDialogHoldFestivalButtons(); text_xoffset = 0; fun_drawGameText(58, city_inform[ciid].festivalSize + 30, dialog_x + 180, dialog_y + 322, graphic_font + 134, 0); } void fun_drawDialogHoldFestivalButtons() { int v0; // ST68_4@10 int v1; // ST68_4@10 int v2; // [sp+50h] [bp-4h]@2 int v3; // [sp+50h] [bp-4h]@5 int v4; // [sp+50h] [bp-4h]@8 v2 = mouseover_button_id == 6; fun_drawBorderedButton(1, dialog_x + 102, dialog_y + 216, 430, 26, v2); text_xoffset = 0; fun_drawGameText(58, 31, dialog_x + 110, dialog_y + 224, graphic_font + F_NormalBlack, 0); fun_drawNumberSingularPlural( 8, 0, city_inform[ciid].smallFestivalCost, dialog_x + text_xoffset + 110, dialog_y + 224, graphic_font + F_NormalBlack, 0); v3 = mouseover_button_id == 7; fun_drawBorderedButton(1, dialog_x + 102, dialog_y + 246, 430, 26, v3); text_xoffset = 0; fun_drawGameText(58, 32, dialog_x + 110, dialog_y + 254, graphic_font + F_NormalBlack, 0); fun_drawNumberSingularPlural( 8, 0, city_inform[ciid].largeFestivalCost, dialog_x + text_xoffset + 110, dialog_y + 254, graphic_font + F_NormalBlack, 0); v4 = mouseover_button_id == 8; fun_drawBorderedButton(1, dialog_x + 102, dialog_y + 276, 430, 26, v4); text_xoffset = 0; fun_drawGameText(58, 33, dialog_x + 110, dialog_y + 284, graphic_font + F_NormalBlack, 0); v0 = text_xoffset; fun_drawNumberSingularPlural( 8, 0, city_inform[ciid].grandFestivalCost, dialog_x + text_xoffset + 110, dialog_y + 284, graphic_font + F_NormalBlack, 0); text_xoffset += v0; v1 = text_xoffset; fun_drawNumberSingularPlural(8,10,city_inform[ciid].grandFestivalWine,dialog_x + text_xoffset + 120, dialog_y + 284,graphic_font + F_NormalBlack,0); text_xoffset += v1; drawGraphic(graphic_resourceIcons + 7, dialog_x + text_xoffset + 120, dialog_y + 279); if ( city_inform[ciid].treasury > -5000 ) { if ( city_inform[ciid].grandFestivalWineUnavailable ) fun_greyRectangle(dialog_x + 104, dialog_y + 278, 426, 22, 0); } else { fun_greyRectangle(dialog_x + 104, dialog_y + 218, 426, 22, 0); fun_greyRectangle(dialog_x + 104, dialog_y + 248, 426, 22, 0); fun_greyRectangle(dialog_x + 104, dialog_y + 278, 426, 22, 0); } } void fun_drawReligionAdvisor() { signed int v0; // [sp+4Ch] [bp-Ch]@25 int v1; // [sp+50h] [bp-8h]@4 int i; // [sp+54h] [bp-4h]@10 int j; // [sp+54h] [bp-4h]@13 int k; // [sp+54h] [bp-4h]@16 int l; // [sp+54h] [bp-4h]@19 int m; // [sp+54h] [bp-4h]@22 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; if ( setting_godsOn ) advisor_dialog_height = 17; else advisor_dialog_height = 20; advisor_dialog_width = 40; v1 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v1 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); if ( !setting_godsOn ) fun_drawGameTextWrapped( 59, 43, dialog_x + 60, dialog_y + 256, 16 * advisor_dialog_width - 120, graphic_font + 134, 0); drawGraphic(graphic_advisorIcons + 9, dialog_x + 10, dialog_y + 10); fun_drawGameText(59, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawGameText(59, 5, dialog_x + 270, dialog_y + 32, graphic_font + 938, 0); fun_drawGameText(59, 1, dialog_x + 240, dialog_y + 46, graphic_font + 938, 0); fun_drawGameText(59, 2, dialog_x + 300, dialog_y + 46, graphic_font + 938, 0); fun_drawGameText(59, 3, dialog_x + 450, dialog_y + 46, graphic_font + 938, 0); fun_drawGameText(59, 6, dialog_x + 370, dialog_y + 18, graphic_font + 938, 0); fun_drawGameText(59, 9, dialog_x + 370, dialog_y + 32, graphic_font + 938, 0); fun_drawGameText(59, 7, dialog_x + 370, dialog_y + 46, graphic_font + 938, 0); fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 60, 36, 8); fun_drawGameText(59, 11, dialog_x + 40, dialog_y + 66, graphic_font + 268, 0); fun_drawGameText(59, 16, dialog_x + 120, dialog_y + 67, graphic_font + 938, 0); fun_drawNumberCentered(numSmallTemplesCeres, 64, " ", dialog_x + 230, dialog_y + 66, 50, graphic_font + 268, 0); fun_drawNumberCentered(numLargeTemplesCeres, 64, " ", dialog_x + 290, dialog_y + 66, 50, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].monthsSinceFestivalCeres[0], 64, " ", dialog_x + 360, dialog_y + 66, 50, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText( 59, city_inform[ciid].happinessGod[0] / 10 + 32, dialog_x + 460, dialog_y + 66, graphic_font + 268, 0); for ( i = 0; i < city_inform[ciid].numBoltsGod[0] / 10; ++i ) drawGraphic(graphic_godBolt, 10 * i + dialog_x + text_xoffset + 460, dialog_y + 62); fun_drawGameText(59, 12, dialog_x + 40, dialog_y + 86, graphic_font + 268, 0); fun_drawGameText(59, 17, dialog_x + 120, dialog_y + 87, graphic_font + 938, 0); fun_drawNumberCentered( numSmallTemplesNeptune, 64, " ", dialog_x + 230, dialog_y + 86, 50, graphic_font + 268, 0); fun_drawNumberCentered( numLargeTemplesNeptune, 64, " ", dialog_x + 290, dialog_y + 86, 50, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].monthsSinceFestivalNeptune[0], 64, " ", dialog_x + 360, dialog_y + 86, 50, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText( 59, city_inform[ciid].happinessGod[1] / 10 + 32, dialog_x + 460, dialog_y + 86, graphic_font + 268, 0); for ( j = 0; j < city_inform[ciid].numBoltsGod[1] / 10; ++j ) drawGraphic(graphic_godBolt, 10 * j + dialog_x + text_xoffset + 460, dialog_y + 82); fun_drawGameText(59, 13, dialog_x + 40, dialog_y + 106, graphic_font + 268, 0); fun_drawGameText(59, 18, dialog_x + 120, dialog_y + 107, graphic_font + 938, 0); fun_drawNumberCentered( numSmallTemplesMercury, 64, " ", dialog_x + 230, dialog_y + 106, 50, graphic_font + 268, 0); fun_drawNumberCentered( numLargeTemplesMercury, 64, " ", dialog_x + 290, dialog_y + 106, 50, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].monthsSinceFestivalMercury[0], 64, " ", dialog_x + 360, dialog_y + 106, 50, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText( 59, city_inform[ciid].happinessGod[2]/ 10 + 32, dialog_x + 460, dialog_y + 106, graphic_font + 268, 0); for ( k = 0; k < city_inform[ciid].numBoltsGod[2] / 10; ++k ) drawGraphic(graphic_godBolt, 10 * k + dialog_x + text_xoffset + 460, dialog_y + 102); fun_drawGameText(59, 14, dialog_x + 40, dialog_y + 126, graphic_font + 268, 0); fun_drawGameText(59, 19, dialog_x + 120, dialog_y + 127, graphic_font + 938, 0); fun_drawNumberCentered(numSmallTemplesMars, 64, " ", dialog_x + 230, dialog_y + 126, 50, graphic_font + 268, 0); fun_drawNumberCentered(numLargeTemplesMars, 64, " ", dialog_x + 290, dialog_y + 126, 50, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].monthsSinceFestivalMars[0], 64, " ", dialog_x + 360, dialog_y + 126, 50, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText( 59, city_inform[ciid].happinessGod[3] / 10 + 32, dialog_x + 460, dialog_y + 126, graphic_font + 268, 0); for ( l = 0; l < city_inform[ciid].numBoltsGod[3] / 10; ++l ) drawGraphic(graphic_godBolt, 10 * l + dialog_x + text_xoffset + 460, dialog_y + 122); fun_drawGameText(59, 15, dialog_x + 40, dialog_y + 146, graphic_font + 268, 0); fun_drawGameText(59, 20, dialog_x + 120, dialog_y + 147, graphic_font + 938, 0); fun_drawNumberCentered( numSmallTemplesVenus, 64, " ", dialog_x + 230, dialog_y + 146, 50, graphic_font + 268, 0); fun_drawNumberCentered( numLargeTemplesVenus, 64, " ", dialog_x + 290, dialog_y + 146, 50, graphic_font + 268, 0); fun_drawNumberCentered( city_inform[ciid].monthsSinceFestivalVenus[0], 64, " ", dialog_x + 360, dialog_y + 146, 50, graphic_font + 268, 0); text_xoffset = 0; fun_drawGameText( 59, city_inform[ciid].happinessGod[4] / 10 + 32, dialog_x + 460, dialog_y + 146, graphic_font + 268, 0); for ( m = 0; m < city_inform[ciid].numBoltsGod[4] / 10; ++m ) drawGraphic(graphic_godBolt, 10 * m + dialog_x + text_xoffset + 460, dialog_y + 142); fun_drawGameText(59, 8, dialog_x + 40, dialog_y + 166, graphic_font + 268, 0); fun_drawNumberCentered(numOracles, 64, " ", dialog_x + 230, dialog_y + 166, 50, graphic_font + 268, 0); v0 = 0; fun_determineAngriestGod(); if ( city_inform[ciid].religionAngryGod <= 0 || city_inform[ciid].happinessGod[ city_inform[ciid].religionAngryGod ] <= 4 ) { switch ( city_inform[ciid].religionDemand ) { case 1: if ( city_inform[ciid].serviceReligionRequired ) v0 = 1; else v0 = 0; break; case 2: v0 = 2; break; case 3: v0 = 3; break; default: if ( city_inform[ciid].serviceReligionRequired ) { if ( city_inform[ciid].religionAngryGod ) { switch ( city_inform[ciid].religionAngryGod ) { case 1: v0 = 6; break; case 2: v0 = 7; break; case 3: v0 = 8; break; case 4: v0 = 9; break; case 5: v0 = 10; break; } } else { v0 = 5; } } else { v0 = 4; } break; } } else { switch ( city_inform[ciid].religionAngryGod ) { case 1: v0 = 6; break; case 2: v0 = 7; break; case 3: v0 = 8; break; case 4: v0 = 9; break; case 5: v0 = 10; break; } } fun_drawGameTextWrapped(59, v0 + 21, dialog_x + 60, dialog_y + 196, 512, graphic_font + 134, 0); } else { fun_drawRect( 16 * v1 + dialog_x, dialog_y + 8 * v1, 16 * (advisor_dialog_width - 2 * v1), 16 * (advisor_dialog_height - 2 * v1), 0); } } } void fun_drawFinancialAdvisor() { int v0; // [sp+4Ch] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 26; v0 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v0 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 10, dialog_x + 10, dialog_y + 10); fun_drawGameText(60, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawSunkenTextBox(dialog_x + 64, dialog_y + 48, 34, 4); fun_drawSunkenTextBoxBottomBorder(dialog_x + 64, dialog_y + 104, 34); text_xoffset = 0; if ( city_inform[ciid].treasury < 0 ) { fun_drawGameText(60, 3, dialog_x + text_xoffset + 70, dialog_y + 53, graphic_font + 402, 0); fun_drawNumberSingularPlural( 8, 0, -city_inform[ciid].treasury, dialog_x + text_xoffset + 72, dialog_y + 53, graphic_font + 402, 0); } else { fun_drawGameText(60, 2, dialog_x + text_xoffset + 70, dialog_y + 53, graphic_font + 268, 0); fun_drawNumberSingularPlural( 8, 0, city_inform[ciid].treasury, dialog_x + text_xoffset + 72, dialog_y + 53, graphic_font + 268, 0); } fun_drawGameText(60, 1, dialog_x + 70, dialog_y + 76, graphic_font + 268, 0); text_xoffset = 0; drawNumber(city_inform[ciid].taxrate, 64, "%", dialog_x + 240, dialog_y + 76, graphic_font + 268, 0); fun_drawGameText(60, 4, dialog_x + text_xoffset + 240, dialog_y + 76, graphic_font + 268, 0); fun_drawNumberSingularPlural( 8, 0, city_inform[ciid].estimatedTaxIncome, dialog_x + text_xoffset + 240, dialog_y + 76, graphic_font + 268, 0); text_xoffset = 0; drawNumber( city_inform[ciid].percentageRegisteredForTax, 64, "%", dialog_x + 70, dialog_y + 98, graphic_font + 268, 0); fun_drawGameText(60, 5, dialog_x + text_xoffset + 70, dialog_y + 98, graphic_font + 268, 0); fun_drawGameText(60, 6, dialog_x + 270, dialog_y + 133, graphic_font + 134, 0); fun_drawGameText(60, 7, dialog_x + 400, dialog_y + 133, graphic_font + 134, 0); fun_drawGameText(60, 8, dialog_x + 80, dialog_y + 155, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_taxes_lastyear, 64, " ", dialog_x + 290, dialog_y + 155, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_taxes_thisyear, 64, " ", dialog_x + 430, dialog_y + 155, graphic_font + 134, 0); fun_drawGameText(60, 9, dialog_x + 80, dialog_y + 170, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_exports_lastyear, 64, " ", dialog_x + 290, dialog_y + 170, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_exports_thisyear, 64, " ", dialog_x + 430, dialog_y + 170, graphic_font + 134, 0); fun_drawGameText(60, 20, dialog_x + 80, dialog_y + 185, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_donated_lastyear, 64, " ", dialog_x + 290, dialog_y + 185, graphic_font + 134, 0); drawNumber(city_inform[ciid].finance_donated_thisyear,64," ",dialog_x + 430,dialog_y + 185,graphic_font + 134,0); fun_drawLine(dialog_x + 280, dialog_y + 198, dialog_x + 350, dialog_y + 198, 0); fun_drawLine(dialog_x + 420, dialog_y + 198, dialog_x + 490, dialog_y + 198, 0); fun_drawGameText(60, 10, dialog_x + 80, dialog_y + 203, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_totalIncome_lastyear, 64, " ", dialog_x + 290, dialog_y + 203, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_totalIncome_thisyear, 64, " ", dialog_x + 430, dialog_y + 203, graphic_font + 134, 0); fun_drawGameText(60, 11, dialog_x + 80, dialog_y + 227, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_imports_lastyear, 64, " ", dialog_x + 290, dialog_y + 227, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_imports_thisyear, 64, " ", dialog_x + 430, dialog_y + 227, graphic_font + 134, 0); fun_drawGameText(60, 12, dialog_x + 80, dialog_y + 242, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_wages_lastyear, 64, " ", dialog_x + 290, dialog_y + 242, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_wages_thisyear, 64, " ", dialog_x + 430, dialog_y + 242, graphic_font + 134, 0); fun_drawGameText(60, 13, dialog_x + 80, dialog_y + 257, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_construction_lastyear, 64, " ", dialog_x + 290, dialog_y + 257, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_construction_thisyear, 64, " ", dialog_x + 430, dialog_y + 257, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(60, 14, dialog_x + 80, dialog_y + 272, graphic_font + 134, 0); drawNumber(10, 64, "%", dialog_x + text_xoffset + 80, dialog_y + 272, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_interest_lastyear, 64, " ", dialog_x + 290, dialog_y + 272, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_interest_thisyear, 64, " ", dialog_x + 430, dialog_y + 272, graphic_font + 134, 0); fun_drawGameText(60, 15, dialog_x + 80, dialog_y + 287, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_salary_lastyear, 64, " ", dialog_x + 290, dialog_y + 287, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_salary_thisyear, 64, " ", dialog_x + 430, dialog_y + 287, graphic_font + 134, 0); fun_drawGameText(60, 16, dialog_x + 80, dialog_y + 302, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_sundries_lastyear, 64, " ", dialog_x + 290, dialog_y + 302, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_sundries_thisyear, 64, " ", dialog_x + 430, dialog_y + 302, graphic_font + 134, 0); fun_drawGameText(60, 21, dialog_x + 80, dialog_y + 317, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_tribute_lastyear, 64, " ", dialog_x + 290, dialog_y + 317, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_tribute_thisyear, 64, " ", dialog_x + 430, dialog_y + 317, graphic_font + 134, 0); fun_drawLine(dialog_x + 280, dialog_y + 330, dialog_x + 350, dialog_y + 330, 0); fun_drawLine(dialog_x + 420, dialog_y + 330, dialog_x + 490, dialog_y + 330, 0); fun_drawGameText(60, 17, dialog_x + 80, dialog_y + 335, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_totalExpenses_lastyear, 64, " ", dialog_x + 290, dialog_y + 335, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_totalExpenses_thisyear, 64, " ", dialog_x + 430, dialog_y + 335, graphic_font + 134, 0); fun_drawGameText(60, 18, dialog_x + 80, dialog_y + 358, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_netInOut_lastyear, 64, " ", dialog_x + 290, dialog_y + 358, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_netInOut_thisyear, 64, " ", dialog_x + 430, dialog_y + 358, graphic_font + 134, 0); fun_drawGameText(60, 19, dialog_x + 80, dialog_y + 381, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_balance_lastyear, 64, " ", dialog_x + 290, dialog_y + 381, graphic_font + 134, 0); drawNumber( city_inform[ciid].finance_balance_thisyear, 64, " ", dialog_x + 430, dialog_y + 381, graphic_font + 134, 0); } else { fun_drawRect( 16 * v0 + dialog_x, dialog_y + 8 * v0, 16 * (advisor_dialog_width - 2 * v0), 16 * (advisor_dialog_height - 2 * v0), 0); } } } void fun_drawChiefAdvisor() { int v0; // edx@61 int v1; // [sp+4Ch] [bp-Ch]@86 int v2; // [sp+50h] [bp-8h]@46 int v3; // [sp+54h] [bp-4h]@1 dialog_x = screen_640x480_x; dialog_y = screen_640x480_y; advisor_dialog_width = 40; advisor_dialog_height = 23; v3 = 5 - advisor_ifSomething; if ( 5 - advisor_ifSomething < 5 ) { if ( v3 <= 0 ) { fun_drawDialogBackground(dialog_x, dialog_y, advisor_dialog_width, advisor_dialog_height); drawGraphic(graphic_advisorIcons + 11, dialog_x + 10, dialog_y + 10); fun_drawGameText(61, 0, dialog_x + 60, dialog_y + 12, graphic_font + 670, 0); fun_drawSunkenTextBox(dialog_x + 32, dialog_y + 60, 36, 16); drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 67); fun_drawGameText(61, 1, dialog_x + 60, dialog_y + 66, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].unemploymentPercentage <= 0 ) { if ( city_inform[ciid].numWorkersNeeded <= 0 ) { fun_drawGameText(61, 14, dialog_x + text_xoffset + 240, dialog_y + 66, graphic_font + 1072, 0); } else { fun_drawGameText(61, 13, dialog_x + text_xoffset + 240, dialog_y + 66, graphic_font + 402, 0); fun_drawNumberSingularPlural( 8, 12, city_inform[ciid].numWorkersNeeded, dialog_x + text_xoffset + 240, dialog_y + 66, graphic_font + 402, 0); } } else { fun_drawGameText(61, 12, dialog_x + text_xoffset + 240, dialog_y + 66, graphic_font + 402, 0); drawNumber( city_inform[ciid].unemploymentPercentage, 64, "%", dialog_x + text_xoffset + 240, dialog_y + 66, graphic_font + 402, 0); } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 87); fun_drawGameText(61, 2, dialog_x + 60, dialog_y + 86, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].treasury <= city_inform[ciid].finance_balance_lastyear ) { if ( city_inform[ciid].treasury >= city_inform[ciid].finance_balance_lastyear ) { fun_drawGameText(61, 17, dialog_x + text_xoffset + 240, dialog_y + 86, graphic_font + 1072, 0); } else { fun_drawGameText(61, 16, dialog_x + text_xoffset + 240, dialog_y + 86, graphic_font + 402, 0); drawNumber( city_inform[ciid].finance_balance_lastyear - city_inform[ciid].treasury, 64, "Dn", dialog_x + text_xoffset + 240, dialog_y + 86, graphic_font + 402, 0); } } else { fun_drawGameText(61, 15, dialog_x + text_xoffset + 240, dialog_y + 86, graphic_font + 1072, 0); drawNumber( city_inform[ciid].treasury - city_inform[ciid].finance_balance_lastyear, 64, "Dn", dialog_x + text_xoffset + 240, dialog_y + 86, graphic_font + 1072, 0); } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 107); fun_drawGameText(61, 3, dialog_x + 60, dialog_y + 106, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].relatedToImmigration_always0 ) { if ( city_inform[ciid].relatedToImmigration_always0 == 1 ) fun_drawGameText(61, 23, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 402, 0); else fun_drawGameText(61, 24, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); } else { if ( city_inform[ciid].enemyDestroyedBuildings + city_inform[ciid].imperialArmyComing <= 3 ) { if ( city_inform[ciid].newcomersThisMonth < 5 ) { if ( city_inform[ciid].wantedImmigrantsNoHousing || city_inform[ciid].populationCanImmigrate <= 0 ) { fun_drawGameText(61, 18, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 402, 0); } else { if ( city_inform[ciid].immigrationPercentageBasedOnHappiness < 80 ) { if ( !city_inform[ciid].immigrationState ) fun_drawGameText(61, 19, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); if ( city_inform[ciid].immigrationState == 1 ) fun_drawGameText(61, 20, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); if ( city_inform[ciid].immigrationState == 2 ) fun_drawGameText(61, 21, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); if ( city_inform[ciid].immigrationState == 3 ) fun_drawGameText(61, 22, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); if ( city_inform[ciid].immigrationState == 4 ) fun_drawGameText(61, 70, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); if ( city_inform[ciid].immigrationState == 5 ) fun_drawGameText(61, 71, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); } else { fun_drawGameText(61, 25, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); } } } else { fun_drawGameText(61, 25, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); } } else { fun_drawGameText(61, 79, dialog_x + text_xoffset + 240, dialog_y + 106, graphic_font + 1072, 0); } } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 127); fun_drawGameText(61, 4, dialog_x + 60, dialog_y + 126, graphic_font + 268, 0); text_xoffset = 0; if ( scn_romeSuppliesWheat ) { fun_drawGameText(61, 26, dialog_x + text_xoffset + 240, dialog_y + 126, graphic_font + 1072, 0); } else { if ( city_inform[ciid].foodSupplyMonths > 0 ) { fun_drawGameText(61, 28, dialog_x + text_xoffset + 240, dialog_y + 126, graphic_font + 1072, 0); fun_drawNumberSingularPlural( 8, 4, city_inform[ciid].foodSupplyMonths, dialog_x + text_xoffset + 240, dialog_y + 126, graphic_font + 1072, 0); } else { fun_drawGameText(61, 27, dialog_x + text_xoffset + 240, dialog_y + 126, graphic_font + 402, 0); } } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 147); fun_drawGameText(61, 62, dialog_x + 60, dialog_y + 146, graphic_font + 268, 0); text_xoffset = 0; v2 = getPercentage( city_inform[ciid].plebsFoodInCityLastYear, city_inform[ciid].dword_654500 ); if ( scn_romeSuppliesWheat ) { fun_drawGameText(61, 26, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 1072, 0); } else { if ( v2 <= 150 ) { if ( v2 <= 105 ) { if ( v2 <= 95 ) { if ( v2 <= 75 ) { if ( v2 <= 30 ) { if ( v2 <= 0 ) fun_drawGameText(61, 69, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 402, 0); else fun_drawGameText(61, 68, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 402, 0); } else { fun_drawGameText(61, 67, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 402, 0); } } else { fun_drawGameText(61, 66, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 402, 0); } } else { fun_drawGameText(61, 65, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 1072, 0); } } else { fun_drawGameText(61, 64, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 1072, 0); } } else { fun_drawGameText(61, 63, dialog_x + text_xoffset + 240, dialog_y + 146, graphic_font + 1072, 0); } } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 167); fun_drawGameText(61, 5, dialog_x + 60, dialog_y + 166, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].enemyDestroyedBuildings ) { fun_drawGameText(61, 76, dialog_x + 240, dialog_y + 166, graphic_font + 402, 0); } else { if ( city_inform[ciid].imperialArmyComing ) { fun_drawGameText(61, 75, dialog_x + 240, dialog_y + 166, graphic_font + 402, 0); } else { if ( sub_449C60(/*18068 * ciid, v0*/) ) { fun_drawGameText(61, 74, dialog_x + 240, dialog_y + 166, graphic_font + 402, 0); } else { if ( city_inform[ciid].byte_654584 <= 0 ) { if ( city_inform[ciid].byte_654585 <= 0 ) { if ( city_inform[ciid].byte_654583 <= 0 ) { if ( city_inform[ciid].dword_654598 >= 0 ) fun_drawGameText(61, 73, dialog_x + 240, dialog_y + 166, graphic_font + 1072, 0); else fun_drawGameText(61, 72, dialog_x + 240, dialog_y + 166, graphic_font + 1072, 0); } else { fun_drawGameText(61, 77, dialog_x + 240, dialog_y + 166, graphic_font + 402, 0); } } else { fun_drawGameText(61, 78, dialog_x + 240, dialog_y + 166, graphic_font + 1072, 0); } } else { fun_drawGameText(61, 78, dialog_x + 240, dialog_y + 166, graphic_font + 1072, 0); } } } } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 187); fun_drawGameText(61, 6, dialog_x + 60, dialog_y + 186, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].rioting ) { fun_drawGameText(61, 33, dialog_x + text_xoffset + 240, dialog_y + 186, graphic_font + 402, 0); } else { if ( city_inform[ciid].crimeRate <= 10 ) { if ( city_inform[ciid].crimeRate ) { fun_drawGameText(61, 31, dialog_x + text_xoffset + 240, dialog_y + 186, graphic_font + 402, 0); } else { if ( city_inform[ciid].dword_65433C ) fun_drawGameText(61, 30, dialog_x + text_xoffset + 240, dialog_y + 186, graphic_font + 402, 0); else fun_drawGameText(61, 29, dialog_x + text_xoffset + 240, dialog_y + 186, graphic_font + 1072, 0); } } else { fun_drawGameText(61, 32, dialog_x + text_xoffset + 240, dialog_y + 186, graphic_font + 402, 0); } } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 207); fun_drawGameText(61, 7, dialog_x + 60, dialog_y + 206, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].healthRate >= 40 ) v1 = graphic_font + 1072; else v1 = graphic_font + 402; fun_drawGameText( 56, city_inform[ciid].healthRate / 10 + 27, dialog_x + text_xoffset + 240, dialog_y + 206, v1, 0); drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 227); fun_drawGameText(61, 8, dialog_x + 60, dialog_y + 226, graphic_font + 268, 0); text_xoffset = 0; switch ( city_inform[ciid].educationDemand ) { case 1: fun_drawGameText(61, 39, dialog_x + text_xoffset + 240, dialog_y + 226, graphic_font + 402, 0); break; case 2: fun_drawGameText(61, 40, dialog_x + text_xoffset + 240, dialog_y + 226, graphic_font + 402, 0); break; case 3: fun_drawGameText(61, 41, dialog_x + text_xoffset + 240, dialog_y + 226, graphic_font + 402, 0); break; default: fun_drawGameText(61, 42, dialog_x + text_xoffset + 240, dialog_y + 226, graphic_font + 1072, 0); break; } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 247); fun_drawGameText(61, 9, dialog_x + 60, dialog_y + 246, graphic_font + 268, 0); text_xoffset = 0; switch ( city_inform[ciid].religionDemand ) { case 1: fun_drawGameText(61, 46, dialog_x + text_xoffset + 240, dialog_y + 246, graphic_font + 402, 0); break; case 2: fun_drawGameText(61, 47, dialog_x + text_xoffset + 240, dialog_y + 246, graphic_font + 402, 0); break; case 3: fun_drawGameText(61, 48, dialog_x + text_xoffset + 240, dialog_y + 246, graphic_font + 402, 0); break; default: fun_drawGameText(61, 49, dialog_x + text_xoffset + 240, dialog_y + 246, graphic_font + 1072, 0); break; } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 267); fun_drawGameText(61, 10, dialog_x + 60, dialog_y + 266, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].entertainmentDemand == 1 ) { fun_drawGameText(61, 43, dialog_x + text_xoffset + 240, dialog_y + 266, graphic_font + 402, 0); } else { if ( city_inform[ciid].entertainmentDemand == 2 ) fun_drawGameText(61, 44, dialog_x + text_xoffset + 240, dialog_y + 266, graphic_font + 402, 0); else fun_drawGameText(61, 45, dialog_x + text_xoffset + 240, dialog_y + 266, graphic_font + 1072, 0); } drawGraphic(graphic_bullet, dialog_x + 40, dialog_y + 287); fun_drawGameText(61, 11, dialog_x + 60, dialog_y + 286, graphic_font + 268, 0); text_xoffset = 0; if ( city_inform[ciid].hapinessCity > 0 ) { if ( city_inform[ciid].hapinessCity < 100 ) fun_drawGameText( 61, city_inform[ciid].hapinessCity / 10 + 51, dialog_x + text_xoffset + 240, dialog_y + 286, graphic_font + 1072, 0); else fun_drawGameText(61, 61, dialog_x + text_xoffset + 240, dialog_y + 286, graphic_font + 1072, 0); } else { fun_drawGameText(61, 50, dialog_x + text_xoffset + 240, dialog_y + 286, graphic_font + 402, 0); } } else { fun_drawRect( 16 * v3 + dialog_x, dialog_y + 8 * v3, 16 * (advisor_dialog_width - 2 * v3), 16 * (advisor_dialog_height - 2 * v3), 0); } } } void fun_drawEmpireInfoPanel() { fun_drawEmpireInfoPanelBackground(); fun_drawEmpireInfoPanelForeground(); } void empty_51C8D0() { ; } void fun_drawEmpireInfoPanelBackground() { int v0; // [sp+4Ch] [bp-14h]@7 int v1; // [sp+50h] [bp-10h]@7 int v2; // [sp+54h] [bp-Ch]@1 int v3; // [sp+54h] [bp-Ch]@4 int v4; // [sp+58h] [bp-8h]@1 int v5; // [sp+58h] [bp-8h]@4 int i; // [sp+5Ch] [bp-4h]@1 int j; // [sp+5Ch] [bp-4h]@4 int k; // [sp+5Ch] [bp-4h]@7 v4 = screen_width / 70; v2 = screen_width - 70; for ( i = 0; i < v4; ++i ) { drawGraphic(graphic_empirePanels + 3, 70 * i, screen_height - 120); drawGraphic(graphic_empirePanels + 3, 70 * i, screen_height - 80); drawGraphic(graphic_empirePanels + 3, 70 * i, screen_height - 40); } drawGraphic(graphic_empirePanels + 3, v2, screen_height - 120); drawGraphic(graphic_empirePanels + 3, v2, screen_height - 80); drawGraphic(graphic_empirePanels + 3, v2, screen_height - 40); v5 = screen_width / 86; v3 = screen_width - 86; for ( j = 0; j < v5; ++j ) { drawGraphic(graphic_empirePanels + 1, 86 * j, 0); drawGraphic(graphic_empirePanels + 1, 86 * j, screen_height - 120); drawGraphic(graphic_empirePanels + 1, 86 * j, screen_height - 16); } drawGraphic(graphic_empirePanels + 1, v3, 0); drawGraphic(graphic_empirePanels + 1, v3, screen_height - 120); drawGraphic(graphic_empirePanels + 1, v3, screen_height - 16); v1 = screen_height / 86; v0 = screen_height - 86; for ( k = 0; k < v1; ++k ) { drawGraphic(graphic_empirePanels, 0, 86 * k + 16); drawGraphic(graphic_empirePanels, screen_width - 16, 86 * k + 16); } drawGraphic(graphic_empirePanels, 0, v0); drawGraphic(graphic_empirePanels, screen_width - 16, v0); drawGraphic(graphic_empirePanels + 2, 0, 0); drawGraphic(graphic_empirePanels + 2, 0, screen_height - 120); drawGraphic(graphic_empirePanels + 2, 0, screen_height - 16); drawGraphic(graphic_empirePanels + 2, screen_width - 16, 0); drawGraphic(graphic_empirePanels + 2, screen_width - 16, screen_height - 120); drawGraphic(graphic_empirePanels + 2, screen_width - 16, screen_height - 16); } void fun_drawEmpireInfoPanelCityName() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = empire_selectedCity - 1; if ( mode_editor != 1 ) { drawGraphic(graphic_empirePanels + 6, 2, screen_height - 199); drawGraphic(graphic_empirePanels + 7, screen_width - 84, screen_height - 199); drawGraphic(graphic_empirePanels + 8, (screen_width - 332) / 2, screen_height - 181); if ( empire_selectedCity > 0 ) { if ( empire[v0].type == Emp_City ) fun_drawGameTextCentered( 21, tradeRoutes[trade_selectedCity].cityNameId, (screen_width - 332) / 2 + 64, screen_height - 118, 268, graphic_font + 670, 0); } } } void fun_drawEmpireInfoPanelForeground() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = empire_selectedCity - 1; if ( empire_selectedCity > 0 ) { if ( empire[v0].type == Emp_City ) fun_drawEmpireInfoPanelCity(); if ( empire[v0].type == Emp_BattleIcon ) fun_drawEmpireInfoPanelBattleIcon(); if ( empire[v0].type == Emp_DistantBattleRomanArmy ) fun_drawEmpireInfoPanelRomanArmy(); if ( empire[v0].type == Emp_DistantBattleEnemyArmy ) fun_drawEmpireInfoPanelEnemyArmy(); } else { fun_drawGameTextCentered(47, 8, screen_640x480_x, screen_640x480_y + 492, 640, graphic_font + F_NormalBlack, 0); } } // 607F70: using guessed type int empire_selectedCity; // 6E6BD0: using guessed type __int16 graphic_font; //----- (0051CF90) -------------------------------------------------------- void fun_drawEmpireInfoPanelCity() { int v0; // ST14_4@19 int v1; // esi@19 signed int v2; // eax@19 int v3; // ST14_4@30 int v4; // esi@30 signed int v5; // eax@30 int v6; // esi@45 signed int v7; // eax@45 int v8; // esi@58 signed int v9; // eax@58 int v10; // [sp+4Ch] [bp-28h]@42 int v11; // [sp+4Ch] [bp-28h]@55 int v12; // [sp+50h] [bp-24h]@16 int v13; // [sp+50h] [bp-24h]@27 int v14; // [sp+54h] [bp-20h]@16 int v15; // [sp+54h] [bp-20h]@27 int i; // [sp+54h] [bp-20h]@42 int j; // [sp+54h] [bp-20h]@55 int v18; // [sp+58h] [bp-1Ch]@51 int v19; // [sp+58h] [bp-1Ch]@64 int v20; // [sp+5Ch] [bp-18h]@51 int v21; // [sp+5Ch] [bp-18h]@64 int v22; // [sp+60h] [bp-14h]@1 int v23; // [sp+6Ch] [bp-8h]@4 int v24; // [sp+6Ch] [bp-8h]@15 int v25; // [sp+70h] [bp-4h]@4 int v26; // [sp+70h] [bp-4h]@15 v22 = empire_selectedCity - 1; if ( tradeRoutes[trade_selectedCity].cityType ) { if ( tradeRoutes[trade_selectedCity].cityType == 5 ) { v25 = (screen_width - 240) / 2; v23 = screen_height - 88; if ( city_inform[ciid].byte_654586 <= 0 ) fun_drawGameTextCentered(47, 12, v25, v23 + 42, 240, graphic_font + 1072, 0); else fun_drawGameTextCentered(47, 13, v25, v23 + 42, 240, graphic_font + 1072, 0); } else { if ( tradeRoutes[trade_selectedCity].cityType != 3 && tradeRoutes[trade_selectedCity].cityType != 4 && tradeRoutes[trade_selectedCity].cityType != 6 ) { if ( tradeRoutes[trade_selectedCity].cityType == 1 ) { fun_drawGameTextCentered( 47, 1, (screen_width - 240) / 2, screen_height - 88 + 42, 240, graphic_font + 1072, 0); } else { if ( tradeRoutes[trade_selectedCity].cityType == 2 ) { v26 = (screen_width - 500) / 2; v24 = screen_height - 108; if ( tradeRoutes[trade_selectedCity].isOpen ) { v10 = 0; fun_drawGameText(47, 10, v26 + 40, v24 + 30, graphic_font + 1072, 0); for ( i = 1; i <= 15; ++i ) { if ( canEmpireCitySellsGood(v22, i) ) { fun_drawInsetRect(v26 + 100 * v10 + 120, v24 + 21, 26, 26); v6 = i + word_6E6D0A; v7 = fun_getResourceGraphicIdOffset(i, 3); drawGraphic(v7 + v6, v26 + 100 * v10 + 121, v24 + 22); switch ( tradeRoutes[ tradeRoutes[trade_selectedCity].routeId[i] ].quotas[0] ) { case 0xF: drawGraphic(graphic_tradeAmount, v26 + 100 * v10 + 141, v24 + 20); break; case 0x19: drawGraphic(graphic_tradeAmount + 1, v26 + 100 * v10 + 137, v24 + 20); break; case 0x28: drawGraphic(graphic_tradeAmount + 2, v26 + 100 * v10 + 133, v24 + 20); break; } v20 = tradedSoFar[ tradeRoutes[trade_selectedCity].routeId[i] ]; v18 = tradeRoutes[ tradeRoutes[trade_selectedCity].routeId[i] ].quotas[0]; if ( v20 > v18 ) v18 = tradedSoFar[ tradeRoutes[trade_selectedCity].routeId[i] ]; text_xoffset = 0; drawNumber(v20, 64, byte_5E357C, v26 + 100 * v10 + 150, v24 + 30, graphic_font + 1072, 0); fun_drawGameText(47, 11, v26 + 100 * v10 + text_xoffset + 148, v24 + 30, graphic_font + 1072, 0); drawNumber( v18, 64, byte_5E357C, v26 + 100 * v10++ + text_xoffset + 138, v24 + 30, graphic_font + 1072, 0); } } v11 = 0; fun_drawGameText(47, 9, v26 + 40, v24 + 60, graphic_font + 1072, 0); for ( j = 1; j <= 15; ++j ) { if ( canEmpireCityBuysGood(v22, j) ) { fun_drawInsetRect(v26 + 100 * v11 + 120, v24 + 51, 26, 26); v8 = j + word_6E6D0A; v9 = fun_getResourceGraphicIdOffset(j, 3); drawGraphic(v9 + v8, v26 + 100 * v11 + 121, v24 + 52); switch ( tradeRoutes[ tradeRoutes[trade_selectedCity].routeId[j] ].quotas[0] ) { case 0xF: drawGraphic(graphic_tradeAmount, v26 + 100 * v11 + 141, v24 + 50); break; case 0x19: drawGraphic(graphic_tradeAmount + 1, v26 + 100 * v11 + 137, v24 + 50); break; case 0x28: drawGraphic(graphic_tradeAmount + 2, v26 + 100 * v11 + 133, v24 + 50); break; } v21 = tradedSoFar[ tradeRoutes[trade_selectedCity].routeId[j] ]; v19 = tradeRoutes[ tradeRoutes[trade_selectedCity].routeId[j] ].quotas[0]; if ( v21 > v19 ) v19 = tradedSoFar[ tradeRoutes[trade_selectedCity].routeId[j] ]; text_xoffset = 0; drawNumber(v21, 64, byte_5E357C, v26 + 100 * v11 + 150, v24 + 60, graphic_font + 1072, 0); fun_drawGameText(47, 11, v26 + 100 * v11 + text_xoffset + 148, v24 + 60, graphic_font + 1072, 0); drawNumber( v19, 64, byte_5E357C, v26 + 100 * v11++ + text_xoffset + 138, v24 + 60, graphic_font + 1072, 0); } } } else { text_xoffset = 0; fun_drawGameText(47, 5, v26 + 50, v24 + 42, graphic_font + 1072, 0); v14 = 1; v12 = 0; while ( v14 <= 15 ) { if ( canEmpireCitySellsGood(v22, v14) ) { fun_drawInsetRect(v26 + text_xoffset + 60, v24 + 33, 26, 26); v0 = v26 + text_xoffset + 61; v1 = v14 + word_6E6D0A; v2 = fun_getResourceGraphicIdOffset(v14, 3); drawGraphic(v2 + v1, v0, v24 + 34); switch ( tradeRoutes[ tradeRoutes[trade_selectedCity].routeId[ v14 ] ].quotas[0] ) { case 0xF: drawGraphic(graphic_tradeAmount, v26 + text_xoffset + 81, v24 + 32); break; case 0x19: drawGraphic(graphic_tradeAmount + 1, v26 + text_xoffset + 77, v24 + 32); break; case 0x28: drawGraphic(graphic_tradeAmount + 2, v26 + text_xoffset + 73, v24 + 32); break; } text_xoffset += 32; ++v12; } ++v14; } fun_drawGameText(47, 4, v26 + text_xoffset + 100, v24 + 42, graphic_font + 1072, 0); v15 = 1; v13 = 0; while ( v15 <= 15 ) { if ( canEmpireCityBuysGood(v22, v15) ) { fun_drawInsetRect(v26 + text_xoffset + 110, v24 + 33, 26, 26); v3 = v26 + text_xoffset + 110; v4 = v15 + word_6E6D0A; v5 = fun_getResourceGraphicIdOffset(v15, 3); drawGraphic(v5 + v4, v3, v24 + 34); switch ( tradeRoutes[ tradeRoutes[trade_selectedCity].routeId[v15] ].quotas[0] ) { case 0xF: drawGraphic(graphic_tradeAmount, v26 + text_xoffset + 130, v24 + 32); break; case 0x19: drawGraphic(graphic_tradeAmount + 1, v26 + text_xoffset + 126, v24 + 32); break; case 0x28: drawGraphic(graphic_tradeAmount + 2, v26 + text_xoffset + 122, v24 + 32); break; } text_xoffset += 32; ++v13; } ++v15; } if ( mouseover_button_id_main ) fun_drawBorderedButton(0, v26 + 50, v24 + 68, 400, 20, 1); else fun_drawBorderedButton(0, v26 + 50, v24 + 68, 400, 20, 0); fun_drawNumberSingularPlural( 8, 0, tradeRoutes[trade_selectedCity].costToOpen, v26 + 60, v24 + 73, graphic_font + 1072, 0); fun_drawGameText(47, 6, v26 + text_xoffset + 60, v24 + 73, graphic_font + 1072, 0); } } } } else { fun_drawGameTextCentered( 47, 0, (screen_width - 240) / 2, screen_height - 88 + 42, 240, graphic_font + 1072, 0); } } } else { fun_drawGameTextCentered(47, 12, (screen_width - 240) / 2, screen_height - 88 + 42, 240, graphic_font + 1072, 0); } } int fun_drawEmpireInfoPanelBattleIcon() { return empire_selectedCity - 1; } void fun_drawEmpireInfoPanelRomanArmy() { int v0; // [sp+54h] [bp-Ch]@8 int v1; // [sp+58h] [bp-8h]@8 if ( window_id == W_EmpireMap ) { if ( city_inform[ciid].byte_654585 > 0 || city_inform[ciid].byte_654584 > 0 ) { if ( city_inform[ciid].byte_65458B == empire[empire_selectedCity - 1].distBattleTravelMonths ) { v1 = (screen_width - 240) / 2; v0 = screen_height - 88; if ( city_inform[ciid].byte_654585 ) { fun_drawGameTextWrapped(47, 15, v1, v0 + 20, 240, graphic_font + 134, 0); } else { if ( city_inform[ciid].byte_654584 ) fun_drawGameTextWrapped(47, 16, v1, v0 + 20, 240, graphic_font + 134, 0); } } } } } void fun_drawEmpireInfoPanelEnemyArmy() { if ( window_id == W_EmpireMap ) { if ( city_inform[ciid].byte_654583 > 0 ) { if ( city_inform[ciid].byte_65458A == empire[empire_selectedCity - 1].distBattleTravelMonths ) fun_drawGameTextWrapped(47, 14, (screen_width - 240) / 2, screen_height - 88 + 20, 240, graphic_font + 134, 0); } } } void fun_drawEditEmpireObjectButtons() { __int16 v0; // [sp+4Ch] [bp-Ch]@2 __int16 v1; // [sp+4Ch] [bp-Ch]@5 __int16 v2; // [sp+4Ch] [bp-Ch]@8 __int16 v3; // [sp+4Ch] [bp-Ch]@11 int top; // [sp+50h] [bp-8h]@1 top = screen_height - 116; if ( editEmpire_selectedObjectButton == 1 ) v0 = -2048; else v0 = 0; fun_drawGameTextCentered(44, 0, 15, top + 32, 100, graphic_font, v0); if ( editEmpire_selectedObjectButton == 2 ) v1 = -2048; else v1 = 0; fun_drawGameTextCentered(44, 1, 15, top + 52, 100, graphic_font, v1); if ( editEmpire_selectedObjectButton == 3 ) v2 = -2048; else v2 = 0; fun_drawGameTextCentered(44, 2, 15, top + 72, 100, graphic_font, v2); if ( editEmpire_selectedObjectButton == 4 ) v3 = -2048; else v3 = 0; fun_drawGameTextCentered(44, 3, 15, top + 92, 100, graphic_font, v3); fun_drawGameTextCentered(44, 75, 119, top + 42, 100, graphic_font, 0); fun_drawGameTextCentered(44, 7, 119, top + 82, 100, graphic_font, 0); } void fun_drawEditEmpireObjectPanel() { if ( editEmpire_selectedObjectButton == 1 ) { fun_drawEditEmpireObjectPanel_Add(); } else { if ( editEmpire_selectedObjectButton == 2 ) { fun_drawEditEmpireObjectPanel_Edit(); } else { if ( editEmpire_selectedObjectButton != 3 ) { switch ( editEmpire_selectedObjectButton ) { case 4: fun_drawEditEmpireObjectPanel_General(); break; case 9: fun_drawEditEmpireObjectPanel_General(); break; case 10: fun_drawEditEmpireObjectPanel_General(); break; case 11: fun_drawEditEmpireObjectPanel_General(); break; case 12: fun_drawEditEmpireObjectPanel_General(); break; case 13: fun_drawEditEmpireObjectPanel_General(); break; } } } } } void fun_drawEditEmpireObjectPanel_Add() { int v0; // ST70_4@2 int v1; // ST6C_4@2 __int16 v2; // [sp+54h] [bp-8h]@4 __int16 v3; // [sp+54h] [bp-8h]@7 __int16 v4; // [sp+54h] [bp-8h]@10 __int16 v5; // [sp+54h] [bp-8h]@13 __int16 v6; // [sp+54h] [bp-8h]@16 __int16 v7; // [sp+54h] [bp-8h]@19 __int16 v8; // [sp+54h] [bp-8h]@22 __int16 v9; // [sp+54h] [bp-8h]@25 signed int v10; // [sp+58h] [bp-4h]@1 draw_clip_x = 294; draw_clip_xEnd = screen_height - 103; draw_clip_y = 382; draw_clip_yEnd = screen_height - 15; v10 = editEmpire_addObjectGraphicID; fun_fillRect(293, screen_height - 104, 90, 90, 65535); drawGraphic(v10, 294, screen_height - 103); if ( c3_sg2[v10].unknown_3A ) { v0 = c3_sg2[v10].sprite_top_offset; v1 = c3_sg2[v10].sprite_left_offset; c3_sg2[v10].unknown_3C = sub_51F950(v10, c3_sg2[v10].unknown_3C); drawGraphic(c3_sg2[v10].unknown_3C + v10, v0 + 294, screen_height + v1 - 103); } draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; fun_fillRect(387, screen_height - 110, screen_width - 408, 98, 50712); fun_drawNumberCentered(editEmpire_addObjectGraphicID + 1, 64, " ", 225, screen_height - 28, 48, graphic_font, 0); if ( dword_993F04 ) v2 = 0; else v2 = -2048; fun_drawOutsetRect(393, screen_height - 106, 180, 20); fun_drawGameTextCentered(44, 8, 393, screen_height - 102, 180, graphic_font, v2); if ( dword_993F04 == 1 ) v3 = -2048; else v3 = 0; fun_drawOutsetRect(393, screen_height - 81, 180, 20); fun_drawGameTextCentered(44, 9, 393, screen_height - 77, 180, graphic_font, v3); if ( dword_993F04 == 2 ) v4 = -2048; else v4 = 0; fun_drawOutsetRect(393, screen_height - 56, 180, 20); fun_drawGameTextCentered(44, 10, 393, screen_height - 52, 180, graphic_font, v4); if ( dword_993F04 == 3 ) v5 = -2048; else v5 = 0; fun_drawOutsetRect(393, screen_height - 31, 180, 20); fun_drawGameTextCentered(44, 11, 393, screen_height - 27, 180, graphic_font, v5); if ( dword_993F04 == 4 ) v6 = -2048; else v6 = 0; fun_drawOutsetRect(593, screen_height - 106, 180, 20); fun_drawGameTextCentered(44, 28, 593, screen_height - 102, 180, graphic_font, v6); if ( dword_993F04 == 5 ) v7 = -2048; else v7 = 0; fun_drawOutsetRect(593, screen_height - 81, 180, 20); fun_drawGameTextCentered(44, 29, 593, screen_height - 77, 180, graphic_font, v7); if ( dword_993F04 == 6 ) v8 = -2048; else v8 = 0; fun_drawOutsetRect(593, screen_height - 56, 180, 20); fun_drawGameTextCentered(44, 30, 593, screen_height - 52, 180, graphic_font, v8); if ( dword_993F04 == 7 ) v9 = -2048; else v9 = 0; fun_drawOutsetRect(593, screen_height - 31, 180, 20); fun_drawGameTextCentered(44, 31, 593, screen_height - 27, 180, graphic_font, v9); } void fun_drawEditEmpireObjectPanel_Edit() { int v0; // ST70_4@2 int v1; // ST6C_4@2 int v2; // ST74_4@20 int v3; // ST1C_4@20 int v4; // esi@20 signed int v5; // eax@20 int v6; // ST74_4@26 int v7; // ST1C_4@26 int v8; // esi@26 signed int v9; // eax@26 int v10; // ST74_4@29 int v11; // ST1C_4@29 int v12; // esi@29 signed int v13; // eax@29 signed int i; // [sp+58h] [bp-Ch]@18 signed int j; // [sp+58h] [bp-Ch]@24 signed int k; // [sp+58h] [bp-Ch]@27 int v17; // [sp+5Ch] [bp-8h]@3 signed int v18; // [sp+60h] [bp-4h]@1 draw_clip_x = 294; draw_clip_xEnd = screen_height - 103; draw_clip_y = 382; draw_clip_yEnd = screen_height - 15; v18 = editEmpire_addObjectGraphicID; fun_fillRect(225, screen_height - 54, 48, 20, 50712); fun_drawNumberCentered(editEmpire_addObjectGraphicID + 1, 64, " ", 225, screen_height - 52, 48, graphic_font, 0); fun_fillRect(293, screen_height - 104, 90, 90, 65535); drawGraphic(v18, 294, screen_height - 103); if ( c3_sg2[v18].unknown_3A ) { v0 = c3_sg2[v18].sprite_top_offset; v1 = c3_sg2[v18].sprite_left_offset; c3_sg2[v18].unknown_3C = sub_51F950(v18, c3_sg2[v18].unknown_3C); drawGraphic(c3_sg2[v18].unknown_3C + v18, v0 + 294, screen_height + v1 - 103); } draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; fun_fillRect(387, screen_height - 110, screen_width - 408, 98, 50712); fun_drawNumberCentered(editEmpire_addObjectGraphicID + 1, 64, " ", 225, screen_height - 28, 48, graphic_font, 0); v17 = currentEmpireEntryId; text_xoffset = 0; if ( empire[currentEmpireEntryId].type == 1 ) { fun_drawOutsetRect(393, screen_height - 112, 180, 20); if ( empire[v17].cityType ) { switch ( empire[v17].cityType ) { case 1: fun_drawGameTextCentered(39, 1, 393, screen_height - 108, 180, graphic_font, 0); break; case 2: fun_drawGameTextCentered(39, 2, 393, screen_height - 108, 180, graphic_font, 0); break; case 3: fun_drawGameTextCentered(39, 3, 393, screen_height - 108, 180, graphic_font, 0); break; case 4: fun_drawGameTextCentered(39, 4, 393, screen_height - 108, 180, graphic_font, 0); break; case 5: fun_drawGameTextCentered(39, 5, 393, screen_height - 108, 180, graphic_font, 0); break; default: fun_drawGameTextCentered(39, 6, 393, screen_height - 108, 180, graphic_font, 0); break; } } else { fun_drawGameTextCentered(39, 0, 393, screen_height - 108, 180, graphic_font, 0); } fun_drawOutsetRect(593, screen_height - 112, 180, 20); fun_drawGameTextCentered( 21, empire[v17].cityNameId, 593, screen_height - 108, 180, graphic_font, 0); fun_drawGameText(44, 32, 393, screen_height - 83, graphic_font, 0); fun_drawOutsetRect(453, screen_height - 87, 50, 20); fun_drawNumberCentered( empire[v17].tradeRouteId, 64, " ", 453, screen_height - 83, 50, graphic_font, 0); fun_drawOutsetRect(523, screen_height - 87, 100, 20); fun_drawGameTextCentered(44, 33, 523, screen_height - 83, 100, graphic_font, 0); fun_drawGameText(44, 34, 653, screen_height - 83, graphic_font, 0); fun_drawOutsetRect(703, screen_height - 87, 80, 20); fun_drawNumberCentered(empire[v17].tradeCostToOpen[0], 64, " ", 703, screen_height - 83, 60, graphic_font, 0); if ( empire[v17].cityType == 1 ) { fun_drawGameText(44, 35, 393, screen_height - 55, graphic_font, 0); for ( i = 0; i < 10; ++i ) { fun_drawInsetRect(30 * i + 473, screen_height - 62, 26, 26); v2 = empire[v17].citySells[i]; v3 = screen_height - 61; v4 = v2 + word_6E6D0A; v5 = fun_getResourceGraphicIdOffset(v2, 3); drawGraphic(v5 + v4, 30 * i + 474, v3); } } else { if ( empire[v17].cityType == 2 || empire[v17].cityType == 3 ) { fun_drawGameText(44, 36, 393, screen_height - 55, graphic_font, 0); for ( j = 0; j < 8; ++j ) { fun_drawInsetRect(30 * j + 523, screen_height - 62, 26, 26); v6 = empire[v17].citySells[j]; v7 = screen_height - 61; v8 = v6 + word_6E6D0A; v9 = fun_getResourceGraphicIdOffset(v6, 3); drawGraphic(v9 + v8, 30 * j + 524, v7); } fun_drawGameText(44, 5, 393, screen_height - 27, graphic_font, 0); for ( k = 0; k < 8; ++k ) { fun_drawInsetRect(30 * k + 523, screen_height - 34, 26, 26); v10 = empire[v17].cityBuys[k]; v11 = screen_height - 33; v12 = v10 + word_6E6D0A; v13 = fun_getResourceGraphicIdOffset(v10, 3); drawGraphic(v13 + v12, 30 * k + 524, v11); } } } } else { if ( empire[currentEmpireEntryId].type == 3 ) { fun_drawGameText(44, 69, 393, screen_height - 100, graphic_font + 536, 0); fun_drawGameText(44, 70, 423, screen_height - 64, graphic_font, 0); fun_drawOutsetRect(523, screen_height - 68, 50, 20); fun_drawNumberCentered( empire[v17].invasionPathId, 64, " ", 523, screen_height - 64, 50, graphic_font, 0); fun_drawGameText(44, 71, 423, screen_height - 34, graphic_font, 0); fun_drawOutsetRect(523, screen_height - 38, 50, 20); fun_drawNumberCentered( empire[v17].invasionYears, 64, " ", 523, screen_height - 34, 50, graphic_font, 0); } else { if ( empire[currentEmpireEntryId].type != 4 && empire[currentEmpireEntryId].type != 5 ) { if ( empire[currentEmpireEntryId].type == 6 || empire[currentEmpireEntryId].type == 7 ) { text_xoffset = 0; if ( empire[currentEmpireEntryId].type == 6 ) fun_drawGameText(44, 30, 393, screen_height - 100, graphic_font + 536, 0); else fun_drawGameText(44, 31, 393, screen_height - 100, graphic_font + 536, 0); drawNumber( empire[v17].distBattleTravelMonths, 64, " ", text_xoffset + 393, screen_height - 100, graphic_font + 536, 0); fun_drawGameTextWrapped(44, 106, 393, screen_height - 64, 350, graphic_font, 0); } } else { if ( empire[currentEmpireEntryId].type == 4 ) fun_drawGameText(44, 28, 393, screen_height - 100, graphic_font + 536, 0); else fun_drawGameText(44, 29, 393, screen_height - 100, graphic_font + 536, 0); fun_drawOutsetRect(393, screen_height - 54, 50, 20); fun_drawNumberCentered( empire[v17].tradeRouteId, 64, " ", 393, screen_height - 50, 50, graphic_font, 0); fun_drawGameText( 21, empire[v17].cityNameId, 493, screen_height - 50, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(44, 33, 623, screen_height - 50, graphic_font, 0); fun_drawGameTextCentered( 18, empire[v17].tradeRouteOpen, text_xoffset + 623, screen_height - 50, 50, graphic_font, 0); } } } } int sub_51F950(int a1, int a2) { int v2; // ecx@15 signed int v4; // [sp+4Ch] [bp-4h]@8 int v5; // [sp+5Ch] [bp+Ch]@8 if ( a2 <= 0 ) a2 = 1; if ( byte_9DA640[c3_sg2[a1].unknown_3A] ) { if ( LOBYTE(c3_sg2[0].animation[32 * a1 + 5]) ) { if ( a2 & 0x80 ) v4 = 1; v5 = a2 & 0x7F; if ( v4 ) { a2 = v5 - 1; if ( a2 < 1 ) { a2 = 1; v4 = 0; } } else { a2 = v5 + 1; if ( a2 > c3_sg2[a1].unknown_1E ) { a2 = c3_sg2[a1].unknown_1E; v4 = 1; } } if ( v4 ) { v2 = a2; _LOBYTE(v2) = a2 | 0x80; a2 = v2; } } else { ++a2; if ( a2 > c3_sg2[a1].unknown_1E ) a2 = 1; } } return a2; } void fun_drawEditEmpireObjectPanel_General() { text_xoffset = 0; fun_drawGameText(44, 18, 283, screen_height - 100, graphic_font, 0); drawNumber(scenario_map_empire + 1, 64, " ", text_xoffset + 283, screen_height - 107, graphic_font + 536, 0); fun_drawOutsetRect(231, screen_height - 64, 120, 20); fun_drawGameTextCentered(44, 4, 231, screen_height - 60, 120, graphic_font, 0); fun_drawGameText(44, 81, 423, screen_height - 60, graphic_font, 0); fun_drawOutsetRect(573, screen_height - 64, 120, 20); drawNumber(map_empireExpansionYear, 43, " ", 583, screen_height - 60, graphic_font, 0); fun_drawGameYearWithBcAd( 0, map_empireExpansionYear + map_settings_startYear, 613, screen_height - 60, graphic_font, 0); fun_drawGameText(44, 82, 383, screen_height - 30, graphic_font, 0); fun_drawOutsetRect(573, screen_height - 34, 60, 20); fun_drawGameTextCentered(18, map_empireExpanded, 573, screen_height - 30, 60, graphic_font, 0); } void fun_drawEmpire() { int v0; // ST6C_4@50 int v1; // ST68_4@50 __int16 v2; // [sp+54h] [bp-1Ch]@35 signed int v3; // [sp+58h] [bp-18h]@17 int v4; // [sp+5Ch] [bp-14h]@17 int v5; // [sp+5Ch] [bp-14h]@54 int v6; // [sp+60h] [bp-10h]@17 int v7; // [sp+60h] [bp-10h]@54 signed int v8; // [sp+64h] [bp-Ch]@23 int i; // [sp+6Ch] [bp-4h]@5 signed int j; // [sp+6Ch] [bp-4h]@58 fun_nextSelectAntsColorLong(); fullscreenImage_width = ddraw_width - 2 * empireMapBorderLeftRight; fullscreenImage_height = ddraw_height - empireMapBorderTop - empireMapBorderBottom; if ( empire_scroll_x >= 2000 - fullscreenImage_width ) empire_scroll_x = 2000 - fullscreenImage_width - 1; if ( empire_scroll_y >= 1000 - fullscreenImage_height ) empire_scroll_y = 1000 - fullscreenImage_height - 1; fullscreenImage_xOffset = empire_scroll_x; fullscreenImage_yOffset = empire_scroll_y; drawGraphic(word_6E6C0E, empireMapBorderLeftRight, empireMapBorderTop); draw_clip_x = empireMapBorderLeftRight; draw_clip_xEnd = ddraw_width - empireMapBorderLeftRight; draw_clip_y = empireMapBorderTop; draw_clip_yEnd = ddraw_height - empireMapBorderBottom; for ( i = 0; i < 200 && empire[i].inUse; ++i ) { if ( window_id != 20 || empire[i].type != 4 && empire[i].type != 5 || fun_isTradeRouteOpen(empire[j].tradeRouteId) ) { if ( window_id == 21 && map_empireExpanded ) { v6 = empire[i].xCoord_exp; v4 = empire[i].yCoord_exp; v3 = empire[i].graphicID_exp; } else { if ( window_id == 20 && scn_empireExpanded_flag ) { v6 = empire[i].xCoord_exp; v4 = empire[i].yCoord_exp; v3 = empire[i].graphicID_exp; } else { v6 = empire[i].xCoord; v4 = empire[i].yCoord; v3 = empire[i].graphicID; } } if ( empire[i].type == Emp_City ) { v8 = fun_getTradeCityFromEmpireObject(i); if ( tradeRoutes[v8].cityType== City_DistantForeign ) v3 = word_6E6D6E; if ( tradeRoutes[v8].cityType== City_FutureRoman ) v3 = word_6E6D6E; } if ( empire[i].type == Emp_BattleIcon ) { if ( window_id == W_EmpireMap ) continue; drawNumber( empire[i].invasionPathId, 64, " ", v6 + empireMapBorderLeftRight - empire_scroll_x - 8, v4 + empireMapBorderTop - empire_scroll_y - 10, graphic_font + 938, 0); drawNumber( empire[i].invasionPathId, 64, " ", v6 + empireMapBorderLeftRight - empire_scroll_x - 9, v4 + empireMapBorderTop - empire_scroll_y - 9, graphic_font + 938, -1); drawNumber( empire[i].invasionYears, 64, " ", v6 + empireMapBorderLeftRight - empire_scroll_x + 16, v4 + empireMapBorderTop - empire_scroll_y - 10, graphic_font + 938, 0); drawNumber( empire[i].invasionYears, 64, " ", v6 + empireMapBorderLeftRight - empire_scroll_x + 15, v4 + empireMapBorderTop - empire_scroll_y - 9, graphic_font + 938, -2048); } if ( empire[i].type != Emp_DistantBattleRomanArmy && empire[i].type != Emp_DistantBattleEnemyArmy ) goto LABEL_49; if ( window_id != 20 ) { if ( empire[i].type == Emp_DistantBattleRomanArmy ) v2 = -1; else v2 = -2048; drawNumber( empire[i].distBattleTravelMonths, 64, " ", v6 + empireMapBorderLeftRight - empire_scroll_x + 8, v4 + empireMapBorderTop - empire_scroll_y - 10, graphic_font + 938, 0); drawNumber( empire[i].distBattleTravelMonths, 64, " ", v6 + empireMapBorderLeftRight - empire_scroll_x + 7, v4 + empireMapBorderTop - empire_scroll_y - 9, graphic_font + 938, v2); LABEL_49: drawGraphic( v3, v6 + empireMapBorderLeftRight - empire_scroll_x, v4 + empireMapBorderTop - empire_scroll_y); if ( c3_sg2[v3].unknown_3A ) { v0 = c3_sg2[v3].sprite_top_offset; v1 = c3_sg2[v3].sprite_left_offset; empire[i].currentAnimationIndex = sub_51F950(v3, empire[i].currentAnimationIndex); drawGraphic( empire[i].currentAnimationIndex + v3, v0 + v6 + empireMapBorderLeftRight - empire_scroll_x, v1 + v4 + empireMapBorderTop - empire_scroll_y); } continue; } if ( empire[i].type == Emp_DistantBattleEnemyArmy ) { if ( city_inform[ciid].byte_654583 > 0 && city_inform[ciid].byte_65458A == empire[i].distBattleTravelMonths ) goto LABEL_49; } else { if ( (city_inform[ciid].byte_654585 > 0 || city_inform[ciid].byte_654584 > 0) && city_inform[ciid].byte_65458B == empire[i].distBattleTravelMonths ) goto LABEL_49; } } } if ( window_id == 21 ) { if ( map_empireExpanded ) { v7 = empire[currentEmpireEntryId].xCoord_exp; v5 = empire[currentEmpireEntryId].yCoord_exp; } else { v7 = empire[currentEmpireEntryId].xCoord; v5 = empire[currentEmpireEntryId].yCoord; } if ( empire[currentEmpireEntryId].inUse ) fun_drawSelectionAnts( v7 + empireMapBorderLeftRight - empire_scroll_x - 4, v5 + empireMapBorderTop - empire_scroll_y - 4, c3_sg2[empire[currentEmpireEntryId].graphicID].width + 8, c3_sg2[empire[currentEmpireEntryId].graphicID].height + 8); } for ( j = 0; j < 101 && window_id == W_EmpireMap; ++j ) { if ( byte_98EF40[32 * j] ) { if ( byte_98EF41[32 * j] ) drawGraphic( word_98EF48[16 * j], word_98EF44[16 * j] + empireMapBorderLeftRight - empire_scroll_x, word_98EF46[16 * j] + empireMapBorderTop - empire_scroll_y); } } draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } void fun_drawEditorEditStartDate() { int v0; // [sp+4Ch] [bp-Ch]@1 int v1; // [sp+50h] [bp-8h]@1 int v2; // [sp+54h] [bp-4h]@2 int v3; // [sp+54h] [bp-4h]@8 v1 = screen_640x480_x + 128; v0 = screen_640x480_y + 44; fun_drawDialogBackground(screen_640x480_x + 128, screen_640x480_y + 44, 20, 10); text_xoffset = 0; fun_drawGameTextCentered(44, 13, v1 + 10, v0 + 12, 320, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v1, v0 + 134, 320, graphic_font + 134, 0); v2 = mouseover_button_id == 1; fun_drawBorderedButton(1, v1 + 30, v0 + 56, 100, 30, v2); if ( map_settings_startYear >= 0 ) fun_drawGameText(20, 1, v1 + 40, v0 + 60, graphic_font + 670, 0); else fun_drawGameText(20, 0, v1 + 40, v0 + 60, graphic_font + 670, 0); v3 = mouseover_button_id == 2; fun_drawBorderedButton(1, v1 + 150, v0 + 56, 120, 30, v3); if ( map_settings_startYear >= 0 ) fun_drawNumberCentered(map_settings_startYear, 64, " ", v1 + 150, v0 + 60, 120, graphic_font + 670, 0); else fun_drawNumberCentered(-map_settings_startYear, 64, " ", v1 + 150, v0 + 60, 120, graphic_font + 670, 0); } void fun_drawEditorRequests() { int v0; // [sp+4Ch] [bp-18h]@10 int v1; // [sp+50h] [bp-14h]@1 int v2; // [sp+54h] [bp-10h]@1 int v3; // [sp+58h] [bp-Ch]@7 int v4; // [sp+5Ch] [bp-8h]@4 signed int i; // [sp+60h] [bp-4h]@1 v2 = screen_640x480_x; v1 = screen_640x480_y; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y, 40, 23); fun_drawGameText(44, 14, v2 + 20, v1 + 12, graphic_font + 536, 0); fun_drawGameTextCentered(13, 3, v2, v1 + 344, 640, graphic_font + 134, 0); for ( i = 0; i < 20; ++i ) { if ( i < 10 ) v4 = v2 + 20; else v4 = v2 + 320; if ( i < 10 ) v3 = v1 + 30 * i + 42; else v3 = v1 + 30 * (i - 10) + 42; v0 = mouseover_button_id == i + 1; fun_drawBorderedButton(1, v4, v3, 290, 25, v0); if ( map_requests_good[i] ) { drawNumber(map_requests_year[i], 43, " ", v4 + 20, v3 + 6, graphic_font, 0); fun_drawGameYearWithBcAd(0, map_requests_year[i] + map_settings_startYear, v4 + 60, v3 + 6, graphic_font, 0); text_xoffset = 0; drawNumber(map_requests_amount[i], 64, " ", v4 + text_xoffset + 140, v3 + 6, graphic_font, 0); fun_drawGameText(23, map_requests_good[i], v4 + text_xoffset + 140, v3 + 6, graphic_font, 0); } else { fun_drawGameTextCentered(44, 23, v4, v3 + 6, 290, graphic_font, 0); } } } void fun_drawEditorEditRequest() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@11 int v4; // [sp+4Ch] [bp-Ch]@14 int v5; // [sp+4Ch] [bp-Ch]@17 int v6; // [sp+4Ch] [bp-Ch]@20 int v7; // [sp+50h] [bp-8h]@1 int v8; // [sp+54h] [bp-4h]@1 v8 = screen_640x480_x; v7 = screen_640x480_y + 100; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y + 100, 38, 11); fun_drawGameText(44, 21, v8 + 14, v7 + 14, graphic_font + 670, 0); v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, v8 + 30, v7 + 52, 60, 25, v0); fun_drawNumberCentered( map_requests_year[editRequests_current], 43, " ", v8 + 30, v7 + 58, 60, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 1, map_requests_year[editRequests_current] + map_settings_startYear, v8 + 110, v7 + 58, graphic_font + 134, 0); fun_drawGameText(44, 72, v8 + 250, v7 + 58, graphic_font + 134, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, v8 + 330, v7 + 52, 80, 25, v1); fun_drawNumberCentered( map_requests_amount[editRequests_current], 64, " ", v8 + 330, v7 + 58, 80, graphic_font + 134, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(0, v8 + 430, v7 + 52, 100, 25, v2); fun_drawGameTextCentered(23, map_requests_good[editRequests_current], v8 + 430, v7 + 58, 100, graphic_font + 134, 0); fun_drawGameText(44, 24, v8 + 40, v7 + 96, graphic_font + 134, 0); v3 = mouseover_button_id == 4; fun_drawBorderedButton(0, v8 + 70, v7 + 90, 140, 25, v3); fun_drawNumberSingularPlural( 8, 8, map_requests_deadline[editRequests_current], v8 + 80, v7 + 96, graphic_font + 134, 0); fun_drawGameText(44, 73, v8 + 300, v7 + 96, graphic_font + 134, 0); v4 = mouseover_button_id == 5; fun_drawBorderedButton(0, v8 + 400, v7 + 90, 80, 25, v4); fun_drawNumberCentered( map_requests_favor[editRequests_current], 43, " ", v8 + 400, v7 + 96, 80, graphic_font + 134, 0); v5 = mouseover_button_id == 7; fun_drawBorderedButton(1, v8 + 300, v7 + 134, 100, 25, v5); fun_drawGameTextCentered(18, 3, v8 + 300, v7 + 140, 100, graphic_font + 134, 0); v6 = mouseover_button_id == 6; fun_drawBorderedButton(1, v8 + 10, v7 + 134, 250, 25, v6); fun_drawGameTextCentered(44, 25, v8 + 10, v7 + 140, 250, graphic_font + 134, 0); } void fun_drawEditorInvasions() { int v0; // [sp+4Ch] [bp-18h]@10 int v1; // [sp+50h] [bp-14h]@1 int v2; // [sp+54h] [bp-10h]@1 int v3; // [sp+58h] [bp-Ch]@7 int v4; // [sp+5Ch] [bp-8h]@4 signed int i; // [sp+60h] [bp-4h]@1 v2 = screen_640x480_x; v1 = screen_640x480_y; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y, 40, 23); fun_drawGameText(44, 15, v2 + 20, v1 + 12, graphic_font + 536, 0); fun_drawGameTextCentered(13, 3, v2, v1 + 344, 640, graphic_font + 134, 0); for ( i = 0; i < 20; ++i ) { if ( i < 10 ) v4 = v2 + 20; else v4 = v2 + 320; if ( i < 10 ) v3 = v1 + 30 * i + 42; else v3 = v1 + 30 * (i - 10) + 42; v0 = mouseover_button_id == i + 1; fun_drawBorderedButton(1, v4, v3, 290, 25, v0); if ( map_invasions_type[i] ) { drawNumber(map_invasions_year[i], 43, " ", v4 + 6, v3 + 6, graphic_font, 0); fun_drawGameYearWithBcAd(1, map_invasions_year[i] + map_settings_startYear, v4 + 40, v3 + 6, graphic_font, 0); text_xoffset = 0; drawNumber(map_invasions_amount[i], 64, " ", v4 + text_xoffset + 110, v3 + 6, graphic_font, 0); fun_drawGameText(34, map_invasions_type[i], v4 + text_xoffset + 110, v3 + 6, graphic_font, 0); } else { fun_drawGameTextCentered(44, 23, v4, v3 + 6, 290, graphic_font, 0); } } } void fun_drawEditorEditInvasion() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@12 int v4; // [sp+4Ch] [bp-Ch]@15 int v5; // [sp+4Ch] [bp-Ch]@19 int v6; // [sp+4Ch] [bp-Ch]@22 int v7; // [sp+50h] [bp-8h]@1 int v8; // [sp+54h] [bp-4h]@1 v8 = screen_640x480_x; v7 = screen_640x480_y + 100; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y + 100, 38, 11); fun_drawGameText(44, 22, v8 + 14, v7 + 14, graphic_font + 670, 0); v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, v8 + 30, v7 + 52, 60, 25, v0); fun_drawNumberCentered( map_invasions_year[editInvasions_current], 43, " ", v8 + 30, v7 + 58, 60, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 1, map_invasions_year[editInvasions_current] + map_settings_startYear, v8 + 100, v7 + 58, graphic_font + 134, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, v8 + 200, v7 + 52, 80, 25, v1); fun_drawNumberCentered( map_invasions_amount[editInvasions_current], 64, " ", v8 + 200, v7 + 58, 80, graphic_font + 134, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(0, v8 + 320, v7 + 52, 200, 25, v2); fun_drawGameTextCentered( 34, map_invasions_type[editInvasions_current], v8 + 320, v7 + 58, 200, graphic_font + 134, 0); if ( map_invasions_type[editInvasions_current] != 4 ) { fun_drawGameText(44, 27, v8 + 40, v7 + 96, graphic_font + 134, 0); v3 = mouseover_button_id == 4; fun_drawBorderedButton(0, v8 + 130, v7 + 90, 190, 25, v3); fun_drawGameTextCentered( 35, map_invasions_from[editInvasions_current], v8 + 130, v7 + 96, 190, graphic_font + 134, 0); v4 = mouseover_button_id == 5; fun_drawBorderedButton(0, v8 + 340, v7 + 90, 220, 25, v4); fun_drawGameTextCentered( 36, map_invasions_attack[editInvasions_current], v8 + 340, v7 + 96, 220, graphic_font + 134, 0); } v5 = mouseover_button_id == 7; fun_drawBorderedButton(0, v8 + 310, v7 + 130, 100, 25, v5); fun_drawGameTextCentered(18, 3, v8 + 310, v7 + 136, 100, graphic_font + 134, 0); v6 = mouseover_button_id == 6; fun_drawBorderedButton(0, v8 + 20, v7 + 130, 250, 25, v6); fun_drawGameTextCentered(44, 26, v8 + 20, v7 + 136, 250, graphic_font + 134, 0); } void fun_editor_drawNumericInputDialog(int a1, int a2) { signed int v2; // [sp+4Ch] [bp-4h]@4 signed int v3; // [sp+4Ch] [bp-4h]@7 signed int v4; // [sp+4Ch] [bp-4h]@10 signed int v5; // [sp+4Ch] [bp-4h]@13 signed int v6; // [sp+4Ch] [bp-4h]@16 signed int v7; // [sp+4Ch] [bp-4h]@19 signed int v8; // [sp+4Ch] [bp-4h]@22 signed int v9; // [sp+4Ch] [bp-4h]@25 signed int v10; // [sp+4Ch] [bp-4h]@28 signed int v11; // [sp+4Ch] [bp-4h]@31 signed int v12; // [sp+4Ch] [bp-4h]@34 signed int v13; // [sp+4Ch] [bp-4h]@37 fun_drawDialogBackground(a1 - 16, a2 - 16, 8, 14); fun_fillRect(a1, a2, 96, 30, 0); if ( numericInput_numDigits > 0 ) fun_drawNumberCentered(numericInput_value, 64, " ", a1 - 8, a2 + 3, 96, graphic_font + F_LargePlain, -2048); if ( mouseover_button_id == 1 ) v2 = 703; else v2 = 0; fun_drawRect(a1 + 5, a2 + 35, 25, 25, v2); fun_drawTextCentered((const char *)"1", a1 + 5, a2 + 35, 25, graphic_font + F_LargePlain, v2); if ( mouseover_button_id == 2 ) v3 = 703; else v3 = 0; fun_drawRect(a1 + 35, a2 + 35, 25, 25, v3); fun_drawTextCentered((const char *)"2", a1 + 35, a2 + 35, 25, graphic_font + F_LargePlain, v3); if ( mouseover_button_id == 3 ) v4 = 703; else v4 = 0; fun_drawRect(a1 + 65, a2 + 35, 25, 25, v4); fun_drawTextCentered((const char *)"3", a1 + 65, a2 + 35, 25, graphic_font + F_LargePlain, v4); if ( mouseover_button_id == 4 ) v5 = 703; else v5 = 0; fun_drawRect(a1 + 5, a2 + 65, 25, 25, v5); fun_drawTextCentered((const char *)"4", a1 + 5, a2 + 65, 25, graphic_font + F_LargePlain, v5); if ( mouseover_button_id == 5 ) v6 = 703; else v6 = 0; fun_drawRect(a1 + 35, a2 + 65, 25, 25, v6); fun_drawTextCentered((const char *)"5", a1 + 35, a2 + 65, 25, graphic_font + F_LargePlain, v6); if ( mouseover_button_id == 6 ) v7 = 703; else v7 = 0; fun_drawRect(a1 + 65, a2 + 65, 25, 25, v7); fun_drawTextCentered((const char *)"6", a1 + 65, a2 + 65, 25, graphic_font + F_LargePlain, v7); if ( mouseover_button_id == 7 ) v8 = 703; else v8 = 0; fun_drawRect(a1 + 5, a2 + 95, 25, 25, v8); fun_drawTextCentered((const char *)"7", a1 + 5, a2 + 95, 25, graphic_font + F_LargePlain, v8); if ( mouseover_button_id == 8 ) v9 = 703; else v9 = 0; fun_drawRect(a1 + 35, a2 + 95, 25, 25, v9); fun_drawTextCentered((const char *)"8", a1 + 35, a2 + 95, 25, graphic_font + F_LargePlain, v9); if ( mouseover_button_id == 9 ) v10 = 703; else v10 = 0; fun_drawRect(a1 + 65, a2 + 95, 25, 25, v10); fun_drawTextCentered((const char *)"9", a1 + 65, a2 + 95, 25, graphic_font + F_LargePlain, v10); if ( mouseover_button_id == 10 ) v11 = 703; else v11 = 0; fun_drawRect(a1 + 5, a2 + 125, 25, 25, v11); fun_drawTextCentered((const char *)"0", a1 + 5, a2 + 125, 25, graphic_font + F_LargePlain, v11); if ( mouseover_button_id == 11 ) v12 = 703; else v12 = 0; fun_drawRect(a1 + 35, a2 + 125, 55, 25, v12); fun_drawGameTextCentered(44, 16, a1 + 35, a2 + 131, 55, graphic_font, v12); if ( mouseover_button_id == 12 ) v13 = 703; else v13 = 0; fun_drawRect(a1 + 5, a2 + 155, 85, 25, v13); fun_drawGameTextCentered(44, 17, a1 + 5, a2 + 161, 85, graphic_font, v13); } void fun_editor_drawSelectListDialog(int a1, int a2) { signed int v2; // [sp+4Ch] [bp-8h]@11 signed int v3; // [sp+4Ch] [bp-8h]@17 __int16 v4; // [sp+4Ch] [bp-8h]@24 int i; // [sp+50h] [bp-4h]@8 signed int j; // [sp+50h] [bp-4h]@14 int k; // [sp+50h] [bp-4h]@21 if ( selectList_fromWindow == 21 ) { if ( selectList_numItems == 40 ) fun_drawDialogBackground(a1, a2, 26, 26); else fun_drawDialogBackground(a1, a2, 13, (20 * selectList_numItems + 24) / 16); } else { fun_drawDialogBackground(a1, a2, 13, (20 * selectList_numItems + 24) / 16); } if ( selectList_numItems == 40 ) { for ( i = 0; i < 20; ++i ) { if ( mouseover_button_id == i + 1 ) v2 = 703; else v2 = 0; fun_drawRect(a1 + 5, a2 + 20 * i + 6, 196, 18, v2); fun_drawGameTextCentered(selectList_group, i, a1 + 5, a2 + 20 * i + 9, 196, graphic_font, v2); } for ( j = 0; j < 20; ++j ) { if ( mouseover_button_id == j + 21 ) v3 = 703; else v3 = 0; fun_drawRect(a1 + 205, a2 + 20 * j + 6, 196, 18, v3); fun_drawGameTextCentered(selectList_group, j + 20, a1 + 205, a2 + 20 * j + 9, 196, graphic_font, v3); } } else { for ( k = 0; k < selectList_numItems; ++k ) { if ( mouseover_button_id == k + 1 ) v4 = 703; else v4 = 0; fun_drawGameTextCentered(selectList_group, k, a1 + 5, a2 + 20 * k + 11, 196, graphic_font, v4); } } } void fun_drawDisplayOptionsDialog() { __int16 v0; // [sp+4Ch] [bp-8h]@17 __int16 v1; // [sp+4Ch] [bp-8h]@23 __int16 v2; // [sp+4Ch] [bp-8h]@26 __int16 v3; // [sp+4Ch] [bp-8h]@29 __int16 v4; // [sp+4Ch] [bp-8h]@32 int v5; // [sp+50h] [bp-4h]@2 int v6; // [sp+50h] [bp-4h]@5 int v7; // [sp+50h] [bp-4h]@8 int v8; // [sp+50h] [bp-4h]@11 int v9; // [sp+50h] [bp-4h]@14 fun_drawDialogBackground(screen_640x480_x + 96, screen_640x480_y + 80, 18, 12); if ( mouseover_button_id == 1 ) v5 = 1; else v5 = 2; fun_drawSmallGreyButton(2, screen_640x480_x + 128, screen_640x480_y + 136, 14, 0, v5); if ( mouseover_button_id == 2 ) v6 = 1; else v6 = 2; fun_drawSmallGreyButton(2, screen_640x480_x + 128, screen_640x480_y + 160, 14, 0, v6); if ( mouseover_button_id == 3 ) v7 = 1; else v7 = 2; fun_drawSmallGreyButton(2, screen_640x480_x + 128, screen_640x480_y + 184, 14, 0, v7); if ( mouseover_button_id == 4 ) v8 = 1; else v8 = 2; fun_drawSmallGreyButton(2, screen_640x480_x + 128, screen_640x480_y + 208, 14, 0, v8); if ( mouseover_button_id == 5 ) v9 = 1; else v9 = 2; fun_drawSmallGreyButton(2, screen_640x480_x + 128, screen_640x480_y + 232, 14, 0, v9); fun_drawGameTextCentered(42, 0, screen_640x480_x + 128, screen_640x480_y + 94, 224, graphic_font + 670, 0); if ( mouseover_button_id == 1 ) v0 = -1343; else v0 = 703; if ( setting_fullscreen ) fun_drawGameTextCentered(42, 2, screen_640x480_x + 128, screen_640x480_y + 140, 224, graphic_font + 1072, v0); else fun_drawGameTextCentered(42, 1, screen_640x480_x + 128, screen_640x480_y + 140, 224, graphic_font + 1072, v0); if ( mouseover_button_id == 2 ) v1 = -1343; else v1 = 703; fun_drawGameTextCentered(42, 3, screen_640x480_x + 128, screen_640x480_y + 164, 224, graphic_font + 1072, v1); if ( mouseover_button_id == 3 ) v2 = -1343; else v2 = 703; fun_drawGameTextCentered(42, 4, screen_640x480_x + 128, screen_640x480_y + 188, 224, graphic_font + 1072, v2); if ( mouseover_button_id == 4 ) v3 = -1343; else v3 = 703; fun_drawGameTextCentered(42, 5, screen_640x480_x + 128, screen_640x480_y + 212, 224, graphic_font + 1072, v3); if ( mouseover_button_id == 5 ) v4 = -1343; else v4 = 703; fun_drawGameTextCentered(42, 6, screen_640x480_x + 128, screen_640x480_y + 236, 224, graphic_font + 1072, v4); fun_resetClipRegionOptionsDialog(); button_something_2 = 50; } void fun_drawDifficultyOptionsDialog() { fun_drawDialogBackground(screen_640x480_x + 48, screen_640x480_y + 80, 24, 12); fun_drawGameTextCentered(153, 0, screen_640x480_x + 48, screen_640x480_y + 94, 384, graphic_font + 670, 0); fun_drawGameTextCentered( 153, setting_difficulty + 1, screen_640x480_x + 80, screen_640x480_y + 142, 224, graphic_font + 134, 0); if ( setting_godsOn ) fun_drawGameTextCentered(153, 7, screen_640x480_x + 80, screen_640x480_y + 190, 224, graphic_font + 134, 0); else fun_drawGameTextCentered(153, 6, screen_640x480_x + 80, screen_640x480_y + 190, 224, graphic_font + 134, 0); fun_drawArrowButtonCollection(screen_640x480_x + 288, screen_640x480_y + 80, &arrowbuttons_difficultyOptions, 3); fun_drawGameTextCentered(153, 8, screen_640x480_x + 48, screen_640x480_y + 246, 384, graphic_font + 134, 0); } void fun_drawSpeedOptionsDialog() { __int16 v0; // [sp+4Ch] [bp-8h]@8 __int16 v1; // [sp+4Ch] [bp-8h]@11 int v2; // [sp+50h] [bp-4h]@2 int v3; // [sp+50h] [bp-4h]@5 fun_drawDialogBackground(screen_640x480_x + 96, screen_640x480_y + 80, 18, 14); if ( mouseover_button_id == 1 ) v2 = 1; else v2 = 2; fun_drawSmallGreyButton(4, screen_640x480_x + 144, screen_640x480_y + 232, 12, 0, v2); if ( mouseover_button_id == 2 ) v3 = 1; else v3 = 2; fun_drawSmallGreyButton(4, screen_640x480_x + 144, screen_640x480_y + 262, 12, 0, v3); fun_drawGameTextCentered(45, 0, screen_640x480_x + 128, screen_640x480_y + 92, 224, graphic_font + 670, 0); if ( mouseover_button_id == 1 ) v0 = -1343; else v0 = 703; fun_drawGameTextCentered(45, 4, screen_640x480_x + 128, screen_640x480_y + 236, 224, graphic_font + 1072, v0); if ( mouseover_button_id == 2 ) v1 = -1343; else v1 = 703; fun_drawGameTextCentered(45, 1, screen_640x480_x + 128, screen_640x480_y + 266, 224, graphic_font + 1072, v1); fun_drawGameText(45, 2, screen_640x480_x + 144, screen_640x480_y + 146, graphic_font, 0); drawNumber(setting_speed_game, 64, "%", screen_640x480_x + 296, screen_640x480_y + 146, graphic_font, 0); fun_drawGameText(45, 3, screen_640x480_x + 144, screen_640x480_y + 182, graphic_font, 0); drawNumber(setting_speed_scroll, 64, "%", screen_640x480_x + 296, screen_640x480_y + 182, graphic_font, 0); fun_resetClipRegionOptionsDialog(); button_something_4 = 50; } void fun_drawSoundOptionsDialog() { int v0; // [sp+4Ch] [bp-Ch]@26 int v1; // [sp+4Ch] [bp-Ch]@29 int v2; // [sp+4Ch] [bp-Ch]@32 int v3; // [sp+4Ch] [bp-Ch]@35 __int16 v4; // [sp+50h] [bp-8h]@20 __int16 v5; // [sp+50h] [bp-8h]@23 int v6; // [sp+54h] [bp-4h]@2 int v7; // [sp+54h] [bp-4h]@5 int v8; // [sp+54h] [bp-4h]@8 int v9; // [sp+54h] [bp-4h]@11 int v10; // [sp+54h] [bp-4h]@14 int v11; // [sp+54h] [bp-4h]@17 fun_drawDialogBackground(screen_640x480_x + 48, screen_640x480_y + 80, 24, 18); if ( mouseover_button_id == 1 ) v6 = 1; else v6 = 2; fun_drawSmallGreyButton(3, screen_640x480_x + 64, screen_640x480_y + 162, 14, 0, v6); if ( mouseover_button_id == 2 ) v7 = 1; else v7 = 2; fun_drawSmallGreyButton(3, screen_640x480_x + 64, screen_640x480_y + 192, 14, 0, v7); if ( mouseover_button_id == 3 ) v8 = 1; else v8 = 2; fun_drawSmallGreyButton(3, screen_640x480_x + 64, screen_640x480_y + 222, 14, 0, v8); if ( mouseover_button_id == 4 ) v9 = 1; else v9 = 2; fun_drawSmallGreyButton(3, screen_640x480_x + 64, screen_640x480_y + 252, 14, 0, v9); if ( mouseover_button_id == 5 ) v10 = 1; else v10 = 2; fun_drawSmallGreyButton(3, screen_640x480_x + 144, screen_640x480_y + 296, 12, 0, v10); if ( mouseover_button_id == 6 ) v11 = 1; else v11 = 2; fun_drawSmallGreyButton(3, screen_640x480_x + 144, screen_640x480_y + 326, 12, 0, v11); fun_drawGameTextCentered(46, 0, screen_640x480_x + 96, screen_640x480_y + 92, 288, graphic_font + 670, 0); if ( mouseover_button_id == 5 ) v4 = -1343; else v4 = 703; fun_drawGameTextCentered(46, 12, screen_640x480_x + 128, screen_640x480_y + 300, 224, graphic_font + 1072, v4); if ( mouseover_button_id == 6 ) v5 = -1343; else v5 = 703; fun_drawGameTextCentered(46, 9, screen_640x480_x + 128, screen_640x480_y + 330, 224, graphic_font + 1072, v5); fun_drawGameText(46, 10, screen_640x480_x + 112, screen_640x480_y + 142, graphic_font + 938, 0); fun_drawGameText(46, 11, screen_640x480_x + 336, screen_640x480_y + 142, graphic_font + 938, 0); if ( setting_sound_music_on ) v0 = 2; else v0 = 1; fun_drawGameTextCentered(46, v0, screen_640x480_x + 64, screen_640x480_y + 166, 224, graphic_font + 1072, 0); drawNumber(setting_sound_music_pct, 64, "%", screen_640x480_x + 374, screen_640x480_y + 166, graphic_font, 0); if ( setting_sound_speech_on ) v1 = 4; else v1 = 3; fun_drawGameTextCentered(46, v1, screen_640x480_x + 64, screen_640x480_y + 196, 224, graphic_font + 1072, 0); drawNumber(setting_sound_speech_pct, 64, "%", screen_640x480_x + 374, screen_640x480_y + 196, graphic_font, 0); if ( setting_sound_effects_on ) v2 = 6; else v2 = 5; fun_drawGameTextCentered(46, v2, screen_640x480_x + 64, screen_640x480_y + 226, 224, graphic_font + 1072, 0); drawNumber(setting_sound_effects_pct, 64, "%", screen_640x480_x + 374, screen_640x480_y + 226, graphic_font, 0); if ( setting_sound_city_on ) v3 = 8; else v3 = 7; fun_drawGameTextCentered(46, v3, screen_640x480_x + 64, screen_640x480_y + 256, 224, graphic_font + 1072, 0); drawNumber(setting_sound_city_pct, 64, "%", screen_640x480_x + 374, screen_640x480_y + 256, graphic_font, 0); fun_resetClipRegionOptionsDialog(); button_something_3 = 50; } // 60872C: using guessed type int button_something_3; // 65E70B: using guessed type char setting_sound_effects_on; // 65E70C: using guessed type char setting_sound_music_on; // 65E70D: using guessed type char setting_sound_speech_on; // 65E768: using guessed type char setting_sound_city_on; // 6E6BD0: using guessed type __int16 graphic_font; // 9D7B28: using guessed type int mouseover_button_id; //----- (00523420) -------------------------------------------------------- void fun_drawDialogFileSavedGame() { char str; // [sp+4Ch] [bp-10Ch]@11 int i; // [sp+150h] [bp-8h]@6 int fontId; // [sp+154h] [bp-4h]@9 imagebuttons_redraw = 1; fun_drawDialogBackground(screen_640x480_x + 128, screen_640x480_y + 40, 24, 21); fun_drawSunkenTextBox(screen_640x480_x + 144, screen_640x480_y + 80, 20, 2); fun_drawSunkenTextBox(screen_640x480_x + 144, screen_640x480_y + 120, 20, 13); if ( byte_6ADD0C ) { --byte_6ADD0C; fun_drawGameTextCentered(43, 2, screen_640x480_x + 160, screen_640x480_y + 50, 304, graphic_font + 670, -2048); } else { if ( byte_7E1EF9 == 2 ) fun_drawGameTextCentered(43, 6, screen_640x480_x + 160, screen_640x480_y + 50, 304, graphic_font + 670, -1); else fun_drawGameTextCentered( 43, byte_7E1EF9, screen_640x480_x + 160, screen_640x480_y + 50, 304, graphic_font + 670, -1); } fun_drawGameText(43, 5, screen_640x480_x + 224, screen_640x480_y + 342, graphic_font + 134, -2048); for ( i = 1; i <= 12; ++i ) { if ( mouseover_button_id == i ) fontId = graphic_font + 268; else fontId = graphic_font + 1072; strcpy(&str, &findfiles_filenames[65 * (filelist_scrollPosition + i - 1)]); fun_removeFileExtension(&str); fun_drawText(&str, screen_640x480_x + 160, screen_640x480_y + 16 * (i - 1) + 130, fontId, 0); } fun_drawImageButtonCollection(screen_640x480_x, screen_640x480_y, &imagebuttons_fileSavedGame, 4); sub_4CBDD0(); fun_drawText(current_saveFilename, screen_640x480_x + 160, screen_640x480_y + 90, graphic_font + 268, 0); fun_drawTextCursor(screen_640x480_x + 160, screen_640x480_y + 91, 65535); fun_drawScrollbarDot(); } // 660905: using guessed type char imagebuttons_redraw; // 6ADD0C: using guessed type char byte_6ADD0C; // 6E6BD0: using guessed type __int16 graphic_font; // 7E1EF9: using guessed type char byte_7E1EF9; // 9D7B28: using guessed type int mouseover_button_id; //----- (005237B0) -------------------------------------------------------- void fun_drawDialogFileScenario() { char str; // [sp+4Ch] [bp-10Ch]@6 int i; // [sp+150h] [bp-8h]@1 int fontId; // [sp+154h] [bp-4h]@4 imagebuttons_redraw = 1; fun_drawDialogBackground(screen_640x480_x + 128, screen_640x480_y + 40, 24, 21); fun_drawSunkenTextBox(screen_640x480_x + 144, screen_640x480_y + 80, 20, 2); fun_drawSunkenTextBox(screen_640x480_x + 144, screen_640x480_y + 120, 20, 13); fun_drawGameTextCentered( 43, byte_7E1EF9 + 3, screen_640x480_x + 128, screen_640x480_y + 50, 304, graphic_font + 670, -1); fun_drawGameText(43, 5, screen_640x480_x + 224, screen_640x480_y + 342, graphic_font + 134, -2048); for ( i = 1; i <= 12; ++i ) { if ( mouseover_button_id == i ) fontId = graphic_font + 268; else fontId = graphic_font + 1072; strcpy(&str, &findfiles_filenames[65 * (filelist_scrollPosition + i - 1)]); fun_removeFileExtension(&str); fun_drawText(&str, screen_640x480_x + 160, screen_640x480_y + 16 * (i - 1) + 130, fontId, 0); } fun_drawImageButtonCollection(screen_640x480_x, screen_640x480_y, &imagebuttons_fileScenario, 4); sub_4CBDD0(); fun_drawText(currentScenarioFilename, screen_640x480_x + 160, screen_640x480_y + 90, graphic_font + 268, 0); fun_drawTextCursor(screen_640x480_x + 160, screen_640x480_y + 91, 65535); fun_drawScrollbarDot(); } // 660905: using guessed type char imagebuttons_redraw; // 6E6BD0: using guessed type __int16 graphic_font; // 7E1EF9: using guessed type char byte_7E1EF9; // 9D7B28: using guessed type int mouseover_button_id; //----- (00523A70) -------------------------------------------------------- void fun_drawScrollbarDot() { int yOffset_small; // ST58_4@9 int yOffset_large; // ST58_4@17 int percentageFromTop_small; // [sp+54h] [bp-8h]@5 int percentageFromTop_large; // [sp+54h] [bp-8h]@13 if ( scrollbar_file_isLarge ) { if ( filelist_numFiles - 15 > 0 ) { if ( filelist_scrollPosition > 0 ) { if ( filelist_scrollPosition + 15 < filelist_numFiles ) percentageFromTop_large = getPercentage(filelist_scrollPosition, filelist_numFiles - 15); else percentageFromTop_large = 100; } else { percentageFromTop_large = 0; } yOffset_large = fun_adjustWithPercentage(164, percentageFromTop_large); drawGraphic(graphic_buttons + 39, screen_640x480_x + 284, screen_640x480_y + yOffset_large + 245); } } else { if ( filelist_numFiles - 12 > 0 ) { if ( filelist_scrollPosition > 0 ) { if ( filelist_scrollPosition + 12 < filelist_numFiles ) percentageFromTop_small = getPercentage(filelist_scrollPosition, filelist_numFiles - 12); else percentageFromTop_small = 100; } else { percentageFromTop_small = 0; } yOffset_small = fun_adjustWithPercentage(130, percentageFromTop_small); drawGraphic(graphic_buttons + 39, screen_640x480_x + 472, screen_640x480_y + yOffset_small + 145); } } } // 6E6BCE: using guessed type __int16 graphic_buttons; // 9DA86C: using guessed type int scrollbar_file_isLarge; // 9DA8C0: using guessed type int filelist_numFiles; //----- (00523C30) -------------------------------------------------------- void fun_editor_drawMainDialog() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@14 int v4; // [sp+4Ch] [bp-Ch]@17 int v5; // [sp+4Ch] [bp-Ch]@23 int v6; // [sp+4Ch] [bp-Ch]@26 int v7; // [sp+4Ch] [bp-Ch]@29 int v8; // [sp+4Ch] [bp-Ch]@32 int v9; // [sp+4Ch] [bp-Ch]@35 int v10; // [sp+50h] [bp-8h]@1 int v11; // [sp+54h] [bp-4h]@1 v11 = screen_640x480_x + 12; v10 = screen_640x480_y + 40; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y + 28, 30, 28); sub_4CBDD0(); fun_drawSunkenTextBox(v11 + 97, v10, 18, 2); fun_drawTextCentered(map_briefDescription, v11 + 100, v10 + 10, 280, graphic_font + 268, 0); fun_drawTextCursor(v11 + draw_centeredTextOffset + 100, v10 + 10, 65535); v0 = mouseover_button_id == 1; fun_drawBorderedButton(1, v11 + 200, v10 + 36, 250, 30, v0); fun_drawGameTextCentered(44, 88, v11 + 200, v10 + 45, 250, graphic_font + 134, 0); fun_drawGameText(44, 76, v11 + 20, v10 + 85, graphic_font, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(1, v11 + 200, v10 + 76, 250, 30, v1); fun_drawGameTextCentered(44, map_climate + 77, v11 + 200, v10 + 85, 250, graphic_font + 134, 0); fun_drawGameText(44, 40, v11 + 20, v10 + 125, graphic_font, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(1, v11 + 200, v10 + 116, 250, 30, v2); if ( map_requests_good[0] ) { fun_drawGameYearWithBcAd( 1, map_requests_year[0] + map_settings_startYear, v11 + 210, v10 + 125, graphic_font + 134, 0); text_xoffset = 0; drawNumber(map_requests_amount[0], 64, " ", v11 + text_xoffset + 300, v10 + 125, graphic_font + 134, 0); fun_drawGameText(23, map_requests_good[0], v11 + text_xoffset + 300, v10 + 125, graphic_font + 134, 0); } else { fun_drawGameTextCentered(44, 19, v11 + 200, v10 + 125, 250, graphic_font + 134, 0); } fun_drawGameText(44, 41, v11 + 20, v10 + 165, graphic_font, 0); v3 = mouseover_button_id == 4; fun_drawBorderedButton(1, v11 + 200, v10 + 156, 250, 30, v3); fun_drawGameTextCentered(37, map_enemy, v11 + 200, v10 + 165, 250, graphic_font + 134, 0); fun_drawGameText(44, 42, v11 + 20, v10 + 205, graphic_font, 0); v4 = mouseover_button_id == 5; fun_drawBorderedButton(1, v11 + 200, v10 + 196, 250, 30, v4); if ( map_invasions_type[0] ) { fun_drawGameYearWithBcAd( 1, map_invasions_year[0] + map_settings_startYear, v11 + 204, v10 + 205, graphic_font + 134, 0); text_xoffset = 0; drawNumber(map_invasions_amount[0], 64, " ", v11 + text_xoffset + 290, v10 + 205, graphic_font + 134, 0); fun_drawGameText(34, map_invasions_type[0], v11 + text_xoffset + 290, v10 + 205, graphic_font + 134, 0); } else { fun_drawGameTextCentered(44, 20, v11 + 200, v10 + 205, 250, graphic_font + 134, 0); } v5 = mouseover_button_id == 6; fun_drawBorderedButton(1, v11 + 200, v10 + 236, 250, 30, v5); fun_drawGameTextCentered(44, 44, v11 + 200, v10 + 245, 250, graphic_font + 134, 0); v6 = mouseover_button_id == 7; fun_drawBorderedButton(1, v11 + 200, v10 + 276, 250, 30, v6); fun_drawGameTextCentered(44, 45, v11 + 200, v10 + 285, 250, graphic_font + 134, 0); v7 = mouseover_button_id == 8; fun_drawBorderedButton(1, v11 + 200, v10 + 316, 250, 30, v7); fun_drawGameTextCentered(44, 49, v11 + 200, v10 + 325, 250, graphic_font + 134, 0); v8 = mouseover_button_id == 9; fun_drawBorderedButton(1, v11 + 200, v10 + 356, 250, 30, v8); fun_drawGameTextCentered(44, 94, v11 + 200, v10 + 365, 250, graphic_font + 134, 0); v9 = mouseover_button_id == 10; fun_drawBorderedButton(1, v11 + 200, v10 + 396, 250, 30, v9); fun_drawGameTextCentered(44, 95, v11 + 200, v10 + 405, 250, graphic_font + 134, 0); fun_drawBorderedButton(1, v11 + 6, v10 + 238, 184, 144, 0); drawGraphic(map_image + word_6E6D9E, v11 + 8, v10 + 240); } // 6ADCDC: using guessed type int draw_centeredTextOffset; // 6E6BD0: using guessed type __int16 graphic_font; // 6E6D9E: using guessed type __int16 word_6E6D9E; // 7E2724: using guessed type int text_xoffset; // 990620: using guessed type __int16 map_settings_startYear; // 99079C: using guessed type __int16 map_enemy; // 990A12: using guessed type __int16 map_image; // 990CC8: using guessed type char map_climate; // 9D7B28: using guessed type int mouseover_button_id; //----- (00524600) -------------------------------------------------------- void fun_editor_drawStartingConditionsDialog() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@11 int v4; // [sp+4Ch] [bp-Ch]@14 int v5; // [sp+4Ch] [bp-Ch]@17 int v6; // [sp+4Ch] [bp-Ch]@20 int v7; // [sp+4Ch] [bp-Ch]@23 int v8; // [sp+4Ch] [bp-Ch]@26 int v9; // [sp+50h] [bp-8h]@1 int v10; // [sp+54h] [bp-4h]@1 v10 = screen_640x480_x + 12; v9 = screen_640x480_y + 40; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y + 28, 30, 28); fun_drawGameText(44, 88, v10 + 20, v9 + 5, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v10, v9 + 408, 480, graphic_font + 134, 0); fun_drawGameText(44, 108, v10 + 20, v9 + 45, graphic_font, 0); v0 = mouseover_button_id == 9; fun_drawBorderedButton(1, v10 + 300, v9 + 36, 150, 30, v0); fun_drawGameTextCentered(32, map_playerRank[0], v10 + 300, v9 + 45, 150, graphic_font + 134, 0); fun_drawGameText(44, 89, v10 + 20, v9 + 85, graphic_font, 0); v1 = mouseover_button_id == 1; fun_drawBorderedButton(1, v10 + 300, v9 + 76, 150, 30, v1); fun_drawGameYearWithBcAd(0, map_settings_startYear, v10 + 302, v9 + 79, graphic_font + 670, 0); fun_drawGameText(44, 39, v10 + 20, v9 + 125, graphic_font, 0); v2 = mouseover_button_id == 2; fun_drawBorderedButton(1, v10 + 300, v9 + 116, 150, 30, v2); fun_drawNumberCentered(map_startFunds, 64, " ", v10 + 300, v9 + 125, 150, graphic_font + 134, 0); fun_drawGameText(44, 68, v10 + 20, v9 + 165, graphic_font, 0); v3 = mouseover_button_id == 3; fun_drawBorderedButton(1, v10 + 300, v9 + 156, 150, 30, v3); fun_drawNumberCentered(map_rescueLoan, 64, " ", v10 + 300, v9 + 165, 150, graphic_font + 134, 0); fun_drawGameText(44, 43, v10 + 20, v9 + 205, graphic_font, 0); v4 = mouseover_button_id == 4; fun_drawBorderedButton(1, v10 + 300, v9 + 196, 150, 30, v4); fun_drawGameTextCentered(18, map_romeSuppliesWheat, v10 + 300, v9 + 205, 150, graphic_font + 134, 0); fun_drawGameText(44, 80, v10 + 20, v9 + 245, graphic_font, 0); v5 = mouseover_button_id == 5; fun_drawBorderedButton(1, v10 + 300, v9 + 236, 150, 30, v5); fun_drawGameTextCentered(18, map_flotsam, v10 + 300, v9 + 245, 150, graphic_font + 134, 0); fun_drawGameText(44, 91, v10 + 20, v9 + 285, graphic_font, 0); v6 = mouseover_button_id == 6; fun_drawBorderedButton(1, v10 + 300, v9 + 276, 150, 30, v6); text_xoffset = 0; drawNumber(map_milestone25[0], 43, " ", v10 + 315, v9 + 287, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_milestone25[0] + map_settings_startYear, v10 + text_xoffset + 325, v9 + 287, graphic_font + 938, 0); fun_drawGameText(44, 92, v10 + 20, v9 + 325, graphic_font, 0); v7 = mouseover_button_id == 7; fun_drawBorderedButton(1, v10 + 300, v9 + 316, 150, 30, v7); text_xoffset = 0; drawNumber(map_milestone50, 43, " ", v10 + 315, v9 + 327, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_milestone50 + map_settings_startYear, v10 + text_xoffset + 325, v9 + 327, graphic_font + 938, 0); fun_drawGameText(44, 93, v10 + 20, v9 + 365, graphic_font, 0); v8 = mouseover_button_id == 8; fun_drawBorderedButton(1, v10 + 300, v9 + 356, 150, 30, v8); text_xoffset = 0; drawNumber(map_milestone75, 43, " ", v10 + 315, v9 + 367, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_milestone75 + map_settings_startYear, v10 + text_xoffset + 325, v9 + 367, graphic_font + 938, 0); } // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 990620: using guessed type __int16 map_settings_startYear; // 990A16: using guessed type __int16 map_playerRank[]; // 990CB0: using guessed type int map_milestone25[]; // 990CC9: using guessed type char map_flotsam; // 9D7B28: using guessed type int mouseover_button_id; //----- (00524EE0) -------------------------------------------------------- void fun_editor_drawAllowedBuildingsDialog() { int i; // [sp+4Ch] [bp-18h]@1 int v1; // [sp+50h] [bp-14h]@9 int v2; // [sp+54h] [bp-10h]@4 signed int v3; // [sp+58h] [bp-Ch]@4 int v4; // [sp+5Ch] [bp-8h]@1 int v5; // [sp+60h] [bp-4h]@1 v5 = screen_640x480_x + 16; v4 = screen_640x480_y + 32; fun_drawDialogBackground(screen_640x480_x + 16, screen_640x480_y + 32, 38, 26); fun_drawGameText(44, 47, v5 + 10, v4 + 10, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v5, v4 + 392, 608, graphic_font + 134, 0); for ( i = 1; i <= 48; ++i ) { if ( i > 16 ) { if ( i > 32 ) { v3 = 407; v2 = 20 * (i - 33) + 50; } else { v3 = 208; v2 = 20 * (i - 17) + 50; } } else { v3 = 9; v2 = 20 * (i - 1) + 50; } if ( mouseover_button_id == i ) v1 = 64193; else v1 = 0; fun_drawRect(v3 + v5, v2 + v4, 190, 18, v1); if ( map_allowedBuildings[i] ) fun_drawGameTextCentered(67, i, v3 + v5, v4 + v2 + 4, 190, graphic_font + 134, 0); else fun_drawGameTextCentered(67, i, v3 + v5, v4 + v2 + 4, 190, graphic_font, -2048); } } // 6E6BD0: using guessed type __int16 graphic_font; // 9D7B28: using guessed type int mouseover_button_id; //----- (00525110) -------------------------------------------------------- void fun_editor_drawWinCriteriaDialog() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@14 int v4; // [sp+4Ch] [bp-Ch]@17 int v5; // [sp+4Ch] [bp-Ch]@23 int v6; // [sp+4Ch] [bp-Ch]@26 int v7; // [sp+4Ch] [bp-Ch]@32 int v8; // [sp+4Ch] [bp-Ch]@35 int v9; // [sp+4Ch] [bp-Ch]@41 int v10; // [sp+4Ch] [bp-Ch]@44 int v11; // [sp+4Ch] [bp-Ch]@50 int v12; // [sp+4Ch] [bp-Ch]@53 int v13; // [sp+4Ch] [bp-Ch]@59 int v14; // [sp+4Ch] [bp-Ch]@62 int v15; // [sp+4Ch] [bp-Ch]@68 int v16; // [sp+50h] [bp-8h]@1 int v17; // [sp+54h] [bp-4h]@1 v17 = screen_640x480_x + 16; v16 = screen_640x480_y + 32; fun_drawDialogBackground(screen_640x480_x + 16, screen_640x480_y + 32, 38, 26); fun_drawGameText(44, 48, v17 + 10, v16 + 10, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v17, v16 + 392, 608, graphic_font + 134, 0); fun_drawGameText(44, 107, v17 + 50, v16 + 69, graphic_font, 0); v0 = mouseover_button_id == 15; fun_drawBorderedButton(0, v17 + 300, v16 + 60, 80, 30, v0); fun_drawGameTextCentered(18, map_isOpenPlay, v17 + 300, v16 + 69, 80, graphic_font + 134, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, v17 + 400, v16 + 60, 180, 30, v1); fun_drawNumberCentered( map_openPlayScenId, 64, " ", v17 + 400, v16 + 69, 180, graphic_font + 134, 0); fun_drawGameText(44, 50, v17 + 50, v16 + 109, graphic_font, 0); v2 = mouseover_button_id == 1; fun_drawBorderedButton(0, v17 + 300, v16 + 100, 80, 30, v2); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 109, 80, graphic_font + 134, 0); else fun_drawGameTextCentered( 18, map_win_culture_on[0], v17 + 300, v16 + 109, 80, graphic_font + 134, 0); v3 = mouseover_button_id == 2; fun_drawBorderedButton(0, v17 + 400, v16 + 100, 180, 30, v3); fun_drawNumberCentered(map_win_culture[0], 64, " ", v17 + 400, v16 + 109, 180, graphic_font + 134, 0); fun_drawGameText(44, 51, v17 + 50, v16 + 149, graphic_font, 0); v4 = mouseover_button_id == 3; fun_drawBorderedButton(0, v17 + 300, v16 + 140, 80, 30, v4); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 149, 80, graphic_font + 134, 0); else fun_drawGameTextCentered( 18, map_win_prosperity_on, v17 + 300, v16 + 149, 80, graphic_font + 134, 0); v5 = mouseover_button_id == 4; fun_drawBorderedButton(0, v17 + 400, v16 + 140, 180, 30, v5); fun_drawNumberCentered(map_win_prosperity, 64, " ", v17 + 400, v16 + 149, 180, graphic_font + 134, 0); fun_drawGameText(44, 52, v17 + 50, v16 + 189, graphic_font, 0); v6 = mouseover_button_id == 5; fun_drawBorderedButton(0, v17 + 300, v16 + 180, 80, 30, v6); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 189, 80, graphic_font + 134, 0); else fun_drawGameTextCentered(18, map_win_peace_on, v17 + 300, v16 + 189, 80, graphic_font + 134, 0); v7 = mouseover_button_id == 6; fun_drawBorderedButton(0, v17 + 400, v16 + 180, 180, 30, v7); fun_drawNumberCentered(map_win_peace, 64, " ", v17 + 400, v16 + 189, 180, graphic_font + 134, 0); fun_drawGameText(44, 53, v17 + 50, v16 + 229, graphic_font, 0); v8 = mouseover_button_id == 7; fun_drawBorderedButton(0, v17 + 300, v16 + 220, 80, 30, v8); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 229, 80, graphic_font + 134, 0); else fun_drawGameTextCentered(18, map_win_favor_on, v17 + 300, v16 + 229, 80, graphic_font + 134, 0); v9 = mouseover_button_id == 8; fun_drawBorderedButton(0, v17 + 400, v16 + 220, 180, 30, v9); fun_drawNumberCentered(map_win_favor, 64, " ", v17 + 400, v16 + 229, 180, graphic_font + 134, 0); fun_drawGameText(44, 54, v17 + 50, v16 + 269, graphic_font, 0); v10 = mouseover_button_id == 9; fun_drawBorderedButton(0, v17 + 300, v16 + 260, 80, 30, v10); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 269, 80, graphic_font + 134, 0); else fun_drawGameTextCentered(18, map_win_timeLimitYears_on, v17 + 300, v16 + 269, 80, graphic_font + 134, 0); v11 = mouseover_button_id == 10; fun_drawBorderedButton(0, v17 + 400, v16 + 260, 180, 30, v11); text_xoffset = 0; drawNumber(map_win_timeLimitYears, 43, " ", v17 + text_xoffset + 420, v16 + 269, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_win_timeLimitYears + map_settings_startYear, v17 + text_xoffset + 430, v16 + 269, graphic_font + 134, 0); fun_drawGameText(44, 55, v17 + 50, v16 + 309, graphic_font, 0); v12 = mouseover_button_id == 11; fun_drawBorderedButton(0, v17 + 300, v16 + 300, 80, 30, v12); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 309, 80, graphic_font + 134, 0); else fun_drawGameTextCentered(18, map_win_survivalYears_on, v17 + 300, v16 + 309, 80, graphic_font + 134, 0); v13 = mouseover_button_id == 12; fun_drawBorderedButton(0, v17 + 400, v16 + 300, 180, 30, v13); text_xoffset = 0; drawNumber(map_win_survivalYears, 43, " ", v17 + text_xoffset + 420, v16 + 309, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_win_survivalYears + map_settings_startYear, v17 + text_xoffset + 430, v16 + 309, graphic_font + 134, 0); fun_drawGameText(44, 56, v17 + 50, v16 + 349, graphic_font, 0); v14 = mouseover_button_id == 13; fun_drawBorderedButton(0, v17 + 300, v16 + 340, 80, 30, v14); if ( map_isOpenPlay ) fun_drawGameTextCentered(18, 0, v17 + 300, v16 + 349, 80, graphic_font + 134, 0); else fun_drawGameTextCentered(18, map_win_population_flag, v17 + 300, v16 + 349, 80, graphic_font + 134, 0); v15 = mouseover_button_id == 14; fun_drawBorderedButton(0, v17 + 400, v16 + 340, 180, 30, v15); fun_drawNumberCentered(map_win_population, 64, " ", v17 + 400, v16 + 349, 180, graphic_font + 134, 0); } // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 990620: using guessed type __int16 map_settings_startYear; // 990A14: using guessed type __int16 map_isOpenPlay; // 990C44: using guessed type int map_win_culture[]; // 990C55: using guessed type char map_win_prosperity_on; // 990C56: using guessed type char map_win_peace_on; // 990C57: using guessed type char map_win_favor_on; // 990CD6: using guessed type char map_openPlayScenId; // 9D7B28: using guessed type int mouseover_button_id; //----- (00525FA0) -------------------------------------------------------- void fun_drawCitySidepanelEditorConsole() { int v0; // [sp+4Ch] [bp-1Ch]@45 int v1; // [sp+50h] [bp-18h]@38 int v2; // [sp+54h] [bp-14h]@31 signed int v3; // [sp+58h] [bp-10h]@31 signed int v4; // [sp+58h] [bp-10h]@38 signed int v5; // [sp+58h] [bp-10h]@45 __int16 color; // [sp+5Ch] [bp-Ch]@2 int v7; // [sp+64h] [bp-4h]@1 v7 = cityscreen_width_withControlpanel + 8; fun_fillRect(cityscreen_width_withControlpanel + 8, 175, 145, 111, 0); fun_drawGameText(49, dword_9DA804, v7 + 2, 177, graphic_font, -1343); if ( dword_9DA804 ) { switch ( dword_9DA804 ) { case 1: color = 0xFAC1u; break; case 2: color = 0xFAC1u; break; case 4: color = 0xFAC1u; break; case 5: color = 0xFAC1u; break; case 6: color = 0xFAC1u; break; case 11: color = 0xFAC1u; break; case 12: color = 0xFAC1u; break; default: color = 0x4208u; break; } } else { color = 0xFAC1u; } fun_drawGameText(48, dword_9DA87C, v7 + 2, 193, graphic_font, color); if ( map_event_earthquake_severity ) { if ( map_earthquake_x != -1 && map_earthquake_y != -1 ) fun_drawGameText(44, 58, v7 + 2, 211, graphic_font, 0x7E0u); else fun_drawGameText(44, 57, v7 + 2, 211, graphic_font, 0xF800u); } if ( map_entry_x[0] != -1 && map_entry_y != -1 ) fun_drawGameText(44, 60, v7 + 2, 225, graphic_font, 0x7E0u); else fun_drawGameText(44, 59, v7 + 2, 225, graphic_font, 0xF800u); if ( map_exit_x != -1 && map_exit_y[0] != -1 ) fun_drawGameText(44, 62, v7 + 2, 239, graphic_font, 0x7E0u); else fun_drawGameText(44, 61, v7 + 2, 239, graphic_font, 0xF800u); v3 = 0; v2 = 0; while ( v3 < 8 ) { if ( map_invasionPoints_x[v3] != -1 ) { if ( map_invasionPoints_y[v3] != -1 ) ++v2; } ++v3; } v4 = 0; v1 = 0; while ( v4 < 8 ) { if ( map_fish_x[v4] > 0 ) { if ( map_fish_y[v4] > 0 ) ++v1; } ++v4; } v5 = 0; v0 = 0; while ( v5 < 4 ) { if ( map_herd_x[v5] != -1 ) { if ( map_herd_y[v5] != -1 ) ++v0; } ++v5; } if ( v2 > 0 ) { if ( v2 == 1 ) { fun_drawGameText(44, 64, v7 + 2, 253, graphic_font, 2016); } else { text_xoffset = 0; drawNumber(v2, 64, " ", v7 + 2, 253, graphic_font, 2016); fun_drawGameText(44, 65, v7 + text_xoffset + 2, 253, graphic_font, 2016); } } else { fun_drawGameText(44, 63, v7 + 2, 253, graphic_font, -2048); } if ( map_riverEntry_x != -1 && map_riverEntry_y != -1 ) fun_drawGameText(44, 67, v7 + 2, 267, graphic_font, 2016); else fun_drawGameText(44, 66, v7 + 2, 267, graphic_font, -2048); } // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 990C78: using guessed type __int16 map_earthquake_x; // 990C7A: using guessed type __int16 map_earthquake_y; // 990C7C: using guessed type __int16 map_entry_x[]; // 990C7E: using guessed type __int16 map_entry_y; // 990C80: using guessed type __int16 map_exit_x; // 990C82: using guessed type __int16 map_exit_y[]; // 990CA4: using guessed type __int16 map_riverEntry_x; // 990CA6: using guessed type __int16 map_riverEntry_y; //----- (00526540) -------------------------------------------------------- void fun_editor_drawSpecialEventsDialog() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@11 int v4; // [sp+4Ch] [bp-Ch]@14 int v5; // [sp+4Ch] [bp-Ch]@17 int v6; // [sp+4Ch] [bp-Ch]@20 int v7; // [sp+4Ch] [bp-Ch]@23 int v8; // [sp+4Ch] [bp-Ch]@26 int v9; // [sp+4Ch] [bp-Ch]@29 int v10; // [sp+4Ch] [bp-Ch]@32 int v11; // [sp+4Ch] [bp-Ch]@35 int v12; // [sp+4Ch] [bp-Ch]@38 int v13; // [sp+50h] [bp-8h]@1 int v14; // [sp+54h] [bp-4h]@1 v14 = screen_640x480_x + 16; v13 = screen_640x480_y + 32; fun_drawDialogBackground(screen_640x480_x + 16, screen_640x480_y + 32, 30, 26); fun_drawGameText(38, 0, v14 + 16, v13 + 16, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v14, v13 + 392, 480, graphic_font + 134, 0); fun_drawGameText(38, 11, v14 + 220, v13 + 60, graphic_font + 938, 0); fun_drawGameText(38, 12, v14 + 330, v13 + 60, graphic_font + 938, 0); fun_drawGameText(38, 1, v14 + 20, v13 + 80, graphic_font + 134, 0); v0 = mouseover_button_id == 1; fun_drawBorderedButton(1, v14 + 200, v13 + 74, 100, 24, v0); fun_drawGameTextCentered(40, map_event_earthquake_severity, v14 + 200, v13 + 80, 100, graphic_font + 134, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(1, v14 + 310, v13 + 74, 150, 24, v1); text_xoffset = 0; drawNumber(map_event_earthquake_year, 43, " ", v14 + text_xoffset + 330, v13 + 80, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_event_earthquake_year + map_settings_startYear, v14 + text_xoffset + 340, v13 + 80, graphic_font + 134, 0); fun_drawGameText(38, 2, v14 + 20, v13 + 110, graphic_font + 134, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(1, v14 + 200, v13 + 104, 100, 24, v2); fun_drawGameTextCentered(18, map_event_gladiatorRevolt_on, v14 + 200, v13 + 110, 100, graphic_font + 134, 0); v3 = mouseover_button_id == 4; fun_drawBorderedButton(1, v14 + 310, v13 + 104, 150, 24, v3); text_xoffset = 0; drawNumber(map_event_gladiatorRevolt_year, 43, " ", v14 + text_xoffset + 330, v13 + 110, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_event_gladiatorRevolt_year + map_settings_startYear, v14 + text_xoffset + 340, v13 + 110, graphic_font + 134, 0); fun_drawGameText(38, 3, v14 + 20, v13 + 140, graphic_font + 134, 0); v4 = mouseover_button_id == 5; fun_drawBorderedButton(1, v14 + 200, v13 + 134, 100, 24, v4); fun_drawGameTextCentered(18, map_event_emperorChange_on, v14 + 200, v13 + 140, 100, graphic_font + 134, 0); v5 = mouseover_button_id == 6; fun_drawBorderedButton(1, v14 + 310, v13 + 134, 150, 24, v5); text_xoffset = 0; drawNumber(map_event_emperorChange_year, 43, " ", v14 + text_xoffset + 330, v13 + 140, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 0, map_event_emperorChange_year + map_settings_startYear, v14 + text_xoffset + 340, v13 + 140, graphic_font + 134, 0); fun_drawGameText(38, 4, v14 + 20, v13 + 170, graphic_font + 134, 0); v6 = mouseover_button_id == 7; fun_drawBorderedButton(1, v14 + 200, v13 + 164, 100, 24, v6); fun_drawGameTextCentered(18, map_event_seaTradeProblem, v14 + 200, v13 + 170, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 172, graphic_font + 938, 0); fun_drawGameText(38, 5, v14 + 20, v13 + 200, graphic_font + 134, 0); v7 = mouseover_button_id == 8; fun_drawBorderedButton(1, v14 + 200, v13 + 194, 100, 24, v7); fun_drawGameTextCentered(18, map_event_landTradeProblem, v14 + 200, v13 + 200, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 202, graphic_font + 938, 0); fun_drawGameText(38, 6, v14 + 20, v13 + 230, graphic_font + 134, 0); v8 = mouseover_button_id == 9; fun_drawBorderedButton(1, v14 + 200, v13 + 224, 100, 24, v8); fun_drawGameTextCentered(18, map_event_raiseWages, v14 + 200, v13 + 230, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 232, graphic_font + 938, 0); fun_drawGameText(38, 7, v14 + 20, v13 + 260, graphic_font + 134, 0); v9 = mouseover_button_id == 10; fun_drawBorderedButton(1, v14 + 200, v13 + 254, 100, 24, v9); fun_drawGameTextCentered(18, map_event_lowerWages, v14 + 200, v13 + 260, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 262, graphic_font + 938, 0); fun_drawGameText(38, 8, v14 + 20, v13 + 290, graphic_font + 134, 0); v10 = mouseover_button_id == 11; fun_drawBorderedButton(1, v14 + 200, v13 + 284, 100, 24, v10); fun_drawGameTextCentered(18, map_event_contaminatedWater, v14 + 200, v13 + 290, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 292, graphic_font + 938, 0); fun_drawGameText(38, 9, v14 + 20, v13 + 320, graphic_font + 134, 0); v11 = mouseover_button_id == 12; fun_drawBorderedButton(1, v14 + 200, v13 + 314, 100, 24, v11); fun_drawGameTextCentered(18, map_event_ironMineCollapse, v14 + 200, v13 + 320, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 322, graphic_font + 938, 0); fun_drawGameText(38, 10, v14 + 20, v13 + 350, graphic_font + 134, 0); v12 = mouseover_button_id == 13; fun_drawBorderedButton(1, v14 + 200, v13 + 344, 100, 24, v12); fun_drawGameTextCentered(18, map_event_clayPitFlooded, v14 + 200, v13 + 350, 100, graphic_font + 134, 0); fun_drawGameText(38, 13, v14 + 330, v13 + 352, graphic_font + 938, 0); } // 6E6BD0: using guessed type __int16 graphic_font; // 7E2724: using guessed type int text_xoffset; // 990620: using guessed type __int16 map_settings_startYear; // 9D7B28: using guessed type int mouseover_button_id; //----- (005272C0) -------------------------------------------------------- void fun_editor_drawDemandChangesDialog() { int v0; // esi@14 signed int v1; // eax@14 int v2; // [sp+4Ch] [bp-18h]@10 int v3; // [sp+50h] [bp-14h]@1 int v4; // [sp+54h] [bp-10h]@1 int v5; // [sp+58h] [bp-Ch]@7 int v6; // [sp+5Ch] [bp-8h]@4 signed int i; // [sp+60h] [bp-4h]@1 v4 = screen_640x480_x; v3 = screen_640x480_y; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y, 40, 23); fun_drawGameText(44, 94, v4 + 20, v3 + 14, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v4, v3 + 342, 640, graphic_font + 134, 0); for ( i = 0; i < 20; ++i ) { if ( i < 10 ) v6 = v4 + 20; else v6 = v4 + 320; if ( i < 10 ) v5 = v3 + 30 * i + 42; else v5 = v3 + 30 * (i - 10) + 42; v2 = mouseover_button_id == i + 1; fun_drawBorderedButton(1, v6, v5, 290, 25, v2); if ( map_demandChanges_year[i] > 0 ) { drawNumber(map_demandChanges_year[i], 43, " ", v6 + 10, v5 + 6, graphic_font, 0); fun_drawGameYearWithBcAd( 1, map_demandChanges_year[i] + map_settings_startYear, v6 + 35, v5 + 6, graphic_font, 0); v0 = map_demandChanges_good[i] + graphic_resourceIcons; v1 = fun_getResourceGraphicIdOffset(map_demandChanges_good[i], 3); drawGraphic(v1 + v0, v6 + 115, v5 + 3); text_xoffset = 0; fun_drawGameText(44, 97, v6 + text_xoffset + 140, v5 + 6, graphic_font, 0); drawNumber( map_demandChanges_route[i], 64, " ", v6 + text_xoffset + 140, v5 + 6, graphic_font, 0); if ( map_demandChanges_isRise[i] ) fun_drawGameText(44, 99, v6 + text_xoffset + 140, v5 + 6, graphic_font, 0); else fun_drawGameText(44, 98, v6 + text_xoffset + 140, v5 + 6, graphic_font, 0); } else { fun_drawGameTextCentered(44, 96, v6, v5 + 6, 290, graphic_font, 0); } } } // 6E6BD0: using guessed type __int16 graphic_font; // 6E6CB2: using guessed type __int16 graphic_resourceIcons; // 7E2724: using guessed type int text_xoffset; // 990620: using guessed type __int16 map_settings_startYear; // 9D7B28: using guessed type int mouseover_button_id; //----- (00527680) -------------------------------------------------------- void fun_editor_drawEditDemandChangeDialog() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@11 int v4; // [sp+4Ch] [bp-Ch]@17 int v5; // [sp+4Ch] [bp-Ch]@20 int v6; // [sp+50h] [bp-8h]@1 int v7; // [sp+54h] [bp-4h]@1 v7 = screen_640x480_x; v6 = screen_640x480_y + 100; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y + 100, 38, 11); fun_drawGameText(44, 94, v7 + 20, v6 + 14, graphic_font + 670, 0); v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, v7 + 30, v6 + 52, 60, 25, v0); fun_drawNumberCentered( map_demandChanges_year[editDemandChanges_current], 43, " ", v7 + 30, v6 + 58, 60, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 1, map_demandChanges_year[editDemandChanges_current] + map_settings_startYear, v7 + 100, v6 + 58, graphic_font + 134, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, v7 + 240, v6 + 52, 120, 25, v1); fun_drawGameTextCentered( 23, map_demandChanges_good[editDemandChanges_current], v7 + 240, v6 + 58, 120, graphic_font + 134, 0); fun_drawGameText(44, 97, v7 + 390, v6 + 58, graphic_font + 134, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(0, v7 + 480, v6 + 52, 80, 25, v2); fun_drawNumberCentered( map_demandChanges_route[editDemandChanges_current], 64, " ", v7 + 480, v6 + 58, 80, graphic_font + 134, 0); fun_drawGameText(44, 100, v7 + 60, v6 + 98, graphic_font + 134, 0); v3 = mouseover_button_id == 4; fun_drawBorderedButton(0, v7 + 350, v6 + 92, 100, 25, v3); if ( map_demandChanges_isRise[editDemandChanges_current] ) fun_drawGameTextCentered(44, 99, v7 + 350, v6 + 98, 100, graphic_font + 134, 0); else fun_drawGameTextCentered(44, 98, v7 + 350, v6 + 98, 100, graphic_font + 134, 0); v4 = mouseover_button_id == 5; fun_drawBorderedButton(0, v7 + 30, v6 + 130, 250, 25, v4); fun_drawGameTextCentered(44, 101, v7 + 30, v6 + 136, 250, graphic_font + 134, 0); v5 = mouseover_button_id == 6; fun_drawBorderedButton(0, v7 + 320, v6 + 130, 100, 25, v5); fun_drawGameTextCentered(18, 3, v7 + 320, v6 + 136, 100, graphic_font + 134, 0); } void fun_editor_drawPriceChangesDialog() { int v0; // esi@14 signed int v1; // eax@14 int v2; // [sp+4Ch] [bp-18h]@10 int v3; // [sp+50h] [bp-14h]@1 int v4; // [sp+54h] [bp-10h]@1 int v5; // [sp+58h] [bp-Ch]@7 int v6; // [sp+5Ch] [bp-8h]@4 signed int i; // [sp+60h] [bp-4h]@1 v4 = screen_640x480_x; v3 = screen_640x480_y; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y, 40, 23); fun_drawGameText(44, 95, v4 + 20, v3 + 14, graphic_font + 670, 0); fun_drawGameTextCentered(13, 3, v4, v3 + 342, 640, graphic_font + 134, 0); for ( i = 0; i < 20; ++i ) { if ( i < 10 ) v6 = v4 + 20; else v6 = v4 + 320; if ( i < 10 ) v5 = v3 + 30 * i + 42; else v5 = v3 + 30 * (i - 10) + 42; v2 = mouseover_button_id == i + 1; fun_drawBorderedButton(1, v6, v5, 290, 25, v2); if ( map_priceChanges_year[i] > 0 ) { drawNumber(map_priceChanges_year[i], 43, " ", v6 + 10, v5 + 6, graphic_font, 0); fun_drawGameYearWithBcAd(1, map_priceChanges_year[i] + map_settings_startYear, v6 + 50, v5 + 6, graphic_font, 0); v0 = map_priceChanges_good[i] + graphic_resourceIcons; v1 = fun_getResourceGraphicIdOffset(map_priceChanges_good[i], 3); drawGraphic(v1 + v0, v6 + 130, v5 + 3); text_xoffset = 0; if ( map_priceChanges_isRise[i] ) fun_drawGameText(44, 104, v6 + text_xoffset + 160, v5 + 6, graphic_font, 0); else fun_drawGameText(44, 103, v6 + text_xoffset + 160, v5 + 6, graphic_font, 0); drawNumber( map_priceChanges_amount[i], 64, " ", v6 + text_xoffset + 160, v5 + 6, graphic_font, 0); } else { fun_drawGameTextCentered(44, 102, v6, v5 + 6, 290, graphic_font, 0); } } } void fun_editor_drawEditPriceChangeDialog() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+4Ch] [bp-Ch]@5 int v2; // [sp+4Ch] [bp-Ch]@8 int v3; // [sp+4Ch] [bp-Ch]@14 int v4; // [sp+4Ch] [bp-Ch]@17 int v5; // [sp+4Ch] [bp-Ch]@20 int v6; // [sp+50h] [bp-8h]@1 int v7; // [sp+54h] [bp-4h]@1 v7 = screen_640x480_x; v6 = screen_640x480_y + 100; fun_drawDialogBackground(screen_640x480_x, screen_640x480_y + 100, 38, 11); fun_drawGameText(44, 95, v7 + 20, v6 + 14, graphic_font + 670, 0); v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, v7 + 30, v6 + 52, 60, 25, v0); fun_drawNumberCentered( map_priceChanges_year[editPriceChanges_current], 43, " ", v7 + 30, v6 + 58, 60, graphic_font + 134, 0); fun_drawGameYearWithBcAd( 1, map_priceChanges_year[editPriceChanges_current] + map_settings_startYear, v7 + 100, v6 + 58, graphic_font + 134, 0); v1 = mouseover_button_id == 2; fun_drawBorderedButton(0, v7 + 240, v6 + 52, 120, 25, v1); fun_drawGameTextCentered( 23, map_priceChanges_good[editPriceChanges_current], v7 + 240, v6 + 58, 120, graphic_font + 134, 0); v2 = mouseover_button_id == 3; fun_drawBorderedButton(0, v7 + 100, v6 + 92, 200, 25, v2); if ( map_priceChanges_isRise[editPriceChanges_current] ) fun_drawGameTextCentered(44, 104, v7 + 100, v6 + 98, 200, graphic_font + 134, 0); else fun_drawGameTextCentered(44, 103, v7 + 100, v6 + 98, 200, graphic_font + 134, 0); v3 = mouseover_button_id == 4; fun_drawBorderedButton(0, v7 + 350, v6 + 92, 100, 25, v3); fun_drawNumberCentered( map_priceChanges_amount[editPriceChanges_current], 64, " ", v7 + 350, v6 + 98, 100, graphic_font + 134, 0); v4 = mouseover_button_id == 5; fun_drawBorderedButton(0, v7 + 30, v6 + 130, 250, 25, v4); fun_drawGameTextCentered(44, 105, v7 + 30, v6 + 136, 250, graphic_font + 134, 0); v5 = mouseover_button_id == 6; fun_drawBorderedButton(0, v7 + 320, v6 + 130, 100, 25, v5); fun_drawGameTextCentered(18, 3, v7 + 320, v6 + 136, 100, graphic_font + 134, 0); } void fun_editor_drawSupplyDemandDialog() { int v0; // esi@3 signed int v1; // eax@3 int v2; // esi@11 signed int v3; // eax@11 int v4; // [sp+4Ch] [bp-14h]@4 int v5; // [sp+4Ch] [bp-14h]@12 int v6; // [sp+50h] [bp-10h]@1 int v7; // [sp+54h] [bp-Ch]@1 signed int v8; // [sp+58h] [bp-8h]@6 signed int v9; // [sp+58h] [bp-8h]@14 signed int i; // [sp+5Ch] [bp-4h]@1 signed int j; // [sp+5Ch] [bp-4h]@9 v7 = screen_640x480_x + 16; v6 = screen_640x480_y + 32; fun_drawDialogBackground(screen_640x480_x + 16, screen_640x480_y + 32, 30, 14); fun_drawGameTextCentered(44, 83, v7, v6 + 16, 480, graphic_font + 670, 0); for ( i = 1; i <= 8; ++i ) { v0 = i + graphic_resourceIcons; v1 = fun_getResourceGraphicIdOffset(i, 3); drawGraphic(v1 + v0, v7 + 50 * (i - 1) + 40, v6 + 60); v4 = i == mouseover_button_id; fun_drawBorderedButton(0, v7 + 50 * (i - 1) + 25, v6 + 90, 50, 22, v4); v8 = fun_getEmpireTradeAmountId(currentEmpireEntryId, i); if ( v8 ) fun_drawGameTextCentered(44, v8 + 84, v7 + 50 * (i - 1) + 25, v6 + 96, 50, graphic_font + 938, 0); } for ( j = 9; j <= 15; ++j ) { v2 = j + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(j, 3); drawGraphic(v3 + v2, v7 + 50 * (j - 9) + 40, v6 + 120); v5 = j == mouseover_button_id; fun_drawBorderedButton(0, v7 + 50 * (j - 9) + 25, v6 + 150, 50, 22, v5); v9 = fun_getEmpireTradeAmountId(currentEmpireEntryId, j); if ( v9 ) fun_drawGameTextCentered(44, v9 + 84, v7 + 50 * (j - 9) + 25, v6 + 156, 50, graphic_font + 938, 0); } fun_drawGameTextCentered(13, 1, v7, v6 + 196, 480, graphic_font + 134, 0); } void fun_drawConfirmResolutionDialog() { int v0; // ST70_4@1 int v1; // ST6C_4@1 v0 = screen_640x480_x + 80; v1 = screen_640x480_y + 64; fun_clearScreen(); fun_drawDialogBackground(v0, v1, 30, 10); fun_drawGameTextWrapped(146, 0, v0 + 32, v1 + 30, 416, graphic_font + 134, 0); } void fun_drawConfirmResolutionDialogButtons() { int v0; // [sp+4Ch] [bp-Ch]@2 int v1; // [sp+50h] [bp-8h]@1 int v2; // [sp+54h] [bp-4h]@1 v2 = screen_640x480_x + 80; v1 = screen_640x480_y + 64; v0 = mouseover_button_id == 1; fun_drawBorderedButton(0, screen_640x480_x + 240, screen_640x480_y + 176, 160, 32, v0); fun_drawGameTextCentered(18, 3, v2 + 160, v1 + 123, 160, graphic_font + 134, 0); } void fun_drawDebugInfoPopulation() { int totalPop; // [sp+4Ch] [bp-18h]@8 __int16 color; // [sp+50h] [bp-14h]@6 signed int j; // [sp+5Ch] [bp-8h]@10 signed int i; // [sp+60h] [bp-4h]@3 if ( debug_drawPopInfo == 1 ) { for ( i = 1; i <= 8; ++i ) { color = -1; text_xoffset = 0; if ( city_inform[ciid].byte_6500A2_always1 == 1 ) { text_xoffset = 0; fun_drawText("Pop is ", text_xoffset + 8, 50 * i + 30, graphic_font, -1); drawNumber(city_inform[i].population, 64, " ", text_xoffset + 8, 50 * i + 30, graphic_font, -1); fun_drawText(" tot cap ", text_xoffset + 8, 50 * i + 30, graphic_font, -1); drawNumber( city_inform[i].populationRoomForMax, 64, " ", text_xoffset + 8, 50 * i + 30, graphic_font, -1); fun_drawText(" spare cap ", text_xoffset + 8, 50 * i + 30, graphic_font, -1); drawNumber( city_inform[i].populationCanImmigrate, 64, " ", text_xoffset + 8, 50 * i + 30, graphic_font, -1); text_xoffset = 0; fun_drawText(" births ", text_xoffset + 8, 50 * i + 44, graphic_font, -1); drawNumber(city_inform[i].births, 64, " ", text_xoffset + 8, 50 * i + 44, graphic_font, -1); fun_drawText(" deaths ", text_xoffset + 8, 50 * i + 44, graphic_font, -1); drawNumber(city_inform[i].deaths, 64, " ", text_xoffset + 8, 50 * i + 44, graphic_font, -1); totalPop = fun_calculatePeopleInHousingTypes(ciid); if ( totalPop != city_inform[i].population ) color = 0xF800u; fun_drawText(" in houses ", text_xoffset + 8, 50 * i + 44, graphic_font, color); drawNumber(totalPop, 64, " ", text_xoffset + 8, 50 * i + 44, graphic_font, color); text_xoffset = 0; fun_drawText("nof_docks= ", text_xoffset + 8, 50 * i + 58, graphic_font, -1); drawNumber( city_inform[ciid].numWorkingDocks, 64, " ", text_xoffset + 8, 50 * i + 58, graphic_font, -1); fun_drawText("docks_list= ", text_xoffset + 8, 50 * i + 58, graphic_font, -1); for ( j = 0; j < 10; ++j ) drawNumber( city_inform[ciid].word_654388[j], 64, ", ", text_xoffset + 4, 50 * i + 58, graphic_font, -1); text_xoffset = 0; fun_drawText("wine sources = ", text_xoffset + 8, 50 * i + 72, graphic_font, -1); drawNumber( city_inform[ciid].numWineTypesAvailable[0], 64, " ", text_xoffset + 8, 50 * i + 72, graphic_font, -1); text_xoffset = 0; drawNumber(setting_map_orientation, 64, " MAP ROTATION", text_xoffset + 8, 50 * i + 86, graphic_font, -1); text_xoffset = 0; drawNumber(currentOverlay, 64, " map_style", text_xoffset + 8, 50 * i + 100, graphic_font, -1); text_xoffset = 0; drawNumber( city_inform[ciid].dword_6544B8, 64, " natives_are_restless", text_xoffset + 8, 50 * i + 114, graphic_font, -1); drawNumber( city_inform[ciid].dword_6544C0, 64, " mission_in_place", text_xoffset + 108, 50 * i + 114, graphic_font, -1); text_xoffset = 0; drawNumber(dword_607F5C, 64, " was_in_int", text_xoffset + 8, 50 * i + 128, graphic_font, -1); drawNumber(dword_607F60, 64, " was_in_set", text_xoffset + 108, 50 * i + 128, graphic_font, -1); text_xoffset = 0; drawNumber(playermessageHotspot, 64, " alert_messages", text_xoffset + 8, 50 * i + 142, graphic_font, -1); drawNumber( dword_659F68, 64, " last_alert_message_shown", text_xoffset + 108, 50 * i + 142, graphic_font, -1); text_xoffset = 0; drawNumber( dword_608094, 64, "Auto removed man mades tiles", text_xoffset + 8, 50 * i + 156, graphic_font, -1); text_xoffset = 0; drawNumber(dword_6AD9C0, 64, " test_value1a", text_xoffset + 8, 50 * i + 170, graphic_font, -1); drawNumber(dword_6A1138, 64, " test_value2a", text_xoffset + 108, 50 * i + 170, graphic_font, -1); text_xoffset = 0; drawNumber(dword_6A1148, 64, " test_value3a", text_xoffset + 8, 50 * i + 184, graphic_font, -1); drawNumber(dword_6A1158, 64, " test_value4a", text_xoffset + 108, 50 * i + 184, graphic_font, -1); text_xoffset = 0; drawNumber(mouseclick_x, 64, " mouse_x", text_xoffset + 8, 50 * i + 198, graphic_font, -1); drawNumber(mouseclick_y, 64, " mouse_y", text_xoffset + 108, 50 * i + 198, graphic_font, -1); text_xoffset = 0; drawNumber(mouse_moved, 64, " mouse_movement", text_xoffset + 8, 50 * i + 212, graphic_font, -1); drawNumber( cityscreen_width_withControlpanel, 64, " side_panel_x1", text_xoffset + 108, 50 * i + 212, graphic_font, -1); text_xoffset = 0; drawNumber(dword_9DA918, 64, " building_in_progress", text_xoffset + 8, 50 * i + 226, graphic_font, -1); } } } } void fun_drawDebugInfoEvolve() { __int16 color; // [sp+4Ch] [bp-Ch]@4 int v1; // [sp+50h] [bp-8h]@3 if ( debug_drawEvolveInfo == 1 ) { v1 = 2 * screen_640x480_y + 220; fun_drawDebugInfoBox(6, 0, 2 * screen_640x480_y + 220, 12, 15, 1); fun_drawTextCentered("Evolve info (F3)", 0, v1 + 6, 192, graphic_font + 134, -1); drawNumber(game_ticks, 64, " = tick", 8, v1 + 26, 27, 16122); drawNumber(game_weeks, 64, " = week", 110, v1 + 26, 27, 16122); drawNumber(gametime_month, 64, " = month", 8, v1 + 40, 27, 16122); drawNumber(gametime_year, 64, " = year", 110, v1 + 40, 27, 16122); drawNumber(buildingId_highestInUse, 64, " = last building", 8, v1 + 54, 27, 16122); drawNumber(buildingId_highestInUseEver, 64, " = ever", 110, v1 + 54, 27, 16122); drawNumber(dword_94A2EC - 1, 64, " = no of connects", 8, v1 + 68, 27, 16122); drawNumber(dword_98C480 - 1, 64, " = ever", 110, v1 + 68, 27, 16122); drawNumber(dword_98BF3C, 64, " = total connections", 8, v1 + 96, 27, 16122); if ( dword_98C028 ) color = 0xF800u; else color = 0x3EFAu; drawNumber(dword_98C028, 64, " = evolve error", 8, v1 + 110, 27, color); drawNumber(dword_634468, 64, " = routings", 8, v1 + 124, 27, color); drawNumber(dword_614158, 64, " = barb", 8, v1 + 138, 27, color); } } void fun_drawDebugInfoBuildings() { signed int j; // [sp+50h] [bp-14h]@7 signed int i; // [sp+50h] [bp-14h]@15 signed int v2; // [sp+50h] [bp-14h]@20 int v3; // [sp+54h] [bp-10h]@4 __int16 v4; // [sp+58h] [bp-Ch]@12 int v5; // [sp+5Ch] [bp-8h]@3 if ( debug_drawBuildingInfo == 1 ) { v5 = 2 * screen_640x480_y + 156; fun_drawDebugInfoBox(6, 0, 2 * screen_640x480_y + 156, 12, 19, 1); dword_8C79EC = sub_42DE10(); if ( dword_8C79EC ) v3 = grid_buildingIds[dword_8C79EC]; else v3 = 0; fun_drawTextCentered("Building info (F4)", 0, v5 + 6, 192, graphic_font + 134, -1); if ( v3 ) { if ( buildings[v3].inUse == 1 ) v4 = 16122; else v4 = -2048; drawNumber(v3, 64, " = building no", 8, v5 + 24, 27, v4); drawNumber(buildings[v3].type, 64, " = type", 8, v5 + 60, 27, 16122); drawNumber(buildings[v3].level_resourceId, 64, " = sub_type", 100, v5 + 60, 27, 16122); if ( buildings[v3].type == B_Reservoir ) { text_xoffset = 0; fun_drawText("aqua links", 8, v5 + 72, 27, 16122); for ( i = 0; i < 4; ++i ) drawNumber( *(__int16 *)((char *)&buildings[v3].house_amphiGlad_colo + 2 * i), 64, " ", text_xoffset + 8, v5 + 72, 27, 16122); } else { if ( buildings[v3].type == B_Granary ) { text_xoffset = 0; fun_drawText("food", 8, v5 + 72, 27, 16122); v2 = 0; while ( v2 < 7 ) { drawNumber( buildings[v3].granary_capacity[v2++], 64, " ", text_xoffset + 8, v5 + 72, 27, 16122); text_xoffset -= 4; } } else { if ( buildings[v3].type >= B_WineWorkshop ) { if ( buildings[v3].type <= B_PotteryWorkshop ) { text_xoffset = 0; fun_drawText("raw_materials", 8, v5 + 72, 27, 16122); drawNumber( buildings[v3].industry_unitsStored, 64, " ", text_xoffset + 8, v5 + 72, 27, 16122); } } } } drawNumber(buildings[v3].house_population, 64, " = pop", 8, v5 + 84, 27, 16122); drawNumber(buildings[v3].industry_unitsStored, 64, " = goods", 100, v5 + 84, 27, 16122); drawNumber(buildings[v3].walkerServiceAccess, 64, " = acc", 8, v5 + 96, 27, 16122); drawNumber(buildings[v3].workersEffectivity, 64, " = rel", 100, v5 + 96, 27, 16122); drawNumber(buildings[v3].immigrantId, 64, " = immigrant", 8, v5 + 108, 27, 16122); if ( buildings[v3].laborSeekerId ) { drawNumber(buildings[v3].laborSeekerId, 64, " = SUB agent", 100, v5 + 108, 27, 16122); } else { if ( buildings[v3].walkerId ) drawNumber(buildings[v3].walkerId, 64, " = agent", 100, v5 + 108, 27, 16122); } drawNumber(buildings[v3].haveRomeroad, 64, " = rome", 8, v5 + 120, 27, 16122); drawNumber(buildings[v3].haveRoadnet, 64, " = roadnet", 100, v5 + 120, 27, 16122); drawNumber(buildings[v3].house_roomForPeople, 64, " = spare room", 8, v5 + 132, 27, 16122); drawNumber(buildings[v3].damageRisk, 64, " = damage", 100, v5 + 132, 27, 16122); if (buildings[v3].hasFountain ) { drawNumber( buildings[v3].hasFountain, 64, " = water sup", 8, v5 + 144, 27, 16122); } else { if ( buildings[v3].house_hasWell ) drawNumber( buildings[v3].house_hasWell, 64, " = well sup", 8, v5 + 144, 27, 16122); else drawNumber( buildings[v3].hasFountain, 64, " = no water", 8, v5 + 144, 27, 16122); } drawNumber(buildings[v3].waterDep, 64, " = water dep", 100, v5 + 144, 27, 16122); drawNumber(buildings[v3].noContactWithRome, 64, " = no contact with rome", 8, v5 + 156, 27, 16122); drawNumber(buildings[v3].num_workers, 64, " = employees", 100, v5 + 168, 27, 16122); drawNumber( buildings[v3].house_taxcollector, 64, " = tax cvr", 8, v5 + 180, 27, 16122); drawNumber(buildings[v3].house_maxPopEver, 64, " = max pop", 100, v5 + 180, 27, 16122); if ( buildings[v3].house_size ) { text_xoffset = 0; drawNumber(LOBYTE(buildings[v3].house_theater_amphi_wine), 64, "th", 8, v5 + 192, 27, 16122); text_xoffset = 0; drawNumber(HIBYTE(buildings[v3].house_theater_amphi_wine), 64, ",", 50, v5 + 192, 27, 16122); drawNumber( LOBYTE(buildings[v3].house_amphiGlad_colo), 64, " am", text_xoffset + 50, v5 + 192, 27, 16122); text_xoffset = 0; drawNumber(HIBYTE(buildings[v3].house_amphiGlad_colo), 64, " ", 100, v5 + 192, 27, 16122); drawNumber( LOBYTE(buildings[v3].house_coloLion_hippo), 64, "co", text_xoffset + 100, v5 + 192, 27, 16122); text_xoffset = 0; drawNumber(HIBYTE(buildings[v3].house_coloLion_hippo), 64, "hi", 150, v5 + 192, 27, 16122); drawNumber(buildings[v3].house_entertainment, 64, " en", 8, v5 + 240, 27, 16122); drawNumber(buildings[v3].house_education, 64, " ed", 50, v5 + 240, 27, 16122); drawNumber(buildings[v3].house_health, 64, " he", 100, v5 + 240, 27, 16122); drawNumber(buildings[v3].house_numGods, 64, " re", 150, v5 + 240, 27, 16122); drawNumber( model_houses[buildings[v3].level_resourceId].entertainment, 40, ")", 8, v5 + 252, 27, 16122); drawNumber( model_houses[buildings[v3].level_resourceId].education, 40, ")", 50, v5 + 252, 27, 16122); drawNumber( model_houses[buildings[v3].level_resourceId].religion, 40, ")", 100, v5 + 252, 27, 16122); drawNumber( model_houses[buildings[v3].level_resourceId].health, 40, ")", 150, v5 + 252, 27, 16122); } else { drawNumber(buildings[v3].house_clinic, 64, " shows", 8, v5 + 192, 27, 16122); text_xoffset = 0; drawNumber( buildings[v3].house_bathhouse_dock_numships_entert_days, 64, ", ", text_xoffset + 108, v5 + 192, 27, 16122); drawNumber( buildings[v3].house_hospital_entert_days2, 64, " ", text_xoffset + 108, v5 + 192, 27, 16122); } drawNumber(dword_8C79EC, 64, " = over ptr", 8, v5 + 204, 27, -1); if ( buildings[v3].house_size ) { text_xoffset = 0; drawNumber( buildings[v3].grow_value_house_foodstocks[0], 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_pottery, 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_furniture, 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_oil, 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_wine, 64, " goods", text_xoffset + 8, v5 + 220, 27, 16122); } else { if ( buildings[v3].type == B_Market ) { text_xoffset = 0; drawNumber(buildings[v3].granary_capacity[0], 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_theater_amphi_wine, 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_pottery, 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_furniture, 64, " ,", text_xoffset + 8, v5 + 220, 27, 16122); drawNumber(buildings[v3].house_oil, 64, " goods", text_xoffset + 8, v5 + 220, 27, 16122); } } } else { fun_drawTextCentered("Not over a building", 0, v5 + 120, 192, 27, 16122); drawNumber(dword_8C79EC, 64, " = over ptr", 8, v5 + 140, 27, -1); fun_drawGameTextCentered(16, setting_debug_grid, 8, v5 + 160, 192, 27, -1); drawNumber(dword_9363B0, 64, " = undo_ready", 8, v5 + 180, 27, -1); drawNumber(dword_8E1484, 64, " = undo_valid", 8, v5 + 200, 27, -1); drawNumber(dword_8876B8, 64, " = undo_buildings", 8, v5 + 220, 27, -1); drawNumber(buildings[word_89AAA0[0]].inUse, 64, " = alive", 8, v5 + 240, 27, -1); drawNumber(undoBuildings[0], 64, " = alive", 100, v5 + 240, 27, -1); text_xoffset = 0; for ( j = 0; j < 8; ++j ) drawNumber( *(&byte_614180[dword_8C79EC] + dword_5FFE4C[j]), 64, ",", text_xoffset + 8, v5 + 260, 27, 0x3EFAu); drawNumber(imagebuttons_redraw, 64, " = redraw", 100, v5 + 280, 27, -1); } } } void fun_drawDebugInfoFigures() { int v0; // ST6C_4@8 __int16 v1; // dx@12 __int16 v2; // dx@12 int v3; // [sp+4Ch] [bp-18h]@12 signed int i; // [sp+54h] [bp-10h]@12 __int16 v5; // [sp+58h] [bp-Ch]@10 int v6; // [sp+5Ch] [bp-8h]@3 if ( debug_drawFigureInfo == 1 ) { v6 = 2 * screen_640x480_y + 220; fun_drawDebugInfoBox(6, 0, 2 * screen_640x480_y + 220, 12, 15, 1); dword_8C79EC = sub_42DE10(); if ( dword_8C79EC ) { if ( grid_walkerIds[dword_8C79EC] ) currentWalkerGridId = grid_walkerIds[dword_8C79EC]; } else { currentWalkerGridId = 0; } fun_drawTextCentered("Figure info (F1)", 0, v6 + 6, 192, graphic_font + 134, -1); if ( currentWalkerGridId ) { if ( walkers[currentWalkerGridId].state == 1 ) v5 = 16122; else v5 = -2048; drawNumber(currentWalkerGridId, 64, " = figure no", 8, v6 + 24, 27, v5); drawNumber(walkers[currentWalkerGridId].ruler, 64, " = ruler", 110, v6 + 24, 27, 16122); text_xoffset = 0; drawNumber(walkers[currentWalkerGridId].tilePosition_y, 64, ",", 8, v6 + 48, 27, 16122); drawNumber(walkers[currentWalkerGridId].tilePosition_x, 64, "x,y", text_xoffset + 8, v6 + 48, 27, 16122); text_xoffset = 0; drawNumber(walkers[currentWalkerGridId].x, 64, ",", 100, v6 + 48, 27, 16122); drawNumber(walkers[currentWalkerGridId].y, 64, " map x,y", text_xoffset + 100, v6 + 48, 27, 16122); text_xoffset = 0; v1 = walkers[currentWalkerGridId].tilePosition_y; drawNumber(v1 & 0xF, 64, ",", 8, v6 + 72, 27, 16122); v2 = walkers[currentWalkerGridId].tilePosition_x; drawNumber(v2 & 0xF, 64, "x,y bits", text_xoffset + 8, v6 + 72, 27, 16122); text_xoffset = 0; drawNumber(walkers[currentWalkerGridId].buildingId, 64, " = agent_for ", 8, v6 + 84, 27, 16122); drawNumber( walkers[currentWalkerGridId].migrantDestinationHome, 64, " = immigrant_to ", text_xoffset + 8, v6 + 84, 27, 16122); text_xoffset = 0; drawNumber( walkers[currentWalkerGridId].migrantNumPeopleCarried, 64, " = people ", 8, v6 + 96, 27, 16122); drawNumber( walkers[currentWalkerGridId].reachedLastStep, 64, " = ghost ", text_xoffset + 8, v6 + 96, 27, 16122); v3 = 0; for ( i = 1; i < 1000; ++i ) { if ( walkers[i].state == 1 ) { if ( walkers[i].type== Walker_Dockman ) ++v3; } } drawNumber(v3, 64, " = dockers ", text_xoffset + 8, v6 + 108, 27, 16122); } else { fun_drawTextCentered("Not watching a figure", 0, v6 + 24, 192, graphic_font + 134, -1); drawNumber(debugInfo_numFigures, 64, " Figs", 8, v6 + 48, 27, 16122); drawNumber(walkerId_lastUsed, 64, " = ever", 110, v6 + 48, 27, 16122); v0 = fun_getNumFreeDestinationPaths(); drawNumber(v0, 64, " free route slots", 8, v6 + 60, 27, 16122); } } } void fun_drawDebugInfoNetwork() { int v0; // ST64_4@3 if ( debug_drawNetworkInfo ) { v0 = 2 * screen_640x480_y + 220; fun_drawDebugInfoBox(6, 0, 2 * screen_640x480_y + 220, 12, 15, 1); fun_drawTextCentered("Network info (F2)", 0, v0 + 6, 192, graphic_font + 134, -1); } } void fun_drawTopMenuBackground() { int v0; // [sp+4Ch] [bp-8h]@10 int v1; // [sp+4Ch] [bp-8h]@23 int v2; // [sp+4Ch] [bp-8h]@36 signed int i; // [sp+50h] [bp-4h]@3 signed int j; // [sp+50h] [bp-4h]@7 signed int k; // [sp+50h] [bp-4h]@16 signed int l; // [sp+50h] [bp-4h]@20 signed int m; // [sp+50h] [bp-4h]@29 signed int n; // [sp+50h] [bp-4h]@33 switch ( screen_width ) { case 640: if ( mode_editor == 1 ) { for ( i = 0; i < 25; ++i ) drawGraphic(graphic_buttons_start + i % 8 + 1, 24 * i, 0); drawGraphic(graphic_buttons_start + 9, 600, 0); } else { for ( j = 0; j < 26; ++j ) { v0 = topmenuGraphics640[j].graphicId; if ( v0 != -1 ) drawGraphic(v0 + graphic_buttons_start, topmenuGraphics640[j].xOffset, 0); } } break; case 800: if ( mode_editor == 1 ) { for ( k = 0; k < 32; ++k ) drawGraphic(graphic_buttons_start + k % 8 + 1, 24 * k, 0); drawGraphic(graphic_buttons_start + 10, 24 * k - 32, 0); } else { for ( l = 0; l < 33; ++l ) { v1 = topmenuGraphics800[l].graphicId; if ( v1 != -1 ) drawGraphic(v1 + graphic_buttons_start, topmenuGraphics800[l].xOffset, 0); } } break; case 1024: if ( mode_editor == 1 ) { for ( m = 0; m < 41; ++m ) drawGraphic(graphic_buttons_start + m % 8 + 1, 24 * m, 0); drawGraphic(graphic_buttons_start + 11, 24 * m, 0); } else { for ( n = 0; n < 42; ++n ) { v2 = topmenuGraphics1024[n].graphicId; if ( v2 != -1 ) drawGraphic(v2 + graphic_buttons_start, topmenuGraphics1024[n].xOffset, 0); } } break; } } void fun_drawGreyButton(int a1, int x, int y, int width, int mouseOver) { int v5; // [sp+4Ch] [bp-8h]@5 int i; // [sp+50h] [bp-4h]@8 if ( button_something_0[a1] >= 5 ) { if ( button_something_0[a1] >= 15 ) { v5 = button_something_0[a1] - 13; if ( v5 <= width ) x += 16 * (width - v5) / 2; else v5 = width; for ( i = 0; i < v5; ++i ) { graphic_xOffset = 16 * i + x; graphic_yOffset = y; if ( i ) { if ( i < v5 - 1 ) graphic_currentGraphicId = graphic_buttons + 3 * mouseOver + 1; else graphic_currentGraphicId = graphic_buttons + 3 * mouseOver + 2; } else { graphic_currentGraphicId = 3 * mouseOver + graphic_buttons; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); } } else { graphic_xOffset = dword_5FFF64[3 * (button_something_0[a1] - 5)] + 16 * (width - 2) / 2 + x; graphic_yOffset = dword_5FFF68[3 * (button_something_0[a1] - 5)] + y; drawGraphic( dword_5FFF60[3 * (button_something_0[a1] - 5)] + graphic_buttons + 8 * mouseOver + 24, graphic_xOffset, graphic_yOffset); } } } void unused_drawGildedCorners(int a1, int x, int y, signed int a4, int a5, int a6) { int v6; // ST5C_4@10 signed int v7; // [sp+4Ch] [bp-8h]@4 if ( button_something_0[a1] >= 0 ) { if ( button_something_0[a1] >= a5 ) v7 = (a6 + 2) * (11 - (button_something_0[a1] - a5)) + 16; else v7 = a6 * button_something_0[a1] + 16; if ( v7 > a4 ) v7 = a4; if ( v7 < 0 ) v7 = 0; v6 = x - v7 / 2; drawGraphic(graphic_buttons + 49, x - v7 / 2 - 1, y - 1); drawGraphic(graphic_buttons + 50, v6 + v7 - 7, y - 1); drawGraphic(graphic_buttons + 51, v6 - 1, y + 17); drawGraphic(graphic_buttons + 52, v6 + v7 - 7, y + 17); } } void fun_drawDialogBackground(int xOffset, int yOffset, int widthBlocks, int heightBlocks) { signed int yAdd; // [sp+4Ch] [bp-14h]@28 signed int graphicY; // [sp+50h] [bp-10h]@1 signed int graphicX; // [sp+54h] [bp-Ch]@3 int y; // [sp+58h] [bp-8h]@1 int x; // [sp+5Ch] [bp-4h]@3 y = 0; graphicY = 0; while ( y < heightBlocks ) { x = 0; graphicX = 0; while ( x < widthBlocks ) { graphic_xOffset = 16 * x + xOffset; graphic_yOffset = 16 * y + yOffset; if ( y ) { if ( y < heightBlocks - 1 ) { if ( x ) { if ( x < widthBlocks - 1 ) graphic_currentGraphicId = graphicY + graphic_dialogBackground + graphicX++ + 13; else graphic_currentGraphicId = graphic_dialogBackground + graphicY + 23; } else { graphic_currentGraphicId = graphic_dialogBackground + graphicY + 12; } yAdd = 12; } else { if ( x ) { if ( x < widthBlocks - 1 ) graphic_currentGraphicId = graphic_dialogBackground + graphicX++ + 133; else graphic_currentGraphicId = graphic_dialogBackground + 143; } else { graphic_currentGraphicId = graphic_dialogBackground + 132; } yAdd = 0; } } else { if ( x ) { if ( x < widthBlocks - 1 ) graphic_currentGraphicId = graphic_dialogBackground + graphicX++ + 1; else graphic_currentGraphicId = graphic_dialogBackground + 11; } else { graphic_currentGraphicId = graphic_dialogBackground; } yAdd = 0; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); if ( graphicX >= 10 ) graphicX = 0; ++x; } graphicY += yAdd; if ( graphicY >= 120 ) graphicY = 0; ++y; } } void fun_drawSubMenuBackground(int xOffset, int yOffset, int widthBlocks, int heightBlocks) { signed int v4; // [sp+4Ch] [bp-14h]@8 signed int v5; // [sp+50h] [bp-10h]@1 signed int v6; // [sp+54h] [bp-Ch]@3 int y; // [sp+58h] [bp-8h]@1 int x; // [sp+5Ch] [bp-4h]@3 y = 0; v5 = 0; while ( y < heightBlocks ) { x = 0; v6 = 0; while ( x < widthBlocks ) { graphic_xOffset = 16 * x + xOffset; graphic_yOffset = 16 * y + yOffset; graphic_currentGraphicId = v5 + graphic_dialogBackground + v6++ + 13; v4 = 12; drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); if ( v6 >= 10 ) v6 = 0; ++x; } v5 += v4; if ( v5 >= 120 ) v5 = 0; ++y; } } void fun_drawSunkenTextBox(int x, int y, int width, int height) { signed int v4; // [sp+4Ch] [bp-14h]@28 signed int v5; // [sp+50h] [bp-10h]@1 signed int v6; // [sp+54h] [bp-Ch]@3 int h; // [sp+58h] [bp-8h]@1 int w; // [sp+5Ch] [bp-4h]@3 h = 0; v5 = 0; while ( h < height ) { w = 0; v6 = 0; while ( w < width ) { graphic_xOffset = 16 * w + x; graphic_yOffset = 16 * h + y; if ( h ) { if ( h < height - 1 ) { if ( w ) { if ( w < width - 1 ) graphic_currentGraphicId = v5 + graphic_sunkenBackground + v6++ + 8; else graphic_currentGraphicId = graphic_sunkenBackground + v5 + 13; } else { graphic_currentGraphicId = graphic_sunkenBackground + v5 + 7; } v4 = 7; } else { if ( w ) { if ( w < width - 1 ) graphic_currentGraphicId = graphic_sunkenBackground + v6++ + 43; else graphic_currentGraphicId = graphic_sunkenBackground + 48; } else { graphic_currentGraphicId = graphic_sunkenBackground + 42; } v4 = 0; } } else { if ( w ) { if ( w < width - 1 ) graphic_currentGraphicId = graphic_sunkenBackground + v6++ + 1; else graphic_currentGraphicId = graphic_sunkenBackground + 6; } else { graphic_currentGraphicId = graphic_sunkenBackground; } v4 = 0; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); if ( v6 >= 5 ) v6 = 0; ++w; } v5 += v4; if ( v5 >= 35 ) v5 = 0; ++h; } } void fun_drawSunkenTextBoxBottomBorder(int xOffset, int yOffset, int widthInBlocks) { signed int v3; // [sp+4Ch] [bp-8h]@1 int v4; // [sp+50h] [bp-4h]@1 graphic_yOffset = yOffset; v4 = 0; v3 = 0; while ( v4 < widthInBlocks ) { graphic_xOffset = 16 * v4 + xOffset; if ( v4 ) { if ( v4 < widthInBlocks - 1 ) graphic_currentGraphicId = graphic_sunkenBackground + v3++ + 43; else graphic_currentGraphicId = graphic_sunkenBackground + 48; } else { graphic_currentGraphicId = graphic_sunkenBackground + 42; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); if ( v3 >= 5 ) v3 = 0; ++v4; } } void fun_drawBorderedButton(int a1, int x, int y, signed int width, signed int height, int mouseOver) { int v6; // [sp+4Ch] [bp-1Ch]@5 int v7; // [sp+50h] [bp-18h]@5 int heightInBlocks; // [sp+54h] [bp-14h]@3 int widthInBlocks; // [sp+58h] [bp-10h]@1 int h; // [sp+5Ch] [bp-Ch]@13 int w; // [sp+60h] [bp-8h]@15 signed int v12; // [sp+64h] [bp-4h]@7 widthInBlocks = width / 16; if ( width % 16 ) ++widthInBlocks; heightInBlocks = height / 16; if ( height % 16 ) ++heightInBlocks; v7 = 16 * widthInBlocks - width; v6 = 16 * heightInBlocks - height; if ( a1 ) { if ( mouseOver ) v12 = graphic_borderedButton + 8; else v12 = graphic_borderedButton; } else { if ( mouseOver ) v12 = graphic_borderedButton + 8; else v12 = graphic_borderedButton; } for ( h = 0; h < heightInBlocks; ++h ) { for ( w = 0; w < widthInBlocks; ++w ) { graphic_xOffset = 16 * w + x; graphic_yOffset = 16 * h + y; if ( h ) { if ( h < heightInBlocks - 1 ) { if ( w ) { if ( w >= widthInBlocks - 1 ) drawGraphic(v12 + 3, graphic_xOffset - v7, graphic_yOffset); } else { drawGraphic(v12 + 7, graphic_xOffset, graphic_yOffset); } } else { if ( w ) { if ( w < widthInBlocks - 1 ) drawGraphic(v12 + 5, graphic_xOffset, graphic_yOffset - v6); else drawGraphic(v12 + 4, graphic_xOffset - v7, graphic_yOffset - v6); } else { drawGraphic(v12 + 6, graphic_xOffset, graphic_yOffset - v6); } } } else { if ( w ) { if ( w < widthInBlocks - 1 ) drawGraphic(v12 + 1, graphic_xOffset, graphic_yOffset); else drawGraphic(v12 + 2, graphic_xOffset - v7, graphic_yOffset); } else { drawGraphic(v12, graphic_xOffset, graphic_yOffset); } } } } } void fun_drawDebugInfoBox(int greyButtonId, int a2, int a3, int a4, int a5, int a6) { int v6; // [sp+4Ch] [bp-10h]@8 int v7; // [sp+50h] [bp-Ch]@5 int i; // [sp+54h] [bp-8h]@11 int j; // [sp+58h] [bp-4h]@13 if ( button_something_0[greyButtonId] >= 5 ) { if ( button_something_0[greyButtonId] >= 15 ) { v7 = button_something_0[greyButtonId] - 13; if ( v7 <= a4 ) a2 += 16 * (a4 - v7) / 2; else v7 = a4; v6 = button_something_0[greyButtonId] - 13; if ( v6 <= a5 ) a3 += 16 * (a5 - v6) / 2; else v6 = a5; for ( i = 0; i < v6; ++i ) { for ( j = 0; j < v7; ++j ) { graphic_xOffset = 16 * j + a2; graphic_yOffset = 16 * i + a3; if ( i ) { if ( i < v6 - 1 ) { if ( j ) { if ( j < v7 - 1 ) graphic_currentGraphicId = graphic_buttons + 9 * a6 + 10; else graphic_currentGraphicId = graphic_buttons + 9 * a6 + 11; } else { graphic_currentGraphicId = graphic_buttons + 9 * a6 + 9; } } else { if ( j ) { if ( j < v7 - 1 ) graphic_currentGraphicId = graphic_buttons + 9 * a6 + 13; else graphic_currentGraphicId = graphic_buttons + 9 * a6 + 14; } else { graphic_currentGraphicId = graphic_buttons + 9 * a6 + 12; } } } else { if ( j ) { if ( j < v7 - 1 ) graphic_currentGraphicId = graphic_buttons + 9 * a6 + 7; else graphic_currentGraphicId = graphic_buttons + 9 * a6 + 8; } else { graphic_currentGraphicId = graphic_buttons + 9 * a6 + 6; } } if ( greyButtonId == 8 ) sub_4D0B70(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset, 0xF863u); else drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); } } } else { graphic_xOffset = dword_5FFF64[3 * (button_something_0[greyButtonId] - 5)] + 16 * (a4 - 2) / 2 + a2; graphic_yOffset = dword_5FFF68[3 * (button_something_0[greyButtonId] - 5)] + 16 * (a5 - 2) / 2 + a3; drawGraphic( dword_5FFF60[3 * (button_something_0[greyButtonId] - 5)] + graphic_buttons + 8 * a6 + 24, graphic_xOffset, graphic_yOffset); } } } signed int sub_52C7A0(int a1) { button_something_6 = 100; if ( button_something_0[a1] == 7 ) sound_playChannel(1); return 1; } void fun_drawSmallGreyButton(int a1, int x, int y, int width, int widthIsFixed, int mouseOver) { int max; // [sp+4Ch] [bp-8h]@2 int i; // [sp+50h] [bp-4h]@8 if ( widthIsFixed == 1 ) { max = width; } else { if ( button_something_0[a1] < 20 ) return; max = button_something_0[a1] - 18; if ( max <= width ) x += 16 * (width - max) / 2; else max = width; } for ( i = 0; i < max; ++i ) { graphic_xOffset = 16 * i + x; graphic_yOffset = y; if ( i ) { if ( i < max - 1 ) graphic_currentGraphicId = graphic_buttons + 3 * mouseOver + 41; else graphic_currentGraphicId = graphic_buttons + 3 * mouseOver + 42; } else { graphic_currentGraphicId = graphic_buttons + 3 * mouseOver + 40; } drawGraphic(graphic_currentGraphicId, graphic_xOffset, graphic_yOffset); } } int unused_52C9D0(int a1, int a2, int a3) { int result; // eax@2 if ( button_something_0[a1] >= 6 ) { draw_clip_x = 16 * a3 / 2 + a2 - 3 * (button_something_0[a1] - 5); result = 3 * (button_something_0[a1] - 5); draw_clip_xEnd = result + 16 * a3 / 2 + a2; if ( draw_clip_x < 0 ) draw_clip_x = 0; if ( draw_clip_xEnd > screen_width ) { result = screen_width; draw_clip_xEnd = screen_width; } } else { result = 0; } return result; } int unused_52CA90(int a1, int a2, int a3, int a4, int a5) { int result; // eax@2 if ( button_something_0[a1] >= 6 ) { draw_clip_x = 16 * a4 / 2 + a2 - 3 * (button_something_0[a1] - 5); draw_clip_xEnd = 3 * (button_something_0[a1] - 5) + 16 * a4 / 2 + a2; draw_clip_y = 16 * a5 / 2 + a3 - 3 * (button_something_0[a1] - 5); draw_clip_yEnd = 3 * (button_something_0[a1] - 5) + 16 * a5 / 2 + a3; if ( draw_clip_x < 0 ) draw_clip_x = 0; result = draw_clip_xEnd; if ( draw_clip_xEnd > screen_width ) draw_clip_xEnd = screen_width; if ( draw_clip_y < 0 ) draw_clip_y = 0; if ( draw_clip_yEnd > screen_height ) { result = screen_height; draw_clip_yEnd = screen_height; } } else { result = 0; } return result; } void fun_resetClipRegionOptionsDialog() { draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } int unused_52CC30(int a1) { int result; // eax@6 for ( graphic_yOffset = 0; graphic_yOffset < 32 * a1; graphic_yOffset += 32 ) { for ( graphic_xOffset = 0; graphic_xOffset < 32 * screen_width; graphic_xOffset += 32 ) drawGraphic(1, graphic_xOffset, graphic_yOffset); result = graphic_yOffset + 32; } return result; } //----- (0052CCD0) -------------------------------------------------------- void fun_drawCitySidepanelBorder_800() { graphic_xOffset = 760; for ( graphic_yOffset = 24; graphic_yOffset < 600; graphic_yOffset += 24 ) drawGraphic(graphic_buttons_start + 12, graphic_xOffset, graphic_yOffset); } // 6E6BC6: using guessed type __int16 graphic_buttons_start; //----- (0052CD50) -------------------------------------------------------- void fun_drawCitySidepanelBorder_1024() { graphic_xOffset = 1000; for ( graphic_yOffset = 24; graphic_yOffset < 768; graphic_yOffset += 24 ) drawGraphic(graphic_buttons_start + 13, graphic_xOffset, graphic_yOffset); } // 6E6BC6: using guessed type __int16 graphic_buttons_start; //----- (0052CDD0) -------------------------------------------------------- void fun_drawTextCursor(int a1, int a2, int a3) { int timeDiffMs; // [sp+4Ch] [bp-4h]@1 timeDiffMs = time_current - input_cursorLastChange; if ( input_showCursor[0] || timeDiffMs < 200 ) { if ( input_showCursor[0] == 1 ) { if ( timeDiffMs >= 400 ) { input_cursorLastChange = time_current; input_showCursor[0] = 0; } } } else { input_cursorLastChange = time_current; input_showCursor[0] = 1; } if ( input_showCursor[0] ) { if ( input_isInsert ) { fun_drawLine( a1 + dword_6AD9D0 - 3, a2 + input_cursorOffset - 3, a1 + dword_6AD9D0 + 1, a2 + input_cursorOffset - 3, a3); fun_drawLine( a1 + dword_6AD9D0 - 1, a2 + input_cursorOffset - 3, a1 + dword_6AD9D0 - 1, a2 + input_cursorOffset + 13, a3); fun_drawLine( a1 + dword_6AD9D0 - 3, a2 + input_cursorOffset + 14, a1 + dword_6AD9D0 + 1, a2 + input_cursorOffset + 14, a3); } else { fun_fillRect(dword_6AD9D0 + a1, a2 + input_cursorOffset + 14, drawtext_input_cursor_width, 2, a3); } } } void unused_52CFC0() { if ( setting_map_camera_x > 0 ) drawGraphic(5, -4, (screen_height - 64) / 2); if ( setting_map_camera_y > 0 ) drawGraphic(2, (screen_width - 32) / 2, -4); if ( setting_map_width - setting_map_camera_x > fun_getIsometricViewportWidth2() ) drawGraphic(3, screen_width - 28, (screen_height - 64) / 2); if ( setting_map_height - setting_map_camera_x > 14 ) drawGraphic(4, (screen_width - 32) / 2, screen_height - 60); } void unused_52D0B0(const char *str, int a2) { unused_fillGreenGraphicRectWithBorder(128, 320, 24, 3); drawtext_forceColor = 1; dword_6608AC[0] = 1; dword_66057C = mouseclick_x; dword_660578 = mouseclick_y; fun_drawTextCentered(str, 128, 330, 384, 107, 0xF800u); if ( a2 ) fun_drawNumberCentered(a2, 64, " ", 128, 348, 384, 107, 0); } void unused_52D180() { ; } //----- (0052D1A0) -------------------------------------------------------- signed int fun_startVideo(const char *filename, int x, int y, int fullscreen, int nextWindowId) { signed int result; // eax@2 if ( message_useVideo ) { video_nextWindowId = nextWindowId; if ( fun_playVideo(filename, x, y, fullscreen) ) { window_id = W_Video; result = 1; } else { window_id = nextWindowId; if ( message_useVideo == 2 ) window_redrawRequest = 1; result = 0; } } else { result = 0; } return result; } signed int fun_checkVideo(const char *videoFilename, int xOffset, int yOffset) { signed int result; // eax@2 fun_resetTooltipTimer(); if ( fun_playVideo(videoFilename, xOffset, yOffset, 0) ) { if ( !smack_videoInHomeDir ) fun_chdirToCdBasedOnExtension(video_filename); if ( smack_currentVideo ) { //SmackClose(smack_currentVideo); smack_currentVideo = 0; smack_videoPlaying = 0; } fun_chdirHome(); result = 1; } else { result = 0; } return result; } signed int fun_playVideo(const char *filename, int x, int y, int fullscreen) { int v4; // ecx@6 int v5; // eax@9 signed int result; // eax@15 SIZE_T v7; // eax@15 int v8; // [sp+4Ch] [bp-4h]@3 smack_videoPlaying = 0; if ( !dword_6084B0 ) { //SmackSoundUseDirectSound(ds_idirectsound); dword_6084B0 = 1; } fun_logDebugMessage("OK :SMK starting smack ", filename, 0); smack_currentVideo = 0; smack_video_x = x; smack_video_y[0] = y; smack_video_fullscreen = fullscreen; v8 = 0; if ( graphics_format_hex == 0x565 ) smack_color_flags = 0xC0000000u; else smack_color_flags = 0x80000000u; fun_strncpy(filename, video_filename, 64); smack_videoInHomeDir = fun_fileExistsHome(video_filename); if ( !smack_videoInHomeDir ) fun_chdirToCdBasedOnExtension(video_filename); if ( ds_idirectsound ) { v5 = 0; *(_WORD *)((char *)&v5 + 1) = BYTE1(v5) | 0x20; v8 = v5; if ( video_nextWindowId != 65 ) { if ( video_nextWindowId != 60 ) { v4 = setting_sound_effects_on; if ( !setting_sound_effects_on ) v8 = 0; } } } //smack_currentVideo = SmackOpen(v4, video_filename, v8, -1); if ( smack_currentVideo ) { fun_soundStopChannel(0); fun_soundStopChannel(1); fun_refreshVideoBuffer(1); smack_videoPlaying = 1; fun_smackDoFrame(); fun_chdirHome(); result = 1; } else { fun_chdirHome(); fun_logDebugMessage("ERR:SMK Could not open ", video_filename, 0); v7 = fun_getAvailablePhysicalMem(); fun_logDebugMessage("MEM:Max alloc after = ", 0, v7 + 1); result = 0; } return result; } // 607FFC: using guessed type int ds_idirectsound; // 608128: using guessed type int smack_currentVideo; // 608458: using guessed type int video_nextWindowId; // 6084A4: using guessed type int smack_video_fullscreen; // 6084AC: using guessed type int smack_videoInHomeDir; // 6084B0: using guessed type int dword_6084B0; // 60856C: using guessed type int smack_videoPlaying; // 608570: using guessed type int smack_video_x; // 608574: using guessed type int smack_video_y[22]; // 6085CC: using guessed type int smack_color_flags; // 65E70B: using guessed type char setting_sound_effects_on; // 6608E0: using guessed type int graphics_format_hex; // 9DD934: using guessed type int __stdcall SmackSoundUseDirectSound(_DWORD); // 9DD940: using guessed type int __thiscall SmackOpen(_DWORD, _DWORD, _DWORD, _DWORD); //----- (0052D4E0) -------------------------------------------------------- signed int fun_smackDoFrame() { signed int result=0; // eax@2 /*int v1; // eax@9 SIZE_T v2; // eax@20 int v3; // [sp+54h] [bp-4h]@6 if ( smack_videoPlaying ) { if ( SmackWait(smack_currentVideo) ) { result = 0; } else { memset(&smack_videoSurface, 0, 0x6Cu); smack_videoSurface.dwSize = 108; if ( ddraw_busy ) { v3 = ((int (__stdcall *)(IDirectDrawSurface *, _DWORD, DDSURFACEDESC *, signed int, _DWORD))ddraw_surface->lpVtbl->Lock)( ddraw_surface, 0, &smack_videoSurface, 1, 0); while ( v3 == 2289435074 ) { if ( ((int (__stdcall *)(IDirectDrawSurface *))ddraw_surface->lpVtbl->Restore)(ddraw_surface) ) goto LABEL_17; } if ( v3 ) { v1 = fun_translateDDrawSurfaceLockError(v3); fun_logDebugMessage("ERR:SMK releasing write_to_primary, surface lock error:", 0, v1 + 1); ddraw_busy = 0; } else { SmackToBuffer( smack_currentVideo, smack_video_x, smack_video_y[0], smack_videoSurface.lPitch, *(_DWORD *)(smack_currentVideo + 8), smack_videoSurface.lpSurface, smack_color_flags); SmackDoFrame(smack_currentVideo); ((void (__stdcall *)(IDirectDrawSurface *, LPVOID))ddraw_surface->lpVtbl->Unlock)( ddraw_surface, smack_videoSurface.lpSurface); } } else { if ( !((int (__stdcall *)(IDirectDrawSurface *, _DWORD, DDSURFACEDESC *, signed int, _DWORD))ddraw_backSurface->lpVtbl->Lock)( ddraw_backSurface, 0, &smack_videoSurface, 1, 0) ) { SmackToBuffer( smack_currentVideo, smack_video_x, smack_video_y[0], smack_videoSurface.lPitch, *(_DWORD *)(smack_currentVideo + 8), smack_videoSurface.lpSurface, smack_color_flags); SmackDoFrame(smack_currentVideo); ((void (__stdcall *)(IDirectDrawSurface *, LPVOID))ddraw_backSurface->lpVtbl->Unlock)( ddraw_backSurface, smack_videoSurface.lpSurface); } } LABEL_17: if ( *(_DWORD *)(smack_currentVideo + 884) < (unsigned int)(*(_DWORD *)(smack_currentVideo + 12) - 1) ) { SmackNextFrame(smack_currentVideo, smack_currentVideo, smack_currentVideo); result = 1; } else { if ( smack_currentVideo ) { SmackClose(smack_currentVideo); smack_currentVideo = 0; } fun_chdirHome(); fun_logDebugMessage("OK :SMK natural end of ", video_filename, 0); v2 = fun_getAvailablePhysicalMem(); fun_logDebugMessage("MEM:Max alloc after = ", 0, v2 + 1); fun_smackCleanupAfterVideo(); result = 1; } } } else { result = 0; }*/ return result; } void fun_smackCancelVideo() { SIZE_T v0; // eax@7 if ( smack_videoPlaying ) { if ( !smack_videoInHomeDir ) fun_chdirToCdBasedOnExtension(video_filename); if ( smack_currentVideo ) { //SmackClose(smack_currentVideo); smack_currentVideo = 0; } fun_chdirHome(); fun_logDebugMessage("OK :SMK user ends ", video_filename, 0); v0 = fun_getAvailablePhysicalMem(); fun_logDebugMessage("MEM:Max alloc after = ", 0, v0 + 1); fun_smackCleanupAfterVideo(); } } void fun_smackStopVideo() { if ( smack_videoPlaying ) { if ( !smack_videoInHomeDir ) fun_chdirToCdBasedOnExtension(video_filename); if ( smack_currentVideo ) { //SmackClose(smack_currentVideo); smack_currentVideo = 0; } fun_chdirHome(); } } void fun_smackCleanupAfterVideo() { smack_videoPlaying = 0; window_id = video_nextWindowId; fun_resetBackgroundMusic(); fun_changeBackgroundMusic(); if ( message_useVideo == 2 ) window_redrawRequest = 1; message_useVideo = 0; } signed int unused_52D950() { signed int result; // eax@2 if ( smack_videoPlaying ) result = 1; else result = 0; return result; } void unused_52D980() { ; } //----- (0052D9A0) -------------------------------------------------------- void unused_52D9A0() { ; } signed int unused_52D9C0() { fun_soundStopChannel(0); return fun_startVideo(&aIntro_smk[16 * dword_6084A0], 39, 73, 0, window_id); } void unused_52DA10(HWND hWnd) { HDC v1; // [sp+4Ch] [bp-44h]@1 struct tagPAINTSTRUCT Paint; // [sp+50h] [bp-40h]@1 v1 = BeginPaint(hWnd, &Paint); if ( ddraw_busy ) PatBlt(v1, 0, 0, *(_DWORD *)(smack_currentVideo + 4), *(_DWORD *)(smack_currentVideo + 8), 0x42u); EndPaint(hWnd, &Paint); if ( ddraw_busy ) { if ( dword_6084A8 ) { //SmackSoundOnOff(smack_currentVideo, 0); //SmackGoto(smack_currentVideo, dword_6084A8); //SmackSoundOnOff(smack_currentVideo, 1); } } } int unused_52DAE0(int a1, int a2, int a3, int a4) { int result; // eax@2 RECT v5; // [sp+4Ch] [bp-20h]@1 RECT v9; // [sp+5Ch] [bp-10h]@1 v9.left = a1 + ddraw_rect.left; v9.top = a2 + dword_660554; v9.right = a3 + a1 + ddraw_rect.left; v9.bottom = a4 + a2 + dword_660554; v5.left = a1; v5.top = a2; v5.right = a3 + a1; v5.bottom = a4 + a2; if ( setting_fullscreen ) result = ddraw_surface->BltFast(v9.left,v9.top,ddraw_backSurface,&v5,16); else result = ddraw_surface->Blt(&v9,ddraw_backSurface,&v5,0x1000200,0); return result; } void playWalkerSound(int walkerSoundId, int soundId) { char path[32]; // [sp+4Ch] [bp-24h]@7 int i; // [sp+6Ch] [bp-4h]@5 if ( walkerSoundId > 0 ) { if ( soundId >= 0 ) { for ( i = 0; i < 32; ++i ) path[i] = 0; strcpy(path, "wavs\\"); strcat(path, &walkerSounds[480 * (walkerSoundId - 1)] + 24 * soundId); fun_playSound(path, 1, 0); } } } void fun_determineWalkerSoundPhrase(int walkerId) { int v1; // [sp+4Ch] [bp-18h]@164 int v2; // [sp+4Ch] [bp-18h]@176 signed int i; // [sp+50h] [bp-14h]@215 int v4; // [sp+54h] [bp-10h]@183 signed int v5; // [sp+5Ch] [bp-8h]@215 signed int v6; // [sp+60h] [bp-4h]@221 if ( walkerId > 0 ) { currentMoodSoundId = 0; walkers[walkerId].mood = currentMoodSoundId; if ( walkers[walkerId].type < Walker_IndigenousNative || walkers[walkerId].type > Walker_NativeTrader ) { if ( walkers[walkerId].type != Walker_LaborSeeker ) { if ( walkers[walkerId].type != 35 ) { if ( walkers[walkerId].type != Walker_Actor ) { if ( walkers[walkerId].type == Walker_LionTamer ) { if ( walkers[walkerId].actionState == 150 ) { ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 3 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; } } else { if ( walkers[walkerId].type == Walker_Gladiator ) { if ( walkers[walkerId].actionState == 150 ) currentMoodSoundId = 7; } else { if ( walkers[walkerId].type != Walker_Charioteer ) { if ( walkers[walkerId].type != Walker_SchoolChild ) { if ( walkers[walkerId].type != Walker_BathhouseWorker ) { if ( walkers[walkerId].type != Walker_Barber ) { if ( walkers[walkerId].type != Walker_Doctor ) { if ( walkers[walkerId].type != Walker_Surgeon ) { if ( walkers[walkerId].type != Walker_Priest ) { switch ( walkers[walkerId].type ) { case Walker_TaxCollector: if ( walkers[walkerId].maxLevelOrRiskSeen < 7 ) { if ( walkers[walkerId].maxLevelOrRiskSeen < 4 ) { if ( walkers[walkerId].maxLevelOrRiskSeen >= 1 ) currentMoodSoundId = 9; } else { currentMoodSoundId = 8; } } else { currentMoodSoundId = 7; } break; case Walker_MarketTrader: if ( walkers[walkerId].actionState == 126 ) { if ( sub_452DD0(walkers[walkerId].buildingId) <= 0 ) currentMoodSoundId = 9; } break; case Walker_MarketBuyer: if ( walkers[walkerId].actionState == 145 ) { currentMoodSoundId = 7; } else { if ( walkers[walkerId].actionState == 146 ) currentMoodSoundId = 8; } break; case Walker_CartPusher: if ( walkers[walkerId].actionState == 20 ) { if ( walkers[walkerId].maxLevelOrRiskSeen == 2 ) { currentMoodSoundId = 7; } else { if ( walkers[walkerId].maxLevelOrRiskSeen == 1 ) currentMoodSoundId = 8; } } else { if ( walkers[walkerId].actionState == 21 || walkers[walkerId].actionState == 22 || walkers[walkerId].actionState == 23 ) { if ( fun_getDistanceMaximum( walkers[walkerId].destination_x, walkers[walkerId].destination_y, walkers[walkerId].byte_7FA360, walkers[walkerId].byte_7FA361) >= 25 ) currentMoodSoundId = 9; } } break; case Walker_Warehouseman: if ( walkers[walkerId].actionState == 51 ) { if ( fun_getDistanceMaximum( walkers[walkerId].destination_x, walkers[walkerId].destination_y, walkers[walkerId].byte_7FA360, walkers[walkerId].byte_7FA361) >= 25 ) currentMoodSoundId = 9; } break; default: if ( walkers[walkerId].type != Walker_Patrician ) { if ( walkers[walkerId].type == Walker_Prefect ) { ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 4 ) byte_7FA3AA[128 * walkerId] = 0; switch ( walkers[walkerId].actionState ) { case 0x4A: currentMoodSoundId = 10; break; case 0x4B: if ( byte_7FA3AA[128 * walkerId] ) { switch ( byte_7FA3AA[128 * walkerId] ) { case 1: currentMoodSoundId = 12; break; case 2: currentMoodSoundId = 11; break; case 3: currentMoodSoundId = 12; break; } } else { currentMoodSoundId = 11; } break; case 0x96: if ( byte_7FA3AA[128 * walkerId] ) { switch ( byte_7FA3AA[128 * walkerId] ) { case 1: currentMoodSoundId = 14; break; case 2: currentMoodSoundId = 15; break; case 3: currentMoodSoundId = 16; break; } } else { currentMoodSoundId = 13; } break; default: if ( walkers[walkerId].maxLevelOrRiskSeen < 50 ) { if ( walkers[walkerId].maxLevelOrRiskSeen < 10 ) currentMoodSoundId = 9; else currentMoodSoundId = 8; } else { currentMoodSoundId = 7; } break; } } else { if ( walkers[walkerId].type == Walker_Engineer ) { if ( walkers[walkerId].maxLevelOrRiskSeen < 60 ) { if ( walkers[walkerId].maxLevelOrRiskSeen >= 10 ) currentMoodSoundId = 8; } else { currentMoodSoundId = 7; } } else { if ( walkers[walkerId].type != Walker_Protestor && walkers[walkerId].type != Walker_Criminal && walkers[walkerId].type != Walker_Rioter ) { switch ( walkers[walkerId].type ) { case Walker_Homeless: ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 2 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; break; case Walker_Immigrant: ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 2 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; break; case Walker_Emigrant: switch ( city_inform[ciid].dword_654464 ) { case 1: currentMoodSoundId = 8; break; case 2: currentMoodSoundId = 7; break; case 3: currentMoodSoundId = 9; break; case 4: currentMoodSoundId = 10; break; default: currentMoodSoundId = 11; break; } break; case Walker_TowerSentry: ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 2 ) byte_7FA3AA[128 * walkerId] = 0; if ( city_inform[ciid].imperialArmyComing ) { if ( city_inform[ciid].imperialArmyComing > 10 ) { if ( city_inform[ciid].imperialArmyComing > 30 ) currentMoodSoundId = 11; else currentMoodSoundId = 10; } else { currentMoodSoundId = 9; } } else { currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; } break; default: if ( walkers[walkerId].type != Walker_FortJavelin && walkers[walkerId].type != Walker_FortMounted && walkers[walkerId].type != Walker_FortLegionary ) { if ( walkers[walkerId].type != Walker_Teacher ) { if ( walkers[walkerId].type != Walker_Librarian ) { switch ( walkers[walkerId].type ) { case Walker_TradeCaravan: ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 2 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 8; v1 = byte_7FA3AD[128 * walkerId]; if ( walkers[walkerId].actionState == 103 ) { if ( !dword_993F64[12 * v1] ) { if ( !dword_993F60[12 * v1] ) currentMoodSoundId = 7; } } else { if ( walkers[walkerId].actionState == 102 ) { if ( sub_45AA70( walkerId, ciid, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].tradeCityId) ) { currentMoodSoundId = 11; } else { if ( sub_45AEB0( walkerId, ciid, walkers[walkerId].baseWorkingBuildingId, walkers[walkerId].tradeCityId) ) currentMoodSoundId = 10; } } } break; case Walker_TradeShip: v2 = byte_7FA3AD[128 * walkerId]; if ( walkers[walkerId].actionState == 115 ) { if ( dword_993F64[12 * v2] || dword_993F60[12 * v2] ) currentMoodSoundId = 11; else currentMoodSoundId = 9; } else { if ( walkers[walkerId].actionState == 112 ) { v4 = sub_4A4D70(walkerId); if ( v4 == 1 ) { currentMoodSoundId = 8; } else { if ( v4 == 2 ) currentMoodSoundId = 7; else currentMoodSoundId = 9; } } else { currentMoodSoundId = 10; } } break; case Walker_Dockman: if ( walkers[walkerId].actionState == 135 || walkers[walkerId].actionState == 136 ) { if ( fun_getDistanceMaximum( walkers[walkerId].destination_x, walkers[walkerId].destination_y, walkers[walkerId].byte_7FA360, walkers[walkerId].byte_7FA361) >= 25 ) currentMoodSoundId = 9; } break; default: if ( walkers[walkerId].type != Walker_IndigenousNative ) { if ( walkers[walkerId].type < Walker_Enemy43 || walkers[walkerId].type > Walker_Enemy53 ) { if ( walkers[walkerId].type != Walker_NativeTrader ) { if ( walkers[walkerId].type == Walker_Missionary ) { ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 3 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; } else { if ( walkers[walkerId].type == Walker_DeliveryBoy ) { ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 3 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; } } } } } break; } } } } else { if ( city_inform[ciid].imperialArmyComing < 40 ) { if ( city_inform[ciid].imperialArmyComing <= 20 ) { if ( city_inform[ciid].imperialArmyComing ) currentMoodSoundId = 9; } else { currentMoodSoundId = 10; } } else { currentMoodSoundId = 11; } } break; } } else { ++byte_7FA3AA[128 * walkerId]; if ( byte_7FA3AA[128 * walkerId] >= 3 ) byte_7FA3AA[128 * walkerId] = 0; currentMoodSoundId = byte_7FA3AA[128 * walkerId] + 7; } } } } break; } } } } } } } } } } } } } if ( !currentMoodSoundId ) { ++byte_7FA3AC[128 * walkerId]; if ( byte_7FA3AC[128 * walkerId] >= 1 ) byte_7FA3AC[128 * walkerId] = 0; v5 = 100; for ( i = 0; i < 5; ++i ) { if ( city_inform[ciid].happinessGod[ i ] < v5 ) v5 = city_inform[ciid].happinessGod[ i ]; } if ( v5 >= 20 ) { if ( v5 >= 40 ) v6 = 0; else v6 = 2; } else { v6 = 1; } currentMoodSoundId = -1; if ( city_inform[ciid].foodSupplyMonths > 0 ) { if ( city_inform[ciid].unemploymentPercentage < 17 ) { if ( city_inform[ciid].numWorkersNeeded < 10 ) { if ( city_inform[ciid].entertainment_needsMet ) { if ( v6 == 1 ) { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 4; } else { if ( city_inform[ciid].entertainment_needsMet > 10 ) { if ( v6 == 2 ) { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 4; } else { if ( city_inform[ciid].entertainment_needsMet > 20 ) { if ( city_inform[ciid].foodSupplyMonths >= 4 ) { if ( city_inform[ciid].unemploymentPercentage <= 5 ) { if ( city_inform[ciid].health_needsMet > 0 ) { if ( city_inform[ciid].education_needsMet > 0 ) { if ( city_inform[ciid].population >= 500 ) currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 6; else currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 5; } } } } } else { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 3; } } } else { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 3; } } } else { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 3; } } else { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 2; } } else { currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 1; } } else { currentMoodSoundId = byte_7FA3AC[128 * walkerId]; } if ( currentMoodSoundId == -1 ) { if ( city_inform[ciid].unemploymentPercentage < 10 ) currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 5; else currentMoodSoundId = byte_7FA3AC[128 * walkerId] + 1; } } walkers[walkerId].mood = currentMoodSoundId; } else { walkers[walkerId].mood = -1; currentMoodSoundId = -1; } } } void fun_playWalkerInfoSound() { int v0; // [sp+4Ch] [bp-4h]@1 v0 = dword_64E300[walkerInfo_index]; if ( v0 > 0 ) { currentWalkerSoundId = mappingWalkerTypeToSoundIndex[walkers[v0].type]; currentMoodSoundId = walkers[v0].mood; playWalkerSound(currentWalkerSoundId, currentMoodSoundId); } } void fun_initScenario(char *mapFilename) { int v1; // [sp+4Ch] [bp-8h]@1 int v2; // [sp+50h] [bp-4h]@1 v2 = savedgame_missionId; v1 = setting_currentMissionId; fun_clearBookmarks(); if ( setting_isCustomScenario ) { if ( !fun_file_mapExists(mapFilename) ) { window_id = 1; window_redrawRequest = 1; return; } fun_initCustomScenario(mapFilename); } else { strcpy(save_playername, setting_player_name); if ( !fun_loadSavedGameFromMissionPack(0) ) return; city_inform[ciid].treasury = fun_adjustWithPercentage( city_inform[ciid].treasury, difficulty_moneypct[setting_difficulty]); strcpy(save_playername, setting_player_name); } savedgame_missionId = v2; setting_currentMissionId = v1; startingFavor = difficulty_startingFavor[setting_difficulty]; setting_personalSavings_lastMission = setting_personalSavingsPerMission[setting_currentMissionId]; city_inform[ciid].favorRating = startingFavor; city_inform[ciid].personalSavings = setting_personalSavings_lastMission; city_inform[ciid].player_rank = setting_currentMissionId; city_inform[ciid].salary_rank = setting_currentMissionId; if ( setting_isCustomScenario ) { city_inform[ciid].personalSavings = 0; city_inform[ciid].player_rank = scn_playerRank; city_inform[ciid].salary_rank = scn_playerRank; } if ( city_inform[ciid].salary_rank > 10 ) city_inform[ciid].salary_rank = 10; city_inform[ciid].salary_amount = salaryAmounts[city_inform[ciid].salary_rank]; tutorial1_fire = 1; tutorial1_crime = 1; tutorial1_prefectureBuilt = 1; tutorial2_disease = 1; tutorial2_granaryBuilt = 1; tutorial2_population250reached = 1; tutorial1_senateEngineerBuilt = 1; tutorial2_population450reached = 1; tutorial2_potteryMade = 1; city_inform[ciid].dword_654640 = 1; city_inform[ciid].dword_654644 = 1; if ( setting_currentMissionId || setting_isCustomScenario ) { if ( setting_currentMissionId != 1 || setting_isCustomScenario ) { if ( setting_currentMissionId == 2 ) { if ( !setting_isCustomScenario ) { tutorial2_disease = 0; city_inform[ciid].dword_654644 = 0; } } } else { tutorial2_granaryBuilt = 0; tutorial2_population250reached = 0; tutorial2_population450reached = 0; tutorial2_potteryMade = 0; tutorial2_potteryMadeYear = 0; } } else { tutorial1_fire = 0; tutorial1_crime = 0; tutorial1_prefectureBuilt = 0; tutorial2_granaryBuilt = 0; tutorial2_population250reached = 0; tutorial1_senateEngineerBuilt = 0; tutorial2_population450reached = 0; tutorial2_potteryMade = 0; tutorial2_potteryMadeYear = 0; city_inform[ciid].dword_654640 = 0; setting_personalSavingsPerMission[setting_currentMissionId] = 0; setting_personalSavings_lastMission = 0; city_inform[ciid].personalSavings = setting_personalSavings_lastMission; setting_currentMissionId = 0; } fun_enableBuildingMenuItems(); fun_enableSidebarButtons(); sub_4DE6E0(); if ( !setting_isCustomScenario ) { city_inform[ciid].favorRating = startingFavor; city_inform[ciid].personalSavings = setting_personalSavings_lastMission; city_inform[ciid].player_rank = setting_currentMissionId; } } signed int fun_file_mapExists(char *mapFilename) { signed int v2; // [sp+4Ch] [bp-4h]@2 fun_removeFileExtension(mapFilename); fun_strncpy("map", current_fileExtension, 3); fun_appendFileExtension(mapFilename); if ( fun_fileExists(mapFilename) ) v2 = 1; else v2 = 0; fun_removeFileExtension(mapFilename); return v2; } void fun_initCustomScenario(const char *scnFilename) { winState = 0; byte_65E6A0 = 0; toPlace_buildingType = B_none_building; fun_clearCityInfo(); sub_4E1200(); ciid = 1; city_inform[ciid].byte_6500A3_always1 = 1; city_inform[ciid].byte_6500A2_always1 = 1; sub_4DE6E0(); sub_530190(); sub_4122A0(); sub_41C670(); fun_resetBackgroundMusic(); fun_enableAllBuildingMenuItems(); fun_clearBuildings(); fun_clearStorages(); fun_clearWalkers(); sub_4BE0F0(); fun_initWalkerNameSequences(); fun_clearFormations(); fun_clearDestinationPaths(); sub_44B340(); if ( mode_editor == 1 ) { scenario_map_empire = 0; fun_createNewScenario(3); fun_readEmpireFile(1); fun_initializeTradeRoutes(); sub_4459F0(); fun_setInvasionMonthsAndPaths(); fun_setDistantBattleCity(); fun_generateMapFlagWalkers(); } fun_loadScenario(scnFilename); ciid = 1; city_inform[ciid].byte_6500A3_always1 = 1; city_inform[ciid].byte_6500A2_always1 = 1; byte_658DCD = 1; strcpy(save_playername, setting_player_name); fun_determineDistantBattleCity(); } signed int fun_cdDrive_FileExistsOnDriveWithLength(LPCSTR drive, const char *filename, int a3) { signed int result; // eax@2 DWORD v4; // [sp+4Ch] [bp-22Ch]@13 DWORD NumberOfBytesWritten; // [sp+50h] [bp-228h]@1 char Buffer; // [sp+54h] [bp-224h]@1 char v7; // [sp+55h] [bp-223h]@1 char v8; // [sp+56h] [bp-222h]@1 DWORD v9; // [sp+58h] [bp-220h]@1 DWORD TotalNumberOfClusters; // [sp+5Ch] [bp-21Ch]@1 DWORD NumberOfFreeClusters; // [sp+60h] [bp-218h]@1 DWORD BytesPerSector; // [sp+64h] [bp-214h]@1 DWORD SectorsPerCluster; // [sp+68h] [bp-210h]@1 DWORD FileSystemFlags; // [sp+6Ch] [bp-20Ch]@1 DWORD MaximumComponentLength; // [sp+70h] [bp-208h]@1 DWORD VolumeSerialNumber; // [sp+74h] [bp-204h]@1 char Dest[0x32]; // [sp+78h] [bp-200h]@1 char VolumeNameBuffer[0xC8u]; // [sp+ACh] [bp-1CCh]@1 HANDLE hObject; // [sp+174h] [bp-104h]@1 char Dst[0x100]; // [sp+178h] [bp-100h]@1 hObject = 0; VolumeSerialNumber = -1; MaximumComponentLength = -1; FileSystemFlags = -1; SectorsPerCluster = -1; BytesPerSector = -1; NumberOfFreeClusters = -1; TotalNumberOfClusters = -1; v9 = -1; Buffer = 'c'; v7 = 51; v8 = 0; NumberOfBytesWritten = -1; memset((void *)&Dst, 0, 0x100u); memset(&VolumeNameBuffer, 0, 0xC8u); memset(&Dest, 0, 0x32u); if ( GetDriveTypeA(drive) == 5 ) { strcpy(Dest, &Buffer); GetVolumeInformationA( drive, VolumeNameBuffer, 0xC8u, &VolumeSerialNumber, &MaximumComponentLength, &FileSystemFlags, Dest, 0x32u); //if ( unknown_libname_1("CDFS", &Dest) ) //{ // result = 0; //} //else { NumberOfFreeClusters = 4; GetDiskFreeSpaceA(drive, &SectorsPerCluster, &BytesPerSector, &NumberOfFreeClusters, &TotalNumberOfClusters); if ( NumberOfFreeClusters ) { result = 1; } else { strcpy(Dst, drive); strcat(Dst, filename); hObject = CreateFileA(Dst, 0x80000000u, 1u, 0, 3u, 0x60000001u, 0); if ( hObject == (HANDLE)-1 ) { CloseHandle((HANDLE)0xFFFFFFFF); result = 4; } else { v9 = GetFileSize(hObject, 0); if ( v9 == -1 ) { CloseHandle(hObject); result = 5; } else { if ( v9 == a3 ) { CloseHandle(hObject); hObject = 0; v4 = TotalNumberOfClusters * SectorsPerCluster * BytesPerSector; if ( v4 >= 0x29E00000 || v4 <= 0x2AD00000 ) { strcpy((char *)&Dst, drive); strcat((char *)&Dst, "c3mm.tmp"); hObject = CreateFileA(Dst, 0x40000000u, 2u, 0, 1u, 0x80u, 0); if ( hObject == (HANDLE)-1 ) { result = 7; } else { if ( WriteFile(hObject, &Buffer, 3u, &NumberOfBytesWritten, 0) || NumberOfBytesWritten ) { CloseHandle(hObject); DeleteFileA(Dst); result = 2; } else { CloseHandle(hObject); DeleteFileA(Dst); result = 8; } } } else { result = 10; } } else { CloseHandle(hObject); result = 6; } } } } } } else { result = -1; } return result; } BOOL sub_52FF00(char *Dest) { char Dst; // [sp+4Ch] [bp-110h]@1 SIZE_T nBufferLength; // [sp+14Ch] [bp-10h]@1 LPCSTR Source; // [sp+150h] [bp-Ch]@1 LPSTR lpMem; // [sp+154h] [bp-8h]@1 HANDLE hHeap; // [sp+158h] [bp-4h]@1 memset(&Dst, 0, 0x100u); nBufferLength = GetLogicalDriveStringsA(0, 0); hHeap = GetProcessHeap(); lpMem = (LPSTR)HeapAlloc(hHeap, 8u, nBufferLength); GetLogicalDriveStringsA(nBufferLength, lpMem); Source = lpMem; strcpy(Dest, byte_5E357C); while ( *Source ) { Source = (LPCSTR)(_mbschr((unsigned char *)Source, 0) + 1); if ( GetDriveTypeA(Source) == 5 && fun_cdDrive_FileExistsOnDriveWithLength(Source, "sgs\\001bw.sg1", 15738880) == 7 ) { strcpy(Dest, Source); return HeapFree(hHeap, 0, lpMem); } } return HeapFree(hHeap, 0, lpMem); } //----- (00530020) -------------------------------------------------------- bool sub_530020() { bool result; // eax@2 signed int v1; // esi@3 int v2; // esi@3 int v3; // esi@3 int v4; // esi@3 int v5; // esi@3 char Dst; // [sp+58h] [bp-4h]@1 memset(&Dst, 0, 4u); sub_52FF00(&Dst); if ( strcmp(&Dst, byte_5E357C) ) { v1 = fun_cdDrive_FileExistsOnDriveWithLength(&Dst, "sgs\\001bw.sg1", 15738880); v2 = fun_cdDrive_FileExistsOnDriveWithLength(&Dst, "sgs\\002bw.sg1", 15738880) & v1; v3 = fun_cdDrive_FileExistsOnDriveWithLength(&Dst, "sgs\\003bw.sg1", 15738880) & v2; v4 = fun_cdDrive_FileExistsOnDriveWithLength(&Dst, "sgs\\004bw.sg1", 15738880) & v3; v5 = fun_cdDrive_FileExistsOnDriveWithLength(&Dst, "sgs\\005bw.sg1", 15738880) & v4; result = (fun_cdDrive_FileExistsOnDriveWithLength(&Dst, "sgs\\006bw.sg1", 15738880) & v5) == 7; } else { result = 0; } return result; } // 40156E: using guessed type _DWORD sub_40156E(char *Dest); //----- (00530190) -------------------------------------------------------- void sub_530190() { winState = 0; dword_660B78 = 0; dword_660B7C = 0; debug_drawEvolveInfo = 0; debug_drawBuildingInfo = 0; debug_drawFigureInfo = 0; sub_48C740(); mapOrientation = 0; sub_42DB70(mapOrientation); if ( sidepanel_collapsed == 1 ) fun_setCityViewport_withoutPanel(); else fun_setCityViewport_withPanel(); setting_map_camera_x = 76; setting_map_camera_y = 152; setting_map_orientation = 0; sub_4DC600(); fun_generateRandomnessPool(); inputtext_lastUsed = 0; fun_initInputTextbox(1, setting_player_name, 25, 200, 0, graphic_font); fun_initInputTextbox(2, current_saveFilename, 32, 280, 1, graphic_font + F_NormalWhite); fun_initInputTextbox(4, currentScenarioFilename, 32, 280, 1, graphic_font + F_NormalWhite); fun_initInputTextbox(5, map_briefDescription, 24, 280, 0, graphic_font); fun_initInputTextbox(6, map_briefing, 500, 400, 0, graphic_font); fun_clearWarnings(); if ( fun_fileExistsOnCdWithMinimumLength("smk\\intro.smk", 60000000) ) sub_530020(); // altered } signed int loadC3ModelTxt() { signed int result; // eax@2 char *v1; // ST58_4@16 char *v2; // ST58_4@23 const char *i; // [sp+4Ch] [bp-1Ch]@5 const char *v4; // [sp+4Ch] [bp-1Ch]@11 const char *v5; // [sp+4Ch] [bp-1Ch]@18 int v6; // [sp+54h] [bp-14h]@7 int filesize; // [sp+58h] [bp-10h]@5 signed int j; // [sp+5Ch] [bp-Ch]@14 signed int k; // [sp+5Ch] [bp-Ch]@21 signed int v10; // [sp+60h] [bp-8h]@5 signed int v11; // [sp+60h] [bp-8h]@11 signed int v12; // [sp+60h] [bp-8h]@18 int numLines; // [sp+64h] [bp-4h]@5 signed int building; // [sp+64h] [bp-4h]@11 signed int v15; // [sp+64h] [bp-4h]@18 if ( screen_buffer ) { fun_memset(screen_buffer, 100000, 0); if ( fun_readFileIntoBuffer("c3_model.txt", screen_buffer) ) { filesize = fun_getFilesize("c3_model.txt"); numLines = 0; v10 = 200; for ( i = (char *)screen_buffer + fun_strnpos((const char *)screen_buffer, "ALL BUILDINGS", filesize); ; i += v6 ) { --v10; if ( v10 <= 0 ) break; v6 = fun_strnchr(i, '{', filesize); if ( !v6 ) break; ++numLines; } if ( numLines == 150 ) { building = 0; v11 = 200; v4 = (char *)screen_buffer + fun_strnpos((const char *)screen_buffer, "ALL BUILDINGS", filesize); while ( 1 ) { --v11; if ( v11 <= 0 ) break; if ( building >= 130 ) break; v4 += fun_strnchr(v4, '{', filesize); for ( j = 0; j < 8; ++j ) { v1 = (char *)&v4[fun_strNumDigitChars((char *)v4)]; switch( j ) { case 0: model_buildings[building].cost = strToInt(v1); break; case 1: model_buildings[building].desirability = strToInt(v1); break; case 2: model_buildings[building].des_step = strToInt(v1); break; case 3: model_buildings[building].des_stepSize = strToInt(v1); break; case 4: model_buildings[building].des_range = strToInt(v1); break; case 5: model_buildings[building].laborers = strToInt(v1); break; case 6: model_buildings[building].dword_5F6DD4 = strToInt(v1); break; case 7: model_buildings[building].dword_5F7814 = strToInt(v1); break; } v4 = &v1[fun_strnchr(v1, ',', filesize)]; } ++building; } v15 = 0; v12 = 200; v5 = (char *)screen_buffer + fun_strnpos((const char *)screen_buffer, "ALL HOUSES", filesize); while ( 1 ) { --v12; if ( v12 <= 0 ) break; if ( v15 >= 20 ) break; v5 += fun_strnchr(v5, 0x7Bu, filesize); for ( k = 0; k < 20; ++k ) { v2 = (char *)&v5[fun_strNumDigitChars((char *)v5)]; model_houses[v15].des_devolve[k] = strToInt(v2); v5 = &v2[fun_strnchr(v2, 0x2Cu, filesize)]; } ++v15; } fun_logDebugMessage(" OK: model loaded", 0, 0); result = 1; } else { fun_logDebugMessage("ERR:model has incorrect no of lines ", 0, numLines + 1); result = 0; } } else { fun_logDebugMessage("ERR:no c3_model.txt file", 0, 0); result = 0; } } else { fun_logDebugMessage("ERR:no spare screen for model", 0, 0); result = 0; } return result; } MMRESULT mmio_530A90(HMMIO *a1, LPMMCKINFO pmmcki, const MMCKINFO *pmmckiParent) { MMRESULT v4; // [sp+4Ch] [bp-4h]@1 v4 = 1; if ( mmioSeek(*a1, pmmckiParent->dwDataOffset + 4, 0) != -1 ) { pmmcki->ckid = 1635017060; v4 = mmioDescend(*a1, pmmcki, pmmckiParent, 0x10u); } fun_logDebugMessage("ERR:WAV start read data.", 0, 0); return v4; } //----- (00530D80) -------------------------------------------------------- int mmio_530D80(const char *a1, int *a2, HGLOBAL *a3, HGLOBAL *a4) { int v5; // [sp+4Ch] [bp-34h]@7 int v6; // [sp+50h] [bp-30h]@2 struct _MMCKINFO pmmcki; // [sp+54h] [bp-2Ch]@3 MMCKINFO pmmckiParent; // [sp+68h] [bp-18h]@1 HMMIO hmmio; // [sp+7Ch] [bp-4h]@1 *a4 = 0; *a3 = 0; *a2 = 0; if ( mmio_loadFile(a1, &hmmio, a3, &pmmckiParent) ) { v6 = 1; } else { if ( mmio_530A90(&hmmio, &pmmcki, &pmmckiParent) ) { v6 = 2; } else { *a4 = GlobalAlloc(0, pmmcki.cksize); if ( *a4 ) { if ( !mmio_530B40(hmmio, pmmcki.cksize, (char*)a4, (int)&pmmcki, (int)&v5) ) { *a2 = v5; v6 = 0; goto LABEL_14; } v6 = 4; } else { v6 = 3; } } } if ( *a4 ) { GlobalFree(*a4); *a4 = 0; } if ( *a3 ) { GlobalFree(*a3); *a3 = 0; } LABEL_14: if ( hmmio ) { mmioClose(hmmio, 0); hmmio = 0; } return v6; } //----- (00530EF0) -------------------------------------------------------- signed int fun_writeCompressedChunk(int fd, void *buffer, signed int nNumberOfBytesToWrite) { signed int result; // eax@2 compress_data = screen_buffer; if ( nNumberOfBytesToWrite <= 600000 ) { compress_inputSize = nNumberOfBytesToWrite; if ( fun_pkCompress( (int *)&pk_hashcode, &compress_size, (char *)buffer, (char *)compress_data, nNumberOfBytesToWrite) ) { _write(fd, &compress_size, 4u); _write(fd, compress_data, compress_size); } else { compress_size = 0x80000000u; _write(fd, &compress_size, 4u); _write(fd, buffer, nNumberOfBytesToWrite); } result = 1; } else { result = 0; } return result; } //----- (00530FE0) -------------------------------------------------------- signed int fun_readCompressedChunk(int fd, void *buffer, DWORD nNumberOfBytesToRead) { compress_data = screen_buffer; if ( nNumberOfBytesToRead > 600000 ) return 0; compress_inputSize = nNumberOfBytesToRead; _read(fd, &compress_size, 4u); if ( compress_size == 0x80000000 ) { _read(fd, buffer, nNumberOfBytesToRead); } else { _read(fd, (LPVOID)compress_data, compress_size); if ( !fun_pkDecompress( (int *)&pk_hashcode, (char *)compress_data, compress_size, (char *)buffer, nNumberOfBytesToRead) ) return 0; } return 1; } //----- (005310C0) -------------------------------------------------------- signed int unused_compressFile(const char *inputFile, const char *outputFile) { signed int result; // eax@2 int v3; // [sp+4Ch] [bp-4h]@1 compress_data = screen_buffer; v3 = fun_getFilesize(inputFile); if ( (unsigned int)v3 <= 300000 ) { if ( fun_readFileIntoBuffer(inputFile, (void *)compress_data) ) { compress_inputSize = v3; if ( fun_pkCompress( (int *)&pk_hashcode, &compress_size, (char *)compress_data, (char *)compress_data + 300000, v3) ) { fun_writeToFilenameAtOffset(outputFile, &compress_inputSize, 4u, 0); fun_writeToFilenameAtOffset(outputFile, (char *)compress_data + 300000, compress_size, 4); result = 1; } else { result = 0; } } else { result = 0; } } else { result = 0; } return result; } signed int unused_decompressFile(char *inputFile, const char *outputFile) { int v2; // eax@1 signed int result; // eax@2 int v4; // [sp+4Ch] [bp-4h]@1 compress_data = screen_buffer; v2 = fun_getFilesize(inputFile); v4 = v2 - 4; if ( v2 == 4 ) { result = 0; } else { fun_readDataFromFilename(inputFile, &compress_inputSize, 4u, 0); fun_readDataFromFilename(inputFile, (void *)compress_data, v4, 4); compress_size = v4; if ( fun_pkDecompress( (int *)&pk_hashcode, (char *)compress_data, v4, (char *)compress_data + 300000, compress_inputSize) ) { if ( fun_writeBufferToFile(outputFile, (char *)compress_data + 300000, compress_inputSize) ) result = 1; else result = 0; } else { result = 0; } } return result; } int j_freeMemory(void *a1) { return freeMemory(a1, 1); } int freeMemory(void *a1, signed int a2) { int result; // eax@1 char *v3; // ecx@14 int v4; // ecx@21 char v5; // [sp+0h] [bp-10h]@12 char *v6; // [sp+Ch] [bp-4h]@14 result = dword_606780 & 4; if ( dword_606780 & 4 ) { result = _CrtCheckMemory(); if ( !result ) { //result = _CrtDbgReport(2, (int)"dbgheap.c", 993, 0, "_CrtCheckMemory()", v5); //if ( result == 1 ) // __asm { int 3 ; Trap to Debugger } } } if ( a1 ) { free(a1); /*if( off_6067B8(3, a1, 0, a2, 0, 0, 0 ) { if ( !_CrtIsValidHeapPointer(a1) ) { //if ( _CrtDbgReport(2, (int)"dbgheap.c", 1011, 0, "_CrtIsValidHeapPointer(pUserData)", v5) == 1 ) // __asm { int 3 ; Trap to Debugger } } v3 = (char *)a1 - 32; v6 = (char *)a1 - 32; if ( (*((_DWORD *)a1 - 3) & 0xFFFF) != 4 ) { v3 = (char *)a1 - 32; if ( *((_DWORD *)v6 + 5) != 1 ) { if ( (*((_DWORD *)v6 + 5) & 0xFFFF) != 2 ) { v3 = (char *)a1 - 32; if ( *((_DWORD *)v6 + 5) != 3 ) { //if ( _CrtDbgReport(2, (int)"dbgheap.c", 1017, 0, "_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)", v5) == 1 ) // __asm { int 3 ; Trap to Debugger } } } } } if ( !(dword_606780 & 4) ) { _LOBYTE(v3) = byte_60678C; if ( !CheckBytes(v6 + 28, v3, 4) ) { if ( _CrtDbgReport( 1, 0, 0, 0, "DAMAGE: before %hs block (#%d) at 0x%08X.\n", *(_DWORD *)&off_606790[4 * (*((_DWORD *)v6 + 5) & 0xFFFF)]) == 1 ) __asm { int 3 ; Trap to Debugger } } _LOBYTE(v4) = byte_60678C; if ( !CheckBytes(&v6[*((_DWORD *)v6 + 4) + 32], v4, 4) ) { if ( _CrtDbgReport( 1, 0, 0, 0, "DAMAGE: after %hs block (#%d) at 0x%08X.\n", *(_DWORD *)&off_606790[4 * (*((_DWORD *)v6 + 5) & 0xFFFF)]) == 1 ) __asm { int 3 ; Trap to Debugger } } } if ( *((_DWORD *)v6 + 5) == 3 ) { if ( *((_DWORD *)v6 + 3) != -19088708 || *((_DWORD *)v6 + 6) ) { if ( _CrtDbgReport( 2, (int)"dbgheap.c", 1038, 0, "pHead->nLine == IGNORE_LINE && pHead->lRequest == IGNORE_REQ", v5) == 1 ) __asm { int 3 ; Trap to Debugger } } memset(v6, byte_60678D, *((_DWORD *)v6 + 4) + 36); result = _free_base(v6); } else { if ( *((_DWORD *)v6 + 5) == 2 ) { if ( a2 == 1 ) a2 = 2; } if ( *((_DWORD *)v6 + 5) != a2 ) { //if ( _CrtDbgReport(2, (int)"dbgheap.c", 1051, 0, "pHead->nBlockUse == nBlockUse", v5) == 1 ) // __asm { int 3 ; Trap to Debugger } } dword_60814C -= *((_DWORD *)v6 + 4); if ( dword_606780 & 2 ) { *((_DWORD *)v6 + 5) = 0; result = (int)memset(a1, byte_60678D, *((_DWORD *)a1 - 4)); } else { if ( *(_DWORD *)v6 ) { *(_DWORD *)(*(_DWORD *)v6 + 4) = *((_DWORD *)v6 + 1); } else { if ( (char *)dword_608140 != v6 ) { //if ( _CrtDbgReport(2, (int)"dbgheap.c", 1066, 0, "_pLastBlock == pHead", v5) == 1 ) // __asm { int 3 ; Trap to Debugger } } dword_608140 = *((_DWORD *)v6 + 1); } if ( *((_DWORD *)v6 + 1) ) { **((_DWORD **)v6 + 1) = *(_DWORD *)v6; } else { if ( (char *)dword_608148 != v6 ) { //if ( _CrtDbgReport(2, (int)"dbgheap.c", 1076, 0, "_pFirstBlock == pHead", v5) == 1 ) // __asm { int 3 ; Trap to Debugger } } dword_608148 = *(_DWORD *)v6; } memset(v6, byte_60678D, *((_DWORD *)v6 + 4) + 36); result = _free_base(v6); } } } else { //result = _CrtDbgReport(0, 0, 0, 0, "%s", (unsigned int)"Client hook free failure.\n"); //if ( result == 1 ) // __asm { int 3 ; Trap to Debugger } }*/ } return result; } bool sub_538D90(int a1) { bool result; // eax@2 int v2; // [sp+0h] [bp-4h]@28 if ( !dword_606A14 ) return 0; if ( *(_DWORD *)(a1 + 20) != dword_606AA8 || *(_DWORD *)(a1 + 20) != dword_606AB8 ) { if ( dword_6081F0 ) { if ( TimeZoneInformation.DaylightDate.wYear ) cvtdate( 1, 0, *(_DWORD *)(a1 + 20), TimeZoneInformation.DaylightDate.wMonth, 0, 0, TimeZoneInformation.DaylightDate.wDay, TimeZoneInformation.DaylightDate.wHour, TimeZoneInformation.DaylightDate.wMinute, TimeZoneInformation.DaylightDate.wSecond, TimeZoneInformation.DaylightDate.wMilliseconds); else cvtdate( 1, 1, *(_DWORD *)(a1 + 20), TimeZoneInformation.DaylightDate.wMonth, TimeZoneInformation.DaylightDate.wDay, TimeZoneInformation.DaylightDate.wDayOfWeek, 0, TimeZoneInformation.DaylightDate.wHour, TimeZoneInformation.DaylightDate.wMinute, TimeZoneInformation.DaylightDate.wSecond, TimeZoneInformation.DaylightDate.wMilliseconds); if ( TimeZoneInformation.StandardDate.wYear ) cvtdate( 0, 0, *(_DWORD *)(a1 + 20), TimeZoneInformation.StandardDate.wMonth, 0, 0, TimeZoneInformation.StandardDate.wDay, TimeZoneInformation.StandardDate.wHour, TimeZoneInformation.StandardDate.wMinute, TimeZoneInformation.StandardDate.wSecond, TimeZoneInformation.StandardDate.wMilliseconds); else cvtdate( 0, 1, *(_DWORD *)(a1 + 20), TimeZoneInformation.StandardDate.wMonth, TimeZoneInformation.StandardDate.wDay, TimeZoneInformation.StandardDate.wDayOfWeek, 0, TimeZoneInformation.StandardDate.wHour, TimeZoneInformation.StandardDate.wMinute, TimeZoneInformation.StandardDate.wSecond, TimeZoneInformation.StandardDate.wMilliseconds); } else { cvtdate(1, 1, *(_DWORD *)(a1 + 20), 4, 1, 0, 0, 2, 0, 0, 0); cvtdate(0, 1, *(_DWORD *)(a1 + 20), 10, 5, 0, 0, 2, 0, 0, 0); } } if ( dword_606AAC >= dword_606ABC ) { if ( *(_DWORD *)(a1 + 28) < dword_606ABC || *(_DWORD *)(a1 + 28) > dword_606AAC ) return 1; if ( *(_DWORD *)(a1 + 28) > dword_606ABC && *(_DWORD *)(a1 + 28) < dword_606AAC ) return 0; } else { if ( *(_DWORD *)(a1 + 28) < dword_606AAC || *(_DWORD *)(a1 + 28) > dword_606ABC ) return 0; if ( *(_DWORD *)(a1 + 28) > dword_606AAC && *(_DWORD *)(a1 + 28) < dword_606ABC ) return 1; } v2 = 1000 * (3600 * *(_DWORD *)(a1 + 8) + 60 * *(_DWORD *)(a1 + 4) + *(_DWORD *)a1); if ( *(_DWORD *)(a1 + 28) == dword_606AAC ) result = v2 >= dword_606AB0; else result = v2 < dword_606AC0; return result; } void sub_42E560(int x, int y, int gridOffset) { dword_9A050C = x; dword_9A0510 = y; dword_9A04E0 = gridOffset; draw_clip_x = cityviewport_x; draw_clip_xEnd = cityviewport_xEnd; draw_clip_y = cityviewport_y; draw_clip_yEnd = cityviewport_yEnd; dword_9A0534 = 0; if ( time_current - dword_9A0524 > 60 || time_current - dword_9A0524 < 0 ) { dword_9A0524 = time_current; dword_9A0534 = 1; } if ( currentOverlay ) { fun_drawOverlay(); sub_4384F0(); fun_drawSelectedBuildingGhost(); sub_437E20(9999); sub_43E600(); } else { sub_42E7A0(); fun_drawExtraBuildingImages(0); fun_drawSelectedBuildingGhost(); sub_437E20(0); sub_43E600(); } if ( dword_9A04A8 ) --dword_9A04A8; draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; } void sub_4DC1B0() { sub_42E560(setting_map_camera_x, setting_map_camera_y, setting_map_startGridOffset); } void fun_drawHelpDialogNoVideo() { int v0; // ST18_4@65 int v1; // ST14_4@65 int v2; // esi@65 signed int v3; // eax@65 int v4; // ST18_4@67 int v5; // ST14_4@67 int v6; // esi@67 signed int v7; // eax@67 int v8; // ST18_4@70 int v9; // ST14_4@70 int v10; // esi@70 signed int v11; // eax@70 font_currentFontId = graphic_font + F_NormalWhite; dword_7E2C08 = graphic_font + F_NormalRed; xOffset = help_x[40 * currentHelpId] + screen_640x480_x; yOffset = help_y[40 * currentHelpId] + screen_640x480_y; if ( !dword_7E29E8 ) { sub_4DC1B0(); if ( window_redrawRequest == 1 ) fun_drawCityScreenForeground(); } if ( help_type[40 * currentHelpId] ) dword_7E313C = 32; else dword_7E313C = 48; helpDialog_text_x = xOffset + 16; fun_drawDialogBackground(xOffset, yOffset, help_width[40 * currentHelpId], help_height[40 * currentHelpId]); if ( help_title_x[40 * currentHelpId] ) { fun_drawText( &c3mm_data[help_title[20 * currentHelpId]], help_title_x[40 * currentHelpId] + xOffset, help_title_y[40 * currentHelpId] + yOffset, graphic_font + F_LargeBlack, 0); helpDialog_text_y = yOffset + 32; } else { if ( help_messageType[40 * currentHelpId] == HelpMessage_Tutorial ) fun_drawTextCentered( &c3mm_data[help_title[20 * currentHelpId]], xOffset, help_title_y[40 * currentHelpId] + yOffset, 16 * help_width[40 * currentHelpId], graphic_font + F_LargeBlack, 0); else fun_drawTextCentered( &c3mm_data[help_title[20 * currentHelpId]], xOffset, yOffset + 14, 16 * help_width[40 * currentHelpId], graphic_font + F_LargeBlack, 0); helpDialog_text_y = yOffset + 48; } if ( help_picture1_id[40 * currentHelpId] ) { if ( currentHelpId ) { drawGraphic( word_6E6CEE + help_picture1_id[40 * currentHelpId] - 1, help_picture1_x[40 * currentHelpId] + xOffset, help_picture1_y[40 * currentHelpId] + yOffset); } else // about { help_picture1_x[40 * currentHelpId] = 16; help_picture1_y[40 * currentHelpId] = 16; if ( dword_607F8C == 2 ) { drawGraphic( word_6E6DA2, help_picture1_x[40 * currentHelpId] + xOffset, help_picture1_y[40 * currentHelpId] + yOffset); fun_drawSubMenuBackground( xOffset + help_picture1_x[40 * currentHelpId] + 30, yOffset + help_picture1_y[40 * currentHelpId] + 40, 2, 1); } else { drawGraphic( graphic_bigpeople, help_picture1_x[40 * currentHelpId] + xOffset, help_picture1_y[40 * currentHelpId] + yOffset); } } if ( help_picture1_y[40 * currentHelpId] + yOffset + (signed __int16)drawGraphic_height + 8 > helpDialog_text_y ) helpDialog_text_y = help_picture1_y[40 * currentHelpId] + yOffset + (signed __int16)drawGraphic_height + 8; } if ( help_picture2_id[40 * currentHelpId] ) { drawGraphic( word_6E6CEE + help_picture2_id[40 * currentHelpId] - 1, help_picture2_x[40 * currentHelpId] + xOffset, help_picture2_y[40 * currentHelpId] + yOffset); if ( help_picture2_y[40 * currentHelpId] + yOffset + (signed __int16)drawGraphic_height + 8 > helpDialog_text_y ) helpDialog_text_y = help_picture2_y[40 * currentHelpId] + yOffset + (signed __int16)drawGraphic_height + 8; } if ( help_subtitle_x[40 * currentHelpId] ) { dword_7E2C04 = 16 * help_width[40 * currentHelpId] - 16 - help_subtitle_x[40 * currentHelpId]; text_yoffset = 0; fun_drawTextWrapped( &c3mm_data[help_subtitle[20 * currentHelpId]], help_subtitle_x[40 * currentHelpId] + xOffset, help_subtitle_y[40 * currentHelpId] + yOffset, dword_7E2C04, graphic_font + F_NormalBlack, 0); if ( text_yoffset + help_subtitle_y[40 * currentHelpId] + yOffset > helpDialog_text_y ) helpDialog_text_y = help_subtitle_y[40 * currentHelpId] + yOffset + text_yoffset + 4; } if ( !dword_7E2C10 ) { helpDialog_text_height = help_height[40 * currentHelpId] - 1 - (dword_7E313C + helpDialog_text_y - yOffset) / 16; dword_7E3128 = helpDialog_text_height - 1; helpDialog_text_width = help_width[40 * currentHelpId] - 4; imagebuttons_unknown_5EF670.state_enabled = 1; imagebuttons_unknown_5EF698.state_enabled = 1; fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 6, 16 * helpDialog_text_width - 16, 1); if ( dword_7E2C10 <= dword_7E3128 ) { helpDialog_text_width = help_width[40 * currentHelpId] - 2; helpDialog_max = 0; imagebuttons_unknown_5EF670.state_enabled = 0; imagebuttons_unknown_5EF698.state_enabled = 0; } else { helpDialog_max = dword_7E2C10 - dword_7E3128; } window_redrawRequest = 1; } if ( helpDialog_showVideo ) fun_fillRect( help_unknown20[40 * currentHelpId] + xOffset, help_unknown21[40 * currentHelpId] + yOffset, 200, 200, 0xF800u); fun_drawSunkenTextBox(helpDialog_text_x, helpDialog_text_y, helpDialog_text_width, helpDialog_text_height); draw_clip_x = helpDialog_text_x + 3; draw_clip_xEnd = helpDialog_text_x + 16 * helpDialog_text_width - 3; draw_clip_y = helpDialog_text_y + 3; draw_clip_yEnd = helpDialog_text_y + 16 * helpDialog_text_height - 3; sub_4C64A0(); if ( help_type[40 * currentHelpId] == Help_Message ) { if ( help_messageType[40 * currentHelpId] != HelpMessage_Tutorial ) { text_xoffset = 0; fun_drawGameText( 25, message_month, helpDialog_text_x + 10, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); fun_drawGameYearWithBcAd( 0, message_year, helpDialog_text_x + text_xoffset + 12, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); if ( help_messageType[40 * currentHelpId] == HelpMessage_Disaster ) { if ( message_param1 ) { if ( currentHelpId == 251 ) // theft: amount of money fun_drawNumberSingularPlural( 8, 0, message_param1, xOffset + 240, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); else // building id fun_drawGameText( 41, message_param1, xOffset + 240, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); } else { fun_drawGameText( 63, 5, helpDialog_text_x + text_xoffset + 80, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); fun_drawText( setting_player_name, helpDialog_text_x + text_xoffset + 80, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); } } else { fun_drawGameText( 63, 5, helpDialog_text_x + text_xoffset + 80, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); fun_drawText( setting_player_name, helpDialog_text_x + text_xoffset + 80, helpDialog_text_y + 6, graphic_font + F_NormalWhite, 0); } } text_yoffset = 0; if ( help_messageType[40 * currentHelpId] != 1 && help_messageType[40 * currentHelpId] != 7 ) { switch ( help_messageType[40 * currentHelpId] ) { case HelpMessage_Emigration: switch ( city_inform[ciid].dword_654464 ) { case 1: fun_drawGameText(12, 3, xOffset + 64, helpDialog_text_y + 44, graphic_font + 268, 0); break; case 2: fun_drawGameText(12, 4, xOffset + 64, helpDialog_text_y + 44, graphic_font + 268, 0); break; case 3: fun_drawGameText(12, 5, xOffset + 64, helpDialog_text_y + 44, graphic_font + 268, 0); break; case 4: fun_drawGameText(12, 6, xOffset + 64, helpDialog_text_y + 44, graphic_font + 268, 0); break; case 5: fun_drawGameText(12, 7, xOffset + 64, helpDialog_text_y + 44, graphic_font + 268, 0); break; } fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 86, 16 * helpDialog_text_width - 16, 0); break; case HelpMessage_Tutorial: fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 6, 16 * helpDialog_text_width - 16, 0); break; case HelpMessage_TradeChange: v0 = helpDialog_text_y + 40; v1 = xOffset + 64; v2 = message_paramResourceId + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(message_paramResourceId, 3); drawGraphic(v3 + v2, v1, v0); fun_drawGameText( 21, tradeRoutes[message_param1].cityNameId, xOffset + 100, helpDialog_text_y + 44, graphic_font + 268, 0); fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 86, 16 * helpDialog_text_width - 16, 0); break; case HelpMessage_PriceChange: v4 = helpDialog_text_y + 40; v5 = xOffset + 64; v6 = message_paramResourceId + graphic_resourceIcons; v7 = fun_getResourceGraphicIdOffset(message_paramResourceId, 3); drawGraphic(v7 + v6, v5, v4); drawNumber(message_param1, 64, " Dn", xOffset + 100, helpDialog_text_y + 44, graphic_font + 268, 0); fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 86, 16 * helpDialog_text_width - 16, 0); break; default: fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 56, 16 * helpDialog_text_width - 16, 0); break; } } else { fun_drawGameText(12, 1, xOffset + 100, helpDialog_text_y + 44, graphic_font + 268, 0); fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 86, 16 * helpDialog_text_width - 16, 0); } if ( help_messageType[40 * currentHelpId] == HelpMessage_Imperial ) { drawNumber( scn_requests_amount[message_param1], 64, " ", helpDialog_text_x + 8, helpDialog_text_y + text_yoffset + 86, graphic_font + 268, 0); v8 = helpDialog_text_y + text_yoffset + 81; v9 = helpDialog_text_x + 70; v10 = scn_requests_good[message_param1] + graphic_resourceIcons; v11 = fun_getResourceGraphicIdOffset(scn_requests_good[message_param1], 3); drawGraphic(v11 + v10, v9, v8); fun_drawGameText( 23, scn_requests_good[message_param1], helpDialog_text_x + 100, helpDialog_text_y + text_yoffset + 86, graphic_font + 268, 0); if ( scn_requests_state[message_param1] <= 1 ) { text_xoffset = 0; fun_drawNumberSingularPlural( 8, 4, scn_requests_monthsToComply[message_param1], helpDialog_text_x + 200, helpDialog_text_y + text_yoffset + 86, graphic_font + 268, 0); fun_drawGameText( 12, 2, helpDialog_text_x + text_xoffset + 200, helpDialog_text_y + text_yoffset + 86, graphic_font + 268, 0); } } } else { fun_drawScrollableText( &c3mm_data[help_content[20 * currentHelpId]], helpDialog_text_x + 8, helpDialog_text_y + 6, 16 * helpDialog_text_width - 16, 0); } draw_clip_x = 0; draw_clip_xEnd = screen_width; draw_clip_y = 0; draw_clip_yEnd = screen_height; sub_4C4CC0(); } void fun_drawHelpDialogWithVideo() { int v0; // ST18_4@11 int v1; // ST14_4@11 int v2; // esi@11 signed int v3; // eax@11 font_currentFontId = graphic_font + 268; dword_7E2C08 = graphic_font + 402; xOffset = screen_640x480_x + 32; yOffset = screen_640x480_y + 28; if ( !dword_7E29E8 ) { sub_4DC1B0(); if ( window_redrawRequest == 1 ) fun_drawCityScreenForeground(); } fun_drawDialogBackground(xOffset, yOffset, 26, 28); fun_drawRect(xOffset + 7, yOffset + 7, 402, 294, 0); sub_4C64A0(); fun_startVideo(&c3mm_data[help_videoLink[20 * currentHelpId]], xOffset + 8, yOffset + 8, 0, window_id); fun_drawSunkenTextBox(xOffset + 8, yOffset + 308, 25, 6); fun_drawTextCentered( &c3mm_data[help_title[20 * currentHelpId]], xOffset + 8, yOffset + 414, 400, graphic_font + 134, 0); text_xoffset = 0; fun_drawGameText(25, message_month, xOffset + 16, yOffset + 312, graphic_font + 268, 0); fun_drawGameYearWithBcAd(0, message_year, xOffset + text_xoffset + 18, yOffset + 312, graphic_font + 268, 0); if ( help_type[40 * currentHelpId] != Help_Message || help_messageType[40 * currentHelpId] != 1 || currentHelpId != 251 ) { fun_drawGameText(63, 5, xOffset + text_xoffset + 90, yOffset + 312, graphic_font + 268, 0); fun_drawText(setting_player_name, xOffset + text_xoffset + 90, yOffset + 312, graphic_font + 268, 0); } else { fun_drawNumberSingularPlural( 8, 0, message_param1, xOffset + text_xoffset + 90, yOffset + 312, graphic_font + 268, 0); } text_yoffset = 0; helpDialog_text_height = help_height[40 * currentHelpId] - 1 - (dword_7E313C + helpDialog_text_y - yOffset) / 16; dword_7E3128 = helpDialog_text_height - 1; helpDialog_text_width = help_width[40 * currentHelpId] - 4; fun_drawScrollableText(&c3mm_data[help_content[20 * currentHelpId]], xOffset + 16, yOffset + 332, 384, 0); if ( help_type[40 * currentHelpId] == Help_Message ) { if ( help_messageType[40 * currentHelpId] == HelpMessage_Imperial ) { drawNumber(scn_requests_amount[message_param1], 64, " ", xOffset + 8, yOffset + 384, graphic_font + 268, 0); v0 = yOffset + 379; v1 = xOffset + 70; v2 = scn_requests_good[message_param1] + graphic_resourceIcons; v3 = fun_getResourceGraphicIdOffset(scn_requests_good[message_param1], 3); drawGraphic(v3 + v2, v1, v0); fun_drawGameText(23, scn_requests_good[message_param1], xOffset + 100, yOffset + 384, graphic_font + 268, 0); if ( scn_requests_state[message_param1] <= 1 ) { text_xoffset = 0; fun_drawNumberSingularPlural( 8, 4, scn_requests_monthsToComply[message_param1], xOffset + 200, yOffset + 384, graphic_font + 268, 0); fun_drawGameText(12, 2, xOffset + text_xoffset + 200, yOffset + 384, graphic_font + 268, 0); } } } fun_drawHelpDialogButtons(); }