Portal-Zone Gothic-Zone Gothic II-Zone Gothic 3-Zone Gothic 4-Zone Modifikationen-Zone Download-Zone Foren-Zone RPG-Zone Almanach-Zone Spirit of Gothic

 

Ergebnis 1 bis 5 von 5
  1. Beiträge anzeigen #1 Zitieren
    Waldläufer Avatar von Siemekk
    Registriert seit
    May 2016
    Beiträge
    121
     
    Siemekk ist offline

    Disable keyWeapon handle event

    Hello
    I have a little problem, I must turn off game key [keyWeapon]-> default KEY_SPACE. But i don't know where is this saved... I didn't found in oCGame::HandleEvent, CGameManager::HandleEvent. So where is this saved? Any ideas? (And no - i can't remove this key from .ini :/ )

  2. Beiträge anzeigen #2 Zitieren
    Ehrengarde Avatar von mud-freak
    Registriert seit
    Dec 2005
    Beiträge
    2.199
     
    mud-freak ist offline
    Response to the weapon change key is inside in the PC AI-"loop". The function responsible is oCAIHuman::PC_WeaponMove (0x69A0E0) which is called from oCAIHuman::_WalkCycle (0x69AE20) at 0x69AECB with an integer parameter indicating whether the weapon change key (ID 8, default: space bar) was pressed.

    To prevent this action you can either disable the function oCAIHuman::PC_WeaponMove (set the first five bytes to "33 C0 C2 04 00" == return 0), or by setting the function argument to zero inside of oCAIHuman::_WalkCycle at the above address.

    Note, however, that this only affects the weapon change key itself (space bar) not the number keys for switching weapons.

  3. Beiträge anzeigen #3 Zitieren
    Waldläufer Avatar von Siemekk
    Registriert seit
    May 2016
    Beiträge
    121
     
    Siemekk ist offline
    I don't know if turned off engine function is good way (PC_WeaponMove ). I can't use MemoryProtectionOverride because full code is created in AST. But ok, i turn off function, and i see very stupid behavior - if player is in inventory and I press key space, player draw weapon...
    I need only for space (keyWeapon) because for keys 0-9 it's work.

  4. Beiträge anzeigen #4 Zitieren
    Ehrengarde Avatar von mud-freak
    Registriert seit
    Dec 2005
    Beiträge
    2.199
     
    mud-freak ist offline
    Zitat Zitat von Siemekk Beitrag anzeigen
    But ok, i turn off function, and i see very stupid behavior - if player is in inventory and I press key space, player draw weapon...
    I need only for space (keyWeapon) because for keys 0-9 it's work.
    I wouldn't call this stupid behavior, it's normal. We just missed a special case where you can draw the weapon from inventory. You can just disable that as well by overwriting two bytes at 0x70F25B with "90 E8" (in oCNpcInventory::HandleEvent).

    Disabling the key itself is a bit more tricky, because there are several ways the engine checks whether a key is pressed (zCInput_Win32::GetState, zCInput_Win32::GetToggled, ...). You would have to identify all of the functions in question, go into them and have them return false everytime the key ID 8 is passed as an argument.

  5. Beiträge anzeigen #5 Zitieren
    Waldläufer Avatar von Siemekk
    Registriert seit
    May 2016
    Beiträge
    121
     
    Siemekk ist offline
    Big thanks Now it's work well.
    Code:
    int __fastcall Inv_HandleEvent(oCNpcInventory* _this, void*, int key);
    CInvoke<int(__thiscall*)(oCNpcInventory*, int)>    pInvHandleEvent    (0x0070E040, Inv_HandleEvent,    IVK_AUTO);
    int __fastcall Inv_HandleEvent(oCNpcInventory* _this, void*, int key)
    {
        if(zinput->GetFirstBindedLogicalKey(key) == zLOGICKEY_WEAPON) return NULL;
        return pInvHandleEvent(_this, key);
    }

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
Impressum | Link Us | intern
World of Gothic © by World of Gothic Team
Gothic, Gothic 2 & Gothic 3 are © by Piranha Bytes & Egmont Interactive & JoWooD Productions AG, all rights reserved worldwide