Ignore:
Timestamp:
Dec 11, 2009, 9:58:07 AM (15 years ago)
Author:
gumby
Message:

ZOMG FLATLINE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Daodan/src/Daodan_BSL.c

    r481 r484  
    77
    88#include "Daodan_BSL.h"
     9#include "Flatline_BSL.h"
    910#include "Daodan_Utility.h"
    1011#include "Daodan_Patch.h"
     
    1718#include "Daodan_Character.h"
    1819
     20
     21
    1922uint16_t ONICALL bsl_int32mul(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
    2023{
     
    5053        return 0;
    5154}
    52 
    5355uint16_t ONICALL bsl_div(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
    5456{
     
    218220        else index = args[0].value_int32;
    219221        Character* Chr = ONgGameState + 0x1260 ;
    220         int* health = (int)&Chr[index] + 0x144;
    221 
     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        */
    222235        ret->value_int32 = *health;
    223236        ret->type = sl_int32;
     
    743756{
    744757
    745         //const char regen_patch[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
    746         //DDrPatch_Const(OniExe + 0x0011BB6D, regen_patch);
    747        
    748         //This one should work but doesn't.
    749         //const char regen_patch[] ={0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x8B, 0x86, 0x44};
    750         //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);
    751770
    752771        SLrConfig();
     
    783802        SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf);
    784803       
    785         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);
    786        
    787         //SLrScript_Command_Register_ReturnType("d_offset", "a test", "thing:int", sl_int32, bsl_returnoffset);
     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        //Flatline
     807        SLrFlatline_Initialize();
     808
    788809}
    789810
Note: See TracChangeset for help on using the changeset viewer.