Snowboss pseudo code

              | offset 479030
              | 
              | 
              | #define
              | my.ptr = [4bba58]
              | SETPTR = mov ecx, 4bba58
              | collision = [ecx+4]
              | x-pos = [ecx+8]
              | y-pos = [ecx+C]
              | x-vel = [ecx+10]
              | y-vel = [ecx+14]
              | event = [ecx+30]
              | direction = [ecx+4c]
              | flags = [ecx+50]
              | hp = [ecx+40]
              | framtimer = [EcX+64]
              | frame = [EcX+68]
              | ObjTimer = [EcX+6C]
              | ScrTimer = [EcX+78]
              | damage = [EcX+A4]
              | QuoteX = [49E654]
              | QuoteY = [49E658]
              | my.state = [ecx+74]
              | leftBound = [ecx+7c]
              | upBound = [ecx+80]
              | rightBound = [ecx+84]
              | downBound = [ecx+88]
              | leftDBound = [ecx+8c]
              | upDBound = [ecx+90]
              | rightDBound = [ecx+94]
              | downDBound = [ecx+98]
              | leftrect = [ebp-10]
              | uprect = [ebp-c]
              | rightrect = [ebp-8]
              | downrect = [ebp-4]
              | hitbox.state = [4bbac0]
              | hitbox.ptr = [4bbb04]
              | grab = mov eax,
              | size = [ecx+48]
              | Var1 = [ebp-14]
              | Var2 = [ebp-18]
              | #enddefine
              | 
              | push ebp
              | mov ebp, esp
              | sub esp, 18
              | SETPTR
              | grab my.state
              | JMP [EAX*4+:switchst8]
:STATE0       | 
              | SETPTR
              | mov leftDBound, 5000
              | mov rightDBound, 5000
              | mov upDBound, 7000
              | mov downDBound, 7000
              | mov leftBound, 2800
              | mov rightBound, 2800
              | mov upBound, 3000
              | mov downBound, 7000
              | mov x-pos, 1f000
              | mov y-pos, 11000
              | mov frame, 0
              | mov size, 3
              | mov flags, 8260
              | mov hp, 12C
              | mov my.state, 1
              | mov direction, 0
              | mov damage, 2
:STATE1       | jmp :Frame
              | 
:STATE2       | SETPTR
              | mov frame, 0
              | inc ScrTimer
              | cmp ScrTimer, 0a0
              | jl :Frame
              | mov ScrTimer, 0
              | push 3
              | push 0
              | CALL 40F350
              | add esp, 8
              | SETPTR
              | shl eax, 2
              | add eax, 3
              | mov my.state, eax
              | jmp :Frame
              | 
:STATE3       | 
:STATE7       | 
              | SETPTR
              | grab QuoteX
              | cmp x-pos, eax
              | jle :FacingRight
              | mov direction, 0
              | jmp :Crouching
:FacingRight  | mov direction, 2
:Crouching    | mov frame, 1
              | inc ScrTimer
              | cmp ScrTimer, 30
              | jl :Frame
              | mov ScrTimer, 0
              | inc my.state
              | push 1
              | push 6C
              | call 420640
              | add esp, 8
              | SETPTR
              | mov frame, 2
              | mov y-vel, -c00
              | cmp direction, 0
              | jne :JumpRight
              | mov x-vel, -400
              | jmp :Frame
:JumpRight    | mov x-vel, 400
              | jmp :Frame
              | 
:STATE4       | 
:STATE8       | SETPTR
              | grab collision
              | and eax, 8
              | cmp eax, 0
              | je :InAir
              | push 1
              | push 1A
              | call 420640
              | add esp, 8
              | SETPTR
              | mov [49E1DC], 10
              | mov my.state, 2
              | mov x-vel, 0
              | jmp :Frame
:InAir        | cmp my.state, 8
              | jne :Frame
              | grab quotex
              | add eax, 1000
              | cmp eax, x-pos
              | jle :Frame
              | sub eax, 2000
              | cmp eax, x-pos
              | jge :Frame
              | mov frame, 1
              | mov y-vel, 800
              | mov x-vel, 0
              | push 1
              | push 46
              | call 420640
              | add esp, 8
              | SETPTR
              | sub my.state, 4
              | jmp :Frame
:STATE11      | 
              | SETPTR
              | grab QuoteX
              | cmp x-pos, eax
              | jle :FacingRight2
              | mov direction, 0
              | jmp :Crouching2
:FacingRight2 | mov direction, 2
:Crouching2   | mov frame, 1
              | inc ScrTimer
              | cmp ScrTimer, 30
              | jl :Frame
              | mov ScrTimer, 0
              | inc my.state
              | push 1
              | push 6C
              | call 420640
              | add esp, 8
:STATE12      | SETPTR
              | mov frame, 2
              | mov y-vel, -c00
              | cmp y-pos, -10000
              | jge :FRAME
              | inc my.state
              | grab QuoteX
              | cmp eax, 8000
              | jg :NotFarLeft
              | mov eax, 8000
              | jmp :SetMyX
:NotFarLeft   | cmp eax, 20000
              | jl :SetMyX
              | mov eax, 20000
:SetMyX       | mov x-pos, eax
              | push 1
              | push 6C
              | call 420640
              | add esp, 8
:STATE13      | SETPTR
              | mov frame, 1
              | mov y-vel, 800
              | grab collision
              | and eax, 8
              | cmp eax, 0
              | je :Frame
              | push 1
              | push 1A
              | call 420640
              | add esp, 8
              | SETPTR
              | mov [49E1DC], 10
              | mov my.state, 2
              | mov Var1, 0
