I started developing rotatable camera in VIII (VII will utilize from it too)
The look-at actor is always in center of the stage, and R is distance from center of circle to world-space camera.
I'm kinda new to FPU so sorry for not so good code. Anyway this one is working fine, when you press '3' in battle the camera would move, but I'm currently struggling with conversion of pseudo-vector short16 from real (single) value. Need to think about it, also it misses the Y axis (or Z if we're talking about X-ZY coordinate system)
In code you can see divide by 10000.0, but it's wrong. Diving doesn't do anything as the float/real number always will have different hex values other than FF8 short16 camera coordinate.
Currently I'm on stage like this:
alloc(newmem,2048)
label(returnhere)
label(originalcode)
newmem:
PUSH 03
CALL FF8.exe+685E0 //get_key_state
ADD ESP, 4
TEST EAX, EAX
JNZ LeftCamera
PUSH 04
CALL FF8.exe+685E0 //get_key_state
ADD ESP, 4
TEST EAX, EAX
JNZ RightCamera
JMP originalcode
LeftCamera: //Casual value+10
PUSH EAX
MOV EAX, [B8B7F4] //BattleCamera X
//SHR EAX, 010
ADD EAX, 32
//SHL EAX, 010
MOV [B8B7F4], EAX //BattleCamera X
POP EAX
JMP originalcode
RightCamera: //Degree to radians + sine
FINIT
FLD [myvar]
FLD1
FADD st(0), st(1)
FST [myvar]
PUSH [myvar]
CALL CalculateRadians
ADD ESP,4
FINIT
FLD [myvar+8]
FSIN
FLD [myvar+10]
FMUL st(0), st(1)
FLD [myvar+14]
FDIV st(1), st(0)
FSTP [B8B7F4] //BattleCamera X (st1>st0)
FSTP [B8B7F4] //BattleCamera X (correct st0)
//MOV EAX, [B8B7F4]
//SUB EAX, 32
//MOV [B8B7F4], EAX
JMP originalcode
myvar:
dd 42340000 //alpha
dd 40490e56 //PI
dd 00000000 //Temp far for FPU
dd 43340000 //180.0
dd 41200000 //R
dd 461c4000 //10000.0 0x14
CalculateRadians: //Get Angle to radians
ADD ESP, 4
POP EAX
SUB ESP, 8
MOV [myvar+8], EAX
FINIT
FLD [myvar+4] //st0 has PI
FLD [myvar+C] //st1 has 180.0
FDIV st(1), st(0)
FLD [myvar+8] //alpha
FMUL st(0), st(2)
FST [myvar+8]
RET
originalcode:
push 0000009D
JMP returnhere
"FF8.exe"+A2CA0:
jmp newmem
returnhere: