Bombchu Link's Open source Mods!

Apr 10, 2017 at 5:30 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 31
It's still a sort of a waste of space... Well since we got PEONS it's fine I guess
Wasted space != more optimized.

A lot of the "garbage" you can clean up is actually just the compiler making proper use of the processor pipeline to speed things up.
 
Apr 10, 2017 at 9:35 AM
Catz R cool
Modding Community Discord Moderator
"..."
Join Date: Nov 23, 2015
Location: Somewhere within a world far away from reality...
Posts: 381
Age: 23
Apr 29, 2017 at 1:41 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
an npc spawner

<ANP----:XXXX:YYYY

XXXX is the entity ID and YYYY is the frames between spawn time

also stops spawning when you die

E: Having the scriptstate set to 0 makes it spawn nothing so it won't fill up your map with null entities.

Code:
offset NPC100


push ebp                
mov ebp, esp
setpointer

///are we dead?
mov al, playerFlags    
//If player dead stop attacking, AL is just a smaller EAX that holds only FF (255 dec) bytes of space like the player flags is only FF big, if you put EAX into it it would be all messed up when comparing it to anything
test al, al              //compare to 0 but saves space
je :end_of_code          //don't spawn anything if you're ded

cmp npc.scriptstate, 0   //is <ANP 0 ?
je :end_of_code          // if it is, jump to "end_of_code" (JE stands for Jump if Equal)

mov edx npc.direction    //MOVe into EDX, the npc's direction
cmp npc.frametimer edx   //CoMPare the frametimer to EDX
jg :create_npc           // if it is higher than the npc's direction then create an npc.

inc npc.frametimer       //INCrease the frametimer
jmp :end_of_code         //jump to the end of the code to advance another frame

:create_npc
//now we start PUSHing values onto the stack so we can CALL the NPC_create function

xor eax, eax               //makes EAX 0 but takes less bytes than "mov eax, 0"
mov npc.frametimer, eax    //reset the frametimer
push 100                   //Only 200 (hex) entitys can be placed on the map, it starts checking for an open slot from the pushed number
push eax                   //Parent value (a variable that is handed to the "child" NPC, unused here
push eax                   //NPC's direction, also 0
push eax                   //YVelocity, also 0
push eax                   //Xvelocity, ditto
mov ebx npc.Y              //MOVe the NPC's Y position to EBX
push ebx                   //Child NPC spawn at parent NPC's Y position
mov ebx npc.X          
push ebx                   //repeat for the X position
mov eax npc.scriptstate    //MOVe into eax, the <ANP number
push eax                   //the NPC's ID number in hex (example: 42 dec 2A hex would create Sue)
call 46efd0                //create npc function
add esp,20                 //resets the stack, each PUSH offsets it by 0x4, and we had 8 PUSHes, and 0x4 X 0x8 = 20 so add esp, 20

//if we had more code here other than end_of_code we would have to reset our pointer after CALLing a function using "setpointer"

:end_of_code
mov esp, ebp
pop ebp
retn

It's heavily commentated because I wrote it up for Enlight to help him maybe get into ASM


Also have some falling blocks because reasons
Works identical to vanilla (almost?) but it has 4 sprites that animate instead of 1 that's static

also each sprite is lower than the last instead of farther to the right because of how my spritesheet was arranged.
Code:
offset NPC279

#define
L_framerect_distance = B3
U_framerect_distance = 0

sprite_width         = 20
sprite_heigth        = 20
maxfallspeed         = 2000
fallaccel            = 20
maxframes            = 4
#enddefine

push ebp                
mov ebp, esp
setpointer
add npc.moveY, fallaccel
cmp npc.moveY maxfallspeed
jl :speed_fall_ok
mov npc.moveX maxfallspeed
:speed_fall_ok
cmp npc.scriptstate, 1
je :solid
cmp npc.scriptstate, 2
je :render
mov npc.flags, 8 // ignore solid
inc npc.scripttimer
cmp npc.scripttimer 13
jl :render
mov npc.scriptstate, 1
mov npc.flags, 0
jmp :render

