Mercurial > mm7
comparison Render.cpp @ 430:58b71c1af7d8
Objects are drawn (items, spells sfx)
author | Nomad |
---|---|
date | Sun, 24 Feb 2013 00:54:25 +0200 |
parents | edd2d8b7e3c4 |
children | cb0ad52d6a26 |
comparison
equal
deleted
inserted
replaced
427:49d945ce4285 | 430:58b71c1af7d8 |
---|---|
3051 | 3051 |
3052 //----- (0047AF11) -------------------------------------------------------- | 3052 //----- (0047AF11) -------------------------------------------------------- |
3053 void Render::DrawLayingItems_Shooting_Magic_ODM() | 3053 void Render::DrawLayingItems_Shooting_Magic_ODM() |
3054 { | 3054 { |
3055 //char *v0; // edi@2 | 3055 //char *v0; // edi@2 |
3056 ObjectDesc *v1; // ebx@4 | 3056 //ObjectDesc *v1; // ebx@4 |
3057 __int16 v2; // cx@5 | 3057 __int16 v2; // cx@5 |
3058 RenderBillboard *v3; // esi@10 | 3058 RenderBillboard *v3; // esi@10 |
3059 SpriteFrame *v4; // eax@10 | 3059 SpriteFrame *v4; // eax@10 |
3060 SpriteFrame *v5; // ebx@10 | 3060 //SpriteFrame *v5; // ebx@10 |
3061 unsigned int v6; // eax@10 | 3061 unsigned int v6; // eax@10 |
3062 int v7; // ecx@10 | 3062 //int v7; // ecx@10 |
3063 int v8; // edx@10 | 3063 //int v8; // edx@10 |
3064 int v9; // ecx@10 | 3064 int v9; // ecx@10 |
3065 unsigned __int16 v10; // ax@10 | 3065 unsigned __int16 v10; // ax@10 |
3066 int *v11; // eax@14 | 3066 //int *v11; // eax@14 |
3067 int v12; // eax@22 | 3067 int v12; // eax@22 |
3068 int v13; // ST3C_4@23 | 3068 int v13; // ST3C_4@23 |
3069 int v14; // eax@23 | 3069 int v14; // eax@23 |
3070 int v15; // ecx@23 | 3070 int v15; // ecx@23 |
3071 int v16; // ebx@23 | 3071 int v16; // ebx@23 |
3078 signed __int64 v23; // qtt@30 | 3078 signed __int64 v23; // qtt@30 |
3079 int v24; // ebx@30 | 3079 int v24; // ebx@30 |
3080 int v25; // ST3C_4@30 | 3080 int v25; // ST3C_4@30 |
3081 int v26; // eax@31 | 3081 int v26; // eax@31 |
3082 char v27; // zf@31 | 3082 char v27; // zf@31 |
3083 SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 | 3083 //SpriteFrame *v28; // [sp+Ch] [bp-34h]@10 |
3084 __int16 a5; // [sp+10h] [bp-30h]@10 | 3084 //__int16 a5; // [sp+10h] [bp-30h]@10 |
3085 int v30; // [sp+14h] [bp-2Ch]@23 | 3085 int v30; // [sp+14h] [bp-2Ch]@23 |
3086 int v31; // [sp+14h] [bp-2Ch]@29 | 3086 int v31; // [sp+14h] [bp-2Ch]@29 |
3087 __int16 v32; // [sp+14h] [bp-2Ch]@30 | 3087 __int16 v32; // [sp+14h] [bp-2Ch]@30 |
3088 int v33; // [sp+18h] [bp-28h]@23 | 3088 int v33; // [sp+18h] [bp-28h]@23 |
3089 int v34; // [sp+18h] [bp-28h]@26 | 3089 int v34; // [sp+18h] [bp-28h]@26 |
3101 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 | 3101 signed __int16 v46; // [sp+3Ch] [bp-4h]@12 |
3102 | 3102 |
3103 //v41 = 0; | 3103 //v41 = 0; |
3104 for (int i = 0; i < uNumLayingItems; ++i) | 3104 for (int i = 0; i < uNumLayingItems; ++i) |
3105 { | 3105 { |
3106 auto v0 = (char *)&pLayingItems[i].uSectorID; | 3106 auto object = pLayingItems + i; |
3107 //auto v0 = (char *)&pLayingItems[i].uSectorID; | |
3107 //v0 = (char *)&pLayingItems[0].uSectorID; | 3108 //v0 = (char *)&pLayingItems[0].uSectorID; |
3108 //do | 3109 //do |
3109 //{ | 3110 //{ |
3110 if ( *((short *)v0 - 13) ) | 3111 if (!object->uObjectDescID) // item probably pciked up |
3111 { | 3112 continue; |
3112 v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; | 3113 |
3113 if ( !(v1->uFlags & 1) ) | 3114 assert(object->uObjectDescID < pObjectList->uNumObjects); |
3114 { | 3115 auto object_desc = pObjectList->pObjects + object->uObjectDescID; |
3115 if ( ((v2 = *((short *)v0 - 14), v2 < 1000) || v2 >= 10000) && (v2 < 500 || v2 >= 600) | 3116 if (object_desc->NoSprite()) |
3116 || pGame->pStru6Instance->_4A81CA((LayingItem *)(v0 - 28)) ) | 3117 continue; |
3117 { | 3118 |
3118 a5 = *(short *)v0; | 3119 //v1 = &pObjectList->pObjects[*((short *)v0 - 13)]; |
3119 x = *((int *)v0 - 6); | 3120 //if ( !(v1->uFlags & 1) ) |
3120 y = *((int *)v0 - 5); | 3121 //{ |
3121 z = *((int *)v0 - 4); | 3122 //v2 = *((short *)v0 - 14) |
3122 v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; | 3123 v2 = object->uItemType; |
3123 v4 = pSpriteFrameTable->GetFrame(v1->uSpriteID, *((short *)v0 + 1)); | 3124 if ( (v2 < 1000 || v2 >= 10000) && (v2 < 500 || v2 >= 600) || pGame->pStru6Instance->_4A81CA(object) ) |
3124 v5 = v4; | 3125 { |
3125 v28 = v4; | 3126 //a5 = *(short *)v0; |
3126 v36 = v4->uFlags; | 3127 x = object->vPosition.x; |
3127 a6 = v4->uGlowRadius * *((short *)v0 + 3); | 3128 y = object->vPosition.y; |
3128 v6 = stru_5C6E00->Atan2( | 3129 z = object->vPosition.z; |
3129 *((int *)v0 - 6) - pIndoorCamera->pos.x, | 3130 v3 = &pBillboardRenderList[::uNumBillboardsToDraw]; |
3130 *((int *)v0 - 5) - pIndoorCamera->pos.y); | 3131 v4 = pSpriteFrameTable->GetFrame(object_desc->uSpriteID, object->uSpriteFrameID); |
3131 LOWORD(v7) = *((short *)v0 - 3); | 3132 //v5 = v4; |
3132 v8 = v36; | 3133 //v28 = v4; |
3133 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v7 - v6) >> 8) & 7; | 3134 v36 = v4->uFlags; |
3134 v10 = v5->pHwSpriteIDs[v9]; | 3135 a6 = v4->uGlowRadius * object->field_22_glow_radius_multiplier; |
3136 v6 = stru_5C6E00->Atan2(object->vPosition.x - pIndoorCamera->pos.x, object->vPosition.y - pIndoorCamera->pos.y); | |
3137 //LOWORD(v7) = object->uFacing; | |
3138 //v8 = v36; | |
3139 v9 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + object->uFacing - v6) >> 8) & 7; | |
3140 v10 = v4->pHwSpriteIDs[v9]; | |
3135 v3->uHwSpriteID = v10; | 3141 v3->uHwSpriteID = v10; |
3136 if ( v36 & 0x20 ) | 3142 if ( v36 & 0x20 ) |
3137 { | 3143 { |
3138 v8 = v36; | 3144 //v8 = v36; |
3139 z -= (signed int)((unsigned __int64)(v5->scale | 3145 z -= (signed int)((unsigned __int64)(v4->scale * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; |
3140 * (signed __int64)pSprites_LOD->pSpriteHeaders[(signed __int16)v10].uHeight) >> 16) >> 1; | |
3141 } | 3146 } |
3142 v46 = 0; | 3147 v46 = 0; |
3143 if ( v8 & 2 ) | 3148 if ( v36 & 2 ) |
3144 v46 = 2; | 3149 v46 = 2; |
3145 v11 = (int *)(256 << v9); | 3150 //v11 = (int *)(256 << v9); |
3146 if ( (256 << v9) & v8 ) | 3151 if ( (256 << v9) & v36 ) |
3147 v46 |= 4u; | 3152 v46 |= 4u; |
3148 if ( v8 & 0x40000 ) | 3153 if ( v36 & 0x40000 ) |
3149 v46 |= 0x40u; | 3154 v46 |= 0x40u; |
3150 if ( v8 & 0x20000 ) | 3155 if ( v36 & 0x20000 ) |
3151 LOBYTE(v46) = v46 | 0x80; | 3156 LOBYTE(v46) = v46 | 0x80; |
3152 if ( a6 ) | 3157 if ( a6 ) |
3153 { | 3158 { |
3154 LOBYTE(v11) = byte_4E94D3; | 3159 //LOBYTE(v11) = byte_4E94D3; |
3155 pMobileLightsStack->AddLight(x, y, z, a5, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); | 3160 pMobileLightsStack->AddLight(x, y, z, object->uSectorID, a6, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3); |
3156 } | 3161 } |
3157 v12 = (x - pIndoorCamera->pos.x) << 16; | 3162 v12 = (x - pIndoorCamera->pos.x) << 16; |
3158 if ( pIndoorCamera->sRotationX ) | 3163 if ( pIndoorCamera->sRotationX ) |
3159 { | 3164 { |
3160 v13 = (y - pIndoorCamera->pos.y) << 16; | 3165 v13 = (y - pIndoorCamera->pos.y) << 16; |
3183 v20 = (unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | 3188 v20 = (unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; |
3184 v16 = v20 + v19; | 3189 v16 = v20 + v19; |
3185 v42 = v20 + v19; | 3190 v42 = v20 + v19; |
3186 if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) | 3191 if ( v20 + v19 >= 262144 && v16 <= pOutdoorCamera->shading_dist_mist << 16 ) |
3187 { | 3192 { |
3188 v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) | 3193 v21 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16) * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; |
3189 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16; | 3194 v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; |
3190 v17 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) | 3195 v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v21; |
3191 - v21; | |
3192 v40 = ((unsigned __int64)(v34 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) | |
3193 - v21; | |
3194 v18 = (z - pIndoorCamera->pos.z) << 16; | 3196 v18 = (z - pIndoorCamera->pos.z) << 16; |
3195 LABEL_29: | 3197 LABEL_29: |
3196 v31 = v18; | 3198 v31 = v18; |
3197 v22 = abs(v17); | 3199 v22 = abs(v17); |
3198 if ( abs(v16) >= v22 ) | 3200 if ( abs(v16) >= v22 ) |
3201 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); | 3203 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); |
3202 v24 = v23 / v42; | 3204 v24 = v23 / v42; |
3203 v25 = v23 / v42; | 3205 v25 = v23 / v42; |
3204 LODWORD(v23) = 0; | 3206 LODWORD(v23) = 0; |
3205 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); | 3207 HIDWORD(v23) = SLOWORD(pOutdoorCamera->int_fov_rad); |
3206 v35 = pViewport->uScreenCenterX | 3208 v35 = pViewport->uScreenCenterX - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); |
3207 - ((signed int)(((unsigned __int64)(v25 * (signed __int64)v40) >> 16) + 32768) >> 16); | 3209 v32 = LOWORD(pViewport->uScreenCenterY) - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); |
3208 v32 = LOWORD(pViewport->uScreenCenterY) | 3210 |
3209 - (((unsigned int)((unsigned __int64)(v23 / v42 * v31) >> 16) + 32768) >> 16); | 3211 //if (::uNumBillboardsToDraw >= 500) |
3210 if (::uNumBillboardsToDraw >= 500) | 3212 // return; |
3211 return; | 3213 assert(::uNumBillboardsToDraw < 500); |
3212 ++::uNumBillboardsToDraw; | 3214 ++::uNumBillboardsToDraw; |
3213 ++uNumSpritesDrawnThisFrame; | 3215 ++uNumSpritesDrawnThisFrame; |
3214 *(v0 - 2) |= 1u; | 3216 |
3215 v3->uPalette = v28->uPaletteIndex; | 3217 object->uAttributes |= 1; |
3216 v3->uIndoorSectorID = a5; | 3218 v3->uPalette = v4->uPaletteIndex; |
3217 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; | 3219 v3->uIndoorSectorID = object->uSectorID; |
3218 v26 = (unsigned __int64)(v28->scale * (signed __int64)v24) >> 16; | 3220 v3->_screenspace_x_scaler_packedfloat = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; |
3219 v3->pSpriteFrame = v28; | 3221 v26 = (unsigned __int64)(v4->scale * (signed __int64)v24) >> 16; |
3222 v3->pSpriteFrame = v4; | |
3220 v3->_screenspace_y_scaler_packedfloat = v26; | 3223 v3->_screenspace_y_scaler_packedfloat = v26; |
3221 v3->field_1E = v46; | 3224 v3->field_1E = v46; |
3222 v3->some_x = x; | 3225 v3->world_x = x; |
3223 v3->some_y = y; | 3226 v3->world_y = y; |
3224 v3->some_z = z; | 3227 v3->world_z = z; |
3225 v3->uScreenSpaceX = v35; | 3228 v3->uScreenSpaceX = v35; |
3226 v3->uScreenSpaceY = v32; | 3229 v3->uScreenSpaceY = v32; |
3227 HIWORD(v26) = HIWORD(v42); | 3230 HIWORD(v26) = HIWORD(v42); |
3228 LOWORD(v26) = 0; | 3231 LOWORD(v26) = 0; |
3229 v27 = (*(v0 - 2) & 0x20) == 0; | 3232 v27 = (object->uAttributes & 0x20) == 0; |
3230 v3->sZValue = v26 + (8 * i | OBJECT_Item); | 3233 v3->sZValue = v26 + (8 * i | OBJECT_Item); |
3231 v3->uPaletteSubindex = 0; | 3234 v3->uPaletteSubindex = 0; |
3232 v3->uTintColor = 0; | 3235 v3->uTintColor = 0; |
3233 if ( !v27 ) | 3236 if ( !v27 ) |
3234 { | 3237 { |
3238 } | 3241 } |
3239 goto LABEL_34; | 3242 goto LABEL_34; |
3240 } | 3243 } |
3241 } | 3244 } |
3242 } | 3245 } |
3243 } | 3246 //} |
3244 } | |
3245 LABEL_34: | 3247 LABEL_34: |
3246 ; | 3248 ; |
3247 //++v41; | 3249 //++v41; |
3248 //v0 += 112; | 3250 //v0 += 112; |
3249 //} | 3251 //} |
3657 v29 = v38; | 3659 v29 = v38; |
3658 v27->uScreenSpaceX = v25; | 3660 v27->uScreenSpaceX = v25; |
3659 HIBYTE(v29) |= 2u; | 3661 HIBYTE(v29) |= 2u; |
3660 v27->uPalette = v28; | 3662 v27->uPalette = v28; |
3661 v27->field_1E = v29; | 3663 v27->field_1E = v29; |
3662 v27->some_x = x; | 3664 v27->world_x = x; |
3663 v27->some_y = y; | 3665 v27->world_y = y; |
3664 v27->some_z = v36; | 3666 v27->world_z = v36; |
3665 v27->uScreenSpaceY = v40; | 3667 v27->uScreenSpaceY = v40; |
3666 HIWORD(v30) = HIWORD(v39); | 3668 HIWORD(v30) = HIWORD(v39); |
3667 v31 = 8 * i | OBJECT_Decoration; | 3669 v31 = 8 * i | OBJECT_Decoration; |
3668 LOWORD(v30) = 0; | 3670 LOWORD(v30) = 0; |
3669 v27->uIndoorSectorID = 0; | 3671 v27->uIndoorSectorID = 0; |