Comments (10)
Fix #10 implement free shooting
from gothicfreeaim.
Constrain this issue to rotation and free shooting.
from gothicfreeaim.
Free rotation is implemented.
Separately for runes and scrolls, oCMag_Book::Spell_Cast
calls oCSpell::Setup
. This function performs a check on oCSpell.targetCollectAlgo
and then presumably (?) calls oCVisualFX::Init
(0x491F20). This, in turn, sets up the trajectory of the spell fx according to the passed target vob.
Finding out where best to manipulate this target vob is the next step.
from gothicfreeaim.
The address to inject the aim vob at should be in this engine function.
0x4861D0 int __thiscall oCSpell::IsValidTarget(zCVob*)
In that function, the target vob is validated. This entails checking if its type matches oCSpell.targetCollectType
and if it is in line of sight.
An appropriate address to hook within this function is after both checks are performed to overwrite the return value as well as the vob itself (to the aim vob). This will set the aim vob as focus vob for the spell and have it always valid, even when out of line of sight.
Allow free aiming only for spells whose property targetCollectAlgo
is one of the following.
TARGET_COLLECT_NONE
TARGET_COLLECT_FOCUS_FALLBACK_NONE
from gothicfreeaim.
Pick up the work on free aim for spells.
from gothicfreeaim.
Update issue details to generalize to free aim for spells.
from gothicfreeaim.
At the moment, work is focused on finalizing and stabilizing free aiming. After it has been solved for ranged combat (bow and crossbow), the work on blink and spells in general will be picked up again.
from gothicfreeaim.
It might even be a nice idea to create a distributor like Spell_ProcessMana
. Spell_ProcessMana
calls the respective Spell_Logic_*
function of each spell. The function to hook oCSpell::Setup
could be just like that calling each (the spells that are actually entered there) spell's Spell_Invest_*
function. This would offer additional control over spells with this general structure:
instance Spell_Name () // Settings
func int Spell_Logic_Name(var int manaInvested) // Previous invest loop (as before: trigger FX-levels and timed events)
func void Spell_Invest_Name() // NEW (for frame-based operations like aiming; only necessary for certain invest spells of course)
func void Spell_Cast_Name(var int spellLevel) // Cast function (as before: decrease mana, cast the spell if it is not an invest spell)
Analogous to Spell_ProcessMana
:
const int oCSpell__Setup = 4737328; //0x484930
HookEngineF(oCSpell__Setup, 7, Spell_ProcessInvest);
func void Spell_ProcessInvest(/* Is it possible to ask for arguments here? */) {
// Get self and other (or item)
self = _@(MEM_ReadInt(ESP+4)); // Self is a global instance (Classes.d) and will stay set in the functions below
var int targetPtr; targetPtr = MEM_ReadInt(ESP+8);
if (Hlp_Is_oCNpc(targetPtr)) { other = _@(targetPtr); } // Other is a global instance (Classes.d) and will stay set in the functions below
else if (Hlp_Is_oCItem(targetPtr)) { item = _@(targetPtr); }; // Item is a global instance (Classes.d) and will stay set in the functions below
// From here on it's the usual (like in Spell_ProcessMana and Spell_ProcessManaRelease)
var int activeSpell; activeSpell = Npc_GetActiveSpell(self); // Could also be retrieved with ESP+12 but this looks more familiar
// ...
if (activeSpell == SPL_Blink) { Spell_Invest_Blink(); return; };
// ...
// Spells that don't need to hook the function should just not be listed here. Same as in Spell_ProcessManaRelease.
};
func void Spell_Invest_Blink() {
if (!Npc_IsPlayer(self)) { return; }; // Only player is allowed to use this spell anyway
// ...
var int ptr; ptr = ESP+8; // Not sure about the offset here
MEM_WriteInt(ptr, vobPtr); // The variable vobPtr points to the aim vob
};
from gothicfreeaim.
If this works, it is probably not even necessary to create the aim vob as oCItem.
from gothicfreeaim.
One likely solution might be to change the hook. Hook this function instead (or additionally) to unconditionally change the target vob:
const int oCSpell__Setup = 4737328; //0x484930
HookEngineF(oCSpell__Setup, 7, Spell_Invest_Blink);
func void Spell_Invest_Blink() {
// ...
var int ptr; ptr = ESP+8; // Not sure about the offset here
MEM_WriteInt(ptr, vobPtr); // The variable vobPtr points to the aim vob
};
from gothicfreeaim.
Related Issues (20)
- Update project architecture diagram
- Finish wiki
- Decrease fine scattering angle HOT 1
- Decrease secondary modulation of accuracy HOT 1
- Crash on loading related to oCNpc::SetBodyState HOT 2
- Projectiles are not destroyed when reuse-feature is disabled in Gothic 1
- Simplify categorizing spells for drawing reticle in config
- Remove debugging visualizations (Draw3D) from default initialization
- Low FPS prevent aiming with crossbow T2 stance
- Crash when initializing GFA_SPELLS without GFA_STRAFING
- Focus mode is wrong when loading game in fight mode HOT 1
- Display reticle in virtual coordinates HOT 1
- Move "no focus no aim" to INI
- [Returning 2.0] Game crashes after intros while using Ninja GFA patch HOT 2
- Provide projectile pointer to config function HOT 1
- Add safety checks for common fixes HOT 1
- ITEM_FOCUS HOT 1
- New idea - free hiting
- [Gothic Multiplayer] AimRay intersection with player's camera bbox HOT 4
- [Singleplayer] FPS Drops / [Multiplayer] Not able to connect HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gothicfreeaim.