:solid
mov edx, npc.collision       ;see if we are still in the air
and edx, 8
je :render
//hit floor
mov npc.scriptstate, 2
mov npc.moveY, -200
mov npc.flags, 8 // ignore solid
mov [49E1DC] 10 //soft quake duration
//create smoke

xor eax, eax            
push 100                
push eax                   //Parent value (a variable that is handed to the "child" NPC, unused here
push eax                   //NPC's direction, also 0
push eax                   //YVelocity, also 0
push eax                   //Xvelocity, ditto
mov ebx npc.Y              //MOVe the NPC's Y position to EBX
push ebx                   //Child NPC spawn at parent NPC's Y position
mov ebx npc.X          
push ebx                   //repeat for the X position
push 4                     //the NPC's ID number in hex (example: 42 dec 2A hex would create Sue)
call 46efd0                //create npc function
add esp,20
setpointer



:render
mov eax npc.moveY
add npc.Y, eax
inc npc.frametimer
cmp npc.frametimer, 5
jl :cont_render
mov npc.frametimer, 0
inc npc.framenum
cmp npc.framenum, maxframes
jl :cont_render
mov npc.framenum, 0
:cont_render
xor eax, eax                            
mov eax,npc.framenum                
imul al, al, sprite_heigth
mov npc.DisplayU,eax                  
add eax, sprite_heigth                      
mov npc.displayD,eax
mov eax, L_framerect_distance    
mov npc.displayL,eax                
add eax, sprite_heigth                      
mov npc.displayR,eax
:end_of_code
mov esp, ebp
pop ebp
retn
 
May 8, 2017 at 4:31 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
I remade the mini balrogs from CS beta as seen at the beginning of this video.


Code:
offset NPC---

#define
L_framerect_distance = 60
U_framerect_distance = 20

sprite_width         = 10
sprite_height        = 10

Walk_speed           = 100
gravity              = 30
jumpvel              = 300

max_walk_time        = 80
min_walk_time        = 3

#enddefine

push ebp                  
mov ebp, esp  
setpointer
mov eax, npc.scriptstate
jmp [eax*4+:StateTable]


//----------------------------------------

:State_direction
push 1
push 0
call random
add esp,8
setpointer
cmp eax, 0
je :set_dir_0
mov npc.direction, 2
jmp :dir_set_stand
:set_dir_0
mov npc.direction, 0
:dir_set_stand
jmp :State_decide

//----------------------------------------

:State_walk
mov npc.scriptstate, 1
add npc.moveY, gravity
inc npc.frametimer
cmp npc.frametimer, 5
jl :Walk_frame_set
mov npc.frametimer, 0
cmp npc.framenum, 0
je :set_frame_walk_1
mov npc.framenum, 0
jmp :decide_walk_time
:set_frame_walk_1
mov npc.framenum, 1
:Walk_frame_set

cmp npc.direction, 2
je :move_right_walk
mov npc.moveX, -Walk_speed
jmp :move_walk_set
:move_right_walk
mov npc.moveX, Walk_speed
:move_walk_set

:decide_walk_time
cmp npc.directive, 1
je :time_set_walk
push max_walk_time
push min_walk_time
call random
add esp, 8
setpointer
mov npc.objecttimer, eax
:time_set_walk
mov eax, npc.objecttimer
inc npc.scripttimer
cmp eax, npc.scripttimer
jge :render
jl :state_decide



//----------------------------------------

:State_Jump_prep
mov npc.moveY, -jumpvel
:State_Jump
mov npc.scriptstate, 2
mov npc.framenum, 2
jl :render
mov edx, npc.collision
and edx, 8
jne :hit_floor
add npc.moveY, gravity
jmp :render
:hit_floor
mov npc.moveY, 0
jmp :state_decide


//----------------------------------------

:State_decide
xor eax, eax   //reset values
mov npc.scripttimer, eax
mov npc.frametimer, eax
mov npc.framenum, eax
mov npc.objecttimer, eax
mov npc.directive, eax
push 12
push 0
call random
add esp, 8
setpointer
cmp eax, 5
jl :State_direction
cmp eax, 11
jl :State_walk
jmp :State_Jump_prep

//----------------------




:render
mov eax, npc.moveX
mov edx, npc.moveY
add npc.X eax
add npc.Y edx

