Add rooftop elevator, lounge, volumetric city, river and animated traffic. Prune invisible mesh faces, clip CPU surfaces, streamline compositing and add automatic/F8 roof quality profiles with renderer diagnostics. Include dartboard/reticle improvements, tracked fortune orb numerals and fate-session visuals, native regression tests, compatible jukebox IDs and updated shipping executables.
382 lines
7.4 KiB
PHP
382 lines
7.4 KiB
PHP
; Directional dusk lighting and aerial perspective are applied to actual geometry.
|
|
ShadeRoofCityPixel3D PROC uses ebx esi edi color:DWORD,depth:DWORD,light:DWORD,material:DWORD
|
|
local fog:DWORD,inverseFog:DWORD,red:DWORD,green:DWORD,blue:DWORD,level:DWORD
|
|
local targetR:DWORD,targetG:DWORD,targetB:DWORD
|
|
mov roofPixelGlow3D,0
|
|
mov eax,depth
|
|
sar eax,16
|
|
test eax,eax
|
|
jns @F
|
|
xor eax,eax
|
|
@@:
|
|
cmp eax,1023
|
|
jbe @F
|
|
mov eax,1023
|
|
@@:
|
|
movzx eax,roofFog3D[eax]
|
|
mov fog,eax
|
|
neg eax
|
|
add eax,256
|
|
mov inverseFog,eax
|
|
mov eax,color
|
|
and eax,255
|
|
mov blue,eax
|
|
mov eax,color
|
|
shr eax,8
|
|
and eax,255
|
|
mov green,eax
|
|
mov eax,color
|
|
shr eax,16
|
|
and eax,255
|
|
mov red,eax
|
|
mov targetR,171
|
|
mov targetG,157
|
|
mov targetB,177
|
|
mov eax,light
|
|
mov level,eax
|
|
cmp roofNight3D,0
|
|
je roof_lighting_day
|
|
mov targetR,13
|
|
mov targetG,24
|
|
mov targetB,44
|
|
mov level,72
|
|
cmp material,ROOF_CITY_ROAD
|
|
jne @F
|
|
mov level,256
|
|
@@:
|
|
cmp material,ROOF_LIGHT
|
|
jne @F
|
|
mov level,256
|
|
mov roofPixelGlow3D,96
|
|
@@:
|
|
cmp roofLandmarkLight3D,0
|
|
je @F
|
|
mov level,148
|
|
@@:
|
|
cmp material,ROOF_BRASS
|
|
jne @F
|
|
mov level,228
|
|
cmp roofLandmarkLight3D,0
|
|
je @F
|
|
mov roofPixelGlow3D,12
|
|
@@:
|
|
; Emission is tagged in the actual window pixels, never inferred from gold trim.
|
|
cmp material,ROOF_FACADE
|
|
jb roof_lighting_apply
|
|
cmp material,ROOF_FACADE+7
|
|
jbe roof_lighting_window
|
|
cmp material,ROOF_MODERN_FACADE
|
|
jb roof_lighting_apply
|
|
cmp material,ROOF_MODERN_FACADE+7
|
|
ja roof_lighting_apply
|
|
roof_lighting_window:
|
|
mov eax,color
|
|
shr eax,24
|
|
cmp eax,255
|
|
jne roof_lighting_apply
|
|
mov level,310
|
|
mov roofPixelGlow3D,64
|
|
shr fog,1
|
|
mov eax,fog
|
|
neg eax
|
|
add eax,256
|
|
mov inverseFog,eax
|
|
jmp roof_lighting_apply
|
|
roof_lighting_day:
|
|
cmp material,ROOF_CITY_ROOF
|
|
jne @F
|
|
imul eax,red,180
|
|
shr eax,8
|
|
mov red,eax
|
|
imul eax,green,220
|
|
shr eax,8
|
|
mov green,eax
|
|
@@:
|
|
mov eax,red
|
|
imul eax,263
|
|
shr eax,8
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
mov red,eax
|
|
imul eax,blue,235
|
|
shr eax,8
|
|
mov blue,eax
|
|
roof_lighting_apply:
|
|
mov eax,red
|
|
imul eax,level
|
|
shr eax,8
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
imul eax,inverseFog
|
|
mov ecx,targetR
|
|
imul ecx,fog
|
|
add eax,ecx
|
|
shr eax,8
|
|
mov ebx,eax
|
|
shl ebx,16
|
|
mov eax,green
|
|
imul eax,level
|
|
shr eax,8
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
imul eax,inverseFog
|
|
mov ecx,targetG
|
|
imul ecx,fog
|
|
add eax,ecx
|
|
shr eax,8
|
|
shl eax,8
|
|
or ebx,eax
|
|
mov eax,blue
|
|
imul eax,level
|
|
shr eax,8
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
imul eax,inverseFog
|
|
mov ecx,targetB
|
|
imul ecx,fog
|
|
add eax,ecx
|
|
shr eax,8
|
|
or eax,ebx
|
|
ret
|
|
ShadeRoofCityPixel3D ENDP
|
|
|
|
SampleRoofGroundLight3D PROC uses ebx esi edi color:DWORD,wx:DWORD,wy:DWORD
|
|
mov eax,color
|
|
cmp roofLightingArt3D.pixels,0
|
|
je roof_ground_light_done
|
|
mov eax,wx
|
|
sar eax,17
|
|
add eax,256
|
|
cmp eax,511
|
|
ja roof_ground_light_original
|
|
mov ebx,eax
|
|
mov eax,wy
|
|
sar eax,17
|
|
add eax,256
|
|
cmp eax,511
|
|
ja roof_ground_light_original
|
|
shl eax,9
|
|
add eax,ebx
|
|
mov esi,roofLightingArt3D.pixels
|
|
cmp roofNight3D,0
|
|
je @F
|
|
add esi,512*512*4
|
|
@@:
|
|
mov edx,[esi+eax*4]
|
|
mov edi,edx
|
|
and edx,255
|
|
mov eax,color
|
|
and eax,255
|
|
imul eax,edx
|
|
shr eax,8
|
|
mov ebx,eax
|
|
mov edx,edi
|
|
shr edx,8
|
|
and edx,255
|
|
mov eax,color
|
|
shr eax,8
|
|
and eax,255
|
|
imul eax,edx
|
|
and eax,0FF00h
|
|
or ebx,eax
|
|
mov edx,edi
|
|
shr edx,16
|
|
and edx,255
|
|
mov eax,color
|
|
shr eax,16
|
|
and eax,255
|
|
imul eax,edx
|
|
and eax,0FF00h
|
|
shl eax,8
|
|
or eax,ebx
|
|
ret
|
|
roof_ground_light_original:
|
|
mov eax,color
|
|
roof_ground_light_done:
|
|
ret
|
|
SampleRoofGroundLight3D ENDP
|
|
|
|
PrepareRoofCityAA3D PROC uses ebx esi edi
|
|
mov roofAAStill3D,0
|
|
cmp roofAAValid3D,0
|
|
je roof_aa_moving
|
|
mov eax,playerX
|
|
cmp eax,roofAAX3D
|
|
jne roof_aa_moving
|
|
mov eax,playerY
|
|
cmp eax,roofAAY3D
|
|
jne roof_aa_moving
|
|
mov eax,playerAngle
|
|
cmp eax,roofAAAngle3D
|
|
jne roof_aa_moving
|
|
mov eax,viewEye3D
|
|
cmp eax,roofAAEye3D
|
|
jne roof_aa_moving
|
|
mov eax,viewHorizon3D
|
|
cmp eax,roofAAHorizon3D
|
|
jne roof_aa_moving
|
|
mov eax,roofNight3D
|
|
cmp eax,roofAATheme3D
|
|
jne roof_aa_moving
|
|
mov roofAAStill3D,1
|
|
inc roofAAFrame3D
|
|
and roofAAFrame3D,3
|
|
jmp roof_aa_save_view
|
|
roof_aa_moving:
|
|
mov roofAAFrame3D,0
|
|
roof_aa_save_view:
|
|
mov eax,playerX
|
|
mov roofAAX3D,eax
|
|
mov eax,playerY
|
|
mov roofAAY3D,eax
|
|
mov eax,playerAngle
|
|
mov roofAAAngle3D,eax
|
|
mov eax,viewEye3D
|
|
mov roofAAEye3D,eax
|
|
mov eax,viewHorizon3D
|
|
mov roofAAHorizon3D,eax
|
|
mov eax,roofNight3D
|
|
mov roofAATheme3D,eax
|
|
mov eax,roofAAFrame3D
|
|
shl eax,1
|
|
sub eax,3
|
|
mov ebx,eax
|
|
mov eax,playerPlaneX
|
|
imul ebx
|
|
cdq
|
|
mov ecx,SCREEN_W*4
|
|
idiv ecx
|
|
mov esi,eax
|
|
mov eax,playerPlaneY
|
|
imul ebx
|
|
cdq
|
|
idiv ecx
|
|
mov edi,eax
|
|
xor ebx,ebx
|
|
roof_aa_shift_ray:
|
|
add cityRayX3D[ebx*4],esi
|
|
add cityRayY3D[ebx*4],edi
|
|
inc ebx
|
|
cmp ebx,SCREEN_W
|
|
jb roof_aa_shift_ray
|
|
ret
|
|
PrepareRoofCityAA3D ENDP
|
|
|
|
FinishRoofCityAA3D PROC uses ebx esi edi
|
|
xor edi,edi
|
|
roof_aa_pixel:
|
|
mov eax,screenBuffer[edi*4]
|
|
cmp roofAAStill3D,0
|
|
je roof_aa_store
|
|
cmp roofCityMask3D[edi],1
|
|
jne roof_aa_store
|
|
and eax,00FCFCFCh
|
|
shr eax,2
|
|
mov edx,roofAAHistory3D[edi*4]
|
|
and edx,00FCFCFCh
|
|
shr edx,2
|
|
imul edx,3
|
|
add eax,edx
|
|
mov screenBuffer[edi*4],eax
|
|
roof_aa_store:
|
|
mov roofAAHistory3D[edi*4],eax
|
|
inc edi
|
|
cmp edi,SCREEN_SIZE
|
|
jb roof_aa_pixel
|
|
mov roofAAValid3D,1
|
|
ret
|
|
FinishRoofCityAA3D ENDP
|
|
|
|
RenderRoofCityBloom3D PROC uses ebx esi edi
|
|
local pixel:DWORD,color:DWORD,amount:DWORD,rowOffset:DWORD,columnOffset:DWORD
|
|
local target:DWORD,red:DWORD,green:DWORD,blue:DWORD
|
|
cmp roofNight3D,0
|
|
je roof_bloom_done
|
|
mov pixel,SCREEN_W+1
|
|
roof_bloom_source:
|
|
mov esi,pixel
|
|
movzx eax,roofGlowMask3D[esi]
|
|
test eax,eax
|
|
jz roof_bloom_next_source
|
|
shr eax,2
|
|
mov amount,eax
|
|
mov eax,screenBuffer[esi*4]
|
|
mov color,eax
|
|
mov rowOffset,-1
|
|
roof_bloom_row:
|
|
mov columnOffset,-1
|
|
roof_bloom_column:
|
|
mov eax,rowOffset
|
|
imul eax,SCREEN_W
|
|
add eax,columnOffset
|
|
add eax,pixel
|
|
cmp eax,SCREEN_SIZE
|
|
jae roof_bloom_next_column
|
|
mov target,eax
|
|
lea edi,screenBuffer[eax*4]
|
|
mov ebx,[edi]
|
|
mov eax,color
|
|
and eax,255
|
|
imul eax,amount
|
|
shr eax,8
|
|
movzx ecx,bl
|
|
add eax,ecx
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
mov blue,eax
|
|
mov eax,color
|
|
shr eax,8
|
|
and eax,255
|
|
imul eax,amount
|
|
shr eax,8
|
|
mov ecx,ebx
|
|
shr ecx,8
|
|
and ecx,255
|
|
add eax,ecx
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
mov green,eax
|
|
mov eax,color
|
|
shr eax,16
|
|
and eax,255
|
|
imul eax,amount
|
|
shr eax,8
|
|
shr ebx,16
|
|
and ebx,255
|
|
add eax,ebx
|
|
cmp eax,255
|
|
jbe @F
|
|
mov eax,255
|
|
@@:
|
|
shl eax,16
|
|
mov ecx,green
|
|
shl ecx,8
|
|
or eax,ecx
|
|
or eax,blue
|
|
mov [edi],eax
|
|
roof_bloom_next_column:
|
|
inc columnOffset
|
|
cmp columnOffset,1
|
|
jle roof_bloom_column
|
|
inc rowOffset
|
|
cmp rowOffset,1
|
|
jle roof_bloom_row
|
|
roof_bloom_next_source:
|
|
inc pixel
|
|
cmp pixel,SCREEN_SIZE-SCREEN_W-1
|
|
jb roof_bloom_source
|
|
roof_bloom_done:
|
|
ret
|
|
RenderRoofCityBloom3D ENDP
|