ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/src/Daodan_BSL.c
(Generate patch)

Comparing Daodan/src/Daodan_BSL.c (file contents):
Revision 483 by gumby, Sun Nov 15 02:13:50 2009 UTC vs.
Revision 484 by gumby, Fri Dec 11 08:58:07 2009 UTC

# Line 6 | Line 6
6   #include "inifile.h"
7  
8   #include "Daodan_BSL.h"
9 + #include "Flatline_BSL.h"
10   #include "Daodan_Utility.h"
11   #include "Daodan_Patch.h"
12   #include "Daodan_Console.h"
# Line 16 | Line 17
17   #include "dSFMT\dSFMT.h"
18   #include "Daodan_Character.h"
19  
20 +
21 +
22   uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
23   {
24          ret->value_int32 = args[0].value_int32 * args[1].value_int32;
# Line 49 | Line 52 | uint16_t ONICALL bsl_int32div(sl_callinf
52          ret->type = sl_int32;
53          return 0;
54   }
52
55   uint16_t ONICALL bsl_div(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
56   {
57          double val1;
# Line 217 | Line 219 | uint16_t ONICALL bsl_regen(sl_callinfo*
219          else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32);
220          else index = args[0].value_int32;
221          Character* Chr = ONgGameState + 0x1260 ;
222 <        int* health = (int)&Chr[index] + 0x144;
223 <
222 >        int* health = (int*)Chr[index].ScriptNoPath;
223 >        
224 >        /*
225 >        DDrConsole_PrintF("Character %s", Chr[index].Name);
226 >        DDrConsole_PrintF("Spawn %s", Chr[index].ScriptSpawn);
227 >        DDrConsole_PrintF("Death %s", Chr[index].ScriptDie);
228 >        DDrConsole_PrintF("Aware %s", Chr[index].ScriptAware);
229 >        DDrConsole_PrintF("Alarm %s", Chr[index].ScriptAlarm);
230 >        DDrConsole_PrintF("Hurt %s", Chr[index].ScriptHurt);
231 >        DDrConsole_PrintF("Defeat %s", Chr[index].ScriptDefeat);
232 >        DDrConsole_PrintF("NoAmmo %s", Chr[index].ScriptNoAmmo);
233 >        DDrConsole_PrintF("NoPath %s", Chr[index].ScriptNoPath);
234 >        */
235          ret->value_int32 = *health;
236          ret->type = sl_int32;
237  
# Line 742 | Line 755 | void SLrConfig()
755   void SLrDaodan_Initalize()
756   {
757  
758 <        //const char regen_patch[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
759 <        //DDrPatch_Const(OniExe + 0x0011BB6D, regen_patch);
760 <        
761 <        //This one should work but doesn't.
762 <        //const char regen_patch[] ={0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x8B, 0x86, 0x44};
763 <        //DDrPatch_Const(OniExe + 0x0011BB64, regen_patch);
758 >
759 >        //Calculating the value of the needed offset is much more reliable when the compiler does it for you.
760 >
761 >        //TODO: fix moonshadow.
762 >        Character * Chr = 0;
763 >        char NoPath = (char)(0x100 - (int)(Chr->ScriptNoPath));
764 >        const char regen_patch[] =
765 >                {0x90, 0x90, 0x90, 0x90, 0x90,  // mov     al, _WPgRegenerationCheat
766 >                0x90, 0x90,                                             // test    al, al
767 >                0x90, 0x90,                                             // jz      short loc_51BB98
768 >                0x8B, 0x86, NoPath};    
769 >        DDrPatch_Const(OniExe + 0x0011BB64, regen_patch);
770  
771          SLrConfig();
772  
# Line 782 | Line 801 | void SLrDaodan_Initalize()
801  
802          SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf);
803          
804 <        SLrScript_Command_Register_ReturnType("d_dprint", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored);
804 >        SLrScript_Command_Register_ReturnType("st", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored);
805          
806 <        //SLrScript_Command_Register_ReturnType("d_offset", "a test", "thing:int", sl_int32, bsl_returnoffset);
806 >        //Flatline
807 >        SLrFlatline_Initialize();
808 >
809   }
810  
811   void SLrDaodan_Patch()

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)