; All weather uses visual time and stable seeds, never gameplay RNG. BlendCityWeatherPixel3D PROC uses ebx esi edi px:DWORD,py:DWORD,tint:DWORD,opacity:DWORD cmp px,640 jae weather_pixel_done cmp py,480 jae weather_pixel_done mov esi,py imul esi,640 add esi,px mov ebx,screenBuffer[esi*4] mov edi,256 sub edi,opacity movzx eax,bl imul eax,edi mov ecx,tint and ecx,255 imul ecx,opacity add eax,ecx shr eax,8 mov edx,eax movzx eax,bh imul eax,edi mov ecx,tint shr ecx,8 and ecx,255 imul ecx,opacity add eax,ecx shr eax,8 shl eax,8 or edx,eax shr ebx,16 and ebx,255 imul ebx,edi mov eax,tint shr eax,16 and eax,255 imul eax,opacity add eax,ebx shr eax,8 shl eax,16 or eax,edx mov screenBuffer[esi*4],eax weather_pixel_done: ret BlendCityWeatherPixel3D ENDP DrawCityRain3D PROC uses ebx esi edi local layer:DWORD,px:DWORD,py:DWORD,lengthPx:DWORD,opacity:DWORD local radius:DWORD,alpha:DWORD,rowStart:DWORD,age:DWORD,groundDepth:DWORD mov layer,0 rain_layer: mov eax,layer imul eax,3 add eax,4 mov lengthPx,eax mov eax,layer imul eax,28 add eax,50 mov opacity,eax xor esi,esi rain_drop: mov eax,layer imul eax,3 add eax,3 imul eax,cityClock3D imul ecx,esi,829 add eax,ecx xor edx,edx mov ecx,7680 div ecx shr edx,4 mov py,edx imul eax,esi,137 imul ebx,layer,211 add eax,ebx mov ecx,cityClock3D shr ecx,6 sub eax,ecx and eax,1023 imul eax,640 shr eax,10 mov px,eax xor edi,edi rain_streak: mov eax,edi shr eax,2 mov ebx,px sub ebx,eax mov ecx,py add ecx,edi invoke BlendCityWeatherPixel3D,ebx,ecx,00B2C5CDh,opacity inc edi cmp edi,lengthPx jb rain_streak inc esi cmp esi,36 jb rain_drop inc layer cmp layer,3 jb rain_layer mov eax,viewHorizon3D add eax,50 cmp eax,310 jge @F mov eax,310 @@: cmp eax,450 jge rain_done mov rowStart,eax xor esi,esi rain_splash: imul eax,esi,97 add eax,cityClock3D xor edx,edx mov ecx,800 div ecx cmp edx,250 jae rain_splash_next mov age,edx imul eax,esi,71 add eax,43 xor edx,edx mov ecx,600 div ecx add edx,20 mov px,edx imul eax,esi,37 xor edx,edx mov ecx,468 sub ecx,rowStart div ecx add edx,rowStart mov py,edx sub edx,viewHorizon3D mov eax,viewEye3D imul eax,480 cdq mov ecx,py sub ecx,viewHorizon3D idiv ecx sub eax,1024 mov groundDepth,eax mov ecx,py imul ecx,640 add ecx,px mov eax,groundDepth cmp cityDepthBuffer3D[ecx*4],eax jl rain_splash_next mov eax,age xor edx,edx mov ecx,40 div ecx inc eax mov radius,eax mov eax,250 sub eax,age imul eax,100 xor edx,edx mov ecx,250 div ecx mov alpha,eax mov ebx,px sub ebx,radius invoke BlendCityWeatherPixel3D,ebx,py,00C5C6AEh,alpha mov ebx,px add ebx,radius invoke BlendCityWeatherPixel3D,ebx,py,00C5C6AEh,alpha mov eax,radius shr eax,1 mov edi,py sub edi,eax invoke BlendCityWeatherPixel3D,px,edi,00C5C6AEh,alpha mov eax,radius shr eax,1 mov edi,py add edi,eax invoke BlendCityWeatherPixel3D,px,edi,00C5C6AEh,alpha rain_splash_next: inc esi cmp esi,24 jb rain_splash rain_done: ret DrawCityRain3D ENDP