# HG changeset patch # User Ritor1 # Date 1387995589 -21600 # Node ID de5cdcb03fda3cf21cc8d05fc8e8be9ed43c11a2 # Parent 5b654c03a11e81989530a922b41294f6d466600d sky for snow diff -r 5b654c03a11e -r de5cdcb03fda Game.cpp --- a/Game.cpp Wed Dec 25 17:42:19 2013 +0600 +++ b/Game.cpp Thu Dec 26 00:19:49 2013 +0600 @@ -205,7 +205,7 @@ static uint frames_this_second = 0; static uint last_frame_time = GetTickCount(); static uint framerate_time_elapsed = 0; - if ( pCurrentScreen == SCREEN_GAME ) + if ( pCurrentScreen == SCREEN_GAME && uCurrentlyLoadedLevelType == LEVEL_Outdoor) pWeather->Draw();//Ritor1: my include uint frame_dt = GetTickCount() - last_frame_time; diff -r 5b654c03a11e -r de5cdcb03fda Outdoor.cpp --- a/Outdoor.cpp Wed Dec 25 17:42:19 2013 +0600 +++ b/Outdoor.cpp Thu Dec 26 00:19:49 2013 +0600 @@ -1126,60 +1126,60 @@ //----- (0047CDE2) -------------------------------------------------------- void OutdoorLocation::CreateDebugLocation() { - OutdoorLocation *v1; // esi@1 + //OutdoorLocation *v1; // esi@1 void *v2; // eax@1 void *v3; // ST14_4@1 void *v4; // eax@1 void *v5; // ST14_4@1 void *v6; // eax@1 - unsigned int v7; // eax@1 + //unsigned int v7; // eax@1 //char v8; // zf@1 - v1 = this; + //v1 = this; strcpy(this->pLevelFilename, "blank"); - strcpy(v1->pLocationFileName, "i6.odm"); - strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00"); - v1->uNumBModels = 0; - v1->pTileTypes[0].tileset = Tileset_Grass; - v1->pTileTypes[1].tileset = Tileset_Water; - v1->pTileTypes[2].tileset = Tileset_6; - v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble; - v1->LoadTileGroupIds(); - v1->LoadRoadTileset(); - free(v1->pBModels); - free(v1->pSpawnPoints); - v1->pBModels = 0; - v1->pSpawnPoints = 0; - v1->pTerrain.Initialize(); - v1->pTerrain.ZeroLandscape(); - v1->pTerrain.FillDMap(0, 0, 128, 128); - free(v1->pCmap); - v1->pCmap = 0; + strcpy(this->pLocationFileName, "i6.odm"); + strcpy(this->pLocationFileDescription, "MM6 Outdoor v1.00"); + this->uNumBModels = 0; + this->pTileTypes[0].tileset = Tileset_Grass; + this->pTileTypes[1].tileset = Tileset_Water; + this->pTileTypes[2].tileset = Tileset_6; + this->pTileTypes[3].tileset = Tileset_RoadGrassCobble; + this->LoadTileGroupIds(); + this->LoadRoadTileset(); + free(this->pBModels); + free(this->pSpawnPoints); + this->pBModels = 0; + this->pSpawnPoints = 0; + this->pTerrain.Initialize(); + this->pTerrain.ZeroLandscape(); + this->pTerrain.FillDMap(0, 0, 128, 128); + free(this->pCmap); + this->pCmap = 0; v2 = malloc(0x8000u); - v3 = v1->pOMAP; - v1->pCmap = v2; + v3 = this->pOMAP; + this->pCmap = v2; free(v3); - v1->pOMAP = 0; + this->pOMAP = 0; v4 = malloc(0x10000u); - v1->pOMAP = (unsigned int *)v4; + this->pOMAP = (unsigned int *)v4; memset(v4, 0, 0x10000u); - v5 = v1->pFaceIDLIST; - v1->numFaceIDListElems = 0; + v5 = this->pFaceIDLIST; + this->numFaceIDListElems = 0; free(v5); - v1->pFaceIDLIST = 0; + this->pFaceIDLIST = 0; v6 = malloc(2); - v1->pFaceIDLIST = (unsigned __int16 *)v6; + this->pFaceIDLIST = (unsigned __int16 *)v6; *(short *)v6 = 0; - strcpy(v1->pSkyTextureName, pDefaultSkyTexture.data()); - v1->sSky_TextureID = pBitmaps_LOD->LoadTexture(v1->pSkyTextureName); - strcpy(v1->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); - v7 = pBitmaps_LOD->LoadTexture(v1->pGroundTileset); - v1->sMainTile_BitmapID = v7; - - if ( v1->sSky_TextureID == -1 ) + strcpy(this->pSkyTextureName, pDefaultSkyTexture.data()); + this->sSky_TextureID = pBitmaps_LOD->LoadTexture(this->pSkyTextureName); + strcpy(this->pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture.data()); + //v7 = pBitmaps_LOD->LoadTexture(this->pGroundTileset); + this->sMainTile_BitmapID = pBitmaps_LOD->LoadTexture(this->pGroundTileset); + + if ( this->sSky_TextureID == -1 ) Error("Invalid Sky Tex Handle"); - if ( v1->sMainTile_BitmapID == -1 ) + if ( this->sMainTile_BitmapID == -1 ) Error("Invalid Ground Tex Handle"); } @@ -2334,7 +2334,9 @@ //v100 = HIDWORD(uLastVisitDay); //LODWORD(v142) = LODWORD(uLastVisitDay); //HIDWORD(v142) = v100; - if (loc_time.uLastVisitDay) + if ( pWeather->bRenderSnow ) //Ritor1: it's include + strcpy(loc_time.sky_texture_name, "sky19"); + else if (loc_time.uLastVisitDay) { if ( (signed int)((signed int)(signed __int64)((double)loc_time.uLastVisitDay * 0.234375) / 60 / 60 / 24) % 28 != pParty->uDaysPlayed ) { @@ -2346,9 +2348,8 @@ } } else - { strcpy(loc_time.sky_texture_name, "plansky3"); - } + //v101 = pBitmaps_LOD->LoadTexture(field_4F8); sSky_TextureID = pBitmaps_LOD->LoadTexture(loc_time.sky_texture_name); if (sSky_TextureID != -1) @@ -2361,40 +2362,39 @@ pSoundList->LoadSound(96, 0); pSoundList->LoadSound(64, 0); pSoundList->LoadSound(103, 0); - for (int i=0; i<3;++i) + for (int i=0; i < 3;++i) { - - switch ( pTileTypes[i].tileset ) - { - case Tileset_Grass: - pSoundList->LoadSound(54, 0); - pSoundList->LoadSound(93, 0); - break; - case Tileset_Snow: - pSoundList->LoadSound(58, 0); - pSoundList->LoadSound(97, 0); - break; - case Tileset_2: - pSoundList->LoadSound(52, 0); - pSoundList->LoadSound(91, 0); - break; - case Tileset_3: - pSoundList->LoadSound(51, 0); - pSoundList->LoadSound(90, 0); - break; - case Tileset_Water: - pSoundList->LoadSound(62, 0); - pSoundList->LoadSound(101, 0); - break; - case Tileset_6: - pSoundList->LoadSound(49, 0); - pSoundList->LoadSound(88, 0); - break; - case Tileset_Swamp: - pSoundList->LoadSound(61, 0); - pSoundList->LoadSound(100, 0); - break; - } + switch ( pTileTypes[i].tileset ) + { + case Tileset_Grass: + pSoundList->LoadSound(54, 0); + pSoundList->LoadSound(93, 0); + break; + case Tileset_Snow: + pSoundList->LoadSound(58, 0); + pSoundList->LoadSound(97, 0); + break; + case Tileset_2: + pSoundList->LoadSound(52, 0); + pSoundList->LoadSound(91, 0); + break; + case Tileset_3: + pSoundList->LoadSound(51, 0); + pSoundList->LoadSound(90, 0); + break; + case Tileset_Water: + pSoundList->LoadSound(62, 0); + pSoundList->LoadSound(101, 0); + break; + case Tileset_6: + pSoundList->LoadSound(49, 0); + pSoundList->LoadSound(88, 0); + break; + case Tileset_Swamp: + pSoundList->LoadSound(61, 0); + pSoundList->LoadSound(100, 0); + break; + } } return true; } @@ -2852,10 +2852,10 @@ //double v7; // ST30_8@10 unsigned int v8; // eax@11 int v9; // edx@11 - __int16 v10; // dx@11 - unsigned int v11; // eax@13 + //__int16 v10; // dx@11 + //unsigned int v11; // eax@13 signed int v12; // eax@16 - __int16 v13; // cx@21 + //__int16 v13; // cx@21 SpriteFrame *v14; // eax@24 SpriteFrame *v15; // ebx@25 //int *v16; // eax@25 @@ -2881,8 +2881,8 @@ int v36; // ecx@54 //unsigned __int8 v37; // zf@54 //unsigned __int8 v38; // sf@54 - unsigned int v39; // [sp-8h] [bp-68h]@23 - unsigned int v40; // [sp-4h] [bp-64h]@23 + //unsigned int v39; // [sp-8h] [bp-68h]@23 + //unsigned int v40; // [sp-4h] [bp-64h]@23 int v41; // [sp+24h] [bp-3Ch]@11 int v42; // [sp+28h] [bp-38h]@38 int v43; // [sp+28h] [bp-38h]@45 @@ -2914,75 +2914,59 @@ //v1 = pActors;//[0].vPosition.z; //do //{ - Actor* actor = &pActors[i]; + //Actor* actor = &pActors[i]; //v2 = actor->uAIState; - actor->uAttributes &= 0xFFFFFFF7u; - if (actor->uAIState == Removed || actor->uAIState == Disabled) + pActors[i].uAttributes &= 0xFFFFFFF7u; + if (pActors[i].uAIState == Removed || pActors[i].uAIState == Disabled) continue; - z = actor->vPosition.z; + z = pActors[i].vPosition.z; v49 = 0; - x = actor->vPosition.x; - y = actor->vPosition.y; - if (actor->uAIState == Summoned) + x = pActors[i].vPosition.x; + y = pActors[i].vPosition.y; + if (pActors[i].uAIState == Summoned) { - if (PID_TYPE(actor->uSummonerID) != OBJECT_Actor || - pActors[PID_ID(actor->uSummonerID)].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) + if (PID_TYPE(pActors[i].uSummonerID) != OBJECT_Actor || + pActors[PID_ID(pActors[i].uSummonerID)].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 ) { - z += floorf(actor->uActorHeight * 0.5f + 0.5f); + z += floorf(pActors[i].uActorHeight * 0.5f + 0.5f); } else { v49 = 1; - pGame->pStru6Instance->_4A7F74(actor->vPosition.x, actor->vPosition.y, z); - v4 = (1.0 - (double)actor->uCurrentActionTime / (double)actor->uCurrentActionLength) * - (double)(2 * actor->uActorHeight); + pGame->pStru6Instance->_4A7F74(pActors[i].vPosition.x, pActors[i].vPosition.y, z); + v4 = (1.0 - (double)pActors[i].uCurrentActionTime / (double)pActors[i].uCurrentActionLength) * + (double)(2 * pActors[i].uActorHeight); z -= floorf(v4 + 0.5f); - if ( z > actor->vPosition.z ) - z = actor->vPosition.z; + if ( z > pActors[i].vPosition.z ) + z = pActors[i].vPosition.z; } } - v8 = stru_5C6E00->Atan2(actor->vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, - actor->vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); - LOWORD(v9) = actor->uYawAngle; + v8 = stru_5C6E00->Atan2(pActors[i].vPosition.x - pGame->pIndoorCameraD3D->vPartyPos.x, + pActors[i].vPosition.y - pGame->pIndoorCameraD3D->vPartyPos.y); + LOWORD(v9) = pActors[i].uYawAngle; v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7; - v10 = actor->uCurrentActionAnimation; if ( pParty->bTurnBasedModeOn ) { - if ( v10 != 1 ) - { -LABEL_17: - v12 = actor->uCurrentActionTime; - goto LABEL_18; - } - v11 = pMiscTimer->uTotalGameTimeElapsed; + v12 = pActors[i].uCurrentActionTime; + if ( pActors[i].uCurrentActionAnimation == 1 ) + v12 = 32 * i + pMiscTimer->uTotalGameTimeElapsed; } else { - if ( v10 != 1 ) - goto LABEL_17; - v11 = pEventTimer->uTotalGameTimeElapsed; + v12 = pActors[i].uCurrentActionTime; + if ( pActors[i].uCurrentActionAnimation == 1 ) + v12 = 32 * i + pEventTimer->uTotalGameTimeElapsed; } - v12 = 32 * i + v11; -LABEL_18: - if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 || (signed __int64)actor->pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 ) + if ( (signed __int64)pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0 || (signed __int64)pActors[i].pActorBuffs[ACTOR_BUFF_PARALYZED].uExpireTime > 0 ) v12 = 0; - v13 = actor->uAIState; - if ( v13 == 17 && !v49 ) - { - v40 = v12; - v39 = uSpriteID_Spell11; -LABEL_24: - v14 = pSpriteFrameTable->GetFrame(v39, v40); - goto LABEL_25; - } - v40 = v12; - v39 = actor->pSpriteIDs[v10]; - if ( v13 != 16 ) - goto LABEL_24; - v14 = pSpriteFrameTable->GetFrameBy_x(v39, v12); -LABEL_25: + if ( pActors[i].uAIState == 17 && !v49 ) + v14 = pSpriteFrameTable->GetFrame(uSpriteID_Spell11, v12); + else if ( pActors[i].uAIState == 16 ) + v14 = pSpriteFrameTable->GetFrameBy_x(pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], v12); + else + v14 = pSpriteFrameTable->GetFrame(pActors[i].pSpriteIDs[pActors[i].uCurrentActionAnimation], v12); v62 = 0; v15 = v14; //v16 = (int *)v14->uFlags; @@ -3055,19 +3039,19 @@ return; ++uNumBillboardsToDraw; ++uNumSpritesDrawnThisFrame; - actor->uAttributes |= 8u; + pActors[i].uAttributes |= 8u; v28->uHwSpriteID = v15->pHwSpriteIDs[v41]; v28->uIndoorSectorID = 0; v28->uPalette = v15->uPaletteIndex; v28->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16; - v30 = HIDWORD(actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) == 0; - v31 = SHIDWORD(actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) < 0; + v30 = HIDWORD(pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) == 0; + v31 = SHIDWORD(pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) < 0; v28->_screenspace_y_scaler_packedfloat = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16; - if ( v31 || v31 | v30 && LODWORD(actor->pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) <= 0u ) + if ( v31 || v31 | v30 && LODWORD(pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uExpireTime) <= 0u ) { - if ( (signed __int64)actor->pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0i64 ) + if ( (signed __int64)pActors[i].pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime > 0i64 ) { - v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(actor) + v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(&pActors[i]) * (signed __int64)v28->_screenspace_y_scaler_packedfloat) >> 16; LABEL_53: LOWORD(v27) = v43; @@ -3076,10 +3060,10 @@ } else { - v32 = actor->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; + v32 = pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; if ( v32 ) { - v33 = actor->pActorBuffs[ACTOR_BUFF_SHRINK].uPower; + v33 = pActors[i].pActorBuffs[ACTOR_BUFF_SHRINK].uPower; v28->_screenspace_x_scaler_packedfloat = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->_screenspace_x_scaler_packedfloat) >> 16; v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->_screenspace_y_scaler_packedfloat) >> 16; goto LABEL_53; @@ -3096,11 +3080,11 @@ v28->sZValue = v34 + PID(OBJECT_Actor, i); v28->field_14_actor_id = i; v35 = pMonsterList->pMonsters; - v36 = actor->pMonsterInfo.uID; + v36 = pActors[i].pMonsterInfo.uID; v28->field_1E = v62 | 0x200; v28->pSpriteFrame = v15; - v28->sTintColor = pMonsterList->pMonsters[actor->pMonsterInfo.uID-1].sTintColor;//*((int *)&v35[v36] - 36); - if (actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) + v28->sTintColor = pMonsterList->pMonsters[pActors[i].pMonsterInfo.uID-1].sTintColor;//*((int *)&v35[v36] - 36); + if (pActors[i].pActorBuffs[ACTOR_BUFF_STONED].uExpireTime) v28->field_1E = v62 | 0x200; } //LABEL_58: