547 lines
12 KiB
PHP
547 lines
12 KiB
PHP
; Physical camera shots and moving textured objects. No video / second runtime.
|
|
include src_graphics\cinematic_master.inc
|
|
include src_graphics\cinematic_hd.inc
|
|
LoadStartupFilm3D PROC
|
|
IFNDEF CINEMATIC_SOURCE_CAPTURE
|
|
call LoadHDStudio3D
|
|
test eax,eax
|
|
jnz film_load_done
|
|
call LoadCinematicMaster3D
|
|
test eax,eax
|
|
jnz film_load_done
|
|
ENDIF
|
|
call LoadStartupProceduralAssets3D
|
|
film_load_done:
|
|
ret
|
|
LoadStartupFilm3D ENDP
|
|
|
|
LoadStartupProceduralAssets3D PROC
|
|
invoke LoadAnimPack3D,OFFSET filmWheel,OFFSET filmWheelPath
|
|
invoke LoadAnimPack3D,OFFSET filmStudio,OFFSET filmStudioPath
|
|
invoke LoadAnimPack3D,OFFSET filmTitle,OFFSET filmTitlePath
|
|
call LoadArrivalAssets3D
|
|
call LoadCityArrival3D
|
|
ret
|
|
LoadStartupProceduralAssets3D ENDP
|
|
|
|
FreeStartupFilm3D PROC
|
|
call FreeHDStudio3D
|
|
call FreeCinematicMaster3D
|
|
invoke FreeAnimPack3D,OFFSET filmWheel
|
|
invoke FreeAnimPack3D,OFFSET filmStudio
|
|
invoke FreeAnimPack3D,OFFSET filmTitle
|
|
ret
|
|
FreeStartupFilm3D ENDP
|
|
|
|
FilmLerp3D PROC uses ebx timeMs:DWORD,durationMs:DWORD,fromValue:SDWORD,toValue:SDWORD
|
|
invoke CityEase3D,timeMs,durationMs
|
|
mov ebx,toValue
|
|
sub ebx,fromValue
|
|
imul ebx
|
|
shrd eax,edx,16
|
|
add eax,fromValue
|
|
ret
|
|
FilmLerp3D ENDP
|
|
|
|
; A rotating textured plane with an oblique camera, clipped in native pixels.
|
|
DrawFilmWheel3D PROC uses ebx esi edi centerX:SDWORD,centerY:SDWORD,wide:DWORD,tall:DWORD,angle:DWORD,gain:DWORD
|
|
local filmCos:SDWORD,filmSin:SDWORD,stepU:SDWORD,stepV:SDWORD
|
|
local texU:SDWORD,texV:SDWORD,rowU:SDWORD,rowV:SDWORD
|
|
local py:DWORD,px:DWORD,localX:SDWORD,localY:SDWORD,pixel:DWORD
|
|
cmp filmWheel.pixels,0
|
|
je film_wheel_done
|
|
mov eax,angle
|
|
and eax,511
|
|
mov edx,tableCos[eax*4]
|
|
mov filmCos,edx
|
|
mov edx,tableSin[eax*4]
|
|
mov filmSin,edx
|
|
mov eax,512*FP_1
|
|
xor edx,edx
|
|
div wide
|
|
mov ebx,eax
|
|
imul filmCos
|
|
shrd eax,edx,16
|
|
mov stepU,eax
|
|
mov eax,ebx
|
|
imul filmSin
|
|
shrd eax,edx,16
|
|
neg eax
|
|
mov stepV,eax
|
|
mov py,32
|
|
film_wheel_row:
|
|
mov eax,py
|
|
sub eax,centerY
|
|
mov ecx,512*FP_1
|
|
imul ecx
|
|
idiv tall
|
|
mov localY,eax
|
|
mov eax,centerX
|
|
neg eax
|
|
mov ecx,512*FP_1
|
|
imul ecx
|
|
idiv wide
|
|
mov localX,eax
|
|
mov eax,localX
|
|
imul filmCos
|
|
shrd eax,edx,16
|
|
mov rowU,eax
|
|
mov eax,localY
|
|
imul filmSin
|
|
shrd eax,edx,16
|
|
add eax,rowU
|
|
add eax,256*FP_1
|
|
mov texU,eax
|
|
mov eax,localX
|
|
imul filmSin
|
|
shrd eax,edx,16
|
|
neg eax
|
|
mov rowV,eax
|
|
mov eax,localY
|
|
imul filmCos
|
|
shrd eax,edx,16
|
|
add eax,rowV
|
|
add eax,256*FP_1
|
|
mov texV,eax
|
|
mov eax,py
|
|
imul eax,SCREEN_W
|
|
lea edi,screenBuffer[eax*4]
|
|
mov px,0
|
|
film_wheel_pixel:
|
|
mov eax,texU
|
|
sar eax,16
|
|
cmp eax,512
|
|
jae film_wheel_next
|
|
mov ebx,texV
|
|
sar ebx,16
|
|
cmp ebx,512
|
|
jae film_wheel_next
|
|
shl ebx,9
|
|
add eax,ebx
|
|
mov esi,filmWheel.pixels
|
|
mov eax,[esi+eax*4]
|
|
cmp eax,80000000h
|
|
jb film_wheel_next
|
|
invoke StartupInk3D,eax,gain
|
|
mov [edi],eax
|
|
film_wheel_next:
|
|
mov eax,stepU
|
|
add texU,eax
|
|
mov eax,stepV
|
|
add texV,eax
|
|
add edi,4
|
|
inc px
|
|
cmp px,640
|
|
jb film_wheel_pixel
|
|
inc py
|
|
cmp py,448
|
|
jb film_wheel_row
|
|
film_wheel_done:
|
|
ret
|
|
DrawFilmWheel3D ENDP
|
|
|
|
DrawFilmBall3D PROC uses ebx esi edi centerX:DWORD,centerY:DWORD,wide:DWORD,tall:DWORD,angle:DWORD
|
|
local ballX:SDWORD,ballY:SDWORD,dxVal:SDWORD,dyVal:SDWORD,ink:DWORD
|
|
mov eax,angle
|
|
and eax,511
|
|
mov ebx,tableCos[eax*4]
|
|
mov esi,tableSin[eax*4]
|
|
mov eax,wide
|
|
imul eax,42
|
|
xor edx,edx
|
|
mov ecx,100
|
|
div ecx
|
|
imul ebx
|
|
shrd eax,edx,16
|
|
add eax,centerX
|
|
mov ballX,eax
|
|
mov eax,tall
|
|
imul eax,42
|
|
xor edx,edx
|
|
div ecx
|
|
imul esi
|
|
shrd eax,edx,16
|
|
add eax,centerY
|
|
mov ballY,eax
|
|
mov dyVal,-6
|
|
film_ball_row:
|
|
mov dxVal,-6
|
|
film_ball_pixel:
|
|
mov eax,dxVal
|
|
imul eax,eax
|
|
mov ebx,dyVal
|
|
imul ebx,ebx
|
|
add eax,ebx
|
|
cmp eax,36
|
|
ja film_ball_next
|
|
mov eax,dxVal
|
|
add eax,dyVal
|
|
add eax,12
|
|
imul eax,8
|
|
neg eax
|
|
add eax,245
|
|
imul eax,00010101h
|
|
mov ink,eax
|
|
mov eax,ballX
|
|
add eax,dxVal
|
|
mov edx,ballY
|
|
add edx,dyVal
|
|
invoke BlendCityWeatherPixel3D,eax,edx,ink,245
|
|
film_ball_next:
|
|
inc dxVal
|
|
cmp dxVal,6
|
|
jle film_ball_pixel
|
|
inc dyVal
|
|
cmp dyVal,6
|
|
jle film_ball_row
|
|
ret
|
|
DrawFilmBall3D ENDP
|
|
|
|
DrawFilmDust3D PROC uses ebx esi edi
|
|
local px:DWORD,py:DWORD,alpha:DWORD
|
|
xor esi,esi
|
|
film_dust_particle:
|
|
mov eax,esi
|
|
imul eax,149
|
|
add eax,startupElapsed3D
|
|
shr eax,2
|
|
xor edx,edx
|
|
mov ecx,700
|
|
div ecx
|
|
sub edx,30
|
|
mov px,edx
|
|
mov eax,esi
|
|
imul eax,991
|
|
mov ebx,startupElapsed3D
|
|
shr ebx,5
|
|
sub eax,ebx
|
|
and eax,511
|
|
mov py,eax
|
|
mov eax,esi
|
|
and eax,3
|
|
imul eax,22
|
|
add eax,30
|
|
mov alpha,eax
|
|
invoke BlendCityWeatherPixel3D,px,py,00D6B584h,alpha
|
|
inc esi
|
|
cmp esi,40
|
|
jb film_dust_particle
|
|
ret
|
|
DrawFilmDust3D ENDP
|
|
|
|
FilmLetterbox3D PROC
|
|
invoke StartupRect3D,0,0,640,32,0
|
|
invoke StartupRect3D,0,448,640,32,0
|
|
ret
|
|
FilmLetterbox3D ENDP
|
|
|
|
FilmGlint3D PROC uses ebx esi edi px:SDWORD,py:SDWORD,start:DWORD
|
|
local strength:DWORD,dxVal:SDWORD,alpha:DWORD
|
|
mov eax,startupElapsed3D
|
|
sub eax,start
|
|
js film_glint_done
|
|
cmp eax,900
|
|
jae film_glint_done
|
|
sub eax,450
|
|
cdq
|
|
xor eax,edx
|
|
sub eax,edx
|
|
neg eax
|
|
add eax,450
|
|
imul eax,100
|
|
xor edx,edx
|
|
mov ecx,450
|
|
div ecx
|
|
mov strength,eax
|
|
mov dxVal,-90
|
|
film_glint_ray:
|
|
mov eax,dxVal
|
|
cdq
|
|
xor eax,edx
|
|
sub eax,edx
|
|
neg eax
|
|
add eax,90
|
|
imul eax,strength
|
|
xor edx,edx
|
|
mov ecx,90
|
|
div ecx
|
|
mov alpha,eax
|
|
mov eax,px
|
|
add eax,dxVal
|
|
invoke BlendCityWeatherPixel3D,eax,py,00FFE9C0h,alpha
|
|
inc dxVal
|
|
cmp dxVal,90
|
|
jle film_glint_ray
|
|
film_glint_done:
|
|
ret
|
|
FilmGlint3D ENDP
|
|
|
|
GradeFilm3D PROC uses ebx esi edi
|
|
local rowGain:DWORD,row:DWORD,col:DWORD,gain:DWORD,pixel:DWORD
|
|
lea edi,screenBuffer[32*640*4]
|
|
mov row,32
|
|
film_grade_row:
|
|
mov eax,row
|
|
sub eax,240
|
|
cdq
|
|
xor eax,edx
|
|
sub eax,edx
|
|
shr eax,4
|
|
neg eax
|
|
add eax,256
|
|
mov rowGain,eax
|
|
mov col,0
|
|
film_grade_pixel:
|
|
mov eax,col
|
|
sub eax,320
|
|
cdq
|
|
xor eax,edx
|
|
sub eax,edx
|
|
shr eax,3
|
|
neg eax
|
|
add eax,rowGain
|
|
mov gain,eax
|
|
mov eax,[edi]
|
|
and eax,00FF00FFh
|
|
imul eax,gain
|
|
shr eax,8
|
|
and eax,00FF00FFh
|
|
mov ebx,eax
|
|
mov eax,[edi]
|
|
and eax,0000FF00h
|
|
imul eax,gain
|
|
shr eax,8
|
|
and eax,0000FF00h
|
|
or eax,ebx
|
|
mov [edi],eax
|
|
add edi,4
|
|
inc col
|
|
cmp col,640
|
|
jb film_grade_pixel
|
|
inc row
|
|
cmp row,448
|
|
jb film_grade_row
|
|
ret
|
|
GradeFilm3D ENDP
|
|
|
|
RenderStudioFilm3D PROC uses ebx esi edi
|
|
local focalX:DWORD,focalY:DWORD,wide:DWORD,tall:DWORD,spin:DWORD,gain:DWORD
|
|
local logoW:DWORD,logoH:DWORD,left:DWORD,top:DWORD
|
|
local originalTime:DWORD
|
|
invoke RenderHDStudio3D,startupElapsed3D
|
|
test eax,eax
|
|
jnz studio_film_master_done
|
|
; Map the longer ident to the retained eight-second fallback studio only.
|
|
mov eax,startupElapsed3D
|
|
mov originalTime,eax
|
|
imul eax,8000
|
|
xor edx,edx
|
|
mov ecx,STUDIO_HD_DURATION
|
|
div ecx
|
|
cmp eax,7999
|
|
jbe @F
|
|
mov eax,7999
|
|
@@:
|
|
mov startupElapsed3D,eax
|
|
invoke RenderCinematicMaster3D,startupElapsed3D
|
|
test eax,eax
|
|
jnz studio_film_restore_time
|
|
invoke FilmLerp3D,startupElapsed3D,6200,140,320
|
|
mov focalX,eax
|
|
invoke FilmLerp3D,startupElapsed3D,6200,500,420
|
|
mov focalY,eax
|
|
invoke FilmLerp3D,startupElapsed3D,6200,1380,730
|
|
mov wide,eax
|
|
imul eax,3
|
|
shr eax,2
|
|
mov tall,eax
|
|
mov eax,startupElapsed3D
|
|
imul eax,7
|
|
xor edx,edx
|
|
mov ecx,80
|
|
div ecx
|
|
mov spin,eax
|
|
invoke FilmLerp3D,startupElapsed3D,6500,256,92
|
|
mov gain,eax
|
|
invoke DrawFilmWheel3D,focalX,focalY,wide,tall,spin,gain
|
|
mov eax,startupElapsed3D
|
|
imul eax,21
|
|
xor edx,edx
|
|
mov ecx,80
|
|
div ecx
|
|
neg eax
|
|
add eax,80
|
|
invoke DrawFilmBall3D,focalX,focalY,wide,tall,eax
|
|
mov eax,startupElapsed3D
|
|
sub eax,3000
|
|
js studio_film_fx
|
|
mov ebx,eax
|
|
invoke FilmLerp3D,ebx,2000,890,540
|
|
mov logoW,eax
|
|
imul eax,2
|
|
xor edx,edx
|
|
mov ecx,3
|
|
div ecx
|
|
mov logoH,eax
|
|
mov eax,640
|
|
sub eax,logoW
|
|
sar eax,1
|
|
mov left,eax
|
|
mov eax,480
|
|
sub eax,logoH
|
|
sar eax,1
|
|
sub eax,12
|
|
mov top,eax
|
|
invoke FilmLerp3D,ebx,1500,0,255
|
|
mov animOpacity3D,eax
|
|
invoke DrawAnimSprite3D,OFFSET filmStudio,0,left,top,logoW,logoH
|
|
mov animOpacity3D,255
|
|
cmp startupElapsed3D,5500
|
|
jb studio_film_fx
|
|
invoke PresentationText3D,272,419,OFFSET bootPresents,00B9B5AAh,1,-1
|
|
studio_film_fx:
|
|
call DrawFilmDust3D
|
|
invoke FilmGlint3D,438,168,4400
|
|
call GradeFilm3D
|
|
call FilmLetterbox3D
|
|
studio_film_restore_time:
|
|
mov eax,originalTime
|
|
mov startupElapsed3D,eax
|
|
studio_film_master_done:
|
|
ret
|
|
RenderStudioFilm3D ENDP
|
|
|
|
RenderTitleFilm3D PROC uses ebx esi edi
|
|
local t:DWORD,logoW:DWORD,logoH:DWORD,left:SDWORD,top:SDWORD
|
|
mov eax,startupElapsed3D
|
|
add eax,8000
|
|
invoke RenderCinematicMaster3D,eax
|
|
test eax,eax
|
|
jnz title_film_master_done
|
|
; Save the playable scene. The fly-through never moves the actual player.
|
|
push playerX
|
|
push playerY
|
|
push playerAngle
|
|
push worldMap3D
|
|
push viewHorizon3D
|
|
push floorTexture3D
|
|
push outdoorRender3D
|
|
push viewEye3D
|
|
push viewCeiling3D
|
|
push cityClock3D
|
|
lea esi,cityObjects3D
|
|
lea edi,filmObjectSave
|
|
mov ecx,CITY_PROP_COUNT*SIZEOF CityProp3D/4
|
|
rep movsd
|
|
mov eax,startupElapsed3D
|
|
mov t,eax
|
|
cmp eax,4500
|
|
jae film_camera_turn
|
|
invoke FilmLerp3D,eax,4500,FP_1*29,FP_1*223/10
|
|
mov playerX,eax
|
|
invoke FilmLerp3D,t,4500,FP_1*14,FP_1*146/10
|
|
mov playerY,eax
|
|
invoke FilmLerp3D,t,4500,FP_1*7,FP_1*42/10
|
|
mov viewEye3D,eax
|
|
invoke FilmLerp3D,t,4500,256,288
|
|
mov playerAngle,eax
|
|
invoke FilmLerp3D,t,4500,165,230
|
|
mov viewHorizon3D,eax
|
|
jmp film_camera_ready
|
|
film_camera_turn:
|
|
sub eax,4500
|
|
mov ebx,eax
|
|
invoke FilmLerp3D,ebx,3300,FP_1*223/10,FP_1*22
|
|
mov playerX,eax
|
|
invoke FilmLerp3D,ebx,5500,FP_1*146/10,FP_1*116/10
|
|
mov playerY,eax
|
|
invoke FilmLerp3D,ebx,3300,FP_1*42/10,FP_1*19/10
|
|
mov viewEye3D,eax
|
|
invoke FilmLerp3D,ebx,3300,288,384
|
|
mov playerAngle,eax
|
|
invoke FilmLerp3D,ebx,3300,230,300
|
|
mov viewHorizon3D,eax
|
|
film_camera_ready:
|
|
mov eax,playerX
|
|
mov filmLastCameraX,eax
|
|
mov eax,playerY
|
|
mov filmLastCameraY,eax
|
|
mov eax,viewEye3D
|
|
mov filmLastCameraZ,eax
|
|
mov eax,playerAngle
|
|
mov filmLastCameraAngle,eax
|
|
mov worldMap3D,OFFSET cityMap3D
|
|
mov outdoorRender3D,1
|
|
mov floorTexture3D,60
|
|
mov viewCeiling3D,FP_1*13
|
|
mov eax,startupElapsed3D
|
|
add eax,17000
|
|
mov cityClock3D,eax
|
|
call UpdateCamera3D
|
|
call DrawCitySky3D
|
|
call RenderCeilingAndFloor
|
|
call DrawCitySkyline3D
|
|
call RenderWalls
|
|
call PrepareCityDepth3D
|
|
call RenderStreetDressing3D
|
|
call RenderCityObjects3D
|
|
call RenderCityFurniture3D
|
|
call RenderCityFacade3D
|
|
call RenderCityGuards3D
|
|
cmp startupElapsed3D,7800
|
|
jae @F
|
|
invoke DrawCityObject3D,OFFSET filmSign,0
|
|
@@:
|
|
call DrawCityRain3D
|
|
; The sign becomes the full title as the dolly reaches the casino entrance.
|
|
mov eax,startupElapsed3D
|
|
sub eax,7800
|
|
js film_title_finish
|
|
mov ebx,eax
|
|
invoke FilmLerp3D,ebx,1200,256,92
|
|
invoke FadeCityFrame3D,eax
|
|
invoke FilmLerp3D,ebx,1400,760,568
|
|
mov logoW,eax
|
|
imul eax,344
|
|
xor edx,edx
|
|
mov ecx,1024
|
|
div ecx
|
|
mov logoH,eax
|
|
mov eax,640
|
|
sub eax,logoW
|
|
sar eax,1
|
|
mov left,eax
|
|
mov eax,480
|
|
sub eax,logoH
|
|
sar eax,1
|
|
sub eax,8
|
|
mov top,eax
|
|
invoke FilmLerp3D,ebx,1100,0,255
|
|
mov animOpacity3D,eax
|
|
invoke DrawAnimSprite3D,OFFSET filmTitle,0,left,top,logoW,logoH
|
|
mov animOpacity3D,255
|
|
cmp startupElapsed3D,9400
|
|
jb film_title_finish
|
|
invoke PresentationText3D,220,373,OFFSET bootTitleTag,00D4D3BEh,1,-1
|
|
film_title_finish:
|
|
invoke FilmGlint3D,422,207,8800
|
|
call GradeFilm3D
|
|
call FilmLetterbox3D
|
|
lea esi,filmObjectSave
|
|
lea edi,cityObjects3D
|
|
mov ecx,CITY_PROP_COUNT*SIZEOF CityProp3D/4
|
|
rep movsd
|
|
pop cityClock3D
|
|
pop viewCeiling3D
|
|
pop viewEye3D
|
|
pop outdoorRender3D
|
|
pop floorTexture3D
|
|
pop viewHorizon3D
|
|
pop worldMap3D
|
|
pop playerAngle
|
|
pop playerY
|
|
pop playerX
|
|
call UpdateCamera3D
|
|
title_film_master_done:
|
|
ret
|
|
RenderTitleFilm3D ENDP
|