xor eax, eax
mov eax,npc.framenum
imul al, al, sprite_width
add eax, L_framerect_distance  
mov npc.DisplayL,eax
add eax, sprite_width
mov npc.displayR,eax

mov eax, U_framerect_distance
cmp npc.direction, 2
jne :render_left
add eax sprite_height
:render_left
mov npc.displayU,eax
add eax,sprite_height
mov npc.displayD,eax


:end_of_code
mov esp, ebp
pop ebp
retn


:StateTable
print :State_direction  
print :State_Walk
print :State_Jump
 
Jun 25, 2017 at 5:53 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
Hey guys, have you ever like, wanted to use the money system in CS beta?

https://www.dropbox.com/s/k46by2skum091ad/BUY TSC.zip?dl=0

Everything you need to know is in the description text thing in the zip.

E: whoops now it works with save files and the TSC command doesn't crash the game anymore
 
Last edited:
Jul 19, 2017 at 1:18 AM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
Foreground water while still having the background! (never set map bk to 3, it doesn't do anything anymore k thanks)

Code:
0x402830
55 8B EC 83 EC 44 C7 45 C8 04 01 00 00 C7 45 CC 80
00 00 00 C7 45 D0 24 01 00 00 C7 45 D4 90 00 00 00
C7 45 D8 04 01 00 00 C7 45 DC 90 00 00 00 C7 45 E0
24 01 00 00 C7 45 E4 B0 00 00 00 A1 88 9C 49 00 89
45 BC 83 7D BC 03 74 05 90 90 90 90 90 8B 45 08 99
81 E2 FF 3F 00 00 03 C2 C1 F8 0E 89 45 EC 8B 4D EC
83 C1 0B 89 4D F0 C7 45 FC 00 00 00 00 8B 55 FC 83
C2 20 89 55 C4 8B 45 FC 89 45 F8 EB 09 8B 4D F8 83
C1 01 89 4D F8 8B 55 F8 3B 55 C4 0F 8D DB 00 00 00
8B 45 F8 C1 E0 05 C1 E0 09 99 81 E2 FF 01 00 00 03
C2 8B C8 C1 F9 09 8B 45 0C 99 81 E2 FF 01 00 00 03
C2 C1 F8 09 2B C8 A1 90 9C 49 00 99 81 E2 FF 01 00
00 03 C2 C1 F8 09 03 C8 89 4D E8 83 7D E8 E0 7D 02
EB A5 81 7D E8 F0 00 00 00 7E 05 E9 87 00 00 00 8B
55 EC 89 55 F4 EB 09 8B 45 F4 83 C0 01 89 45 F4 8B
4D F4 3B 4D F0 7D 69 8B 45 F4 C1 E0 05 C1 E0 09 99
81 E2 FF 01 00 00 03 C2 8B C8 C1 F9 09 8B 45 08 99
81 E2 FF 01 00 00 03 C2 C1 F8 09 2B C8 89 4D C0 6A
11 8D 55 D8 52 8B 45 E8 50 8B 4D C0 51 68 1C F9 48
00 E8 47 9A 00 00 83 C4 14 83 7D F8 00 75 1B 6A 11

Bullet.bmp


the sprite is now in bullet.bmp and it's in the lower right section.

The only problem with this hack is you can only use one colour of water now.
 
Aug 2, 2017 at 4:45 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Jun 22, 2015
Location:
Posts: 35
Aug 2, 2017 at 9:25 PM
The TideWalker
Modding Community Discord Founder
"That dog!"
Join Date: Apr 5, 2013
Location: In my mind and of my body.
Posts: 1640
Age: 26
If you don't have the version of Doukutsu assembler with the new EDI defines then it might crash. (last updated 7/02/17)

https://cdn.discordapp.com/attachme...70945/Doukutsu_Assembler_1.31_EDI_defines.zip

Here try using it on this and if it doesn't work then maybe you aren't applying the patches in the correct order.

Also Andy I know your reading this so can this be the new default one on the tribute site now? every hack in the CSMC (aka all the hacks) are based off this version and it's 99% compatible with all previous DouA hacks (you just have to change your custom defines in each hack to edi instead of ecx in SOME hacks not all and it takes like 10 seconds max)
 
Top