OpenXcom Forum
Contributions => Programming => Topic started by: Phezzan on June 30, 2013, 07:39:30 pm
-
There is no 'REAR' on the front tile of a tank.
Edit: Fixed a crash if we hit a unit that doesn't exist.
Details:
BUG:
A large unit takes up four tiles, but a hit calculates
the position hit on a single tile and BattleUnit::damage assumes
that each tile has every side, which is not true for a large unit.
FIX:
Calculate the relative direction of the hit and then
classify it as one of 8 cardinal directions.
Then rotate it according to unit.direction.
Since direction is relative to the center of the unit instead of the tile,
large units work fine.
Notes:
I think I might have gotten the Z calculation correct for body parts.
I'm still terrible at using git and making patches.
-
yeah i prefer pull requests, especially since i can easily see if they've been updated.
-
I'll be reading some more git tutorials then ;D
Currently I work in a branch (local/Kmod -> origin/Kmod)
master is untouched so that... well I'm not sure why...
Anyway, I need to learn the magic sauce for smoothly applying a modded branch's commit to a fresh remote branch.
git is interesting.
On a somewhat separate topic, is anyone working on the AI, and if not, can anyone explain the basic design?
It's been a long time since college, but if I can make them a bit more aggressive (and pick up weapons after they wake up) I'll be very pleased with myself.
-
The not-picking-up-weapons is a deliberate compromise, as this is original game behaviour.
However, it actually only needs a change to some data values in the ruleset to make this happen. I've attached a ruleset I made that does this, although of course you'll need to remove the extra .txt extension, as the board currently doesn't allow you to attach .rul files.
-
i can explain to you in detail how the AI works, but it'd be a long document, save me some typing and ask some more direct questions ;)
-
ok - but I'll do that in a proper thread.
Thanks 54x - your dataFile got me looking in the right direction...
I merged it with my own, but either I made a mistake or it wasn't very proactive.
So I grepped 'attractive' until I found the right functions in BattlescapeGame.cpp.
Then I had to take some remedial C++ as I broke it.
I learned the best way to modify a vector item by item is:
create a vector as a local
push in the stuff you want to keep (Chryssalid Weapon, etc)
swap with _inventory when you're done.
Other solutions tend to be crashtastic !
Regardless, I now have Chryssalids waking up and killing me, along with panicking leaders and anything that wasn't properly slaughtered.
(I modded in regeneration, and increased the bonus stun damage - waking up is pretty common for Chryssalids)