Fallout 2 mod FO2 Engine Tweaks (Sfall)

Discussion in 'Fallout General Modding' started by Dude101, Jul 30, 2007.

  1. Guest

    Guest First time out of the vault

    33
    Aug 3, 2007
    Offtopic, but ... you also need computer :D

     
  2. Per

    Per Vault Consort Staff Member Admin

    Apr 1, 2004
    See, this is why we disabled guest posting.
     
  3. Mario_Dweller

    Mario_Dweller It Wandered In From the Wastes

    153
    Apr 9, 2004
    Hi, I have troubles with set_perk_owed function. Some time ago I have tried it and it seemed to be OK, but...

    Here is code: (DUDE_OBJ.SSL)
    ~~~~~~~~~~~~~~~~~~~

    if (fixed_param == _perk_enable) then begin
    set_perk_owed(1);
    display_msg("new perk enabled");
    end else
    if (fixed_param == _perk_disable) then begin
    set_perk_owed(0);
    display_msg("new perk disabled");
    end

    set_perk_owed(1);
    display_msg("new perk enabled");
    --- this is OK

    set_perk_owed(0);
    display_msg("new perk disabled");
    --- this does not disable perk choose (btw enabled by engine before, NOT by set_perk_owed function):(

    -E-D-I-T- : It's because of engine. get_perk_owed function returns 1(if owed is set by engine)only after enter to CHAR window(PERK window showed). Is there some solution? Something like override_next_perk_owed :lol: :lol: ??

    And second trouble (GLOBAL.SSL)
    ~~~~~~~~~~~~~~~~~~~~~~

    set_critter_current_ap(dude_obj,get_critter_current_ap(dude_obj) + 1);

    --- Is syntax good ? Doesn't work for me either.

    BTW Thanx for Win9x version. I haven't tested it on W98 yet, but on XP works fine :twisted: :mrgreen:
     
  4. gracul

    gracul It Wandered In From the Wastes

    100
    Jun 6, 2007
    Hm, i've encountered a very strange bug with your latest 1.18b sfall.
    Whenever i press the speedmod key (CTRL - SpeedModKey=-1) i get a dxwin.exe error, running XP SP2.
    So, i checked if thats just something that happend to my computer, got an older ver of sfall, no crashes with speedmod key. Maybe you should look into it Timeslip?

    And also, i managed to bypass the bug by switching speedmodkey to 0, changing the default game speed to 10x and switching the SpeedToggleKey, to something on my numpad. Now whenever i was slow speed i just press 0 on my numpad and all is fine :)
     
  5. Sorrow

    Sorrow So Old I'm Losing Radiation Signs

    Feb 9, 2006
    Any chances for a Win9* version of Sfall for Fallout1?
     
  6. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    Not really anything to do with fallout then. :P

    Whatever it is, (DXWindower? I'd be mildly surprised if that worked with sfall at all, tbh...) is probably just trying to use the control key for something as well. That's not a bug; just change the controls for either sfall or whatever your crashing program is. (Since you've already changed sfall's controls, problem solved, I guess.)

    I'll make one once my exams are over.
     
  7. gracul

    gracul It Wandered In From the Wastes

    100
    Jun 6, 2007
    Well, any key i bind (-1 -2 -3 in .ini file) crashes the game instantly after i click it. And its a Fallout2 error, followed by a dxwin error. Like i said its not happening on older versions of ur sfall.
     
  8. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    Ah. If fallout is crashing too then that's different.

    Can you redownload and tell me if it's still doing it? I left a bit of debugging code in there that could have been the cause. :oops:
     
  9. gracul

    gracul It Wandered In From the Wastes

    100
    Jun 6, 2007
    Its working fine right now,
    Thanks :)
     
  10. Glovz

    Glovz Vault Dweller
    Modder

    736
    Sep 16, 2005
    @Timeslip

    I know you are busy with exams and fixing possible bugs in the dll; but if you get a chance (again this does not have to be right away), if you could find where the engine reads in a PID (Proto ID, prototype identifier) then I might be able to start experimenting with a way to changes values and ultimately introduce some balance. Or at the minimum create a very interesting mod.

    Sorry if this is a bother, but I have been working with a lot numbers theoretically and I would really like the chance to test them out. :obsessed:

    Again, thanks for all your help and the work you have done to expand and correct Fallout engines is tremendous!
     
  11. Alray

    Alray First time out of the vault

    50
    May 10, 2007
    About customizable encounter fix. In version 1.18b just find line:

    SafeWrite16(0x004c0668, 0x0005); //replaces cmp eax, 0x5dc with cmp eax, 0x5

    replace it with:

    SafeWrite16(0x004c0668, delay); //replaces cmp eax, 0x5dc with cmp eax, delay

    And put to WorldMapEncounterFix enother value. I think it must be 5, but if you think that encounters appear to often - put what you like

    WorldMapEncounterFix=8 (for example)
     
  12. Alray

    Alray First time out of the vault

    50
    May 10, 2007
    Timeslip

    By the way, do you know, that function GetTickCount has fallibility something about 10 ms? I have a lot of problems with worldmap patch when I used GetTickCount. I use TimeGetTime function for all time calculations. I saw GetTickCount in WorldMapSpeedPatch3 function in main.cpp

    Any ideas? You saw encounter fix. It can't work wrong... But people still have problems with encounters...
     
  13. Mr.Wolna

    Mr.Wolna Vault Senior Citizen

    Nov 15, 2007
    hey Mr.Timeslip can you make an ability to make new animations (for example AA for walk). Or is this imposibile?
     
  14. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    1.18e is up, for both fallout 1 and 2, and for both win xp and 9x. All that's new in the fallout 1 version is the upscaling filters and a fix for broken movies in dx9 mode.

    As long as the resolution is better than the length of one frame any error should average itself out, so a 10ms resolution should be sufficient for accurately measuring 100fps. :?

    That being said, on windows 9x the resolution is only 55ms, so something more accurate would be a good idea. I've switched to using the high performance counter when it's available.

    That looks fine, but when are you calling it? Remember that it will only have any effect if it is the players turn in combat. Also the graphics don't update until you spend some ap, so the ap bar will be incorrect.
     
  15. Sorrow

    Sorrow So Old I'm Losing Radiation Signs

    Feb 9, 2006
    Thanks :) . It's nice to play Fallout in a decent resolution :) .
     
  16. Mario_Dweller

    Mario_Dweller It Wandered In From the Wastes

    153
    Apr 9, 2004
    OK. I will test it once again :P
     
  17. Glovz

    Glovz Vault Dweller
    Modder

    736
    Sep 16, 2005
    @Timeslip

    I have made some tweaks to the damage calculation mod, could you replace the current version with this:
    Code:
    bJmp:
    MOV EDX,DWORD PTR DS:[ESI+4] ; start of damage loop
    MOV EAX,DWORD PTR DS:[ESI] ;
    MOV EBX,DWORD PTR SS:[ESP+18] ;
    CALL fallout2.00478448 ;
    ADD EBX,EAX ; raw damage
    
    SUB EBX,DWORD PTR SS:[ESP+28] ; damage minus threshold
    
    TEST EBX,EBX ;
    JLE SHORT nJmp ; no damage
    
    CMP DWORD PTR SS:[ESP+2C],64 ;
    JL SHORT vJmp ;
    
    MOV EAX,0 ; adjustor equals zero
    JMP SHORT nJmp ;
    
    vJmp:
    CMP DWORD PTR SS:[ESP+2C],0 ;
    JLE SHORT wJmp ;
    
    MOV EAX,64 ;
    SUB EAX,DWORD PTR SS:[ESP+2C] ;
    JMP SHORT mJmp ;
    
    wJmp:
    MOV EAX,64 ; adjustor equals one hundred
    
    mJmp:
    IMUL EBX,EAX ; damage multiplied by adjustor
    IMUL EBX,DWORD PTR SS:[ESP+20] ; damage multiplied by the difficulty setting 
    IMUL EBX,DWORD PTR SS:[ESP+24] ; damage multiplied by damage multiplier
    SAR EBX,1 ;
    MOV DWORD PTR SS:[ESP+30],64 ;
    MOV EDX,EBX ;
    MOV EAX,EBX ;
    SAR EDX,1F ;
    IDIV DWORD PTR SS:[ESP+30] ; damage divided by one hundred
    MOV EBX,EAX ; assign new damage value
    MOV EDX,EBX ;
    MOV EAX,EBX ;
    SAR EDX,1F ;
    IDIV DWORD PTR SS:[ESP+30] ; damage divided by one hundred
    MOV EBX,EAX ; assign new damage value
    
    TEST EBP,EBP ;
    JLE SHORT aJmp ; add damage
    
    MOV EDX,EBX ;
    MOV EAX,EBX ;
    SAR EDX,1F ;
    IDIV EBP ; damage divided by the damage divisor
    MOV EBX,EAX ; assign new damage value
    
    CMP DWORD PTR SS:[ESP+24],4 ;
    JG SHORT aJmp ; add damage
    JE SHORT zJmp ; JHP ammo damage decrease
    
    CMP EBP,2 ;
    JNZ SHORT aJmp ; add damage
    
    CMP DWORD PTR SS:[ESP+28],4 ;
    JGE SHORT xJmp ; AP ammo damage increase
    JL SHORT yJmp ; AP ammo damage decrease
    
    xJmp:
    IMUL EAX,3 ; multiple damage by three
    SAR EAX,1 ; divide damage by two
    ADD EBX,EAX ; add result to previous damage value
    JMP SHORT aJmp ; add damage
    
    yJmp:
    SAR EAX,1 ; divide damage by two
    ADD EBX,EAX ; add result to previous damage value
    JMP SHORT aJmp ; add damage
    
    zJmp:
    CMP EBP,1 ;
    JNZ SHORT aJmp ; add damage
    
    CMP DWORD PTR SS:[ESP+28],4 ;
    JGE SHORT cJmp ;
    
    IMUL EAX,0D ; multiple damage by thirteen
    SAR EAX,6 ; divide damage by sixty-four
    SUB EBX,EAX ; subtract result from previous damage value
    JMP SHORT aJmp ; add damage
    
    cJmp:
    SAR EAX,2 ; divide damage by four
    SUB EBX,EAX ; subtract result from previous damage value
    
    aJmp:
    ADD DWORD PTR DS:[EDI],EBX ; accumulate damage
    
    nJmp:
    MOV EAX,DWORD PTR SS:[ESP+1C] ; no damage
    INC ECX ;
    CMP ECX,EAX ;
    JL SHORT bJmp ; loop back to beginning
    Thanks!
     
  18. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    OK, I've been able to fix that, but it has an interesting side effect in that it lets you store up multiple perks. That means that if you don't want a perk at level 6, you could wait till level 9 and then pick 2. Anyone have any opinions on whether that counts as a cheat? I'll probably default it to on, but leave an option in to turn it off. Also get_perk_owed and set_perk_owed will start returning/accepting numbers bigger than 1.

    Edit: @Glovz
    You can write your code in C if you think it's easier. Only the glue code needs to be in asm. Look at the knockback code for an example that does a similar thing:
    Code:
    static DWORD _stdcall CalcKnockback(int flags, int damage,DWORD target,DWORD attacker,DWORD weapon) {
    	double result=(double)damage/(flags==0x3d?5.0:10.0);
    	result=ApplyModifiers(&mWeapons, weapon, result);
    	result=ApplyModifiers(&mAttackers, attacker, result);
    	result=ApplyModifiers(&mTargets, target, result);
    	return (DWORD)floor(result);
    }
    static const DWORD KnockbackRetAddr=0x00424B85;
    static void _declspec(naked) KnockbackHook() {
    	_asm {
    		mov ecx, [esp+0x14];
    		push ebx;
    		mov ebx, [esi+8];
    		push ebx;	//Weapon
    		mov ebx, [esi];
    		push ebx;	//Attacker
    		push ecx;	//target
    		mov edi, [edi];
    		push edi;	//Damage
    		push eax;	//Weapon flags
    		call CalcKnockback;
    		pop ebx;
    		mov ecx, [esp+0x10];
    		mov [ecx], eax;
    		jmp KnockbackRetAddr;
    	}
    }
     
  19. Glovz

    Glovz Vault Dweller
    Modder

    736
    Sep 16, 2005
    @Timeslip
    Currently I am more comfortable with Assembly, but I will think about dusting off my rusty C skills. ;)

    As well, I cannot go much farther in my efforts without knowing where the engine reads in .pro information.

    I have already planned out 85% of the changes I want regarding armor and ammo stats to bring further balance to the game; I am looking at weapons currently.

    Any help you can provide towards this effort would be greatly appreciated.
     
  20. Timeslip

    Timeslip Water Chip? Been There, Done That
    Modder

    921
    Aug 15, 2007
    1.19 is up. The only changes are the perk fix (no-one commented, so it's now on all the time as long as the extra script function are enabled, so anyone using get_perk_owed doesn't have to worry about putting up with 2 different behaviours,) and the updated ammo patch.

    Let me know whether or not it works. :)

    More comfortable with asm than C? :shock:

    How are you testing this then? If the new code block is too big to fit on top of what your replacing, modifying and recompiling sfall should be pretty much the only way to do it. Do you have some other way of overwriting that code block?