The source is on MASM syntax, I hope you will be able to understand it (I know it was a bad idea to use assembler)
Code:
WinMain proc uses esi edi hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
invoke fRaydiumInitAll
push CSTR("Farabi")
push RAYDIUM_RENDERING_WINDOW
push 480
push 600
call raydium_window_create
add esp,16
invoke FindWindow,0,CADD("Farabi")
.if eax==0
invoke MessageBox,0,CADD("Cannot Find Window"),0,0
.endif
mov hwnd,eax
invoke GetDC,hwnd
.if eax==0
invoke MessageBox,hwnd,CADD("DC failed"),0,0
.endif
mov hDC,eax
invoke GetProcAddress,Raydium, CADD("raydium_texture_filter_change")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
push RAYDIUM_TEXTURE_FILTER_TRILINEAR
call eax
add esp,4
push CFLT(2000.0)
push CFLT(0.01)
push CFLT(60.0)
call raydium_window_view_perspective
add esp,12
invoke GetProcAddress,Raydium, CADD("raydium_light_enable")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
call eax
push 0
call raydium_light_on
add esp,4
;
;void raydium_light_conf_7f(GLuint l,GLfloat px, GLfloat py, GLfloat pz, GLfloat intensity,
;GLfloat r, GLfloat g, GLfloat b)
push CFLT(1.0)
push CFLT(1.0)
push CFLT(1.0)
push CFLT(100000000.0)
push CFLT(100.0)
push CFLT(150.0)
push CFLT(150.0)
push 0
call raydium_light_conf_7f
add esp,32
push 1
call raydium_light_on
add esp,4
push CFLT(1.0)
push CFLT(1.0)
push CFLT(1.0)
push CFLT(100000000.0)
push CFLT(100.0)
push CFLT(-150.0)
push CFLT(150.0)
push 1
call raydium_light_conf_7f
add esp,32
push 2
call raydium_light_on
add esp,4
push CFLT(1.0)
push CFLT(1.0)
push CFLT(1.0)
push CFLT(100000000.0)
push CFLT(100.0)
push CFLT(150.0)
push CFLT(-150.0)
push 2
call raydium_light_conf_7f
add esp,32
push 3
call raydium_light_on
add esp,4
push CFLT(1.0)
push CFLT(1.0)
push CFLT(1.0)
push CFLT(100000000.0)
push CFLT(100.0)
push CFLT(-150.0)
push CFLT(-150.0)
push 3
call raydium_light_conf_7f
add esp,32
invoke GetProcAddress,Raydium, CADD("raydium_background_color_change")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
;aydium_background_color_change(1,0.9,0.7,1);
push CFLT(1.0)
push CFLT(0.0)
push CFLT(0.0)
push CFLT(0.0)
call eax
add esp,16
invoke GetProcAddress,Raydium,CADD("raydium_fog_disable")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
call eax
invoke GetProcAddress,Raydium, CADD("raydium_sky_box_cache")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
;call eax
invoke GetProcAddress,Raydium, CADD("glutKeyboardFunc")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
push offset Key
call eax
add esp,4
invoke GetProcAddress,Raydium, CADD("glutSpecialUpFunc")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
; push offset KeyUp
; call eax
; add esp,4
invoke glEnable,GL_LINE_SMOOTH
;invoke glEnable,GL_LIGHTING
invoke GetProcAddress,Raydium, CADD("raydium_ode_CollideCallback")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
mov raydium_ode_CollideCallback,eax
push offset Collide
pop dword ptr[eax]
;call eax
; invoke GetProcAddress,Raydium,CADD("raydium_ode_set_physics_freq")
; .if eax==0
; invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
; .endif
; push CFLT(100.0)
; call eax
; add esp,4
invoke GetProcAddress,Raydium,CADD("raydium_osd_color_change")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
.endif
mov raydium_osd_color_change,eax
push CFLT(1.0)
push CFLT(1.0)
push CFLT(1.0)
call raydium_osd_color_change
add esp,12
invoke GetProcAddress,Raydium,CADD("raydium_camera_replace_go")
.if eax==0
invoke MessageBox,0,CADD("Cannot Find function"),0,MB_OK
ret
.endif
mov raydium_camera_replace_go,eax
push CSTR("map.tri")
call raydium_ode_ground_set_name
add esp,4
jmp @f
invoke LoadObject,CADD("anm1.tri")
invoke LoadObject,CADD("anm2.tri")
invoke LoadObject,CADD("anm3.tri")
invoke LoadObject,CADD("anm4.tri")
invoke LoadObject,CADD("anm5.tri")
@@:
invoke SetTimer,hwnd,1,1000,addr FPSCounter
invoke fBVHReadData,CADD("Untitled.bvh"),addr fb
push CSTR("obj1")
call raydium_ode_object_create
add esp,4
mov a,eax
invoke mAlloc,256
mov obj1,eax
invoke fRaydiumODEObjectBoxAdd,CADD("Hip"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri")
invoke fBVHGetDataS,addr fb,0,0
invoke fRaydiumODEElementMoveName3f,CADD("Hip"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ
invoke fRaydiumODEObjectBoxAdd,CADD("waist"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri")
invoke fBVHGetDataS,addr fb,0,1
invoke fRaydiumODEElementMoveName3f,CADD("waist"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ
invoke fRaydiumODEObjectBoxAdd,CADD("abdomen"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri")
invoke fBVHGetDataS,addr fb,0,2
invoke fRaydiumODEElementMoveName3f,CADD("abdomen"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ
invoke fRaydiumODEObjectBoxAdd,CADD("chest"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri")
invoke fBVHGetDataS,addr fb,0,3
invoke fRaydiumODEElementMoveName3f,CADD("chest"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ
invoke fRaydiumODEObjectBoxAdd,CADD("neck"),a,CFLT(1.0),CFLT(-1.0),CFLT(0.0),CFLT(0.0),RAYDIUM_ODE_STANDARD,0,CADD("cube2.tri")
invoke fBVHGetDataS,addr fb,0,4
invoke fRaydiumODEElementMoveName3f,CADD("neck"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ
invoke fBVHGetDataS,addr fb,0,1
invoke fRaydiumODEJointAttachHingeName,CADD("waist2"),CADD("Hip"),CADD("waist"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X
invoke fBVHGetDataS,addr fb,0,2
invoke fRaydiumODEJointAttachHingeName,CADD("abdomen2"),CADD("waist"),CADD("abdomen"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X
invoke fBVHGetDataS,addr fb,0,3
invoke fRaydiumODEJointAttachHingeName,CADD("chest2"),CADD("abdomen"),CADD("chest"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X
invoke fBVHGetDataS,addr fb,0,4
invoke fRaydiumODEJointAttachHingeName,CADD("neck2"),CADD("chest"),CADD("neck"),[eax].fObject.OffsetX,[eax].fObject.OffsetY,[eax].fObject.OffsetZ,RAYDIUM_ODE_JOINT_AXE_X
invoke GetProcAddress,Raydium, CADD("raydium_callback")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
push offset DrawScene
call eax
add esp,4
ret
WinMain endp
Code:
DrawScene proc
LOCAL buff[256]:dword
LOCAL position,t:dword
LOCAL cambuff:dword
LOCAL tick:dword
LOCAL q:qword
invoke GetTickCount
mov tick,eax
invoke GetProcAddress,Raydium, CADD("raydium_joy_key_emul")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
call eax
invoke GetProcAddress,Raydium, CADD("raydium_key")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
mov edx,[eax]
invoke GetProcAddress,Raydium, CADD("raydium_key_last")
.if eax==0
invoke MessageBox,0,CADD("Cannot find function"),0,MB_OK
ret
.endif
mov edx,[eax]
call raydium_clear_frame
push RAYDIUM_CAMERA_FREEMOVE_NORMAL
call raydium_camera_freemove
add esp,4
;
; push CFLT(1.0) ;z
; push CFLT(0.0) ;y
; push CFLT(100.0) ;x
; push obj2
; call raydium_ode_element_move_name_3f
; add esp,16
;
; push CFLT(0.0) ;z
; push CFLT(0.0) ;y
; push CFLT(0.0) ;x
; push obj2
; call raydium_ode_element_rotate_name_3f
; add esp,16
;
; push CFLT(1.0) ;z
; push CFLT(0.0) ;y
; push CFLT(100.0) ;x
; push obj3
; call raydium_ode_element_move_name_3f
; add esp,16
;
; push CFLT(0.0) ;z
; push CFLT(0.0) ;y
; push CFLT(0.0) ;x
; push obj3
; call raydium_ode_element_rotate_name_3f
; add esp,16
;
; push CFLT(1.0) ;z
; push CFLT(0.0) ;y
; push CFLT(100.0) ;x
; push obj4
; call raydium_ode_element_move_name_3f
; add esp,16
;
; push CFLT(0.0) ;z
; push CFLT(0.0) ;y
; push CFLT(0.0) ;x
; push obj4
; call raydium_ode_element_rotate_name_3f
; add esp,16
;
; push CFLT(1.0) ;z
; push CFLT(0.0) ;y
; push CFLT(100.0) ;x
; push obj5
; call raydium_ode_element_move_name_3f
; add esp,16
;
; push CFLT(0.0) ;z
; push CFLT(0.0) ;y
; push CFLT(0.0) ;x
; push obj5
; call raydium_ode_element_rotate_name_3f
; add esp,16
; invoke fRaydiumODEElementMoveName3f,CADD("Hip"),CFLT(0.0),CFLT(5.0),CFLT(10.0)
; invoke fRaydiumODEObjectMoveName3f,CADD("obj1"),CFLT(0.0),CFLT(0.0),CFLT(5.0)
jmp @f
.if frame_count==0
invoke LoadObject,CADD("anm1.tri")
.elseif frame_count==2
invoke LoadObject,CADD("anm2.tri")
.elseif frame_count==4
invoke LoadObject,CADD("anm3.tri")
.elseif frame_count==6
invoke LoadObject,CADD("anm4.tri")
.elseif frame_count==8
invoke LoadObject,CADD("anm5.tri")
mov frame_count,0
.endif
inc frame_count
push CFLT(-0.7)
push CFLT(0.0)
push CFLT(1.0)
push obj1
call raydium_ode_element_move_name_3f
add esp,16
push CFLT(0.0) ;z
push CFLT(0.0) ;y
push CFLT(0.0) ;x
push obj1
call raydium_ode_element_rotate_name_3f
add esp,16
@@:
push 0
call raydium_ode_draw_all
add esp,4
call raydium_camera_get_data
mov cambuff,eax
invoke glDisable,GL_LINE_SMOOTH
mov eax,cambuff
push FLT2INT(dword ptr[eax+4*3])
push CSTR("Rot X: %d ") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(98.0) ; Y
push CFLT(20.0) ; X
CALL raydium_osd_printf
add esp,28
mov eax,cambuff
push FLT2INT(dword ptr[eax+4*4])
push CSTR("Rot Y: %d ") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(95.0) ; Y
push CFLT(20.0) ; X
CALL raydium_osd_printf
add esp,28
mov eax,cambuff
push FLT2INT(dword ptr[eax+4*5])
push CSTR("Rot Z: %d ") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(92.0) ; Y
push CFLT(20.0) ; X
CALL raydium_osd_printf
add esp,28
mov eax,cambuff
;GLfloat x, GLfloat y, GLfloat size, GLfloat spacer,char *texture, unsigned char *format, ...)
push FLT2INT(dword ptr[eax+4*0])
push CSTR("posX: %d") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(98.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
mov eax,cambuff
push FLT2INT(dword ptr[eax+4*1])
push CSTR("PosY: %d") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(95.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
mov eax,cambuff
push FLT2INT(dword ptr[eax+4*2])
push CSTR("PosZ: %d") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(92.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
push tick_c
push CSTR("Time Call: %d ms/Frame") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(87.0) ; Y
push CFLT(20.0) ; X
CALL raydium_osd_printf
add esp,28
mov eax,raydium_render_fps
push dword ptr[eax]
pop FPS
push FPS
push CSTR("%d FPS") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(82.0) ; Y
push CFLT(20.0) ; X
CALL raydium_osd_printf
add esp,28
invoke fBVHGetDataS,addr fb,0,0
pushad
mov eax,[eax].fObject.lpName
push eax
; push FLT2INT([eax].fObject.PositionZ)
; push eax
push CSTR("Name: %s") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(83.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
popad
pushad
fld [eax].fObject.RotationX
fstp q
invoke FloatToStr2,q,addr buff
lea eax,buff
push eax
; push FLT2INT([eax].fObject.PositionZ)
; push eax
push CSTR("Test Value X: %s") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(78.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
popad
pushad
fld [eax].fObject.RotationY
fstp q
invoke FloatToStr2,q,addr buff
lea eax,buff
push eax
; push FLT2INT([eax].fObject.PositionZ)
; push eax
push CSTR("Test Value Y: %s") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(73.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
popad
pushad
fld [eax].fObject.RotationZ
fstp q
invoke FloatToStr2,q,addr buff
lea eax,buff
push eax
; push FLT2INT([eax].fObject.PositionZ)
; push eax
push CSTR("Test Value Z: %s") ; format
push CSTR("Font2.tga") ; texture
push CFLT(0.5) ; spacer
push CFLT(18.0) ; size
push CFLT(68.0) ; Y
push CFLT(1.0) ; X
CALL raydium_osd_printf
add esp,28
popad
invoke glEnable,GL_LINE_SMOOTH
call raydium_rendering_finish
invoke GetTickCount
sub eax,tick
mov tick_c,eax
inc FPS_C
;invoke Sleep,40
ret
DrawScene endp
Code with ";" in front of it is not used code, ";" mean is comment or equal to "/* */" on C++.
Keep up the good works to all of you guys.