Dec 26, 2013 at 2:08 AM
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 27
Pronouns: he/him
Optimization to the max.
direction sets U/D on the scale.
frame number sets leftness/rightness.
the only downfall is that directions are skewed. (0001 would be right)
Code:
offset [*something*]
push ebp
mov ebp,esp
;================================
;=======<///FRAMARECTS\\\>=======
;================================
SUB ESP,1C ;10 represents the total amount of variables.
MOV DWORD PTR SS:[EBP-10],0
MOV DWORD PTR SS:[EBP-C],0
MOV DWORD PTR SS:[EBP-8],0
MOV DWORD PTR SS:[EBP-4],0
;=================================
;=====<///RENDER GRAPHICS\\\>=====
;=================================
setpointer
XOR EAX,EAX ;MOV EAX,0
;render face direction
MOV EAX, [ECX+4C] ;move direction of NPC to EAX
MOV EDX, 10
IMUL EAX,EDX ;multiply by 10
;if your NPC was lower down on the sprite sheet, we can add an ADD EAX, -- here!
mov npc.displayU, eax ;and that is the Up rect of you NPC if direction is 2 then it would be 20 for the up rect
add eax, 10
mov npc.displayD, eax ;and pending on the size of the npc, we ad 10 for the down rect.
;render frame number
setpointer
MOV EAX,DWORD PTR DS:[ECX+68] ;move frame number to EAX
MOV EDX, 10 ;and then we repeat the process here.
IMUL EAX,EDX ;except instead of directon, we fo go the frome number to prove leftness/rightness of thee NPC
mov npc.displayL, eax
add eax, 10
mov npc.displayR, eax
MOV ESP,EBP
POP EBP
RETN
(Thanks Noxid)