mirror of
https://github.com/fallout2-ce/fallout2-ce.git
synced 2026-07-27 16:47:11 -07:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
068e6dd864 | ||
|
|
1acb4a57d2 | ||
|
|
293c5b71fb |
@@ -86,10 +86,6 @@ jobs:
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
F2_GAME_VERSION: Game=${{github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
- name: Place hash file
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: echo "$GITHUB_SHA" > fallout2-ce-ems/dist/site_hash.txt
|
||||
|
||||
- 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)
|
||||
run: |
|
||||
@@ -105,28 +101,6 @@ jobs:
|
||||
clean: false
|
||||
single-commit: true
|
||||
|
||||
|
||||
|
||||
- name: Check that site is deployed
|
||||
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository)
|
||||
run: |
|
||||
URL="$SITE_ORIGIN""$SITE_BASE""site_hash.txt"
|
||||
echo "Expecting $GITHUB_SHA from $URL"
|
||||
for i in `seq 1 80`; do
|
||||
got="$(curl -fsSL --max-time 10 "$URL" | tr -d '\r\n' || true)"
|
||||
if [ "$got" = "$GITHUB_SHA" ]; then
|
||||
echo "âś… Match on attempt $i: ${got}"
|
||||
exit 0
|
||||
fi
|
||||
echo "Received $got, waiting"
|
||||
sleep 5
|
||||
done
|
||||
exit 1
|
||||
|
||||
env:
|
||||
SITE_ORIGIN: https://${{ github.repository_owner }}.github.io
|
||||
SITE_BASE: ${{ steps.set-path.outputs.SITE_BASE }}
|
||||
|
||||
- name: Update deployment status
|
||||
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
|
||||
uses: bobheadxi/deployments@v1
|
||||
|
||||
@@ -328,16 +328,16 @@ jobs:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Visual Studio 2022 Build Tools with v141_xp
|
||||
- name: Install Visual Studio 2019 Build Tools with v141_xp
|
||||
shell: cmd
|
||||
run: |
|
||||
choco install visualstudio2022buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
|
||||
choco install visualstudio2019buildtools -y --package-parameters="'--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.VC.v141.x86.x64 --add Microsoft.VisualStudio.Component.VC.v141.xp --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.10240 --add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.WinXP --add Microsoft.VisualStudio.Component.WinXP'"
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: out
|
||||
key: windows-${{ matrix.arch }}-cmake-v102
|
||||
key: windows-${{ matrix.arch }}-cmake-v101
|
||||
|
||||
- name: Configure
|
||||
shell: cmd
|
||||
@@ -432,4 +432,4 @@ jobs:
|
||||
tag_name: continious
|
||||
draft: false
|
||||
prerelease: true
|
||||
name: Fallout2-CE Continuous Build
|
||||
name: Fallout2-CE Continuous Build
|
||||
+1
-28
@@ -286,7 +286,6 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
|
||||
"src/sfall_metarules.h"
|
||||
"src/sfall_opcodes.cc"
|
||||
"src/sfall_opcodes.h"
|
||||
"src/sfall_script_hooks.cc"
|
||||
"src/sfall_arrays.cc"
|
||||
"src/sfall_arrays.h"
|
||||
"src/sfall_callbacks.cc"
|
||||
@@ -319,8 +318,7 @@ endif()
|
||||
if(WIN32)
|
||||
target_link_libraries(${EXECUTABLE_NAME}
|
||||
winmm
|
||||
debug libcpmtd
|
||||
optimized libcpmt
|
||||
libcpmt
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -509,28 +507,3 @@ if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
|
||||
endif()
|
||||
|
||||
# Optional path to which the built executable and PDB will be copied after build.
|
||||
# Can be set via -DCOPY_TO_PATH=/some/path or through the CMake/CLion GUI.
|
||||
set(COPY_TO_PATH "" CACHE PATH "Destination directory for copying the executable and PDB after build")
|
||||
|
||||
if(DEFINED COPY_TO_PATH AND NOT "${COPY_TO_PATH}" STREQUAL "")
|
||||
add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${COPY_TO_PATH}"
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:${EXECUTABLE_NAME}>"
|
||||
"${COPY_TO_PATH}/"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Copied executable to ${COPY_TO_PATH}"
|
||||
)
|
||||
if(MSVC)
|
||||
add_custom_command(TARGET ${EXECUTABLE_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_PDB_FILE:${EXECUTABLE_NAME}>"
|
||||
"${COPY_TO_PATH}/"
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Copied PDB to ${COPY_TO_PATH}"
|
||||
)
|
||||
message(STATUS "Will copy executable and PDB to: ${COPY_TO_PATH}")
|
||||
else()
|
||||
message(STATUS "Will copy executable to: ${COPY_TO_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
"inherits": [
|
||||
"windows-base"
|
||||
],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": "Win32",
|
||||
"cacheVariables": {
|
||||
"CMAKE_GENERATOR_TOOLSET": "v141_xp",
|
||||
@@ -42,7 +42,7 @@
|
||||
"inherits": [
|
||||
"windows-base"
|
||||
],
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"generator": "Visual Studio 16 2019",
|
||||
"architecture": "x64",
|
||||
"cacheVariables": {
|
||||
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>"
|
||||
|
||||
@@ -126,17 +126,6 @@ IFACE_BAR_SIDES_ORI=0
|
||||
;if IFACE_BAR_WIDTH=640 - Interface bar will remain at it's original width.
|
||||
;if IFACE_BAR_WIDTH=800 - Interface bar will use 800pix wide asset from f2_res.dat.
|
||||
;IFACE_BAR_WIDTH=640
|
||||
|
||||
[STATIC_SCREENS]
|
||||
;if SPLASH_SCRN_SIZE=0 - Splash screen shows at original size if it fits, otherwise scales down while preserving aspect ratio.
|
||||
;if SPLASH_SCRN_SIZE=1 - Splash screen scales to fit the screen while preserving aspect ratio.
|
||||
;if SPLASH_SCRN_SIZE=2 - Splash screen stretches to fill the entire screen.
|
||||
SPLASH_SCRN_SIZE=0
|
||||
|
||||
[MAPS]
|
||||
;if IGNORE_MAP_EDGES=0 - Hi-Res map scroll edges are enabled.
|
||||
;if IGNORE_MAP_EDGES=1 - Hi-Res map scroll edges are ignored.
|
||||
IGNORE_MAP_EDGES=0
|
||||
```
|
||||
|
||||
Recommendations:
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
*.int
|
||||
sfall
|
||||
@@ -1,120 +0,0 @@
|
||||
#include "../sfall/sfall.h"
|
||||
#include "../sfall/dik.h"
|
||||
#include "../sfall/define_lite.h"
|
||||
#include "../test_utils.h"
|
||||
|
||||
variable last_game_mode;
|
||||
variable gamemodechange_assertions_enabled := false;
|
||||
variable gamemodechange_reported := false;
|
||||
|
||||
procedure test_with_args(variable arg1) begin
|
||||
display_msg("test_w_arg" + arg1);
|
||||
end
|
||||
|
||||
procedure test_wo_args begin
|
||||
display_msg("test_wo_args");
|
||||
end
|
||||
|
||||
procedure tohit_handler begin
|
||||
variable
|
||||
attacker := get_sfall_arg_at(1),
|
||||
target := get_sfall_arg_at(2),
|
||||
chanceRaw := get_sfall_arg_at(7);
|
||||
|
||||
display_msg(string_format("tohit %s -> %s (%d)", obj_name(attacker), obj_name(target), chanceRaw));
|
||||
if (attacker == dude_obj) then
|
||||
set_sfall_return(100);
|
||||
else if (target == dude_obj) then
|
||||
set_sfall_return(0);
|
||||
|
||||
end
|
||||
|
||||
procedure useobj_handler begin
|
||||
variable
|
||||
user := get_sfall_arg,
|
||||
item := get_sfall_arg;
|
||||
|
||||
display_msg(string_format("useobj %s (%s)", obj_name(user), obj_name(item)));
|
||||
set_sfall_return(2);
|
||||
end
|
||||
|
||||
procedure useobjon_handler begin
|
||||
variable args := get_sfall_args,
|
||||
target := args[0],
|
||||
user := args[1],
|
||||
item := args[2];
|
||||
|
||||
display_msg(string_format("useobjon %s (%s) -> %s [len: %d]", obj_name(user), obj_name(item), obj_name(target), len_array(args)));
|
||||
set_sfall_return(0);
|
||||
end
|
||||
|
||||
procedure keypress_handler begin
|
||||
variable
|
||||
pressed := get_sfall_arg_at(0),
|
||||
key := get_sfall_arg_at(1);
|
||||
|
||||
display_msg(string_format("keypress %d dx: %d", pressed, key));
|
||||
|
||||
if (not pressed) then return;
|
||||
|
||||
if (key == DIK_F2) then begin
|
||||
display_msg(string_format("tile %d, elev %d, map %d", tile_under_cursor, elevation(dude_obj), cur_map_index));
|
||||
end if (key == DIK_F3) then begin
|
||||
if (key_pressed(DIK_LCONTROL)) then begin
|
||||
variable cr := obj_under_cursor(true, false);
|
||||
if (cr) then
|
||||
critter_dmg(cr, 1000, DMG_BYPASS_ARMOR);
|
||||
end else
|
||||
move_to(dude_obj, tile_under_cursor, elevation(dude_obj));
|
||||
end
|
||||
end
|
||||
|
||||
procedure gamemodechange_handler begin
|
||||
variable
|
||||
event_type := get_sfall_arg_at(0),
|
||||
previous_mode := get_sfall_arg_at(1),
|
||||
current_mode := get_game_mode;
|
||||
|
||||
display_msg(string_format("gamemodechange event=%d prev=%d cur=%d", event_type, previous_mode, current_mode));
|
||||
|
||||
if (not gamemodechange_assertions_enabled) then begin
|
||||
last_game_mode := current_mode;
|
||||
return;
|
||||
end
|
||||
|
||||
call assertTrue("gamemodechange event_type is 0 or 1", event_type == 0 or event_type == 1);
|
||||
call assertEquals("gamemodechange previous mode", previous_mode, last_game_mode);
|
||||
if (event_type == 0) then
|
||||
call assertNotEquals("gamemodechange mode changed", current_mode, previous_mode);
|
||||
else if (not gamemodechange_reported) then begin
|
||||
gamemodechange_reported := true;
|
||||
call report_test_results("hook_gamemodechange");
|
||||
end
|
||||
|
||||
last_game_mode := current_mode;
|
||||
end
|
||||
|
||||
procedure start begin
|
||||
//call test_with_args(777);
|
||||
display_msg("start hook test");
|
||||
|
||||
if (not game_loaded) then return;
|
||||
|
||||
add_obj_to_inven(dude_obj, create_object_sid(40, 0, 0, -1));
|
||||
add_obj_to_inven(dude_obj, create_object_sid(76, 0, 0, -1));
|
||||
add_obj_to_inven(dude_obj, create_object_sid(85, 0, 0, -1));
|
||||
|
||||
last_game_mode := get_game_mode;
|
||||
gamemodechange_assertions_enabled := true;
|
||||
|
||||
register_hook_proc(HOOK_KEYPRESS, keypress_handler);
|
||||
register_hook_proc(HOOK_TOHIT, tohit_handler);
|
||||
register_hook_proc(HOOK_USEOBJ, useobj_handler);
|
||||
register_hook_proc(HOOK_USEOBJON, useobjon_handler);
|
||||
register_hook_proc(HOOK_GAMEMODECHANGE, gamemodechange_handler);
|
||||
end
|
||||
|
||||
|
||||
procedure map_enter_p_proc begin
|
||||
display_msg("Map Enter hook test");
|
||||
end
|
||||
+27
-27
@@ -103,7 +103,7 @@ static int hideProjectile(void* _, void* projectile);
|
||||
// 0x410468
|
||||
int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int delay)
|
||||
{
|
||||
if (critterFlagCheck(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
if (_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ int _pick_death(Object* attacker, Object* defender, Object* weapon, int damage,
|
||||
|
||||
int violenceLevel = settings.preferences.violence_level;
|
||||
|
||||
if (critterFlagCheck(defender->pid, CRITTER_SPECIAL_DEATH)) {
|
||||
if (_critter_flag_check(defender->pid, CRITTER_SPECIAL_DEATH)) {
|
||||
return _check_death(defender, ANIM_EXPLODED_TO_NOTHING, VIOLENCE_LEVEL_NORMAL, hitFromFront);
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ int _check_death(Object* obj, int anim, int minViolenceLevel, bool hitFromFront)
|
||||
// 0x4108C8
|
||||
int _internal_destroy(Object* _, Object* toDestroy)
|
||||
{
|
||||
return objectDestroy(toDestroy);
|
||||
return _obj_destroy(toDestroy);
|
||||
}
|
||||
|
||||
// TODO: Check very carefully, lots of conditions and jumps.
|
||||
@@ -297,12 +297,12 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
||||
int fid;
|
||||
const char* sfx_name;
|
||||
|
||||
if (critterFlagCheck(defender->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
if (_critter_flag_check(defender->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
knockbackDistance = 0;
|
||||
}
|
||||
|
||||
anim = FID_ANIM_TYPE(defender->fid);
|
||||
if (!critterIsProne(defender)) {
|
||||
if (!_critter_is_prone(defender)) {
|
||||
if ((flags & DAM_DEAD) != 0) {
|
||||
fid = buildFid(OBJ_TYPE_MISC, 10, 0, 0, 0);
|
||||
if (fid == attacker->fid) {
|
||||
@@ -447,7 +447,7 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
||||
|
||||
if (weapon != nullptr) {
|
||||
if ((flags & DAM_EXPLODE) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)objectDrop, -1);
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_obj_drop, -1);
|
||||
fid = buildFid(OBJ_TYPE_MISC, 10, 0, 0, 0);
|
||||
animationRegisterSetFid(weapon, fid, 0);
|
||||
animationRegisterAnimateAndHide(weapon, ANIM_STAND, 0);
|
||||
@@ -459,7 +459,7 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
||||
} else if ((flags & DAM_DESTROY) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_internal_destroy, -1);
|
||||
} else if ((flags & DAM_DROP) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)objectDrop, -1);
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_obj_drop, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -488,7 +488,7 @@ int _show_death(Object* obj, int anim)
|
||||
}
|
||||
}
|
||||
|
||||
if (!critterFlagCheck(obj->pid, CRITTER_FLAT)) {
|
||||
if (!_critter_flag_check(obj->pid, CRITTER_FLAT)) {
|
||||
obj->flags |= OBJECT_NO_BLOCK;
|
||||
if (_obj_toggle_flat(obj, &tempRect) == 0) {
|
||||
rectUnion(&dirtyRect, &tempRect, &dirtyRect);
|
||||
@@ -499,7 +499,7 @@ int _show_death(Object* obj, int anim)
|
||||
rectUnion(&dirtyRect, &tempRect, &dirtyRect);
|
||||
}
|
||||
|
||||
if (anim >= 30 && anim <= 31 && !critterFlagCheck(obj->pid, CRITTER_SPECIAL_DEATH) && !critterFlagCheck(obj->pid, CRITTER_NO_DROP)) {
|
||||
if (anim >= 30 && anim <= 31 && !_critter_flag_check(obj->pid, CRITTER_SPECIAL_DEATH) && !_critter_flag_check(obj->pid, CRITTER_NO_DROP)) {
|
||||
itemDropAll(obj, obj->tile);
|
||||
}
|
||||
|
||||
@@ -1040,7 +1040,7 @@ int _action_climb_ladder(Object* critter, Object* ladder)
|
||||
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterRotateToTile(critter, ladder->tile);
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallbackForced(critter, ladder, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
|
||||
int weaponAnimationCode = (critter->fid & 0xF000) >> 12;
|
||||
if (weaponAnimationCode != 0) {
|
||||
@@ -1052,7 +1052,7 @@ int _action_climb_ladder(Object* critter, Object* ladder)
|
||||
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*)objectUse, -1);
|
||||
animationRegisterCallback(critter, ladder, (AnimationCallback*)_obj_use, -1);
|
||||
|
||||
if (weaponAnimationCode != 0) {
|
||||
animationRegisterTakeOutWeapon(critter, weaponAnimationCode, -1);
|
||||
@@ -1108,7 +1108,7 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
animationRegisterCallbackForced(user, targetObj, (AnimationCallback*)_is_next_to, -1);
|
||||
|
||||
if (item == nullptr) {
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
}
|
||||
|
||||
int weaponAnimCode = (user->fid & 0xF000) >> 12;
|
||||
@@ -1120,9 +1120,9 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
|
||||
int anim;
|
||||
int objectType = FID_TYPE(targetObj->fid);
|
||||
if (objectType == OBJ_TYPE_CRITTER && critterIsProne(targetObj)) {
|
||||
if (objectType == OBJ_TYPE_CRITTER && _critter_is_prone(targetObj)) {
|
||||
anim = ANIM_MAGIC_HANDS_GROUND;
|
||||
} else if (objectType == OBJ_TYPE_SCENERY && (proto->scenery.extendedFlags & PROTO_EXT_FLAG_MAGIC_HANDS_GROUND) != 0) {
|
||||
} else if (objectType == OBJ_TYPE_SCENERY && (proto->scenery.extendedFlags & 0x01) != 0) {
|
||||
anim = ANIM_MAGIC_HANDS_GROUND;
|
||||
} else {
|
||||
anim = ANIM_MAGIC_HANDS_MIDDLE;
|
||||
@@ -1134,9 +1134,9 @@ int _action_use_an_item_on_object(Object* user, Object* targetObj, Object* item)
|
||||
|
||||
if (item != nullptr) {
|
||||
// TODO: Get rid of cast.
|
||||
animationRegisterCallback3(user, targetObj, item, (AnimationCallback3*)objectUseItemOn, -1);
|
||||
animationRegisterCallback3(user, targetObj, item, (AnimationCallback3*)_obj_use_item_on, -1);
|
||||
} else {
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)objectUse, -1);
|
||||
animationRegisterCallback(user, targetObj, (AnimationCallback*)_obj_use, -1);
|
||||
}
|
||||
|
||||
if (weaponAnimCode != 0) {
|
||||
@@ -1182,7 +1182,7 @@ int actionPickUp(Object* critter, Object* item)
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(critter, item, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
|
||||
Proto* itemProto;
|
||||
protoGetProto(item->pid, &itemProto);
|
||||
@@ -1207,7 +1207,7 @@ int actionPickUp(Object* critter, Object* item)
|
||||
animationRegisterPlaySoundEffect(item, sfx, actionFrame);
|
||||
}
|
||||
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)objectPickup, actionFrame);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)_obj_pickup, actionFrame);
|
||||
} else {
|
||||
int weaponAnimationCode = (critter->fid & 0xF000) >> 12;
|
||||
if (weaponAnimationCode != 0) {
|
||||
@@ -1235,7 +1235,7 @@ int actionPickUp(Object* critter, Object* item)
|
||||
}
|
||||
|
||||
if (item->frame != 1) {
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)objectUseContainer, actionFrame);
|
||||
animationRegisterCallback(critter, item, (AnimationCallback*)_obj_use_container, actionFrame);
|
||||
}
|
||||
|
||||
if (weaponAnimationCode != 0) {
|
||||
@@ -1263,7 +1263,7 @@ int _action_loot_container(Object* critter, Object* container)
|
||||
}
|
||||
|
||||
// SFALL: Fix for trying to loot corpses with the "NoSteal" flag.
|
||||
if (critterFlagCheck(container->pid, CRITTER_NO_STEAL)) {
|
||||
if (_critter_flag_check(container->pid, CRITTER_NO_STEAL)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1288,7 +1288,7 @@ int _action_loot_container(Object* critter, Object* container)
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(critter, container, (AnimationCallback*)_is_next_to, -1);
|
||||
animationRegisterCallback(critter, container, (AnimationCallback*)checkSceneryUseActionPointCost, -1);
|
||||
animationRegisterCallback(critter, container, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
animationRegisterCallback(critter, container, (AnimationCallback*)scriptsRequestLooting, -1);
|
||||
return reg_anim_end();
|
||||
}
|
||||
@@ -1494,7 +1494,7 @@ int actionUseSkill(Object* user, Object* target, int skill)
|
||||
|
||||
animationRegisterCallbackForced(performer, target, (AnimationCallback*)_is_next_to, -1);
|
||||
|
||||
int anim = (FID_TYPE(target->fid) == OBJ_TYPE_CRITTER && critterIsProne(target)) ? ANIM_MAGIC_HANDS_GROUND : ANIM_MAGIC_HANDS_MIDDLE;
|
||||
int anim = (FID_TYPE(target->fid) == OBJ_TYPE_CRITTER && _critter_is_prone(target)) ? ANIM_MAGIC_HANDS_GROUND : ANIM_MAGIC_HANDS_MIDDLE;
|
||||
int fid = buildFid(OBJ_TYPE_CRITTER, performer->fid & 0xFFF, anim, 0, performer->rotation + 1);
|
||||
|
||||
CacheEntry* artHandle;
|
||||
@@ -1506,7 +1506,7 @@ int actionUseSkill(Object* user, Object* target, int skill)
|
||||
|
||||
animationRegisterAnimate(performer, anim, -1);
|
||||
// TODO: Get rid of casts.
|
||||
animationRegisterCallback3(performer, target, (void*)(uintptr_t)skill, (AnimationCallback3*)objectUseSkillOn, -1);
|
||||
animationRegisterCallback3(performer, target, (void*)(uintptr_t)skill, (AnimationCallback3*)_obj_use_skill_on, -1);
|
||||
return reg_anim_end();
|
||||
}
|
||||
|
||||
@@ -1753,7 +1753,7 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
||||
xp += critterGetExp(attack->defender);
|
||||
}
|
||||
} else {
|
||||
critterSetWhoHitMe(attack->defender, sourceObj);
|
||||
_critter_set_who_hit_me(attack->defender, sourceObj);
|
||||
anyDefender = attack->defender;
|
||||
}
|
||||
}
|
||||
@@ -1766,7 +1766,7 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
||||
xp += critterGetExp(critter);
|
||||
}
|
||||
} else {
|
||||
critterSetWhoHitMe(critter, sourceObj);
|
||||
_critter_set_who_hit_me(critter, sourceObj);
|
||||
|
||||
if (anyDefender == nullptr) {
|
||||
anyDefender = critter;
|
||||
@@ -1972,7 +1972,7 @@ int _report_dmg(Attack* attack, Object* _)
|
||||
// 0x413660
|
||||
int _compute_dmg_damage(int min, int max, Object* obj, int* knockbackDistancePtr, int damageType)
|
||||
{
|
||||
if (!critterFlagCheck(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
if (!_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
knockbackDistancePtr = nullptr;
|
||||
}
|
||||
|
||||
@@ -2046,7 +2046,7 @@ int actionPush(Object* obj, Object* target)
|
||||
}
|
||||
|
||||
int sid;
|
||||
if (objectGetSid(target, &sid) == 0) {
|
||||
if (_obj_sid(target, &sid) == 0) {
|
||||
scriptSetObjects(sid, obj, target);
|
||||
scriptExecProc(sid, SCRIPT_PROC_PUSH);
|
||||
|
||||
|
||||
+24
-24
@@ -1418,7 +1418,7 @@ static int animationRunSequence(int animationSequenceIndex)
|
||||
rc = _anim_animate(animationDescription->owner, animationDescription->anim, animationSequenceIndex, ANIM_SAD_FOREVER);
|
||||
break;
|
||||
case ANIM_KIND_ROTATE_TO_TILE:
|
||||
if (!critterIsProne(animationDescription->owner)) {
|
||||
if (!_critter_is_prone(animationDescription->owner)) {
|
||||
int rotation = tileGetRotationTo(animationDescription->owner->tile, animationDescription->tile);
|
||||
_dude_stand(animationDescription->owner, rotation, -1);
|
||||
}
|
||||
@@ -1637,7 +1637,7 @@ static int _anim_set_end(int animationSequenceIndex)
|
||||
}
|
||||
}
|
||||
|
||||
if ((animationSequence->flags & ANIM_SEQ_NO_STAND) == 0 && !critterIsProne(owner)) {
|
||||
if ((animationSequence->flags & ANIM_SEQ_NO_STAND) == 0 && !_critter_is_prone(owner)) {
|
||||
_dude_stand(owner, owner->rotation, -1);
|
||||
}
|
||||
}
|
||||
@@ -1755,7 +1755,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
||||
|
||||
int toScreenX;
|
||||
int toScreenY;
|
||||
tileToScreenXY(to, &toScreenX, &toScreenY);
|
||||
tileToScreenXY(to, &toScreenX, &toScreenY, object->elevation);
|
||||
|
||||
int closedPathNodeListLength = 0;
|
||||
int openPathNodeListLength = 1;
|
||||
@@ -1840,7 +1840,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
||||
|
||||
int newX;
|
||||
int newY;
|
||||
tileToScreenXY(tile, &newX, &newY);
|
||||
tileToScreenXY(tile, &newX, &newY, object->elevation);
|
||||
|
||||
v27->estimate = _idist(newX, newY, toScreenX, toScreenY);
|
||||
v27->cost = temp.cost + 50;
|
||||
@@ -1940,11 +1940,11 @@ static int _tile_idistance(int tile1, int tile2)
|
||||
{
|
||||
int x1;
|
||||
int y1;
|
||||
tileToScreenXY(tile1, &x1, &y1);
|
||||
tileToScreenXY(tile1, &x1, &y1, gElevation);
|
||||
|
||||
int x2;
|
||||
int y2;
|
||||
tileToScreenXY(tile2, &x2, &y2);
|
||||
tileToScreenXY(tile2, &x2, &y2, gElevation);
|
||||
|
||||
return _idist(x1, y1, x2, y2);
|
||||
}
|
||||
@@ -1977,13 +1977,13 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
|
||||
int fromX;
|
||||
int fromY;
|
||||
tileToScreenXY(from, &fromX, &fromY);
|
||||
tileToScreenXY(from, &fromX, &fromY, obj->elevation);
|
||||
fromX += 16;
|
||||
fromY += 8;
|
||||
|
||||
int toX;
|
||||
int toY;
|
||||
tileToScreenXY(to, &toX, &toY);
|
||||
tileToScreenXY(to, &toX, &toY, obj->elevation);
|
||||
toX += 16;
|
||||
toY += 8;
|
||||
|
||||
@@ -2021,7 +2021,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
if (ddx <= ddy) {
|
||||
int middle = ddx - ddy / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, obj->elevation);
|
||||
|
||||
v22 += 1;
|
||||
if (v22 == a6) {
|
||||
@@ -2034,7 +2034,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2074,7 +2074,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
} else {
|
||||
int middle = ddy - ddx / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, obj->elevation);
|
||||
|
||||
v22 += 1;
|
||||
if (v22 == a6) {
|
||||
@@ -2087,7 +2087,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2136,7 +2136,7 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2201,13 +2201,13 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
|
||||
int fromX;
|
||||
int fromY;
|
||||
tileToScreenXY(from, &fromX, &fromY);
|
||||
tileToScreenXY(from, &fromX, &fromY, fromElevation);
|
||||
fromX += 16;
|
||||
fromY += 8;
|
||||
|
||||
int toX;
|
||||
int toY;
|
||||
tileToScreenXY(to, &toX, &toY);
|
||||
tileToScreenXY(to, &toX, &toY, toElevation);
|
||||
toX += 16;
|
||||
toY += 8;
|
||||
|
||||
@@ -2250,7 +2250,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
if (ddx > ddy) {
|
||||
int middle = ddy - ddx / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, elevation);
|
||||
|
||||
iteration += 1;
|
||||
if (iteration == 16) {
|
||||
@@ -2263,7 +2263,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2297,7 +2297,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
} else {
|
||||
int middle = ddx - ddy / 2;
|
||||
while (true) {
|
||||
tile = tileFromScreenXY(tileX, tileY);
|
||||
tile = tileFromScreenXY(tileX, tileY, elevation);
|
||||
|
||||
iteration += 1;
|
||||
if (iteration == 16) {
|
||||
@@ -2310,7 +2310,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2353,7 +2353,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY);
|
||||
tileToScreenXY(tile, &fromX, &fromY, elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
@@ -2613,7 +2613,7 @@ static void _object_move(int index)
|
||||
}
|
||||
nextTile = -1;
|
||||
} else {
|
||||
objectUseDoor(object, obstacle, 0);
|
||||
_obj_use_door(object, obstacle, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2962,7 +2962,7 @@ int _check_move(int* actionPointsPtr)
|
||||
int y;
|
||||
mouseGetPosition(&x, &y);
|
||||
|
||||
int tile = tileFromScreenXY(x, y);
|
||||
int tile = tileFromScreenXY(x, y, gElevation);
|
||||
if (tile == -1) {
|
||||
return -1;
|
||||
}
|
||||
@@ -3219,7 +3219,7 @@ void _dude_standup(Object* a1)
|
||||
// 0x4185EC
|
||||
static int actionRotate(Object* obj, int delta, int animationSequenceIndex)
|
||||
{
|
||||
if (!critterIsProne(obj)) {
|
||||
if (!_critter_is_prone(obj)) {
|
||||
int rotation = obj->rotation + delta;
|
||||
if (rotation >= ROTATION_COUNT) {
|
||||
rotation = ROTATION_NE;
|
||||
@@ -3293,7 +3293,7 @@ static int _check_gravity(int tile, int elevation)
|
||||
for (; elevation > 0; elevation--) {
|
||||
int x;
|
||||
int y;
|
||||
tileToScreenXY(tile, &x, &y);
|
||||
tileToScreenXY(tile, &x, &y, elevation);
|
||||
|
||||
int squareTile = squareTileFromScreenXY(x + 2, y + 8, elevation);
|
||||
int fid = buildFid(OBJ_TYPE_TILE, _square[elevation]->field_0[squareTile] & 0xFFF, 0, 0, 0);
|
||||
|
||||
+53
-51
@@ -542,72 +542,72 @@ int artCopyFileName(int objectType, int id, char* dest)
|
||||
}
|
||||
|
||||
// 0x419314
|
||||
int _art_get_code(int animation, int weaponType, char* weaponCodePtr, char* animationCodePtr)
|
||||
int _art_get_code(int animation, int weaponType, char* a3, char* a4)
|
||||
{
|
||||
if (weaponType < 0 || weaponType >= WEAPON_ANIMATION_COUNT) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (animation >= ANIM_TAKE_OUT && animation <= ANIM_FIRE_CONTINUOUS) {
|
||||
*animationCodePtr = 'c' + (animation - ANIM_TAKE_OUT);
|
||||
*a4 = 'c' + (animation - ANIM_TAKE_OUT);
|
||||
if (weaponType == WEAPON_ANIMATION_NONE) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*weaponCodePtr = 'd' + (weaponType - 1);
|
||||
*a3 = 'd' + (weaponType - 1);
|
||||
return 0;
|
||||
} else if (animation == ANIM_PRONE_TO_STANDING) {
|
||||
*animationCodePtr = 'h';
|
||||
*weaponCodePtr = 'c';
|
||||
*a4 = 'h';
|
||||
*a3 = 'c';
|
||||
return 0;
|
||||
} else if (animation == ANIM_BACK_TO_STANDING) {
|
||||
*animationCodePtr = 'j';
|
||||
*weaponCodePtr = 'c';
|
||||
*a4 = 'j';
|
||||
*a3 = 'c';
|
||||
return 0;
|
||||
} else if (animation == ANIM_CALLED_SHOT_PIC) {
|
||||
*animationCodePtr = 'a';
|
||||
*weaponCodePtr = 'n';
|
||||
*a4 = 'a';
|
||||
*a3 = 'n';
|
||||
return 0;
|
||||
} else if (animation >= FIRST_SF_DEATH_ANIM) {
|
||||
*animationCodePtr = 'a' + (animation - FIRST_SF_DEATH_ANIM);
|
||||
*weaponCodePtr = 'r';
|
||||
*a4 = 'a' + (animation - FIRST_SF_DEATH_ANIM);
|
||||
*a3 = 'r';
|
||||
return 0;
|
||||
} else if (animation >= FIRST_KNOCKDOWN_AND_DEATH_ANIM) {
|
||||
*animationCodePtr = 'a' + (animation - FIRST_KNOCKDOWN_AND_DEATH_ANIM);
|
||||
*weaponCodePtr = 'b';
|
||||
*a4 = 'a' + (animation - FIRST_KNOCKDOWN_AND_DEATH_ANIM);
|
||||
*a3 = 'b';
|
||||
return 0;
|
||||
} else if (animation == ANIM_THROW_ANIM) {
|
||||
if (weaponType == WEAPON_ANIMATION_KNIFE) {
|
||||
// knife
|
||||
*weaponCodePtr = 'd';
|
||||
*animationCodePtr = 'm';
|
||||
*a3 = 'd';
|
||||
*a4 = 'm';
|
||||
} else if (weaponType == WEAPON_ANIMATION_SPEAR) {
|
||||
// spear
|
||||
*weaponCodePtr = 'g';
|
||||
*animationCodePtr = 'm';
|
||||
*a3 = 'g';
|
||||
*a4 = 'm';
|
||||
} else {
|
||||
// other -> probably rock or grenade
|
||||
*weaponCodePtr = 'a';
|
||||
*animationCodePtr = 's';
|
||||
*a3 = 'a';
|
||||
*a4 = 's';
|
||||
}
|
||||
return 0;
|
||||
} else if (animation == ANIM_DODGE_ANIM) {
|
||||
if (weaponType <= 0) {
|
||||
*weaponCodePtr = 'a';
|
||||
*animationCodePtr = 'n';
|
||||
*a3 = 'a';
|
||||
*a4 = 'n';
|
||||
} else {
|
||||
*weaponCodePtr = 'd' + (weaponType - 1);
|
||||
*animationCodePtr = 'e';
|
||||
*a3 = 'd' + (weaponType - 1);
|
||||
*a4 = 'e';
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
*animationCodePtr = 'a' + animation;
|
||||
*a4 = 'a' + animation;
|
||||
if (animation <= ANIM_WALK && weaponType > 0) {
|
||||
*weaponCodePtr = 'd' + (weaponType - 1);
|
||||
*a3 = 'd' + (weaponType - 1);
|
||||
return 0;
|
||||
}
|
||||
*weaponCodePtr = 'a';
|
||||
*a3 = 'a';
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -615,51 +615,53 @@ int _art_get_code(int animation, int weaponType, char* weaponCodePtr, char* anim
|
||||
// 0x419428
|
||||
char* artBuildFilePath(int fid)
|
||||
{
|
||||
int baseFid = fid;
|
||||
int rotation = FID_ROTATION(fid);
|
||||
int v1, v2, v3, v4, v5, type, v8, v10;
|
||||
char v9, v11, v12;
|
||||
|
||||
int aliasFid = artAliasFid(fid);
|
||||
if (aliasFid != -1) {
|
||||
baseFid = aliasFid;
|
||||
v2 = fid;
|
||||
|
||||
v10 = FID_ROTATION(fid);
|
||||
|
||||
v1 = artAliasFid(fid);
|
||||
if (v1 != -1) {
|
||||
v2 = v1;
|
||||
}
|
||||
|
||||
*_art_name = '\0';
|
||||
|
||||
int frmId = baseFid & 0xFFF;
|
||||
int animType = FID_ANIM_TYPE(baseFid);
|
||||
int weaponCode = (baseFid & 0xF000) >> 12;
|
||||
int objectType = FID_TYPE(baseFid);
|
||||
v3 = v2 & 0xFFF;
|
||||
v4 = FID_ANIM_TYPE(v2);
|
||||
v5 = (v2 & 0xF000) >> 12;
|
||||
type = FID_TYPE(v2);
|
||||
|
||||
if (objectType < OBJ_TYPE_ITEM || objectType >= OBJ_TYPE_COUNT) {
|
||||
if (type < OBJ_TYPE_ITEM || type >= OBJ_TYPE_COUNT) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (frmId >= gArtListDescriptions[objectType].fileNamesLength) {
|
||||
if (v3 >= gArtListDescriptions[type].fileNamesLength) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int fileNameOffset = frmId * 13;
|
||||
v8 = v3 * 13;
|
||||
|
||||
if (objectType == OBJ_TYPE_CRITTER) {
|
||||
char critterWeaponCode;
|
||||
char critterAnimationCode;
|
||||
if (_art_get_code(animType, weaponCode, &critterWeaponCode, &critterAnimationCode) == -1) {
|
||||
if (type == 1) {
|
||||
if (_art_get_code(v4, v5, &v11, &v12) == -1) {
|
||||
return nullptr;
|
||||
}
|
||||
if (rotation != 0) {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.fr%c", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_CRITTER].name, gArtListDescriptions[OBJ_TYPE_CRITTER].fileNames + fileNameOffset, critterWeaponCode, critterAnimationCode, rotation + 47);
|
||||
if (v10) {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.fr%c", _cd_path_base, "art\\", gArtListDescriptions[1].name, gArtListDescriptions[1].fileNames + v8, v11, v12, v10 + 47);
|
||||
} else {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_CRITTER].name, gArtListDescriptions[OBJ_TYPE_CRITTER].fileNames + fileNameOffset, critterWeaponCode, critterAnimationCode);
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[1].name, gArtListDescriptions[1].fileNames + v8, v11, v12);
|
||||
}
|
||||
} else if (objectType == OBJ_TYPE_HEAD) {
|
||||
char headSuffix = _head2[animType];
|
||||
if (headSuffix == 'f') {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c%d.frm", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_HEAD].name, gArtListDescriptions[OBJ_TYPE_HEAD].fileNames + fileNameOffset, _head1[animType], 102, weaponCode);
|
||||
} else if (type == 8) {
|
||||
v9 = _head2[v4];
|
||||
if (v9 == 'f') {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c%d.frm", _cd_path_base, "art\\", gArtListDescriptions[8].name, gArtListDescriptions[8].fileNames + v8, _head1[v4], 102, v5);
|
||||
} else {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_HEAD].name, gArtListDescriptions[OBJ_TYPE_HEAD].fileNames + fileNameOffset, _head1[animType], headSuffix);
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s%c%c.frm", _cd_path_base, "art\\", gArtListDescriptions[8].name, gArtListDescriptions[8].fileNames + v8, _head1[v4], v9);
|
||||
}
|
||||
} else {
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s", _cd_path_base, "art\\", gArtListDescriptions[objectType].name, gArtListDescriptions[objectType].fileNames + fileNameOffset);
|
||||
snprintf(_art_name, sizeof(_art_name), "%s%s%s\\%s", _cd_path_base, "art\\", gArtListDescriptions[type].name, gArtListDescriptions[type].fileNames + v8);
|
||||
}
|
||||
|
||||
return _art_name;
|
||||
|
||||
@@ -129,8 +129,8 @@ 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 id, char* dest);
|
||||
int _art_get_code(int animation, int weaponType, char* weaponCodePtr, char* animationCodePtr);
|
||||
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);
|
||||
@@ -138,7 +138,7 @@ int artGetFrameCount(Art* art);
|
||||
int artGetWidth(Art* art, int frame, int direction);
|
||||
int artGetHeight(Art* art, int frame, int direction);
|
||||
int artGetSize(Art* art, int frame, int direction, int* out_width, int* out_height);
|
||||
int artGetFrameOffsets(Art* art, int frame, int direction, int* xPtr, int* yPtr);
|
||||
int artGetFrameOffsets(Art* art, int frame, int direction, int* a4, int* a5);
|
||||
int artGetRotationOffsets(Art* art, int rotation, int* out_offset_x, int* out_offset_y);
|
||||
unsigned char* artGetFrameData(Art* art, int frame, int direction);
|
||||
ArtFrame* artGetFrame(Art* art, int frame, int direction);
|
||||
|
||||
+6
-6
@@ -148,7 +148,7 @@ long audioSeek(int handle, long offset, int origin)
|
||||
{
|
||||
int pos;
|
||||
unsigned char* buf;
|
||||
int remainingBytesToSkip;
|
||||
int v10;
|
||||
|
||||
Audio* audioFile = &(gAudioList[handle - 1]);
|
||||
|
||||
@@ -189,14 +189,14 @@ long audioSeek(int handle, long offset, int origin)
|
||||
}
|
||||
} else {
|
||||
buf = (unsigned char*)internal_malloc_safe(1024, __FILE__, __LINE__); // "..\int\audio.c", 321
|
||||
remainingBytesToSkip = audioFile->position - pos;
|
||||
while (remainingBytesToSkip > 1024) {
|
||||
remainingBytesToSkip -= 1024;
|
||||
v10 = audioFile->position - pos;
|
||||
while (v10 > 1024) {
|
||||
v10 -= 1024;
|
||||
audioRead(handle, buf, 1024);
|
||||
}
|
||||
|
||||
if (remainingBytesToSkip != 0) {
|
||||
audioRead(handle, buf, remainingBytesToSkip);
|
||||
if (v10 != 0) {
|
||||
audioRead(handle, buf, v10);
|
||||
}
|
||||
|
||||
// TODO: Probably leaks memory.
|
||||
|
||||
+11
-11
@@ -148,26 +148,26 @@ long audioFileSeek(int handle, long offset, int origin)
|
||||
{
|
||||
void* buf;
|
||||
int remaining;
|
||||
int targetPosition;
|
||||
int a4;
|
||||
|
||||
AudioFile* audioFile = &(gAudioFileList[handle - 1]);
|
||||
|
||||
switch (origin) {
|
||||
case SEEK_SET:
|
||||
targetPosition = offset;
|
||||
a4 = offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
targetPosition = audioFile->fileSize + offset;
|
||||
a4 = audioFile->fileSize + offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
targetPosition = audioFile->position + offset;
|
||||
a4 = audioFile->position + offset;
|
||||
break;
|
||||
default:
|
||||
assert(false && "Should be unreachable");
|
||||
}
|
||||
|
||||
if ((audioFile->flags & AUDIO_FILE_COMPRESSED) != 0) {
|
||||
if (targetPosition <= audioFile->position) {
|
||||
if (a4 <= audioFile->position) {
|
||||
soundDecoderFree(audioFile->soundDecoder);
|
||||
|
||||
fseek(audioFile->stream, 0, 0);
|
||||
@@ -176,20 +176,20 @@ long audioFileSeek(int handle, long offset, int origin)
|
||||
audioFile->fileSize *= 2;
|
||||
audioFile->position = 0;
|
||||
|
||||
if (targetPosition != 0) {
|
||||
if (a4) {
|
||||
buf = internal_malloc_safe(4096, __FILE__, __LINE__); // "..\int\audiof.c", 364
|
||||
while (targetPosition > 4096) {
|
||||
while (a4 > 4096) {
|
||||
audioFileRead(handle, buf, 4096);
|
||||
targetPosition -= 4096;
|
||||
a4 -= 4096;
|
||||
}
|
||||
if (targetPosition != 0) {
|
||||
audioFileRead(handle, buf, targetPosition);
|
||||
if (a4 != 0) {
|
||||
audioFileRead(handle, buf, a4);
|
||||
}
|
||||
internal_free_safe(buf, __FILE__, __LINE__); // "..\int\audiof.c", 370
|
||||
}
|
||||
} else {
|
||||
buf = internal_malloc_safe(0x400, __FILE__, __LINE__); // "..\int\audiof.c", 316
|
||||
remaining = audioFile->position - targetPosition;
|
||||
remaining = audioFile->position - a4;
|
||||
while (remaining > 1024) {
|
||||
audioFileRead(handle, buf, 1024);
|
||||
remaining -= 1024;
|
||||
|
||||
+25
-25
@@ -373,7 +373,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
||||
frmImages[AUTOMAP_FRM_SWITCH_UP].getData(),
|
||||
frmImages[AUTOMAP_FRM_SWITCH_DOWN].getData(),
|
||||
nullptr,
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_CHECKABLE);
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_0x01);
|
||||
if (switchBtn != -1) {
|
||||
buttonSetCallbacks(switchBtn, _gsound_toggle_butt_press_, _gsound_toggle_butt_press_);
|
||||
}
|
||||
@@ -550,7 +550,7 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
|
||||
}
|
||||
}
|
||||
|
||||
int pixelOffset = -2 * (object->tile % 200) - 10 + AUTOMAP_WINDOW_WIDTH * (2 * (object->tile / 200) + 9) - 60;
|
||||
int v10 = -2 * (object->tile % 200) - 10 + AUTOMAP_WINDOW_WIDTH * (2 * (object->tile / 200) + 9) - 60;
|
||||
if ((flags & AUTOMAP_IN_GAME) == 0) {
|
||||
switch (objectType) {
|
||||
case OBJ_TYPE_ITEM:
|
||||
@@ -574,28 +574,28 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
|
||||
}
|
||||
|
||||
if (objectColor != _colorTable[0]) {
|
||||
unsigned char* pixel = windowBuffer + pixelOffset;
|
||||
unsigned char* v12 = windowBuffer + v10;
|
||||
if ((flags & AUTOMAP_IN_GAME) != 0) {
|
||||
if (*pixel != _colorTable[992] || objectColor != _colorTable[480]) {
|
||||
pixel[0] = objectColor;
|
||||
pixel[1] = objectColor;
|
||||
if (*v12 != _colorTable[992] || objectColor != _colorTable[480]) {
|
||||
v12[0] = objectColor;
|
||||
v12[1] = objectColor;
|
||||
}
|
||||
|
||||
if (object == gDude) {
|
||||
pixel[-1] = objectColor;
|
||||
pixel[-AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
v12[-1] = objectColor;
|
||||
v12[-AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
}
|
||||
} else {
|
||||
pixel[0] = objectColor;
|
||||
pixel[1] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH + 1] = objectColor;
|
||||
v12[0] = objectColor;
|
||||
v12[1] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH + 1] = objectColor;
|
||||
|
||||
pixel[AUTOMAP_WINDOW_WIDTH - 1] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH + 2] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH * 2] = objectColor;
|
||||
pixel[AUTOMAP_WINDOW_WIDTH * 2 + 1] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH - 1] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH + 2] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH * 2] = objectColor;
|
||||
v12[AUTOMAP_WINDOW_WIDTH * 2 + 1] = objectColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -639,8 +639,8 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int bitsRemaining = 0; // Number of 2-bit tile entries left in `byte`.
|
||||
unsigned char byte = 0;
|
||||
int v1 = 0;
|
||||
unsigned char v2 = 0;
|
||||
unsigned char* ptr = gAutomapEntry.data;
|
||||
|
||||
// FIXME: This loop is implemented incorrectly. Automap requires 400x400 px,
|
||||
@@ -650,13 +650,13 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
// crash.
|
||||
for (int y = 0; y < HEX_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < HEX_GRID_WIDTH; x++) {
|
||||
bitsRemaining -= 1;
|
||||
if (bitsRemaining <= 0) {
|
||||
bitsRemaining = 4;
|
||||
byte = *ptr++;
|
||||
v1 -= 1;
|
||||
if (v1 <= 0) {
|
||||
v1 = 4;
|
||||
v2 = *ptr++;
|
||||
}
|
||||
|
||||
switch ((byte & 0xC0) >> 6) {
|
||||
switch ((v2 & 0xC0) >> 6) {
|
||||
case 1:
|
||||
*windowBuffer++ = wallColor;
|
||||
*windowBuffer++ = wallColor;
|
||||
@@ -670,7 +670,7 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
||||
break;
|
||||
}
|
||||
|
||||
byte <<= 2;
|
||||
v2 <<= 2;
|
||||
}
|
||||
|
||||
windowBuffer += 640 + 240;
|
||||
|
||||
+12
-12
@@ -575,26 +575,26 @@ static bool cacheSetCapacity(Cache* cache, int newCapacity)
|
||||
// 0x420A74
|
||||
static int cacheEntriesCompareByUsage(const void* a1, const void* a2)
|
||||
{
|
||||
CacheEntry* lhs = *(CacheEntry**)a1;
|
||||
CacheEntry* rhs = *(CacheEntry**)a2;
|
||||
CacheEntry* v1 = *(CacheEntry**)a1;
|
||||
CacheEntry* v2 = *(CacheEntry**)a2;
|
||||
|
||||
if (lhs->referenceCount != 0 && rhs->referenceCount == 0) {
|
||||
if (v1->referenceCount != 0 && v2->referenceCount == 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (rhs->referenceCount != 0 && lhs->referenceCount == 0) {
|
||||
if (v2->referenceCount != 0 && v1->referenceCount == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (lhs->hits < rhs->hits) {
|
||||
if (v1->hits < v2->hits) {
|
||||
return -1;
|
||||
} else if (lhs->hits > rhs->hits) {
|
||||
} else if (v1->hits > v2->hits) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (lhs->mru < rhs->mru) {
|
||||
if (v1->mru < v2->mru) {
|
||||
return -1;
|
||||
} else if (lhs->mru > rhs->mru) {
|
||||
} else if (v1->mru > v2->mru) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -604,12 +604,12 @@ static int cacheEntriesCompareByUsage(const void* a1, const void* a2)
|
||||
// 0x420AE8
|
||||
static int cacheEntriesCompareByMostRecentHit(const void* a1, const void* a2)
|
||||
{
|
||||
CacheEntry* lhs = *(CacheEntry**)a1;
|
||||
CacheEntry* rhs = *(CacheEntry**)a2;
|
||||
CacheEntry* v1 = *(CacheEntry**)a1;
|
||||
CacheEntry* v2 = *(CacheEntry**)a2;
|
||||
|
||||
if (lhs->mru < rhs->mru) {
|
||||
if (v1->mru < v2->mru) {
|
||||
return 1;
|
||||
} else if (lhs->mru > rhs->mru) {
|
||||
} else if (v1->mru > v2->mru) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
|
||||
@@ -3627,7 +3627,7 @@ static void characterEditorEditGender()
|
||||
_editorFrmImages[EDITOR_GRAPHIC_MALE_OFF].getData(),
|
||||
_editorFrmImages[EDITOR_GRAPHIC_MALE_ON].getData(),
|
||||
nullptr,
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_NO_TOGGLE_OFF | BUTTON_FLAG_CHECK_ON_DOWN | BUTTON_FLAG_CHECKABLE);
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_0x04 | BUTTON_FLAG_0x02 | BUTTON_FLAG_0x01);
|
||||
if (btns[0] != -1) {
|
||||
buttonSetCallbacks(doneBtn, _gsound_red_butt_press, nullptr);
|
||||
}
|
||||
@@ -3644,7 +3644,7 @@ static void characterEditorEditGender()
|
||||
_editorFrmImages[EDITOR_GRAPHIC_FEMALE_OFF].getData(),
|
||||
_editorFrmImages[EDITOR_GRAPHIC_FEMALE_ON].getData(),
|
||||
nullptr,
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_NO_TOGGLE_OFF | BUTTON_FLAG_CHECK_ON_DOWN | BUTTON_FLAG_CHECKABLE);
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_0x04 | BUTTON_FLAG_0x02 | BUTTON_FLAG_0x01);
|
||||
if (btns[1] != -1) {
|
||||
_win_group_radio_buttons(2, btns);
|
||||
buttonSetCallbacks(doneBtn, _gsound_red_butt_press, nullptr);
|
||||
@@ -3946,7 +3946,7 @@ static int characterEditorShowOptions()
|
||||
strcat(string4, "TXT");
|
||||
|
||||
char** fileList;
|
||||
int fileListLength = fileNameListInit(string4, &fileList);
|
||||
int fileListLength = fileNameListInit(string4, &fileList, 0, 0);
|
||||
if (fileListLength != -1) {
|
||||
// PRINT
|
||||
strcpy(string1, getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 616));
|
||||
@@ -4018,7 +4018,7 @@ static int characterEditorShowOptions()
|
||||
strcat(string4, "GCD");
|
||||
|
||||
char** fileNameList;
|
||||
int fileNameListLength = fileNameListInit(string4, &fileNameList);
|
||||
int fileNameListLength = fileNameListInit(string4, &fileNameList, 0, 0);
|
||||
if (fileNameListLength != -1) {
|
||||
// NOTE: This value is not copied as in save dialog.
|
||||
char* title = getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 601);
|
||||
@@ -4111,7 +4111,7 @@ static int characterEditorShowOptions()
|
||||
strcat(string4, "GCD");
|
||||
|
||||
char** fileNameList;
|
||||
int fileNameListLength = fileNameListInit(string4, &fileNameList);
|
||||
int fileNameListLength = fileNameListInit(string4, &fileNameList, 0, 0);
|
||||
if (fileNameListLength != -1) {
|
||||
strcpy(string1, getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 617));
|
||||
strcpy(string4, getmsg(&gCharacterEditorMessageList, &gCharacterEditorMessageListItem, 600));
|
||||
@@ -4198,7 +4198,7 @@ static int characterEditorShowOptions()
|
||||
strcpy(pattern, "*.TXT");
|
||||
|
||||
char** fileNames;
|
||||
int filesCount = fileNameListInit(pattern, &fileNames);
|
||||
int filesCount = fileNameListInit(pattern, &fileNames, 0, 0);
|
||||
if (filesCount == -1) {
|
||||
soundPlayFile("iisxxxx1");
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ typedef enum PremadeCharacter {
|
||||
typedef struct PremadeCharacterDescription {
|
||||
char fileName[20];
|
||||
int face;
|
||||
char vid[20];
|
||||
char field_18[20];
|
||||
} PremadeCharacterDescription;
|
||||
|
||||
static bool characterSelectorWindowInit();
|
||||
@@ -959,7 +959,7 @@ void premadeCharactersInit()
|
||||
|
||||
faceFidsString = pch + 1;
|
||||
|
||||
gCustomPremadeCharacterDescriptions[index].vid[0] = '\0';
|
||||
gCustomPremadeCharacterDescriptions[index].field_18[0] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -969,7 +969,7 @@ void premadeCharactersInit()
|
||||
for (int index = 0; index < PREMADE_CHARACTER_COUNT; index++) {
|
||||
strcpy(gCustomPremadeCharacterDescriptions[index].fileName, gPremadeCharacterDescriptions[index].fileName);
|
||||
gCustomPremadeCharacterDescriptions[index].face = gPremadeCharacterDescriptions[index].face;
|
||||
strcpy(gCustomPremadeCharacterDescriptions[index].vid, gPremadeCharacterDescriptions[index].vid);
|
||||
strcpy(gCustomPremadeCharacterDescriptions[index].field_18, gPremadeCharacterDescriptions[index].field_18);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+83
-71
@@ -11,9 +11,9 @@
|
||||
|
||||
namespace fallout {
|
||||
|
||||
static void _setIntensityTableColor(int color);
|
||||
static void _setIntensityTableColor(int a1);
|
||||
static void _setIntensityTables();
|
||||
static void _setMixTableColor(int color);
|
||||
static void _setMixTableColor(int a1);
|
||||
static void _buildBlendTable(unsigned char* ptr, unsigned char ch);
|
||||
static void _rebuildColorBlendTables();
|
||||
|
||||
@@ -203,76 +203,88 @@ static void _setIntensityTables()
|
||||
}
|
||||
|
||||
// 0x4C769C
|
||||
static void _setMixTableColor(int color)
|
||||
static void _setMixTableColor(int a1)
|
||||
{
|
||||
for (int otherColor = 0; otherColor < 256; otherColor++) {
|
||||
if (_mappedColor[color] && _mappedColor[otherColor]) {
|
||||
int colorRgb = Color2RGB(color);
|
||||
int otherColorRgb = Color2RGB(otherColor);
|
||||
int i;
|
||||
int v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19;
|
||||
int v20, v21, v22, v23, v24, v25, v26, v27, v28, v29;
|
||||
|
||||
int colorR = (colorRgb & 0x7C00) >> 10;
|
||||
int colorG = (colorRgb & 0x3E0) >> 5;
|
||||
int colorB = colorRgb & 0x1F;
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (_mappedColor[a1] && _mappedColor[i]) {
|
||||
v2 = (Color2RGB(a1) & 0x7C00) >> 10;
|
||||
v3 = (Color2RGB(a1) & 0x3E0) >> 5;
|
||||
v4 = (Color2RGB(a1) & 0x1F);
|
||||
|
||||
int otherColorR = (otherColorRgb & 0x7C00) >> 10;
|
||||
int otherColorG = (otherColorRgb & 0x3E0) >> 5;
|
||||
int otherColorB = otherColorRgb & 0x1F;
|
||||
v5 = (Color2RGB(i) & 0x7C00) >> 10;
|
||||
v6 = (Color2RGB(i) & 0x3E0) >> 5;
|
||||
v7 = (Color2RGB(i) & 0x1F);
|
||||
|
||||
int addedR = colorR + otherColorR;
|
||||
int addedG = colorG + otherColorG;
|
||||
int addedB = colorB + otherColorB;
|
||||
v8 = v2 + v5;
|
||||
v9 = v3 + v6;
|
||||
v10 = v4 + v7;
|
||||
|
||||
int maxAddedChannel = addedR;
|
||||
if (addedG > maxAddedChannel) {
|
||||
maxAddedChannel = addedG;
|
||||
}
|
||||
if (addedB > maxAddedChannel) {
|
||||
maxAddedChannel = addedB;
|
||||
v11 = v8;
|
||||
|
||||
if (v9 > v11) {
|
||||
v11 = v9;
|
||||
}
|
||||
|
||||
int additiveColor;
|
||||
if (maxAddedChannel <= 0x1F) {
|
||||
int paletteIndex = (addedR << 10) | (addedG << 5) | addedB;
|
||||
additiveColor = _colorTable[paletteIndex];
|
||||
if (v10 > v11) {
|
||||
v11 = v10;
|
||||
}
|
||||
|
||||
if (v11 <= 0x1F) {
|
||||
int paletteIndex = (v8 << 10) | (v9 << 5) | v10;
|
||||
v12 = _colorTable[paletteIndex];
|
||||
} else {
|
||||
int overflow = maxAddedChannel - 0x1F;
|
||||
v13 = v11 - 0x1F;
|
||||
|
||||
int normalizedR = addedR - overflow;
|
||||
int normalizedG = addedG - overflow;
|
||||
int normalizedB = addedB - overflow;
|
||||
v14 = v8 - v13;
|
||||
v15 = v9 - v13;
|
||||
v16 = v10 - v13;
|
||||
|
||||
if (normalizedR < 0) {
|
||||
normalizedR = 0;
|
||||
}
|
||||
if (normalizedG < 0) {
|
||||
normalizedG = 0;
|
||||
}
|
||||
if (normalizedB < 0) {
|
||||
normalizedB = 0;
|
||||
if (v14 < 0) {
|
||||
v14 = 0;
|
||||
}
|
||||
|
||||
int saturatedPaletteIndex = (normalizedR << 10) | (normalizedG << 5) | normalizedB;
|
||||
int saturatedColor = _colorTable[saturatedPaletteIndex];
|
||||
if (v15 < 0) {
|
||||
v15 = 0;
|
||||
}
|
||||
|
||||
int intensity = (int)((((double)maxAddedChannel + (-31.0)) * 0.0078125 + 1.0) * 65536.0);
|
||||
additiveColor = _calculateColor(intensity, saturatedColor);
|
||||
if (v16 < 0) {
|
||||
v16 = 0;
|
||||
}
|
||||
|
||||
v17 = (v14 << 10) | (v15 << 5) | v16;
|
||||
v18 = _colorTable[v17];
|
||||
|
||||
v19 = (int)((((double)v11 + (-31.0)) * 0.0078125 + 1.0) * 65536.0);
|
||||
v12 = _calculateColor(v19, v18);
|
||||
}
|
||||
|
||||
colorMixAddTable[color][otherColor] = additiveColor;
|
||||
colorMixAddTable[a1][i] = v12;
|
||||
|
||||
int multipliedR = (colorR * otherColorR) >> 5;
|
||||
int multipliedG = (colorG * otherColorG) >> 5;
|
||||
int multipliedB = (colorB * otherColorB) >> 5;
|
||||
v20 = (Color2RGB(a1) & 0x7C00) >> 10;
|
||||
v21 = (Color2RGB(a1) & 0x3E0) >> 5;
|
||||
v22 = (Color2RGB(a1) & 0x1F);
|
||||
|
||||
int multiplyPaletteIndex = (multipliedR << 10) | (multipliedG << 5) | multipliedB;
|
||||
colorMixMulTable[color][otherColor] = _colorTable[multiplyPaletteIndex];
|
||||
v23 = (Color2RGB(i) & 0x7C00) >> 10;
|
||||
v24 = (Color2RGB(i) & 0x3E0) >> 5;
|
||||
v25 = (Color2RGB(i) & 0x1F);
|
||||
|
||||
v26 = (v20 * v23) >> 5;
|
||||
v27 = (v21 * v24) >> 5;
|
||||
v28 = (v22 * v25) >> 5;
|
||||
|
||||
v29 = (v26 << 10) | (v27 << 5) | v28;
|
||||
colorMixMulTable[a1][i] = _colorTable[v29];
|
||||
} else {
|
||||
if (_mappedColor[otherColor]) {
|
||||
colorMixAddTable[color][otherColor] = otherColor;
|
||||
colorMixMulTable[color][otherColor] = otherColor;
|
||||
if (_mappedColor[i]) {
|
||||
colorMixAddTable[a1][i] = i;
|
||||
colorMixMulTable[a1][i] = i;
|
||||
} else {
|
||||
colorMixAddTable[color][otherColor] = color;
|
||||
colorMixMulTable[color][otherColor] = color;
|
||||
colorMixAddTable[a1][i] = a1;
|
||||
colorMixMulTable[a1][i] = a1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,7 +376,7 @@ static void _buildBlendTable(unsigned char* ptr, unsigned char ch)
|
||||
{
|
||||
int r, g, b;
|
||||
int i, j;
|
||||
int mixedR, mixedG, mixedB;
|
||||
int v12, v14, v16;
|
||||
unsigned char* beg;
|
||||
|
||||
beg = ptr;
|
||||
@@ -380,7 +392,7 @@ static void _buildBlendTable(unsigned char* ptr, unsigned char ch)
|
||||
ptr += 256;
|
||||
|
||||
int b_1 = b;
|
||||
int blendWeight = 6;
|
||||
int v31 = 6;
|
||||
int g_1 = g;
|
||||
int r_1 = r;
|
||||
|
||||
@@ -390,31 +402,31 @@ static void _buildBlendTable(unsigned char* ptr, unsigned char ch)
|
||||
|
||||
for (j = 0; j < 7; j++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
mixedR = (Color2RGB(i) & 0x7C00) >> 10;
|
||||
mixedG = (Color2RGB(i) & 0x3E0) >> 5;
|
||||
mixedB = (Color2RGB(i) & 0x1F);
|
||||
v12 = (Color2RGB(i) & 0x7C00) >> 10;
|
||||
v14 = (Color2RGB(i) & 0x3E0) >> 5;
|
||||
v16 = (Color2RGB(i) & 0x1F);
|
||||
int index = 0;
|
||||
index |= (r_2 + mixedR * blendWeight) / 7 << 10;
|
||||
index |= (g_2 + mixedG * blendWeight) / 7 << 5;
|
||||
index |= (b_2 + mixedB * blendWeight) / 7;
|
||||
index |= (r_2 + v12 * v31) / 7 << 10;
|
||||
index |= (g_2 + v14 * v31) / 7 << 5;
|
||||
index |= (b_2 + v16 * v31) / 7;
|
||||
ptr[i] = _colorTable[index];
|
||||
}
|
||||
blendWeight--;
|
||||
v31--;
|
||||
ptr += 256;
|
||||
r_2 += r_1;
|
||||
g_2 += g_1;
|
||||
b_2 += b_1;
|
||||
}
|
||||
|
||||
int shadeStep = 0;
|
||||
int v18 = 0;
|
||||
for (j = 0; j < 6; j++) {
|
||||
int shadeIntensity = shadeStep / 7 + 0xFFFF;
|
||||
int v20 = v18 / 7 + 0xFFFF;
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
ptr[i] = _calculateColor(shadeIntensity, ch);
|
||||
ptr[i] = _calculateColor(v20, ch);
|
||||
}
|
||||
|
||||
shadeStep += 0x10000;
|
||||
v18 += 0x10000;
|
||||
ptr += 256;
|
||||
}
|
||||
}
|
||||
@@ -450,15 +462,15 @@ unsigned char* _getColorBlendTable(int ch)
|
||||
}
|
||||
|
||||
// 0x4C7E20
|
||||
void _freeColorBlendTable(int color)
|
||||
void _freeColorBlendTable(int a1)
|
||||
{
|
||||
unsigned char* blendTable = _blendTable[color];
|
||||
if (blendTable != nullptr) {
|
||||
int* count = (int*)(blendTable - sizeof(int));
|
||||
unsigned char* v2 = _blendTable[a1];
|
||||
if (v2 != nullptr) {
|
||||
int* count = (int*)(v2 - sizeof(int));
|
||||
*count -= 1;
|
||||
if (*count == 0) {
|
||||
internal_free(count);
|
||||
_blendTable[color] = nullptr;
|
||||
_blendTable[a1] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,11 +24,11 @@ void colorPaletteFadeBetween(unsigned char* oldPalette, unsigned char* newPalett
|
||||
void colorPaletteSetTransitionCallback(ColorTransitionCallback* callback);
|
||||
void _setSystemPalette(unsigned char* palette);
|
||||
unsigned char* _getSystemPalette();
|
||||
void _setSystemPaletteEntries(unsigned char* palette, int start, int end);
|
||||
void _setSystemPaletteEntries(unsigned char* a1, int a2, int a3);
|
||||
bool colorPaletteLoad(const char* path);
|
||||
char* _colorError();
|
||||
unsigned char* _getColorBlendTable(int ch);
|
||||
void _freeColorBlendTable(int color);
|
||||
void _freeColorBlendTable(int a1);
|
||||
void colorSetBrightness(double value);
|
||||
bool _initColors();
|
||||
void _colorsClose();
|
||||
|
||||
+20
-23
@@ -39,7 +39,6 @@
|
||||
#include "sfall_callbacks.h"
|
||||
#include "sfall_config.h"
|
||||
#include "sfall_global_scripts.h"
|
||||
#include "sfall_script_hooks.h"
|
||||
#include "skill.h"
|
||||
#include "stat.h"
|
||||
#include "svga.h"
|
||||
@@ -2840,7 +2839,7 @@ static void _combat_over()
|
||||
gameMouseSetMode(GAME_MOUSE_MODE_MOVE);
|
||||
interfaceRenderArmorClass(true);
|
||||
|
||||
if (critterIsProne(gDude) && !critterIsDead(gDude) && _combat_ending_guy == nullptr) {
|
||||
if (_critter_is_prone(gDude) && !critterIsDead(gDude) && _combat_ending_guy == nullptr) {
|
||||
queueRemoveEventsByType(gDude, EVENT_TYPE_KNOCKOUT);
|
||||
knockoutEventProcess(gDude, nullptr);
|
||||
}
|
||||
@@ -3014,11 +3013,11 @@ static void _combat_sequence_init(Object* attacker, Object* defender)
|
||||
_list_noncom -= next;
|
||||
|
||||
if (attacker != nullptr) {
|
||||
critterSetWhoHitMe(attacker, defender);
|
||||
_critter_set_who_hit_me(attacker, defender);
|
||||
}
|
||||
|
||||
if (defender != nullptr) {
|
||||
critterSetWhoHitMe(defender, attacker);
|
||||
_critter_set_who_hit_me(defender, attacker);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3263,7 +3262,7 @@ static int _combat_turn(Object* obj, bool a2)
|
||||
}
|
||||
|
||||
if (!scriptOverrides) {
|
||||
if (!a2 && critterIsProne(obj)) {
|
||||
if (!a2 && _critter_is_prone(obj)) {
|
||||
_combat_standup(obj);
|
||||
}
|
||||
|
||||
@@ -3553,7 +3552,7 @@ int _combat_attack(Object* attacker, Object* defender, int hitMode, int hitLocat
|
||||
|
||||
if (attacker == gDude) {
|
||||
interfaceRenderActionPoints(attacker->data.critter.combat.ap, _combat_free_move);
|
||||
critterSetWhoHitMe(attacker, defender);
|
||||
_critter_set_who_hit_me(attacker, defender);
|
||||
}
|
||||
|
||||
// SFALL
|
||||
@@ -3846,14 +3845,14 @@ static int attackCompute(Attack* attack)
|
||||
}
|
||||
|
||||
int attackType = weaponGetAttackTypeForHitMode(attack->weapon, attack->hitMode);
|
||||
int roundsHitMainTarget = 1;
|
||||
int ammoQuantity = 1;
|
||||
int damageMultiplier = 2;
|
||||
int roundsSpent = 1;
|
||||
int v26 = 1;
|
||||
|
||||
int roll;
|
||||
|
||||
if (anim == ANIM_FIRE_BURST || anim == ANIM_FIRE_CONTINUOUS) {
|
||||
roll = _compute_spray(attack, accuracy, &roundsHitMainTarget, &roundsSpent, anim);
|
||||
roll = _compute_spray(attack, accuracy, &ammoQuantity, &v26, anim);
|
||||
} else {
|
||||
int chance = critterGetStat(attack->attacker, STAT_CRITICAL_CHANCE);
|
||||
roll = randomRoll(accuracy, chance - hit_location_penalty[attack->defenderHitLocation], nullptr);
|
||||
@@ -3891,7 +3890,7 @@ static int attackCompute(Attack* attack)
|
||||
}
|
||||
|
||||
if (attackType == ATTACK_TYPE_RANGED) {
|
||||
attack->ammoQuantity = roundsSpent;
|
||||
attack->ammoQuantity = v26;
|
||||
|
||||
if (roll == ROLL_SUCCESS && attack->attacker == gDude) {
|
||||
if (perkGetRank(gDude, PERK_SNIPER) != 0) {
|
||||
@@ -3908,7 +3907,7 @@ static int attackCompute(Attack* attack)
|
||||
}
|
||||
}
|
||||
|
||||
if (weaponComputeAmmoCost(attack->weapon, &(attack->ammoQuantity)) == -1) {
|
||||
if (_item_w_compute_ammo_cost(attack->weapon, &(attack->ammoQuantity)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -3929,7 +3928,7 @@ static int attackCompute(Attack* attack)
|
||||
case ROLL_SUCCESS:
|
||||
attack->attackerFlags |= DAM_HIT;
|
||||
attackComputeEnhancedKnockout(attack);
|
||||
attackComputeDamage(attack, roundsHitMainTarget, damageMultiplier);
|
||||
attackComputeDamage(attack, ammoQuantity, damageMultiplier);
|
||||
break;
|
||||
case ROLL_FAILURE:
|
||||
if (attackType == ATTACK_TYPE_RANGED || attackType == ATTACK_TYPE_THROW) {
|
||||
@@ -4095,7 +4094,7 @@ void _compute_explosion_on_extras(Attack* attack, bool isFromAttacker, bool isGr
|
||||
static int attackComputeCriticalHit(Attack* attack)
|
||||
{
|
||||
Object* defender = attack->defender;
|
||||
if (defender != nullptr && critterFlagCheck(defender->pid, CRITTER_INVULNERABLE)) {
|
||||
if (defender != nullptr && _critter_flag_check(defender->pid, CRITTER_INVULNERABLE)) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -4169,7 +4168,7 @@ static int _attackFindInvalidFlags(Object* critter, Object* item)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
if (critter != nullptr && PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER && critterFlagCheck(critter->pid, CRITTER_NO_DROP)) {
|
||||
if (critter != nullptr && PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER && _critter_flag_check(critter->pid, CRITTER_NO_DROP)) {
|
||||
flags |= DAM_DROP;
|
||||
}
|
||||
|
||||
@@ -4185,7 +4184,7 @@ static int attackComputeCriticalFailure(Attack* attack)
|
||||
{
|
||||
attack->attackerFlags &= ~DAM_HIT;
|
||||
|
||||
if (attack->attacker != nullptr && critterFlagCheck(attack->attacker->pid, CRITTER_INVULNERABLE)) {
|
||||
if (attack->attacker != nullptr && _critter_flag_check(attack->attacker->pid, CRITTER_INVULNERABLE)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -4492,7 +4491,6 @@ static int attackDetermineToHit(Object* attacker, int tile, Object* defender, in
|
||||
}
|
||||
}
|
||||
|
||||
int toHitUncapped = toHit;
|
||||
if (toHit > 95) {
|
||||
toHit = 95;
|
||||
}
|
||||
@@ -4501,7 +4499,6 @@ static int attackDetermineToHit(Object* attacker, int tile, Object* defender, in
|
||||
debugPrint("Whoa! Bad skill value in determine_to_hit!\n");
|
||||
}
|
||||
|
||||
toHit = scriptHooks_ToHit(attacker, defender, tile, hitMode, hitLocation, toHit, toHitUncapped, useDistance);
|
||||
return toHit;
|
||||
}
|
||||
|
||||
@@ -4642,7 +4639,7 @@ static void attackComputeDamage(Attack* attack, int ammoQuantity, int bonusDamag
|
||||
&& (critter->flags & OBJECT_MULTIHEX) == 0
|
||||
&& (damageType == DAMAGE_TYPE_EXPLOSION || attack->weapon == nullptr || weaponGetAttackTypeForHitMode(attack->weapon, attack->hitMode) == ATTACK_TYPE_MELEE)
|
||||
&& PID_TYPE(critter->pid) == OBJ_TYPE_CRITTER
|
||||
&& !critterFlagCheck(critter->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
&& !_critter_flag_check(critter->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
bool shouldKnockback = true;
|
||||
bool hasStonewall = false;
|
||||
if (critter == gDude) {
|
||||
@@ -4719,7 +4716,7 @@ void _apply_damage(Attack* attack, bool animated)
|
||||
if (defenderIsCritter) {
|
||||
if ((defender->data.critter.combat.results & (DAM_DEAD | DAM_KNOCKED_OUT)) != 0) {
|
||||
if (!v5 || defender != gDude) {
|
||||
critterSetWhoHitMe(defender, attack->attacker);
|
||||
_critter_set_who_hit_me(defender, attack->attacker);
|
||||
}
|
||||
} else if (defender == attack->oops || defender->data.critter.combat.team != attack->attacker->data.critter.combat.team) {
|
||||
_combatai_check_retaliation(defender, attack->attacker);
|
||||
@@ -4748,7 +4745,7 @@ void _apply_damage(Attack* attack, bool animated)
|
||||
|
||||
if (defenderIsCritter) {
|
||||
if ((obj->data.critter.combat.results & (DAM_DEAD | DAM_KNOCKED_OUT)) != 0) {
|
||||
critterSetWhoHitMe(obj, attack->attacker);
|
||||
_critter_set_who_hit_me(obj, attack->attacker);
|
||||
} else if (obj->data.critter.combat.team != attack->attacker->data.critter.combat.team) {
|
||||
_combatai_check_retaliation(obj, attack->attacker);
|
||||
}
|
||||
@@ -4773,7 +4770,7 @@ void _apply_damage(Attack* attack, bool animated)
|
||||
// 0x424EE8
|
||||
static void _check_for_death(Object* object, int damage, int* flags)
|
||||
{
|
||||
if (object == nullptr || !critterFlagCheck(object->pid, CRITTER_INVULNERABLE)) {
|
||||
if (object == nullptr || !_critter_flag_check(object->pid, CRITTER_INVULNERABLE)) {
|
||||
if (object == nullptr || PID_TYPE(object->pid) == OBJ_TYPE_CRITTER) {
|
||||
if (damage > 0) {
|
||||
if (critterGetHitPoints(object) - damage <= 0) {
|
||||
@@ -4795,7 +4792,7 @@ static void _set_new_results(Object* critter, int flags)
|
||||
return;
|
||||
}
|
||||
|
||||
if (critterFlagCheck(critter->pid, CRITTER_INVULNERABLE)) {
|
||||
if (_critter_flag_check(critter->pid, CRITTER_INVULNERABLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4836,7 +4833,7 @@ static void _damage_object(Object* a1, int damage, bool animated, int a4, Object
|
||||
return;
|
||||
}
|
||||
|
||||
if (critterFlagCheck(a1->pid, CRITTER_INVULNERABLE)) {
|
||||
if (_critter_flag_check(a1->pid, CRITTER_INVULNERABLE)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user