:Loopz        | cmp Var1, 2
              | jg :Frame
              | inc Var1
              | push 0D
              | push 0
              | call 40f350
              | add esp, 8
              | SETPTR
              | shl eax, 0D
              | add eax, 8000
              | push 100
              | push 0
              | push 0
              | push 0
              | push 0
              | push 0
              | push eax
              | push 1C
              | CALL 46EFD0
              | add esp, 20
              | SETPTR
              | jmp :Loopz
:STATE15      | SETPTR
              | grab QuoteX
              | cmp x-pos, eax
              | jle :FacingRight3
              | mov direction, 0
              | jmp :Waiting
:FacingRight3 | mov direction, 2
:Waiting      | mov frame, 3
              | mov eax, 4000
              | cmp direction, 0
              | jne :ShootingRight
              | mov rightDBound, eax
              | add eax, 2000
              | mov leftDBound, eax
              | jmp :Waiting2
:ShootingRight| mov leftDBound, eax
              | add eax, 2000
              | mov rightDBound, eax
:Waiting2     | inc ScrTimer
              | cmp ScrTimer, 30
              | jle :Frame
              | inc my.state
              | xor eax, eax
              | mov ScrTimer, eax
              | SETPTR
:STATE16      | inc ScrTimer
              | cmp ScrTimer, 0a0
              | jle :Snowballs
              | xor eax, eax
              | mov ScrTimer, eax
              | mov framtimer, eax
              | mov my.state, 2
              | mov frame, 0
              | mov leftDBound, 5000
              | mov rightDBound, 5000
              | jmp :Frame
:Snowballs    | grab framtimer
              | and eax, 2
              | cmp eax, 0
              | je :RightJitter
              | sub x-pos, 100
              | jmp :frametimInc
:RightJitter  | add x-pos, 100
:frametimInc  | inc framtimer
              | cmp framtimer, 4
              | jl :Frame
              | mov framtimer, 0
              | grab y-pos
              | sub eax, QuoteY
              | push eax
              | grab x-pos
              | sub eax, QuoteX
              | push eax
              | call 4258E0
              | add esp, 8
              | MOVZX edx,AL
	     | mov var1, edx
              | push 10
              | push -10
              | call 40f350
              | add esp, 8
              | mov ecx, [ebp-14]
              | add eax, ecx
              | mov Var1, eax
              | push eax
              | CALL 004258B0
              | add esp, 4
              | imul eax, eax, 3
              | mov Var2, eax
              | grab Var1
              | push eax
              | CALL 004258C0
              | add esp, 4
              | SETPTR
              | imul eax, eax, 3
              | mov Var1, eax
              | grab x-pos
              | sub eax, quoteX
              | sar eax,5
              | sub var1, eax
              | grab y-pos
              | sub eax, quoteY
              | sar eax, 5
              | add eax, 200
              | sub var2, eax
              | cmp var1, 0c00
              | jle :MakeS
              | grab var1
              | sub eax, 0c00
              | sar eax, 2
              | sub var2, eax
              | mov var1, 0c00
:MakeS        | cmp var1, -0c00
              | jge :MakeSnowball
              | mov eax, -0c00
              | sub eax, var1
              | sar eax, 2
              | sub var2, eax
              | mov var1, -0c00
:MakeSnowBall | push 100
              | push 0
              | push 0
              | grab var2
              | push eax
              | grab var1
              | push eax
              | grab y-pos
              | push eax
              | grab x-pos
              | push eax
              | push 1A
              | CALL 0046EFD0
              | add esp, 20
              | push 1
              | push 2e
              | call 420640
              | add esp, 8
              | jmp :Frame
              | 
:STATE17      | SETPTR
              | inc framtimer
              | grab framtimer
              | and eax, 2
              | cmp eax, 0
              | je :RightJitter2
              | sub x-pos, 100
              | jmp :Frame
:RightJitter2 | add x-pos, 100
              | jmp :Frame
              | 
:STATE18      | SETPTR
              | xor eax, eax
              | mov y-vel, eax
              | mov x-vel, eax
              | mov y-pos, 1000000
              | mov x-pos, 1000000
              | 
              | 
:Frame        | SETPTR
              | xor eax, eax
              | cmp direction, 0
              | je :Left
              | add eax, 70
:Left         | mov uprect, eax
              | add eax, 70
              | mov downrect, eax
              | grab frame
              | imul eax, eax, 50
              | mov leftrect, eax
              | add eax, 50
              | mov rightrect, eax
              | add y-vel, 40
              | cmp y-vel, 800
              | jle :Gravity
              | mov y-vel, 800
:Gravity      | grab y-vel
              | add y-pos, eax
              | grab x-vel
              | add x-pos, eax
              | add ecx, 54
              | grab [ebp-10]
              | mov [ecx], eax
              | grab [ebp-c]
              | mov [ecx+4], eax
              | grab [ebp-8]
              | mov [ecx+8], eax
              | grab [ebp-4]
              | mov [ecx+c], eax
              | call 47a6a0
              | mov esp, ebp
              | pop ebp
              | retn
:switchst8    | 
              | print :STATE0
              | print :STATE1
              | print :STATE2
              | print :STATE3
              | print :STATE4
              | print :FRAME
              | print :FRAME
              | print :STATE7
              | print :STATE8
              | print :FRAME
              | print :FRAME
              | print :STATE11
              | print :STATE12
              | print :STATE13
              | print :FRAME
              | print :STATE15
              | print :STATE16
              | print :STATE17
              | print :STATE18
              |

One response to “Snowboss pseudo code

  1. Pingback: Giant Snowman | WTF Story progress & updates.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s