Página 1 de 1

[VC] Help with rendering object

Enviado: 15 Ago 2021, 15:55
por XMDS

Código: Selecionar tudo

0000:
const
 CModelInfo_ms_modelInfoPtrs = 0x0092D4C8
 CBaseModelInfo_AddRef = 0x0053F1B0
 RwFrameCreate = 0x00644AA0
 RpAtomicClone = 0x00640FD0
 RpAtomicSetFrame = 0x006423C0
 RwFrameUpateObjects = 0x00644D00
 ModelID = 336
end // const

int ModelInfo
int vtable
int GetRwObject
int RpAtomic
int RwFrame
int NewRpAtomic
int pos
float x
float y
float z
int RpAtomicCallBackRender

:1
wait 0
if
 Streaming.IsModelAvailable(ModelID)
jf @1
0@ = ModelID * 4
0@ += CModelInfo_ms_modelInfoPtrs
memory.Read(ModelInfo, 0@, 4, 0)
if
 ModelInfo <> 0
jf @1
memory.Read(vtable, ModelInfo, 4, 0)
2@ = vtable + 0x14
memory.Read(GetRwObject, 2@, 4, 0)
0AA8: call_method_return GetRwObject struct ModelInfo num_params 0 pop 0 RpAtomic
if
 RpAtomic <> 0
jf @1
0AA6: call_method CBaseModelInfo_AddRef struct ModelInfo num_params 0 pop 0
0AA7: call_function_return RwFrameCreate num_params 0 pop 0 RwFrame
0AA7: call_function_return RpAtomicClone num_params 1 pop 1 RpAtomic NewRpAtomic
0AA5: call_function RpAtomicSetFrame num_params 2 pop 2 RwFrame NewRpAtomic

:2
wait 0
if
 pad.IsKeyPressed(77)
jf @2
char.GetOffsetInWorldCoords(x, y ,z, $player_actor, 0.0, 2.0, 0.0)
pos = RwFrame + 0x40
memory.Write(pos, 4, x, 0)
pos += 4
memory.Write(pos, 4, y, 0)
pos += 4
memory.Write(pos, 4, z, 0)
0AA5: call_function RwFrameUpateObjects num_params 1 pop 1 RwFrame
15@ = NewRpAtomic + 0x48
memory.Read(RpAtomicCallBackRender, 15@, 4, 0)
0AA5: call_function RpAtomicCallBackRender num_params 1 pop 1 NewRpAtomic
end_thread
I want to render an obj model in front of the player, but the game crashes.

How to render correctly, how should my code be perfect?

Added after 2 minutes 57 seconds:
@Junior_Djjr excuse me. Can you help me?