mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
Compare commits
50
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0813c85c76 | ||
|
|
eaa53b3e8e | ||
|
|
39bcb9875d | ||
|
|
9097c2e76d | ||
|
|
50db3587e4 | ||
|
|
9e5a440895 | ||
|
|
61ca374c03 | ||
|
|
8f2b3a10dd | ||
|
|
bbc4f44845 | ||
|
|
5367eba4f2 | ||
|
|
2d617883d3 | ||
|
|
34f666fe55 | ||
|
|
5ae46be317 | ||
|
|
a4f9d7b940 | ||
|
|
251656e15b | ||
|
|
e1a8dc7adc | ||
|
|
ca029b3412 | ||
|
|
70c3035cde | ||
|
|
57b6b0caed | ||
|
|
37ec7b1874 | ||
|
|
2395a6da3f | ||
|
|
7338c2f428 | ||
|
|
2e2655ee1a | ||
|
|
43c633bb89 | ||
|
|
d5b4486d6e | ||
|
|
590b832ba7 | ||
|
|
cc7d9ed866 | ||
|
|
8ad2cb7e2e | ||
|
|
e638c4cf0d | ||
|
|
2f40ce663c | ||
|
|
7b1a99a706 | ||
|
|
398c7adb9a | ||
|
|
424f2ffecc | ||
|
|
d4c4022f55 | ||
|
|
1d0212ef5a | ||
|
|
c7417bb7e5 | ||
|
|
4d05fc1c4a | ||
|
|
aa70a28509 | ||
|
|
49471a6154 | ||
|
|
1b65466d44 | ||
|
|
aed6c37c67 | ||
|
|
1d48fb35b2 | ||
|
|
bdb4feedf9 | ||
|
|
503695cd4d | ||
|
|
4dfc7538db | ||
|
|
8ad0067510 | ||
|
|
894d9aab52 | ||
|
|
043b43d04b | ||
|
|
144b3beb79 | ||
|
|
30bbb3702a |
@@ -43,8 +43,7 @@ jobs:
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ololoken/fallout2-ce-ems
|
||||
ref: 0764f9fdd0abf27bd9b0d3997ca0a8e61f380058
|
||||
repository: fallout2-ce/fallout2-ce-ems
|
||||
path: fallout2-ce-ems
|
||||
|
||||
- name: Set deployment path
|
||||
@@ -68,10 +67,13 @@ jobs:
|
||||
npm install
|
||||
cp ../build/fallout2-ce.js src/assets/fallout2ce
|
||||
cp ../build/fallout2-ce.wasm src/assets/fallout2ce
|
||||
sed -i 's/Starting wasm module/Starting wasm module ${{github.event.pull_request.head.sha || github.sha }}/' src/pages/Launcher.tsx
|
||||
export F2_WEB_INFO=Web=$(git rev-parse HEAD)
|
||||
echo "F2_WEB_INFO=$F2_WEB_INFO"
|
||||
echo "F2_GAME_VERSION=$F2_GAME_VERSION"
|
||||
npm run build
|
||||
env:
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
F2_GAME_VERSION: Game=${{github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Install rsync (required for the next step)
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
@@ -93,4 +95,4 @@ jobs:
|
||||
gh pr comment ${{ github.event.pull_request.number }} \
|
||||
--body "🚀 WebAssembly PR Preview for ${{github.event.pull_request.head.sha || github.sha }} is available at: https://${{ github.repository_owner }}.github.io/fallout2-ce/PR-${{ github.event.pull_request.number }}/"
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -46,14 +46,20 @@ jobs:
|
||||
|
||||
- name: clang-format
|
||||
run: |
|
||||
echo "Showing PR labels..."
|
||||
gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels
|
||||
echo "Checking labels on PR..."
|
||||
if gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels --jq '.labels[].name' | grep -q "skip-formatting"; then
|
||||
echo "skip-formatting label found — skipping job."
|
||||
exit 0
|
||||
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then
|
||||
echo "Showing PR labels..."
|
||||
gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels
|
||||
echo "Checking labels on PR..."
|
||||
if gh pr view ${{ github.event.pull_request.number }} --repo "${{ github.repository }}" --json labels --jq '.labels[].name' | grep -q "skip-formatting"; then
|
||||
echo "skip-formatting label found - do not raise error"
|
||||
echo "==============================="
|
||||
find src -type f \( -name \*.cc -o -name \*.h \) | xargs clang-format --dry-run
|
||||
exit 0
|
||||
fi
|
||||
echo "skip-formatting label not found - raise error if formatting is not correct"
|
||||
else
|
||||
echo "Not a PR, do not check labels"
|
||||
fi
|
||||
echo "skip-formatting label not found — continuing job."
|
||||
|
||||
find src -type f \( -name \*.cc -o -name \*.h \) | xargs clang-format --dry-run --Werror
|
||||
|
||||
|
||||
+95
-93
@@ -73,30 +73,32 @@ static const int gMaximumBloodDeathAnimations[DAMAGE_TYPE_COUNT] = {
|
||||
ANIM_EXPLODED_TO_NOTHING,
|
||||
};
|
||||
|
||||
// Note: some of these are callbacks that always take two Object*, but may not use them.
|
||||
// Ignored parameters are marked with underscores.
|
||||
static int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int delay);
|
||||
static int _action_blood(Object* obj, int anim, int delay);
|
||||
static int _pick_death(Object* attacker, Object* defender, Object* weapon, int damage, int attackerAnimation, bool hitFromFront);
|
||||
static int _check_death(Object* obj, int anim, int minViolenceLevel, bool hitFromFront);
|
||||
static int _internal_destroy(Object* a1, Object* a2);
|
||||
static int _internal_destroy(Object* _, Object* toDestroy);
|
||||
static void _show_damage_to_object(Object* defender, int damage, int flags, Object* weapon, bool hitFromFront, int knockbackDistance, int knockbackRotation, int attackerAnimation, Object* attacker, int delay);
|
||||
static int _show_death(Object* obj, int anim);
|
||||
static int _show_damage_extras(Attack* attack);
|
||||
static void _show_damage(Attack* attack, int attackerAnimation, int delay);
|
||||
static int _action_melee(Attack* attack, int a2);
|
||||
static int _action_ranged(Attack* attack, int a2);
|
||||
static int _is_next_to(Object* a1, Object* a2);
|
||||
static int _action_climb_ladder(Object* a1, Object* a2);
|
||||
static int _action_melee(Attack* attack, int anim);
|
||||
static int _action_ranged(Attack* attack, int anim);
|
||||
static int _is_next_to(Object* obj1, Object* obj2);
|
||||
static int _action_climb_ladder(Object* critter, Object* ladder);
|
||||
static int _action_use_skill_in_combat_error(Object* critter);
|
||||
static int _pick_fall(Object* obj, int anim);
|
||||
static int _report_explosion(Attack* attack, Object* sourceObj);
|
||||
static int _finished_explosion(Object* a1, Object* a2);
|
||||
static int _finished_explosion(Object*, Object*);
|
||||
static int _compute_explosion_damage(int min, int max, Object* defender, int* knockbackDistancePtr);
|
||||
static int _can_talk_to(Object* a1, Object* a2);
|
||||
static int _talk_to(Object* a1, Object* a2);
|
||||
static int _report_dmg(Attack* attack, Object* a2);
|
||||
static int _can_talk_to(Object* obj, Object* critter);
|
||||
static int _talk_to(Object* _, Object* critter);
|
||||
static int _report_dmg(Attack* attack, Object* _);
|
||||
static int _compute_dmg_damage(int min, int max, Object* obj, int* knockbackDistancePtr, int damageType);
|
||||
|
||||
static int hideProjectile(void* a1, void* a2);
|
||||
static int hideProjectile(void* _, void* projectile);
|
||||
|
||||
// 0x410468
|
||||
int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int delay)
|
||||
@@ -281,9 +283,9 @@ int _check_death(Object* obj, int anim, int minViolenceLevel, bool hitFromFront)
|
||||
}
|
||||
|
||||
// 0x4108C8
|
||||
int _internal_destroy(Object* a1, Object* a2)
|
||||
int _internal_destroy(Object* _, Object* toDestroy)
|
||||
{
|
||||
return _obj_destroy(a2);
|
||||
return _obj_destroy(toDestroy);
|
||||
}
|
||||
|
||||
// TODO: Check very carefully, lots of conditions and jumps.
|
||||
@@ -985,10 +987,10 @@ int _action_ranged(Attack* attack, int anim)
|
||||
}
|
||||
|
||||
// 0x411D68
|
||||
int _is_next_to(Object* a1, Object* a2)
|
||||
int _is_next_to(Object* obj1, Object* obj2)
|
||||
{
|
||||
if (objectGetDistanceBetween(a1, a2) > 1) {
|
||||
if (a2 == gDude) {
|
||||
if (objectGetDistanceBetween(obj1, obj2) > 1) {
|
||||
if (obj2 == gDude) {
|
||||
MessageListItem messageListItem;
|
||||
// You cannot get there.
|
||||
messageListItem.num = 2000;
|
||||
@@ -1003,9 +1005,9 @@ int _is_next_to(Object* a1, Object* a2)
|
||||
}
|
||||
|
||||
// 0x411DB4
|
||||
int _action_climb_ladder(Object* a1, Object* a2)
|
||||
int _action_climb_ladder(Object* critter, Object* ladder)
|
||||
{
|
||||
if (a1 == gDude) {
|
||||
if (critter == gDude) {
|
||||
int anim = FID_ANIM_TYPE(gDude->fid);
|
||||
if (anim == ANIM_WALK || anim == ANIM_RUNNING) {
|
||||
reg_anim_clear(gDude);
|
||||
@@ -1016,46 +1018,46 @@ int _action_climb_ladder(Object* a1, Object* a2)
|
||||
int actionPoints;
|
||||
if (isInCombat()) {
|
||||
animationRequestOptions = ANIMATION_REQUEST_RESERVED;
|
||||
actionPoints = a1->data.critter.combat.ap;
|
||||
actionPoints = critter->data.critter.combat.ap;
|
||||
} else {
|
||||
animationRequestOptions = ANIMATION_REQUEST_UNRESERVED;
|
||||
actionPoints = -1;
|
||||
}
|
||||
|
||||
if (a1 == gDude) {
|
||||
if (critter == gDude) {
|
||||
animationRequestOptions = ANIMATION_REQUEST_RESERVED;
|
||||
}
|
||||
|
||||
animationRequestOptions |= ANIMATION_REQUEST_NO_STAND;
|
||||
reg_anim_begin(animationRequestOptions);
|
||||
|
||||
int tile = tileGetTileInDirection(a2->tile, ROTATION_SE, 1);
|
||||
int tile = tileGetTileInDirection(ladder->tile, ROTATION_SE, 1);
|
||||
int walkDistance = 5;
|
||||
configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_USE_WALK_DISTANCE, &walkDistance);
|
||||
if (actionPoints != -1 || objectGetDistanceBetween(a1, a2) < walkDistance) {
|
||||
animationRegisterMoveToTile(a1, tile, a2->elevation, actionPoints, 0);
|
||||
if (actionPoints != -1 || objectGetDistanceBetween(critter, ladder) < walkDistance) {
|
||||
animationRegisterMoveToTile(critter, tile, ladder->elevation, actionPoints, 0);
|
||||
} else {
|
||||
animationRegisterRunToTile(a1, tile, a2->elevation, actionPoints, 0);
|
||||
animationRegisterRunToTile(critter, tile, ladder->elevation, actionPoints, 0);
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(a1, a2, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterRotateToTile(a1, a2->tile);
|
||||
animationRegisterCallbackForced(a1, a2, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterRotateToTile(critter, ladder->tile);
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
|
||||
int weaponAnimationCode = (a1->fid & 0xF000) >> 12;
|
||||
int weaponAnimationCode = (critter->fid & 0xF000) >> 12;
|
||||
if (weaponAnimationCode != 0) {
|
||||
const char* puttingAwaySfx = sfxBuildCharName(a1, ANIM_PUT_AWAY, CHARACTER_SOUND_EFFECT_UNUSED);
|
||||
animationRegisterPlaySoundEffect(a1, puttingAwaySfx, -1);
|
||||
animationRegisterAnimate(a1, ANIM_PUT_AWAY, 0);
|
||||
const char* puttingAwaySfx = sfxBuildCharName(critter, ANIM_PUT_AWAY, CHARACTER_SOUND_EFFECT_UNUSED);
|
||||
animationRegisterPlaySoundEffect(critter, puttingAwaySfx, -1);
|
||||
animationRegisterAnimate(critter, ANIM_PUT_AWAY, 0);
|
||||
}
|
||||
|
||||
const char* climbingSfx = sfxBuildCharName(a1, ANIM_CLIMB_LADDER, CHARACTER_SOUND_EFFECT_UNUSED);
|
||||
animationRegisterPlaySoundEffect(a1, climbingSfx, -1);
|
||||
animationRegisterAnimate(a1, ANIM_CLIMB_LADDER, 0);
|
||||
animationRegisterCallback(a1, a2, (AnimationCallback*)_obj_use, -1);
|
||||
const char* climbingSfx = sfxBuildCharName(critter, ANIM_CLIMB_LADDER, CHARACTER_SOUND_EFFECT_UNUSED);
|
||||
animationRegisterPlaySoundEffect(critter, climbingSfx, -1);
|
||||
animationRegisterAnimate(critter, ANIM_CLIMB_LADDER, 0);
|
||||
animationRegisterCallback(critter, ladder, (AnimationCallback*)_obj_use, -1);
|
||||
|
||||
if (weaponAnimationCode != 0) {
|
||||
animationRegisterTakeOutWeapon(a1, weaponAnimationCode, -1);
|
||||
animationRegisterTakeOutWeapon(critter, weaponAnimationCode, -1);
|
||||
}
|
||||
|
||||
return reg_anim_end();
|
||||
@@ -1522,9 +1524,9 @@ int actionUseSkill(Object* user, Object* target, int skill)
|
||||
}
|
||||
|
||||
// 0x412BC4
|
||||
bool _is_hit_from_front(Object* a1, Object* a2)
|
||||
bool _is_hit_from_front(Object* attacker, Object* defender)
|
||||
{
|
||||
int diff = a1->rotation - a2->rotation;
|
||||
int diff = attacker->rotation - defender->rotation;
|
||||
if (diff < 0) {
|
||||
diff = -diff;
|
||||
}
|
||||
@@ -1533,11 +1535,11 @@ bool _is_hit_from_front(Object* a1, Object* a2)
|
||||
}
|
||||
|
||||
// 0x412BEC
|
||||
bool _can_see(Object* a1, Object* a2)
|
||||
bool _can_see(Object* source, Object* target)
|
||||
{
|
||||
int diff;
|
||||
|
||||
diff = a1->rotation - tileGetRotationTo(a1->tile, a2->tile);
|
||||
diff = source->rotation - tileGetRotationTo(source->tile, target->tile);
|
||||
if (diff < 0) {
|
||||
diff = -diff;
|
||||
}
|
||||
@@ -1813,7 +1815,7 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
||||
}
|
||||
|
||||
// 0x4132C0
|
||||
int _finished_explosion(Object* a1, Object* a2)
|
||||
int _finished_explosion(Object* _, Object* __)
|
||||
{
|
||||
_action_in_explode = false;
|
||||
return 0;
|
||||
@@ -1842,13 +1844,13 @@ int _compute_explosion_damage(int min, int max, Object* defender, int* knockback
|
||||
}
|
||||
|
||||
// 0x413330
|
||||
int actionTalk(Object* a1, Object* a2)
|
||||
int actionTalk(Object* obj, Object* critter)
|
||||
{
|
||||
if (a1 != gDude) {
|
||||
if (obj != gDude) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (FID_TYPE(a2->fid) != OBJ_TYPE_CRITTER) {
|
||||
if (FID_TYPE(critter->fid) != OBJ_TYPE_CRITTER) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1859,25 +1861,25 @@ int actionTalk(Object* a1, Object* a2)
|
||||
|
||||
if (isInCombat()) {
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
animationRegisterMoveToObject(a1, a2, a1->data.critter.combat.ap, 0);
|
||||
animationRegisterMoveToObject(obj, critter, obj->data.critter.combat.ap, 0);
|
||||
} else {
|
||||
reg_anim_begin(a1 == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED);
|
||||
reg_anim_begin(obj == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED);
|
||||
|
||||
if (objectGetDistanceBetween(a1, a2) >= 9 || _combat_is_shot_blocked(a1, a1->tile, a2->tile, a2, nullptr)) {
|
||||
animationRegisterRunToObject(a1, a2, -1, 0);
|
||||
if (objectGetDistanceBetween(obj, critter) >= 9 || _combat_is_shot_blocked(obj, obj->tile, critter->tile, critter, nullptr)) {
|
||||
animationRegisterRunToObject(obj, critter, -1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(a1, a2, (AnimationCallback*)_can_talk_to, -1);
|
||||
animationRegisterCallback(a1, a2, (AnimationCallback*)_talk_to, -1);
|
||||
animationRegisterCallbackForced(obj, critter, (AnimationCallback*)_can_talk_to, -1);
|
||||
animationRegisterCallback(obj, critter, (AnimationCallback*)_talk_to, -1);
|
||||
return reg_anim_end();
|
||||
}
|
||||
|
||||
// 0x413420
|
||||
int _can_talk_to(Object* a1, Object* a2)
|
||||
int _can_talk_to(Object* obj, Object* critter)
|
||||
{
|
||||
if (_combat_is_shot_blocked(a1, a1->tile, a2->tile, a2, nullptr) || objectGetDistanceBetween(a1, a2) >= 9) {
|
||||
if (a1 == gDude) {
|
||||
if (_combat_is_shot_blocked(obj, obj->tile, critter->tile, critter, nullptr) || objectGetDistanceBetween(obj, critter) >= 9) {
|
||||
if (obj == gDude) {
|
||||
// You cannot get there. (used in actions.c)
|
||||
MessageListItem messageListItem;
|
||||
messageListItem.num = 2000;
|
||||
@@ -1893,9 +1895,9 @@ int _can_talk_to(Object* a1, Object* a2)
|
||||
}
|
||||
|
||||
// 0x413488
|
||||
int _talk_to(Object* a1, Object* a2)
|
||||
int _talk_to(Object* _, Object* critter)
|
||||
{
|
||||
scriptsRequestDialog(a2);
|
||||
scriptsRequestDialog(critter);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1969,7 +1971,7 @@ void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int dam
|
||||
}
|
||||
|
||||
// 0x41363C
|
||||
int _report_dmg(Attack* attack, Object* a2)
|
||||
int _report_dmg(Attack* attack, Object* _)
|
||||
{
|
||||
_combat_display(attack);
|
||||
_apply_damage(attack, false);
|
||||
@@ -2006,42 +2008,42 @@ int _compute_dmg_damage(int min, int max, Object* obj, int* knockbackDistancePtr
|
||||
}
|
||||
|
||||
// 0x4136EC
|
||||
bool actionCheckPush(Object* a1, Object* a2)
|
||||
bool actionCheckPush(Object* obj, Object* target)
|
||||
{
|
||||
// Cannot push anything but critters.
|
||||
if (FID_TYPE(a2->fid) != OBJ_TYPE_CRITTER) {
|
||||
if (FID_TYPE(target->fid) != OBJ_TYPE_CRITTER) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot push itself.
|
||||
if (a1 == a2) {
|
||||
if (obj == target) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Cannot push inactive critters.
|
||||
if (!critterIsActive(a2)) {
|
||||
if (!critterIsActive(target)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_action_can_talk_to(a1, a2) != 0) {
|
||||
if (_action_can_talk_to(obj, target) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Can only push critters that have push handler.
|
||||
if (!scriptHasProc(a2->sid, SCRIPT_PROC_PUSH)) {
|
||||
if (!scriptHasProc(target->sid, SCRIPT_PROC_PUSH)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isInCombat()) {
|
||||
if (a2->data.critter.combat.team == a1->data.critter.combat.team
|
||||
&& a2 == a1->data.critter.combat.whoHitMe) {
|
||||
if (target->data.critter.combat.team == obj->data.critter.combat.team
|
||||
&& target == obj->data.critter.combat.whoHitMe) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO: Check.
|
||||
Object* whoHitMe = a2->data.critter.combat.whoHitMe;
|
||||
Object* whoHitMe = target->data.critter.combat.whoHitMe;
|
||||
if (whoHitMe != nullptr
|
||||
&& whoHitMe->data.critter.combat.team == a1->data.critter.combat.team) {
|
||||
&& whoHitMe->data.critter.combat.team == obj->data.critter.combat.team) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2050,15 +2052,15 @@ bool actionCheckPush(Object* a1, Object* a2)
|
||||
}
|
||||
|
||||
// 0x413790
|
||||
int actionPush(Object* a1, Object* a2)
|
||||
int actionPush(Object* obj, Object* target)
|
||||
{
|
||||
if (!actionCheckPush(a1, a2)) {
|
||||
if (!actionCheckPush(obj, target)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int sid;
|
||||
if (_obj_sid(a2, &sid) == 0) {
|
||||
scriptSetObjects(sid, a1, a2);
|
||||
if (_obj_sid(target, &sid) == 0) {
|
||||
scriptSetObjects(sid, obj, target);
|
||||
scriptExecProc(sid, SCRIPT_PROC_PUSH);
|
||||
|
||||
bool scriptOverrides = false;
|
||||
@@ -2073,36 +2075,36 @@ int actionPush(Object* a1, Object* a2)
|
||||
}
|
||||
}
|
||||
|
||||
int rotation = tileGetRotationTo(a1->tile, a2->tile);
|
||||
int rotation = tileGetRotationTo(obj->tile, target->tile);
|
||||
int tile;
|
||||
do {
|
||||
tile = tileGetTileInDirection(a2->tile, rotation, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
tile = tileGetTileInDirection(target->tile, rotation, 1);
|
||||
if (_obj_blocking_at(target, tile, target->elevation) == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 1) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
tile = tileGetTileInDirection(target->tile, (rotation + 1) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(target, tile, target->elevation) == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 5) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
tile = tileGetTileInDirection(target->tile, (rotation + 5) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(target, tile, target->elevation) == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 2) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
tile = tileGetTileInDirection(target->tile, (rotation + 2) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(target, tile, target->elevation) == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 4) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
tile = tileGetTileInDirection(target->tile, (rotation + 4) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(target, tile, target->elevation) == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 3) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
tile = tileGetTileInDirection(target->tile, (rotation + 3) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(target, tile, target->elevation) == nullptr) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2111,14 +2113,14 @@ int actionPush(Object* a1, Object* a2)
|
||||
|
||||
int actionPoints;
|
||||
if (isInCombat()) {
|
||||
actionPoints = a2->data.critter.combat.ap;
|
||||
actionPoints = target->data.critter.combat.ap;
|
||||
} else {
|
||||
actionPoints = -1;
|
||||
}
|
||||
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
animationRegisterRotateToTile(a2, tile);
|
||||
animationRegisterMoveToTile(a2, tile, a2->elevation, actionPoints, 0);
|
||||
animationRegisterRotateToTile(target, tile);
|
||||
animationRegisterMoveToTile(target, tile, target->elevation, actionPoints, 0);
|
||||
return reg_anim_end();
|
||||
}
|
||||
|
||||
@@ -2126,29 +2128,29 @@ int actionPush(Object* a1, Object* a2)
|
||||
// Returns -2 if it's too far (> 12 tiles).
|
||||
//
|
||||
// 0x413970
|
||||
int _action_can_talk_to(Object* a1, Object* a2)
|
||||
int _action_can_talk_to(Object* obj, Object* target)
|
||||
{
|
||||
if (pathfinderFindPath(a1, a1->tile, a2->tile, nullptr, 0, _obj_sight_blocking_at) == 0) {
|
||||
if (pathfinderFindPath(obj, obj->tile, target->tile, nullptr, 0, _obj_sight_blocking_at) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tileDistanceBetween(a1->tile, a2->tile) > 12) {
|
||||
if (tileDistanceBetween(obj->tile, target->tile) > 12) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hideProjectile(void* a1, void* a2)
|
||||
static int hideProjectile(void* _, void* projectile)
|
||||
{
|
||||
Object* projectile = reinterpret_cast<Object*>(a2);
|
||||
Object* proj = reinterpret_cast<Object*>(projectile);
|
||||
|
||||
Rect rect;
|
||||
if (objectHide(projectile, &rect) == 0) {
|
||||
tileWindowRefreshRect(&rect, projectile->elevation);
|
||||
if (objectHide(proj, &rect) == 0) {
|
||||
tileWindowRefreshRect(&rect, proj->elevation);
|
||||
}
|
||||
|
||||
projectile->flags |= OBJECT_NO_SAVE;
|
||||
proj->flags |= OBJECT_NO_SAVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+5
-5
@@ -16,14 +16,14 @@ int _action_loot_container(Object* critter, Object* container);
|
||||
int _action_skill_use(int skill);
|
||||
int actionUseSkill(Object* user, Object* target, int skill);
|
||||
bool _is_hit_from_front(Object* attacker, Object* defender);
|
||||
bool _can_see(Object* a1, Object* a2);
|
||||
bool _can_see(Object* source, Object* target);
|
||||
bool _action_explode_running();
|
||||
int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object* sourceObj, bool animate);
|
||||
int actionTalk(Object* a1, Object* a2);
|
||||
int actionTalk(Object* obj, Object* critter);
|
||||
void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int damageType, bool animated, bool bypassArmor);
|
||||
bool actionCheckPush(Object* a1, Object* a2);
|
||||
int actionPush(Object* a1, Object* a2);
|
||||
int _action_can_talk_to(Object* a1, Object* a2);
|
||||
bool actionCheckPush(Object* obj, Object* target);
|
||||
int actionPush(Object* obj, Object* target);
|
||||
int _action_can_talk_to(Object* obj, Object* critter);
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ typedef struct HeadDescription {
|
||||
} HeadDescription;
|
||||
|
||||
static int artReadList(const char* path, char** out_arr, int* out_count);
|
||||
static int artCacheGetFileSizeImpl(int a1, int* out_size);
|
||||
static int artCacheReadDataImpl(int a1, int* a2, unsigned char* data);
|
||||
static int artCacheGetFileSizeImpl(int fid, int* out_size);
|
||||
static int artCacheReadDataImpl(int fid, int* sizePtr, unsigned char* data);
|
||||
static void artCacheFreeImpl(void* ptr);
|
||||
static int artReadFrameData(unsigned char* data, File* stream, int count, int* paddingPtr);
|
||||
static int artReadHeader(Art* art, File* stream);
|
||||
|
||||
@@ -129,9 +129,9 @@ unsigned char* artLockFrameData(int fid, int frame, int direction, CacheEntry**
|
||||
unsigned char* artLockFrameDataReturningSize(int fid, CacheEntry** out_cache_entry, int* widthPtr, int* heightPtr);
|
||||
int artUnlock(CacheEntry* cache_entry);
|
||||
int artCacheFlush();
|
||||
int artCopyFileName(int objectType, int a2, char* a3);
|
||||
int _art_get_code(int a1, int a2, char* a3, char* a4);
|
||||
char* artBuildFilePath(int a1);
|
||||
int artCopyFileName(int objectType, int id, char* a3);
|
||||
int _art_get_code(int animation, int weaponType, char* a3, char* a4);
|
||||
char* artBuildFilePath(int fid);
|
||||
int artGetFramesPerSecond(Art* art);
|
||||
int artGetActionFrame(Art* art);
|
||||
int artGetFrameCount(Art* art);
|
||||
@@ -144,8 +144,8 @@ unsigned char* artGetFrameData(Art* art, int frame, int direction);
|
||||
ArtFrame* artGetFrame(Art* art, int frame, int direction);
|
||||
bool artExists(int fid);
|
||||
bool _art_fid_valid(int fid);
|
||||
int _art_alias_num(int a1);
|
||||
int artCritterFidShouldRun(int a1);
|
||||
int _art_alias_num(int index);
|
||||
int artCritterFidShouldRun(int fid);
|
||||
int artAliasFid(int fid);
|
||||
int buildFid(int objectType, int frmId, int animType, int weaponCode, int rotation);
|
||||
Art* artLoad(const char* path);
|
||||
|
||||
+3
-2
@@ -952,11 +952,12 @@ int gameHandleKey(int eventCode, bool isInCombatMode)
|
||||
|
||||
// game_ui_disable
|
||||
// 0x443BFC
|
||||
void gameUiDisable(int a1)
|
||||
// pass allowScrolling = 1 to allow scrolling
|
||||
void gameUiDisable(int allowScrolling)
|
||||
{
|
||||
if (!gGameUiDisabled) {
|
||||
gameMouseObjectsHide();
|
||||
_gmouse_disable(a1);
|
||||
_gmouse_disable(allowScrolling);
|
||||
keyboardDisable();
|
||||
interfaceBarDisable();
|
||||
gGameUiDisabled = true;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ int gameInitWithOptions(const char* windowTitle, bool isMapper, int a3, int a4,
|
||||
void gameReset();
|
||||
void gameExit();
|
||||
int gameHandleKey(int eventCode, bool isInCombatMode);
|
||||
void gameUiDisable(int a1);
|
||||
void gameUiDisable(int allowScrolling);
|
||||
void gameUiEnable();
|
||||
bool gameUiIsDisabled();
|
||||
int gameGetGlobalVar(int var);
|
||||
|
||||
+2
-2
@@ -408,13 +408,13 @@ void _gmouse_enable()
|
||||
}
|
||||
|
||||
// 0x44B48C
|
||||
void _gmouse_disable(int a1)
|
||||
void _gmouse_disable(int allowScrolling)
|
||||
{
|
||||
if (_gmouse_enabled) {
|
||||
gameMouseSetCursor(MOUSE_CURSOR_NONE);
|
||||
_gmouse_enabled = 0;
|
||||
|
||||
if (a1 & 1) {
|
||||
if (allowScrolling & 1) {
|
||||
_gmouse_scrolling_enabled = 1;
|
||||
} else {
|
||||
_gmouse_scrolling_enabled = 0;
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ int gameMouseInit();
|
||||
int gameMouseReset();
|
||||
void gameMouseExit();
|
||||
void _gmouse_enable();
|
||||
void _gmouse_disable(int a1);
|
||||
void _gmouse_disable(int allowScrolling);
|
||||
void _gmouse_enable_scrolling();
|
||||
void _gmouse_disable_scrolling();
|
||||
bool gmouse_scrolling_is_enabled();
|
||||
|
||||
+330
-98
File diff suppressed because it is too large
Load Diff
+22
-9
@@ -298,7 +298,7 @@ MessageListItem gPipboyMessageListItem;
|
||||
// pipboy.msg
|
||||
//
|
||||
// 0x664348
|
||||
MessageList gPipboyMessageList;
|
||||
MessageList gPipboyMessageList = { 0, nullptr };
|
||||
|
||||
// 0x664350
|
||||
STRUCT_664350 _sortlist[24];
|
||||
@@ -488,6 +488,26 @@ int pipboyOpen(int intent)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int pipboyMessageListInit()
|
||||
{
|
||||
if (gPipboyMessageList.entries != nullptr) {
|
||||
messageListFree(&gPipboyMessageList);
|
||||
}
|
||||
|
||||
if (!messageListInit(&gPipboyMessageList)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
char path[COMPAT_MAX_PATH];
|
||||
snprintf(path, sizeof(path), "%s%s", asc_5186C8, "pipboy.msg");
|
||||
|
||||
if (!(messageListLoad(&gPipboyMessageList, path))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x497228
|
||||
static int pipboyWindowInit(int intent)
|
||||
{
|
||||
@@ -519,14 +539,7 @@ static int pipboyWindowInit(int intent)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!messageListInit(&gPipboyMessageList)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
char path[COMPAT_MAX_PATH];
|
||||
snprintf(path, sizeof(path), "%s%s", asc_5186C8, "pipboy.msg");
|
||||
|
||||
if (!(messageListLoad(&gPipboyMessageList, path))) {
|
||||
if (pipboyMessageListInit() == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define PIPBOY_H
|
||||
|
||||
#include "db.h"
|
||||
#include "message.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
@@ -16,6 +17,9 @@ void pipboyReset();
|
||||
int pipboySave(File* stream);
|
||||
int pipboyLoad(File* stream);
|
||||
|
||||
extern MessageList gPipboyMessageList;
|
||||
int pipboyMessageListInit();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* PIPBOY_H */
|
||||
|
||||
+6
-6
@@ -15,17 +15,17 @@ int reactionSetValue(Object* critter, int value)
|
||||
}
|
||||
|
||||
// 0x4A29E8
|
||||
int reactionTranslateValue(int a1)
|
||||
int reactionTranslateValue(int value)
|
||||
{
|
||||
if (a1 > 10) {
|
||||
if (value > 10) {
|
||||
return NPC_REACTION_GOOD;
|
||||
} else if (a1 > -10) {
|
||||
} else if (value > -10) {
|
||||
return NPC_REACTION_NEUTRAL;
|
||||
} else if (a1 > -25) {
|
||||
} else if (value > -25) {
|
||||
return NPC_REACTION_BAD;
|
||||
} else if (a1 > -50) {
|
||||
} else if (value > -50) {
|
||||
return NPC_REACTION_BAD;
|
||||
} else if (a1 > -75) {
|
||||
} else if (value > -75) {
|
||||
return NPC_REACTION_BAD;
|
||||
} else {
|
||||
return NPC_REACTION_BAD;
|
||||
|
||||
+2
-2
@@ -11,8 +11,8 @@ typedef enum NpcReaction {
|
||||
NPC_REACTION_GOOD,
|
||||
} NpcReaction;
|
||||
|
||||
int reactionSetValue(Object* critter, int a2);
|
||||
int reactionTranslateValue(int a1);
|
||||
int reactionSetValue(Object* critter, int value);
|
||||
int reactionTranslateValue(int value);
|
||||
int _reaction_influence_();
|
||||
int reactionGetValue(Object* critter);
|
||||
|
||||
|
||||
+37
-49
@@ -722,83 +722,71 @@ int tileToScreenXY(int tile, int* screenX, int* screenY, int elevation)
|
||||
// validating hex grid bounds. The resulting invalid tile number serves as an
|
||||
// origin for calculations using prepared offsets table during objects
|
||||
// rendering.
|
||||
//
|
||||
// Note: does not take "elevation" into account might need to be corrected.
|
||||
// 0x4B1754
|
||||
int tileFromScreenXY(int screenX, int screenY, int elevation, bool ignoreBounds)
|
||||
{
|
||||
int v2;
|
||||
int v3;
|
||||
int v4;
|
||||
int v5;
|
||||
int v6;
|
||||
int v7;
|
||||
int v8;
|
||||
int v9;
|
||||
int v10;
|
||||
int v11;
|
||||
int v12;
|
||||
int x, y;
|
||||
|
||||
v2 = screenY - _tile_offy;
|
||||
if (v2 >= 0) {
|
||||
v3 = v2 / 12;
|
||||
int yTileOff = screenY - _tile_offy;
|
||||
if (yTileOff >= 0) {
|
||||
y = yTileOff / 12;
|
||||
} else {
|
||||
v3 = (v2 + 1) / 12 - 1;
|
||||
y = (yTileOff + 1) / 12 - 1;
|
||||
}
|
||||
|
||||
v4 = screenX - _tile_offx - 16 * v3;
|
||||
v5 = v2 - 12 * v3;
|
||||
int xTileOff = screenX - _tile_offx - 16 * y;
|
||||
int yOffset = yTileOff - (y * 12);
|
||||
|
||||
if (v4 >= 0) {
|
||||
v6 = v4 / 64;
|
||||
if (xTileOff >= 0) {
|
||||
x = xTileOff / 64;
|
||||
} else {
|
||||
v6 = (v4 + 1) / 64 - 1;
|
||||
x = (xTileOff + 1) / 64 - 1;
|
||||
}
|
||||
|
||||
v7 = v6 + v3;
|
||||
v8 = v4 - (v6 * 64);
|
||||
v9 = 2 * v6;
|
||||
int xOffset = xTileOff - (x * 64);
|
||||
|
||||
if (v8 >= 32) {
|
||||
v8 -= 32;
|
||||
v9++;
|
||||
int tY = x + y;
|
||||
int tX = 2 * x;
|
||||
|
||||
if (xOffset >= 32) {
|
||||
xOffset -= 32;
|
||||
tX++;
|
||||
}
|
||||
|
||||
v10 = _tile_y + v7;
|
||||
v11 = _tile_x + v9;
|
||||
int xTile = _tile_x + tX;
|
||||
int yTile = _tile_y + tY;
|
||||
|
||||
switch (_tile_mask[32 * v5 + v8]) {
|
||||
switch (_tile_mask[(32 * yOffset) + xOffset]) {
|
||||
case 1:
|
||||
yTile--;
|
||||
break;
|
||||
case 2:
|
||||
v11++;
|
||||
if (v11 & 1) {
|
||||
v10--;
|
||||
xTile++;
|
||||
if (xTile & 1) {
|
||||
yTile--;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
v10--;
|
||||
break;
|
||||
case 3:
|
||||
v11--;
|
||||
if (!(v11 & 1)) {
|
||||
v10++;
|
||||
xTile--;
|
||||
if (!(xTile & 1)) {
|
||||
yTile++;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
v10++;
|
||||
yTile++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
v12 = gHexGridWidth - 1 - v11;
|
||||
if (v12 >= 0 && v12 < gHexGridWidth && v10 >= 0 && v10 < gHexGridHeight) {
|
||||
return gHexGridWidth * v10 + v12;
|
||||
int xPos = gHexGridWidth - 1 - xTile;
|
||||
if (ignoreBounds
|
||||
|| (xPos >= 0 && xPos < gHexGridWidth && yTile >= 0 && yTile < gHexGridHeight)) {
|
||||
return (gHexGridWidth * yTile) + xPos;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ignoreBounds) {
|
||||
return gHexGridWidth * v10 + v12;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// tile_distance
|
||||
|
||||
Reference in New Issue
Block a user