KAZIK/src_graphics/bowling_pin_shape.inc
Artvasil09 7e081beeca feat: enhance bowling physics, audio, ball weight selection, and visitor cast routines
- Bowling feel: impulse contact solver, string pinsetter cycle, in-world lengthwise return rack and visible ball return lift

- Ball weights: 4/5/6/7 kg selection with equal launch work physics, momentum balance, and projected picking

- Audio: dedicated MCI channels with 7 synthesized waveaudio cues (release, rolling, impacts, applause, pinsetter, return)

- First-person animations: 33-frame player underarm throw/follow-through sequence (player-underarm-v2)

- Visitors: 10 persistent shared cast identities with exclusive reservations, activity transitions, and chair sit/rise animations

- Tests & verification: comprehensive native regression test suites and updated documentation

- Synchronize binaries and update launcher hash to 536E23BED4055562BC63871826FF44FFED037923A9BE8E0F591131DB4FBD104B
2026-11-04 18:44:12 +03:00

296 lines
6 KiB
PHP

; The existing ray/ellipsoid renderer, evaluated in a pin-local orthonormal basis.
DrawBowlingEllipsoid3D PROC uses ebx esi edi centreX:DWORD,centreY:DWORD,centreZ:DWORD,radiusX:DWORD,radiusY:DWORD,radiusZ:DWORD,material:DWORD
local leftPx:DWORD,rightPx:DWORD,topPx:DWORD,bottomPx:DWORD,column:DWORD,row:DWORD
local centrePx:DWORD,centreDepth:DWORD,pixelDepth:DWORD,temp:DWORD,texU:DWORD,texV:DWORD
local texture:DWORD,texWidth:DWORD,texHeight:DWORD,shade:DWORD,color:DWORD
local worldOX:DWORD,worldOY:DWORD,worldOZ:DWORD,worldRZ:REAL4,boundRadius:DWORD
local ox:REAL4,oy:REAL4,oz:REAL4,rayX:REAL4,rayY:REAL4,rayZ:REAL4
local quadraticC:REAL4,quadraticA:REAL4,quadraticB:REAL4,discriminant:REAL4,hitTime:REAL4
invoke ResolveCitySurface3D,material
test eax,eax
jz bp_shape_done
mov texture,eax
mov texWidth,ecx
mov texHeight,edx
invoke ProjectCityPoint3D,centreX,centreY
cmp edx,FP_1/8
jle bp_shape_done
mov centrePx,eax
mov centreDepth,edx
mov eax,radiusX
cmp eax,radiusZ
jge @F
mov eax,radiusZ
@@:
mov boundRadius,eax
shl eax,1
imul eax,SCREEN_H
cdq
idiv centreDepth
mov ecx,centrePx
sub ecx,eax
mov leftPx,ecx
add eax,centrePx
mov rightPx,eax
mov eax,viewEye3D
sub eax,centreZ
sub eax,boundRadius
imul eax,SCREEN_H
cdq
idiv centreDepth
add eax,viewHorizon3D
sub eax,4
mov topPx,eax
mov eax,viewEye3D
sub eax,centreZ
add eax,boundRadius
imul eax,SCREEN_H
cdq
idiv centreDepth
add eax,viewHorizon3D
add eax,4
mov bottomPx,eax
cmp leftPx,0
jge @F
mov leftPx,0
@@:
cmp rightPx,SCREEN_W-1
jle @F
mov rightPx,SCREEN_W-1
@@:
cmp topPx,0
jge @F
mov topPx,0
@@:
cmp bottomPx,SCREEN_H-1
jle @F
mov bottomPx,SCREEN_H-1
@@:
mov eax,leftPx
cmp eax,rightPx
jge bp_shape_done
mov eax,topPx
cmp eax,bottomPx
jge bp_shape_done
mov eax,playerX
sub eax,centreX
mov worldOX,eax
mov eax,playerY
sub eax,centreY
mov worldOY,eax
mov eax,viewEye3D
sub eax,centreZ
mov worldOZ,eax
fild worldOX
fimul bpRenderUX3D
fild worldOY
fimul bpRenderUY3D
faddp st(1),st
fdiv roofFloatFP3D
fidiv radiusX
fstp ox
fild worldOX
fimul bpRenderVX3D
fild worldOY
fimul bpRenderVY3D
faddp st(1),st
fild worldOZ
fimul bpRenderVZ3D
faddp st(1),st
fdiv roofFloatFP3D
fidiv radiusY
fstp oy
fild worldOX
fimul bpRenderNX3D
fild worldOY
fimul bpRenderNY3D
faddp st(1),st
fild worldOZ
fimul bpRenderNZ3D
faddp st(1),st
fdiv roofFloatFP3D
fidiv radiusZ
fstp oz
fld ox
fmul st,st
fld oy
fmul st,st
faddp st(1),st
fld oz
fmul st,st
faddp st(1),st
fld1
fsubp st(1),st
fstp quadraticC
mov eax,topPx
mov row,eax
bp_shape_row:
mov eax,viewHorizon3D
sub eax,row
mov temp,eax
fild temp
fmul roofFloatFP3D
fdiv roofFloat4803D
fstp worldRZ
mov eax,row
imul eax,SCREEN_W*4
mov ebx,leftPx
lea edi,[eax+ebx*4]
mov column,ebx
bp_shape_pixel:
mov ebx,column
fild cityRayX3D[ebx*4]
fimul bpRenderUX3D
fild cityRayY3D[ebx*4]
fimul bpRenderUY3D
faddp st(1),st
fdiv roofFloatFP3D
fidiv radiusX
fstp rayX
fild cityRayX3D[ebx*4]
fimul bpRenderVX3D
fild cityRayY3D[ebx*4]
fimul bpRenderVY3D
faddp st(1),st
fld worldRZ
fimul bpRenderVZ3D
faddp st(1),st
fdiv roofFloatFP3D
fidiv radiusY
fstp rayY
fild cityRayX3D[ebx*4]
fimul bpRenderNX3D
fild cityRayY3D[ebx*4]
fimul bpRenderNY3D
faddp st(1),st
fld worldRZ
fimul bpRenderNZ3D
faddp st(1),st
fdiv roofFloatFP3D
fidiv radiusZ
fstp rayZ
fld rayX
fmul st,st
fld rayY
fmul st,st
faddp st(1),st
fld rayZ
fmul st,st
faddp st(1),st
fstp quadraticA
fld rayX
fmul ox
fld rayY
fmul oy
faddp st(1),st
fld rayZ
fmul oz
faddp st(1),st
fstp quadraticB
fld quadraticB
fmul st,st
fld quadraticA
fmul quadraticC
fsubp st(1),st
fst discriminant
ftst
fnstsw ax
sahf
fstp st(0)
jb bp_shape_next
fld discriminant
fsqrt
fadd quadraticB
fchs
fdiv quadraticA
fst hitTime
fmul roofFloatFP3D
fistp pixelDepth
mov eax,pixelDepth
cmp eax,4096
jle bp_shape_next
cmp eax,cityDepthBuffer3D[edi]
jae bp_shape_next
fld hitTime
fmul rayX
fadd ox
fld1
faddp st(1),st
fmul roofFloatHalfTex3D
fistp texU
fld hitTime
fmul rayZ
fadd oz
fchs
fld1
faddp st(1),st
fmul roofFloatHalfTex3D
fistp texV
fld hitTime
fmul rayZ
fadd oz
fmul roofFloatShade3D
fadd roofFloatAmbient3D
fistp shade
mov eax,texV
and eax,255
mov ecx,texHeight
imul eax,ecx
shr eax,8
imul eax,texWidth
mov edx,texU
and edx,255
imul edx,texWidth
shr edx,8
add eax,edx
mov esi,texture
mov eax,[esi+eax*4]
mov color,eax
movzx eax,al
imul eax,shade
shr eax,8
mov ebx,eax
mov eax,color
shr eax,8
and eax,255
imul eax,shade
and eax,0FF00h
or ebx,eax
mov eax,color
shr eax,16
and eax,255
imul eax,shade
and eax,0FF00h
shl eax,8
or eax,ebx
cmp roofCityPass3D,0
je bp_shape_color_ready
invoke ShadeRoofCityPixel3D,eax,pixelDepth,256,material
mov ecx,edi
shr ecx,2
mov edx,roofPixelGlow3D
mov roofGlowMask3D[ecx],dl
bp_shape_color_ready:
mov screenBuffer[edi],eax
cmp hallLevel3D,HALL_ROOF
jne @F
mov ecx,edi
shr ecx,2
mov edx,roofCityPass3D
mov roofCityMask3D[ecx],dl
@@:
mov eax,pixelDepth
mov cityDepthBuffer3D[edi],eax
bp_shape_next:
add edi,4
inc column
mov eax,column
cmp eax,rightPx
jbe bp_shape_pixel
inc row
mov eax,row
cmp eax,bottomPx
jbe bp_shape_row
bp_shape_done:
ret
DrawBowlingEllipsoid3D ENDP