Compare commits
3 Commits
main
...
olympus-su
Author | SHA1 | Date |
---|---|---|
![]() |
8d4057366e | |
![]() |
80b58bd174 | |
![]() |
ca268ecb2c |
|
@ -7,7 +7,6 @@
|
|||
*.java text eol=lf
|
||||
*.json text eol=lf
|
||||
*.md text eol=lf
|
||||
*.mm text eol=lf
|
||||
*.plist text eol=lf
|
||||
*.pro text eol=lf
|
||||
*.properties text eol=lf
|
||||
|
|
|
@ -26,7 +26,7 @@ jobs:
|
|||
sudo apt install cppcheck
|
||||
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: cppcheck
|
||||
run: cppcheck --std=c++17 src/
|
||||
|
@ -38,7 +38,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: clang-format
|
||||
run: find src -type f -name \*.cc -o -name \*.h | xargs clang-format --dry-run --Werror
|
||||
|
@ -50,7 +50,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
|
@ -60,7 +60,7 @@ jobs:
|
|||
cache: gradle
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: os/android/app/.cxx
|
||||
key: android-cmake-v1
|
||||
|
@ -81,7 +81,7 @@ jobs:
|
|||
./gradlew assembleDebug
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fallout2-ce-debug.apk
|
||||
path: os/android/app/build/outputs/apk/debug/app-debug.apk
|
||||
|
@ -94,10 +94,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: ios-cmake-v2
|
||||
|
@ -127,7 +127,7 @@ jobs:
|
|||
cpack -C RelWithDebInfo
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fallout2-ce.ipa
|
||||
path: build/fallout2-ce.ipa
|
||||
|
@ -147,7 +147,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Dependencies (x86)
|
||||
if: matrix.arch == 'x86'
|
||||
|
@ -164,7 +164,7 @@ jobs:
|
|||
sudo apt install libsdl2-dev zlib1g-dev
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: linux-${{ matrix.arch }}-cmake-v1
|
||||
|
@ -194,7 +194,7 @@ jobs:
|
|||
# EOL
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fallout2-ce-linux-${{ matrix.arch }}
|
||||
path: build/fallout2-ce
|
||||
|
@ -207,10 +207,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: macos-cmake-v4
|
||||
|
@ -237,7 +237,7 @@ jobs:
|
|||
cpack -C RelWithDebInfo
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fallout2-ce-macos.dmg
|
||||
path: build/Fallout II Community Edition.dmg
|
||||
|
@ -259,10 +259,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: windows-${{ matrix.arch }}-cmake-v1
|
||||
|
@ -283,7 +283,7 @@ jobs:
|
|||
# EOL
|
||||
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: fallout2-ce-windows-${{ matrix.arch }}
|
||||
path: build/RelWithDebInfo/fallout2-ce.exe
|
||||
|
|
|
@ -17,17 +17,17 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
uses: actions/setup-java@v2
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 11
|
||||
cache: gradle
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: os/android/app/.cxx
|
||||
key: android-cmake-v1
|
||||
|
@ -51,7 +51,7 @@ jobs:
|
|||
run: |
|
||||
cd os/android/app/build/outputs/apk/release
|
||||
cp app-release.apk fallout2-ce-android.apk
|
||||
gh release upload ${{ github.event.release.tag_name }} fallout2-ce-android.apk
|
||||
gh release upload ${{ github.ref_name }} fallout2-ce-android.apk
|
||||
rm fallout2-ce-android.apk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -59,14 +59,14 @@ jobs:
|
|||
ios:
|
||||
name: iOS
|
||||
|
||||
runs-on: macos-12
|
||||
runs-on: macos-11
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: ios-cmake-v1
|
||||
|
@ -75,31 +75,25 @@ jobs:
|
|||
run: |
|
||||
cmake \
|
||||
-B build \
|
||||
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchain/ios.toolchain.cmake \
|
||||
-D ENABLE_BITCODE=0 \
|
||||
-D PLATFORM=OS64 \
|
||||
-G Xcode \
|
||||
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY='' \
|
||||
# EOL
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake \
|
||||
--build build \
|
||||
--config RelWithDebInfo \
|
||||
-j $(sysctl -n hw.physicalcpu) \
|
||||
--target package \
|
||||
# EOL
|
||||
|
||||
- name: Pack
|
||||
run: |
|
||||
cd build
|
||||
cpack -C RelWithDebInfo
|
||||
|
||||
- name: Upload
|
||||
run: |
|
||||
cd build
|
||||
cp fallout2-ce.ipa fallout2-ce-ios.ipa
|
||||
gh release upload ${{ github.event.release.tag_name }} fallout2-ce-ios.ipa
|
||||
cp fallout2-ce.zip fallout2-ce-ios.ipa
|
||||
gh release upload ${{ github.ref_name }} fallout2-ce-ios.ipa
|
||||
rm fallout2-ce-ios.ipa
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -118,7 +112,7 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Dependencies (x86)
|
||||
if: matrix.arch == 'x86'
|
||||
|
@ -135,7 +129,7 @@ jobs:
|
|||
sudo apt install libsdl2-dev zlib1g-dev
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: linux-${{ matrix.arch }}-cmake-v1
|
||||
|
@ -168,7 +162,7 @@ jobs:
|
|||
run: |
|
||||
cd build
|
||||
tar -czvf fallout2-ce-linux-${{ matrix.arch }}.tar.gz fallout2-ce
|
||||
gh release upload ${{ github.event.release.tag_name }} fallout2-ce-linux-${{ matrix.arch }}.tar.gz
|
||||
gh release upload ${{ github.ref_name }} fallout2-ce-linux-${{ matrix.arch }}.tar.gz
|
||||
rm fallout2-ce-linux-${{ matrix.arch }}.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -180,16 +174,16 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Import code signing certificates
|
||||
uses: apple-actions/import-codesign-certs@v2
|
||||
uses: apple-actions/import-codesign-certs@v1
|
||||
with:
|
||||
p12-file-base64: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_FILE_BASE64 }}
|
||||
p12-password: ${{ secrets.APPLE_DEVELOPER_CERTIFICATE_P12_PASSWORD }}
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: macos-cmake-v3
|
||||
|
@ -198,44 +192,41 @@ jobs:
|
|||
run: |
|
||||
cmake \
|
||||
-B build \
|
||||
-G Xcode \
|
||||
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="${{ secrets.APPLE_DEVELOPER_CERTIFICATE_IDENTITY }}" \
|
||||
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_INJECT_BASE_ENTITLEMENTS="NO" \
|
||||
-D CMAKE_XCODE_ATTRIBUTE_OTHER_CODE_SIGN_FLAGS="--options=runtime --timestamp" \
|
||||
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-D CPACK_BUNDLE_APPLE_CERT_APP="${{ secrets.APPLE_DEVELOPER_CERTIFICATE_IDENTITY }}" \
|
||||
# EOL
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
cmake \
|
||||
--build build \
|
||||
--config RelWithDebInfo \
|
||||
-j $(sysctl -n hw.physicalcpu) \
|
||||
--target package \
|
||||
# EOL
|
||||
|
||||
- name: Pack
|
||||
run: |
|
||||
cd build
|
||||
cpack -C RelWithDebInfo
|
||||
|
||||
- name: Notarize
|
||||
run: |
|
||||
xcrun notarytool submit \
|
||||
"build/Fallout II Community Edition.dmg" \
|
||||
--apple-id "${{ secrets.APPLE_DEVELOPER_AC_USERNAME }}" \
|
||||
--team-id "${{ secrets.APPLE_DEVELOPER_AC_TEAM }}" \
|
||||
--password "${{ secrets.APPLE_DEVELOPER_AC_PASSWORD }}" \
|
||||
--wait
|
||||
|
||||
- name: Staple
|
||||
run: |
|
||||
xcrun stapler staple \
|
||||
"build/Fallout II Community Edition.dmg"
|
||||
brew install mitchellh/gon/gon
|
||||
cat << EOF > config.json
|
||||
{
|
||||
"notarize": {
|
||||
"path": "build/fallout2-ce.dmg",
|
||||
"bundle_id": "$(/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" build/fallout2-ce.app/Contents/Info.plist)",
|
||||
"staple": true
|
||||
}
|
||||
}
|
||||
EOF
|
||||
gon config.json
|
||||
rm config.json
|
||||
env:
|
||||
AC_USERNAME: ${{ secrets.APPLE_DEVELOPER_AC_USERNAME }}
|
||||
AC_PASSWORD: ${{ secrets.APPLE_DEVELOPER_AC_PASSWORD }}
|
||||
|
||||
- name: Upload
|
||||
run: |
|
||||
cd build
|
||||
cp "Fallout II Community Edition.dmg" fallout2-ce-macos.dmg
|
||||
gh release upload ${{ github.event.release.tag_name }} fallout2-ce-macos.dmg
|
||||
cp fallout2-ce.dmg fallout2-ce-macos.dmg
|
||||
gh release upload ${{ github.ref_name }} fallout2-ce-macos.dmg
|
||||
rm fallout2-ce-macos.dmg
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -256,10 +247,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache cmake build
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: build
|
||||
key: windows-${{ matrix.arch }}-cmake-v1
|
||||
|
@ -283,7 +274,7 @@ jobs:
|
|||
run: |
|
||||
cd build/RelWithDebInfo
|
||||
7z a fallout2-ce-windows-${{ matrix.arch }}.zip fallout2-ce.exe
|
||||
gh release upload ${{ github.event.release.tag_name }} fallout2-ce-windows-${{ matrix.arch }}.zip
|
||||
gh release upload ${{ github.ref_name }} fallout2-ce-windows-${{ matrix.arch }}.zip
|
||||
rm fallout2-ce-windows-${{ matrix.arch }}.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -253,8 +253,6 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
|
|||
target_sources(${EXECUTABLE_NAME} PUBLIC
|
||||
"src/audio_engine.cc"
|
||||
"src/audio_engine.h"
|
||||
"src/delay.cc"
|
||||
"src/delay.h"
|
||||
"src/fps_limiter.cc"
|
||||
"src/fps_limiter.h"
|
||||
"src/platform_compat.cc"
|
||||
|
@ -277,8 +275,6 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
|
|||
"src/sfall_kb_helpers.h"
|
||||
"src/sfall_lists.cc"
|
||||
"src/sfall_lists.h"
|
||||
"src/sfall_metarules.cc"
|
||||
"src/sfall_metarules.h"
|
||||
"src/sfall_opcodes.cc"
|
||||
"src/sfall_opcodes.h"
|
||||
"src/sfall_arrays.cc"
|
||||
|
@ -356,15 +352,15 @@ if(APPLE)
|
|||
endif()
|
||||
|
||||
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.alexbatalov.fallout2-ce")
|
||||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.3.0")
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION "1.3.0")
|
||||
set(MACOSX_BUNDLE_SHORT_VERSION_STRING "1.2.0")
|
||||
set(MACOSX_BUNDLE_BUNDLE_VERSION "1.2.0")
|
||||
endif()
|
||||
|
||||
add_subdirectory("third_party/fpattern")
|
||||
target_link_libraries(${EXECUTABLE_NAME} ${FPATTERN_LIBRARY})
|
||||
target_include_directories(${EXECUTABLE_NAME} PRIVATE ${FPATTERN_INCLUDE_DIR})
|
||||
|
||||
if((NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") AND (NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
|
||||
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
add_subdirectory("third_party/zlib")
|
||||
add_subdirectory("third_party/sdl2")
|
||||
else()
|
||||
|
@ -389,6 +385,13 @@ if(APPLE)
|
|||
else()
|
||||
install(TARGETS ${EXECUTABLE_NAME} DESTINATION .)
|
||||
|
||||
if(CPACK_BUNDLE_APPLE_CERT_APP)
|
||||
install(CODE "
|
||||
execute_process(COMMAND codesign --deep --force --options runtime --sign \"${CPACK_BUNDLE_APPLE_CERT_APP}\" ${CMAKE_BINARY_DIR}/Fallout II Community Edition.app)
|
||||
"
|
||||
COMPONENT Runtime)
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR "DragNDrop")
|
||||
set(CPACK_DMG_DISABLE_APPLICATIONS_SYMLINK ON)
|
||||
set(CPACK_PACKAGE_FILE_NAME "Fallout II Community Edition")
|
||||
|
|
|
@ -9,8 +9,8 @@ android {
|
|||
applicationId 'com.alexbatalov.fallout2ce'
|
||||
minSdk 21
|
||||
targetSdk 32
|
||||
versionCode 4
|
||||
versionName '1.3.0'
|
||||
versionCode 3
|
||||
versionName '1.2.0'
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments '-DANDROID_STL=c++_static'
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
<string>11.0</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>LSSupportsOpeningDocumentsInPlace</key>
|
||||
<true/>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
|
|
237
src/actions.cc
237
src/actions.cc
|
@ -48,9 +48,6 @@ typedef enum ScienceRepairTargetType {
|
|||
// 0x5106D0
|
||||
static bool _action_in_explode = false;
|
||||
|
||||
// 0x5106D4
|
||||
int rotation;
|
||||
|
||||
// 0x5106E0
|
||||
static const int gNormalDeathAnimations[DAMAGE_TYPE_COUNT] = {
|
||||
ANIM_DANCING_AUTOFIRE,
|
||||
|
@ -88,7 +85,7 @@ static int _is_next_to(Object* a1, Object* a2);
|
|||
static int _action_climb_ladder(Object* a1, Object* a2);
|
||||
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 _report_explosion(Attack* attack, Object* a2);
|
||||
static int _finished_explosion(Object* a1, Object* a2);
|
||||
static int _compute_explosion_damage(int min, int max, Object* defender, int* knockbackDistancePtr);
|
||||
static int _can_talk_to(Object* a1, Object* a2);
|
||||
|
@ -121,7 +118,7 @@ int actionKnockdown(Object* obj, int* anim, int maxDistance, int rotation, int d
|
|||
int tile;
|
||||
for (distance = 1; distance <= maxDistance; distance++) {
|
||||
tile = tileGetTileInDirection(obj->tile, rotation, distance);
|
||||
if (_obj_blocking_at(obj, tile, obj->elevation) != nullptr) {
|
||||
if (_obj_blocking_at(obj, tile, obj->elevation) != NULL) {
|
||||
distance--;
|
||||
break;
|
||||
}
|
||||
|
@ -187,7 +184,7 @@ int _pick_death(Object* attacker, Object* defender, Object* weapon, int damage,
|
|||
|
||||
int damageType = weaponGetDamageType(attacker, weapon);
|
||||
|
||||
if (weapon != nullptr && weapon->pid == PROTO_ID_MOLOTOV_COCKTAIL) {
|
||||
if (weapon != NULL && weapon->pid == PROTO_ID_MOLOTOV_COCKTAIL) {
|
||||
normalViolenceLevelDamageThreshold = 5;
|
||||
maximumBloodViolenceLevelDamageThreshold = 15;
|
||||
damageType = DAMAGE_TYPE_FIRE;
|
||||
|
@ -199,7 +196,7 @@ int _pick_death(Object* attacker, Object* defender, Object* weapon, int damage,
|
|||
maximumBloodViolenceLevelDamageThreshold = 1;
|
||||
}
|
||||
|
||||
if (weapon != nullptr && weaponGetPerk(weapon) == PERK_WEAPON_FLAMEBOY) {
|
||||
if (weapon != NULL && weaponGetPerk(weapon) == PERK_WEAPON_FLAMEBOY) {
|
||||
normalViolenceLevelDamageThreshold /= 3;
|
||||
maximumBloodViolenceLevelDamageThreshold /= 3;
|
||||
}
|
||||
|
@ -371,9 +368,9 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
|||
while (true) {
|
||||
int tile = tileGetTileInDirection(defender->tile, (rotation + randomRotation) % ROTATION_COUNT, distance);
|
||||
if (!isExitGridAt(tile, defender->elevation)) {
|
||||
Object* obstacle = nullptr;
|
||||
_make_straight_path(defender, defender->tile, tile, nullptr, &obstacle, 4);
|
||||
if (obstacle == nullptr) {
|
||||
Object* obstacle = NULL;
|
||||
_make_straight_path(defender, defender->tile, tile, NULL, &obstacle, 4);
|
||||
if (obstacle == NULL) {
|
||||
animationRegisterRotateToTile(defender, tile);
|
||||
animationRegisterMoveToTileStraight(defender, tile, defender->elevation, anim, 0);
|
||||
break;
|
||||
|
@ -443,7 +440,7 @@ void _show_damage_to_object(Object* defender, int damage, int flags, Object* wea
|
|||
}
|
||||
}
|
||||
|
||||
if (weapon != nullptr) {
|
||||
if (weapon != NULL) {
|
||||
if ((flags & DAM_EXPLODE) != 0) {
|
||||
animationRegisterCallbackForced(defender, weapon, (AnimationCallback*)_obj_drop, -1);
|
||||
fid = buildFid(OBJ_TYPE_MISC, 10, 0, 0, 0);
|
||||
|
@ -544,7 +541,7 @@ void _show_damage(Attack* attack, int attackerAnimation, int delay)
|
|||
_show_damage_to_object(attack->attacker, attack->attackerDamage, attack->attackerFlags, attack->weapon, 1, 0, 0, attackerAnimation, attack->attacker, -1);
|
||||
}
|
||||
} else {
|
||||
if (attack->defender != nullptr) {
|
||||
if (attack->defender != NULL) {
|
||||
// NOTE: Uninline.
|
||||
bool hitFromFront = _is_hit_from_front(attack->defender, attack->attacker);
|
||||
|
||||
|
@ -609,7 +606,7 @@ int _action_melee(Attack* attack, int anim)
|
|||
|
||||
fid = buildFid(OBJ_TYPE_CRITTER, attack->attacker->fid & 0xFFF, anim, (attack->attacker->fid & 0xF000) >> 12, attack->attacker->rotation + 1);
|
||||
art = artLock(fid, &cache_entry);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
delay = artGetActionFrame(art);
|
||||
} else {
|
||||
delay = 0;
|
||||
|
@ -649,7 +646,7 @@ int _action_melee(Attack* attack, int anim)
|
|||
} else {
|
||||
fid = buildFid(OBJ_TYPE_CRITTER, attack->defender->fid & 0xFFF, ANIM_DODGE_ANIM, (attack->defender->fid & 0xF000) >> 12, attack->defender->rotation + 1);
|
||||
art = artLock(fid, &cache_entry);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
int dodgeDelay = artGetActionFrame(art);
|
||||
artUnlock(cache_entry);
|
||||
|
||||
|
@ -693,14 +690,14 @@ int _action_ranged(Attack* attack, int anim)
|
|||
{
|
||||
Object* adjacentObjects[ROTATION_COUNT];
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
adjacentObjects[rotation] = nullptr;
|
||||
adjacentObjects[rotation] = NULL;
|
||||
}
|
||||
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
_register_priority(1);
|
||||
|
||||
Object* projectile = nullptr;
|
||||
Object* replacedWeapon = nullptr;
|
||||
Object* projectile = NULL;
|
||||
Object* replacedWeapon = NULL;
|
||||
int weaponFid = -1;
|
||||
|
||||
Proto* weaponProto;
|
||||
|
@ -710,7 +707,7 @@ int _action_ranged(Attack* attack, int anim)
|
|||
int fid = buildFid(OBJ_TYPE_CRITTER, attack->attacker->fid & 0xFFF, anim, (attack->attacker->fid & 0xF000) >> 12, attack->attacker->rotation + 1);
|
||||
CacheEntry* artHandle;
|
||||
Art* art = artLock(fid, &artHandle);
|
||||
int delay = (art != nullptr) ? artGetActionFrame(art) : 0;
|
||||
int delay = (art != NULL) ? artGetActionFrame(art) : 0;
|
||||
artUnlock(artHandle);
|
||||
|
||||
weaponGetRange(attack->attacker, attack->hitMode);
|
||||
|
@ -761,11 +758,11 @@ int _action_ranged(Attack* attack, int anim)
|
|||
|
||||
itemRemove(attack->attacker, weapon, 1);
|
||||
replacedWeapon = itemReplace(attack->attacker, weapon, weaponFlags & OBJECT_IN_ANY_HAND);
|
||||
objectSetFid(projectile, projectileProto->fid, nullptr);
|
||||
objectSetFid(projectile, projectileProto->fid, NULL);
|
||||
_cAIPrepWeaponItem(attack->attacker, weapon);
|
||||
|
||||
if (attack->attacker == gDude) {
|
||||
if (replacedWeapon == nullptr) {
|
||||
if (replacedWeapon == NULL) {
|
||||
if ((weaponFlags & OBJECT_IN_LEFT_HAND) != 0) {
|
||||
leftItemAction = INTERFACE_ITEM_ACTION_DEFAULT;
|
||||
} else if ((weaponFlags & OBJECT_IN_RIGHT_HAND) != 0) {
|
||||
|
@ -775,25 +772,25 @@ int _action_ranged(Attack* attack, int anim)
|
|||
interfaceUpdateItems(false, leftItemAction, rightItemAction);
|
||||
}
|
||||
|
||||
_obj_connect(weapon, attack->attacker->tile, attack->attacker->elevation, nullptr);
|
||||
_obj_connect(weapon, attack->attacker->tile, attack->attacker->elevation, NULL);
|
||||
} else {
|
||||
objectCreateWithFidPid(&projectile, projectileProto->fid, -1);
|
||||
}
|
||||
|
||||
objectHide(projectile, nullptr);
|
||||
objectHide(projectile, NULL);
|
||||
|
||||
// SFALL
|
||||
if (explosionEmitsLight() && projectile->lightIntensity == 0) {
|
||||
objectSetLight(projectile, projectileProto->item.lightDistance, projectileProto->item.lightIntensity, nullptr);
|
||||
objectSetLight(projectile, projectileProto->item.lightDistance, projectileProto->item.lightIntensity, NULL);
|
||||
} else {
|
||||
objectSetLight(projectile, 9, projectile->lightIntensity, nullptr);
|
||||
objectSetLight(projectile, 9, projectile->lightIntensity, NULL);
|
||||
}
|
||||
|
||||
int projectileOrigin = _combat_bullet_start(attack->attacker, attack->defender);
|
||||
objectSetLocation(projectile, projectileOrigin, attack->attacker->elevation, nullptr);
|
||||
objectSetLocation(projectile, projectileOrigin, attack->attacker->elevation, NULL);
|
||||
|
||||
int projectileRotation = tileGetRotationTo(attack->attacker->tile, attack->defender->tile);
|
||||
objectSetRotation(projectile, projectileRotation, nullptr);
|
||||
objectSetRotation(projectile, projectileRotation, NULL);
|
||||
|
||||
animationRegisterUnsetFlag(projectile, OBJECT_HIDDEN, delay);
|
||||
|
||||
|
@ -803,7 +800,7 @@ int _action_ranged(Attack* attack, int anim)
|
|||
int explosionCenterTile;
|
||||
if ((attack->attackerFlags & DAM_HIT) != 0) {
|
||||
animationRegisterMoveToTileStraight(projectile, attack->defender->tile, attack->defender->elevation, ANIM_WALK, 0);
|
||||
delay = _make_straight_path(projectile, projectileOrigin, attack->defender->tile, nullptr, nullptr, 32) - 1;
|
||||
delay = _make_straight_path(projectile, projectileOrigin, attack->defender->tile, NULL, NULL, 32) - 1;
|
||||
explosionCenterTile = attack->defender->tile;
|
||||
} else {
|
||||
animationRegisterMoveToTileStraight(projectile, attack->tile, attack->defender->elevation, ANIM_WALK, 0);
|
||||
|
@ -865,10 +862,10 @@ int _action_ranged(Attack* attack, int anim)
|
|||
|
||||
for (int rotation = startRotation; rotation < endRotation; rotation++) {
|
||||
if (objectCreateWithFidPid(&(adjacentObjects[rotation]), explosionFid, -1) != -1) {
|
||||
objectHide(adjacentObjects[rotation], nullptr);
|
||||
objectHide(adjacentObjects[rotation], NULL);
|
||||
|
||||
int adjacentTile = tileGetTileInDirection(explosionCenterTile, rotation, 1);
|
||||
objectSetLocation(adjacentObjects[rotation], adjacentTile, projectile->elevation, nullptr);
|
||||
objectSetLocation(adjacentObjects[rotation], adjacentTile, projectile->elevation, NULL);
|
||||
|
||||
int delay;
|
||||
if (rotation != ROTATION_NE) {
|
||||
|
@ -923,7 +920,7 @@ int _action_ranged(Attack* attack, int anim)
|
|||
}
|
||||
|
||||
// SFALL
|
||||
if (projectile != nullptr && (isGrenade || damageType == explosionGetDamageType())) {
|
||||
if (projectile != NULL && (isGrenade || damageType == explosionGetDamageType())) {
|
||||
// CE: Use custom callback to hide projectile instead of relying on
|
||||
// `animationRegisterHideObjectForced`. The problem is that completing
|
||||
// `ANIM_KIND_HIDE` removes (frees) object entirely. When this happens
|
||||
|
@ -934,12 +931,12 @@ int _action_ranged(Attack* attack, int anim)
|
|||
// `opDestroyObject` for self-deleting objects (mark it hidden +
|
||||
// no-save).
|
||||
animationRegisterCallbackForced(attack, projectile, hideProjectile, -1);
|
||||
} else if (anim == ANIM_THROW_ANIM && projectile != nullptr) {
|
||||
} else if (anim == ANIM_THROW_ANIM && projectile != NULL) {
|
||||
animationRegisterSetFid(projectile, weaponFid, -1);
|
||||
}
|
||||
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
if (adjacentObjects[rotation] != nullptr) {
|
||||
if (adjacentObjects[rotation] != NULL) {
|
||||
animationRegisterHideObjectForced(adjacentObjects[rotation]);
|
||||
}
|
||||
}
|
||||
|
@ -947,7 +944,7 @@ int _action_ranged(Attack* attack, int anim)
|
|||
if ((attack->attackerFlags & (DAM_KNOCKED_OUT | DAM_KNOCKED_DOWN | DAM_DEAD)) == 0) {
|
||||
if (anim == ANIM_THROW_ANIM) {
|
||||
bool takeOutAnimationRegistered = false;
|
||||
if (replacedWeapon != nullptr) {
|
||||
if (replacedWeapon != NULL) {
|
||||
int weaponAnimationCode = weaponGetAnimationCode(replacedWeapon);
|
||||
if (weaponAnimationCode != 0) {
|
||||
animationRegisterTakeOutWeapon(attack->attacker, weaponAnimationCode, -1);
|
||||
|
@ -966,13 +963,13 @@ int _action_ranged(Attack* attack, int anim)
|
|||
|
||||
if (reg_anim_end() == -1) {
|
||||
debugPrint("Something went wrong with a ranged attack sequence!\n");
|
||||
if (projectile != nullptr && (isGrenade || damageType == DAMAGE_TYPE_EXPLOSION || anim != ANIM_THROW_ANIM)) {
|
||||
objectDestroy(projectile, nullptr);
|
||||
if (projectile != NULL && (isGrenade || damageType == DAMAGE_TYPE_EXPLOSION || anim != ANIM_THROW_ANIM)) {
|
||||
objectDestroy(projectile, NULL);
|
||||
}
|
||||
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
if (adjacentObjects[rotation] != nullptr) {
|
||||
objectDestroy(adjacentObjects[rotation], nullptr);
|
||||
if (adjacentObjects[rotation] != NULL) {
|
||||
objectDestroy(adjacentObjects[rotation], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1062,7 +1059,7 @@ int _action_climb_ladder(Object* a1, Object* a2)
|
|||
// 0x411F2C
|
||||
int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3)
|
||||
{
|
||||
Proto* proto = nullptr;
|
||||
Proto* proto = NULL;
|
||||
int type = FID_TYPE(a2->fid);
|
||||
int sceneryType = -1;
|
||||
if (type == OBJ_TYPE_SCENERY) {
|
||||
|
@ -1073,7 +1070,7 @@ int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3)
|
|||
sceneryType = proto->scenery.type;
|
||||
}
|
||||
|
||||
if (sceneryType != SCENERY_TYPE_LADDER_UP || a3 != nullptr) {
|
||||
if (sceneryType != SCENERY_TYPE_LADDER_UP || a3 != NULL) {
|
||||
if (a1 == gDude) {
|
||||
int anim = FID_ANIM_TYPE(gDude->fid);
|
||||
if (anim == ANIM_WALK || anim == ANIM_RUNNING) {
|
||||
|
@ -1105,7 +1102,7 @@ int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3)
|
|||
|
||||
animationRegisterCallbackForced(a1, a2, (AnimationCallback*)_is_next_to, -1);
|
||||
|
||||
if (a3 == nullptr) {
|
||||
if (a3 == NULL) {
|
||||
animationRegisterCallback(a1, a2, (AnimationCallback*)_check_scenery_ap_cost, -1);
|
||||
}
|
||||
|
||||
|
@ -1126,11 +1123,11 @@ int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3)
|
|||
anim = ANIM_MAGIC_HANDS_MIDDLE;
|
||||
}
|
||||
|
||||
if (sceneryType != SCENERY_TYPE_STAIRS && a3 == nullptr) {
|
||||
if (sceneryType != SCENERY_TYPE_STAIRS && a3 == NULL) {
|
||||
animationRegisterAnimate(a1, anim, -1);
|
||||
}
|
||||
|
||||
if (a3 != nullptr) {
|
||||
if (a3 != NULL) {
|
||||
// TODO: Get rid of cast.
|
||||
animationRegisterCallback3(a1, a2, a3, (AnimationCallback3*)_obj_use_item_on, -1);
|
||||
} else {
|
||||
|
@ -1150,7 +1147,7 @@ int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3)
|
|||
// 0x412114
|
||||
int _action_use_an_object(Object* a1, Object* a2)
|
||||
{
|
||||
return _action_use_an_item_on_object(a1, a2, nullptr);
|
||||
return _action_use_an_item_on_object(a1, a2, NULL);
|
||||
}
|
||||
|
||||
// 0x412134
|
||||
|
@ -1193,7 +1190,7 @@ int actionPickUp(Object* critter, Object* item)
|
|||
int actionFrame;
|
||||
CacheEntry* cacheEntry;
|
||||
Art* art = artLock(fid, &cacheEntry);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
actionFrame = artGetActionFrame(art);
|
||||
} else {
|
||||
actionFrame = -1;
|
||||
|
@ -1225,7 +1222,7 @@ int actionPickUp(Object* critter, Object* item)
|
|||
int actionFrame;
|
||||
CacheEntry* cacheEntry;
|
||||
Art* art = artLock(fid, &cacheEntry);
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
actionFrame = artGetActionFrame(art);
|
||||
artUnlock(cacheEntry);
|
||||
} else {
|
||||
|
@ -1422,34 +1419,34 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
|
|||
Object* partyMember = partyMemberGetBestInSkill(skill);
|
||||
|
||||
if (partyMember == gDude) {
|
||||
partyMember = nullptr;
|
||||
partyMember = NULL;
|
||||
}
|
||||
|
||||
// Only dude can perform stealing.
|
||||
if (skill == SKILL_STEAL) {
|
||||
partyMember = nullptr;
|
||||
partyMember = NULL;
|
||||
}
|
||||
|
||||
if (partyMember != nullptr) {
|
||||
if (partyMember != NULL) {
|
||||
if (partyMemberGetBestSkill(partyMember) != skill) {
|
||||
partyMember = nullptr;
|
||||
partyMember = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (partyMember != nullptr) {
|
||||
if (partyMember != NULL) {
|
||||
performer = partyMember;
|
||||
int anim = FID_ANIM_TYPE(partyMember->fid);
|
||||
if (anim != ANIM_WALK && anim != ANIM_RUNNING) {
|
||||
if (anim != ANIM_STAND) {
|
||||
performer = gDude;
|
||||
partyMember = nullptr;
|
||||
partyMember = NULL;
|
||||
}
|
||||
} else {
|
||||
reg_anim_clear(partyMember);
|
||||
}
|
||||
}
|
||||
|
||||
if (partyMember != nullptr) {
|
||||
if (partyMember != NULL) {
|
||||
bool isDude = false;
|
||||
if (objectGetDistanceBetween(gDude, a2) <= 1) {
|
||||
isDude = true;
|
||||
|
@ -1464,11 +1461,11 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
|
|||
|
||||
if (isDude) {
|
||||
performer = gDude;
|
||||
partyMember = nullptr;
|
||||
partyMember = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (partyMember == nullptr) {
|
||||
if (partyMember == NULL) {
|
||||
int anim = FID_ANIM_TYPE(performer->fid);
|
||||
if (anim == ANIM_WALK || anim == ANIM_RUNNING) {
|
||||
reg_anim_clear(performer);
|
||||
|
@ -1497,7 +1494,7 @@ int actionUseSkill(Object* a1, Object* a2, int skill)
|
|||
|
||||
CacheEntry* artHandle;
|
||||
Art* art = artLock(fid, &artHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
artGetActionFrame(art);
|
||||
artUnlock(artHandle);
|
||||
}
|
||||
|
@ -1545,7 +1542,7 @@ int _pick_fall(Object* obj, int anim)
|
|||
rotation = obj->rotation;
|
||||
for (i = 1; i < 3; i++) {
|
||||
tile_num = tileGetTileInDirection(obj->tile, rotation, i);
|
||||
if (_obj_blocking_at(obj, tile_num, obj->elevation) != nullptr) {
|
||||
if (_obj_blocking_at(obj, tile_num, obj->elevation) != NULL) {
|
||||
anim = ANIM_FALL_BACK;
|
||||
break;
|
||||
}
|
||||
|
@ -1554,7 +1551,7 @@ int _pick_fall(Object* obj, int anim)
|
|||
rotation = (obj->rotation + 3) % ROTATION_COUNT;
|
||||
for (i = 1; i < 3; i++) {
|
||||
tile_num = tileGetTileInDirection(obj->tile, rotation, i);
|
||||
if (_obj_blocking_at(obj, tile_num, obj->elevation) != nullptr) {
|
||||
if (_obj_blocking_at(obj, tile_num, obj->elevation) != NULL) {
|
||||
anim = ANIM_FALL_FRONT;
|
||||
break;
|
||||
}
|
||||
|
@ -1579,14 +1576,14 @@ bool _action_explode_running()
|
|||
|
||||
// action_explode
|
||||
// 0x412CF4
|
||||
int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object* sourceObj, bool animate)
|
||||
int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object* a5, bool a6)
|
||||
{
|
||||
if (animate && _action_in_explode) {
|
||||
if (a6 && _action_in_explode) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
Attack* attack = (Attack*)internal_malloc(sizeof(*attack));
|
||||
if (attack == nullptr) {
|
||||
if (attack == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1597,35 +1594,35 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
return -1;
|
||||
}
|
||||
|
||||
objectHide(explosion, nullptr);
|
||||
objectHide(explosion, NULL);
|
||||
explosion->flags |= OBJECT_NO_SAVE;
|
||||
|
||||
objectSetLocation(explosion, tile, elevation, nullptr);
|
||||
objectSetLocation(explosion, tile, elevation, NULL);
|
||||
|
||||
Object* adjacentExplosions[ROTATION_COUNT];
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
int fid = buildFid(OBJ_TYPE_MISC, 10, 0, 0, 0);
|
||||
if (objectCreateWithFidPid(&(adjacentExplosions[rotation]), fid, -1) == -1) {
|
||||
while (--rotation >= 0) {
|
||||
objectDestroy(adjacentExplosions[rotation], nullptr);
|
||||
objectDestroy(adjacentExplosions[rotation], NULL);
|
||||
}
|
||||
|
||||
objectDestroy(explosion, nullptr);
|
||||
objectDestroy(explosion, NULL);
|
||||
internal_free(attack);
|
||||
return -1;
|
||||
}
|
||||
|
||||
objectHide(adjacentExplosions[rotation], nullptr);
|
||||
objectHide(adjacentExplosions[rotation], NULL);
|
||||
adjacentExplosions[rotation]->flags |= OBJECT_NO_SAVE;
|
||||
|
||||
int adjacentTile = tileGetTileInDirection(tile, rotation, 1);
|
||||
objectSetLocation(adjacentExplosions[rotation], adjacentTile, elevation, nullptr);
|
||||
objectSetLocation(adjacentExplosions[rotation], adjacentTile, elevation, NULL);
|
||||
}
|
||||
|
||||
Object* critter = _obj_blocking_at(nullptr, tile, elevation);
|
||||
if (critter != nullptr) {
|
||||
Object* critter = _obj_blocking_at(NULL, tile, elevation);
|
||||
if (critter != NULL) {
|
||||
if (FID_TYPE(critter->fid) != OBJ_TYPE_CRITTER || (critter->data.critter.combat.results & DAM_DEAD) != 0) {
|
||||
critter = nullptr;
|
||||
critter = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1636,7 +1633,7 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
|
||||
gameUiDisable(1);
|
||||
|
||||
if (critter != nullptr) {
|
||||
if (critter != NULL) {
|
||||
if (reg_anim_clear(critter) == -2) {
|
||||
debugPrint("Cannot clear target's animation for action_explode!\n");
|
||||
}
|
||||
|
@ -1656,7 +1653,7 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
|
||||
attackComputeDeathFlags(attack);
|
||||
|
||||
if (animate) {
|
||||
if (a6) {
|
||||
_action_in_explode = true;
|
||||
|
||||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
|
@ -1671,22 +1668,22 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
animationRegisterAnimateAndHide(adjacentExplosions[rotation], ANIM_STAND, 0);
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(explosion, nullptr, (AnimationCallback*)_combat_explode_scenery, -1);
|
||||
animationRegisterCallbackForced(explosion, 0, (AnimationCallback*)_combat_explode_scenery, -1);
|
||||
animationRegisterHideObjectForced(explosion);
|
||||
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
animationRegisterHideObjectForced(adjacentExplosions[rotation]);
|
||||
}
|
||||
|
||||
animationRegisterCallbackForced(attack, sourceObj, (AnimationCallback*)_report_explosion, -1);
|
||||
animationRegisterCallbackForced(nullptr, nullptr, (AnimationCallback*)_finished_explosion, -1);
|
||||
animationRegisterCallbackForced(attack, a5, (AnimationCallback*)_report_explosion, -1);
|
||||
animationRegisterCallbackForced(NULL, NULL, (AnimationCallback*)_finished_explosion, -1);
|
||||
if (reg_anim_end() == -1) {
|
||||
_action_in_explode = false;
|
||||
|
||||
objectDestroy(explosion, nullptr);
|
||||
objectDestroy(explosion, NULL);
|
||||
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
objectDestroy(adjacentExplosions[rotation], nullptr);
|
||||
objectDestroy(adjacentExplosions[rotation], NULL);
|
||||
}
|
||||
|
||||
internal_free(attack);
|
||||
|
@ -1697,7 +1694,7 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
|
||||
_show_damage_extras(attack);
|
||||
} else {
|
||||
if (critter != nullptr) {
|
||||
if (critter != NULL) {
|
||||
if ((attack->defenderFlags & DAM_DEAD) != 0) {
|
||||
critterKill(critter, -1, false);
|
||||
}
|
||||
|
@ -1709,14 +1706,14 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
}
|
||||
}
|
||||
|
||||
_report_explosion(attack, sourceObj);
|
||||
_report_explosion(attack, a5);
|
||||
|
||||
_combat_explode_scenery(explosion, nullptr);
|
||||
_combat_explode_scenery(explosion, NULL);
|
||||
|
||||
objectDestroy(explosion, nullptr);
|
||||
objectDestroy(explosion, NULL);
|
||||
|
||||
for (int rotation = 0; rotation < ROTATION_COUNT; rotation++) {
|
||||
objectDestroy(adjacentExplosions[rotation], nullptr);
|
||||
objectDestroy(adjacentExplosions[rotation], NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1724,10 +1721,10 @@ int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object*
|
|||
}
|
||||
|
||||
// 0x413144
|
||||
int _report_explosion(Attack* attack, Object* sourceObj)
|
||||
int _report_explosion(Attack* attack, Object* a2)
|
||||
{
|
||||
bool mainTargetWasDead;
|
||||
if (attack->defender != nullptr) {
|
||||
if (attack->defender != NULL) {
|
||||
mainTargetWasDead = (attack->defender->data.critter.combat.results & DAM_DEAD) != 0;
|
||||
} else {
|
||||
mainTargetWasDead = false;
|
||||
|
@ -1742,48 +1739,48 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
|||
_combat_display(attack);
|
||||
_apply_damage(attack, false);
|
||||
|
||||
Object* anyDefender = nullptr;
|
||||
Object* anyDefender = NULL;
|
||||
int xp = 0;
|
||||
if (sourceObj != nullptr) {
|
||||
if (attack->defender != nullptr && attack->defender != sourceObj) {
|
||||
if (a2 != NULL) {
|
||||
if (attack->defender != NULL && attack->defender != a2) {
|
||||
if ((attack->defender->data.critter.combat.results & DAM_DEAD) != 0) {
|
||||
if (sourceObj == gDude && !mainTargetWasDead) {
|
||||
if (a2 == gDude && !mainTargetWasDead) {
|
||||
xp += critterGetExp(attack->defender);
|
||||
}
|
||||
} else {
|
||||
_critter_set_who_hit_me(attack->defender, sourceObj);
|
||||
_critter_set_who_hit_me(attack->defender, a2);
|
||||
anyDefender = attack->defender;
|
||||
}
|
||||
}
|
||||
|
||||
for (int index = 0; index < attack->extrasLength; index++) {
|
||||
Object* critter = attack->extras[index];
|
||||
if (critter != sourceObj) {
|
||||
if (critter != a2) {
|
||||
if ((critter->data.critter.combat.results & DAM_DEAD) != 0) {
|
||||
if (sourceObj == gDude && !extrasWasDead[index]) {
|
||||
if (a2 == gDude && !extrasWasDead[index]) {
|
||||
xp += critterGetExp(critter);
|
||||
}
|
||||
} else {
|
||||
_critter_set_who_hit_me(critter, sourceObj);
|
||||
_critter_set_who_hit_me(critter, a2);
|
||||
|
||||
if (anyDefender == nullptr) {
|
||||
if (anyDefender == NULL) {
|
||||
anyDefender = critter;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (anyDefender != nullptr) {
|
||||
if (anyDefender != NULL) {
|
||||
if (!isInCombat()) {
|
||||
CombatStartData combat;
|
||||
STRUCT_664980 combat;
|
||||
combat.attacker = anyDefender;
|
||||
combat.defender = sourceObj;
|
||||
combat.defender = a2;
|
||||
combat.actionPointsBonus = 0;
|
||||
combat.accuracyBonus = 0;
|
||||
combat.damageBonus = 0;
|
||||
combat.minDamage = 0;
|
||||
combat.maxDamage = INT_MAX;
|
||||
combat.overrideAttackResults = 0;
|
||||
combat.field_1C = 0;
|
||||
scriptsRequestCombat(&combat);
|
||||
}
|
||||
}
|
||||
|
@ -1792,7 +1789,7 @@ int _report_explosion(Attack* attack, Object* sourceObj)
|
|||
internal_free(attack);
|
||||
gameUiEnable();
|
||||
|
||||
if (sourceObj == gDude) {
|
||||
if (a2 == gDude) {
|
||||
_combat_give_exps(xp);
|
||||
}
|
||||
|
||||
|
@ -1819,7 +1816,7 @@ int _compute_explosion_damage(int min, int max, Object* defender, int* knockback
|
|||
damage = 0;
|
||||
}
|
||||
|
||||
if (knockbackDistancePtr != nullptr) {
|
||||
if (knockbackDistancePtr != NULL) {
|
||||
if ((defender->flags & OBJECT_MULTIHEX) == 0) {
|
||||
*knockbackDistancePtr = damage / 10;
|
||||
}
|
||||
|
@ -1850,7 +1847,7 @@ int actionTalk(Object* a1, Object* a2)
|
|||
} else {
|
||||
reg_anim_begin(a1 == gDude ? ANIMATION_REQUEST_RESERVED : ANIMATION_REQUEST_UNRESERVED);
|
||||
|
||||
if (objectGetDistanceBetween(a1, a2) >= 9 || _combat_is_shot_blocked(a1, a1->tile, a2->tile, a2, nullptr)) {
|
||||
if (objectGetDistanceBetween(a1, a2) >= 9 || _combat_is_shot_blocked(a1, a1->tile, a2->tile, a2, NULL)) {
|
||||
animationRegisterRunToObject(a1, a2, -1, 0);
|
||||
}
|
||||
}
|
||||
|
@ -1863,7 +1860,7 @@ int actionTalk(Object* a1, Object* a2)
|
|||
// 0x413420
|
||||
int _can_talk_to(Object* a1, Object* a2)
|
||||
{
|
||||
if (_combat_is_shot_blocked(a1, a1->tile, a2->tile, a2, nullptr) || objectGetDistanceBetween(a1, a2) >= 9) {
|
||||
if (_combat_is_shot_blocked(a1, a1->tile, a2->tile, a2, NULL) || objectGetDistanceBetween(a1, a2) >= 9) {
|
||||
if (a1 == gDude) {
|
||||
// You cannot get there. (used in actions.c)
|
||||
MessageListItem messageListItem;
|
||||
|
@ -1890,7 +1887,7 @@ int _talk_to(Object* a1, Object* a2)
|
|||
void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int damageType, bool animated, bool bypassArmor)
|
||||
{
|
||||
Attack* attack = (Attack*)internal_malloc(sizeof(*attack));
|
||||
if (attack == nullptr) {
|
||||
if (attack == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1900,19 +1897,19 @@ void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int dam
|
|||
return;
|
||||
}
|
||||
|
||||
objectHide(attacker, nullptr);
|
||||
objectHide(attacker, NULL);
|
||||
|
||||
attacker->flags |= OBJECT_NO_SAVE;
|
||||
|
||||
objectSetLocation(attacker, tile, elevation, nullptr);
|
||||
objectSetLocation(attacker, tile, elevation, NULL);
|
||||
|
||||
Object* defender = _obj_blocking_at(nullptr, tile, elevation);
|
||||
Object* defender = _obj_blocking_at(NULL, tile, elevation);
|
||||
attackInit(attack, attacker, defender, HIT_MODE_PUNCH, HIT_LOCATION_TORSO);
|
||||
attack->tile = tile;
|
||||
attack->attackerFlags = DAM_HIT;
|
||||
gameUiDisable(1);
|
||||
|
||||
if (defender != nullptr) {
|
||||
if (defender != NULL) {
|
||||
reg_anim_clear(defender);
|
||||
|
||||
int damage;
|
||||
|
@ -1931,25 +1928,25 @@ void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int dam
|
|||
reg_anim_begin(ANIMATION_REQUEST_RESERVED);
|
||||
animationRegisterPlaySoundEffect(attacker, "whc1xxx1", 0);
|
||||
_show_damage(attack, gMaximumBloodDeathAnimations[damageType], 0);
|
||||
animationRegisterCallbackForced(attack, nullptr, (AnimationCallback*)_report_dmg, 0);
|
||||
animationRegisterCallbackForced(attack, NULL, (AnimationCallback*)_report_dmg, 0);
|
||||
animationRegisterHideObjectForced(attacker);
|
||||
|
||||
if (reg_anim_end() == -1) {
|
||||
objectDestroy(attacker, nullptr);
|
||||
objectDestroy(attacker, NULL);
|
||||
internal_free(attack);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (defender != nullptr) {
|
||||
if (defender != NULL) {
|
||||
if ((attack->defenderFlags & DAM_DEAD) != 0) {
|
||||
critterKill(defender, -1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Uninline.
|
||||
_report_dmg(attack, nullptr);
|
||||
_report_dmg(attack, NULL);
|
||||
|
||||
objectDestroy(attacker, nullptr);
|
||||
objectDestroy(attacker, NULL);
|
||||
}
|
||||
|
||||
gameUiEnable();
|
||||
|
@ -1971,7 +1968,7 @@ int _report_dmg(Attack* attack, Object* a2)
|
|||
int _compute_dmg_damage(int min, int max, Object* obj, int* knockbackDistancePtr, int damageType)
|
||||
{
|
||||
if (!_critter_flag_check(obj->pid, CRITTER_NO_KNOCKBACK)) {
|
||||
knockbackDistancePtr = nullptr;
|
||||
knockbackDistancePtr = NULL;
|
||||
}
|
||||
|
||||
int damage = randomBetween(min, max) - critterGetStat(obj, STAT_DAMAGE_THRESHOLD + damageType);
|
||||
|
@ -1983,7 +1980,7 @@ int _compute_dmg_damage(int min, int max, Object* obj, int* knockbackDistancePtr
|
|||
damage = 0;
|
||||
}
|
||||
|
||||
if (knockbackDistancePtr != nullptr) {
|
||||
if (knockbackDistancePtr != NULL) {
|
||||
if ((obj->flags & OBJECT_MULTIHEX) == 0 && damageType != DAMAGE_TYPE_ELECTRICAL) {
|
||||
*knockbackDistancePtr = damage / 10;
|
||||
}
|
||||
|
@ -2027,7 +2024,7 @@ bool actionCheckPush(Object* a1, Object* a2)
|
|||
|
||||
// TODO: Check.
|
||||
Object* whoHitMe = a2->data.critter.combat.whoHitMe;
|
||||
if (whoHitMe != nullptr
|
||||
if (whoHitMe != NULL
|
||||
&& whoHitMe->data.critter.combat.team == a1->data.critter.combat.team) {
|
||||
return false;
|
||||
}
|
||||
|
@ -2064,32 +2061,32 @@ int actionPush(Object* a1, Object* a2)
|
|||
int tile;
|
||||
do {
|
||||
tile = tileGetTileInDirection(a2->tile, rotation, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 1) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 5) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 2) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 4) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
tile = tileGetTileInDirection(a2->tile, (rotation + 3) % ROTATION_COUNT, 1);
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == nullptr) {
|
||||
if (_obj_blocking_at(a2, tile, a2->elevation) == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2115,7 +2112,7 @@ int actionPush(Object* a1, Object* a2)
|
|||
// 0x413970
|
||||
int _action_can_talk_to(Object* a1, Object* a2)
|
||||
{
|
||||
if (pathfinderFindPath(a1, a1->tile, a2->tile, nullptr, 0, _obj_sight_blocking_at) == 0) {
|
||||
if (pathfinderFindPath(a1, a1->tile, a2->tile, NULL, 0, _obj_sight_blocking_at) == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
namespace fallout {
|
||||
|
||||
extern int rotation;
|
||||
|
||||
int _action_attack(Attack* attack);
|
||||
int _action_use_an_item_on_object(Object* a1, Object* a2, Object* a3);
|
||||
int _action_use_an_object(Object* a1, Object* a2);
|
||||
|
@ -15,10 +13,10 @@ int actionPickUp(Object* critter, Object* item);
|
|||
int _action_loot_container(Object* critter, Object* container);
|
||||
int _action_skill_use(int a1);
|
||||
int actionUseSkill(Object* a1, Object* a2, int skill);
|
||||
bool _is_hit_from_front(Object* attacker, Object* defender);
|
||||
bool _is_hit_from_front(Object* a1, Object* a2);
|
||||
bool _can_see(Object* a1, Object* a2);
|
||||
bool _action_explode_running();
|
||||
int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object* sourceObj, bool animate);
|
||||
int actionExplode(int tile, int elevation, int minDamage, int maxDamage, Object* a5, bool a6);
|
||||
int actionTalk(Object* a1, Object* a2);
|
||||
void actionDamage(int tile, int elevation, int minDamage, int maxDamage, int damageType, bool animated, bool bypassArmor);
|
||||
bool actionCheckPush(Object* a1, Object* a2);
|
||||
|
|
209
src/animation.cc
209
src/animation.cc
|
@ -43,8 +43,6 @@ namespace fallout {
|
|||
|
||||
#define ANIMATION_SEQUENCE_FORCED 0x01
|
||||
|
||||
#define PATHFINDING_LIMIT 8192
|
||||
|
||||
typedef enum AnimationKind {
|
||||
ANIM_KIND_MOVE_TO_OBJECT = 0,
|
||||
ANIM_KIND_MOVE_TO_TILE = 1,
|
||||
|
@ -256,7 +254,7 @@ typedef struct AnimationSad {
|
|||
int field_24;
|
||||
union {
|
||||
unsigned char rotations[3200];
|
||||
StraightPathNode straightPathNodeList[PATHFINDING_LIMIT];
|
||||
StraightPathNode straightPathNodeList[200];
|
||||
};
|
||||
} AnimationSad;
|
||||
|
||||
|
@ -505,11 +503,11 @@ int reg_anim_end()
|
|||
// 0x413D6C
|
||||
static int _anim_preload(Object* object, int fid, CacheEntry** cacheEntryPtr)
|
||||
{
|
||||
*cacheEntryPtr = nullptr;
|
||||
*cacheEntryPtr = NULL;
|
||||
|
||||
if (artLock(fid, cacheEntryPtr) != nullptr) {
|
||||
if (artLock(fid, cacheEntryPtr) != NULL) {
|
||||
artUnlock(*cacheEntryPtr);
|
||||
*cacheEntryPtr = nullptr;
|
||||
*cacheEntryPtr = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -530,7 +528,7 @@ static void _anim_cleanup()
|
|||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
for (int index = 0; index < gAnimationDescriptionCurrentIndex; index++) {
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[index]);
|
||||
if (animationDescription->artCacheKey != nullptr) {
|
||||
if (animationDescription->artCacheKey != NULL) {
|
||||
artUnlock(animationDescription->artCacheKey);
|
||||
}
|
||||
|
||||
|
@ -553,7 +551,7 @@ static int _check_registry(Object* obj)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (obj == nullptr) {
|
||||
if (obj == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -582,7 +580,7 @@ static int _check_registry(Object* obj)
|
|||
// 0x413EC8
|
||||
int animationIsBusy(Object* a1)
|
||||
{
|
||||
if (gAnimationDescriptionCurrentIndex >= ANIMATION_DESCRIPTION_LIST_CAPACITY || a1 == nullptr) {
|
||||
if (gAnimationDescriptionCurrentIndex >= ANIMATION_DESCRIPTION_LIST_CAPACITY || a1 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -887,7 +885,7 @@ int animationRegisterAnimateReversed(Object* owner, int anim, int delay)
|
|||
animationDescription->owner = owner;
|
||||
animationDescription->anim = anim;
|
||||
animationDescription->delay = delay;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
|
||||
int fid = buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, animationDescription->anim, (owner->fid & 0xF000) >> 12, owner->rotation + 1);
|
||||
|
||||
|
@ -916,7 +914,7 @@ int animationRegisterAnimateAndHide(Object* owner, int anim, int delay)
|
|||
animationDescription->owner = owner;
|
||||
animationDescription->anim = anim;
|
||||
animationDescription->delay = delay;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
|
||||
int fid = buildFid(FID_TYPE(owner->fid), owner->fid & 0xFFF, anim, (owner->fid & 0xF000) >> 12, owner->rotation + 1);
|
||||
|
||||
|
@ -943,7 +941,7 @@ int animationRegisterRotateToTile(Object* owner, int tile)
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_ROTATE_TO_TILE;
|
||||
animationDescription->delay = -1;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = owner;
|
||||
animationDescription->tile = tile;
|
||||
|
||||
|
@ -964,7 +962,7 @@ int animationRegisterRotateClockwise(Object* owner)
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_ROTATE_CLOCKWISE;
|
||||
animationDescription->delay = -1;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = owner;
|
||||
|
||||
gAnimationDescriptionCurrentIndex++;
|
||||
|
@ -984,7 +982,7 @@ int animationRegisterRotateCounterClockwise(Object* owner)
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_ROTATE_COUNTER_CLOCKWISE;
|
||||
animationDescription->delay = -1;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = owner;
|
||||
|
||||
gAnimationDescriptionCurrentIndex++;
|
||||
|
@ -1006,7 +1004,7 @@ int animationRegisterHideObject(Object* object)
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_HIDE;
|
||||
animationDescription->delay = -1;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->extendedFlags = 0;
|
||||
animationDescription->owner = object;
|
||||
gAnimationDescriptionCurrentIndex++;
|
||||
|
@ -1026,7 +1024,7 @@ int animationRegisterHideObjectForced(Object* object)
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_HIDE;
|
||||
animationDescription->delay = -1;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->extendedFlags = ANIMATION_SEQUENCE_FORCED;
|
||||
animationDescription->owner = object;
|
||||
gAnimationDescriptionCurrentIndex++;
|
||||
|
@ -1037,7 +1035,7 @@ int animationRegisterHideObjectForced(Object* object)
|
|||
// 0x414E98
|
||||
int animationRegisterCallback(void* a1, void* a2, AnimationCallback* proc, int delay)
|
||||
{
|
||||
if (_check_registry(nullptr) == -1 || proc == nullptr) {
|
||||
if (_check_registry(NULL) == -1 || proc == NULL) {
|
||||
_anim_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1046,7 +1044,7 @@ int animationRegisterCallback(void* a1, void* a2, AnimationCallback* proc, int d
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_CALLBACK;
|
||||
animationDescription->extendedFlags = 0;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->param2 = a2;
|
||||
animationDescription->param1 = a1;
|
||||
animationDescription->callback = proc;
|
||||
|
@ -1062,7 +1060,7 @@ int animationRegisterCallback(void* a1, void* a2, AnimationCallback* proc, int d
|
|||
// 0x414F20
|
||||
int animationRegisterCallback3(void* a1, void* a2, void* a3, AnimationCallback3* proc, int delay)
|
||||
{
|
||||
if (_check_registry(nullptr) == -1 || proc == nullptr) {
|
||||
if (_check_registry(NULL) == -1 || proc == NULL) {
|
||||
_anim_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1071,7 +1069,7 @@ int animationRegisterCallback3(void* a1, void* a2, void* a3, AnimationCallback3*
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_CALLBACK3;
|
||||
animationDescription->extendedFlags = 0;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->param2 = a2;
|
||||
animationDescription->param1 = a1;
|
||||
animationDescription->callback3 = proc;
|
||||
|
@ -1086,7 +1084,7 @@ int animationRegisterCallback3(void* a1, void* a2, void* a3, AnimationCallback3*
|
|||
// 0x414FAC
|
||||
int animationRegisterCallbackForced(void* a1, void* a2, AnimationCallback* proc, int delay)
|
||||
{
|
||||
if (_check_registry(nullptr) == -1 || proc == nullptr) {
|
||||
if (_check_registry(NULL) == -1 || proc == NULL) {
|
||||
_anim_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1095,7 +1093,7 @@ int animationRegisterCallbackForced(void* a1, void* a2, AnimationCallback* proc,
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_CALLBACK;
|
||||
animationDescription->extendedFlags = ANIMATION_SEQUENCE_FORCED;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->param2 = a2;
|
||||
animationDescription->param1 = a1;
|
||||
animationDescription->callback = proc;
|
||||
|
@ -1123,7 +1121,7 @@ int animationRegisterSetFlag(Object* object, int flag, int delay)
|
|||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_SET_FLAG;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = object;
|
||||
animationDescription->objectFlag = flag;
|
||||
animationDescription->delay = delay;
|
||||
|
@ -1148,7 +1146,7 @@ int animationRegisterUnsetFlag(Object* object, int flag, int delay)
|
|||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_UNSET_FLAG;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = object;
|
||||
animationDescription->objectFlag = flag;
|
||||
animationDescription->delay = delay;
|
||||
|
@ -1229,7 +1227,7 @@ int animationRegisterSetLightDistance(Object* owner, int lightDistance, int dela
|
|||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_SET_LIGHT_DISTANCE;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = owner;
|
||||
animationDescription->lightDistance = lightDistance;
|
||||
animationDescription->delay = delay;
|
||||
|
@ -1252,7 +1250,7 @@ int animationRegisterToggleOutline(Object* object, bool outline, int delay)
|
|||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_TOGGLE_OUTLINE;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = object;
|
||||
animationDescription->outline = outline;
|
||||
animationDescription->delay = delay;
|
||||
|
@ -1274,10 +1272,10 @@ int animationRegisterPlaySoundEffect(Object* owner, const char* soundEffectName,
|
|||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_CALLBACK;
|
||||
animationDescription->owner = owner;
|
||||
if (soundEffectName != nullptr) {
|
||||
if (soundEffectName != NULL) {
|
||||
int volume = _gsound_compute_relative_volume(owner);
|
||||
animationDescription->param1 = soundEffectLoadWithVolume(soundEffectName, owner, volume);
|
||||
if (animationDescription->param1 != nullptr) {
|
||||
if (animationDescription->param1 != NULL) {
|
||||
animationDescription->callback = (AnimationCallback*)_gsnd_anim_sound;
|
||||
} else {
|
||||
animationDescription->kind = ANIM_KIND_CONTINUE;
|
||||
|
@ -1286,7 +1284,7 @@ int animationRegisterPlaySoundEffect(Object* owner, const char* soundEffectName,
|
|||
animationDescription->kind = ANIM_KIND_CONTINUE;
|
||||
}
|
||||
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->delay = delay;
|
||||
|
||||
gAnimationDescriptionCurrentIndex++;
|
||||
|
@ -1325,7 +1323,7 @@ int animationRegisterAnimateForever(Object* owner, int anim, int delay)
|
|||
// 0x415598
|
||||
int animationRegisterPing(int flags, int delay)
|
||||
{
|
||||
if (_check_registry(nullptr) == -1) {
|
||||
if (_check_registry(NULL) == -1) {
|
||||
_anim_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
@ -1339,9 +1337,9 @@ int animationRegisterPing(int flags, int delay)
|
|||
|
||||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->owner = nullptr;
|
||||
animationDescription->owner = NULL;
|
||||
animationDescription->kind = ANIM_KIND_PING;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->animationSequenceIndex = animationSequenceIndex;
|
||||
animationDescription->delay = delay;
|
||||
|
||||
|
@ -1713,12 +1711,11 @@ int _make_path(Object* object, int from, int to, unsigned char* rotations, int a
|
|||
return pathfinderFindPath(object, from, to, rotations, a5, _obj_blocking_at);
|
||||
}
|
||||
|
||||
// TODO: move pathfinding into another unit
|
||||
// 0x415EFC
|
||||
int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotations, int a5, PathBuilderCallback* callback)
|
||||
{
|
||||
if (a5) {
|
||||
if (callback(object, to, object->elevation) != nullptr) {
|
||||
if (callback(object, to, object->elevation) != NULL) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -1757,7 +1754,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
|||
while (1) {
|
||||
int v63 = -1;
|
||||
|
||||
PathNode* prev = nullptr;
|
||||
PathNode* prev = NULL;
|
||||
int v12 = 0;
|
||||
for (int index = 0; v12 < openPathNodeListLength; index += 1) {
|
||||
PathNode* curr = &(gOpenPathNodeList[index]);
|
||||
|
@ -1803,7 +1800,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
|||
|
||||
if (tile != to) {
|
||||
Object* v24 = callback(object, tile, object->elevation);
|
||||
if (v24 != nullptr) {
|
||||
if (v24 != NULL) {
|
||||
if (!canUseDoor(object, v24)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1843,14 +1840,14 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
|||
|
||||
if (isCritter) {
|
||||
Object* o = objectFindFirstAtLocation(object->elevation, v27->tile);
|
||||
while (o != nullptr) {
|
||||
while (o != NULL) {
|
||||
if (o->pid >= FIRST_RADIOACTIVE_GOO_PID && o->pid <= LAST_RADIOACTIVE_GOO_PID) {
|
||||
break;
|
||||
}
|
||||
o = objectFindNextAtLocation();
|
||||
}
|
||||
|
||||
if (o != nullptr) {
|
||||
if (o != NULL) {
|
||||
if (critterType == KILL_TYPE_GECKO) {
|
||||
v27->cost += 100;
|
||||
} else {
|
||||
|
@ -1873,7 +1870,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
|||
break;
|
||||
}
|
||||
|
||||
if (v39 != nullptr) {
|
||||
if (v39 != NULL) {
|
||||
*v39 = temp.rotation & 0xFF;
|
||||
v39 += 1;
|
||||
}
|
||||
|
@ -1887,7 +1884,7 @@ int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotation
|
|||
memcpy(&temp, v36, sizeof(temp));
|
||||
}
|
||||
|
||||
if (rotations != nullptr) {
|
||||
if (rotations != NULL) {
|
||||
// Looks like array resevering, probably because A* finishes it's path from end to start,
|
||||
// this probably reverses it start-to-end.
|
||||
unsigned char* beginning = rotations;
|
||||
|
@ -1942,19 +1939,19 @@ static int _tile_idistance(int tile1, int tile2)
|
|||
}
|
||||
|
||||
// 0x4163AC
|
||||
int _make_straight_path(Object* obj, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6)
|
||||
int _make_straight_path(Object* a1, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6)
|
||||
{
|
||||
return _make_straight_path_func(obj, from, to, straightPathNodeList, obstaclePtr, a6, _obj_blocking_at);
|
||||
return _make_straight_path_func(a1, from, to, straightPathNodeList, obstaclePtr, a6, _obj_blocking_at);
|
||||
}
|
||||
|
||||
// TODO: Rather complex, but understandable, needs testing.
|
||||
//
|
||||
// 0x4163C8
|
||||
int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6, PathBuilderCallback* callback)
|
||||
int _make_straight_path_func(Object* a1, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6, PathBuilderCallback* callback)
|
||||
{
|
||||
if (obstaclePtr != nullptr) {
|
||||
Object* obstacle = callback(obj, from, obj->elevation);
|
||||
if (obstacle != nullptr) {
|
||||
if (obstaclePtr != NULL) {
|
||||
Object* obstacle = callback(a1, from, a1->elevation);
|
||||
if (obstacle != NULL) {
|
||||
if (obstacle != *obstaclePtr && (a6 != 32 || (obstacle->flags & OBJECT_SHOOT_THRU) == 0)) {
|
||||
*obstaclePtr = obstacle;
|
||||
return 0;
|
||||
|
@ -1964,13 +1961,13 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
|||
|
||||
int fromX;
|
||||
int fromY;
|
||||
tileToScreenXY(from, &fromX, &fromY, obj->elevation);
|
||||
tileToScreenXY(from, &fromX, &fromY, a1->elevation);
|
||||
fromX += 16;
|
||||
fromY += 8;
|
||||
|
||||
int toX;
|
||||
int toY;
|
||||
tileToScreenXY(to, &toX, &toY, obj->elevation);
|
||||
tileToScreenXY(to, &toX, &toY, a1->elevation);
|
||||
toX += 16;
|
||||
toY += 8;
|
||||
|
||||
|
@ -2008,20 +2005,20 @@ 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, obj->elevation);
|
||||
tile = tileFromScreenXY(tileX, tileY, a1->elevation);
|
||||
|
||||
v22 += 1;
|
||||
if (v22 == a6) {
|
||||
if (pathNodeIndex >= PATHFINDING_LIMIT) {
|
||||
if (pathNodeIndex >= 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (straightPathNodeList != nullptr) {
|
||||
if (straightPathNodeList != NULL) {
|
||||
StraightPathNode* pathNode = &(straightPathNodeList[pathNodeIndex]);
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
pathNode->elevation = a1->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
tileToScreenXY(tile, &fromX, &fromY, a1->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
|
@ -2031,8 +2028,8 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
|||
}
|
||||
|
||||
if (tileY == toY) {
|
||||
if (obstaclePtr != nullptr) {
|
||||
*obstaclePtr = nullptr;
|
||||
if (obstaclePtr != NULL) {
|
||||
*obstaclePtr = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2046,11 +2043,11 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
|||
middle += ddx;
|
||||
|
||||
if (tile != prevTile) {
|
||||
if (obstaclePtr != nullptr) {
|
||||
Object* obstacle = callback(obj, tile, obj->elevation);
|
||||
if (obstacle != nullptr) {
|
||||
if (obstacle != *obstaclePtr && (a6 != 32 || (obstacle->flags & OBJECT_SHOOT_THRU) == 0)) {
|
||||
*obstaclePtr = obstacle;
|
||||
if (obstaclePtr != NULL) {
|
||||
Object* obj = callback(a1, tile, a1->elevation);
|
||||
if (obj != NULL) {
|
||||
if (obj != *obstaclePtr && (a6 != 32 || (obj->flags & OBJECT_SHOOT_THRU) == 0)) {
|
||||
*obstaclePtr = obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2061,20 +2058,20 @@ 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, obj->elevation);
|
||||
tile = tileFromScreenXY(tileX, tileY, a1->elevation);
|
||||
|
||||
v22 += 1;
|
||||
if (v22 == a6) {
|
||||
if (pathNodeIndex >= PATHFINDING_LIMIT) {
|
||||
if (pathNodeIndex >= 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (straightPathNodeList != nullptr) {
|
||||
if (straightPathNodeList != NULL) {
|
||||
StraightPathNode* pathNode = &(straightPathNodeList[pathNodeIndex]);
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
pathNode->elevation = a1->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
tileToScreenXY(tile, &fromX, &fromY, a1->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
|
@ -2084,8 +2081,8 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
|||
}
|
||||
|
||||
if (tileX == toX) {
|
||||
if (obstaclePtr != nullptr) {
|
||||
*obstaclePtr = nullptr;
|
||||
if (obstaclePtr != NULL) {
|
||||
*obstaclePtr = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2099,11 +2096,11 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
|||
middle += ddy;
|
||||
|
||||
if (tile != prevTile) {
|
||||
if (obstaclePtr != nullptr) {
|
||||
Object* obstacle = callback(obj, tile, obj->elevation);
|
||||
if (obstacle != nullptr) {
|
||||
if (obstacle != *obstaclePtr && (a6 != 32 || (obstacle->flags & OBJECT_SHOOT_THRU) == 0)) {
|
||||
*obstaclePtr = obstacle;
|
||||
if (obstaclePtr != NULL) {
|
||||
Object* obj = callback(a1, tile, a1->elevation);
|
||||
if (obj != NULL) {
|
||||
if (obj != *obstaclePtr && (a6 != 32 || (obj->flags & OBJECT_SHOOT_THRU) == 0)) {
|
||||
*obstaclePtr = obj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2114,24 +2111,24 @@ int _make_straight_path_func(Object* obj, int from, int to, StraightPathNode* st
|
|||
}
|
||||
|
||||
if (v22 != 0) {
|
||||
if (pathNodeIndex >= PATHFINDING_LIMIT) {
|
||||
if (pathNodeIndex >= 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (straightPathNodeList != nullptr) {
|
||||
if (straightPathNodeList != NULL) {
|
||||
StraightPathNode* pathNode = &(straightPathNodeList[pathNodeIndex]);
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = obj->elevation;
|
||||
pathNode->elevation = a1->elevation;
|
||||
|
||||
tileToScreenXY(tile, &fromX, &fromY, obj->elevation);
|
||||
tileToScreenXY(tile, &fromX, &fromY, a1->elevation);
|
||||
pathNode->x = tileX - fromX - 16;
|
||||
pathNode->y = tileY - fromY - 8;
|
||||
}
|
||||
|
||||
pathNodeIndex += 1;
|
||||
} else {
|
||||
if (pathNodeIndex > 0 && straightPathNodeList != nullptr) {
|
||||
straightPathNodeList[pathNodeIndex - 1].elevation = obj->elevation;
|
||||
if (pathNodeIndex > 0 && straightPathNodeList != NULL) {
|
||||
straightPathNodeList[pathNodeIndex - 1].elevation = a1->elevation;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2198,8 +2195,8 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
toX += 16;
|
||||
toY += 8;
|
||||
|
||||
if (obstaclePtr != nullptr) {
|
||||
*obstaclePtr = nullptr;
|
||||
if (obstaclePtr != NULL) {
|
||||
*obstaclePtr = NULL;
|
||||
}
|
||||
|
||||
int ddx = 2 * abs(toX - fromX);
|
||||
|
@ -2241,11 +2238,11 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
|
||||
iteration += 1;
|
||||
if (iteration == 16) {
|
||||
if (pathNodeIndex >= PATHFINDING_LIMIT) {
|
||||
if (pathNodeIndex >= 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a6 != nullptr) {
|
||||
if (a6 != NULL) {
|
||||
StraightPathNode* pathNode = &(a6[pathNodeIndex]);
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
@ -2272,9 +2269,9 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
middle += ddy;
|
||||
|
||||
if (tile != prevTile) {
|
||||
if (obstaclePtr != nullptr) {
|
||||
if (obstaclePtr != NULL) {
|
||||
*obstaclePtr = _obj_blocking_at(object, tile, object->elevation);
|
||||
if (*obstaclePtr != nullptr) {
|
||||
if (*obstaclePtr != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2288,11 +2285,11 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
|
||||
iteration += 1;
|
||||
if (iteration == 16) {
|
||||
if (pathNodeIndex >= PATHFINDING_LIMIT) {
|
||||
if (pathNodeIndex >= 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a6 != nullptr) {
|
||||
if (a6 != NULL) {
|
||||
StraightPathNode* pathNode = &(a6[pathNodeIndex]);
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
@ -2319,9 +2316,9 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
middle += ddx;
|
||||
|
||||
if (tile != prevTile) {
|
||||
if (obstaclePtr != nullptr) {
|
||||
if (obstaclePtr != NULL) {
|
||||
*obstaclePtr = _obj_blocking_at(object, tile, object->elevation);
|
||||
if (*obstaclePtr != nullptr) {
|
||||
if (*obstaclePtr != NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2331,11 +2328,11 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
}
|
||||
|
||||
if (iteration != 0) {
|
||||
if (pathNodeIndex >= PATHFINDING_LIMIT) {
|
||||
if (pathNodeIndex >= 200) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a6 != nullptr) {
|
||||
if (a6 != NULL) {
|
||||
StraightPathNode* pathNode = &(a6[pathNodeIndex]);
|
||||
pathNode->tile = tile;
|
||||
pathNode->elevation = elevation;
|
||||
|
@ -2348,7 +2345,7 @@ int _make_stair_path(Object* object, int from, int fromElevation, int to, int to
|
|||
pathNodeIndex++;
|
||||
} else {
|
||||
if (pathNodeIndex > 0) {
|
||||
if (a6 != nullptr) {
|
||||
if (a6 != NULL) {
|
||||
a6[pathNodeIndex - 1].elevation = toElevation;
|
||||
}
|
||||
}
|
||||
|
@ -2450,7 +2447,7 @@ static int animateMoveObjectToTileStraight(Object* obj, int tile, int elevation,
|
|||
v15 = 32;
|
||||
}
|
||||
|
||||
sad->field_1C = _make_straight_path(obj, obj->tile, tile, sad->straightPathNodeList, nullptr, v15);
|
||||
sad->field_1C = _make_straight_path(obj, obj->tile, tile, sad->straightPathNodeList, NULL, v15);
|
||||
if (sad->field_1C == 0) {
|
||||
sad->field_20 = -1000;
|
||||
return -1;
|
||||
|
@ -2481,7 +2478,7 @@ static int _anim_move_on_stairs(Object* obj, int tile, int elevation, int anim,
|
|||
sad->animationTimestamp = 0;
|
||||
sad->ticksPerFrame = animationComputeTicksPerFrame(obj, sad->fid);
|
||||
sad->animationSequenceIndex = animationSequenceIndex;
|
||||
sad->field_1C = _make_stair_path(obj, obj->tile, obj->elevation, tile, elevation, sad->straightPathNodeList, nullptr);
|
||||
sad->field_1C = _make_stair_path(obj, obj->tile, obj->elevation, tile, elevation, sad->straightPathNodeList, NULL);
|
||||
if (sad->field_1C == 0) {
|
||||
sad->field_20 = -1000;
|
||||
return -1;
|
||||
|
@ -2516,7 +2513,7 @@ static int _check_for_falling(Object* obj, int anim, int a3)
|
|||
sad->animationTimestamp = 0;
|
||||
sad->ticksPerFrame = animationComputeTicksPerFrame(obj, sad->fid);
|
||||
sad->animationSequenceIndex = a3;
|
||||
sad->field_1C = _make_straight_path_func(obj, obj->tile, obj->tile, sad->straightPathNodeList, nullptr, 16, _obj_blocking_at);
|
||||
sad->field_1C = _make_straight_path_func(obj, obj->tile, obj->tile, sad->straightPathNodeList, 0, 16, _obj_blocking_at);
|
||||
if (sad->field_1C == 0) {
|
||||
sad->field_20 = -1000;
|
||||
return -1;
|
||||
|
@ -2559,7 +2556,7 @@ static void _object_move(int index)
|
|||
|
||||
CacheEntry* cacheHandle;
|
||||
Art* art = artLock(object->fid, &cacheHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
artGetFrameOffsets(art, object->frame, object->rotation, &frameX, &frameY);
|
||||
artUnlock(cacheHandle);
|
||||
} else {
|
||||
|
@ -2579,7 +2576,7 @@ static void _object_move(int index)
|
|||
|
||||
int nextTile = tileGetTileInDirection(object->tile, rotation, 1);
|
||||
Object* obstacle = _obj_blocking_at(object, nextTile, object->elevation);
|
||||
if (obstacle != nullptr) {
|
||||
if (obstacle != NULL) {
|
||||
if (!canUseDoor(object, obstacle)) {
|
||||
sad->field_1C = _make_path(object, object->tile, sad->field_24, sad->rotations, 1);
|
||||
if (sad->field_1C != 0) {
|
||||
|
@ -2666,7 +2663,7 @@ static void _object_straight_move(int index)
|
|||
|
||||
CacheEntry* cacheHandle;
|
||||
Art* art = artLock(object->fid, &cacheHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
int lastFrame = artGetFrameCount(art) - 1;
|
||||
artUnlock(cacheHandle);
|
||||
|
||||
|
@ -2799,7 +2796,7 @@ void _object_animate()
|
|||
if ((sad->flags & ANIM_SAD_REVERSE) == 0) {
|
||||
CacheEntry* cacheHandle;
|
||||
Art* art = artLock(object->fid, &cacheHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
if ((sad->flags & ANIM_SAD_FOREVER) == 0 && object->frame == artGetFrameCount(art) - 1) {
|
||||
sad->field_20 = -1000;
|
||||
artUnlock(cacheHandle);
|
||||
|
@ -2837,7 +2834,7 @@ void _object_animate()
|
|||
|
||||
CacheEntry* cacheHandle;
|
||||
Art* art = artLock(object->fid, &cacheHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
artGetFrameOffsets(art, object->frame, object->rotation, &x, &y);
|
||||
artUnlock(cacheHandle);
|
||||
}
|
||||
|
@ -2860,7 +2857,7 @@ void _object_animate()
|
|||
|
||||
CacheEntry* cacheHandle;
|
||||
Art* art = artLock(object->fid, &cacheHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
artGetRotationOffsets(art, object->rotation, &x, &y);
|
||||
artUnlock(cacheHandle);
|
||||
} else {
|
||||
|
@ -2872,7 +2869,7 @@ void _object_animate()
|
|||
rectUnion(&dirtyRect, &tempRect, &dirtyRect);
|
||||
|
||||
art = artLock(object->fid, &cacheHandle);
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
int frame;
|
||||
if ((sad->flags & ANIM_SAD_REVERSE) != 0) {
|
||||
frame = artGetFrameCount(art) - 1;
|
||||
|
@ -3054,7 +3051,7 @@ void _dude_fidget()
|
|||
|
||||
int candidatesLength = 0;
|
||||
Object* object = objectFindFirstAtElevation(gDude->elevation);
|
||||
while (object != nullptr) {
|
||||
while (object != NULL) {
|
||||
if (candidatesLength >= 100) {
|
||||
break;
|
||||
}
|
||||
|
@ -3131,7 +3128,7 @@ void _dude_stand(Object* obj, int rotation, int fid)
|
|||
int takeOutFid = buildFid(FID_TYPE(obj->fid), obj->fid & 0xFFF, ANIM_TAKE_OUT, weaponAnimationCode, obj->rotation + 1);
|
||||
CacheEntry* takeOutFrmHandle;
|
||||
Art* takeOutFrm = artLock(takeOutFid, &takeOutFrmHandle);
|
||||
if (takeOutFrm != nullptr) {
|
||||
if (takeOutFrm != NULL) {
|
||||
int frameCount = artGetFrameCount(takeOutFrm);
|
||||
for (int frame = 0; frame < frameCount; frame++) {
|
||||
int offsetX;
|
||||
|
@ -3145,7 +3142,7 @@ void _dude_stand(Object* obj, int rotation, int fid)
|
|||
CacheEntry* standFrmHandle;
|
||||
int standFid = buildFid(FID_TYPE(obj->fid), obj->fid & 0xFFF, ANIM_STAND, 0, obj->rotation + 1);
|
||||
Art* standFrm = artLock(standFid, &standFrmHandle);
|
||||
if (standFrm != nullptr) {
|
||||
if (standFrm != NULL) {
|
||||
int offsetX;
|
||||
int offsetY;
|
||||
if (artGetRotationOffsets(standFrm, obj->rotation, &offsetX, &offsetY) == 0) {
|
||||
|
@ -3296,7 +3293,7 @@ static unsigned int animationComputeTicksPerFrame(Object* object, int fid)
|
|||
|
||||
CacheEntry* handle;
|
||||
Art* frm = artLock(fid, &handle);
|
||||
if (frm != nullptr) {
|
||||
if (frm != NULL) {
|
||||
fps = artGetFramesPerSecond(frm);
|
||||
artUnlock(handle);
|
||||
} else {
|
||||
|
@ -3324,7 +3321,7 @@ int animationRegisterSetLightIntensity(Object* owner, int lightDistance, int lig
|
|||
AnimationSequence* animationSequence = &(gAnimationSequences[gAnimationSequenceCurrentIndex]);
|
||||
AnimationDescription* animationDescription = &(animationSequence->animations[gAnimationDescriptionCurrentIndex]);
|
||||
animationDescription->kind = ANIM_KIND_SET_LIGHT_INTENSITY;
|
||||
animationDescription->artCacheKey = nullptr;
|
||||
animationDescription->artCacheKey = NULL;
|
||||
animationDescription->owner = owner;
|
||||
animationDescription->lightDistance = lightDistance;
|
||||
animationDescription->lightIntensity = lightIntensity;
|
||||
|
|
|
@ -145,8 +145,8 @@ int animationRegisterAnimateForever(Object* owner, int anim, int delay);
|
|||
int animationRegisterPing(int flags, int delay);
|
||||
int _make_path(Object* object, int from, int to, unsigned char* a4, int a5);
|
||||
int pathfinderFindPath(Object* object, int from, int to, unsigned char* rotations, int a5, PathBuilderCallback* callback);
|
||||
int _make_straight_path(Object* object, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6);
|
||||
int _make_straight_path_func(Object* object, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6, PathBuilderCallback* callback);
|
||||
int _make_straight_path(Object* a1, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6);
|
||||
int _make_straight_path_func(Object* a1, int from, int to, StraightPathNode* straightPathNodeList, Object** obstaclePtr, int a6, PathBuilderCallback* callback);
|
||||
void _object_animate();
|
||||
int _check_move(int* actionPointsPtr);
|
||||
int _dude_move(int actionPoints);
|
||||
|
|
174
src/art.cc
174
src/art.cc
|
@ -53,17 +53,17 @@ static char gDefaultTribalFemaleFileName[] = "hfprim";
|
|||
|
||||
// 0x510738
|
||||
static ArtListDescription gArtListDescriptions[OBJ_TYPE_COUNT] = {
|
||||
{ 0, "items", nullptr, nullptr, 0 },
|
||||
{ 0, "critters", nullptr, nullptr, 0 },
|
||||
{ 0, "scenery", nullptr, nullptr, 0 },
|
||||
{ 0, "walls", nullptr, nullptr, 0 },
|
||||
{ 0, "tiles", nullptr, nullptr, 0 },
|
||||
{ 0, "misc", nullptr, nullptr, 0 },
|
||||
{ 0, "intrface", nullptr, nullptr, 0 },
|
||||
{ 0, "inven", nullptr, nullptr, 0 },
|
||||
{ 0, "heads", nullptr, nullptr, 0 },
|
||||
{ 0, "backgrnd", nullptr, nullptr, 0 },
|
||||
{ 0, "skilldex", nullptr, nullptr, 0 },
|
||||
{ 0, "items", 0, 0, 0 },
|
||||
{ 0, "critters", 0, 0, 0 },
|
||||
{ 0, "scenery", 0, 0, 0 },
|
||||
{ 0, "walls", 0, 0, 0 },
|
||||
{ 0, "tiles", 0, 0, 0 },
|
||||
{ 0, "misc", 0, 0, 0 },
|
||||
{ 0, "intrface", 0, 0, 0 },
|
||||
{ 0, "inven", 0, 0, 0 },
|
||||
{ 0, "heads", 0, 0, 0 },
|
||||
{ 0, "backgrnd", 0, 0, 0 },
|
||||
{ 0, "skilldex", 0, 0, 0 },
|
||||
};
|
||||
|
||||
// This flag denotes that localized arts should be looked up first. Used
|
||||
|
@ -159,7 +159,7 @@ int artInit()
|
|||
}
|
||||
|
||||
_anon_alias = (int*)internal_malloc(sizeof(*_anon_alias) * gArtListDescriptions[OBJ_TYPE_CRITTER].fileNamesLength);
|
||||
if (_anon_alias == nullptr) {
|
||||
if (_anon_alias == NULL) {
|
||||
gArtListDescriptions[OBJ_TYPE_CRITTER].fileNamesLength = 0;
|
||||
debugPrint("Out of memory for anon_alias in art_init\n");
|
||||
cacheFree(&gArtCache);
|
||||
|
@ -167,7 +167,7 @@ int artInit()
|
|||
}
|
||||
|
||||
gArtCritterFidShoudRunData = (int*)internal_malloc(sizeof(*gArtCritterFidShoudRunData) * gArtListDescriptions[1].fileNamesLength);
|
||||
if (gArtCritterFidShoudRunData == nullptr) {
|
||||
if (gArtCritterFidShoudRunData == NULL) {
|
||||
gArtListDescriptions[OBJ_TYPE_CRITTER].fileNamesLength = 0;
|
||||
debugPrint("Out of memory for artCritterFidShouldRunData in art_init\n");
|
||||
cacheFree(&gArtCache);
|
||||
|
@ -181,34 +181,34 @@ int artInit()
|
|||
snprintf(path, sizeof(path), "%s%s%s\\%s.lst", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_CRITTER].name, gArtListDescriptions[OBJ_TYPE_CRITTER].name);
|
||||
|
||||
stream = fileOpen(path, "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("Unable to open %s in art_init\n", path);
|
||||
cacheFree(&gArtCache);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// SFALL: Modify player model settings.
|
||||
char* jumpsuitMaleFileName = nullptr;
|
||||
char* jumpsuitMaleFileName = NULL;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_MALE_KEY, &jumpsuitMaleFileName);
|
||||
if (jumpsuitMaleFileName == nullptr || jumpsuitMaleFileName[0] == '\0') {
|
||||
if (jumpsuitMaleFileName == NULL || jumpsuitMaleFileName[0] == '\0') {
|
||||
jumpsuitMaleFileName = gDefaultJumpsuitMaleFileName;
|
||||
}
|
||||
|
||||
char* jumpsuitFemaleFileName = nullptr;
|
||||
char* jumpsuitFemaleFileName = NULL;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_JUMPSUIT_FEMALE_KEY, &jumpsuitFemaleFileName);
|
||||
if (jumpsuitFemaleFileName == nullptr || jumpsuitFemaleFileName[0] == '\0') {
|
||||
if (jumpsuitFemaleFileName == NULL || jumpsuitFemaleFileName[0] == '\0') {
|
||||
jumpsuitFemaleFileName = gDefaultJumpsuitFemaleFileName;
|
||||
}
|
||||
|
||||
char* tribalMaleFileName = nullptr;
|
||||
char* tribalMaleFileName = NULL;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_MALE_KEY, &tribalMaleFileName);
|
||||
if (tribalMaleFileName == nullptr || tribalMaleFileName[0] == '\0') {
|
||||
if (tribalMaleFileName == NULL || tribalMaleFileName[0] == '\0') {
|
||||
tribalMaleFileName = gDefaultTribalMaleFileName;
|
||||
}
|
||||
|
||||
char* tribalFemaleFileName = nullptr;
|
||||
char* tribalFemaleFileName = NULL;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_DUDE_NATIVE_LOOK_TRIBAL_FEMALE_KEY, &tribalFemaleFileName);
|
||||
if (tribalFemaleFileName == nullptr || tribalFemaleFileName[0] == '\0') {
|
||||
if (tribalFemaleFileName == NULL || tribalFemaleFileName[0] == '\0') {
|
||||
tribalFemaleFileName = gDefaultTribalFemaleFileName;
|
||||
}
|
||||
|
||||
|
@ -236,11 +236,11 @@ int artInit()
|
|||
}
|
||||
|
||||
char* sep1 = strchr(string, ',');
|
||||
if (sep1 != nullptr) {
|
||||
if (sep1 != NULL) {
|
||||
_anon_alias[critterIndex] = atoi(sep1 + 1);
|
||||
|
||||
char* sep2 = strchr(sep1 + 1, ',');
|
||||
if (sep2 != nullptr) {
|
||||
if (sep2 != NULL) {
|
||||
gArtCritterFidShoudRunData[critterIndex] = atoi(sep2 + 1);
|
||||
} else {
|
||||
gArtCritterFidShoudRunData[critterIndex] = 0;
|
||||
|
@ -262,7 +262,7 @@ int artInit()
|
|||
}
|
||||
|
||||
gHeadDescriptions = (HeadDescription*)internal_malloc(sizeof(*gHeadDescriptions) * gArtListDescriptions[OBJ_TYPE_HEAD].fileNamesLength);
|
||||
if (gHeadDescriptions == nullptr) {
|
||||
if (gHeadDescriptions == NULL) {
|
||||
gArtListDescriptions[OBJ_TYPE_HEAD].fileNamesLength = 0;
|
||||
debugPrint("Out of memory for head_info in art_init\n");
|
||||
cacheFree(&gArtCache);
|
||||
|
@ -272,7 +272,7 @@ int artInit()
|
|||
snprintf(path, sizeof(path), "%s%s%s\\%s.lst", _cd_path_base, "art\\", gArtListDescriptions[OBJ_TYPE_HEAD].name, gArtListDescriptions[OBJ_TYPE_HEAD].name);
|
||||
|
||||
stream = fileOpen(path, "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("Unable to open %s in art_init\n", path);
|
||||
cacheFree(&gArtCache);
|
||||
return -1;
|
||||
|
@ -284,14 +284,14 @@ int artInit()
|
|||
}
|
||||
|
||||
char* sep1 = strchr(string, ',');
|
||||
if (sep1 != nullptr) {
|
||||
if (sep1 != NULL) {
|
||||
*sep1 = '\0';
|
||||
} else {
|
||||
sep1 = string;
|
||||
}
|
||||
|
||||
char* sep2 = strchr(sep1, ',');
|
||||
if (sep2 != nullptr) {
|
||||
if (sep2 != NULL) {
|
||||
*sep2 = '\0';
|
||||
} else {
|
||||
sep2 = sep1;
|
||||
|
@ -300,7 +300,7 @@ int artInit()
|
|||
gHeadDescriptions[headIndex].goodFidgetCount = atoi(sep1 + 1);
|
||||
|
||||
char* sep3 = strchr(sep2, ',');
|
||||
if (sep3 != nullptr) {
|
||||
if (sep3 != NULL) {
|
||||
*sep3 = '\0';
|
||||
} else {
|
||||
sep3 = sep2;
|
||||
|
@ -309,7 +309,7 @@ int artInit()
|
|||
gHeadDescriptions[headIndex].neutralFidgetCount = atoi(sep2 + 1);
|
||||
|
||||
char* sep4 = strpbrk(sep3 + 1, " ,;\t\n");
|
||||
if (sep4 != nullptr) {
|
||||
if (sep4 != NULL) {
|
||||
*sep4 = '\0';
|
||||
}
|
||||
|
||||
|
@ -336,10 +336,10 @@ void artExit()
|
|||
|
||||
for (int index = 0; index < OBJ_TYPE_COUNT; index++) {
|
||||
internal_free(gArtListDescriptions[index].fileNames);
|
||||
gArtListDescriptions[index].fileNames = nullptr;
|
||||
gArtListDescriptions[index].fileNames = NULL;
|
||||
|
||||
internal_free(gArtListDescriptions[index].field_18);
|
||||
gArtListDescriptions[index].field_18 = nullptr;
|
||||
gArtListDescriptions[index].field_18 = NULL;
|
||||
}
|
||||
|
||||
internal_free(gHeadDescriptions);
|
||||
|
@ -348,7 +348,7 @@ void artExit()
|
|||
// 0x418F1C
|
||||
char* artGetObjectTypeName(int objectType)
|
||||
{
|
||||
return objectType >= OBJ_TYPE_ITEM && objectType < OBJ_TYPE_COUNT ? gArtListDescriptions[objectType].name : nullptr;
|
||||
return objectType >= OBJ_TYPE_ITEM && objectType < OBJ_TYPE_COUNT ? gArtListDescriptions[objectType].name : NULL;
|
||||
}
|
||||
|
||||
// 0x418F34
|
||||
|
@ -396,7 +396,7 @@ void artRender(int fid, unsigned char* dest, int width, int height, int pitch)
|
|||
|
||||
CacheEntry* handle;
|
||||
Art* frm = artLock(fid, &handle);
|
||||
if (frm == nullptr) {
|
||||
if (frm == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -438,22 +438,14 @@ void artRender(int fid, unsigned char* dest, int width, int height, int pitch)
|
|||
artUnlock(handle);
|
||||
}
|
||||
|
||||
// mapper2.exe: 0x40A03C
|
||||
int art_list_str(int fid, char* name)
|
||||
{
|
||||
// TODO: Incomplete.
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 0x419160
|
||||
Art* artLock(int fid, CacheEntry** handlePtr)
|
||||
{
|
||||
if (handlePtr == nullptr) {
|
||||
return nullptr;
|
||||
if (handlePtr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Art* art = nullptr;
|
||||
Art* art = NULL;
|
||||
cacheLock(&gArtCache, fid, (void**)&art, handlePtr);
|
||||
return art;
|
||||
}
|
||||
|
@ -464,44 +456,44 @@ unsigned char* artLockFrameData(int fid, int frame, int direction, CacheEntry**
|
|||
Art* art;
|
||||
ArtFrame* frm;
|
||||
|
||||
art = nullptr;
|
||||
art = NULL;
|
||||
if (handlePtr) {
|
||||
cacheLock(&gArtCache, fid, (void**)&art, handlePtr);
|
||||
}
|
||||
|
||||
if (art != nullptr) {
|
||||
if (art != NULL) {
|
||||
frm = artGetFrame(art, frame, direction);
|
||||
if (frm != nullptr) {
|
||||
if (frm != NULL) {
|
||||
|
||||
return (unsigned char*)frm + sizeof(*frm);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x4191CC
|
||||
unsigned char* artLockFrameDataReturningSize(int fid, CacheEntry** handlePtr, int* widthPtr, int* heightPtr)
|
||||
{
|
||||
*handlePtr = nullptr;
|
||||
*handlePtr = NULL;
|
||||
|
||||
Art* art = nullptr;
|
||||
Art* art = NULL;
|
||||
cacheLock(&gArtCache, fid, (void**)&art, handlePtr);
|
||||
|
||||
if (art == nullptr) {
|
||||
return nullptr;
|
||||
if (art == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// NOTE: Uninline.
|
||||
*widthPtr = artGetWidth(art, 0, 0);
|
||||
if (*widthPtr == -1) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// NOTE: Uninline.
|
||||
*heightPtr = artGetHeight(art, 0, 0);
|
||||
if (*heightPtr == -1) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// NOTE: Uninline.
|
||||
|
@ -634,18 +626,18 @@ char* artBuildFilePath(int fid)
|
|||
type = FID_TYPE(v2);
|
||||
|
||||
if (v3 >= gArtListDescriptions[type].fileNamesLength) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (type < OBJ_TYPE_ITEM || type >= OBJ_TYPE_COUNT) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8 = v3 * 13;
|
||||
|
||||
if (type == 1) {
|
||||
if (_art_get_code(v4, v5, &v11, &v12) == -1) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
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);
|
||||
|
@ -671,7 +663,7 @@ char* artBuildFilePath(int fid)
|
|||
static int artReadList(const char* path, char** artListPtr, int* artListSizePtr)
|
||||
{
|
||||
File* stream = fileOpen(path, "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -687,14 +679,14 @@ static int artReadList(const char* path, char** artListPtr, int* artListSizePtr)
|
|||
|
||||
char* artList = (char*)internal_malloc(13 * count);
|
||||
*artListPtr = artList;
|
||||
if (artList == nullptr) {
|
||||
if (artList == NULL) {
|
||||
fileClose(stream);
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (fileReadString(string, sizeof(string), stream)) {
|
||||
char* brk = strpbrk(string, " ,;\r\t\n");
|
||||
if (brk != nullptr) {
|
||||
if (brk != NULL) {
|
||||
*brk = '\0';
|
||||
}
|
||||
|
||||
|
@ -712,7 +704,7 @@ static int artReadList(const char* path, char** artListPtr, int* artListSizePtr)
|
|||
// 0x419760
|
||||
int artGetFramesPerSecond(Art* art)
|
||||
{
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
|
@ -722,13 +714,13 @@ int artGetFramesPerSecond(Art* art)
|
|||
// 0x419778
|
||||
int artGetActionFrame(Art* art)
|
||||
{
|
||||
return art == nullptr ? -1 : art->actionFrame;
|
||||
return art == NULL ? -1 : art->actionFrame;
|
||||
}
|
||||
|
||||
// 0x41978C
|
||||
int artGetFrameCount(Art* art)
|
||||
{
|
||||
return art == nullptr ? -1 : art->frameCount;
|
||||
return art == NULL ? -1 : art->frameCount;
|
||||
}
|
||||
|
||||
// 0x4197A0
|
||||
|
@ -737,7 +729,7 @@ int artGetWidth(Art* art, int frame, int direction)
|
|||
ArtFrame* frm;
|
||||
|
||||
frm = artGetFrame(art, frame, direction);
|
||||
if (frm == nullptr) {
|
||||
if (frm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -750,7 +742,7 @@ int artGetHeight(Art* art, int frame, int direction)
|
|||
ArtFrame* frm;
|
||||
|
||||
frm = artGetFrame(art, frame, direction);
|
||||
if (frm == nullptr) {
|
||||
if (frm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -763,23 +755,23 @@ int artGetSize(Art* art, int frame, int direction, int* widthPtr, int* heightPtr
|
|||
ArtFrame* frm;
|
||||
|
||||
frm = artGetFrame(art, frame, direction);
|
||||
if (frm == nullptr) {
|
||||
if (widthPtr != nullptr) {
|
||||
if (frm == NULL) {
|
||||
if (widthPtr != NULL) {
|
||||
*widthPtr = 0;
|
||||
}
|
||||
|
||||
if (heightPtr != nullptr) {
|
||||
if (heightPtr != NULL) {
|
||||
*heightPtr = 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (widthPtr != nullptr) {
|
||||
if (widthPtr != NULL) {
|
||||
*widthPtr = frm->width;
|
||||
}
|
||||
|
||||
if (heightPtr != nullptr) {
|
||||
if (heightPtr != NULL) {
|
||||
*heightPtr = frm->height;
|
||||
}
|
||||
|
||||
|
@ -792,7 +784,7 @@ int artGetFrameOffsets(Art* art, int frame, int direction, int* xPtr, int* yPtr)
|
|||
ArtFrame* frm;
|
||||
|
||||
frm = artGetFrame(art, frame, direction);
|
||||
if (frm == nullptr) {
|
||||
if (frm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -805,7 +797,7 @@ int artGetFrameOffsets(Art* art, int frame, int direction, int* xPtr, int* yPtr)
|
|||
// 0x41984C
|
||||
int artGetRotationOffsets(Art* art, int rotation, int* xPtr, int* yPtr)
|
||||
{
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -821,8 +813,8 @@ unsigned char* artGetFrameData(Art* art, int frame, int direction)
|
|||
ArtFrame* frm;
|
||||
|
||||
frm = artGetFrame(art, frame, direction);
|
||||
if (frm == nullptr) {
|
||||
return nullptr;
|
||||
if (frm == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (unsigned char*)frm + sizeof(*frm);
|
||||
|
@ -832,15 +824,15 @@ unsigned char* artGetFrameData(Art* art, int frame, int direction)
|
|||
ArtFrame* artGetFrame(Art* art, int frame, int rotation)
|
||||
{
|
||||
if (rotation < 0 || rotation >= 6) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (art == nullptr) {
|
||||
return nullptr;
|
||||
if (art == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (frame < 0 || frame >= art->frameCount) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ArtFrame* frm = (ArtFrame*)((unsigned char*)art + sizeof(*art) + art->dataOffsets[rotation] + art->padding[rotation]);
|
||||
|
@ -856,7 +848,7 @@ bool artExists(int fid)
|
|||
bool result = false;
|
||||
|
||||
char* filePath = artBuildFilePath(fid);
|
||||
if (filePath != nullptr) {
|
||||
if (filePath != NULL) {
|
||||
int fileSize;
|
||||
if (dbGetFileSize(filePath, &fileSize) != -1) {
|
||||
result = true;
|
||||
|
@ -874,7 +866,7 @@ bool _art_fid_valid(int fid)
|
|||
bool result = false;
|
||||
|
||||
char* filePath = artBuildFilePath(fid);
|
||||
if (filePath != nullptr) {
|
||||
if (filePath != NULL) {
|
||||
int fileSize;
|
||||
if (dbGetFileSize(filePath, &fileSize) != -1) {
|
||||
result = true;
|
||||
|
@ -930,13 +922,13 @@ static int artCacheGetFileSizeImpl(int fid, int* sizePtr)
|
|||
int result = -1;
|
||||
|
||||
char* artFilePath = artBuildFilePath(fid);
|
||||
if (artFilePath != nullptr) {
|
||||
if (artFilePath != NULL) {
|
||||
bool loaded = false;
|
||||
File* stream = nullptr;
|
||||
File* stream = NULL;
|
||||
|
||||
if (gArtLanguageInitialized) {
|
||||
char* pch = strchr(artFilePath, '\\');
|
||||
if (pch == nullptr) {
|
||||
if (pch == NULL) {
|
||||
pch = artFilePath;
|
||||
}
|
||||
|
||||
|
@ -946,11 +938,11 @@ static int artCacheGetFileSizeImpl(int fid, int* sizePtr)
|
|||
stream = fileOpen(localizedPath, "rb");
|
||||
}
|
||||
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
stream = fileOpen(artFilePath, "rb");
|
||||
}
|
||||
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
Art art;
|
||||
if (artReadHeader(&art, stream) == 0) {
|
||||
*sizePtr = artGetDataSize(&art);
|
||||
|
@ -969,11 +961,11 @@ static int artCacheReadDataImpl(int fid, int* sizePtr, unsigned char* data)
|
|||
int result = -1;
|
||||
|
||||
char* artFileName = artBuildFilePath(fid);
|
||||
if (artFileName != nullptr) {
|
||||
if (artFileName != NULL) {
|
||||
bool loaded = false;
|
||||
if (gArtLanguageInitialized) {
|
||||
char* pch = strchr(artFileName, '\\');
|
||||
if (pch == nullptr) {
|
||||
if (pch == NULL) {
|
||||
pch = artFileName;
|
||||
}
|
||||
|
||||
|
@ -1130,7 +1122,7 @@ Art* artLoad(const char* path)
|
|||
int artRead(const char* path, unsigned char* data)
|
||||
{
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
@ -1205,12 +1197,12 @@ int artWriteHeader(Art* art, File* stream)
|
|||
// 0x41A1E8
|
||||
int artWrite(const char* path, unsigned char* data)
|
||||
{
|
||||
if (data == nullptr) {
|
||||
if (data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
File* stream = fileOpen(path, "wb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,6 @@ char* artGetObjectTypeName(int objectType);
|
|||
int artIsObjectTypeHidden(int objectType);
|
||||
int artGetFidgetCount(int headFid);
|
||||
void artRender(int fid, unsigned char* dest, int width, int height, int pitch);
|
||||
int art_list_str(int fid, char* name);
|
||||
Art* artLock(int fid, CacheEntry** cache_entry);
|
||||
unsigned char* artLockFrameData(int fid, int frame, int direction, CacheEntry** out_cache_entry);
|
||||
unsigned char* artLockFrameDataReturningSize(int fid, CacheEntry** out_cache_entry, int* widthPtr, int* heightPtr);
|
||||
|
|
12
src/audio.cc
12
src/audio.cc
|
@ -43,7 +43,7 @@ static Audio* gAudioList;
|
|||
static bool defaultCompressionFunc(char* filePath)
|
||||
{
|
||||
char* pch = strrchr(filePath, '.');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
strcpy(pch + 1, "raw");
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ int audioOpen(const char* fname, int* sampleRate)
|
|||
}
|
||||
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("AudioOpen: Couldn't open %s for read\n", path);
|
||||
return -1;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ int audioOpen(const char* fname, int* sampleRate)
|
|||
}
|
||||
|
||||
if (index == gAudioListLength) {
|
||||
if (gAudioList != nullptr) {
|
||||
if (gAudioList != NULL) {
|
||||
gAudioList = (Audio*)internal_realloc_safe(gAudioList, sizeof(*gAudioList) * (gAudioListLength + 1), __FILE__, __LINE__); // "..\int\audio.c", 216
|
||||
} else {
|
||||
gAudioList = (Audio*)internal_malloc_safe(sizeof(*gAudioList), __FILE__, __LINE__); // "..\int\audio.c", 218
|
||||
|
@ -234,7 +234,7 @@ int audioWrite(int handle, const void* buf, unsigned int size)
|
|||
int audioInit(AudioQueryCompressedFunc* func)
|
||||
{
|
||||
queryCompressedFunc = func;
|
||||
gAudioList = nullptr;
|
||||
gAudioList = NULL;
|
||||
gAudioListLength = 0;
|
||||
|
||||
return soundSetDefaultFileIO(audioOpen, audioClose, audioRead, audioWrite, audioSeek, audioTell, audioGetSize);
|
||||
|
@ -243,12 +243,12 @@ int audioInit(AudioQueryCompressedFunc* func)
|
|||
// 0x41A818
|
||||
void audioExit()
|
||||
{
|
||||
if (gAudioList != nullptr) {
|
||||
if (gAudioList != NULL) {
|
||||
internal_free_safe(gAudioList, __FILE__, __LINE__); // "..\int\audio.c", 406
|
||||
}
|
||||
|
||||
gAudioListLength = 0;
|
||||
gAudioList = nullptr;
|
||||
gAudioList = NULL;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -106,7 +106,7 @@ bool audioEngineInit()
|
|||
desiredSpec.samples = 1024;
|
||||
desiredSpec.callback = audioEngineMixin;
|
||||
|
||||
gAudioEngineDeviceId = SDL_OpenAudioDevice(nullptr, 0, &desiredSpec, &gAudioEngineSpec, SDL_AUDIO_ALLOW_ANY_CHANGE);
|
||||
gAudioEngineDeviceId = SDL_OpenAudioDevice(NULL, 0, &desiredSpec, &gAudioEngineSpec, SDL_AUDIO_ALLOW_ANY_CHANGE);
|
||||
if (gAudioEngineDeviceId == -1) {
|
||||
return false;
|
||||
}
|
||||
|
@ -191,10 +191,10 @@ bool audioEngineSoundBufferRelease(int soundBufferIndex)
|
|||
soundBuffer->active = false;
|
||||
|
||||
free(soundBuffer->data);
|
||||
soundBuffer->data = nullptr;
|
||||
soundBuffer->data = NULL;
|
||||
|
||||
SDL_FreeAudioStream(soundBuffer->stream);
|
||||
soundBuffer->stream = nullptr;
|
||||
soundBuffer->stream = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -331,11 +331,11 @@ bool audioEngineSoundBufferGetCurrentPosition(int soundBufferIndex, unsigned int
|
|||
return false;
|
||||
}
|
||||
|
||||
if (readPosPtr != nullptr) {
|
||||
if (readPosPtr != NULL) {
|
||||
*readPosPtr = soundBuffer->pos;
|
||||
}
|
||||
|
||||
if (writePosPtr != nullptr) {
|
||||
if (writePosPtr != NULL) {
|
||||
*writePosPtr = soundBuffer->pos;
|
||||
|
||||
if (soundBuffer->playing) {
|
||||
|
@ -388,12 +388,12 @@ bool audioEngineSoundBufferLock(int soundBufferIndex, unsigned int writePos, uns
|
|||
return false;
|
||||
}
|
||||
|
||||
if (audioBytes1 == nullptr) {
|
||||
if (audioBytes1 == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((flags & AUDIO_ENGINE_SOUND_BUFFER_LOCK_FROM_WRITE_POS) != 0) {
|
||||
if (!audioEngineSoundBufferGetCurrentPosition(soundBufferIndex, nullptr, &writePos)) {
|
||||
if (!audioEngineSoundBufferGetCurrentPosition(soundBufferIndex, NULL, &writePos)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -406,11 +406,11 @@ bool audioEngineSoundBufferLock(int soundBufferIndex, unsigned int writePos, uns
|
|||
*(unsigned char**)audioPtr1 = (unsigned char*)soundBuffer->data + writePos;
|
||||
*audioBytes1 = writeBytes;
|
||||
|
||||
if (audioPtr2 != nullptr) {
|
||||
*audioPtr2 = nullptr;
|
||||
if (audioPtr2 != NULL) {
|
||||
*audioPtr2 = NULL;
|
||||
}
|
||||
|
||||
if (audioBytes2 != nullptr) {
|
||||
if (audioBytes2 != NULL) {
|
||||
*audioBytes2 = 0;
|
||||
}
|
||||
} else {
|
||||
|
@ -418,11 +418,11 @@ bool audioEngineSoundBufferLock(int soundBufferIndex, unsigned int writePos, uns
|
|||
*(unsigned char**)audioPtr1 = (unsigned char*)soundBuffer->data + writePos;
|
||||
*audioBytes1 = soundBuffer->size - writePos;
|
||||
|
||||
if (audioPtr2 != nullptr) {
|
||||
if (audioPtr2 != NULL) {
|
||||
*(unsigned char**)audioPtr2 = (unsigned char*)soundBuffer->data;
|
||||
}
|
||||
|
||||
if (audioBytes2 != nullptr) {
|
||||
if (audioBytes2 != NULL) {
|
||||
*audioBytes2 = writeBytes - (soundBuffer->size - writePos);
|
||||
}
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ bool audioEngineSoundBufferGetStatus(int soundBufferIndex, unsigned int* statusP
|
|||
return false;
|
||||
}
|
||||
|
||||
if (statusPtr == nullptr) {
|
||||
if (statusPtr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ static int gAudioFileListLength;
|
|||
static bool defaultCompressionFunc(char* filePath)
|
||||
{
|
||||
char* pch = strrchr(filePath, '.');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
strcpy(pch + 1, "raw");
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ int audioFileOpen(const char* fname, int* sampleRate)
|
|||
}
|
||||
|
||||
FILE* stream = compat_fopen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ int audioFileOpen(const char* fname, int* sampleRate)
|
|||
}
|
||||
|
||||
if (index == gAudioFileListLength) {
|
||||
if (gAudioFileList != nullptr) {
|
||||
if (gAudioFileList != NULL) {
|
||||
gAudioFileList = (AudioFile*)internal_realloc_safe(gAudioFileList, sizeof(*gAudioFileList) * (gAudioFileListLength + 1), __FILE__, __LINE__); // "..\int\audiof.c", 207
|
||||
} else {
|
||||
gAudioFileList = (AudioFile*)internal_malloc_safe(sizeof(*gAudioFileList), __FILE__, __LINE__); // "..\int\audiof.c", 209
|
||||
|
@ -231,7 +231,7 @@ int audioFileWrite(int handle, const void* buffer, unsigned int size)
|
|||
int audioFileInit(AudioFileQueryCompressedFunc* func)
|
||||
{
|
||||
queryCompressedFunc = func;
|
||||
gAudioFileList = nullptr;
|
||||
gAudioFileList = NULL;
|
||||
gAudioFileListLength = 0;
|
||||
|
||||
return soundSetDefaultFileIO(audioFileOpen, audioFileClose, audioFileRead, audioFileWrite, audioFileSeek, audioFileTell, audioFileGetSize);
|
||||
|
@ -240,12 +240,12 @@ int audioFileInit(AudioFileQueryCompressedFunc* func)
|
|||
// 0x41ADAC
|
||||
void audioFileExit()
|
||||
{
|
||||
if (gAudioFileList != nullptr) {
|
||||
if (gAudioFileList != NULL) {
|
||||
internal_free_safe(gAudioFileList, __FILE__, __LINE__); // "..\int\audiof.c", 405
|
||||
}
|
||||
|
||||
gAudioFileListLength = 0;
|
||||
gAudioFileList = nullptr;
|
||||
gAudioFileList = NULL;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -336,7 +336,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
|||
KEY_LOWERCASE_S,
|
||||
frmImages[AUTOMAP_FRM_BUTTON_UP].getData(),
|
||||
frmImages[AUTOMAP_FRM_BUTTON_DOWN].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (scannerBtn != -1) {
|
||||
buttonSetCallbacks(scannerBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -353,7 +353,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
|||
KEY_ESCAPE,
|
||||
frmImages[AUTOMAP_FRM_BUTTON_UP].getData(),
|
||||
frmImages[AUTOMAP_FRM_BUTTON_DOWN].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (cancelBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -370,7 +370,7 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
|||
KEY_LOWERCASE_H,
|
||||
frmImages[AUTOMAP_FRM_SWITCH_UP].getData(),
|
||||
frmImages[AUTOMAP_FRM_SWITCH_DOWN].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_0x01);
|
||||
if (switchBtn != -1) {
|
||||
buttonSetCallbacks(switchBtn, _gsound_toggle_butt_press_, _gsound_toggle_butt_press_);
|
||||
|
@ -435,19 +435,19 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
|||
}
|
||||
|
||||
if ((gAutomapFlags & AUTOMAP_WITH_SCANNER) == 0) {
|
||||
Object* scanner = nullptr;
|
||||
Object* scanner = NULL;
|
||||
|
||||
Object* item1 = critterGetItem1(gDude);
|
||||
if (item1 != nullptr && item1->pid == PROTO_ID_MOTION_SENSOR) {
|
||||
if (item1 != NULL && item1->pid == PROTO_ID_MOTION_SENSOR) {
|
||||
scanner = item1;
|
||||
} else {
|
||||
Object* item2 = critterGetItem2(gDude);
|
||||
if (item2 != nullptr && item2->pid == PROTO_ID_MOTION_SENSOR) {
|
||||
if (item2 != NULL && item2->pid == PROTO_ID_MOTION_SENSOR) {
|
||||
scanner = item2;
|
||||
}
|
||||
}
|
||||
|
||||
if (scanner != nullptr && miscItemGetCharges(scanner) > 0) {
|
||||
if (scanner != NULL && miscItemGetCharges(scanner) > 0) {
|
||||
needsRefresh = true;
|
||||
gAutomapFlags |= AUTOMAP_WITH_SCANNER;
|
||||
miscItemConsumeCharge(scanner);
|
||||
|
@ -457,8 +457,8 @@ void automapShow(bool isInGame, bool isUsingScanner)
|
|||
MessageListItem messageListItem;
|
||||
// 17 - The motion sensor is not installed.
|
||||
// 18 - The motion sensor has no charges remaining.
|
||||
const char* title = getmsg(&gMiscMessageList, &messageListItem, scanner != nullptr ? 18 : 17);
|
||||
showDialogBox(title, nullptr, 0, 165, 140, _colorTable[32328], nullptr, _colorTable[32328], 0);
|
||||
const char* title = getmsg(&gMiscMessageList, &messageListItem, scanner != NULL ? 18 : 17);
|
||||
showDialogBox(title, NULL, 0, 165, 140, _colorTable[32328], NULL, _colorTable[32328], 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ static void automapRenderInMapWindow(int window, int elevation, unsigned char* b
|
|||
unsigned char* windowBuffer = windowGetBuffer(window);
|
||||
blitBufferToBuffer(backgroundData, AUTOMAP_WINDOW_WIDTH, AUTOMAP_WINDOW_HEIGHT, AUTOMAP_WINDOW_WIDTH, windowBuffer, AUTOMAP_WINDOW_WIDTH);
|
||||
|
||||
for (Object* object = objectFindFirstAtElevation(elevation); object != nullptr; object = objectFindNextAtElevation()) {
|
||||
for (Object* object = objectFindFirstAtElevation(elevation); object != NULL; object = objectFindNextAtElevation()) {
|
||||
if (object->tile == -1) {
|
||||
continue;
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ int automapRenderInPipboyWindow(int window, int map, int elevation)
|
|||
unsigned char sceneryColor = _colorTable[480];
|
||||
|
||||
gAutomapEntry.data = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.data == nullptr) {
|
||||
if (gAutomapEntry.data == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error allocating data buffer!\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -694,9 +694,9 @@ int automapSaveCurrent()
|
|||
|
||||
bool dataBuffersAllocated = false;
|
||||
gAutomapEntry.data = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.data != nullptr) {
|
||||
if (gAutomapEntry.data != NULL) {
|
||||
gAutomapEntry.compressedData = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.compressedData != nullptr) {
|
||||
if (gAutomapEntry.compressedData != NULL) {
|
||||
dataBuffersAllocated = true;
|
||||
}
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ int automapSaveCurrent()
|
|||
snprintf(path, sizeof(path), "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
||||
File* stream1 = fileOpen(path, "r+b");
|
||||
if (stream1 == nullptr) {
|
||||
if (stream1 == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error opening automap database file!\n");
|
||||
debugPrint("Error continued: automap_pip_save: path: %s", path);
|
||||
internal_free(gAutomapEntry.data);
|
||||
|
@ -743,7 +743,7 @@ int automapSaveCurrent()
|
|||
snprintf(path, sizeof(path), "%s\\%s", "MAPS", AUTOMAP_TMP);
|
||||
|
||||
File* stream2 = fileOpen(path, "wb");
|
||||
if (stream2 == nullptr) {
|
||||
if (stream2 == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error creating temp file!\n");
|
||||
internal_free(gAutomapEntry.data);
|
||||
internal_free(gAutomapEntry.compressedData);
|
||||
|
@ -928,7 +928,7 @@ err:
|
|||
// 0x41C8CC
|
||||
static int automapLoadEntry(int map, int elevation)
|
||||
{
|
||||
gAutomapEntry.compressedData = nullptr;
|
||||
gAutomapEntry.compressedData = NULL;
|
||||
|
||||
char path[COMPAT_MAX_PATH];
|
||||
snprintf(path, sizeof(path), "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
@ -936,7 +936,7 @@ static int automapLoadEntry(int map, int elevation)
|
|||
bool success = true;
|
||||
|
||||
File* stream = fileOpen(path, "r+b");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error opening automap database file!\n");
|
||||
debugPrint("Error continued: AM_ReadEntry: path: %s", path);
|
||||
return -1;
|
||||
|
@ -970,7 +970,7 @@ static int automapLoadEntry(int map, int elevation)
|
|||
|
||||
if (gAutomapEntry.isCompressed == 1) {
|
||||
gAutomapEntry.compressedData = (unsigned char*)internal_malloc(11024);
|
||||
if (gAutomapEntry.compressedData == nullptr) {
|
||||
if (gAutomapEntry.compressedData == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error allocating decompression buffer!\n");
|
||||
fileClose(stream);
|
||||
return -1;
|
||||
|
@ -1003,7 +1003,7 @@ out:
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (gAutomapEntry.compressedData != nullptr) {
|
||||
if (gAutomapEntry.compressedData != NULL) {
|
||||
internal_free(gAutomapEntry.compressedData);
|
||||
}
|
||||
|
||||
|
@ -1073,7 +1073,7 @@ static void _decode_map_data(int elevation)
|
|||
_obj_process_seen();
|
||||
|
||||
Object* object = objectFindFirstAtElevation(elevation);
|
||||
while (object != nullptr) {
|
||||
while (object != NULL) {
|
||||
if (object->tile != -1 && (object->flags & OBJECT_SEEN) != 0) {
|
||||
int contentType;
|
||||
|
||||
|
@ -1109,7 +1109,7 @@ static int automapCreate()
|
|||
snprintf(path, sizeof(path), "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
||||
File* stream = fileOpen(path, "wb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error creating automap database file!\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1129,7 +1129,7 @@ static int automapCreate()
|
|||
static int _copy_file_data(File* stream1, File* stream2, int length)
|
||||
{
|
||||
void* buffer = internal_malloc(0xFFFF);
|
||||
if (buffer == nullptr) {
|
||||
if (buffer == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1164,7 +1164,7 @@ int automapGetHeader(AutomapHeader** automapHeaderPtr)
|
|||
snprintf(path, sizeof(path), "%s\\%s", "MAPS", AUTOMAP_DB);
|
||||
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("\nAUTOMAP: Error opening database file for reading!\n");
|
||||
debugPrint("Error continued: ReadAMList: path: %s", path);
|
||||
return -1;
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace fallout {
|
|||
bool autorunMutexCreate()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
gInterplayGenericAutorunMutex = CreateMutexA(nullptr, FALSE, "InterplayGenericAutorunMutex");
|
||||
gInterplayGenericAutorunMutex = CreateMutexA(NULL, FALSE, "InterplayGenericAutorunMutex");
|
||||
if (GetLastError() == ERROR_ALREADY_EXISTS) {
|
||||
CloseHandle(gInterplayGenericAutorunMutex);
|
||||
return false;
|
||||
|
@ -29,7 +29,7 @@ bool autorunMutexCreate()
|
|||
void autorunMutexClose()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (gInterplayGenericAutorunMutex != nullptr) {
|
||||
if (gInterplayGenericAutorunMutex != NULL) {
|
||||
CloseHandle(gInterplayGenericAutorunMutex);
|
||||
}
|
||||
#endif
|
||||
|
|
38
src/cache.cc
38
src/cache.cc
|
@ -51,7 +51,7 @@ bool cacheInit(Cache* cache, CacheSizeProc* sizeProc, CacheReadProc* readProc, C
|
|||
cache->readProc = readProc;
|
||||
cache->freeProc = freeProc;
|
||||
|
||||
if (cache->entries == nullptr) {
|
||||
if (cache->entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ bool cacheInit(Cache* cache, CacheSizeProc* sizeProc, CacheReadProc* readProc, C
|
|||
// 0x41FD50
|
||||
bool cacheFree(Cache* cache)
|
||||
{
|
||||
if (cache == nullptr) {
|
||||
if (cache == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -78,14 +78,14 @@ bool cacheFree(Cache* cache)
|
|||
cache->entriesCapacity = 0;
|
||||
cache->hits = 0;
|
||||
|
||||
if (cache->entries != nullptr) {
|
||||
if (cache->entries != NULL) {
|
||||
internal_free(cache->entries);
|
||||
cache->entries = nullptr;
|
||||
cache->entries = NULL;
|
||||
}
|
||||
|
||||
cache->sizeProc = nullptr;
|
||||
cache->readProc = nullptr;
|
||||
cache->freeProc = nullptr;
|
||||
cache->sizeProc = NULL;
|
||||
cache->readProc = NULL;
|
||||
cache->freeProc = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -93,11 +93,11 @@ bool cacheFree(Cache* cache)
|
|||
// 0x41FDE8
|
||||
bool cacheLock(Cache* cache, int key, void** data, CacheEntry** cacheEntryPtr)
|
||||
{
|
||||
if (cache == nullptr || data == nullptr || cacheEntryPtr == nullptr) {
|
||||
if (cache == NULL || data == NULL || cacheEntryPtr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*cacheEntryPtr = nullptr;
|
||||
*cacheEntryPtr = NULL;
|
||||
|
||||
int index;
|
||||
int rc = cacheFindIndexForKey(cache, key, &index);
|
||||
|
@ -148,7 +148,7 @@ bool cacheLock(Cache* cache, int key, void** data, CacheEntry** cacheEntryPtr)
|
|||
// 0x4200B8
|
||||
bool cacheUnlock(Cache* cache, CacheEntry* cacheEntry)
|
||||
{
|
||||
if (cache == nullptr || cacheEntry == nullptr) {
|
||||
if (cache == NULL || cacheEntry == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ bool cacheUnlock(Cache* cache, CacheEntry* cacheEntry)
|
|||
// 0x42012C
|
||||
bool cacheFlush(Cache* cache)
|
||||
{
|
||||
if (cache == nullptr) {
|
||||
if (cache == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ bool cacheFlush(Cache* cache)
|
|||
// 0x42019C
|
||||
bool cachePrintStats(Cache* cache, char* dest, size_t size)
|
||||
{
|
||||
if (cache == nullptr || dest == nullptr) {
|
||||
if (cache == NULL || dest == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ bool cachePrintStats(Cache* cache, char* dest, size_t size)
|
|||
static bool cacheFetchEntryForKey(Cache* cache, int key, int* indexPtr)
|
||||
{
|
||||
CacheEntry* cacheEntry = (CacheEntry*)internal_malloc(sizeof(*cacheEntry));
|
||||
if (cacheEntry == nullptr) {
|
||||
if (cacheEntry == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -376,7 +376,7 @@ static bool cacheEntryInit(CacheEntry* cacheEntry)
|
|||
{
|
||||
cacheEntry->key = 0;
|
||||
cacheEntry->size = 0;
|
||||
cacheEntry->data = nullptr;
|
||||
cacheEntry->data = NULL;
|
||||
cacheEntry->referenceCount = 0;
|
||||
cacheEntry->hits = 0;
|
||||
cacheEntry->flags = 0;
|
||||
|
@ -389,7 +389,7 @@ static bool cacheEntryInit(CacheEntry* cacheEntry)
|
|||
// 0x420740
|
||||
static bool cacheEntryFree(Cache* cache, CacheEntry* cacheEntry)
|
||||
{
|
||||
if (cacheEntry->data != nullptr) {
|
||||
if (cacheEntry->data != NULL) {
|
||||
heapBlockDeallocate(&(cache->heap), &(cacheEntry->heapHandleIndex));
|
||||
}
|
||||
|
||||
|
@ -420,12 +420,12 @@ static bool cacheClean(Cache* cache)
|
|||
// 0x4207D4
|
||||
static bool cacheResetStatistics(Cache* cache)
|
||||
{
|
||||
if (cache == nullptr) {
|
||||
if (cache == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CacheEntry** entries = (CacheEntry**)internal_malloc(sizeof(*entries) * cache->entriesLength);
|
||||
if (entries == nullptr) {
|
||||
if (entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ static bool cacheEnsureSize(Cache* cache, int size)
|
|||
}
|
||||
|
||||
CacheEntry** entries = (CacheEntry**)internal_malloc(sizeof(*entries) * cache->entriesLength);
|
||||
if (entries != nullptr) {
|
||||
if (entries != NULL) {
|
||||
memcpy(entries, cache->entries, sizeof(*entries) * cache->entriesLength);
|
||||
qsort(entries, cache->entriesLength, sizeof(*entries), cacheEntriesCompareByUsage);
|
||||
|
||||
|
@ -562,7 +562,7 @@ static bool cacheSetCapacity(Cache* cache, int newCapacity)
|
|||
}
|
||||
|
||||
CacheEntry** entries = (CacheEntry**)internal_realloc(cache->entries, sizeof(*cache->entries) * newCapacity);
|
||||
if (entries == nullptr) {
|
||||
if (entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -107,10 +107,10 @@ static int gPremadeCharacterCount = PREMADE_CHARACTER_COUNT;
|
|||
static int gCharacterSelectorWindow = -1;
|
||||
|
||||
// 0x51C7FC
|
||||
static unsigned char* gCharacterSelectorWindowBuffer = nullptr;
|
||||
static unsigned char* gCharacterSelectorWindowBuffer = NULL;
|
||||
|
||||
// 0x51C800
|
||||
static unsigned char* gCharacterSelectorBackground = nullptr;
|
||||
static unsigned char* gCharacterSelectorBackground = NULL;
|
||||
|
||||
// 0x51C804
|
||||
static int gCharacterSelectorWindowPreviousButton = -1;
|
||||
|
@ -269,7 +269,7 @@ static bool characterSelectorWindowInit()
|
|||
}
|
||||
|
||||
gCharacterSelectorWindowBuffer = windowGetBuffer(gCharacterSelectorWindow);
|
||||
if (gCharacterSelectorWindowBuffer == nullptr) {
|
||||
if (gCharacterSelectorWindowBuffer == NULL) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ static bool characterSelectorWindowInit()
|
|||
CS_WINDOW_WIDTH);
|
||||
|
||||
gCharacterSelectorBackground = (unsigned char*)internal_malloc(CS_WINDOW_BACKGROUND_WIDTH * CS_WINDOW_BACKGROUND_HEIGHT);
|
||||
if (gCharacterSelectorBackground == nullptr)
|
||||
if (gCharacterSelectorBackground == NULL)
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
||||
blitBufferToBuffer(backgroundFrmImage.getData() + CS_WINDOW_WIDTH * CS_WINDOW_BACKGROUND_Y + CS_WINDOW_BACKGROUND_X,
|
||||
|
@ -323,7 +323,7 @@ static bool characterSelectorWindowInit()
|
|||
500,
|
||||
_previousButtonNormalFrmImage.getData(),
|
||||
_previousButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
0);
|
||||
if (gCharacterSelectorWindowPreviousButton == -1) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
@ -353,7 +353,7 @@ static bool characterSelectorWindowInit()
|
|||
501,
|
||||
_nextButtonNormalFrmImage.getData(),
|
||||
_nextButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
0);
|
||||
if (gCharacterSelectorWindowNextButton == -1) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
@ -383,7 +383,7 @@ static bool characterSelectorWindowInit()
|
|||
KEY_LOWERCASE_T,
|
||||
_takeButtonNormalFrmImage.getData(),
|
||||
_takeButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (gCharacterSelectorWindowTakeButton == -1) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
@ -412,7 +412,7 @@ static bool characterSelectorWindowInit()
|
|||
KEY_LOWERCASE_M,
|
||||
_modifyButtonNormalFrmImage.getData(),
|
||||
_modifyButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (gCharacterSelectorWindowModifyButton == -1) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
@ -442,7 +442,7 @@ static bool characterSelectorWindowInit()
|
|||
KEY_LOWERCASE_C,
|
||||
_createButtonNormalFrmImage.getData(),
|
||||
_createButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (gCharacterSelectorWindowCreateButton == -1) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
@ -472,7 +472,7 @@ static bool characterSelectorWindowInit()
|
|||
KEY_ESCAPE,
|
||||
_backButtonNormalFrmImage.getData(),
|
||||
_backButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (gCharacterSelectorWindowBackButton == -1) {
|
||||
return characterSelectorWindowFatalError(false);
|
||||
|
@ -546,9 +546,9 @@ static void characterSelectorWindowFree()
|
|||
_backButtonNormalFrmImage.unlock();
|
||||
_backButtonPressedFrmImage.unlock();
|
||||
|
||||
if (gCharacterSelectorBackground != nullptr) {
|
||||
if (gCharacterSelectorBackground != NULL) {
|
||||
internal_free(gCharacterSelectorBackground);
|
||||
gCharacterSelectorBackground = nullptr;
|
||||
gCharacterSelectorBackground = NULL;
|
||||
}
|
||||
|
||||
windowDestroy(gCharacterSelectorWindow);
|
||||
|
@ -595,7 +595,7 @@ static bool characterSelectorWindowRenderFace()
|
|||
int faceFid = buildFid(OBJ_TYPE_INTERFACE, gCustomPremadeCharacterDescriptions[gCurrentPremadeCharacter].face, 0, 0, 0);
|
||||
if (faceFrmImage.lock(faceFid)) {
|
||||
unsigned char* data = faceFrmImage.getData();
|
||||
if (data != nullptr) {
|
||||
if (data != NULL) {
|
||||
int width = faceFrmImage.getWidth();
|
||||
int height = faceFrmImage.getHeight();
|
||||
blitBufferToBufferTrans(data, width, height, width, (gCharacterSelectorWindowBuffer + CS_WINDOW_WIDTH * 23 + 27), CS_WINDOW_WIDTH);
|
||||
|
@ -870,7 +870,7 @@ static bool characterSelectorWindowRenderBio()
|
|||
premadeCharactersLocalizePath(path);
|
||||
|
||||
File* stream = fileOpen(path, "rt");
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
int y = 40;
|
||||
int lineHeight = fontGetLineHeight();
|
||||
|
||||
|
@ -901,24 +901,24 @@ void premadeCharactersInit()
|
|||
{
|
||||
char* fileNamesString;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PREMADE_CHARACTERS_FILE_NAMES_KEY, &fileNamesString);
|
||||
if (fileNamesString != nullptr && *fileNamesString == '\0') {
|
||||
fileNamesString = nullptr;
|
||||
if (fileNamesString != NULL && *fileNamesString == '\0') {
|
||||
fileNamesString = NULL;
|
||||
}
|
||||
|
||||
char* faceFidsString;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PREMADE_CHARACTERS_FACE_FIDS_KEY, &faceFidsString);
|
||||
if (faceFidsString != nullptr && *faceFidsString == '\0') {
|
||||
faceFidsString = nullptr;
|
||||
if (faceFidsString != NULL && *faceFidsString == '\0') {
|
||||
faceFidsString = NULL;
|
||||
}
|
||||
|
||||
if (fileNamesString != nullptr && faceFidsString != nullptr) {
|
||||
if (fileNamesString != NULL && faceFidsString != NULL) {
|
||||
int fileNamesLength = 0;
|
||||
for (char* pch = fileNamesString; pch != nullptr; pch = strchr(pch + 1, ',')) {
|
||||
for (char* pch = fileNamesString; pch != NULL; pch = strchr(pch + 1, ',')) {
|
||||
fileNamesLength++;
|
||||
}
|
||||
|
||||
int faceFidsLength = 0;
|
||||
for (char* pch = faceFidsString; pch != nullptr; pch = strchr(pch + 1, ',')) {
|
||||
for (char* pch = faceFidsString; pch != NULL; pch = strchr(pch + 1, ',')) {
|
||||
faceFidsLength++;
|
||||
}
|
||||
|
||||
|
@ -929,7 +929,7 @@ void premadeCharactersInit()
|
|||
char* pch;
|
||||
|
||||
pch = strchr(fileNamesString, ',');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
|
@ -940,20 +940,20 @@ void premadeCharactersInit()
|
|||
|
||||
snprintf(gCustomPremadeCharacterDescriptions[index].fileName, sizeof(gCustomPremadeCharacterDescriptions[index].fileName), "premade\\%s", fileNamesString);
|
||||
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = ',';
|
||||
}
|
||||
|
||||
fileNamesString = pch + 1;
|
||||
|
||||
pch = strchr(faceFidsString, ',');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
gCustomPremadeCharacterDescriptions[index].face = atoi(faceFidsString);
|
||||
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = ',';
|
||||
}
|
||||
|
||||
|
|
22
src/color.cc
22
src/color.cc
|
@ -51,7 +51,7 @@ static bool _colorsInited = false;
|
|||
static double gBrightness = 1.0;
|
||||
|
||||
// 0x51DF20
|
||||
static ColorTransitionCallback* gColorPaletteTransitionCallback = nullptr;
|
||||
static ColorTransitionCallback* gColorPaletteTransitionCallback = NULL;
|
||||
|
||||
// 0x51DF24
|
||||
static MallocProc* gColorPaletteMallocProc = colorPaletteMallocDefaultImpl;
|
||||
|
@ -63,7 +63,7 @@ static ReallocProc* gColorPaletteReallocProc = colorPaletteReallocDefaultImpl;
|
|||
static FreeProc* gColorPaletteFreeProc = colorPaletteFreeDefaultImpl;
|
||||
|
||||
// 0x51DF30
|
||||
static ColorFileNameManger* gColorFileNameMangler = nullptr;
|
||||
static ColorFileNameManger* gColorFileNameMangler = NULL;
|
||||
|
||||
// 0x51DF34
|
||||
unsigned char _cmap[768] = {
|
||||
|
@ -114,7 +114,7 @@ static ColorPaletteFileOpenProc* gColorPaletteFileOpenProc;
|
|||
// 0x4C7200
|
||||
static int colorPaletteFileOpen(const char* filePath, int flags)
|
||||
{
|
||||
if (gColorPaletteFileOpenProc != nullptr) {
|
||||
if (gColorPaletteFileOpenProc != NULL) {
|
||||
return gColorPaletteFileOpenProc(filePath, flags);
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ static int colorPaletteFileOpen(const char* filePath, int flags)
|
|||
// 0x4C7218
|
||||
static int colorPaletteFileRead(int fd, void* buffer, size_t size)
|
||||
{
|
||||
if (gColorPaletteFileReadProc != nullptr) {
|
||||
if (gColorPaletteFileReadProc != NULL) {
|
||||
return gColorPaletteFileReadProc(fd, buffer, size);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ static int colorPaletteFileRead(int fd, void* buffer, size_t size)
|
|||
// 0x4C7230
|
||||
static int colorPaletteFileClose(int fd)
|
||||
{
|
||||
if (gColorPaletteFileCloseProc != nullptr) {
|
||||
if (gColorPaletteFileCloseProc != NULL) {
|
||||
return gColorPaletteFileCloseProc(fd);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ void colorPaletteFadeBetween(unsigned char* oldPalette, unsigned char* newPalett
|
|||
palette[index] = oldPalette[index] - (oldPalette[index] - newPalette[index]) * step / steps;
|
||||
}
|
||||
|
||||
if (gColorPaletteTransitionCallback != nullptr) {
|
||||
if (gColorPaletteTransitionCallback != NULL) {
|
||||
if (step % 128 == 0) {
|
||||
gColorPaletteTransitionCallback();
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ static void _setMixTableColor(int a1)
|
|||
// 0x4C78E4
|
||||
bool colorPaletteLoad(const char* path)
|
||||
{
|
||||
if (gColorFileNameMangler != nullptr) {
|
||||
if (gColorFileNameMangler != NULL) {
|
||||
path = gColorFileNameMangler(path);
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ unsigned char* _getColorBlendTable(int ch)
|
|||
{
|
||||
unsigned char* ptr;
|
||||
|
||||
if (_blendTable[ch] == nullptr) {
|
||||
if (_blendTable[ch] == NULL) {
|
||||
ptr = (unsigned char*)gColorPaletteMallocProc(4100);
|
||||
*(int*)ptr = 1;
|
||||
_blendTable[ch] = ptr + 4;
|
||||
|
@ -564,12 +564,12 @@ unsigned char* _getColorBlendTable(int ch)
|
|||
void _freeColorBlendTable(int a1)
|
||||
{
|
||||
unsigned char* v2 = _blendTable[a1];
|
||||
if (v2 != nullptr) {
|
||||
if (v2 != NULL) {
|
||||
int* count = (int*)(v2 - sizeof(int));
|
||||
*count -= 1;
|
||||
if (*count == 0) {
|
||||
gColorPaletteFreeProc(count);
|
||||
_blendTable[a1] = nullptr;
|
||||
_blendTable[a1] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ bool colorPopColorPalette()
|
|||
memcpy(_colorTable, entry->colorTable, sizeof(_colorTable));
|
||||
|
||||
free(entry);
|
||||
gColorPaletteStack[gColorPaletteStackSize] = nullptr;
|
||||
gColorPaletteStack[gColorPaletteStackSize] = NULL;
|
||||
|
||||
_setIntensityTables();
|
||||
|
||||
|
|
826
src/combat.cc
826
src/combat.cc
File diff suppressed because it is too large
Load Diff
19
src/combat.h
19
src/combat.h
|
@ -33,14 +33,14 @@ void _combat_update_critter_outline_for_los(Object* critter, bool a2);
|
|||
void _combat_over_from_load();
|
||||
void _combat_give_exps(int exp_points);
|
||||
void _combat_turn_run();
|
||||
void _combat(CombatStartData* csd);
|
||||
void attackInit(Attack* attack, Object* attacker, Object* defender, int hitMode, int hitLocation);
|
||||
int _combat_attack(Object* attacker, Object* defender, int hitMode, int hitLocation);
|
||||
int _combat_bullet_start(const Object* attacker, const Object* target);
|
||||
void _compute_explosion_on_extras(Attack* attack, bool isFromAttacker, bool isGrenade, bool noDamage);
|
||||
void _combat(STRUCT_664980* attack);
|
||||
void attackInit(Attack* attack, Object* a2, Object* a3, int a4, int a5);
|
||||
int _combat_attack(Object* a1, Object* a2, int a3, int a4);
|
||||
int _combat_bullet_start(const Object* a1, const Object* a2);
|
||||
void _compute_explosion_on_extras(Attack* attack, int a2, bool isGrenade, int a4);
|
||||
int _determine_to_hit(Object* a1, Object* a2, int hitLocation, int hitMode);
|
||||
int _determine_to_hit_no_range(Object* attacker, Object* defender, int hitLocation, int hitMode, unsigned char* a5);
|
||||
int _determine_to_hit_from_tile(Object* attacker, int tile, Object* defender, int hitLocation, int hitMode);
|
||||
int _determine_to_hit_no_range(Object* a1, Object* a2, int a3, int a4, unsigned char* a5);
|
||||
int _determine_to_hit_from_tile(Object* a1, int a2, Object* a3, int a4, int a5);
|
||||
void attackComputeDeathFlags(Attack* attack);
|
||||
void _apply_damage(Attack* attack, bool animated);
|
||||
void _combat_display(Attack* attack);
|
||||
|
@ -48,11 +48,11 @@ void _combat_anim_begin();
|
|||
void _combat_anim_finished();
|
||||
int _combat_check_bad_shot(Object* attacker, Object* defender, int hitMode, bool aiming);
|
||||
bool _combat_to_hit(Object* target, int* accuracy);
|
||||
void _combat_attack_this(Object* target);
|
||||
void _combat_attack_this(Object* a1);
|
||||
void _combat_outline_on();
|
||||
void _combat_outline_off();
|
||||
void _combat_highlight_change();
|
||||
bool _combat_is_shot_blocked(Object* sourceObj, int from, int to, Object* targetObj, int* numCrittersOnLof);
|
||||
bool _combat_is_shot_blocked(Object* a1, int from, int to, Object* a4, int* a5);
|
||||
int _combat_player_knocked_out_by();
|
||||
int _combat_explode_scenery(Object* a1, Object* a2);
|
||||
void _combat_delete_critter(Object* obj);
|
||||
|
@ -74,7 +74,6 @@ bool damageModGetDisplayBonusDamage();
|
|||
int combat_get_hit_location_penalty(int hit_location);
|
||||
void combat_set_hit_location_penalty(int hit_location, int penalty);
|
||||
void combat_reset_hit_location_penalty();
|
||||
Attack* combat_get_data();
|
||||
|
||||
static inline bool isInCombat()
|
||||
{
|
||||
|
|
625
src/combat_ai.cc
625
src/combat_ai.cc
File diff suppressed because it is too large
Load Diff
|
@ -30,8 +30,6 @@ void aiReset();
|
|||
int aiExit();
|
||||
int aiLoad(File* stream);
|
||||
int aiSave(File* stream);
|
||||
int combat_ai_num();
|
||||
char* combat_ai_name(int packet_num);
|
||||
int aiGetAreaAttackMode(Object* obj);
|
||||
int aiGetRunAwayMode(Object* obj);
|
||||
int aiGetBestWeapon(Object* obj);
|
||||
|
|
|
@ -86,7 +86,7 @@ typedef enum HitLocation {
|
|||
HIT_LOCATION_SPECIFIC_COUNT = HIT_LOCATION_COUNT - 1,
|
||||
} HitLocation;
|
||||
|
||||
typedef struct CombatStartData {
|
||||
typedef struct STRUCT_664980 {
|
||||
Object* attacker;
|
||||
Object* defender;
|
||||
int actionPointsBonus;
|
||||
|
@ -94,10 +94,10 @@ typedef struct CombatStartData {
|
|||
int damageBonus;
|
||||
int minDamage;
|
||||
int maxDamage;
|
||||
int overrideAttackResults;
|
||||
int attackerResults;
|
||||
int targetResults;
|
||||
} CombatStartData;
|
||||
int field_1C; // probably bool, indicating field_20 and field_24 used
|
||||
int field_20; // flags on attacker
|
||||
int field_24; // flags on defender
|
||||
} STRUCT_664980;
|
||||
|
||||
typedef struct Attack {
|
||||
Object* attacker;
|
||||
|
|
|
@ -31,11 +31,11 @@ static char gConfigLastSectionKey[CONFIG_FILE_MAX_LINE_LENGTH] = "unknown";
|
|||
// 0x42BD90
|
||||
bool configInit(Config* config)
|
||||
{
|
||||
if (config == nullptr) {
|
||||
if (config == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dictionaryInit(config, CONFIG_INITIAL_CAPACITY, sizeof(ConfigSection), nullptr) != 0) {
|
||||
if (dictionaryInit(config, CONFIG_INITIAL_CAPACITY, sizeof(ConfigSection), NULL) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ bool configInit(Config* config)
|
|||
// 0x42BDBC
|
||||
void configFree(Config* config)
|
||||
{
|
||||
if (config == nullptr) {
|
||||
if (config == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ void configFree(Config* config)
|
|||
|
||||
char** value = (char**)keyValueEntry->value;
|
||||
internal_free(*value);
|
||||
*value = nullptr;
|
||||
*value = NULL;
|
||||
}
|
||||
|
||||
dictionaryFree(section);
|
||||
|
@ -78,7 +78,7 @@ void configFree(Config* config)
|
|||
// 0x42BE38
|
||||
bool configParseCommandLineArguments(Config* config, int argc, char** argv)
|
||||
{
|
||||
if (config == nullptr) {
|
||||
if (config == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ bool configParseCommandLineArguments(Config* config, int argc, char** argv)
|
|||
|
||||
// Find opening bracket.
|
||||
pch = strchr(string, '[');
|
||||
if (pch == nullptr) {
|
||||
if (pch == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ bool configParseCommandLineArguments(Config* config, int argc, char** argv)
|
|||
|
||||
// Find closing bracket.
|
||||
pch = strchr(sectionKey, ']');
|
||||
if (pch == nullptr) {
|
||||
if (pch == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ bool configParseCommandLineArguments(Config* config, int argc, char** argv)
|
|||
// 0x42BF48
|
||||
bool configGetString(Config* config, const char* sectionKey, const char* key, char** valuePtr)
|
||||
{
|
||||
if (config == nullptr || sectionKey == nullptr || key == nullptr || valuePtr == nullptr) {
|
||||
if (config == NULL || sectionKey == NULL || key == NULL || valuePtr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ bool configGetString(Config* config, const char* sectionKey, const char* key, ch
|
|||
// 0x42BF90
|
||||
bool configSetString(Config* config, const char* sectionKey, const char* key, const char* value)
|
||||
{
|
||||
if (config == nullptr || sectionKey == nullptr || key == nullptr || value == nullptr) {
|
||||
if (config == NULL || sectionKey == NULL || key == NULL || value == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -167,13 +167,13 @@ bool configSetString(Config* config, const char* sectionKey, const char* key, co
|
|||
|
||||
char** existingValue = (char**)keyValueEntry->value;
|
||||
internal_free(*existingValue);
|
||||
*existingValue = nullptr;
|
||||
*existingValue = NULL;
|
||||
|
||||
dictionaryRemoveValue(section, key);
|
||||
}
|
||||
|
||||
char* valueCopy = internal_strdup(value);
|
||||
if (valueCopy == nullptr) {
|
||||
if (valueCopy == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ bool configSetString(Config* config, const char* sectionKey, const char* key, co
|
|||
// 0x42C05C
|
||||
bool configGetInt(Config* config, const char* sectionKey, const char* key, int* valuePtr, unsigned char base /* = 0 */)
|
||||
{
|
||||
if (valuePtr == nullptr) {
|
||||
if (valuePtr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ bool configGetInt(Config* config, const char* sectionKey, const char* key, int*
|
|||
// 0x42C090
|
||||
bool configGetIntList(Config* config, const char* sectionKey, const char* key, int* arr, int count)
|
||||
{
|
||||
if (arr == nullptr || count < 2) {
|
||||
if (arr == NULL || count < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ bool configGetIntList(Config* config, const char* sectionKey, const char* key, i
|
|||
|
||||
while (1) {
|
||||
char* pch = strchr(string, ',');
|
||||
if (pch == nullptr) {
|
||||
if (pch == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ bool configSetInt(Config* config, const char* sectionKey, const char* key, int v
|
|||
// 0x42C280
|
||||
bool configRead(Config* config, const char* filePath, bool isDb)
|
||||
{
|
||||
if (config == nullptr || filePath == nullptr) {
|
||||
if (config == NULL || filePath == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -282,11 +282,11 @@ bool configRead(Config* config, const char* filePath, bool isDb)
|
|||
File* stream = fileOpen(filePath, "rb");
|
||||
|
||||
// CE: Return `false` if file does not exists in database.
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (fileReadString(string, sizeof(string), stream) != nullptr) {
|
||||
while (fileReadString(string, sizeof(string), stream) != NULL) {
|
||||
configParseLine(config, string);
|
||||
}
|
||||
fileClose(stream);
|
||||
|
@ -294,11 +294,11 @@ bool configRead(Config* config, const char* filePath, bool isDb)
|
|||
FILE* stream = compat_fopen(filePath, "rt");
|
||||
|
||||
// CE: Return `false` if file does not exists on the file system.
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (compat_fgets(string, sizeof(string), stream) != nullptr) {
|
||||
while (compat_fgets(string, sizeof(string), stream) != NULL) {
|
||||
configParseLine(config, string);
|
||||
}
|
||||
fclose(stream);
|
||||
|
@ -312,13 +312,13 @@ bool configRead(Config* config, const char* filePath, bool isDb)
|
|||
// 0x42C324
|
||||
bool configWrite(Config* config, const char* filePath, bool isDb)
|
||||
{
|
||||
if (config == nullptr || filePath == nullptr) {
|
||||
if (config == NULL || filePath == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isDb) {
|
||||
File* stream = fileOpen(filePath, "wt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ bool configWrite(Config* config, const char* filePath, bool isDb)
|
|||
fileClose(stream);
|
||||
} else {
|
||||
FILE* stream = compat_fopen(filePath, "wt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ static bool configParseLine(Config* config, char* string)
|
|||
|
||||
// Find comment marker and truncate the string.
|
||||
pch = strchr(string, ';');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ static bool configParseLine(Config* config, char* string)
|
|||
|
||||
// Find closing bracket.
|
||||
pch = strchr(sectionKey, ']');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
strcpy(gConfigLastSectionKey, sectionKey);
|
||||
return configTrimString(gConfigLastSectionKey);
|
||||
|
@ -431,13 +431,13 @@ static bool configParseLine(Config* config, char* string)
|
|||
// 0x42C594
|
||||
static bool configParseKeyValue(char* string, char* key, char* value)
|
||||
{
|
||||
if (string == nullptr || key == nullptr || value == nullptr) {
|
||||
if (string == NULL || key == NULL || value == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find equals character.
|
||||
char* pch = strchr(string, '=');
|
||||
if (pch == nullptr) {
|
||||
if (pch == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ static bool configParseKeyValue(char* string, char* key, char* value)
|
|||
// 0x42C638
|
||||
static bool configEnsureSectionExists(Config* config, const char* sectionKey)
|
||||
{
|
||||
if (config == nullptr || sectionKey == nullptr) {
|
||||
if (config == NULL || sectionKey == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ static bool configEnsureSectionExists(Config* config, const char* sectionKey)
|
|||
}
|
||||
|
||||
ConfigSection section;
|
||||
if (dictionaryInit(§ion, CONFIG_INITIAL_CAPACITY, sizeof(char**), nullptr) == -1) {
|
||||
if (dictionaryInit(§ion, CONFIG_INITIAL_CAPACITY, sizeof(char**), NULL) == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ static bool configEnsureSectionExists(Config* config, const char* sectionKey)
|
|||
// 0x42C698
|
||||
static bool configTrimString(char* string)
|
||||
{
|
||||
if (string == nullptr) {
|
||||
if (string == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -525,7 +525,7 @@ static bool configTrimString(char* string)
|
|||
// 0x42C718
|
||||
bool configGetDouble(Config* config, const char* sectionKey, const char* key, double* valuePtr)
|
||||
{
|
||||
if (valuePtr == nullptr) {
|
||||
if (valuePtr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ bool configGetDouble(Config* config, const char* sectionKey, const char* key, do
|
|||
return false;
|
||||
}
|
||||
|
||||
*valuePtr = strtod(stringValue, nullptr);
|
||||
*valuePtr = strtod(stringValue, NULL);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ bool configSetDouble(Config* config, const char* sectionKey, const char* key, do
|
|||
// NOTE: Boolean-typed variant of [configGetInt].
|
||||
bool configGetBool(Config* config, const char* sectionKey, const char* key, bool* valuePtr)
|
||||
{
|
||||
if (valuePtr == nullptr) {
|
||||
if (valuePtr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "cycle.h"
|
||||
#include "db.h"
|
||||
#include "debug.h"
|
||||
#include "delay.h"
|
||||
#include "draw.h"
|
||||
#include "game_mouse.h"
|
||||
#include "input.h"
|
||||
|
@ -68,7 +67,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
char localizedPath[COMPAT_MAX_PATH];
|
||||
if (_message_make_path(localizedPath, sizeof(localizedPath), filePath)) {
|
||||
gCreditsFile = fileOpen(localizedPath, "rt");
|
||||
if (gCreditsFile != nullptr) {
|
||||
if (gCreditsFile != NULL) {
|
||||
soundContinueAll();
|
||||
|
||||
colorCycleDisable();
|
||||
|
@ -85,7 +84,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
soundContinueAll();
|
||||
if (window != -1) {
|
||||
unsigned char* windowBuffer = windowGetBuffer(window);
|
||||
if (windowBuffer != nullptr) {
|
||||
if (windowBuffer != NULL) {
|
||||
unsigned char* backgroundBuffer = (unsigned char*)internal_malloc(windowWidth * windowHeight);
|
||||
if (backgroundBuffer) {
|
||||
soundContinueAll();
|
||||
|
@ -106,7 +105,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
}
|
||||
|
||||
unsigned char* intermediateBuffer = (unsigned char*)internal_malloc(windowWidth * windowHeight);
|
||||
if (intermediateBuffer != nullptr) {
|
||||
if (intermediateBuffer != NULL) {
|
||||
memset(intermediateBuffer, 0, windowWidth * windowHeight);
|
||||
|
||||
fontSetCurrent(gCreditsWindowTitleFont);
|
||||
|
@ -118,7 +117,7 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
int lineHeight = std::max(titleFontLineHeight, nameFontLineHeight);
|
||||
int stringBufferSize = windowWidth * lineHeight;
|
||||
unsigned char* stringBuffer = (unsigned char*)internal_malloc(stringBufferSize);
|
||||
if (stringBuffer != nullptr) {
|
||||
if (stringBuffer != NULL) {
|
||||
blitBufferToBuffer(backgroundBuffer,
|
||||
windowWidth,
|
||||
windowHeight,
|
||||
|
@ -173,7 +172,8 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
windowBuffer,
|
||||
windowWidth);
|
||||
|
||||
delay_ms(CREDITS_WINDOW_SCROLLING_DELAY - (getTicks() - tick));
|
||||
while (getTicksSince(tick) < CREDITS_WINDOW_SCROLLING_DELAY) {
|
||||
}
|
||||
|
||||
tick = getTicks();
|
||||
|
||||
|
@ -215,7 +215,8 @@ void creditsOpen(const char* filePath, int backgroundFid, bool useReversedStyle)
|
|||
windowBuffer,
|
||||
windowWidth);
|
||||
|
||||
delay_ms(CREDITS_WINDOW_SCROLLING_DELAY - (getTicks() - tick));
|
||||
while (getTicksSince(tick) < CREDITS_WINDOW_SCROLLING_DELAY) {
|
||||
}
|
||||
|
||||
tick = getTicks();
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ static const int gRadiationEffectPenalties[RADIATION_LEVEL_COUNT][RADIATION_EFFE
|
|||
};
|
||||
|
||||
// 0x518438
|
||||
static Object* _critterClearObj = nullptr;
|
||||
static Object* _critterClearObj = NULL;
|
||||
|
||||
// scrname.msg
|
||||
//
|
||||
|
@ -247,7 +247,7 @@ char* critterGetName(Object* obj)
|
|||
}
|
||||
}
|
||||
|
||||
char* name = nullptr;
|
||||
char* name = NULL;
|
||||
if (obj->field_80 != -1) {
|
||||
MessageListItem messageListItem;
|
||||
messageListItem.num = 101 + obj->field_80;
|
||||
|
@ -256,7 +256,7 @@ char* critterGetName(Object* obj)
|
|||
}
|
||||
}
|
||||
|
||||
if (name == nullptr || *name == '\0') {
|
||||
if (name == NULL || *name == '\0') {
|
||||
name = protoGetName(obj->pid);
|
||||
}
|
||||
|
||||
|
@ -347,8 +347,8 @@ int critterAdjustPoison(Object* critter, int amount)
|
|||
if (newPoison > 0) {
|
||||
critter->data.critter.poison = newPoison;
|
||||
|
||||
_queue_clear_type(EVENT_TYPE_POISON, nullptr);
|
||||
queueAddEvent(10 * (505 - 5 * newPoison), gDude, nullptr, EVENT_TYPE_POISON);
|
||||
_queue_clear_type(EVENT_TYPE_POISON, NULL);
|
||||
queueAddEvent(10 * (505 - 5 * newPoison), gDude, NULL, EVENT_TYPE_POISON);
|
||||
|
||||
// You have been poisoned!
|
||||
messageListItem.num = 3000;
|
||||
|
@ -429,23 +429,23 @@ int critterAdjustRadiation(Object* obj, int amount)
|
|||
}
|
||||
|
||||
if (amount > 0) {
|
||||
Object* geigerCounter = nullptr;
|
||||
Object* geigerCounter = NULL;
|
||||
|
||||
Object* item1 = critterGetItem1(gDude);
|
||||
if (item1 != nullptr) {
|
||||
if (item1 != NULL) {
|
||||
if (item1->pid == PROTO_ID_GEIGER_COUNTER_I || item1->pid == PROTO_ID_GEIGER_COUNTER_II) {
|
||||
geigerCounter = item1;
|
||||
}
|
||||
}
|
||||
|
||||
Object* item2 = critterGetItem2(gDude);
|
||||
if (item2 != nullptr) {
|
||||
if (item2 != NULL) {
|
||||
if (item2->pid == PROTO_ID_GEIGER_COUNTER_I || item2->pid == PROTO_ID_GEIGER_COUNTER_II) {
|
||||
geigerCounter = item2;
|
||||
}
|
||||
}
|
||||
|
||||
if (geigerCounter != nullptr) {
|
||||
if (geigerCounter != NULL) {
|
||||
if (miscItemIsOn(geigerCounter)) {
|
||||
if (amount > 5) {
|
||||
// The geiger counter is clicking wildly.
|
||||
|
@ -517,14 +517,14 @@ int _critter_check_rads(Object* obj)
|
|||
else
|
||||
radiationLevel = RADIATION_LEVEL_NONE;
|
||||
|
||||
if (statRoll(obj, STAT_ENDURANCE, gRadiationEnduranceModifiers[radiationLevel], nullptr) <= ROLL_FAILURE) {
|
||||
if (statRoll(obj, STAT_ENDURANCE, gRadiationEnduranceModifiers[radiationLevel], NULL) <= ROLL_FAILURE) {
|
||||
radiationLevel++;
|
||||
}
|
||||
|
||||
if (radiationLevel > _old_rad_level) {
|
||||
// Create timer event for applying radiation damage.
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)internal_malloc(sizeof(*radiationEvent));
|
||||
if (radiationEvent == nullptr) {
|
||||
if (radiationEvent == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -630,7 +630,7 @@ int radiationEventProcess(Object* obj, void* data)
|
|||
if (!radiationEvent->isHealing) {
|
||||
// Schedule healing stats event in 7 days.
|
||||
RadiationEvent* newRadiationEvent = (RadiationEvent*)internal_malloc(sizeof(*newRadiationEvent));
|
||||
if (newRadiationEvent != nullptr) {
|
||||
if (newRadiationEvent != NULL) {
|
||||
_queue_clear_type(EVENT_TYPE_RADIATION, _clear_rad_damage);
|
||||
newRadiationEvent->radiationLevel = radiationEvent->radiationLevel;
|
||||
newRadiationEvent->isHealing = 1;
|
||||
|
@ -647,7 +647,7 @@ int radiationEventProcess(Object* obj, void* data)
|
|||
int radiationEventRead(File* stream, void** dataPtr)
|
||||
{
|
||||
RadiationEvent* radiationEvent = (RadiationEvent*)internal_malloc(sizeof(*radiationEvent));
|
||||
if (radiationEvent == nullptr) {
|
||||
if (radiationEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ char* killTypeGetName(int killType)
|
|||
MessageListItem messageListItem;
|
||||
return getmsg(&gProtoMessageList, &messageListItem, 1450 + killType);
|
||||
} else {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
return byte_501494;
|
||||
|
@ -785,7 +785,7 @@ char* killTypeGetDescription(int killType)
|
|||
MessageListItem messageListItem;
|
||||
return getmsg(&gProtoMessageList, &messageListItem, 1469 + killType);
|
||||
} else {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
return byte_501494;
|
||||
|
@ -927,7 +927,7 @@ int critterGetExp(Object* critter)
|
|||
// 0x42DCDC
|
||||
bool critterIsActive(Object* critter)
|
||||
{
|
||||
if (critter == nullptr) {
|
||||
if (critter == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -949,7 +949,7 @@ bool critterIsActive(Object* critter)
|
|||
// 0x42DD18
|
||||
bool critterIsDead(Object* critter)
|
||||
{
|
||||
if (critter == nullptr) {
|
||||
if (critter == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -971,7 +971,7 @@ bool critterIsDead(Object* critter)
|
|||
// 0x42DD58
|
||||
bool critterIsCrippled(Object* critter)
|
||||
{
|
||||
if (critter == nullptr) {
|
||||
if (critter == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -985,7 +985,7 @@ bool critterIsCrippled(Object* critter)
|
|||
// 0x42DD80
|
||||
bool _critter_is_prone(Object* critter)
|
||||
{
|
||||
if (critter == nullptr) {
|
||||
if (critter == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1004,7 +1004,7 @@ bool _critter_is_prone(Object* critter)
|
|||
// 0x42DDC4
|
||||
int critterGetBodyType(Object* critter)
|
||||
{
|
||||
if (critter == nullptr) {
|
||||
if (critter == NULL) {
|
||||
debugPrint("\nError: critter_body_type: pobj was NULL!");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1022,7 +1022,7 @@ int critterGetBodyType(Object* critter)
|
|||
int gcdLoad(const char* path)
|
||||
{
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1094,7 +1094,7 @@ int protoCritterDataRead(File* stream, CritterProtoData* critterData)
|
|||
int gcdSave(const char* path)
|
||||
{
|
||||
File* stream = fileOpen(path, "wb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ void dudeEnableState(int state)
|
|||
proto->critter.data.flags |= (1 << state);
|
||||
|
||||
if (state == DUDE_STATE_SNEAKING) {
|
||||
sneakEventProcess(nullptr, nullptr);
|
||||
sneakEventProcess(NULL, NULL);
|
||||
}
|
||||
|
||||
indicatorBarRefresh();
|
||||
|
@ -1197,7 +1197,7 @@ int sneakEventProcess(Object* obj, void* data)
|
|||
int time;
|
||||
|
||||
int sneak = skillGetValue(gDude, SKILL_SNEAK);
|
||||
if (skillRoll(gDude, SKILL_SNEAK, 0, nullptr) < ROLL_SUCCESS) {
|
||||
if (skillRoll(gDude, SKILL_SNEAK, 0, NULL) < ROLL_SUCCESS) {
|
||||
time = 600;
|
||||
_sneak_working = false;
|
||||
|
||||
|
@ -1218,7 +1218,7 @@ int sneakEventProcess(Object* obj, void* data)
|
|||
_sneak_working = true;
|
||||
}
|
||||
|
||||
queueAddEvent(time, gDude, nullptr, EVENT_TYPE_SNEAK);
|
||||
queueAddEvent(time, gDude, NULL, EVENT_TYPE_SNEAK);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1276,7 +1276,7 @@ int _critter_wake_clear(Object* obj, void* data)
|
|||
obj->data.critter.combat.results &= ~(DAM_KNOCKED_OUT | DAM_KNOCKED_DOWN);
|
||||
|
||||
int fid = buildFid(FID_TYPE(obj->fid), obj->fid & 0xFFF, ANIM_STAND, (obj->fid & 0xF000) >> 12, obj->rotation + 1);
|
||||
objectSetFid(obj, fid, nullptr);
|
||||
objectSetFid(obj, fid, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1284,16 +1284,16 @@ int _critter_wake_clear(Object* obj, void* data)
|
|||
// 0x42E4C0
|
||||
int _critter_set_who_hit_me(Object* a1, Object* a2)
|
||||
{
|
||||
if (a1 == nullptr) {
|
||||
if (a1 == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (a2 != nullptr && FID_TYPE(a2->fid) != OBJ_TYPE_CRITTER) {
|
||||
if (a2 != NULL && FID_TYPE(a2->fid) != OBJ_TYPE_CRITTER) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (PID_TYPE(a1->pid) == OBJ_TYPE_CRITTER) {
|
||||
if (a2 == nullptr || a1->data.critter.combat.team != a2->data.critter.combat.team || (statRoll(a1, STAT_INTELLIGENCE, -1, nullptr) < 2 && (!objectIsPartyMember(a1) || !objectIsPartyMember(a2)))) {
|
||||
if (a2 == NULL || a1->data.critter.combat.team != a2->data.critter.combat.team || (statRoll(a1, STAT_INTELLIGENCE, -1, NULL) < 2 && (!objectIsPartyMember(a1) || !objectIsPartyMember(a2)))) {
|
||||
a1->data.critter.combat.whoHitMe = a2;
|
||||
if (a2 == gDude) {
|
||||
reactionSetValue(a1, -3);
|
||||
|
@ -1373,7 +1373,7 @@ bool critterIsEncumbered(Object* critter)
|
|||
// 0x42E690
|
||||
bool critterIsFleeing(Object* critter)
|
||||
{
|
||||
return critter != nullptr
|
||||
return critter != NULL
|
||||
? (critter->data.critter.combat.maneuver & CRITTER_MANUEVER_FLEEING) != 0
|
||||
: false;
|
||||
}
|
||||
|
@ -1396,40 +1396,4 @@ bool _critter_flag_check(int pid, int flag)
|
|||
return (proto->critter.data.flags & flag) != 0;
|
||||
}
|
||||
|
||||
// 0x42E6F0
|
||||
void critter_flag_set(int pid, int flag)
|
||||
{
|
||||
Proto* proto;
|
||||
|
||||
if (pid == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PID_TYPE(pid) != OBJ_TYPE_CRITTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
protoGetProto(pid, &proto);
|
||||
|
||||
proto->critter.data.flags |= flag;
|
||||
}
|
||||
|
||||
// 0x42E71C
|
||||
void critter_flag_unset(int pid, int flag)
|
||||
{
|
||||
Proto* proto;
|
||||
|
||||
if (pid == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (PID_TYPE(pid) != OBJ_TYPE_CRITTER) {
|
||||
return;
|
||||
}
|
||||
|
||||
protoGetProto(pid, &proto);
|
||||
|
||||
proto->critter.data.flags &= ~flag;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -70,8 +70,6 @@ int critterGetMovementPointCostAdjustedForCrippledLegs(Object* critter, int a2);
|
|||
bool critterIsEncumbered(Object* critter);
|
||||
bool critterIsFleeing(Object* a1);
|
||||
bool _critter_flag_check(int pid, int flag);
|
||||
void critter_flag_set(int pid, int flag);
|
||||
void critter_flag_unset(int pid, int flag);
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
namespace fallout {
|
||||
|
||||
// 0x5184AC
|
||||
DatafileLoader* gDatafileLoader = nullptr;
|
||||
DatafileLoader* gDatafileLoader = NULL;
|
||||
|
||||
// 0x5184B0
|
||||
DatafileNameMangler* gDatafileNameMangler = datafileDefaultNameManglerImpl;
|
||||
|
@ -90,24 +90,24 @@ unsigned char* datafileReadRaw(char* path, int* widthPtr, int* heightPtr)
|
|||
{
|
||||
char* mangledPath = gDatafileNameMangler(path);
|
||||
char* dot = strrchr(mangledPath, '.');
|
||||
if (dot != nullptr) {
|
||||
if (dot != NULL) {
|
||||
if (compat_stricmp(dot + 1, "pcx") == 0) {
|
||||
return pcxRead(mangledPath, widthPtr, heightPtr, gDatafilePalette);
|
||||
}
|
||||
}
|
||||
|
||||
if (gDatafileLoader != nullptr) {
|
||||
if (gDatafileLoader != NULL) {
|
||||
return gDatafileLoader(mangledPath, gDatafilePalette, widthPtr, heightPtr);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x42EFCC
|
||||
unsigned char* datafileRead(char* path, int* widthPtr, int* heightPtr)
|
||||
{
|
||||
unsigned char* v1 = datafileReadRaw(path, widthPtr, heightPtr);
|
||||
if (v1 != nullptr) {
|
||||
if (v1 != NULL) {
|
||||
sub_42EE84(v1, gDatafilePalette, *widthPtr, *heightPtr);
|
||||
}
|
||||
return v1;
|
||||
|
@ -121,12 +121,12 @@ unsigned char* sub_42EFF4(char* path)
|
|||
int width;
|
||||
int height;
|
||||
unsigned char* v3 = datafileReadRaw(path, &width, &height);
|
||||
if (v3 != nullptr) {
|
||||
if (v3 != NULL) {
|
||||
internal_free_safe(v3, __FILE__, __LINE__); // "..\\int\\DATAFILE.C", 148
|
||||
return gDatafilePalette;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// NOTE: Unused.
|
||||
|
@ -177,17 +177,17 @@ unsigned char* datafileLoad(char* path, int* sizePtr)
|
|||
{
|
||||
const char* mangledPath = gDatafileNameMangler(path);
|
||||
File* stream = fileOpen(mangledPath, "rb");
|
||||
if (stream == nullptr) {
|
||||
return nullptr;
|
||||
if (stream == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int size = fileGetSize(stream);
|
||||
unsigned char* data = (unsigned char*)internal_malloc_safe(size, __FILE__, __LINE__); // "..\\int\\DATAFILE.C", 185
|
||||
if (data == nullptr) {
|
||||
if (data == NULL) {
|
||||
// NOTE: This code is unreachable, internal_malloc_safe never fails.
|
||||
// Otherwise it leaks stream.
|
||||
*sizePtr = 0;
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fileRead(data, 1, size, stream);
|
||||
|
|
42
src/db.cc
42
src/db.cc
|
@ -19,7 +19,7 @@ static int _db_list_compare(const void* p1, const void* p2);
|
|||
// Generic file progress report handler.
|
||||
//
|
||||
// 0x51DEEC
|
||||
static FileReadProgressHandler* gFileReadProgressHandler = nullptr;
|
||||
static FileReadProgressHandler* gFileReadProgressHandler = NULL;
|
||||
|
||||
// Bytes read so far while tracking progress.
|
||||
//
|
||||
|
@ -50,13 +50,13 @@ static FileList* gFileListHead;
|
|||
// 0x4C5D30
|
||||
int dbOpen(const char* filePath1, int a2, const char* filePath2, int a4)
|
||||
{
|
||||
if (filePath1 != nullptr) {
|
||||
if (filePath1 != NULL) {
|
||||
if (!xbaseOpen(filePath1)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (filePath2 != nullptr) {
|
||||
if (filePath2 != NULL) {
|
||||
xbaseOpen(filePath2);
|
||||
}
|
||||
|
||||
|
@ -64,15 +64,15 @@ int dbOpen(const char* filePath1, int a2, const char* filePath2, int a4)
|
|||
}
|
||||
|
||||
// 0x4C5D58
|
||||
int db_total()
|
||||
int _db_total()
|
||||
{
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x4C5D60
|
||||
void dbExit()
|
||||
{
|
||||
xbaseReopenAll(nullptr);
|
||||
xbaseReopenAll(NULL);
|
||||
}
|
||||
|
||||
// TODO: sizePtr should be long*.
|
||||
|
@ -84,7 +84,7 @@ int dbGetFileSize(const char* filePath, int* sizePtr)
|
|||
assert(sizePtr); // "de", "db.c", 109
|
||||
|
||||
File* stream = xfileOpen(filePath, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -102,12 +102,12 @@ int dbGetFileContents(const char* filePath, void* ptr)
|
|||
assert(ptr); // "buf", "db.c", 142
|
||||
|
||||
File* stream = xfileOpen(filePath, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
long size = xfileGetSize(stream);
|
||||
if (gFileReadProgressHandler != nullptr) {
|
||||
if (gFileReadProgressHandler != NULL) {
|
||||
unsigned char* byteBuffer = (unsigned char*)ptr;
|
||||
|
||||
long remainingSize = size;
|
||||
|
@ -166,7 +166,7 @@ int filePrintFormatted(File* stream, const char* format, ...)
|
|||
// 0x4C5F24
|
||||
int fileReadChar(File* stream)
|
||||
{
|
||||
if (gFileReadProgressHandler != nullptr) {
|
||||
if (gFileReadProgressHandler != NULL) {
|
||||
int ch = xfileReadChar(stream);
|
||||
|
||||
gFileReadProgressBytesRead++;
|
||||
|
@ -184,9 +184,9 @@ int fileReadChar(File* stream)
|
|||
// 0x4C5F70
|
||||
char* fileReadString(char* string, size_t size, File* stream)
|
||||
{
|
||||
if (gFileReadProgressHandler != nullptr) {
|
||||
if (xfileReadString(string, size, stream) == nullptr) {
|
||||
return nullptr;
|
||||
if (gFileReadProgressHandler != NULL) {
|
||||
if (xfileReadString(string, size, stream) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gFileReadProgressBytesRead += strlen(string);
|
||||
|
@ -210,7 +210,7 @@ int fileWriteString(const char* string, File* stream)
|
|||
// 0x4C5FFC
|
||||
size_t fileRead(void* ptr, size_t size, size_t count, File* stream)
|
||||
{
|
||||
if (gFileReadProgressHandler != nullptr) {
|
||||
if (gFileReadProgressHandler != NULL) {
|
||||
unsigned char* byteBuffer = (unsigned char*)ptr;
|
||||
|
||||
size_t totalBytesRead = 0;
|
||||
|
@ -602,7 +602,7 @@ int fileWriteUInt32List(File* stream, unsigned int* arr, int count)
|
|||
int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a4)
|
||||
{
|
||||
FileList* fileList = (FileList*)malloc(sizeof(*fileList));
|
||||
if (fileList == nullptr) {
|
||||
if (fileList == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -638,9 +638,9 @@ int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a
|
|||
char fileName[COMPAT_MAX_FNAME];
|
||||
char extension[COMPAT_MAX_EXT];
|
||||
compat_windows_path_to_native(name);
|
||||
compat_splitpath(name, nullptr, dir, fileName, extension);
|
||||
compat_splitpath(name, NULL, dir, fileName, extension);
|
||||
|
||||
if (!isWildcard || *dir == '\0' || (strchr(dir, '\\') == nullptr && strchr(dir, '/') == nullptr)) {
|
||||
if (!isWildcard || *dir == '\0' || (strchr(dir, '\\') == NULL && strchr(dir, '/') == NULL)) {
|
||||
// NOTE: Quick and dirty fix to buffer overflow. See RE to
|
||||
// understand the problem.
|
||||
char path[COMPAT_MAX_PATH];
|
||||
|
@ -663,7 +663,7 @@ int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a
|
|||
// 0x4C6868
|
||||
void fileNameListFree(char*** fileNameListPtr, int a2)
|
||||
{
|
||||
if (gFileListHead == nullptr) {
|
||||
if (gFileListHead == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -672,7 +672,7 @@ void fileNameListFree(char*** fileNameListPtr, int a2)
|
|||
while (*fileNameListPtr != currentFileList->xlist.fileNames) {
|
||||
previousFileList = currentFileList;
|
||||
currentFileList = currentFileList->next;
|
||||
if (currentFileList == nullptr) {
|
||||
if (currentFileList == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -699,11 +699,11 @@ int fileGetSize(File* stream)
|
|||
// 0x4C68C4
|
||||
void fileSetReadProgressHandler(FileReadProgressHandler* handler, int size)
|
||||
{
|
||||
if (handler != nullptr && size != 0) {
|
||||
if (handler != NULL && size != 0) {
|
||||
gFileReadProgressHandler = handler;
|
||||
gFileReadProgressChunkSize = size;
|
||||
} else {
|
||||
gFileReadProgressHandler = nullptr;
|
||||
gFileReadProgressHandler = NULL;
|
||||
gFileReadProgressChunkSize = 0;
|
||||
}
|
||||
}
|
||||
|
|
2
src/db.h
2
src/db.h
|
@ -12,7 +12,7 @@ typedef void FileReadProgressHandler();
|
|||
typedef char* StrdupProc(const char* string);
|
||||
|
||||
int dbOpen(const char* filePath1, int a2, const char* filePath2, int a4);
|
||||
int db_total();
|
||||
int _db_total();
|
||||
void dbExit();
|
||||
int dbGetFileSize(const char* filePath, int* sizePtr);
|
||||
int dbGetFileContents(const char* filePath, void* ptr);
|
||||
|
|
56
src/dbox.cc
56
src/dbox.cc
|
@ -9,7 +9,6 @@
|
|||
#include "character_editor.h"
|
||||
#include "color.h"
|
||||
#include "debug.h"
|
||||
#include "delay.h"
|
||||
#include "draw.h"
|
||||
#include "game.h"
|
||||
#include "game_sound.h"
|
||||
|
@ -157,12 +156,12 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
bool v86 = false;
|
||||
|
||||
bool hasTwoButtons = false;
|
||||
if (a8 != nullptr) {
|
||||
if (a8 != NULL) {
|
||||
hasTwoButtons = true;
|
||||
}
|
||||
|
||||
bool hasTitle = false;
|
||||
if (title != nullptr) {
|
||||
if (title != NULL) {
|
||||
hasTitle = true;
|
||||
}
|
||||
|
||||
|
@ -298,7 +297,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
500,
|
||||
buttonNormalFrmImage.getData(),
|
||||
buttonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (btn != -1) {
|
||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -339,7 +338,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
501,
|
||||
buttonNormalFrmImage.getData(),
|
||||
buttonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
0,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (btn != -1) {
|
||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -404,7 +403,7 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
|
|||
501,
|
||||
buttonNormalFrmImage.getData(),
|
||||
buttonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (btn != -1) {
|
||||
buttonSetCallbacks(btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -644,7 +643,7 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
500,
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (doneBtn != -1) {
|
||||
buttonSetCallbacks(doneBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -661,7 +660,7 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
501,
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (cancelBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -678,7 +677,7 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
505,
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_UP_ARROW_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_UP_ARROW_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (scrollUpBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -695,7 +694,7 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
503,
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_DOWN_ARROW_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_DOWN_ARROW_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (scrollUpBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -711,12 +710,12 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
-1,
|
||||
-1,
|
||||
502,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0);
|
||||
|
||||
if (title != nullptr) {
|
||||
if (title != NULL) {
|
||||
fontDrawText(windowBuffer + backgroundWidth * FILE_DIALOG_TITLE_Y + FILE_DIALOG_TITLE_X, title, backgroundWidth, backgroundWidth, _colorTable[18979]);
|
||||
}
|
||||
|
||||
|
@ -886,8 +885,8 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
}
|
||||
|
||||
unsigned int delay = (scrollCounter > 14.4) ? 1000 / scrollDelay : 1000 / 24;
|
||||
|
||||
delay_ms(delay - (getTicks() - scrollTick));
|
||||
while (getTicksSince(scrollTick) < delay) {
|
||||
}
|
||||
|
||||
if (_game_user_wants_to_quit != 0) {
|
||||
rc = 1;
|
||||
|
@ -910,7 +909,8 @@ int showLoadFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
doubleClickSelectedFileIndex = -2;
|
||||
}
|
||||
|
||||
delay_ms(1000 / 24 - (getTicks() - tick));
|
||||
while (getTicksSince(tick) < (1000 / 24)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (_game_user_wants_to_quit) {
|
||||
|
@ -1009,7 +1009,7 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
500,
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (doneBtn != -1) {
|
||||
buttonSetCallbacks(doneBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -1026,7 +1026,7 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
501,
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_LITTLE_RED_BUTTON_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (cancelBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -1043,7 +1043,7 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
505,
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_UP_ARROW_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_UP_ARROW_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (scrollUpBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -1060,7 +1060,7 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
503,
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_DOWN_ARROW_NORMAL].getData(),
|
||||
frmImages[FILE_DIALOG_FRM_SCROLL_DOWN_ARROW_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (scrollUpBtn != -1) {
|
||||
buttonSetCallbacks(cancelBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
@ -1076,12 +1076,12 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
-1,
|
||||
-1,
|
||||
502,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0);
|
||||
|
||||
if (title != nullptr) {
|
||||
if (title != NULL) {
|
||||
fontDrawText(windowBuffer + backgroundWidth * FILE_DIALOG_TITLE_Y + FILE_DIALOG_TITLE_X, title, backgroundWidth, backgroundWidth, _colorTable[18979]);
|
||||
}
|
||||
|
||||
|
@ -1335,7 +1335,8 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
// FIXME: Missing windowRefresh makes blinking useless.
|
||||
|
||||
unsigned int delay = (scrollCounter > 14.4) ? 1000 / scrollDelay : 1000 / 24;
|
||||
delay_ms(delay - (getTicks() - scrollTick));
|
||||
while (getTicksSince(scrollTick) < delay) {
|
||||
}
|
||||
|
||||
if (_game_user_wants_to_quit != 0) {
|
||||
rc = 1;
|
||||
|
@ -1368,7 +1369,8 @@ int showSaveFileDialog(char* title, char** fileList, char* dest, int fileListLen
|
|||
doubleClickSelectedFileIndex = -2;
|
||||
}
|
||||
|
||||
delay_ms(1000 / 24 - (getTicks() - tick));
|
||||
while (getTicksSince(tick) < (1000 / 24)) {
|
||||
}
|
||||
}
|
||||
|
||||
if (_game_user_wants_to_quit != 0) {
|
||||
|
|
46
src/debug.cc
46
src/debug.cc
|
@ -22,7 +22,7 @@ static void _debug_putc(int ch);
|
|||
static void _debug_scroll();
|
||||
|
||||
// 0x51DEF8
|
||||
static FILE* _fd = nullptr;
|
||||
static FILE* _fd = NULL;
|
||||
|
||||
// 0x51DEFC
|
||||
static int _curx = 0;
|
||||
|
@ -31,7 +31,7 @@ static int _curx = 0;
|
|||
static int _cury = 0;
|
||||
|
||||
// 0x51DF04
|
||||
static DebugPrintProc* gDebugPrintProc = nullptr;
|
||||
static DebugPrintProc* gDebugPrintProc = NULL;
|
||||
|
||||
// 0x4C6CD0
|
||||
void _GNW_debug_init()
|
||||
|
@ -43,9 +43,9 @@ void _GNW_debug_init()
|
|||
void _debug_register_mono()
|
||||
{
|
||||
if (gDebugPrintProc != _debug_mono) {
|
||||
if (_fd != nullptr) {
|
||||
if (_fd != NULL) {
|
||||
fclose(_fd);
|
||||
_fd = nullptr;
|
||||
_fd = NULL;
|
||||
}
|
||||
|
||||
gDebugPrintProc = _debug_mono;
|
||||
|
@ -56,8 +56,8 @@ void _debug_register_mono()
|
|||
// 0x4C6D18
|
||||
void _debug_register_log(const char* fileName, const char* mode)
|
||||
{
|
||||
if ((mode[0] == 'w' || mode[0] == 'a') && mode[1] == 't') {
|
||||
if (_fd != nullptr) {
|
||||
if ((mode[0] == 'w' && mode[1] == 'a') && mode[1] == 't') {
|
||||
if (_fd != NULL) {
|
||||
fclose(_fd);
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,9 @@ void _debug_register_log(const char* fileName, const char* mode)
|
|||
void _debug_register_screen()
|
||||
{
|
||||
if (gDebugPrintProc != _debug_screen) {
|
||||
if (_fd != nullptr) {
|
||||
if (_fd != NULL) {
|
||||
fclose(_fd);
|
||||
_fd = nullptr;
|
||||
_fd = NULL;
|
||||
}
|
||||
|
||||
gDebugPrintProc = _debug_screen;
|
||||
|
@ -83,12 +83,12 @@ void _debug_register_screen()
|
|||
void _debug_register_env()
|
||||
{
|
||||
const char* type = getenv("DEBUGACTIVE");
|
||||
if (type == nullptr) {
|
||||
if (type == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
char* copy = (char*)internal_malloc(strlen(type) + 1);
|
||||
if (copy == nullptr) {
|
||||
if (copy == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -104,8 +104,14 @@ void _debug_register_env()
|
|||
// NOTE: Uninline.
|
||||
_debug_register_screen();
|
||||
} else if (strcmp(copy, "gnw") == 0) {
|
||||
// NOTE: Uninline.
|
||||
_debug_register_func(_win_debug);
|
||||
if (gDebugPrintProc != _win_debug) {
|
||||
if (_fd != NULL) {
|
||||
fclose(_fd);
|
||||
_fd = NULL;
|
||||
}
|
||||
|
||||
gDebugPrintProc = _win_debug;
|
||||
}
|
||||
}
|
||||
|
||||
internal_free(copy);
|
||||
|
@ -115,9 +121,9 @@ void _debug_register_env()
|
|||
void _debug_register_func(DebugPrintProc* proc)
|
||||
{
|
||||
if (gDebugPrintProc != proc) {
|
||||
if (_fd != nullptr) {
|
||||
if (_fd != NULL) {
|
||||
fclose(_fd);
|
||||
_fd = nullptr;
|
||||
_fd = NULL;
|
||||
}
|
||||
|
||||
gDebugPrintProc = proc;
|
||||
|
@ -132,7 +138,7 @@ int debugPrint(const char* format, ...)
|
|||
|
||||
int rc;
|
||||
|
||||
if (gDebugPrintProc != nullptr) {
|
||||
if (gDebugPrintProc != NULL) {
|
||||
char string[260];
|
||||
vsnprintf(string, sizeof(string), format, args);
|
||||
|
||||
|
@ -152,7 +158,7 @@ int debugPrint(const char* format, ...)
|
|||
// 0x4C6F94
|
||||
static int _debug_puts(char* string)
|
||||
{
|
||||
if (gDebugPrintProc != nullptr) {
|
||||
if (gDebugPrintProc != NULL) {
|
||||
return gDebugPrintProc(string);
|
||||
}
|
||||
|
||||
|
@ -166,7 +172,7 @@ static void _debug_clear()
|
|||
int x;
|
||||
int y;
|
||||
|
||||
buffer = nullptr;
|
||||
buffer = NULL;
|
||||
|
||||
if (gDebugPrintProc == _debug_mono) {
|
||||
buffer = (char*)0xB0000;
|
||||
|
@ -174,7 +180,7 @@ static void _debug_clear()
|
|||
buffer = (char*)0xB8000;
|
||||
}
|
||||
|
||||
if (buffer != nullptr) {
|
||||
if (buffer != NULL) {
|
||||
for (y = 0; y < 25; y++) {
|
||||
for (x = 0; x < 80; x++) {
|
||||
*buffer++ = ' ';
|
||||
|
@ -202,7 +208,7 @@ static int _debug_mono(char* string)
|
|||
static int _debug_log(char* string)
|
||||
{
|
||||
if (gDebugPrintProc == _debug_log) {
|
||||
if (_fd == nullptr) {
|
||||
if (_fd == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -300,7 +306,7 @@ static void _debug_scroll()
|
|||
// 0x4C71E8
|
||||
void _debug_exit(void)
|
||||
{
|
||||
if (_fd != nullptr) {
|
||||
if (_fd != NULL) {
|
||||
fclose(_fd);
|
||||
}
|
||||
}
|
||||
|
|
11
src/delay.cc
11
src/delay.cc
|
@ -1,11 +0,0 @@
|
|||
#include "delay.h"
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
void delay_ms(int ms)
|
||||
{
|
||||
if (ms <= 0) {
|
||||
return;
|
||||
}
|
||||
SDL_Delay(ms);
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef DELAY_H
|
||||
#define DELAY_H
|
||||
|
||||
void delay_ms(int ms);
|
||||
|
||||
#endif
|
105
src/dfile.cc
105
src/dfile.cc
|
@ -43,6 +43,8 @@ static int dfileReadCharInternal(DFile* stream);
|
|||
static bool dfileReadCompressed(DFile* stream, void* ptr, size_t size);
|
||||
static void dfileUngetCompressed(DFile* stream, int ch);
|
||||
|
||||
static void dfile_normalize_path(char* path);
|
||||
|
||||
// Reads .DAT file contents.
|
||||
//
|
||||
// 0x4E4F58
|
||||
|
@ -51,14 +53,14 @@ DBase* dbaseOpen(const char* filePath)
|
|||
assert(filePath); // "filename", "dfile.c", 74
|
||||
|
||||
FILE* stream = compat_fopen(filePath, "rb");
|
||||
if (stream == nullptr) {
|
||||
return nullptr;
|
||||
if (stream == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DBase* dbase = (DBase*)malloc(sizeof(*dbase));
|
||||
if (dbase == nullptr) {
|
||||
if (dbase == NULL) {
|
||||
fclose(stream);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(dbase, 0, sizeof(*dbase));
|
||||
|
@ -95,7 +97,7 @@ DBase* dbaseOpen(const char* filePath)
|
|||
}
|
||||
|
||||
dbase->entries = (DBaseEntry*)malloc(sizeof(*dbase->entries) * dbase->entriesLength);
|
||||
if (dbase->entries == nullptr) {
|
||||
if (dbase->entries == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -112,7 +114,7 @@ DBase* dbaseOpen(const char* filePath)
|
|||
}
|
||||
|
||||
entry->path = (char*)malloc(pathLength + 1);
|
||||
if (entry->path == nullptr) {
|
||||
if (entry->path == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -122,6 +124,9 @@ DBase* dbaseOpen(const char* filePath)
|
|||
|
||||
entry->path[pathLength] = '\0';
|
||||
|
||||
// CE: Normalize entry path.
|
||||
dfile_normalize_path(entry->path);
|
||||
|
||||
if (fread(&(entry->compressed), sizeof(entry->compressed), 1, stream) != 1) {
|
||||
break;
|
||||
}
|
||||
|
@ -158,7 +163,7 @@ err:
|
|||
|
||||
fclose(stream);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Closes [dbase], all open file handles, frees all associated resources,
|
||||
|
@ -170,24 +175,24 @@ bool dbaseClose(DBase* dbase)
|
|||
assert(dbase); // "dbase", "dfile.c", 173
|
||||
|
||||
DFile* curr = dbase->dfileHead;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
DFile* next = curr->next;
|
||||
dfileClose(curr);
|
||||
curr = next;
|
||||
}
|
||||
|
||||
if (dbase->entries != nullptr) {
|
||||
if (dbase->entries != NULL) {
|
||||
for (int index = 0; index < dbase->entriesLength; index++) {
|
||||
DBaseEntry* entry = &(dbase->entries[index]);
|
||||
char* entryName = entry->path;
|
||||
if (entryName != nullptr) {
|
||||
if (entryName != NULL) {
|
||||
free(entryName);
|
||||
}
|
||||
}
|
||||
free(dbase->entries);
|
||||
}
|
||||
|
||||
if (dbase->path != nullptr) {
|
||||
if (dbase->path != NULL) {
|
||||
free(dbase->path);
|
||||
}
|
||||
|
||||
|
@ -201,11 +206,18 @@ bool dbaseClose(DBase* dbase)
|
|||
// 0x4E5308
|
||||
bool dbaseFindFirstEntry(DBase* dbase, DFileFindData* findFileData, const char* pattern)
|
||||
{
|
||||
// CE: Normalize pattern to match entries. Underlying `fpattern`
|
||||
// implementation is case-sensitive on non-Windows platforms, so both
|
||||
// pattern and entries should match in case and have native path separators.
|
||||
char normalizedPattern[COMPAT_MAX_PATH];
|
||||
strcpy(normalizedPattern, pattern);
|
||||
dfile_normalize_path(normalizedPattern);
|
||||
|
||||
for (int index = 0; index < dbase->entriesLength; index++) {
|
||||
DBaseEntry* entry = &(dbase->entries[index]);
|
||||
if (fpattern_match(pattern, entry->path)) {
|
||||
if (fpattern_match(normalizedPattern, entry->path)) {
|
||||
strcpy(findFileData->fileName, entry->path);
|
||||
strcpy(findFileData->pattern, pattern);
|
||||
strcpy(findFileData->pattern, normalizedPattern);
|
||||
findFileData->index = index;
|
||||
return true;
|
||||
}
|
||||
|
@ -258,15 +270,15 @@ int dfileClose(DFile* stream)
|
|||
}
|
||||
}
|
||||
|
||||
if (stream->decompressionStream != nullptr) {
|
||||
if (stream->decompressionStream != NULL) {
|
||||
free(stream->decompressionStream);
|
||||
}
|
||||
|
||||
if (stream->decompressionBuffer != nullptr) {
|
||||
if (stream->decompressionBuffer != NULL) {
|
||||
free(stream->decompressionBuffer);
|
||||
}
|
||||
|
||||
if (stream->stream != nullptr) {
|
||||
if (stream->stream != NULL) {
|
||||
fclose(stream->stream);
|
||||
}
|
||||
|
||||
|
@ -275,8 +287,8 @@ int dfileClose(DFile* stream)
|
|||
//
|
||||
// NOTE: Compiled code is slightly different.
|
||||
DFile* curr = stream->dbase->dfileHead;
|
||||
DFile* prev = nullptr;
|
||||
while (curr != nullptr) {
|
||||
DFile* prev = NULL;
|
||||
while (curr != NULL) {
|
||||
if (curr == stream) {
|
||||
break;
|
||||
}
|
||||
|
@ -285,8 +297,8 @@ int dfileClose(DFile* stream)
|
|||
curr = curr->next;
|
||||
}
|
||||
|
||||
if (curr != nullptr) {
|
||||
if (prev == nullptr) {
|
||||
if (curr != NULL) {
|
||||
if (prev == NULL) {
|
||||
stream->dbase->dfileHead = stream->next;
|
||||
} else {
|
||||
prev->next = stream->next;
|
||||
|
@ -309,7 +321,7 @@ DFile* dfileOpen(DBase* dbase, const char* filePath, const char* mode)
|
|||
assert(filePath); // dfile.c, 296
|
||||
assert(mode); // dfile.c, 297
|
||||
|
||||
return dfileOpenInternal(dbase, filePath, mode, nullptr);
|
||||
return dfileOpenInternal(dbase, filePath, mode, 0);
|
||||
}
|
||||
|
||||
// [vfprintf].
|
||||
|
@ -363,7 +375,7 @@ char* dfileReadString(char* string, int size, DFile* stream)
|
|||
assert(stream); // "stream", "dfile.c", 409
|
||||
|
||||
if ((stream->flags & DFILE_EOF) != 0 || (stream->flags & DFILE_ERROR) != 0) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char* pch = string;
|
||||
|
@ -391,7 +403,7 @@ char* dfileReadString(char* string, int size, DFile* stream)
|
|||
|
||||
if (pch == string) {
|
||||
// No character was set into the buffer.
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*pch = '\0';
|
||||
|
@ -632,8 +644,15 @@ static int dbaseFindEntryByFilePath(const void* a1, const void* a2)
|
|||
// 0x4E5D9C
|
||||
static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char* mode, DFile* dfile)
|
||||
{
|
||||
DBaseEntry* entry = (DBaseEntry*)bsearch(filePath, dbase->entries, dbase->entriesLength, sizeof(*dbase->entries), dbaseFindEntryByFilePath);
|
||||
if (entry == nullptr) {
|
||||
// CE: Normalize path to match entries. Even though
|
||||
// `dbaseFindEntryByFilePath` uses case-insensitive compare, it still needs
|
||||
// native path separators.
|
||||
char normalizedFilePath[COMPAT_MAX_PATH];
|
||||
strcpy(normalizedFilePath, filePath);
|
||||
dfile_normalize_path(normalizedFilePath);
|
||||
|
||||
DBaseEntry* entry = (DBaseEntry*)bsearch(normalizedFilePath, dbase->entries, dbase->entriesLength, sizeof(*dbase->entries), dbaseFindEntryByFilePath);
|
||||
if (entry == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -641,10 +660,10 @@ static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char*
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (dfile == nullptr) {
|
||||
if (dfile == NULL) {
|
||||
dfile = (DFile*)malloc(sizeof(*dfile));
|
||||
if (dfile == nullptr) {
|
||||
return nullptr;
|
||||
if (dfile == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(dfile, 0, sizeof(*dfile));
|
||||
|
@ -656,9 +675,9 @@ static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char*
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (dfile->stream != nullptr) {
|
||||
if (dfile->stream != NULL) {
|
||||
fclose(dfile->stream);
|
||||
dfile->stream = nullptr;
|
||||
dfile->stream = NULL;
|
||||
}
|
||||
|
||||
dfile->compressedBytesRead = 0;
|
||||
|
@ -670,7 +689,7 @@ static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char*
|
|||
|
||||
// Open stream to .DAT file.
|
||||
dfile->stream = compat_fopen(dbase->path, "rb");
|
||||
if (dfile->stream == nullptr) {
|
||||
if (dfile->stream == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -684,14 +703,14 @@ static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char*
|
|||
// buffer. This step is not needed when previous instance of dfile is
|
||||
// passed via parameter, which might already have stream and
|
||||
// buffer allocated.
|
||||
if (dfile->decompressionStream == nullptr) {
|
||||
if (dfile->decompressionStream == NULL) {
|
||||
dfile->decompressionStream = (z_streamp)malloc(sizeof(*dfile->decompressionStream));
|
||||
if (dfile->decompressionStream == nullptr) {
|
||||
if (dfile->decompressionStream == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
dfile->decompressionBuffer = (unsigned char*)malloc(DFILE_DECOMPRESSION_BUFFER_SIZE);
|
||||
if (dfile->decompressionBuffer == nullptr) {
|
||||
if (dfile->decompressionBuffer == NULL) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
@ -709,14 +728,14 @@ static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char*
|
|||
// Entry is not compressed, there is no need to keep decompression
|
||||
// stream and decompression buffer (in case [dfile] was passed via
|
||||
// parameter).
|
||||
if (dfile->decompressionStream != nullptr) {
|
||||
if (dfile->decompressionStream != NULL) {
|
||||
free(dfile->decompressionStream);
|
||||
dfile->decompressionStream = nullptr;
|
||||
dfile->decompressionStream = NULL;
|
||||
}
|
||||
|
||||
if (dfile->decompressionBuffer != nullptr) {
|
||||
if (dfile->decompressionBuffer != NULL) {
|
||||
free(dfile->decompressionBuffer);
|
||||
dfile->decompressionBuffer = nullptr;
|
||||
dfile->decompressionBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -728,11 +747,11 @@ static DFile* dfileOpenInternal(DBase* dbase, const char* filePath, const char*
|
|||
|
||||
err:
|
||||
|
||||
if (dfile != nullptr) {
|
||||
if (dfile != NULL) {
|
||||
dfileClose(dfile);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x4E5F9C
|
||||
|
@ -854,4 +873,10 @@ static void dfileUngetCompressed(DFile* stream, int ch)
|
|||
stream->position--;
|
||||
}
|
||||
|
||||
static void dfile_normalize_path(char* path)
|
||||
{
|
||||
compat_windows_path_to_native(path);
|
||||
compat_strlwr(path);
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -28,10 +28,10 @@ int _topDialogLine = 0;
|
|||
int _topDialogReply = 0;
|
||||
|
||||
// 0x5184E4
|
||||
DialogFunc1* _replyWinDrawCallback = nullptr;
|
||||
DialogFunc1* _replyWinDrawCallback = NULL;
|
||||
|
||||
// 0x5184E8
|
||||
DialogFunc2* _optionsWinDrawCallback = nullptr;
|
||||
DialogFunc2* _optionsWinDrawCallback = NULL;
|
||||
|
||||
// 0x5184EC
|
||||
int gDialogBorderX = 7;
|
||||
|
@ -171,7 +171,7 @@ STRUCT_56DAE0_FIELD_4* _getReply()
|
|||
STRUCT_56DAE0_FIELD_4_FIELD_C* v1;
|
||||
|
||||
v0 = &(_dialog[_tods].field_4[_dialog[_tods].field_C]);
|
||||
if (v0->field_C == nullptr) {
|
||||
if (v0->field_C == NULL) {
|
||||
v0->field_14 = 1;
|
||||
v1 = (STRUCT_56DAE0_FIELD_4_FIELD_C*)internal_malloc_safe(sizeof(STRUCT_56DAE0_FIELD_4_FIELD_C), __FILE__, __LINE__); // "..\\int\\DIALOG.C", 789
|
||||
} else {
|
||||
|
@ -195,20 +195,20 @@ void _replyAddOption(const char* a1, const char* a2, int a3)
|
|||
v17 = v18->field_14 - 1;
|
||||
v18->field_C[v17].kind = 2;
|
||||
|
||||
if (a1 != nullptr) {
|
||||
if (a1 != NULL) {
|
||||
v14 = (char*)internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 805
|
||||
strcpy(v14, a1);
|
||||
v18->field_C[v17].field_0 = v14;
|
||||
} else {
|
||||
v18->field_C[v17].field_0 = nullptr;
|
||||
v18->field_C[v17].field_0 = NULL;
|
||||
}
|
||||
|
||||
if (a2 != nullptr) {
|
||||
if (a2 != NULL) {
|
||||
v15 = (char*)internal_malloc_safe(strlen(a2) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 810
|
||||
strcpy(v15, a2);
|
||||
v18->field_C[v17].string = v15;
|
||||
} else {
|
||||
v18->field_C[v17].string = nullptr;
|
||||
v18->field_C[v17].string = NULL;
|
||||
}
|
||||
|
||||
v18->field_C[v17].field_18 = windowGetFont();
|
||||
|
@ -228,12 +228,12 @@ void _replyAddOptionProc(const char* a1, int a2, int a3)
|
|||
|
||||
v5->field_C[v13].kind = 1;
|
||||
|
||||
if (a1 != nullptr) {
|
||||
if (a1 != NULL) {
|
||||
v11 = (char*)internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 830
|
||||
strcpy(v11, a1);
|
||||
v5->field_C[v13].field_0 = v11;
|
||||
} else {
|
||||
v5->field_C[v13].field_0 = nullptr;
|
||||
v5->field_C[v13].field_0 = NULL;
|
||||
}
|
||||
|
||||
v5->field_C[v13].proc = a2;
|
||||
|
@ -246,12 +246,12 @@ void _replyAddOptionProc(const char* a1, int a2, int a3)
|
|||
// 0x42F714
|
||||
void _optionFree(STRUCT_56DAE0_FIELD_4_FIELD_C* a1)
|
||||
{
|
||||
if (a1->field_0 != nullptr) {
|
||||
if (a1->field_0 != NULL) {
|
||||
internal_free_safe(a1->field_0, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 844
|
||||
}
|
||||
|
||||
if (a1->kind == 2) {
|
||||
if (a1->string != nullptr) {
|
||||
if (a1->string != NULL) {
|
||||
internal_free_safe(a1->string, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 846
|
||||
}
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void _replyFree()
|
|||
for (i = 0; i < ptr->field_8; i++) {
|
||||
v6 = &(_dialog[_tods].field_4[i]);
|
||||
|
||||
if (v6->field_C != nullptr) {
|
||||
if (v6->field_C != NULL) {
|
||||
for (j = 0; j < v6->field_14; j++) {
|
||||
_optionFree(&(v6->field_C[j]));
|
||||
}
|
||||
|
@ -277,20 +277,20 @@ void _replyFree()
|
|||
internal_free_safe(v6->field_C, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 857
|
||||
}
|
||||
|
||||
if (v6->field_8 != nullptr) {
|
||||
if (v6->field_8 != NULL) {
|
||||
internal_free_safe(v6->field_8, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 860
|
||||
}
|
||||
|
||||
if (v6->field_4 != nullptr) {
|
||||
if (v6->field_4 != NULL) {
|
||||
internal_free_safe(v6->field_4, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 862
|
||||
}
|
||||
|
||||
if (v6->field_0 != nullptr) {
|
||||
if (v6->field_0 != NULL) {
|
||||
internal_free_safe(v6->field_0, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 864
|
||||
}
|
||||
}
|
||||
|
||||
if (ptr->field_4 != nullptr) {
|
||||
if (ptr->field_4 != NULL) {
|
||||
internal_free_safe(ptr->field_4, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 867
|
||||
}
|
||||
}
|
||||
|
@ -305,9 +305,9 @@ int _endDialog()
|
|||
_topDialogReply = _dialog[_tods].field_10;
|
||||
_replyFree();
|
||||
|
||||
if (gDialogReplyTitle != nullptr) {
|
||||
if (gDialogReplyTitle != NULL) {
|
||||
internal_free_safe(gDialogReplyTitle, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 986
|
||||
gDialogReplyTitle = nullptr;
|
||||
gDialogReplyTitle = NULL;
|
||||
}
|
||||
|
||||
--_tods;
|
||||
|
@ -414,7 +414,7 @@ int _dialogStart(Program* a1)
|
|||
|
||||
ptr = &(_dialog[_tods]);
|
||||
ptr->field_0 = a1;
|
||||
ptr->field_4 = nullptr;
|
||||
ptr->field_4 = 0;
|
||||
ptr->field_8 = 0;
|
||||
ptr->field_C = -1;
|
||||
ptr->field_10 = -1;
|
||||
|
@ -449,11 +449,11 @@ int _dialogGotoReply(const char* a1)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (a1 != nullptr) {
|
||||
if (a1 != NULL) {
|
||||
ptr = &(_dialog[_tods]);
|
||||
for (i = 0; i < ptr->field_8; i++) {
|
||||
v5 = &(ptr->field_4[i]);
|
||||
if (v5->field_4 != nullptr && compat_stricmp(v5->field_4, a1) == 0) {
|
||||
if (v5->field_4 != NULL && compat_stricmp(v5->field_4, a1) == 0) {
|
||||
ptr->field_10 = i;
|
||||
return 0;
|
||||
}
|
||||
|
@ -470,15 +470,15 @@ int _dialogGotoReply(const char* a1)
|
|||
// 0x430E84
|
||||
int dialogSetReplyTitle(const char* a1)
|
||||
{
|
||||
if (gDialogReplyTitle != nullptr) {
|
||||
if (gDialogReplyTitle != NULL) {
|
||||
internal_free_safe(gDialogReplyTitle, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2561
|
||||
}
|
||||
|
||||
if (a1 != nullptr) {
|
||||
if (a1 != NULL) {
|
||||
gDialogReplyTitle = (char*)internal_malloc_safe(strlen(a1) + 1, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2564
|
||||
strcpy(gDialogReplyTitle, a1);
|
||||
} else {
|
||||
gDialogReplyTitle = nullptr;
|
||||
gDialogReplyTitle = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -586,22 +586,22 @@ int _dialogSetScrollUp(int a1, int a2, char* a3, char* a4, char* a5, char* a6, i
|
|||
_upButton = a1;
|
||||
dword_56DBD8 = a2;
|
||||
|
||||
if (off_56DBE0 != nullptr) {
|
||||
if (off_56DBE0 != NULL) {
|
||||
internal_free_safe(off_56DBE0, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2750
|
||||
}
|
||||
off_56DBE0 = a3;
|
||||
|
||||
if (off_56DBE4 != nullptr) {
|
||||
if (off_56DBE4 != NULL) {
|
||||
internal_free_safe(off_56DBE4, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2752
|
||||
}
|
||||
off_56DBE4 = a4;
|
||||
|
||||
if (off_56DBE8 != nullptr) {
|
||||
if (off_56DBE8 != NULL) {
|
||||
internal_free_safe(off_56DBE8, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2754
|
||||
}
|
||||
off_56DBE8 = a5;
|
||||
|
||||
if (off_56DBEC != nullptr) {
|
||||
if (off_56DBEC != NULL) {
|
||||
internal_free_safe(off_56DBEC, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2756
|
||||
}
|
||||
off_56DBEC = a5;
|
||||
|
@ -617,22 +617,22 @@ int _dialogSetScrollDown(int a1, int a2, char* a3, char* a4, char* a5, char* a6,
|
|||
_downButton = a1;
|
||||
dword_56DBB8 = a2;
|
||||
|
||||
if (off_56DBC0 != nullptr) {
|
||||
if (off_56DBC0 != NULL) {
|
||||
internal_free_safe(off_56DBC0, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2765
|
||||
}
|
||||
off_56DBC0 = a3;
|
||||
|
||||
if (off_56DBC4 != nullptr) {
|
||||
if (off_56DBC4 != NULL) {
|
||||
internal_free_safe(off_56DBC4, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2767
|
||||
}
|
||||
off_56DBC4 = a4;
|
||||
|
||||
if (off_56DBC8 != nullptr) {
|
||||
if (off_56DBC8 != NULL) {
|
||||
internal_free_safe(off_56DBC8, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2769
|
||||
}
|
||||
off_56DBC8 = a5;
|
||||
|
||||
if (off_56DBCC != nullptr) {
|
||||
if (off_56DBCC != NULL) {
|
||||
internal_free_safe(off_56DBCC, __FILE__, __LINE__); // "..\\int\\DIALOG.C", 2771
|
||||
}
|
||||
off_56DBCC = a6;
|
||||
|
|
|
@ -52,11 +52,11 @@ int dictionaryInit(Dictionary* dictionary, int initialCapacity, size_t valueSize
|
|||
dictionary->valueSize = valueSize;
|
||||
dictionary->entriesLength = 0;
|
||||
|
||||
if (io != nullptr) {
|
||||
if (io != NULL) {
|
||||
memcpy(&(dictionary->io), io, sizeof(*io));
|
||||
} else {
|
||||
dictionary->io.readProc = nullptr;
|
||||
dictionary->io.writeProc = nullptr;
|
||||
dictionary->io.readProc = NULL;
|
||||
dictionary->io.writeProc = NULL;
|
||||
dictionary->io.field_8 = 0;
|
||||
dictionary->io.field_C = 0;
|
||||
}
|
||||
|
@ -65,11 +65,11 @@ int dictionaryInit(Dictionary* dictionary, int initialCapacity, size_t valueSize
|
|||
|
||||
if (initialCapacity != 0) {
|
||||
dictionary->entries = (DictionaryEntry*)gDictionaryMallocProc(sizeof(*dictionary->entries) * initialCapacity);
|
||||
if (dictionary->entries == nullptr) {
|
||||
if (dictionary->entries == NULL) {
|
||||
rc = -1;
|
||||
}
|
||||
} else {
|
||||
dictionary->entries = nullptr;
|
||||
dictionary->entries = NULL;
|
||||
}
|
||||
|
||||
if (rc != -1) {
|
||||
|
@ -91,7 +91,7 @@ int dictionarySetCapacity(Dictionary* dictionary, int newCapacity)
|
|||
}
|
||||
|
||||
DictionaryEntry* entries = (DictionaryEntry*)gDictionaryReallocProc(dictionary->entries, sizeof(*dictionary->entries) * newCapacity);
|
||||
if (entries == nullptr) {
|
||||
if (entries == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -110,16 +110,16 @@ int dictionaryFree(Dictionary* dictionary)
|
|||
|
||||
for (int index = 0; index < dictionary->entriesLength; index++) {
|
||||
DictionaryEntry* entry = &(dictionary->entries[index]);
|
||||
if (entry->key != nullptr) {
|
||||
if (entry->key != NULL) {
|
||||
gDictionaryFreeProc(entry->key);
|
||||
}
|
||||
|
||||
if (entry->value != nullptr) {
|
||||
if (entry->value != NULL) {
|
||||
gDictionaryFreeProc(entry->value);
|
||||
}
|
||||
}
|
||||
|
||||
if (dictionary->entries != nullptr) {
|
||||
if (dictionary->entries != NULL) {
|
||||
gDictionaryFreeProc(dictionary->entries);
|
||||
}
|
||||
|
||||
|
@ -224,23 +224,23 @@ int dictionaryAddValue(Dictionary* dictionary, const char* key, const void* valu
|
|||
|
||||
// Make a copy of the key.
|
||||
char* keyCopy = (char*)gDictionaryMallocProc(strlen(key) + 1);
|
||||
if (keyCopy == nullptr) {
|
||||
if (keyCopy == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
strcpy(keyCopy, key);
|
||||
|
||||
// Make a copy of the value.
|
||||
void* valueCopy = nullptr;
|
||||
if (value != nullptr && dictionary->valueSize != 0) {
|
||||
void* valueCopy = NULL;
|
||||
if (value != NULL && dictionary->valueSize != 0) {
|
||||
valueCopy = gDictionaryMallocProc(dictionary->valueSize);
|
||||
if (valueCopy == nullptr) {
|
||||
if (valueCopy == NULL) {
|
||||
gDictionaryFreeProc(keyCopy);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (valueCopy != nullptr && dictionary->valueSize != 0) {
|
||||
if (valueCopy != NULL && dictionary->valueSize != 0) {
|
||||
memcpy(valueCopy, value, dictionary->valueSize);
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ int dictionaryRemoveValue(Dictionary* dictionary, const char* key)
|
|||
|
||||
// Free key and value (which are copies).
|
||||
gDictionaryFreeProc(entry->key);
|
||||
if (entry->value != nullptr) {
|
||||
if (entry->value != NULL) {
|
||||
gDictionaryFreeProc(entry->value);
|
||||
}
|
||||
|
||||
|
@ -397,16 +397,16 @@ int dictionaryLoad(FILE* stream, Dictionary* dictionary, int a3)
|
|||
|
||||
for (int index = 0; index < dictionary->entriesLength; index++) {
|
||||
DictionaryEntry* entry = &(dictionary->entries[index]);
|
||||
if (entry->key != nullptr) {
|
||||
if (entry->key != NULL) {
|
||||
gDictionaryFreeProc(entry->key);
|
||||
}
|
||||
|
||||
if (entry->value != nullptr) {
|
||||
if (entry->value != NULL) {
|
||||
gDictionaryFreeProc(entry->value);
|
||||
}
|
||||
}
|
||||
|
||||
if (dictionary->entries != nullptr) {
|
||||
if (dictionary->entries != NULL) {
|
||||
gDictionaryFreeProc(dictionary->entries);
|
||||
}
|
||||
|
||||
|
@ -414,21 +414,21 @@ int dictionaryLoad(FILE* stream, Dictionary* dictionary, int a3)
|
|||
return -1;
|
||||
}
|
||||
|
||||
dictionary->entries = nullptr;
|
||||
dictionary->entries = NULL;
|
||||
|
||||
if (dictionary->entriesCapacity <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
dictionary->entries = (DictionaryEntry*)gDictionaryMallocProc(sizeof(*dictionary->entries) * dictionary->entriesCapacity);
|
||||
if (dictionary->entries == nullptr) {
|
||||
if (dictionary->entries == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int index = 0; index < dictionary->entriesLength; index++) {
|
||||
DictionaryEntry* entry = &(dictionary->entries[index]);
|
||||
entry->key = nullptr;
|
||||
entry->value = nullptr;
|
||||
entry->key = NULL;
|
||||
entry->value = NULL;
|
||||
}
|
||||
|
||||
if (dictionary->entriesLength <= 0) {
|
||||
|
@ -443,21 +443,21 @@ int dictionaryLoad(FILE* stream, Dictionary* dictionary, int a3)
|
|||
}
|
||||
|
||||
entry->key = (char*)gDictionaryMallocProc(keyLength + 1);
|
||||
if (entry->key == nullptr) {
|
||||
if (entry->key == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (compat_fgets(entry->key, keyLength + 1, stream) == nullptr) {
|
||||
if (compat_fgets(entry->key, keyLength + 1, stream) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dictionary->valueSize != 0) {
|
||||
entry->value = gDictionaryMallocProc(dictionary->valueSize);
|
||||
if (entry->value == nullptr) {
|
||||
if (entry->value == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (dictionary->io.readProc != nullptr) {
|
||||
if (dictionary->io.readProc != NULL) {
|
||||
if (dictionary->io.readProc(stream, entry->value, dictionary->valueSize, a3) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ int dictionaryWrite(FILE* stream, Dictionary* dictionary, int a3)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (dictionary->io.writeProc != nullptr) {
|
||||
if (dictionary->io.writeProc != NULL) {
|
||||
if (dictionary->valueSize != 0) {
|
||||
if (dictionary->io.writeProc(stream, entry->value, dictionary->valueSize, a3) != 0) {
|
||||
return -1;
|
||||
|
@ -544,7 +544,7 @@ int dictionaryWrite(FILE* stream, Dictionary* dictionary, int a3)
|
|||
// 0x4DA498
|
||||
void dictionarySetMemoryProcs(MallocProc* mallocProc, ReallocProc* reallocProc, FreeProc* freeProc)
|
||||
{
|
||||
if (mallocProc != nullptr && reallocProc != nullptr && freeProc != nullptr) {
|
||||
if (mallocProc != NULL && reallocProc != NULL && freeProc != NULL) {
|
||||
gDictionaryMallocProc = mallocProc;
|
||||
gDictionaryReallocProc = reallocProc;
|
||||
gDictionaryFreeProc = freeProc;
|
||||
|
|
|
@ -118,7 +118,7 @@ int displayMonitorInit()
|
|||
fontSetCurrent(oldFont);
|
||||
|
||||
gDisplayMonitorBackgroundFrmData = (unsigned char*)internal_malloc(DISPLAY_MONITOR_WIDTH * DISPLAY_MONITOR_HEIGHT);
|
||||
if (gDisplayMonitorBackgroundFrmData == nullptr) {
|
||||
if (gDisplayMonitorBackgroundFrmData == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -158,16 +158,16 @@ int displayMonitorInit()
|
|||
-1,
|
||||
-1,
|
||||
-1,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0);
|
||||
if (gDisplayMonitorScrollUpButton != -1) {
|
||||
buttonSetMouseCallbacks(gDisplayMonitorScrollUpButton,
|
||||
displayMonitorScrollUpOnMouseEnter,
|
||||
displayMonitorOnMouseExit,
|
||||
displayMonitorScrollUpOnMouseDown,
|
||||
nullptr);
|
||||
NULL);
|
||||
}
|
||||
|
||||
gDisplayMonitorScrollDownButton = buttonCreate(gInterfaceBarWindow,
|
||||
|
@ -179,16 +179,16 @@ int displayMonitorInit()
|
|||
-1,
|
||||
-1,
|
||||
-1,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0);
|
||||
if (gDisplayMonitorScrollDownButton != -1) {
|
||||
buttonSetMouseCallbacks(gDisplayMonitorScrollDownButton,
|
||||
displayMonitorScrollDownOnMouseEnter,
|
||||
displayMonitorOnMouseExit,
|
||||
displayMonitorScrollDownOnMouseDown,
|
||||
nullptr);
|
||||
NULL);
|
||||
}
|
||||
|
||||
gDisplayMonitorEnabled = true;
|
||||
|
@ -257,7 +257,7 @@ void displayMonitorAddMessage(char* str)
|
|||
}
|
||||
|
||||
// TODO: Refactor these two loops.
|
||||
char* v1 = nullptr;
|
||||
char* v1 = NULL;
|
||||
while (true) {
|
||||
while (fontGetStringWidth(str) < DISPLAY_MONITOR_WIDTH - _max_disp - knobWidth) {
|
||||
char* temp = gDisplayMonitorLines[_disp_start];
|
||||
|
@ -274,7 +274,7 @@ void displayMonitorAddMessage(char* str)
|
|||
gDisplayMonitorLines[_disp_start][DISPLAY_MONITOR_LINE_LENGTH - 1] = '\0';
|
||||
_disp_start = (_disp_start + 1) % gDisplayMonitorLinesCapacity;
|
||||
|
||||
if (v1 == nullptr) {
|
||||
if (v1 == NULL) {
|
||||
fontSetCurrent(oldFont);
|
||||
_disp_curr = _disp_start;
|
||||
displayMonitorRefresh();
|
||||
|
@ -283,20 +283,20 @@ void displayMonitorAddMessage(char* str)
|
|||
|
||||
str = v1 + 1;
|
||||
*v1 = ' ';
|
||||
v1 = nullptr;
|
||||
v1 = NULL;
|
||||
}
|
||||
|
||||
char* space = strrchr(str, ' ');
|
||||
if (space == nullptr) {
|
||||
if (space == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (v1 != nullptr) {
|
||||
if (v1 != NULL) {
|
||||
*v1 = ' ';
|
||||
}
|
||||
|
||||
v1 = space;
|
||||
if (space != nullptr) {
|
||||
if (space != NULL) {
|
||||
*space = '\0';
|
||||
}
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ static void displayMonitorRefresh()
|
|||
}
|
||||
|
||||
unsigned char* buf = windowGetBuffer(gInterfaceBarWindow);
|
||||
if (buf == nullptr) {
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -438,11 +438,11 @@ static void consoleFileInit()
|
|||
{
|
||||
char* consoleFilePath;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CONSOLE_OUTPUT_FILE_KEY, &consoleFilePath);
|
||||
if (consoleFilePath != nullptr && *consoleFilePath == '\0') {
|
||||
consoleFilePath = nullptr;
|
||||
if (consoleFilePath != NULL && *consoleFilePath == '\0') {
|
||||
consoleFilePath = NULL;
|
||||
}
|
||||
|
||||
if (consoleFilePath != nullptr) {
|
||||
if (consoleFilePath != NULL) {
|
||||
gConsoleFileStream.open(consoleFilePath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ void bufferDrawLine(unsigned char* buf, int pitch, int x1, int y1, int x2, int y
|
|||
|
||||
p1 = buf + pitch * y1 + x1;
|
||||
p2 = buf + pitch * y2 + x2;
|
||||
while (p1 <= p2) {
|
||||
while (p1 < p2) {
|
||||
*p1 = color;
|
||||
*p2 = color;
|
||||
p1 += pitch;
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "art.h"
|
||||
#include "cycle.h"
|
||||
#include "debug.h"
|
||||
#include "delay.h"
|
||||
#include "draw.h"
|
||||
#include "game_mouse.h"
|
||||
#include "game_sound.h"
|
||||
|
@ -454,7 +453,8 @@ int elevatorSelectLevel(int elevator, int* mapPtr, int* elevationPtr, int* tileP
|
|||
|
||||
windowRefresh(gElevatorWindow);
|
||||
|
||||
delay_ms(delay - (getTicks() - tick));
|
||||
while (getTicksSince(tick) < delay) {
|
||||
}
|
||||
|
||||
renderPresent();
|
||||
sharedFpsLimiter.throttle();
|
||||
|
@ -593,10 +593,10 @@ static int elevatorWindowInit(int elevator)
|
|||
500 + level,
|
||||
_elevatorFrmImages[ELEVATOR_FRM_BUTTON_UP].getData(),
|
||||
_elevatorFrmImages[ELEVATOR_FRM_BUTTON_DOWN].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (btn != -1) {
|
||||
buttonSetCallbacks(btn, _gsound_red_butt_press, nullptr);
|
||||
buttonSetCallbacks(btn, _gsound_red_butt_press, NULL);
|
||||
}
|
||||
y += 60;
|
||||
}
|
||||
|
@ -650,11 +650,11 @@ void elevatorsInit()
|
|||
{
|
||||
char* elevatorsFileName;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_ELEVATORS_FILE_KEY, &elevatorsFileName);
|
||||
if (elevatorsFileName != nullptr && *elevatorsFileName == '\0') {
|
||||
elevatorsFileName = nullptr;
|
||||
if (elevatorsFileName != NULL && *elevatorsFileName == '\0') {
|
||||
elevatorsFileName = NULL;
|
||||
}
|
||||
|
||||
if (elevatorsFileName != nullptr) {
|
||||
if (elevatorsFileName != NULL) {
|
||||
Config elevatorsConfig;
|
||||
if (configInit(&elevatorsConfig)) {
|
||||
if (configRead(&elevatorsConfig, elevatorsFileName, false)) {
|
||||
|
|
104
src/endgame.cc
104
src/endgame.cc
|
@ -112,7 +112,7 @@ static int _endgame_maybe_done = 0;
|
|||
// enddeath.txt
|
||||
//
|
||||
// 0x518678
|
||||
static EndgameDeathEnding* gEndgameDeathEndings = nullptr;
|
||||
static EndgameDeathEnding* gEndgameDeathEndings = NULL;
|
||||
|
||||
// The number of death endings in [gEndgameDeathEndings] array.
|
||||
//
|
||||
|
@ -248,7 +248,7 @@ void endgamePlayMovie()
|
|||
|
||||
creditsOpen("credits.txt", -1, false);
|
||||
backgroundSoundDelete();
|
||||
backgroundSoundSetEndCallback(nullptr);
|
||||
backgroundSoundSetEndCallback(NULL);
|
||||
tickersRemove(_endgame_movie_bk_process);
|
||||
backgroundSoundDelete();
|
||||
colorPaletteLoad("color.pal");
|
||||
|
@ -286,7 +286,7 @@ static int endgameEndingHandleContinuePlaying()
|
|||
MessageListItem messageListItem;
|
||||
messageListItem.num = 30;
|
||||
if (messageListGetItem(&gMiscMessageList, &messageListItem)) {
|
||||
rc = showDialogBox(messageListItem.text, nullptr, 0, 169, 117, _colorTable[32328], nullptr, _colorTable[32328], DIALOG_BOX_YES_NO);
|
||||
rc = showDialogBox(messageListItem.text, NULL, 0, 169, 117, _colorTable[32328], NULL, _colorTable[32328], DIALOG_BOX_YES_NO);
|
||||
if (rc == 0) {
|
||||
_game_user_wants_to_quit = 2;
|
||||
}
|
||||
|
@ -317,7 +317,7 @@ static void endgameEndingRenderPanningScene(int direction, const char* narratorF
|
|||
|
||||
CacheEntry* backgroundHandle;
|
||||
Art* background = artLock(fid, &backgroundHandle);
|
||||
if (background != nullptr) {
|
||||
if (background != NULL) {
|
||||
int width = artGetWidth(background, 0, 0);
|
||||
int height = artGetHeight(background, 0, 0);
|
||||
unsigned char* backgroundData = artGetFrameData(background, 0, 0);
|
||||
|
@ -449,12 +449,12 @@ static void endgameEndingRenderStaticScene(int fid, const char* narratorFileName
|
|||
{
|
||||
CacheEntry* backgroundHandle;
|
||||
Art* background = artLock(fid, &backgroundHandle);
|
||||
if (background == nullptr) {
|
||||
if (background == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char* backgroundData = artGetFrameData(background, 0, 0);
|
||||
if (backgroundData != nullptr) {
|
||||
if (backgroundData != NULL) {
|
||||
blitBufferToBuffer(backgroundData, ENDGAME_ENDING_WINDOW_WIDTH, ENDGAME_ENDING_WINDOW_HEIGHT, ENDGAME_ENDING_WINDOW_WIDTH, gEndgameEndingSlideshowWindowBuffer, ENDGAME_ENDING_WINDOW_WIDTH);
|
||||
windowRefresh(gEndgameEndingSlideshowWindow);
|
||||
|
||||
|
@ -584,7 +584,7 @@ static int endgameEndingSlideshowWindowInit()
|
|||
}
|
||||
|
||||
gEndgameEndingSlideshowWindowBuffer = windowGetBuffer(gEndgameEndingSlideshowWindow);
|
||||
if (gEndgameEndingSlideshowWindowBuffer == nullptr) {
|
||||
if (gEndgameEndingSlideshowWindowBuffer == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -600,17 +600,17 @@ static int endgameEndingSlideshowWindowInit()
|
|||
snprintf(gEndgameEndingSubtitlesLocalizedPath, sizeof(gEndgameEndingSubtitlesLocalizedPath), "text\\%s\\cuts\\", settings.system.language.c_str());
|
||||
|
||||
gEndgameEndingSubtitles = (char**)internal_malloc(sizeof(*gEndgameEndingSubtitles) * ENDGAME_ENDING_MAX_SUBTITLES);
|
||||
if (gEndgameEndingSubtitles == nullptr) {
|
||||
if (gEndgameEndingSubtitles == NULL) {
|
||||
gEndgameEndingSubtitlesEnabled = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (int index = 0; index < ENDGAME_ENDING_MAX_SUBTITLES; index++) {
|
||||
gEndgameEndingSubtitles[index] = nullptr;
|
||||
gEndgameEndingSubtitles[index] = NULL;
|
||||
}
|
||||
|
||||
gEndgameEndingSubtitlesTimings = (unsigned int*)internal_malloc(sizeof(*gEndgameEndingSubtitlesTimings) * ENDGAME_ENDING_MAX_SUBTITLES);
|
||||
if (gEndgameEndingSubtitlesTimings == nullptr) {
|
||||
if (gEndgameEndingSubtitlesTimings == NULL) {
|
||||
internal_free(gEndgameEndingSubtitles);
|
||||
gEndgameEndingSubtitlesEnabled = false;
|
||||
return 0;
|
||||
|
@ -628,7 +628,7 @@ static void endgameEndingSlideshowWindowFree()
|
|||
internal_free(gEndgameEndingSubtitlesTimings);
|
||||
internal_free(gEndgameEndingSubtitles);
|
||||
|
||||
gEndgameEndingSubtitles = nullptr;
|
||||
gEndgameEndingSubtitles = NULL;
|
||||
gEndgameEndingSubtitlesEnabled = false;
|
||||
}
|
||||
|
||||
|
@ -637,7 +637,7 @@ static void endgameEndingSlideshowWindowFree()
|
|||
|
||||
fontSetCurrent(gEndgameEndingSlideshowOldFont);
|
||||
|
||||
speechSetEndCallback(nullptr);
|
||||
speechSetEndCallback(NULL);
|
||||
windowDestroy(gEndgameEndingSlideshowWindow);
|
||||
windowDestroy(gEndgameEndingOverlay);
|
||||
|
||||
|
@ -741,7 +741,7 @@ static void endgameEndingLoadPalette(int type, int id)
|
|||
|
||||
// Remove extension from file name.
|
||||
char* pch = strrchr(fileName, '.');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ static int endgameEndingSubtitlesLoad(const char* filePath)
|
|||
endgameEndingSubtitlesFree();
|
||||
|
||||
File* stream = fileOpen(filePath, "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -778,14 +778,14 @@ static int endgameEndingSubtitlesLoad(const char* filePath)
|
|||
|
||||
// Find and clamp string at EOL.
|
||||
pch = strchr(string, '\n');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
// Find separator. The value before separator is ignored (as opposed to
|
||||
// movie subtitles, where the value before separator is a timing).
|
||||
pch = strchr(string, ':');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
if (gEndgameEndingSubtitlesLength < ENDGAME_ENDING_MAX_SUBTITLES) {
|
||||
gEndgameEndingSubtitles[gEndgameEndingSubtitlesLength] = internal_strdup(pch + 1);
|
||||
gEndgameEndingSubtitlesLength++;
|
||||
|
@ -817,7 +817,7 @@ static void endgameEndingRefreshSubtitles()
|
|||
}
|
||||
|
||||
char* text = gEndgameEndingSubtitles[gEndgameEndingSubtitlesCurrentLine];
|
||||
if (text == nullptr) {
|
||||
if (text == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -856,9 +856,9 @@ static void endgameEndingRefreshSubtitles()
|
|||
static void endgameEndingSubtitlesFree()
|
||||
{
|
||||
for (int index = 0; index < gEndgameEndingSubtitlesLength; index++) {
|
||||
if (gEndgameEndingSubtitles[index] != nullptr) {
|
||||
if (gEndgameEndingSubtitles[index] != NULL) {
|
||||
internal_free(gEndgameEndingSubtitles[index]);
|
||||
gEndgameEndingSubtitles[index] = nullptr;
|
||||
gEndgameEndingSubtitles[index] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -878,7 +878,7 @@ static void _endgame_movie_bk_process()
|
|||
{
|
||||
if (_endgame_maybe_done) {
|
||||
backgroundSoundLoad("10labone", 11, 14, 16);
|
||||
backgroundSoundSetEndCallback(nullptr);
|
||||
backgroundSoundSetEndCallback(NULL);
|
||||
tickersRemove(_endgame_movie_bk_process);
|
||||
}
|
||||
}
|
||||
|
@ -894,15 +894,15 @@ static int endgameEndingInit()
|
|||
EndgameEnding* entries;
|
||||
size_t narratorFileNameLength;
|
||||
|
||||
if (gEndgameEndings != nullptr) {
|
||||
if (gEndgameEndings != NULL) {
|
||||
internal_free(gEndgameEndings);
|
||||
gEndgameEndings = nullptr;
|
||||
gEndgameEndings = NULL;
|
||||
}
|
||||
|
||||
gEndgameEndingsLength = 0;
|
||||
|
||||
stream = fileOpen("data\\endgame.txt", "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -917,28 +917,28 @@ static int endgameEndingInit()
|
|||
}
|
||||
|
||||
tok = strtok(ch, delim);
|
||||
if (tok == nullptr) {
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.gvar = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.value = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.art_num = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -949,15 +949,15 @@ static int endgameEndingInit()
|
|||
entry.voiceOverBaseName[narratorFileNameLength - 1] = '\0';
|
||||
}
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok != nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok != NULL) {
|
||||
entry.direction = atoi(tok);
|
||||
} else {
|
||||
entry.direction = 1;
|
||||
}
|
||||
|
||||
entries = (EndgameEnding*)internal_realloc(gEndgameEndings, sizeof(*entries) * (gEndgameEndingsLength + 1));
|
||||
if (entries == nullptr) {
|
||||
if (entries == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -983,9 +983,9 @@ err:
|
|||
// 0x44095C
|
||||
static void endgameEndingFree()
|
||||
{
|
||||
if (gEndgameEndings != nullptr) {
|
||||
if (gEndgameEndings != NULL) {
|
||||
internal_free(gEndgameEndings);
|
||||
gEndgameEndings = nullptr;
|
||||
gEndgameEndings = NULL;
|
||||
}
|
||||
|
||||
gEndgameEndingsLength = 0;
|
||||
|
@ -1007,7 +1007,7 @@ int endgameDeathEndingInit()
|
|||
strcpy(gEndgameDeathEndingFileName, "narrator\\nar_5");
|
||||
|
||||
stream = fileOpen("data\\enddeath.txt", "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1022,49 +1022,49 @@ int endgameDeathEndingInit()
|
|||
}
|
||||
|
||||
tok = strtok(ch, delim);
|
||||
if (tok == nullptr) {
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.gvar = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.value = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.worldAreaKnown = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.worldAreaNotKnown = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.min_level = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
entry.percentage = atoi(tok);
|
||||
|
||||
tok = strtok(nullptr, delim);
|
||||
if (tok == nullptr) {
|
||||
tok = strtok(NULL, delim);
|
||||
if (tok == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1079,7 +1079,7 @@ int endgameDeathEndingInit()
|
|||
}
|
||||
|
||||
entries = (EndgameDeathEnding*)internal_realloc(gEndgameDeathEndings, sizeof(*entries) * (gEndgameDeathEndingsLength + 1));
|
||||
if (entries == nullptr) {
|
||||
if (entries == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -1103,9 +1103,9 @@ err:
|
|||
// 0x440BA8
|
||||
int endgameDeathEndingExit()
|
||||
{
|
||||
if (gEndgameDeathEndings != nullptr) {
|
||||
if (gEndgameDeathEndings != NULL) {
|
||||
internal_free(gEndgameDeathEndings);
|
||||
gEndgameDeathEndings = nullptr;
|
||||
gEndgameDeathEndings = NULL;
|
||||
|
||||
gEndgameDeathEndingsLength = 0;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ ExternalProcedure* externalProcedureFind(const char* identifier)
|
|||
unsigned int v2 = v1;
|
||||
|
||||
ExternalProcedure* externalProcedure = &(gExternalProcedures[v1]);
|
||||
if (externalProcedure->program != nullptr) {
|
||||
if (externalProcedure->program != NULL) {
|
||||
if (compat_stricmp(externalProcedure->name, identifier) == 0) {
|
||||
return externalProcedure;
|
||||
}
|
||||
|
@ -74,14 +74,14 @@ ExternalProcedure* externalProcedureFind(const char* identifier)
|
|||
}
|
||||
|
||||
externalProcedure = &(gExternalProcedures[v1]);
|
||||
if (externalProcedure->program != nullptr) {
|
||||
if (externalProcedure->program != NULL) {
|
||||
if (compat_stricmp(externalProcedure->name, identifier) == 0) {
|
||||
return externalProcedure;
|
||||
}
|
||||
}
|
||||
} while (v1 != v2);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x441018
|
||||
|
@ -108,7 +108,7 @@ ExternalProcedure* externalProcedureAdd(const char* identifier)
|
|||
}
|
||||
} while (v1 != a2);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x4410AC
|
||||
|
@ -140,7 +140,7 @@ ExternalVariable* externalVariableFind(const char* identifier)
|
|||
}
|
||||
} while (v1 != v2);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x44118C
|
||||
|
@ -167,14 +167,14 @@ ExternalVariable* externalVariableAdd(const char* identifier)
|
|||
}
|
||||
} while (v1 != v2);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x44127C
|
||||
int externalVariableSetValue(Program* program, const char* name, ProgramValue& programValue)
|
||||
{
|
||||
ExternalVariable* exportedVariable = externalVariableFind(name);
|
||||
if (exportedVariable == nullptr) {
|
||||
if (exportedVariable == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ int externalVariableSetValue(Program* program, const char* name, ProgramValue& p
|
|||
}
|
||||
|
||||
if ((programValue.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
if (program != nullptr) {
|
||||
if (program != NULL) {
|
||||
const char* stringValue = programGetString(program, programValue.opcode, programValue.integerValue);
|
||||
exportedVariable->value.opcode = VALUE_TYPE_DYNAMIC_STRING;
|
||||
|
||||
|
@ -201,7 +201,7 @@ int externalVariableSetValue(Program* program, const char* name, ProgramValue& p
|
|||
int externalVariableGetValue(Program* program, const char* name, ProgramValue& value)
|
||||
{
|
||||
ExternalVariable* exportedVariable = externalVariableFind(name);
|
||||
if (exportedVariable == nullptr) {
|
||||
if (exportedVariable == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ int externalVariableCreate(Program* program, const char* identifier)
|
|||
const char* programName = program->name;
|
||||
ExternalVariable* exportedVariable = externalVariableFind(identifier);
|
||||
|
||||
if (exportedVariable != nullptr) {
|
||||
if (exportedVariable != NULL) {
|
||||
if (compat_stricmp(exportedVariable->programName, programName) != 0) {
|
||||
return 1;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ int externalVariableCreate(Program* program, const char* identifier)
|
|||
}
|
||||
} else {
|
||||
exportedVariable = externalVariableAdd(identifier);
|
||||
if (exportedVariable == nullptr) {
|
||||
if (exportedVariable == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@ void _removeProgramReferences(Program* program)
|
|||
ExternalProcedure* externalProcedure = &(gExternalProcedures[index]);
|
||||
if (externalProcedure->program == program) {
|
||||
externalProcedure->name[0] = '\0';
|
||||
externalProcedure->program = nullptr;
|
||||
externalProcedure->program = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,12 +285,12 @@ void externalVariablesClear()
|
|||
Program* externalProcedureGetProgram(const char* identifier, int* addressPtr, int* argumentCountPtr)
|
||||
{
|
||||
ExternalProcedure* externalProcedure = externalProcedureFind(identifier);
|
||||
if (externalProcedure == nullptr) {
|
||||
return nullptr;
|
||||
if (externalProcedure == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (externalProcedure->program == nullptr) {
|
||||
return nullptr;
|
||||
if (externalProcedure->program == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*addressPtr = externalProcedure->address;
|
||||
|
@ -303,13 +303,13 @@ Program* externalProcedureGetProgram(const char* identifier, int* addressPtr, in
|
|||
int externalProcedureCreate(Program* program, const char* identifier, int address, int argumentCount)
|
||||
{
|
||||
ExternalProcedure* externalProcedure = externalProcedureFind(identifier);
|
||||
if (externalProcedure != nullptr) {
|
||||
if (externalProcedure != NULL) {
|
||||
if (program != externalProcedure->program) {
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
externalProcedure = externalProcedureAdd(identifier);
|
||||
if (externalProcedure == nullptr) {
|
||||
if (externalProcedure == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -330,14 +330,14 @@ void _exportClearAllVariables()
|
|||
ExternalVariable* exportedVariable = &(gExternalVariables[index]);
|
||||
if (exportedVariable->name[0] != '\0') {
|
||||
if ((exportedVariable->value.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
if (exportedVariable->stringValue != nullptr) {
|
||||
if (exportedVariable->stringValue != NULL) {
|
||||
internal_free_safe(exportedVariable->stringValue, __FILE__, __LINE__); // "..\\int\\EXPORT.C", 387
|
||||
}
|
||||
}
|
||||
|
||||
if (exportedVariable->programName != nullptr) {
|
||||
if (exportedVariable->programName != NULL) {
|
||||
internal_free_safe(exportedVariable->programName, __FILE__, __LINE__); // "..\\int\\EXPORT.C", 393
|
||||
exportedVariable->programName = nullptr;
|
||||
exportedVariable->programName = NULL;
|
||||
}
|
||||
|
||||
exportedVariable->name[0] = '\0';
|
||||
|
|
|
@ -16,40 +16,33 @@ bool fileFindFirst(const char* path, DirectoryFileFindData* findData)
|
|||
return false;
|
||||
}
|
||||
#else
|
||||
strcpy(findData->path, path);
|
||||
|
||||
char drive[COMPAT_MAX_DRIVE];
|
||||
char dir[COMPAT_MAX_DIR];
|
||||
char fname[COMPAT_MAX_FNAME];
|
||||
char ext[COMPAT_MAX_EXT];
|
||||
compat_splitpath(path, drive, dir, fname, ext);
|
||||
|
||||
// Reassemble file name and extension to serve as a pattern. It has to be
|
||||
// lowercased because underlying `fpattern` implementation uses lowercased
|
||||
// char-by-char matching.
|
||||
compat_makepath(findData->pattern, nullptr, nullptr, fname, ext);
|
||||
compat_strlwr(findData->pattern);
|
||||
compat_splitpath(path, drive, dir, NULL, NULL);
|
||||
|
||||
char basePath[COMPAT_MAX_PATH];
|
||||
compat_makepath(basePath, drive, dir, nullptr, nullptr);
|
||||
compat_makepath(basePath, drive, dir, NULL, NULL);
|
||||
|
||||
findData->dir = opendir(basePath);
|
||||
if (findData->dir == nullptr) {
|
||||
if (findData->dir == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
findData->entry = readdir(findData->dir);
|
||||
while (findData->entry != nullptr) {
|
||||
char entryName[COMPAT_MAX_FNAME];
|
||||
strcpy(entryName, fileFindGetName(findData));
|
||||
compat_strlwr(entryName);
|
||||
if (fpattern_match(findData->pattern, entryName)) {
|
||||
while (findData->entry != NULL) {
|
||||
char entryPath[COMPAT_MAX_PATH];
|
||||
compat_makepath(entryPath, drive, dir, fileFindGetName(findData), NULL);
|
||||
if (fpattern_match(findData->path, entryPath)) {
|
||||
break;
|
||||
}
|
||||
findData->entry = readdir(findData->dir);
|
||||
}
|
||||
|
||||
if (findData->entry == nullptr) {
|
||||
if (findData->entry == NULL) {
|
||||
closedir(findData->dir);
|
||||
findData->dir = nullptr;
|
||||
findData->dir = NULL;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -65,20 +58,23 @@ bool fileFindNext(DirectoryFileFindData* findData)
|
|||
return false;
|
||||
}
|
||||
#else
|
||||
char drive[COMPAT_MAX_DRIVE];
|
||||
char dir[COMPAT_MAX_DIR];
|
||||
compat_splitpath(findData->path, drive, dir, NULL, NULL);
|
||||
|
||||
findData->entry = readdir(findData->dir);
|
||||
while (findData->entry != nullptr) {
|
||||
char entryName[COMPAT_MAX_FNAME];
|
||||
strcpy(entryName, fileFindGetName(findData));
|
||||
compat_strlwr(entryName);
|
||||
if (fpattern_match(findData->pattern, entryName)) {
|
||||
while (findData->entry != NULL) {
|
||||
char entryPath[COMPAT_MAX_PATH];
|
||||
compat_makepath(entryPath, drive, dir, fileFindGetName(findData), NULL);
|
||||
if (fpattern_match(findData->path, entryPath)) {
|
||||
break;
|
||||
}
|
||||
findData->entry = readdir(findData->dir);
|
||||
}
|
||||
|
||||
if (findData->entry == nullptr) {
|
||||
if (findData->entry == NULL) {
|
||||
closedir(findData->dir);
|
||||
findData->dir = nullptr;
|
||||
findData->dir = NULL;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -92,7 +88,7 @@ bool findFindClose(DirectoryFileFindData* findData)
|
|||
#if defined(_MSC_VER)
|
||||
FindClose(findData->hFind);
|
||||
#else
|
||||
if (findData->dir != nullptr) {
|
||||
if (findData->dir != NULL) {
|
||||
if (closedir(findData->dir) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ typedef struct DirectoryFileFindData {
|
|||
#else
|
||||
DIR* dir;
|
||||
struct dirent* entry;
|
||||
char pattern[COMPAT_MAX_FNAME];
|
||||
char path[COMPAT_MAX_PATH];
|
||||
#endif
|
||||
} DirectoryFileFindData;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ static void fileCopy(const char* existingFilePath, const char* newFilePath);
|
|||
int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
|
||||
{
|
||||
FILE* stream = compat_fopen(existingFilePath, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
|
|||
gzFile inStream = compat_gzopen(existingFilePath, "rb");
|
||||
FILE* outStream = compat_fopen(newFilePath, "wb");
|
||||
|
||||
if (inStream != nullptr && outStream != nullptr) {
|
||||
if (inStream != NULL && outStream != NULL) {
|
||||
for (;;) {
|
||||
int ch = gzgetc(inStream);
|
||||
if (ch == -1) {
|
||||
|
@ -45,11 +45,11 @@ int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
|
|||
gzclose(inStream);
|
||||
fclose(outStream);
|
||||
} else {
|
||||
if (inStream != nullptr) {
|
||||
if (inStream != NULL) {
|
||||
gzclose(inStream);
|
||||
}
|
||||
|
||||
if (outStream != nullptr) {
|
||||
if (outStream != NULL) {
|
||||
fclose(outStream);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ int fileCopyDecompressed(const char* existingFilePath, const char* newFilePath)
|
|||
int fileCopyCompressed(const char* existingFilePath, const char* newFilePath)
|
||||
{
|
||||
FILE* inStream = compat_fopen(existingFilePath, "rb");
|
||||
if (inStream == nullptr) {
|
||||
if (inStream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ int fileCopyCompressed(const char* existingFilePath, const char* newFilePath)
|
|||
fileCopy(existingFilePath, newFilePath);
|
||||
} else {
|
||||
gzFile outStream = compat_gzopen(newFilePath, "wb");
|
||||
if (outStream == nullptr) {
|
||||
if (outStream == NULL) {
|
||||
fclose(inStream);
|
||||
return -1;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ int fileCopyCompressed(const char* existingFilePath, const char* newFilePath)
|
|||
int _gzdecompress_file(const char* existingFilePath, const char* newFilePath)
|
||||
{
|
||||
FILE* stream = compat_fopen(existingFilePath, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -120,12 +120,12 @@ int _gzdecompress_file(const char* existingFilePath, const char* newFilePath)
|
|||
// TODO: Is it broken?
|
||||
if (magic[0] != 0x1F || magic[1] != 0x8B) {
|
||||
gzFile gzstream = compat_gzopen(existingFilePath, "rb");
|
||||
if (gzstream == nullptr) {
|
||||
if (gzstream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
stream = compat_fopen(newFilePath, "wb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
gzclose(gzstream);
|
||||
return -1;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ static void fileCopy(const char* existingFilePath, const char* newFilePath)
|
|||
{
|
||||
FILE* in = compat_fopen(existingFilePath, "rb");
|
||||
FILE* out = compat_fopen(newFilePath, "wb");
|
||||
if (in != nullptr && out != nullptr) {
|
||||
if (in != NULL && out != NULL) {
|
||||
std::vector<unsigned char> buffer(0xFFFF);
|
||||
|
||||
size_t bytesRead;
|
||||
|
@ -171,11 +171,11 @@ static void fileCopy(const char* existingFilePath, const char* newFilePath)
|
|||
}
|
||||
}
|
||||
|
||||
if (in != nullptr) {
|
||||
if (in != NULL) {
|
||||
fclose(in);
|
||||
}
|
||||
|
||||
if (out != nullptr) {
|
||||
if (out != NULL) {
|
||||
fclose(out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ int interfaceFontsInit()
|
|||
for (int font = 0; font < INTERFACE_FONT_MAX; font++) {
|
||||
if (interfaceFontLoad(font) == -1) {
|
||||
gInterfaceFontDescriptors[font].maxHeight = 0;
|
||||
gInterfaceFontDescriptors[font].data = nullptr;
|
||||
gInterfaceFontDescriptors[font].data = NULL;
|
||||
} else {
|
||||
++gInterfaceFontsLength;
|
||||
|
||||
|
@ -107,7 +107,7 @@ int interfaceFontsInit()
|
|||
void interfaceFontsExit()
|
||||
{
|
||||
for (int font = 0; font < INTERFACE_FONT_MAX; font++) {
|
||||
if (gInterfaceFontDescriptors[font].data != nullptr) {
|
||||
if (gInterfaceFontDescriptors[font].data != NULL) {
|
||||
internal_free_safe(gInterfaceFontDescriptors[font].data, __FILE__, __LINE__); // FONTMGR.C, 124
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ static int interfaceFontLoad(int font_index)
|
|||
snprintf(path, sizeof(path), "font%d.aaf", font_index);
|
||||
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ static int interfaceFontLoad(int font_index)
|
|||
int glyphDataSize = fileSize - 2060;
|
||||
|
||||
fontDescriptor->data = (unsigned char*)internal_malloc_safe(glyphDataSize, __FILE__, __LINE__); // FONTMGR.C, 259
|
||||
if (fontDescriptor->data == nullptr) {
|
||||
if (fontDescriptor->data == NULL) {
|
||||
fileClose(stream);
|
||||
return -1;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ static void interfaceFontSetCurrentImpl(int font)
|
|||
|
||||
font -= 100;
|
||||
|
||||
if (gInterfaceFontDescriptors[font].data != nullptr) {
|
||||
if (gInterfaceFontDescriptors[font].data != NULL) {
|
||||
gCurrentInterfaceFont = font;
|
||||
gCurrentInterfaceFontDescriptor = &(gInterfaceFontDescriptors[font]);
|
||||
}
|
||||
|
|
82
src/game.cc
82
src/game.cc
|
@ -65,7 +65,6 @@
|
|||
#include "trait.h"
|
||||
#include "version.h"
|
||||
#include "window_manager.h"
|
||||
#include "window_manager_private.h"
|
||||
#include "worldmap.h"
|
||||
|
||||
namespace fallout {
|
||||
|
@ -100,7 +99,7 @@ static int gGameState = GAME_STATE_0;
|
|||
static bool gIsMapper = false;
|
||||
|
||||
// 0x5186C0
|
||||
int* gGameGlobalVars = nullptr;
|
||||
int* gGameGlobalVars = NULL;
|
||||
|
||||
// 0x5186C4
|
||||
int gGameGlobalVarsLength = 0;
|
||||
|
@ -169,26 +168,12 @@ int gameInitWithOptions(const char* windowTitle, bool isMapper, int font, int a4
|
|||
showSplash();
|
||||
}
|
||||
|
||||
// CE: Handle debug mode (exactly as seen in `mapper2.exe`).
|
||||
const char* debugMode = settings.debug.mode.c_str();
|
||||
if (compat_stricmp(debugMode, "environment") == 0) {
|
||||
_debug_register_env();
|
||||
} else if (compat_stricmp(debugMode, "screen") == 0) {
|
||||
_debug_register_screen();
|
||||
} else if (compat_stricmp(debugMode, "log") == 0) {
|
||||
_debug_register_log("debug.log", "wt");
|
||||
} else if (compat_stricmp(debugMode, "mono") == 0) {
|
||||
_debug_register_mono();
|
||||
} else if (compat_stricmp(debugMode, "gnw") == 0) {
|
||||
_debug_register_func(_win_debug);
|
||||
}
|
||||
|
||||
interfaceFontsInit();
|
||||
fontManagerAdd(&gModernFontManager);
|
||||
fontSetCurrent(font);
|
||||
|
||||
screenshotHandlerConfigure(KEY_F12, gameTakeScreenshot);
|
||||
pauseHandlerConfigure(-1, nullptr);
|
||||
pauseHandlerConfigure(-1, NULL);
|
||||
|
||||
tileDisable();
|
||||
|
||||
|
@ -599,7 +584,7 @@ int gameHandleKey(int eventCode, bool isInCombatMode)
|
|||
case KEY_LOWERCASE_A:
|
||||
if (interfaceBarEnabled()) {
|
||||
if (!isInCombatMode) {
|
||||
_combat(nullptr);
|
||||
_combat(NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -661,7 +646,7 @@ int gameHandleKey(int eventCode, bool isInCombatMode)
|
|||
MessageListItem messageListItem;
|
||||
char title[128];
|
||||
strcpy(title, getmsg(&gMiscMessageList, &messageListItem, 7));
|
||||
showDialogBox(title, nullptr, 0, 192, 116, _colorTable[32328], nullptr, _colorTable[32328], 0);
|
||||
showDialogBox(title, NULL, 0, 192, 116, _colorTable[32328], NULL, _colorTable[32328], 0);
|
||||
} else {
|
||||
soundPlayFile("ib1p1xx1");
|
||||
pipboyOpen(PIPBOY_OPEN_INTENT_UNSPECIFIED);
|
||||
|
@ -729,7 +714,7 @@ int gameHandleKey(int eventCode, bool isInCombatMode)
|
|||
MessageListItem messageListItem;
|
||||
char title[128];
|
||||
strcpy(title, getmsg(&gMiscMessageList, &messageListItem, 7));
|
||||
showDialogBox(title, nullptr, 0, 192, 116, _colorTable[32328], nullptr, _colorTable[32328], 0);
|
||||
showDialogBox(title, NULL, 0, 192, 116, _colorTable[32328], NULL, _colorTable[32328], 0);
|
||||
} else {
|
||||
soundPlayFile("ib1p1xx1");
|
||||
pipboyOpen(PIPBOY_OPEN_INTENT_REST);
|
||||
|
@ -1047,18 +1032,18 @@ int globalVarsRead(const char* path, const char* section, int* variablesListLeng
|
|||
_inven_reset_dude();
|
||||
|
||||
File* stream = fileOpen(path, "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (*variablesListLengthPtr != 0) {
|
||||
internal_free(*variablesListPtr);
|
||||
*variablesListPtr = nullptr;
|
||||
*variablesListPtr = NULL;
|
||||
*variablesListLengthPtr = 0;
|
||||
}
|
||||
|
||||
char string[260];
|
||||
if (section != nullptr) {
|
||||
if (section != NULL) {
|
||||
while (fileReadString(string, 258, stream)) {
|
||||
if (strncmp(string, section, 16) == 0) {
|
||||
break;
|
||||
|
@ -1076,19 +1061,19 @@ int globalVarsRead(const char* path, const char* section, int* variablesListLeng
|
|||
}
|
||||
|
||||
char* semicolon = strchr(string, ';');
|
||||
if (semicolon != nullptr) {
|
||||
if (semicolon != NULL) {
|
||||
*semicolon = '\0';
|
||||
}
|
||||
|
||||
*variablesListLengthPtr = *variablesListLengthPtr + 1;
|
||||
*variablesListPtr = (int*)internal_realloc(*variablesListPtr, sizeof(int) * *variablesListLengthPtr);
|
||||
|
||||
if (*variablesListPtr == nullptr) {
|
||||
if (*variablesListPtr == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
char* equals = strchr(string, '=');
|
||||
if (equals != nullptr) {
|
||||
if (equals != NULL) {
|
||||
sscanf(equals + 1, "%d", *variablesListPtr + *variablesListLengthPtr - 1);
|
||||
} else {
|
||||
*variablesListPtr[*variablesListLengthPtr - 1] = 0;
|
||||
|
@ -1175,9 +1160,9 @@ static int gameTakeScreenshot(int width, int height, unsigned char* buffer, unsi
|
|||
static void gameFreeGlobalVars()
|
||||
{
|
||||
gGameGlobalVarsLength = 0;
|
||||
if (gGameGlobalVars != nullptr) {
|
||||
if (gGameGlobalVars != NULL) {
|
||||
internal_free(gGameGlobalVars);
|
||||
gGameGlobalVars = nullptr;
|
||||
gGameGlobalVars = NULL;
|
||||
}
|
||||
|
||||
if (gGameGlobalPointers != nullptr) {
|
||||
|
@ -1208,7 +1193,7 @@ static void showHelp()
|
|||
int win = windowCreate(helpWindowX, helpWindowY, HELP_SCREEN_WIDTH, HELP_SCREEN_HEIGHT, 0, WINDOW_HIDDEN | WINDOW_MOVE_ON_TOP);
|
||||
if (win != -1) {
|
||||
unsigned char* windowBuffer = windowGetBuffer(win);
|
||||
if (windowBuffer != nullptr) {
|
||||
if (windowBuffer != NULL) {
|
||||
FrmImage backgroundFrmImage;
|
||||
int backgroundFid = buildFid(OBJ_TYPE_INTERFACE, 297, 0, 0, 0);
|
||||
if (backgroundFrmImage.lock(backgroundFid)) {
|
||||
|
@ -1295,7 +1280,7 @@ int showQuitConfirmationDialog()
|
|||
MessageListItem messageListItem;
|
||||
messageListItem.num = 0;
|
||||
if (messageListGetItem(&gMiscMessageList, &messageListItem)) {
|
||||
rc = showDialogBox(messageListItem.text, nullptr, 0, 169, 117, _colorTable[32328], nullptr, _colorTable[32328], DIALOG_BOX_YES_NO);
|
||||
rc = showDialogBox(messageListItem.text, 0, 0, 169, 117, _colorTable[32328], NULL, _colorTable[32328], DIALOG_BOX_YES_NO);
|
||||
if (rc != 0) {
|
||||
_game_user_wants_to_quit = 2;
|
||||
}
|
||||
|
@ -1328,17 +1313,17 @@ static int gameDbInit()
|
|||
int patch_index;
|
||||
char filename[COMPAT_MAX_PATH];
|
||||
|
||||
main_file_name = nullptr;
|
||||
patch_file_name = nullptr;
|
||||
main_file_name = NULL;
|
||||
patch_file_name = NULL;
|
||||
|
||||
main_file_name = settings.system.master_dat_path.c_str();
|
||||
if (*main_file_name == '\0') {
|
||||
main_file_name = nullptr;
|
||||
main_file_name = NULL;
|
||||
}
|
||||
|
||||
patch_file_name = settings.system.master_patches_path.c_str();
|
||||
if (*patch_file_name == '\0') {
|
||||
patch_file_name = nullptr;
|
||||
patch_file_name = NULL;
|
||||
}
|
||||
|
||||
int master_db_handle = dbOpen(main_file_name, 0, patch_file_name, 1);
|
||||
|
@ -1349,12 +1334,12 @@ static int gameDbInit()
|
|||
|
||||
main_file_name = settings.system.critter_dat_path.c_str();
|
||||
if (*main_file_name == '\0') {
|
||||
main_file_name = nullptr;
|
||||
main_file_name = NULL;
|
||||
}
|
||||
|
||||
patch_file_name = settings.system.critter_patches_path.c_str();
|
||||
if (*patch_file_name == '\0') {
|
||||
patch_file_name = nullptr;
|
||||
patch_file_name = NULL;
|
||||
}
|
||||
|
||||
int critter_db_handle = dbOpen(main_file_name, 0, patch_file_name, 1);
|
||||
|
@ -1363,23 +1348,16 @@ static int gameDbInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
// SFALL: custom patch file name.
|
||||
char* path_file_name_template = nullptr;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_PATCH_FILE, &path_file_name_template);
|
||||
if (path_file_name_template == nullptr || *path_file_name_template == '\0') {
|
||||
path_file_name_template = "patch%03d.dat";
|
||||
}
|
||||
|
||||
for (patch_index = 0; patch_index < 1000; patch_index++) {
|
||||
snprintf(filename, sizeof(filename), path_file_name_template, patch_index);
|
||||
snprintf(filename, sizeof(filename), "patch%03d.dat", patch_index);
|
||||
|
||||
if (compat_access(filename, 0) == 0) {
|
||||
dbOpen(filename, 0, nullptr, 1);
|
||||
dbOpen(filename, 0, NULL, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (compat_access("f2_res.dat", 0) == 0) {
|
||||
dbOpen("f2_res.dat", 0, nullptr, 1);
|
||||
dbOpen("f2_res.dat", 0, NULL, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -1403,7 +1381,7 @@ static void showSplash()
|
|||
char filePath[64];
|
||||
snprintf(filePath, sizeof(filePath), "%ssplash%d.rix", path, splash);
|
||||
stream = fileOpen(filePath, "rb");
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1414,12 +1392,12 @@ static void showSplash()
|
|||
}
|
||||
}
|
||||
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char* palette = reinterpret_cast<unsigned char*>(internal_malloc(768));
|
||||
if (palette == nullptr) {
|
||||
if (palette == NULL) {
|
||||
fileClose(stream);
|
||||
return;
|
||||
}
|
||||
|
@ -1438,7 +1416,7 @@ static void showSplash()
|
|||
fileRead(&height, sizeof(height), 1, stream);
|
||||
|
||||
unsigned char* data = reinterpret_cast<unsigned char*>(internal_malloc(width * height));
|
||||
if (data == nullptr) {
|
||||
if (data == NULL) {
|
||||
internal_free(palette);
|
||||
fileClose(stream);
|
||||
return;
|
||||
|
@ -1483,7 +1461,7 @@ static void showSplash()
|
|||
}
|
||||
|
||||
unsigned char* scaled = reinterpret_cast<unsigned char*>(internal_malloc(scaledWidth * scaledHeight));
|
||||
if (scaled != nullptr) {
|
||||
if (scaled != NULL) {
|
||||
blitBufferToBufferStretch(data, width, height, width, scaled, scaledWidth, scaledHeight, scaledWidth);
|
||||
|
||||
int x = screenWidth > scaledWidth ? (screenWidth - scaledWidth) / 2 : 0;
|
||||
|
@ -1532,7 +1510,7 @@ int gameShowDeathDialog(const char* message)
|
|||
int oldUserWantsToQuit = _game_user_wants_to_quit;
|
||||
_game_user_wants_to_quit = 0;
|
||||
|
||||
int rc = showDialogBox(message, nullptr, 0, 169, 117, _colorTable[32328], nullptr, _colorTable[32328], DIALOG_BOX_LARGE);
|
||||
int rc = showDialogBox(message, 0, 0, 169, 117, _colorTable[32328], NULL, _colorTable[32328], DIALOG_BOX_LARGE);
|
||||
|
||||
_game_user_wants_to_quit = oldUserWantsToQuit;
|
||||
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
#include "game_config.h"
|
||||
#include "sfall_config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "db.h"
|
||||
#include "main.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
static void gameConfigResolvePath(const char* section, const char* key);
|
||||
|
||||
// A flag indicating if [gGameConfig] was initialized.
|
||||
//
|
||||
// 0x5186D0
|
||||
|
@ -124,55 +120,15 @@ bool gameConfigInit(bool isMapper, int argc, char** argv)
|
|||
configSetInt(&gGameConfig, GAME_CONFIG_MAPPER_KEY, GAME_CONFIG_SORT_SCRIPT_LIST_KEY, 0);
|
||||
}
|
||||
|
||||
// CE: Detect alternative default music directory.
|
||||
char alternativeMusicPath[COMPAT_MAX_PATH];
|
||||
strcpy(alternativeMusicPath, "data\\sound\\music\\*.acm");
|
||||
compat_windows_path_to_native(alternativeMusicPath);
|
||||
compat_resolve_path(alternativeMusicPath);
|
||||
|
||||
char** acms;
|
||||
int acmsLength = fileNameListInit(alternativeMusicPath, &acms, 0, 0);
|
||||
if (acmsLength != -1) {
|
||||
if (acmsLength > 0) {
|
||||
configSetString(&gGameConfig, GAME_CONFIG_SOUND_KEY, GAME_CONFIG_MUSIC_PATH1_KEY, "data\\sound\\music\\");
|
||||
configSetString(&gGameConfig, GAME_CONFIG_SOUND_KEY, GAME_CONFIG_MUSIC_PATH2_KEY, "data\\sound\\music\\");
|
||||
}
|
||||
fileNameListFree(&acms, 0);
|
||||
}
|
||||
|
||||
// SFALL: Custom config file name.
|
||||
char* customConfigFileName = nullptr;
|
||||
configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_CONFIG_FILE, &customConfigFileName);
|
||||
|
||||
const char* configFileName = customConfigFileName != nullptr && *customConfigFileName != '\0'
|
||||
? customConfigFileName
|
||||
: DEFAULT_GAME_CONFIG_FILE_NAME;
|
||||
|
||||
// Make `fallout2.cfg` file path.
|
||||
char* executable = argv[0];
|
||||
char* ch = strrchr(executable, '\\');
|
||||
if (ch != nullptr) {
|
||||
if (ch != NULL) {
|
||||
*ch = '\0';
|
||||
if (isMapper) {
|
||||
snprintf(gGameConfigFilePath,
|
||||
sizeof(gGameConfigFilePath),
|
||||
"%s\\%s",
|
||||
executable,
|
||||
MAPPER_CONFIG_FILE_NAME);
|
||||
} else {
|
||||
snprintf(gGameConfigFilePath,
|
||||
sizeof(gGameConfigFilePath),
|
||||
"%s\\%s",
|
||||
executable,
|
||||
configFileName);
|
||||
}
|
||||
snprintf(gGameConfigFilePath, sizeof(gGameConfigFilePath), "%s\\%s", executable, GAME_CONFIG_FILE_NAME);
|
||||
*ch = '\\';
|
||||
} else {
|
||||
if (isMapper) {
|
||||
strcpy(gGameConfigFilePath, MAPPER_CONFIG_FILE_NAME);
|
||||
} else {
|
||||
strcpy(gGameConfigFilePath, configFileName);
|
||||
}
|
||||
strcpy(gGameConfigFilePath, GAME_CONFIG_FILE_NAME);
|
||||
}
|
||||
|
||||
// Read contents of `fallout2.cfg` into config. The values from the file
|
||||
|
@ -183,15 +139,6 @@ bool gameConfigInit(bool isMapper, int argc, char** argv)
|
|||
// whatever was loaded from `fallout2.cfg`.
|
||||
configParseCommandLineArguments(&gGameConfig, argc, argv);
|
||||
|
||||
// CE: Normalize and resolve asset bundle paths.
|
||||
gameConfigResolvePath(GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_DAT_KEY);
|
||||
gameConfigResolvePath(GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_MASTER_PATCHES_KEY);
|
||||
gameConfigResolvePath(GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_CRITTER_DAT_KEY);
|
||||
gameConfigResolvePath(GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_CRITTER_PATCHES_KEY);
|
||||
gameConfigResolvePath(GAME_CONFIG_SYSTEM_KEY, GAME_CONFIG_CRITTER_PATCHES_KEY);
|
||||
gameConfigResolvePath(GAME_CONFIG_SOUND_KEY, GAME_CONFIG_MUSIC_PATH1_KEY);
|
||||
gameConfigResolvePath(GAME_CONFIG_SOUND_KEY, GAME_CONFIG_MUSIC_PATH2_KEY);
|
||||
|
||||
gGameConfigInitialized = true;
|
||||
|
||||
return true;
|
||||
|
@ -237,12 +184,4 @@ bool gameConfigExit(bool shouldSave)
|
|||
return result;
|
||||
}
|
||||
|
||||
static void gameConfigResolvePath(const char* section, const char* key)
|
||||
{
|
||||
char* path;
|
||||
configGetString(&gGameConfig, section, key, &path);
|
||||
compat_windows_path_to_native(path);
|
||||
compat_resolve_path(path);
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
namespace fallout {
|
||||
|
||||
#define DEFAULT_GAME_CONFIG_FILE_NAME "fallout2.cfg"
|
||||
#define MAPPER_CONFIG_FILE_NAME "mapper2.cfg"
|
||||
// The file name of the main config file.
|
||||
#define GAME_CONFIG_FILE_NAME "fallout2.cfg"
|
||||
|
||||
#define GAME_CONFIG_SYSTEM_KEY "system"
|
||||
#define GAME_CONFIG_PREFERENCES_KEY "preferences"
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
#include "critter.h"
|
||||
#include "cycle.h"
|
||||
#include "debug.h"
|
||||
#include "delay.h"
|
||||
#include "dialog.h"
|
||||
#include "display_monitor.h"
|
||||
#include "draw.h"
|
||||
|
@ -155,7 +154,7 @@ static int gGameDialogOptionEntriesLength = 0;
|
|||
static int gGameDialogReviewEntriesLength = 0;
|
||||
|
||||
// 0x5186E0
|
||||
static unsigned char* gGameDialogDisplayBuffer = nullptr;
|
||||
static unsigned char* gGameDialogDisplayBuffer = NULL;
|
||||
|
||||
// 0x5186E4
|
||||
static int gGameDialogReplyWindow = -1;
|
||||
|
@ -173,10 +172,10 @@ static int _boxesWereDisabled = 0;
|
|||
static int gGameDialogFidgetFid = 0;
|
||||
|
||||
// 0x5186F8
|
||||
static CacheEntry* gGameDialogFidgetFrmHandle = nullptr;
|
||||
static CacheEntry* gGameDialogFidgetFrmHandle = NULL;
|
||||
|
||||
// 0x5186FC
|
||||
static Art* gGameDialogFidgetFrm = nullptr;
|
||||
static Art* gGameDialogFidgetFrm = NULL;
|
||||
|
||||
// 0x518700
|
||||
static int gGameDialogBackground = 2;
|
||||
|
@ -185,10 +184,10 @@ static int gGameDialogBackground = 2;
|
|||
static int _lipsFID = 0;
|
||||
|
||||
// 0x518708
|
||||
static CacheEntry* _lipsKey = nullptr;
|
||||
static CacheEntry* _lipsKey = NULL;
|
||||
|
||||
// 0x51870C
|
||||
static Art* _lipsFp = nullptr;
|
||||
static Art* _lipsFp = NULL;
|
||||
|
||||
// 0x518710
|
||||
static bool gGameDialogLipSyncStarted = false;
|
||||
|
@ -215,13 +214,13 @@ static int _gdReenterLevel = 0;
|
|||
static bool _gdReplyTooBig = false;
|
||||
|
||||
// 0x518730
|
||||
static Object* _peon_table_obj = nullptr;
|
||||
static Object* _peon_table_obj = NULL;
|
||||
|
||||
// 0x518734
|
||||
static Object* _barterer_table_obj = nullptr;
|
||||
static Object* _barterer_table_obj = NULL;
|
||||
|
||||
// 0x518738
|
||||
static Object* _barterer_temp_obj = nullptr;
|
||||
static Object* _barterer_temp_obj = NULL;
|
||||
|
||||
// 0x51873C
|
||||
static int gGameDialogBarterModifier = 0;
|
||||
|
@ -267,10 +266,10 @@ static int gGameDialogOldCenterTile = -1;
|
|||
static int gGameDialogOldDudeTile = -1;
|
||||
|
||||
// 0x5187E4
|
||||
static unsigned char* _light_BlendTable = nullptr;
|
||||
static unsigned char* _light_BlendTable = NULL;
|
||||
|
||||
// 0x5187E8
|
||||
static unsigned char* _dark_BlendTable = nullptr;
|
||||
static unsigned char* _dark_BlendTable = NULL;
|
||||
|
||||
// 0x5187EC
|
||||
static int _dialogue_just_started = 0;
|
||||
|
@ -303,7 +302,7 @@ static int gGameDialogReviewWindowButtonFrmIds[GAME_DIALOG_REVIEW_WINDOW_BUTTON_
|
|||
};
|
||||
|
||||
// 0x518848
|
||||
Object* gGameDialogSpeaker = nullptr;
|
||||
Object* gGameDialogSpeaker = NULL;
|
||||
|
||||
// 0x51884C
|
||||
bool gGameDialogSpeakerIsPartyMember = false;
|
||||
|
@ -383,11 +382,11 @@ static int _dialogue_subwin_len = 0;
|
|||
|
||||
// 0x51891C
|
||||
static GameDialogButtonData gGameDialogDispositionButtonsData[5] = {
|
||||
{ 438, 37, 397, 395, 396, nullptr, nullptr, nullptr, 2098, 4 },
|
||||
{ 438, 67, 394, 392, 393, nullptr, nullptr, nullptr, 2103, 3 },
|
||||
{ 438, 96, 406, 404, 405, nullptr, nullptr, nullptr, 2102, 2 },
|
||||
{ 438, 126, 400, 398, 399, nullptr, nullptr, nullptr, 2111, 1 },
|
||||
{ 438, 156, 403, 401, 402, nullptr, nullptr, nullptr, 2099, 0 },
|
||||
{ 438, 37, 397, 395, 396, NULL, NULL, NULL, 2098, 4 },
|
||||
{ 438, 67, 394, 392, 393, NULL, NULL, NULL, 2103, 3 },
|
||||
{ 438, 96, 406, 404, 405, NULL, NULL, NULL, 2102, 2 },
|
||||
{ 438, 126, 400, 398, 399, NULL, NULL, NULL, 2111, 1 },
|
||||
{ 438, 156, 403, 401, 402, NULL, NULL, NULL, 2099, 0 },
|
||||
};
|
||||
|
||||
// 0x5189E4
|
||||
|
@ -444,12 +443,12 @@ static STRUCT_5189E4 _custom_settings[PARTY_MEMBER_CUSTOMIZATION_OPTION_COUNT][6
|
|||
|
||||
// 0x518B04
|
||||
static GameDialogButtonData _custom_button_info[PARTY_MEMBER_CUSTOMIZATION_OPTION_COUNT] = {
|
||||
{ 95, 9, 410, 409, -1, nullptr, nullptr, nullptr, 0, 0 },
|
||||
{ 96, 38, 416, 415, -1, nullptr, nullptr, nullptr, 1, 0 },
|
||||
{ 96, 68, 418, 417, -1, nullptr, nullptr, nullptr, 2, 0 },
|
||||
{ 96, 98, 414, 413, -1, nullptr, nullptr, nullptr, 3, 0 },
|
||||
{ 96, 127, 408, 407, -1, nullptr, nullptr, nullptr, 4, 0 },
|
||||
{ 96, 157, 412, 411, -1, nullptr, nullptr, nullptr, 5, 0 },
|
||||
{ 95, 9, 410, 409, -1, NULL, NULL, NULL, 0, 0 },
|
||||
{ 96, 38, 416, 415, -1, NULL, NULL, NULL, 1, 0 },
|
||||
{ 96, 68, 418, 417, -1, NULL, NULL, NULL, 2, 0 },
|
||||
{ 96, 98, 414, 413, -1, NULL, NULL, NULL, 3, 0 },
|
||||
{ 96, 127, 408, 407, -1, NULL, NULL, NULL, 4, 0 },
|
||||
{ 96, 157, 412, 411, -1, NULL, NULL, NULL, 5, 0 },
|
||||
};
|
||||
|
||||
// 0x518BF4
|
||||
|
@ -669,7 +668,7 @@ bool _gdialogActive()
|
|||
// 0x444D3C
|
||||
void gameDialogEnter(Object* speaker, int a2)
|
||||
{
|
||||
if (speaker == nullptr) {
|
||||
if (speaker == NULL) {
|
||||
debugPrint("\nError: gdialogEnter: target was NULL!");
|
||||
return;
|
||||
}
|
||||
|
@ -824,7 +823,7 @@ void _gdialogSystemEnter()
|
|||
// 0x445050
|
||||
void gameDialogStartLips(const char* audioFileName)
|
||||
{
|
||||
if (audioFileName == nullptr) {
|
||||
if (audioFileName == NULL) {
|
||||
debugPrint("\nGDialog: Bleep!");
|
||||
soundPlayFile("censor");
|
||||
return;
|
||||
|
@ -888,11 +887,11 @@ int _gdialogInitFromScript(int headFid, int reaction)
|
|||
gGameDialogSpeakerIsPartyMember = objectIsPartyMember(gGameDialogSpeaker);
|
||||
_oldFont = fontGetCurrent();
|
||||
fontSetCurrent(101);
|
||||
dialogSetReplyWindow(135, 225, 379, 58, nullptr);
|
||||
dialogSetReplyWindow(135, 225, 379, 58, NULL);
|
||||
dialogSetReplyColor(0.3f, 0.3f, 0.3f);
|
||||
dialogSetOptionWindow(127, 335, 393, 117, nullptr);
|
||||
dialogSetOptionWindow(127, 335, 393, 117, NULL);
|
||||
dialogSetOptionColor(0.2f, 0.2f, 0.2f);
|
||||
dialogSetReplyTitle(nullptr);
|
||||
dialogSetReplyTitle(NULL);
|
||||
_dialogRegisterWinDrawCallbacks(_demo_copy_title, _demo_copy_options);
|
||||
gameDialogHighlightsInit();
|
||||
colorCycleDisable();
|
||||
|
@ -966,17 +965,17 @@ int _gdialogExitFromScript()
|
|||
|
||||
fontSetCurrent(_oldFont);
|
||||
|
||||
if (gGameDialogFidgetFrm != nullptr) {
|
||||
if (gGameDialogFidgetFrm != NULL) {
|
||||
artUnlock(gGameDialogFidgetFrmHandle);
|
||||
gGameDialogFidgetFrm = nullptr;
|
||||
gGameDialogFidgetFrm = NULL;
|
||||
}
|
||||
|
||||
if (_lipsKey != nullptr) {
|
||||
if (_lipsKey != NULL) {
|
||||
if (artUnlock(_lipsKey) == -1) {
|
||||
debugPrint("Failure unlocking lips frame!\n");
|
||||
}
|
||||
_lipsKey = nullptr;
|
||||
_lipsFp = nullptr;
|
||||
_lipsKey = NULL;
|
||||
_lipsFp = NULL;
|
||||
_lipsFID = 0;
|
||||
}
|
||||
|
||||
|
@ -1304,7 +1303,7 @@ int gameDialogReviewWindowInit(int* win)
|
|||
|
||||
gGameDialogReviewWindowOldFont = fontGetCurrent();
|
||||
|
||||
if (win == nullptr) {
|
||||
if (win == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1361,7 @@ int gameDialogReviewWindowInit(int* win)
|
|||
KEY_ARROW_UP,
|
||||
_reviewFrmImages[GAME_DIALOG_REVIEW_WINDOW_BUTTON_FRM_ARROW_UP_NORMAL].getData(),
|
||||
_reviewFrmImages[GAME_DIALOG_REVIEW_WINDOW_BUTTON_FRM_ARROW_UP_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (upBtn == -1) {
|
||||
gameDialogReviewWindowFree(win);
|
||||
|
@ -1382,7 +1381,7 @@ int gameDialogReviewWindowInit(int* win)
|
|||
KEY_ARROW_DOWN,
|
||||
_reviewFrmImages[GAME_DIALOG_REVIEW_WINDOW_BUTTON_FRM_ARROW_DOWN_NORMAL].getData(),
|
||||
_reviewFrmImages[GAME_DIALOG_REVIEW_WINDOW_BUTTON_FRM_ARROW_DOWN_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (downBtn == -1) {
|
||||
gameDialogReviewWindowFree(win);
|
||||
|
@ -1402,7 +1401,7 @@ int gameDialogReviewWindowInit(int* win)
|
|||
KEY_ESCAPE,
|
||||
_reviewFrmImages[GAME_DIALOG_REVIEW_WINDOW_BUTTON_FRM_DONE_NORMAL].getData(),
|
||||
_reviewFrmImages[GAME_DIALOG_REVIEW_WINDOW_BUTTON_FRM_DONE_PRESSED].getData(),
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (doneBtn == -1) {
|
||||
gameDialogReviewWindowFree(win);
|
||||
|
@ -1439,7 +1438,7 @@ int gameDialogReviewWindowFree(int* win)
|
|||
|
||||
fontSetCurrent(gGameDialogReviewWindowOldFont);
|
||||
|
||||
if (win == nullptr) {
|
||||
if (win == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1522,7 +1521,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
|
|||
|
||||
int v20 = fontGetLineHeight() + 2;
|
||||
unsigned char* windowBuffer = windowGetBuffer(win);
|
||||
if (windowBuffer == nullptr) {
|
||||
if (windowBuffer == NULL) {
|
||||
debugPrint("\nError: gdialog: review: can't find buffer!");
|
||||
return;
|
||||
}
|
||||
|
@ -1552,7 +1551,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
|
|||
replyText = _scr_get_msg_str(dialogReviewEntry->replyMessageListId, dialogReviewEntry->replyMessageId);
|
||||
}
|
||||
|
||||
if (replyText == nullptr) {
|
||||
if (replyText == NULL) {
|
||||
showMesageBox("\nGDialog::Error Grabbing text message!");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -1561,7 +1560,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
|
|||
y = text_to_rect_wrapped(windowBuffer + 113,
|
||||
&entriesRect,
|
||||
replyText,
|
||||
nullptr,
|
||||
NULL,
|
||||
fontGetLineHeight(),
|
||||
640,
|
||||
_colorTable[768] | 0x2000000);
|
||||
|
@ -1585,7 +1584,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
|
|||
optionText = _scr_get_msg_str(dialogReviewEntry->optionMessageListId, dialogReviewEntry->optionMessageId);
|
||||
}
|
||||
|
||||
if (optionText == nullptr) {
|
||||
if (optionText == NULL) {
|
||||
showMesageBox("\nGDialog::Error Grabbing text message!");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -1594,7 +1593,7 @@ void gameDialogReviewWindowUpdate(int win, int origin)
|
|||
y = text_to_rect_wrapped(windowBuffer + 113,
|
||||
&entriesRect,
|
||||
optionText,
|
||||
nullptr,
|
||||
NULL,
|
||||
fontGetLineHeight(),
|
||||
640,
|
||||
_colorTable[15855] | 0x2000000);
|
||||
|
@ -1620,9 +1619,9 @@ void dialogReviewEntriesClear()
|
|||
entry->replyMessageListId = 0;
|
||||
entry->replyMessageId = 0;
|
||||
|
||||
if (entry->replyText != nullptr) {
|
||||
if (entry->replyText != NULL) {
|
||||
internal_free(entry->replyText);
|
||||
entry->replyText = nullptr;
|
||||
entry->replyText = NULL;
|
||||
}
|
||||
|
||||
entry->optionMessageListId = 0;
|
||||
|
@ -1666,9 +1665,9 @@ int gameDialogAddReviewText(const char* string)
|
|||
entry->replyMessageListId = -4;
|
||||
entry->replyMessageId = -4;
|
||||
|
||||
if (entry->replyText != nullptr) {
|
||||
if (entry->replyText != NULL) {
|
||||
internal_free(entry->replyText);
|
||||
entry->replyText = nullptr;
|
||||
entry->replyText = NULL;
|
||||
}
|
||||
|
||||
entry->replyText = (char*)internal_malloc(strlen(string) + 1);
|
||||
|
@ -1676,7 +1675,7 @@ int gameDialogAddReviewText(const char* string)
|
|||
|
||||
entry->optionMessageListId = -3;
|
||||
entry->optionMessageId = -3;
|
||||
entry->optionText = nullptr;
|
||||
entry->optionText = NULL;
|
||||
|
||||
gGameDialogReviewEntriesLength++;
|
||||
|
||||
|
@ -1694,7 +1693,7 @@ int gameDialogSetReviewOptionMessage(int messageListId, int messageId)
|
|||
GameDialogReviewEntry* entry = &(gDialogReviewEntries[gGameDialogReviewEntriesLength - 1]);
|
||||
entry->optionMessageListId = messageListId;
|
||||
entry->optionMessageId = messageId;
|
||||
entry->optionText = nullptr;
|
||||
entry->optionText = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1740,22 +1739,22 @@ int _gdProcessInit()
|
|||
}
|
||||
|
||||
// Top part of the reply window - scroll up.
|
||||
upBtn = buttonCreate(gGameDialogReplyWindow, 1, 1, 377, 28, -1, -1, KEY_ARROW_UP, -1, nullptr, nullptr, nullptr, 32);
|
||||
upBtn = buttonCreate(gGameDialogReplyWindow, 1, 1, 377, 28, -1, -1, KEY_ARROW_UP, -1, NULL, NULL, NULL, 32);
|
||||
if (upBtn == -1) {
|
||||
goto err_1;
|
||||
}
|
||||
|
||||
buttonSetCallbacks(upBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
buttonSetMouseCallbacks(upBtn, _reply_arrow_up, _reply_arrow_restore, nullptr, nullptr);
|
||||
buttonSetMouseCallbacks(upBtn, _reply_arrow_up, _reply_arrow_restore, 0, 0);
|
||||
|
||||
// Bottom part of the reply window - scroll down.
|
||||
downBtn = buttonCreate(gGameDialogReplyWindow, 1, 29, 377, 28, -1, -1, KEY_ARROW_DOWN, -1, nullptr, nullptr, nullptr, 32);
|
||||
downBtn = buttonCreate(gGameDialogReplyWindow, 1, 29, 377, 28, -1, -1, KEY_ARROW_DOWN, -1, NULL, NULL, NULL, 32);
|
||||
if (downBtn == -1) {
|
||||
goto err_1;
|
||||
}
|
||||
|
||||
buttonSetCallbacks(downBtn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
buttonSetMouseCallbacks(downBtn, _reply_arrow_down, _reply_arrow_restore, nullptr, nullptr);
|
||||
buttonSetMouseCallbacks(downBtn, _reply_arrow_down, _reply_arrow_restore, 0, 0);
|
||||
|
||||
optionsWindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2 + GAME_DIALOG_OPTIONS_WINDOW_X;
|
||||
optionsWindowY = (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2 + GAME_DIALOG_OPTIONS_WINDOW_Y;
|
||||
|
@ -2133,7 +2132,7 @@ void gameDialogOptionOnMouseEnter(int index)
|
|||
text_to_rect_wrapped(windowGetBuffer(gGameDialogOptionsWindow),
|
||||
&_optionRect,
|
||||
dialogOptionEntry->text,
|
||||
nullptr,
|
||||
NULL,
|
||||
fontGetLineHeight(),
|
||||
393,
|
||||
color);
|
||||
|
@ -2181,7 +2180,7 @@ void gameDialogOptionOnMouseExit(int index)
|
|||
text_to_rect_wrapped(windowGetBuffer(gGameDialogOptionsWindow),
|
||||
&_optionRect,
|
||||
dialogOptionEntry->text,
|
||||
nullptr,
|
||||
NULL,
|
||||
fontGetLineHeight(),
|
||||
393,
|
||||
color);
|
||||
|
@ -2234,7 +2233,7 @@ void _gdProcessUpdate()
|
|||
|
||||
if (gDialogReplyMessageListId > 0) {
|
||||
char* s = _scr_get_msg_str_speech(gDialogReplyMessageListId, gDialogReplyMessageId, 1);
|
||||
if (s == nullptr) {
|
||||
if (s == NULL) {
|
||||
showMesageBox("\n'GDialog::Error Grabbing text message!");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -2277,7 +2276,7 @@ void _gdProcessUpdate()
|
|||
|
||||
if (dialogOptionEntry->messageListId >= 0) {
|
||||
char* text = _scr_get_msg_str_speech(dialogOptionEntry->messageListId, dialogOptionEntry->messageId, 0);
|
||||
if (text == nullptr) {
|
||||
if (text == NULL) {
|
||||
showMesageBox("\nGDialog::Error Grabbing text message!");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -2345,14 +2344,14 @@ void _gdProcessUpdate()
|
|||
text_to_rect_wrapped(windowGetBuffer(gGameDialogOptionsWindow),
|
||||
&_optionRect,
|
||||
dialogOptionEntry->text,
|
||||
nullptr,
|
||||
NULL,
|
||||
fontGetLineHeight(),
|
||||
393,
|
||||
color);
|
||||
|
||||
_optionRect.top += 2;
|
||||
|
||||
dialogOptionEntry->btn = buttonCreate(gGameDialogOptionsWindow, 2, y, width, _optionRect.top - y - 4, 1200 + index, 1300 + index, -1, 49 + index, nullptr, nullptr, nullptr, 0);
|
||||
dialogOptionEntry->btn = buttonCreate(gGameDialogOptionsWindow, 2, y, width, _optionRect.top - y - 4, 1200 + index, 1300 + index, -1, 49 + index, NULL, NULL, NULL, 0);
|
||||
if (dialogOptionEntry->btn != -1) {
|
||||
buttonSetCallbacks(dialogOptionEntry->btn, _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
} else {
|
||||
|
@ -2392,7 +2391,7 @@ int _gdCreateHeadWindow()
|
|||
int width = rect->right - rect->left;
|
||||
int height = rect->bottom - rect->top;
|
||||
_backgrndBufs[index] = (unsigned char*)internal_malloc(width * height);
|
||||
if (_backgrndBufs[index] == nullptr) {
|
||||
if (_backgrndBufs[index] == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2419,7 +2418,7 @@ int _gdCreateHeadWindow()
|
|||
void _gdDestroyHeadWindow()
|
||||
{
|
||||
if (gGameDialogWindow != -1) {
|
||||
gGameDialogDisplayBuffer = nullptr;
|
||||
gGameDialogDisplayBuffer = NULL;
|
||||
}
|
||||
|
||||
if (_dialogue_state == 1) {
|
||||
|
@ -2445,15 +2444,15 @@ void _gdSetupFidget(int headFrmId, int reaction)
|
|||
|
||||
if (headFrmId == -1) {
|
||||
gGameDialogFidgetFid = -1;
|
||||
gGameDialogFidgetFrm = nullptr;
|
||||
gGameDialogFidgetFrm = NULL;
|
||||
gGameDialogFidgetFrmHandle = INVALID_CACHE_ENTRY;
|
||||
gGameDialogFidgetReaction = -1;
|
||||
gGameDialogFidgetUpdateDelay = 0;
|
||||
gGameDialogFidgetLastUpdateTimestamp = 0;
|
||||
gameDialogRenderTalkingHead(nullptr, 0);
|
||||
gameDialogRenderTalkingHead(NULL, 0);
|
||||
_lipsFID = 0;
|
||||
_lipsKey = nullptr;
|
||||
_lipsFp = nullptr;
|
||||
_lipsKey = NULL;
|
||||
_lipsFp = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2472,8 +2471,8 @@ void _gdSetupFidget(int headFrmId, int reaction)
|
|||
if (artUnlock(_lipsKey) == -1) {
|
||||
debugPrint("failure unlocking lips frame!\n");
|
||||
}
|
||||
_lipsKey = nullptr;
|
||||
_lipsFp = nullptr;
|
||||
_lipsKey = NULL;
|
||||
_lipsFp = NULL;
|
||||
_lipsFID = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2482,7 +2481,7 @@ void _gdSetupFidget(int headFrmId, int reaction)
|
|||
_phone_anim = anim;
|
||||
_lipsFID = buildFid(OBJ_TYPE_HEAD, headFrmId, anim, 0, 0);
|
||||
_lipsFp = artLock(_lipsFID, &_lipsKey);
|
||||
if (_lipsFp == nullptr) {
|
||||
if (_lipsFp == NULL) {
|
||||
debugPrint("failure!\n");
|
||||
|
||||
char stats[200];
|
||||
|
@ -2526,7 +2525,7 @@ void _gdSetupFidget(int headFrmId, int reaction)
|
|||
|
||||
debugPrint("Choosing fidget %d out of %d\n", fidget, fidgetCount);
|
||||
|
||||
if (gGameDialogFidgetFrm != nullptr) {
|
||||
if (gGameDialogFidgetFrm != NULL) {
|
||||
if (artUnlock(gGameDialogFidgetFrmHandle) == -1) {
|
||||
debugPrint("failure!\n");
|
||||
}
|
||||
|
@ -2535,7 +2534,7 @@ void _gdSetupFidget(int headFrmId, int reaction)
|
|||
gGameDialogFidgetFid = buildFid(OBJ_TYPE_HEAD, headFrmId, reaction, fidget, 0);
|
||||
gGameDialogFidgetFrmCurrentFrame = 0;
|
||||
gGameDialogFidgetFrm = artLock(gGameDialogFidgetFid, &gGameDialogFidgetFrmHandle);
|
||||
if (gGameDialogFidgetFrm == nullptr) {
|
||||
if (gGameDialogFidgetFrm == NULL) {
|
||||
debugPrint("failure!\n");
|
||||
|
||||
char stats[200];
|
||||
|
@ -2551,7 +2550,7 @@ void _gdSetupFidget(int headFrmId, int reaction)
|
|||
// 0x447598
|
||||
void gameDialogWaitForFidgetToComplete()
|
||||
{
|
||||
if (gGameDialogFidgetFrm == nullptr) {
|
||||
if (gGameDialogFidgetFrm == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2580,7 +2579,7 @@ void gameDialogWaitForFidgetToComplete()
|
|||
// 0x447614
|
||||
void _gdPlayTransition(int anim)
|
||||
{
|
||||
if (gGameDialogFidgetFrm == nullptr) {
|
||||
if (gGameDialogFidgetFrm == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2594,17 +2593,17 @@ void _gdPlayTransition(int anim)
|
|||
|
||||
gameDialogWaitForFidgetToComplete();
|
||||
|
||||
if (gGameDialogFidgetFrm != nullptr) {
|
||||
if (gGameDialogFidgetFrm != NULL) {
|
||||
if (artUnlock(gGameDialogFidgetFrmHandle) == -1) {
|
||||
debugPrint("\tError unlocking fidget in transition func...");
|
||||
}
|
||||
gGameDialogFidgetFrm = nullptr;
|
||||
gGameDialogFidgetFrm = NULL;
|
||||
}
|
||||
|
||||
CacheEntry* headFrmHandle;
|
||||
int headFid = buildFid(OBJ_TYPE_HEAD, gGameDialogHeadFid, anim, 0, 0);
|
||||
Art* headFrm = artLock(headFid, &headFrmHandle);
|
||||
if (headFrm == nullptr) {
|
||||
if (headFrm == NULL) {
|
||||
debugPrint("\tError locking transition...\n");
|
||||
}
|
||||
|
||||
|
@ -2684,7 +2683,7 @@ void _demo_copy_title(int win)
|
|||
}
|
||||
|
||||
unsigned char* src = windowGetBuffer(gGameDialogBackgroundWindow);
|
||||
if (src == nullptr) {
|
||||
if (src == NULL) {
|
||||
debugPrint("\nError: demo_copy_title: couldn't get buffer!");
|
||||
return;
|
||||
}
|
||||
|
@ -2728,7 +2727,7 @@ void _demo_copy_options(int win)
|
|||
windowRect.top -= (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2;
|
||||
|
||||
unsigned char* src = windowGetBuffer(gGameDialogWindow);
|
||||
if (src == nullptr) {
|
||||
if (src == NULL) {
|
||||
debugPrint("\nError: demo_copy_options: couldn't get buffer!");
|
||||
return;
|
||||
}
|
||||
|
@ -2741,7 +2740,7 @@ void _demo_copy_options(int win)
|
|||
// 0x447914
|
||||
void _gDialogRefreshOptionsRect(int win, Rect* drawRect)
|
||||
{
|
||||
if (drawRect == nullptr) {
|
||||
if (drawRect == NULL) {
|
||||
debugPrint("\nError: gDialogRefreshOptionsRect: drawRect NULL!");
|
||||
return;
|
||||
}
|
||||
|
@ -2762,7 +2761,7 @@ void _gDialogRefreshOptionsRect(int win, Rect* drawRect)
|
|||
windowRect.top -= (screenGetHeight() - GAME_DIALOG_WINDOW_HEIGHT) / 2;
|
||||
|
||||
unsigned char* src = windowGetBuffer(gGameDialogWindow);
|
||||
if (src == nullptr) {
|
||||
if (src == NULL) {
|
||||
debugPrint("\nError: gDialogRefreshOptionsRect: couldn't get buffer!");
|
||||
return;
|
||||
}
|
||||
|
@ -2832,7 +2831,7 @@ void gameDialogTicker()
|
|||
break;
|
||||
}
|
||||
|
||||
if (gGameDialogFidgetFrm == nullptr) {
|
||||
if (gGameDialogFidgetFrm == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2937,6 +2936,7 @@ void _gdialog_scroll_subwin(int win, int a2, unsigned char* a3, unsigned char* a
|
|||
int v7;
|
||||
unsigned char* v9;
|
||||
Rect rect;
|
||||
unsigned int tick;
|
||||
|
||||
v7 = a6;
|
||||
v9 = a4;
|
||||
|
@ -2971,7 +2971,9 @@ void _gdialog_scroll_subwin(int win, int a2, unsigned char* a3, unsigned char* a
|
|||
v7 += 10;
|
||||
v9 -= 10 * (GAME_DIALOG_WINDOW_WIDTH);
|
||||
|
||||
delay_ms(33);
|
||||
tick = getTicks();
|
||||
while (getTicksSince(tick) < 33) {
|
||||
}
|
||||
|
||||
renderPresent();
|
||||
sharedFpsLimiter.throttle();
|
||||
|
@ -3009,7 +3011,9 @@ void _gdialog_scroll_subwin(int win, int a2, unsigned char* a3, unsigned char* a
|
|||
|
||||
rect.top += 10;
|
||||
|
||||
delay_ms(33);
|
||||
tick = getTicks();
|
||||
while (getTicksSince(tick) < 33) {
|
||||
}
|
||||
|
||||
renderPresent();
|
||||
sharedFpsLimiter.throttle();
|
||||
|
@ -3044,15 +3048,15 @@ static int text_to_rect_wrapped(unsigned char* buffer, Rect* rect, char* string,
|
|||
int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4, int height, int pitch, int color, int a7)
|
||||
{
|
||||
char* start;
|
||||
if (a4 != nullptr) {
|
||||
if (a4 != NULL) {
|
||||
start = string + *a4;
|
||||
} else {
|
||||
start = string;
|
||||
}
|
||||
|
||||
int maxWidth = rect->right - rect->left;
|
||||
char* end = nullptr;
|
||||
while (start != nullptr && *start != '\0') {
|
||||
char* end = NULL;
|
||||
while (start != NULL && *start != '\0') {
|
||||
if (fontGetStringWidth(start) > maxWidth) {
|
||||
end = start + 1;
|
||||
while (*end != '\0' && *end != ' ') {
|
||||
|
@ -3061,18 +3065,18 @@ int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4,
|
|||
|
||||
if (*end != '\0') {
|
||||
char* lookahead = end + 1;
|
||||
while (lookahead != nullptr) {
|
||||
while (lookahead != NULL) {
|
||||
while (*lookahead != '\0' && *lookahead != ' ') {
|
||||
lookahead++;
|
||||
}
|
||||
|
||||
if (*lookahead == '\0') {
|
||||
lookahead = nullptr;
|
||||
lookahead = NULL;
|
||||
} else {
|
||||
*lookahead = '\0';
|
||||
if (fontGetStringWidth(start) >= maxWidth) {
|
||||
*lookahead = ' ';
|
||||
lookahead = nullptr;
|
||||
lookahead = NULL;
|
||||
} else {
|
||||
end = lookahead;
|
||||
*lookahead = ' ';
|
||||
|
@ -3095,7 +3099,7 @@ int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4,
|
|||
fontDrawText(buffer + pitch * rect->top, start, maxWidth, pitch, color);
|
||||
}
|
||||
|
||||
if (a4 != nullptr) {
|
||||
if (a4 != NULL) {
|
||||
*a4 += static_cast<int>(strlen(start)) + 1;
|
||||
}
|
||||
|
||||
|
@ -3111,7 +3115,7 @@ int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4,
|
|||
|
||||
if (a7 != 0) {
|
||||
if (rect->bottom - fontGetLineHeight() < rect->top) {
|
||||
if (end != nullptr && *end == '\0') {
|
||||
if (end != NULL && *end == '\0') {
|
||||
*end = ' ';
|
||||
}
|
||||
return rect->top;
|
||||
|
@ -3126,24 +3130,24 @@ int gameDialogDrawText(unsigned char* buffer, Rect* rect, char* string, int* a4,
|
|||
fontDrawText(dest + pitch * rect->top, start, maxWidth, pitch, color);
|
||||
}
|
||||
|
||||
if (a4 != nullptr && end != nullptr) {
|
||||
if (a4 != NULL && end != NULL) {
|
||||
*a4 += static_cast<int>(strlen(start)) + 1;
|
||||
}
|
||||
|
||||
rect->top += height;
|
||||
|
||||
if (end != nullptr) {
|
||||
if (end != NULL) {
|
||||
start = end + 1;
|
||||
if (*end == '\0') {
|
||||
*end = ' ';
|
||||
}
|
||||
end = nullptr;
|
||||
end = NULL;
|
||||
} else {
|
||||
start = nullptr;
|
||||
start = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (a4 != nullptr) {
|
||||
if (a4 != NULL) {
|
||||
*a4 = 0;
|
||||
}
|
||||
|
||||
|
@ -3204,7 +3208,7 @@ int _gdialog_barter_create_win()
|
|||
}
|
||||
|
||||
unsigned char* backgroundData = backgroundFrmImage.getData();
|
||||
if (backgroundData == nullptr) {
|
||||
if (backgroundData == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -3228,17 +3232,17 @@ int _gdialog_barter_create_win()
|
|||
unsigned char* backgroundWindowBuffer = windowGetBuffer(gGameDialogBackgroundWindow);
|
||||
blitBufferToBuffer(backgroundWindowBuffer + width * (480 - _dialogue_subwin_len), width, _dialogue_subwin_len, width, windowBuffer, width);
|
||||
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundData, windowBuffer, nullptr, _dialogue_subwin_len, 0);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundData, windowBuffer, NULL, _dialogue_subwin_len, 0);
|
||||
|
||||
backgroundFrmImage.unlock();
|
||||
|
||||
// TRADE
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 41, 163, 14, 14, -1, -1, -1, KEY_LOWERCASE_M, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 41, 163, 14, 14, -1, -1, -1, KEY_LOWERCASE_M, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[0] != -1) {
|
||||
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
// TALK
|
||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 584, 162, 14, 14, -1, -1, -1, KEY_LOWERCASE_T, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 584, 162, 14, 14, -1, -1, -1, KEY_LOWERCASE_T, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[1] != -1) {
|
||||
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
|
@ -3254,10 +3258,10 @@ int _gdialog_barter_create_win()
|
|||
return 0;
|
||||
}
|
||||
|
||||
objectDestroy(_barterer_table_obj, nullptr);
|
||||
objectDestroy(_barterer_table_obj, 0);
|
||||
}
|
||||
|
||||
objectDestroy(_peon_table_obj, nullptr);
|
||||
objectDestroy(_peon_table_obj, 0);
|
||||
}
|
||||
|
||||
buttonDestroy(_gdialog_buttons[1]);
|
||||
|
@ -3281,9 +3285,9 @@ void _gdialog_barter_destroy_win()
|
|||
return;
|
||||
}
|
||||
|
||||
objectDestroy(_barterer_temp_obj, nullptr);
|
||||
objectDestroy(_barterer_table_obj, nullptr);
|
||||
objectDestroy(_peon_table_obj, nullptr);
|
||||
objectDestroy(_barterer_temp_obj, 0);
|
||||
objectDestroy(_barterer_table_obj, 0);
|
||||
objectDestroy(_peon_table_obj, 0);
|
||||
|
||||
for (int index = 0; index < 9; index++) {
|
||||
buttonDestroy(_gdialog_buttons[index]);
|
||||
|
@ -3337,7 +3341,7 @@ void _gdialog_barter_cleanup_tables()
|
|||
itemMoveForce(_barterer_table_obj, gGameDialogSpeaker, item, quantity);
|
||||
}
|
||||
|
||||
if (_barterer_temp_obj != nullptr) {
|
||||
if (_barterer_temp_obj != NULL) {
|
||||
inventory = &(_barterer_temp_obj->data.inventory);
|
||||
length = inventory->length;
|
||||
for (int index = 0; index < length; index++) {
|
||||
|
@ -3358,7 +3362,7 @@ int partyMemberControlWindowInit()
|
|||
}
|
||||
|
||||
unsigned char* backgroundData = backgroundFrmImage.getData();
|
||||
if (backgroundData == nullptr) {
|
||||
if (backgroundData == NULL) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
}
|
||||
|
@ -3380,11 +3384,11 @@ int partyMemberControlWindowInit()
|
|||
unsigned char* windowBuffer = windowGetBuffer(gGameDialogWindow);
|
||||
unsigned char* src = windowGetBuffer(gGameDialogBackgroundWindow);
|
||||
blitBufferToBuffer(src + (GAME_DIALOG_WINDOW_WIDTH) * (GAME_DIALOG_WINDOW_HEIGHT - _dialogue_subwin_len), GAME_DIALOG_WINDOW_WIDTH, _dialogue_subwin_len, GAME_DIALOG_WINDOW_WIDTH, windowBuffer, GAME_DIALOG_WINDOW_WIDTH);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundData, windowBuffer, nullptr, _dialogue_subwin_len, 0);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundData, windowBuffer, 0, _dialogue_subwin_len, 0);
|
||||
backgroundFrmImage.unlock();
|
||||
|
||||
// TALK
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, KEY_ESCAPE, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, KEY_ESCAPE, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[0] == -1) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
|
@ -3392,7 +3396,7 @@ int partyMemberControlWindowInit()
|
|||
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
// TRADE
|
||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 593, 97, 14, 14, -1, -1, -1, KEY_LOWERCASE_D, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 593, 97, 14, 14, -1, -1, -1, KEY_LOWERCASE_D, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[1] == -1) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
|
@ -3400,7 +3404,7 @@ int partyMemberControlWindowInit()
|
|||
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
// USE BEST WEAPON
|
||||
_gdialog_buttons[2] = buttonCreate(gGameDialogWindow, 236, 15, 14, 14, -1, -1, -1, KEY_LOWERCASE_W, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[2] = buttonCreate(gGameDialogWindow, 236, 15, 14, 14, -1, -1, -1, KEY_LOWERCASE_W, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[2] == -1) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
|
@ -3408,7 +3412,7 @@ int partyMemberControlWindowInit()
|
|||
buttonSetCallbacks(_gdialog_buttons[1], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
// USE BEST ARMOR
|
||||
_gdialog_buttons[3] = buttonCreate(gGameDialogWindow, 235, 46, 14, 14, -1, -1, -1, KEY_LOWERCASE_A, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[3] = buttonCreate(gGameDialogWindow, 235, 46, 14, 14, -1, -1, -1, KEY_LOWERCASE_A, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[3] == -1) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
|
@ -3425,7 +3429,7 @@ int partyMemberControlWindowInit()
|
|||
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, buttonData->upFrmId, 0, 0, 0);
|
||||
Art* upButtonFrm = artLock(fid, &(buttonData->upFrmHandle));
|
||||
if (upButtonFrm == nullptr) {
|
||||
if (upButtonFrm == NULL) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
}
|
||||
|
@ -3436,7 +3440,7 @@ int partyMemberControlWindowInit()
|
|||
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, buttonData->downFrmId, 0, 0, 0);
|
||||
Art* downButtonFrm = artLock(fid, &(buttonData->downFrmHandle));
|
||||
if (downButtonFrm == nullptr) {
|
||||
if (downButtonFrm == NULL) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
}
|
||||
|
@ -3445,7 +3449,7 @@ int partyMemberControlWindowInit()
|
|||
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, buttonData->disabledFrmId, 0, 0, 0);
|
||||
Art* disabledButtonFrm = artLock(fid, &(buttonData->disabledFrmHandle));
|
||||
if (disabledButtonFrm == nullptr) {
|
||||
if (disabledButtonFrm == NULL) {
|
||||
partyMemberControlWindowFree();
|
||||
return -1;
|
||||
}
|
||||
|
@ -3465,7 +3469,7 @@ int partyMemberControlWindowInit()
|
|||
-1,
|
||||
upButtonFrmData,
|
||||
downButtonFrmData,
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT | BUTTON_FLAG_0x04 | BUTTON_FLAG_0x01);
|
||||
if (_gdialog_buttons[v21] == -1) {
|
||||
partyMemberControlWindowFree();
|
||||
|
@ -3511,17 +3515,17 @@ void partyMemberControlWindowFree()
|
|||
|
||||
if (buttonData->upFrmHandle) {
|
||||
artUnlock(buttonData->upFrmHandle);
|
||||
buttonData->upFrmHandle = nullptr;
|
||||
buttonData->upFrmHandle = NULL;
|
||||
}
|
||||
|
||||
if (buttonData->downFrmHandle) {
|
||||
artUnlock(buttonData->downFrmHandle);
|
||||
buttonData->downFrmHandle = nullptr;
|
||||
buttonData->downFrmHandle = NULL;
|
||||
}
|
||||
|
||||
if (buttonData->disabledFrmHandle) {
|
||||
artUnlock(buttonData->disabledFrmHandle);
|
||||
buttonData->disabledFrmHandle = nullptr;
|
||||
buttonData->disabledFrmHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3572,13 +3576,13 @@ void partyMemberControlWindowUpdate()
|
|||
|
||||
// Render item in right hand.
|
||||
Object* item2 = critterGetItem2(gGameDialogSpeaker);
|
||||
text = item2 != nullptr ? itemGetName(item2) : getmsg(&gProtoMessageList, &messageListItem, 10);
|
||||
text = item2 != NULL ? itemGetName(item2) : getmsg(&gProtoMessageList, &messageListItem, 10);
|
||||
snprintf(formattedText, sizeof(formattedText), "%s", text);
|
||||
fontDrawText(windowBuffer + windowWidth * 20 + 112, formattedText, 110, windowWidth, _colorTable[992]);
|
||||
|
||||
// Render armor.
|
||||
Object* armor = critterGetArmor(gGameDialogSpeaker);
|
||||
text = armor != nullptr ? itemGetName(armor) : getmsg(&gProtoMessageList, &messageListItem, 10);
|
||||
text = armor != NULL ? itemGetName(armor) : getmsg(&gProtoMessageList, &messageListItem, 10);
|
||||
snprintf(formattedText, sizeof(formattedText), "%s", text);
|
||||
fontDrawText(windowBuffer + windowWidth * 49 + 112, formattedText, 110, windowWidth, _colorTable[992]);
|
||||
|
||||
|
@ -3586,7 +3590,7 @@ void partyMemberControlWindowUpdate()
|
|||
CacheEntry* previewHandle;
|
||||
int previewFid = buildFid(FID_TYPE(gGameDialogSpeaker->fid), gGameDialogSpeaker->fid & 0xFFF, ANIM_STAND, (gGameDialogSpeaker->fid & 0xF000) >> 12, ROTATION_SW);
|
||||
Art* preview = artLock(previewFid, &previewHandle);
|
||||
if (preview != nullptr) {
|
||||
if (preview != NULL) {
|
||||
int width = artGetWidth(preview, 0, ROTATION_SW);
|
||||
int height = artGetHeight(preview, 0, ROTATION_SW);
|
||||
unsigned char* buffer = artGetFrameData(preview, 0, ROTATION_SW);
|
||||
|
@ -3713,8 +3717,8 @@ void partyMemberControlWindowHandleEvents()
|
|||
if (keyCode == KEY_LOWERCASE_W) {
|
||||
_inven_unwield(gGameDialogSpeaker, 1);
|
||||
|
||||
Object* weapon = _ai_search_inven_weap(gGameDialogSpeaker, 0, nullptr);
|
||||
if (weapon != nullptr) {
|
||||
Object* weapon = _ai_search_inven_weap(gGameDialogSpeaker, 0, NULL);
|
||||
if (weapon != NULL) {
|
||||
_inven_wield(gGameDialogSpeaker, weapon, 1);
|
||||
aiAttemptWeaponReload(gGameDialogSpeaker, 0);
|
||||
|
||||
|
@ -3743,7 +3747,7 @@ void partyMemberControlWindowHandleEvents()
|
|||
} else if (keyCode == KEY_LOWERCASE_A) {
|
||||
if (gGameDialogSpeaker->pid != 0x10000A1) {
|
||||
Object* armor = _ai_search_inven_armor(gGameDialogSpeaker);
|
||||
if (armor != nullptr) {
|
||||
if (armor != NULL) {
|
||||
_inven_wield(gGameDialogSpeaker, armor, 0);
|
||||
}
|
||||
}
|
||||
|
@ -3796,7 +3800,7 @@ int partyMemberCustomizationWindowInit()
|
|||
}
|
||||
|
||||
unsigned char* backgroundFrmData = backgroundFrmImage.getData();
|
||||
if (backgroundFrmData == nullptr) {
|
||||
if (backgroundFrmData == NULL) {
|
||||
// FIXME: Leaking background.
|
||||
partyMemberCustomizationWindowFree();
|
||||
return -1;
|
||||
|
@ -3826,10 +3830,10 @@ int partyMemberCustomizationWindowInit()
|
|||
windowBuffer,
|
||||
GAME_DIALOG_WINDOW_WIDTH);
|
||||
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, windowBuffer, nullptr, _dialogue_subwin_len, 0);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, windowBuffer, NULL, _dialogue_subwin_len, 0);
|
||||
backgroundFrmImage.unlock();
|
||||
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 101, 14, 14, -1, -1, -1, 13, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 101, 14, 14, -1, -1, -1, 13, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[0] == -1) {
|
||||
partyMemberCustomizationWindowFree();
|
||||
return -1;
|
||||
|
@ -3845,7 +3849,7 @@ int partyMemberCustomizationWindowInit()
|
|||
|
||||
int upButtonFid = buildFid(OBJ_TYPE_INTERFACE, buttonData->upFrmId, 0, 0, 0);
|
||||
Art* upButtonFrm = artLock(upButtonFid, &(buttonData->upFrmHandle));
|
||||
if (upButtonFrm == nullptr) {
|
||||
if (upButtonFrm == NULL) {
|
||||
partyMemberCustomizationWindowFree();
|
||||
return -1;
|
||||
}
|
||||
|
@ -3856,7 +3860,7 @@ int partyMemberCustomizationWindowInit()
|
|||
|
||||
int downButtonFid = buildFid(OBJ_TYPE_INTERFACE, buttonData->downFrmId, 0, 0, 0);
|
||||
Art* downButtonFrm = artLock(downButtonFid, &(buttonData->downFrmHandle));
|
||||
if (downButtonFrm == nullptr) {
|
||||
if (downButtonFrm == NULL) {
|
||||
partyMemberCustomizationWindowFree();
|
||||
return -1;
|
||||
}
|
||||
|
@ -3875,7 +3879,7 @@ int partyMemberCustomizationWindowInit()
|
|||
buttonData->keyCode,
|
||||
upButtonFrmData,
|
||||
downButtonFrmData,
|
||||
nullptr,
|
||||
NULL,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[optionButton] == -1) {
|
||||
partyMemberCustomizationWindowFree();
|
||||
|
@ -3914,19 +3918,19 @@ void partyMemberCustomizationWindowFree()
|
|||
for (int index = 0; index < PARTY_MEMBER_CUSTOMIZATION_OPTION_COUNT; index++) {
|
||||
GameDialogButtonData* buttonData = &(_custom_button_info[index]);
|
||||
|
||||
if (buttonData->upFrmHandle != nullptr) {
|
||||
if (buttonData->upFrmHandle != NULL) {
|
||||
artUnlock(buttonData->upFrmHandle);
|
||||
buttonData->upFrmHandle = nullptr;
|
||||
buttonData->upFrmHandle = NULL;
|
||||
}
|
||||
|
||||
if (buttonData->downFrmHandle != nullptr) {
|
||||
if (buttonData->downFrmHandle != NULL) {
|
||||
artUnlock(buttonData->downFrmHandle);
|
||||
buttonData->downFrmHandle = nullptr;
|
||||
buttonData->downFrmHandle = NULL;
|
||||
}
|
||||
|
||||
if (buttonData->disabledFrmHandle != nullptr) {
|
||||
if (buttonData->disabledFrmHandle != NULL) {
|
||||
artUnlock(buttonData->disabledFrmHandle);
|
||||
buttonData->disabledFrmHandle = nullptr;
|
||||
buttonData->disabledFrmHandle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4117,13 +4121,13 @@ int _gdCustomSelect(int a1)
|
|||
|
||||
backgroundFrmImage.unlock();
|
||||
|
||||
int btn1 = buttonCreate(win, 70, 164, 14, 14, -1, -1, -1, KEY_RETURN, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
int btn1 = buttonCreate(win, 70, 164, 14, 14, -1, -1, -1, KEY_RETURN, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (btn1 == -1) {
|
||||
windowDestroy(win);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int btn2 = buttonCreate(win, 176, 163, 14, 14, -1, -1, -1, KEY_ESCAPE, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
int btn2 = buttonCreate(win, 176, 163, 14, 14, -1, -1, -1, KEY_ESCAPE, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (btn2 == -1) {
|
||||
windowDestroy(win);
|
||||
return -1;
|
||||
|
@ -4331,7 +4335,7 @@ int _gdialog_window_create()
|
|||
}
|
||||
|
||||
unsigned char* backgroundFrmData = backgroundFrmImage.getData();
|
||||
if (backgroundFrmData != nullptr) {
|
||||
if (backgroundFrmData != NULL) {
|
||||
_dialogue_subwin_len = backgroundFrmImage.getHeight();
|
||||
|
||||
int dialogSubwindowX = (screenGetWidth() - GAME_DIALOG_WINDOW_WIDTH) / 2;
|
||||
|
@ -4346,16 +4350,16 @@ int _gdialog_window_create()
|
|||
|
||||
if (_dialogue_just_started) {
|
||||
windowRefresh(gGameDialogBackgroundWindow);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, v10, nullptr, _dialogue_subwin_len, -1);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, v10, 0, _dialogue_subwin_len, -1);
|
||||
_dialogue_just_started = 0;
|
||||
} else {
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, v10, nullptr, _dialogue_subwin_len, 0);
|
||||
_gdialog_scroll_subwin(gGameDialogWindow, 1, backgroundFrmData, v10, 0, _dialogue_subwin_len, 0);
|
||||
}
|
||||
|
||||
// BARTER/TRADE
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[0] = buttonCreate(gGameDialogWindow, 593, 41, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[0] != -1) {
|
||||
buttonSetMouseCallbacks(_gdialog_buttons[0], nullptr, nullptr, nullptr, gameDialogBarterButtonUpMouseUp);
|
||||
buttonSetMouseCallbacks(_gdialog_buttons[0], NULL, NULL, NULL, gameDialogBarterButtonUpMouseUp);
|
||||
buttonSetCallbacks(_gdialog_buttons[0], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
// di_rest1.frm - dialog rest button up
|
||||
|
@ -4365,9 +4369,9 @@ int _gdialog_window_create()
|
|||
int downFid = buildFid(OBJ_TYPE_INTERFACE, 98, 0, 0, 0);
|
||||
if (_reviewButtonPressedFrmImage.lock(downFid)) {
|
||||
// REVIEW
|
||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 13, 154, 51, 29, -1, -1, -1, -1, _reviewButtonNormalFrmImage.getData(), _reviewButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
_gdialog_buttons[1] = buttonCreate(gGameDialogWindow, 13, 154, 51, 29, -1, -1, -1, -1, _reviewButtonNormalFrmImage.getData(), _reviewButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (_gdialog_buttons[1] != -1) {
|
||||
buttonSetMouseCallbacks(_gdialog_buttons[1], nullptr, nullptr, nullptr, gameDialogReviewButtonOnMouseUp);
|
||||
buttonSetMouseCallbacks(_gdialog_buttons[1], NULL, NULL, NULL, gameDialogReviewButtonOnMouseUp);
|
||||
buttonSetCallbacks(_gdialog_buttons[1], _gsound_red_butt_press, _gsound_red_butt_release);
|
||||
|
||||
if (!gGameDialogSpeakerIsPartyMember) {
|
||||
|
@ -4376,9 +4380,9 @@ int _gdialog_window_create()
|
|||
}
|
||||
|
||||
// COMBAT CONTROL
|
||||
_gdialog_buttons[2] = buttonCreate(gGameDialogWindow, 593, 116, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
_gdialog_buttons[2] = buttonCreate(gGameDialogWindow, 593, 116, 14, 14, -1, -1, -1, -1, _redButtonNormalFrmImage.getData(), _redButtonPressedFrmImage.getData(), 0, BUTTON_FLAG_TRANSPARENT);
|
||||
if (_gdialog_buttons[2] != -1) {
|
||||
buttonSetMouseCallbacks(_gdialog_buttons[2], nullptr, nullptr, nullptr, gameDialogCombatControlButtonOnMouseUp);
|
||||
buttonSetMouseCallbacks(_gdialog_buttons[2], NULL, NULL, NULL, gameDialogCombatControlButtonOnMouseUp);
|
||||
buttonSetCallbacks(_gdialog_buttons[2], _gsound_med_butt_press, _gsound_med_butt_release);
|
||||
|
||||
_gdialog_window_created = true;
|
||||
|
@ -4550,7 +4554,7 @@ void gameDialogRenderTalkingHead(Art* headFrm, int frame)
|
|||
return;
|
||||
}
|
||||
|
||||
if (headFrm != nullptr) {
|
||||
if (headFrm != NULL) {
|
||||
if (frame == 0) {
|
||||
_totalHotx = 0;
|
||||
}
|
||||
|
@ -4562,7 +4566,7 @@ void gameDialogRenderTalkingHead(Art* headFrm, int frame)
|
|||
}
|
||||
|
||||
unsigned char* backgroundFrmData = backgroundFrmImage.getData();
|
||||
if (backgroundFrmData != nullptr) {
|
||||
if (backgroundFrmData != NULL) {
|
||||
blitBufferToBuffer(backgroundFrmData, 388, 200, 388, gGameDialogDisplayBuffer, GAME_DIALOG_WINDOW_WIDTH);
|
||||
} else {
|
||||
debugPrint("\tError getting background data in display...\n");
|
||||
|
@ -4583,7 +4587,7 @@ void gameDialogRenderTalkingHead(Art* headFrm, int frame)
|
|||
_totalHotx += a4;
|
||||
a3 += _totalHotx;
|
||||
|
||||
if (data != nullptr) {
|
||||
if (data != NULL) {
|
||||
int destWidth = GAME_DIALOG_WINDOW_WIDTH;
|
||||
int destOffset = destWidth * (200 - height) + a3 + (388 - width) / 2;
|
||||
if (destOffset + width * v8 > 0) {
|
||||
|
|
|
@ -104,7 +104,7 @@ static unsigned int _gmouse_3d_last_move_time = 0;
|
|||
|
||||
// actmenu.frm
|
||||
// 0x518C8C
|
||||
static Art* gGameMouseActionMenuFrm = nullptr;
|
||||
static Art* gGameMouseActionMenuFrm = NULL;
|
||||
|
||||
// 0x518C90
|
||||
static CacheEntry* gGameMouseActionMenuFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
@ -125,11 +125,11 @@ static int _gmouse_3d_menu_frame_hot_x = 0;
|
|||
static int _gmouse_3d_menu_frame_hot_y = 0;
|
||||
|
||||
// 0x518CA8
|
||||
static unsigned char* gGameMouseActionMenuFrmData = nullptr;
|
||||
static unsigned char* gGameMouseActionMenuFrmData = NULL;
|
||||
|
||||
// actpick.frm
|
||||
// 0x518CAC
|
||||
static Art* gGameMouseActionPickFrm = nullptr;
|
||||
static Art* gGameMouseActionPickFrm = NULL;
|
||||
|
||||
// 0x518CB0
|
||||
static CacheEntry* gGameMouseActionPickFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
@ -150,11 +150,11 @@ static int _gmouse_3d_pick_frame_hot_x = 0;
|
|||
static int _gmouse_3d_pick_frame_hot_y = 0;
|
||||
|
||||
// 0x518CC8
|
||||
static unsigned char* gGameMouseActionPickFrmData = nullptr;
|
||||
static unsigned char* gGameMouseActionPickFrmData = NULL;
|
||||
|
||||
// acttohit.frm
|
||||
// 0x518CCC
|
||||
static Art* gGameMouseActionHitFrm = nullptr;
|
||||
static Art* gGameMouseActionHitFrm = NULL;
|
||||
|
||||
// 0x518CD0
|
||||
static CacheEntry* gGameMouseActionHitFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
@ -169,11 +169,11 @@ static int gGameMouseActionHitFrmHeight = 0;
|
|||
static int gGameMouseActionHitFrmDataSize = 0;
|
||||
|
||||
// 0x518CE0
|
||||
static unsigned char* gGameMouseActionHitFrmData = nullptr;
|
||||
static unsigned char* gGameMouseActionHitFrmData = NULL;
|
||||
|
||||
// blank.frm
|
||||
// 0x518CE4
|
||||
static Art* gGameMouseBouncingCursorFrm = nullptr;
|
||||
static Art* gGameMouseBouncingCursorFrm = NULL;
|
||||
|
||||
// 0x518CE8
|
||||
static CacheEntry* gGameMouseBouncingCursorFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
@ -188,11 +188,11 @@ static int gGameMouseBouncingCursorFrmHeight = 0;
|
|||
static int gGameMouseBouncingCursorFrmDataSize = 0;
|
||||
|
||||
// 0x518CF8
|
||||
static unsigned char* gGameMouseBouncingCursorFrmData = nullptr;
|
||||
static unsigned char* gGameMouseBouncingCursorFrmData = NULL;
|
||||
|
||||
// msef000.frm
|
||||
// 0x518CFC
|
||||
static Art* gGameMouseHexCursorFrm = nullptr;
|
||||
static Art* gGameMouseHexCursorFrm = NULL;
|
||||
|
||||
// 0x518D00
|
||||
static CacheEntry* gGameMouseHexCursorFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
@ -207,13 +207,13 @@ static int gGameMouseHexCursorHeight = 0;
|
|||
static int gGameMouseHexCursorDataSize = 0;
|
||||
|
||||
// 0x518D10
|
||||
static unsigned char* gGameMouseHexCursorFrmData = nullptr;
|
||||
static unsigned char* gGameMouseHexCursorFrmData = NULL;
|
||||
|
||||
// 0x518D14
|
||||
static unsigned char gGameMouseActionMenuItemsLength = 0;
|
||||
|
||||
// 0x518D18
|
||||
static unsigned char* _gmouse_3d_menu_actions_start = nullptr;
|
||||
static unsigned char* _gmouse_3d_menu_actions_start = NULL;
|
||||
|
||||
// 0x518D1C
|
||||
static unsigned char gGameMouseActionMenuHighlightedItemIndex = 0;
|
||||
|
@ -277,7 +277,7 @@ static int _gmouse_bk_last_cursor = -1;
|
|||
static bool gGameMouseItemHighlightEnabled = true;
|
||||
|
||||
// 0x518D94
|
||||
static Object* gGameMouseHighlightedItem = nullptr;
|
||||
static Object* gGameMouseHighlightedItem = NULL;
|
||||
|
||||
// 0x518D98
|
||||
bool _gmouse_clicked_on_edge = false;
|
||||
|
@ -380,7 +380,7 @@ void gameMouseExit()
|
|||
|
||||
mouseHideCursor();
|
||||
|
||||
mouseSetFrame(nullptr, 0, 0, 0, 0, 0, 0);
|
||||
mouseSetFrame(NULL, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
// NOTE: Uninline.
|
||||
gameMouseObjectsFree();
|
||||
|
@ -669,7 +669,7 @@ void gameMouseRefresh()
|
|||
_gmouse_3d_hover_test = true;
|
||||
|
||||
Object* pointedObject = gameMouseGetObjectUnderCursor(-1, true, gElevation);
|
||||
if (pointedObject != nullptr) {
|
||||
if (pointedObject != NULL) {
|
||||
int primaryAction = -1;
|
||||
|
||||
switch (FID_TYPE(pointedObject->fid)) {
|
||||
|
@ -732,14 +732,14 @@ void gameMouseRefresh()
|
|||
}
|
||||
} else if (gGameMouseMode == GAME_MOUSE_MODE_CROSSHAIR) {
|
||||
Object* pointedObject = gameMouseGetObjectUnderCursor(OBJ_TYPE_CRITTER, false, gElevation);
|
||||
if (pointedObject == nullptr) {
|
||||
if (pointedObject == NULL) {
|
||||
pointedObject = gameMouseGetObjectUnderCursor(-1, false, gElevation);
|
||||
if (!objectIsDoor(pointedObject)) {
|
||||
pointedObject = nullptr;
|
||||
pointedObject = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (pointedObject != nullptr) {
|
||||
if (pointedObject != NULL) {
|
||||
bool pointedObjectIsCritter = FID_TYPE(pointedObject->fid) == OBJ_TYPE_CRITTER;
|
||||
|
||||
if (settings.preferences.combat_looks) {
|
||||
|
@ -804,7 +804,7 @@ void gameMouseRefresh()
|
|||
|
||||
char formattedActionPoints[8];
|
||||
int color;
|
||||
int distance = _make_path(gDude, gDude->tile, gGameMouseHexCursor->tile, nullptr, 1);
|
||||
int distance = _make_path(gDude, gDude->tile, gGameMouseHexCursor->tile, NULL, 1);
|
||||
if (distance != 0) {
|
||||
if (!isInCombat()) {
|
||||
formattedActionPoints[0] = '\0';
|
||||
|
@ -856,11 +856,11 @@ void gameMouseRefresh()
|
|||
v34 |= 1;
|
||||
}
|
||||
|
||||
if (gGameMouseHighlightedItem != nullptr) {
|
||||
if (gGameMouseHighlightedItem != NULL) {
|
||||
if (objectClearOutline(gGameMouseHighlightedItem, &r26) == 0) {
|
||||
v34 |= 2;
|
||||
}
|
||||
gGameMouseHighlightedItem = nullptr;
|
||||
gGameMouseHighlightedItem = NULL;
|
||||
}
|
||||
|
||||
switch (v34) {
|
||||
|
@ -951,7 +951,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
|
|||
|
||||
if (gGameMouseMode == GAME_MOUSE_MODE_ARROW) {
|
||||
Object* v5 = gameMouseGetObjectUnderCursor(-1, true, gElevation);
|
||||
if (v5 != nullptr) {
|
||||
if (v5 != NULL) {
|
||||
switch (FID_TYPE(v5->fid)) {
|
||||
case OBJ_TYPE_ITEM:
|
||||
actionPickUp(gDude, v5);
|
||||
|
@ -999,14 +999,14 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
|
|||
|
||||
if (gGameMouseMode == GAME_MOUSE_MODE_CROSSHAIR) {
|
||||
Object* v7 = gameMouseGetObjectUnderCursor(OBJ_TYPE_CRITTER, false, gElevation);
|
||||
if (v7 == nullptr) {
|
||||
if (v7 == NULL) {
|
||||
v7 = gameMouseGetObjectUnderCursor(-1, false, gElevation);
|
||||
if (!objectIsDoor(v7)) {
|
||||
v7 = nullptr;
|
||||
v7 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (v7 != nullptr) {
|
||||
if (v7 != NULL) {
|
||||
_combat_attack_this(v7);
|
||||
_gmouse_3d_hover_test = true;
|
||||
gGameMouseLastY = mouseY;
|
||||
|
@ -1018,7 +1018,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
|
|||
|
||||
if (gGameMouseMode == GAME_MOUSE_MODE_USE_CROSSHAIR) {
|
||||
Object* object = gameMouseGetObjectUnderCursor(-1, true, gElevation);
|
||||
if (object != nullptr) {
|
||||
if (object != NULL) {
|
||||
Object* weapon;
|
||||
if (interfaceGetActiveItem(&weapon) != -1) {
|
||||
if (isInCombat()) {
|
||||
|
@ -1056,7 +1056,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
|
|||
|| gGameMouseMode == GAME_MOUSE_MODE_USE_SCIENCE
|
||||
|| gGameMouseMode == GAME_MOUSE_MODE_USE_REPAIR) {
|
||||
Object* object = gameMouseGetObjectUnderCursor(-1, 1, gElevation);
|
||||
if (object == nullptr || actionUseSkill(gDude, object, gGameMouseModeSkills[gGameMouseMode - FIRST_GAME_MOUSE_MODE_SKILL]) != -1) {
|
||||
if (object == NULL || actionUseSkill(gDude, object, gGameMouseModeSkills[gGameMouseMode - FIRST_GAME_MOUSE_MODE_SKILL]) != -1) {
|
||||
gameMouseSetCursor(MOUSE_CURSOR_NONE);
|
||||
gameMouseSetMode(GAME_MOUSE_MODE_MOVE);
|
||||
}
|
||||
|
@ -1066,7 +1066,7 @@ void _gmouse_handle_event(int mouseX, int mouseY, int mouseState)
|
|||
|
||||
if ((mouseState & MOUSE_EVENT_LEFT_BUTTON_DOWN_REPEAT) == MOUSE_EVENT_LEFT_BUTTON_DOWN_REPEAT && gGameMouseMode == GAME_MOUSE_MODE_ARROW) {
|
||||
Object* v16 = gameMouseGetObjectUnderCursor(-1, true, gElevation);
|
||||
if (v16 != nullptr) {
|
||||
if (v16 != NULL) {
|
||||
int actionMenuItemsCount = 0;
|
||||
int actionMenuItems[6];
|
||||
switch (FID_TYPE(v16->fid)) {
|
||||
|
@ -1266,7 +1266,7 @@ int gameMouseSetCursor(int cursor)
|
|||
CacheEntry* mouseCursorFrmHandle;
|
||||
int fid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseCursorFrmIds[cursor], 0, 0, 0);
|
||||
Art* mouseCursorFrm = artLock(fid, &mouseCursorFrmHandle);
|
||||
if (mouseCursorFrm == nullptr) {
|
||||
if (mouseCursorFrm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1328,12 +1328,6 @@ int gameMouseGetCursor()
|
|||
return gGameMouseCursor;
|
||||
}
|
||||
|
||||
// 0x44C9F0
|
||||
void gmouse_set_mapper_mode(int mode)
|
||||
{
|
||||
_gmouse_mapper_mode = mode;
|
||||
}
|
||||
|
||||
// 0x44C9F8
|
||||
void _gmouse_3d_enable_modes()
|
||||
{
|
||||
|
@ -1426,7 +1420,7 @@ void gameMouseCycleMode()
|
|||
if (isInCombat()) {
|
||||
Object* item;
|
||||
if (interfaceGetActiveItem(&item) == 0) {
|
||||
if (item != nullptr && itemGetType(item) != ITEM_TYPE_WEAPON && mode == GAME_MOUSE_MODE_CROSSHAIR) {
|
||||
if (item != NULL && itemGetType(item) != ITEM_TYPE_WEAPON && mode == GAME_MOUSE_MODE_CROSSHAIR) {
|
||||
mode = GAME_MOUSE_MODE_MOVE;
|
||||
}
|
||||
}
|
||||
|
@ -1465,7 +1459,7 @@ int gameMouseSetBouncingCursorFid(int fid)
|
|||
}
|
||||
|
||||
if (!_gmouse_mapper_mode) {
|
||||
return objectSetFid(gGameMouseBouncingCursor, fid, nullptr);
|
||||
return objectSetFid(gGameMouseBouncingCursor, fid, NULL);
|
||||
}
|
||||
|
||||
int v1 = 0;
|
||||
|
@ -1620,7 +1614,7 @@ Object* gameMouseGetObjectUnderCursor(int objectType, bool a2, int elevation)
|
|||
}
|
||||
}
|
||||
|
||||
Object* v4 = nullptr;
|
||||
Object* v4 = NULL;
|
||||
if (!v13) {
|
||||
ObjectWithFlags* entries;
|
||||
int count = _obj_create_intersect_list(mouseX, mouseY, elevation, objectType, &entries);
|
||||
|
@ -1651,14 +1645,14 @@ int gameMouseRenderPrimaryAction(int x, int y, int menuItem, int width, int heig
|
|||
CacheEntry* menuItemFrmHandle;
|
||||
int menuItemFid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseActionMenuItemFrmIds[menuItem], 0, 0, 0);
|
||||
Art* menuItemFrm = artLock(menuItemFid, &menuItemFrmHandle);
|
||||
if (menuItemFrm == nullptr) {
|
||||
if (menuItemFrm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
CacheEntry* arrowFrmHandle;
|
||||
int arrowFid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseModeFrmIds[GAME_MOUSE_MODE_ARROW], 0, 0, 0);
|
||||
Art* arrowFrm = artLock(arrowFid, &arrowFrmHandle);
|
||||
if (arrowFrm == nullptr) {
|
||||
if (arrowFrm == NULL) {
|
||||
artUnlock(menuItemFrmHandle);
|
||||
// FIXME: Why this is success?
|
||||
return 0;
|
||||
|
@ -1733,11 +1727,11 @@ int _gmouse_3d_pick_frame_hot(int* a1, int* a2)
|
|||
// 0x44D214
|
||||
int gameMouseRenderActionMenuItems(int x, int y, const int* menuItems, int menuItemsLength, int width, int height)
|
||||
{
|
||||
_gmouse_3d_menu_actions_start = nullptr;
|
||||
_gmouse_3d_menu_actions_start = NULL;
|
||||
gGameMouseActionMenuHighlightedItemIndex = 0;
|
||||
gGameMouseActionMenuItemsLength = 0;
|
||||
|
||||
if (menuItems == nullptr) {
|
||||
if (menuItems == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1757,7 +1751,7 @@ int gameMouseRenderActionMenuItems(int x, int y, const int* menuItems, int menuI
|
|||
int fid = buildFid(OBJ_TYPE_INTERFACE, frmId, 0, 0, 0);
|
||||
|
||||
menuItemFrms[index] = artLock(fid, &(menuItemFrmHandles[index]));
|
||||
if (menuItemFrms[index] == nullptr) {
|
||||
if (menuItemFrms[index] == NULL) {
|
||||
while (--index >= 0) {
|
||||
artUnlock(menuItemFrmHandles[index]);
|
||||
}
|
||||
|
@ -1768,7 +1762,7 @@ int gameMouseRenderActionMenuItems(int x, int y, const int* menuItems, int menuI
|
|||
int fid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseModeFrmIds[GAME_MOUSE_MODE_ARROW], 0, 0, 0);
|
||||
CacheEntry* arrowFrmHandle;
|
||||
Art* arrowFrm = artLock(fid, &arrowFrmHandle);
|
||||
if (arrowFrm == nullptr) {
|
||||
if (arrowFrm == NULL) {
|
||||
// FIXME: Unlock arts.
|
||||
return -1;
|
||||
}
|
||||
|
@ -1833,8 +1827,8 @@ int gameMouseRenderActionMenuItems(int x, int y, const int* menuItems, int menuI
|
|||
gGameMouseActionMenuItemsLength = menuItemsLength;
|
||||
_gmouse_3d_menu_actions_start = v58;
|
||||
|
||||
Sound* sound = soundEffectLoad("iaccuxx1", nullptr);
|
||||
if (sound != nullptr) {
|
||||
Sound* sound = soundEffectLoad("iaccuxx1", NULL);
|
||||
if (sound != NULL) {
|
||||
soundEffectPlay(sound);
|
||||
}
|
||||
|
||||
|
@ -1851,7 +1845,7 @@ int gameMouseHighlightActionMenuItemAtIndex(int menuItemIndex)
|
|||
CacheEntry* handle;
|
||||
int fid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseActionMenuItemFrmIds[gGameMouseActionMenuItems[gGameMouseActionMenuHighlightedItemIndex]], 0, 0, 0);
|
||||
Art* art = artLock(fid, &handle);
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1863,7 +1857,7 @@ int gameMouseHighlightActionMenuItemAtIndex(int menuItemIndex)
|
|||
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseActionMenuItemFrmIds[gGameMouseActionMenuItems[menuItemIndex]] - 1, 0, 0, 0);
|
||||
art = artLock(fid, &handle);
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1882,7 +1876,7 @@ int gameMouseRenderAccuracy(const char* string, int color)
|
|||
CacheEntry* crosshairFrmHandle;
|
||||
int fid = buildFid(OBJ_TYPE_INTERFACE, gGameMouseModeFrmIds[GAME_MOUSE_MODE_CROSSHAIR], 0, 0, 0);
|
||||
Art* crosshairFrm = artLock(fid, &crosshairFrmHandle);
|
||||
if (crosshairFrm == nullptr) {
|
||||
if (crosshairFrm == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1970,7 +1964,7 @@ int gameMouseObjectsInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (objectSetOutline(gGameMouseHexCursor, OUTLINE_PALETTED | OUTLINE_TYPE_2, nullptr) != 0) {
|
||||
if (objectSetOutline(gGameMouseHexCursor, OUTLINE_PALETTED | OUTLINE_TYPE_2, NULL) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1990,7 +1984,7 @@ int gameMouseObjectsInit()
|
|||
gGameMouseHexCursor->flags |= OBJECT_SHOOT_THRU;
|
||||
gGameMouseHexCursor->flags |= OBJECT_NO_BLOCK;
|
||||
|
||||
_obj_toggle_flat(gGameMouseHexCursor, nullptr);
|
||||
_obj_toggle_flat(gGameMouseHexCursor, NULL);
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
@ -2044,8 +2038,8 @@ void gameMouseObjectsFree()
|
|||
gGameMouseBouncingCursor->flags &= ~OBJECT_NO_SAVE;
|
||||
gGameMouseHexCursor->flags &= ~OBJECT_NO_SAVE;
|
||||
|
||||
objectDestroy(gGameMouseBouncingCursor, nullptr);
|
||||
objectDestroy(gGameMouseHexCursor, nullptr);
|
||||
objectDestroy(gGameMouseBouncingCursor, NULL);
|
||||
objectDestroy(gGameMouseHexCursor, NULL);
|
||||
|
||||
gGameMouseObjectsInitialized = false;
|
||||
}
|
||||
|
@ -2059,35 +2053,35 @@ int gameMouseActionMenuInit()
|
|||
// actmenu.frm - action menu
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, 283, 0, 0, 0);
|
||||
gGameMouseActionMenuFrm = artLock(fid, &gGameMouseActionMenuFrmHandle);
|
||||
if (gGameMouseActionMenuFrm == nullptr) {
|
||||
if (gGameMouseActionMenuFrm == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// actpick.frm - action pick
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, 282, 0, 0, 0);
|
||||
gGameMouseActionPickFrm = artLock(fid, &gGameMouseActionPickFrmHandle);
|
||||
if (gGameMouseActionPickFrm == nullptr) {
|
||||
if (gGameMouseActionPickFrm == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// acttohit.frm - action to hit
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, 284, 0, 0, 0);
|
||||
gGameMouseActionHitFrm = artLock(fid, &gGameMouseActionHitFrmHandle);
|
||||
if (gGameMouseActionHitFrm == nullptr) {
|
||||
if (gGameMouseActionHitFrm == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// blank.frm - used be mset000.frm for top of bouncing mouse cursor
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, 0, 0, 0, 0);
|
||||
gGameMouseBouncingCursorFrm = artLock(fid, &gGameMouseBouncingCursorFrmHandle);
|
||||
if (gGameMouseBouncingCursorFrm == nullptr) {
|
||||
if (gGameMouseBouncingCursorFrm == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
// msef000.frm - hex mouse cursor
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, 1, 0, 0, 0);
|
||||
gGameMouseHexCursorFrm = artLock(fid, &gGameMouseHexCursorFrmHandle);
|
||||
if (gGameMouseHexCursorFrm == nullptr) {
|
||||
if (gGameMouseHexCursorFrm == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -2134,35 +2128,35 @@ void gameMouseActionMenuFree()
|
|||
if (gGameMouseBouncingCursorFrmHandle != INVALID_CACHE_ENTRY) {
|
||||
artUnlock(gGameMouseBouncingCursorFrmHandle);
|
||||
}
|
||||
gGameMouseBouncingCursorFrm = nullptr;
|
||||
gGameMouseBouncingCursorFrm = NULL;
|
||||
gGameMouseBouncingCursorFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
||||
if (gGameMouseHexCursorFrmHandle != INVALID_CACHE_ENTRY) {
|
||||
artUnlock(gGameMouseHexCursorFrmHandle);
|
||||
}
|
||||
gGameMouseHexCursorFrm = nullptr;
|
||||
gGameMouseHexCursorFrm = NULL;
|
||||
gGameMouseHexCursorFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
||||
if (gGameMouseActionHitFrmHandle != INVALID_CACHE_ENTRY) {
|
||||
artUnlock(gGameMouseActionHitFrmHandle);
|
||||
}
|
||||
gGameMouseActionHitFrm = nullptr;
|
||||
gGameMouseActionHitFrm = NULL;
|
||||
gGameMouseActionHitFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
||||
if (gGameMouseActionMenuFrmHandle != INVALID_CACHE_ENTRY) {
|
||||
artUnlock(gGameMouseActionMenuFrmHandle);
|
||||
}
|
||||
gGameMouseActionMenuFrm = nullptr;
|
||||
gGameMouseActionMenuFrm = NULL;
|
||||
gGameMouseActionMenuFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
||||
if (gGameMouseActionPickFrmHandle != INVALID_CACHE_ENTRY) {
|
||||
artUnlock(gGameMouseActionPickFrmHandle);
|
||||
}
|
||||
|
||||
gGameMouseActionPickFrm = nullptr;
|
||||
gGameMouseActionPickFrm = NULL;
|
||||
gGameMouseActionPickFrmHandle = INVALID_CACHE_ENTRY;
|
||||
|
||||
gGameMouseActionPickFrmData = nullptr;
|
||||
gGameMouseActionPickFrmData = NULL;
|
||||
gGameMouseActionPickFrmWidth = 0;
|
||||
gGameMouseActionPickFrmHeight = 0;
|
||||
gGameMouseActionPickFrmDataSize = 0;
|
||||
|
@ -2201,7 +2195,7 @@ int _gmouse_3d_move_to(int x, int y, int elevation, Rect* a4)
|
|||
int offsetY = 0;
|
||||
CacheEntry* hexCursorFrmHandle;
|
||||
Art* hexCursorFrm = artLock(gGameMouseHexCursor->fid, &hexCursorFrmHandle);
|
||||
if (hexCursorFrm != nullptr) {
|
||||
if (hexCursorFrm != NULL) {
|
||||
artGetRotationOffsets(hexCursorFrm, 0, &offsetX, &offsetY);
|
||||
|
||||
int frameOffsetX;
|
||||
|
@ -2290,7 +2284,7 @@ int _gmouse_3d_move_to(int x, int y, int elevation, Rect* a4)
|
|||
int offsetY = 0;
|
||||
CacheEntry* hexCursorFrmHandle;
|
||||
Art* hexCursorFrm = artLock(gGameMouseHexCursor->fid, &hexCursorFrmHandle);
|
||||
if (hexCursorFrm != nullptr) {
|
||||
if (hexCursorFrm != NULL) {
|
||||
artGetRotationOffsets(hexCursorFrm, 0, &offsetX, &offsetY);
|
||||
|
||||
int frameOffsetX;
|
||||
|
@ -2419,19 +2413,19 @@ int gameMouseHandleScrolling(int x, int y, int cursor)
|
|||
// 0x44E544
|
||||
void _gmouse_remove_item_outline(Object* object)
|
||||
{
|
||||
if (gGameMouseHighlightedItem != nullptr && gGameMouseHighlightedItem == object) {
|
||||
if (gGameMouseHighlightedItem != NULL && gGameMouseHighlightedItem == object) {
|
||||
Rect rect;
|
||||
if (objectClearOutline(object, &rect) == 0) {
|
||||
tileWindowRefreshRect(&rect, gElevation);
|
||||
}
|
||||
gGameMouseHighlightedItem = nullptr;
|
||||
gGameMouseHighlightedItem = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x44E580
|
||||
int objectIsDoor(Object* object)
|
||||
{
|
||||
if (object == nullptr) {
|
||||
if (object == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2464,9 +2458,4 @@ void gameMouseRefreshImmediately()
|
|||
renderPresent();
|
||||
}
|
||||
|
||||
Object* gmouse_get_outlined_object()
|
||||
{
|
||||
return gGameMouseHighlightedItem;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -86,7 +86,6 @@ void gameMouseRefresh();
|
|||
void _gmouse_handle_event(int mouseX, int mouseY, int mouseState);
|
||||
int gameMouseSetCursor(int cursor);
|
||||
int gameMouseGetCursor();
|
||||
void gmouse_set_mapper_mode(int mode);
|
||||
void gameMouseSetMode(int a1);
|
||||
int gameMouseGetMode();
|
||||
void gameMouseCycleMode();
|
||||
|
@ -103,7 +102,6 @@ void gameMouseLoadItemHighlight();
|
|||
void _gmouse_remove_item_outline(Object* object);
|
||||
|
||||
void gameMouseRefreshImmediately();
|
||||
Object* gmouse_get_outlined_object();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
|
|
|
@ -54,18 +54,18 @@ static const char* gMovieFileNames[MOVIE_COUNT] = {
|
|||
|
||||
// 0x518DE4
|
||||
static const char* gMoviePaletteFilePaths[MOVIE_COUNT] = {
|
||||
nullptr,
|
||||
NULL,
|
||||
"art\\cuts\\introsub.pal",
|
||||
"art\\cuts\\eldersub.pal",
|
||||
nullptr,
|
||||
NULL,
|
||||
"art\\cuts\\artmrsub.pal",
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"art\\cuts\\artmrsub.pal",
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
"art\\cuts\\artmrsub.pal",
|
||||
"art\\cuts\\artmrsub.pal",
|
||||
"art\\cuts\\artmrsub.pal",
|
||||
|
@ -210,7 +210,7 @@ int gameMoviePlay(int movie, int flags)
|
|||
int oldFont;
|
||||
if (subtitlesEnabled) {
|
||||
const char* subtitlesPaletteFilePath;
|
||||
if (gMoviePaletteFilePaths[movie] != nullptr) {
|
||||
if (gMoviePaletteFilePaths[movie] != NULL) {
|
||||
subtitlesPaletteFilePath = gMoviePaletteFilePaths[movie];
|
||||
} else {
|
||||
subtitlesPaletteFilePath = "art\\cuts\\subtitle.pal";
|
||||
|
@ -338,7 +338,7 @@ static char* gameMovieBuildSubtitlesFilePath(char* movieFilePath)
|
|||
char* path = movieFilePath;
|
||||
|
||||
char* separator = strrchr(path, '\\');
|
||||
if (separator != nullptr) {
|
||||
if (separator != NULL) {
|
||||
path = separator + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,16 +68,16 @@ static bool gSoundEffectsEnabled = false;
|
|||
static int _gsound_active_effect_counter;
|
||||
|
||||
// 0x518E50
|
||||
static Sound* gBackgroundSound = nullptr;
|
||||
static Sound* gBackgroundSound = NULL;
|
||||
|
||||
// 0x518E54
|
||||
static Sound* gSpeechSound = nullptr;
|
||||
static Sound* gSpeechSound = NULL;
|
||||
|
||||
// 0x518E58
|
||||
static SoundEndCallback* gBackgroundSoundEndCallback = nullptr;
|
||||
static SoundEndCallback* gBackgroundSoundEndCallback = NULL;
|
||||
|
||||
// 0x518E5C
|
||||
static SoundEndCallback* gSpeechEndCallback = nullptr;
|
||||
static SoundEndCallback* gSpeechEndCallback = NULL;
|
||||
|
||||
// 0x518E60
|
||||
static char _snd_lookup_weapon_type[WEAPON_SOUND_EFFECT_COUNT] = {
|
||||
|
@ -547,7 +547,7 @@ void backgroundSoundSetVolume(int volume)
|
|||
}
|
||||
|
||||
if (gMusicEnabled) {
|
||||
if (gBackgroundSound != nullptr) {
|
||||
if (gBackgroundSound != NULL) {
|
||||
soundSetVolume(gBackgroundSound, (int)(gMusicVolume * 0.94));
|
||||
}
|
||||
}
|
||||
|
@ -621,18 +621,18 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
debugPrint("failed because sound could not be allocated.\n");
|
||||
}
|
||||
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = soundSetFileIO(gBackgroundSound, audioFileOpen, audioFileClose, audioFileRead, nullptr, audioFileSeek, gameSoundFileTellNotImplemented, audioFileGetSize);
|
||||
rc = soundSetFileIO(gBackgroundSound, audioFileOpen, audioFileClose, audioFileRead, NULL, audioFileSeek, gameSoundFileTellNotImplemented, audioFileGetSize);
|
||||
if (rc != 0) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("failed because file IO could not be set for compression.\n");
|
||||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -644,7 +644,7 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -675,13 +675,13 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
rc = soundSetCallback(gBackgroundSound, backgroundSoundCallback, nullptr);
|
||||
rc = soundSetCallback(gBackgroundSound, backgroundSoundCallback, NULL);
|
||||
if (rc != SOUND_NO_ERROR) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("soundSetCallback failed for background sound\n");
|
||||
|
@ -704,7 +704,7 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ int backgroundSoundLoad(const char* fileName, int a2, int a3, int a4)
|
|||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -753,13 +753,13 @@ void backgroundSoundDelete()
|
|||
if (gGameSoundInitialized && gMusicEnabled && gBackgroundSound) {
|
||||
if (_gsound_background_fade) {
|
||||
if (_soundFade(gBackgroundSound, 2000, 0) == 0) {
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
soundDelete(gBackgroundSound);
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -777,7 +777,7 @@ void backgroundSoundRestart(int value)
|
|||
// 0x450B50
|
||||
void backgroundSoundPause()
|
||||
{
|
||||
if (gBackgroundSound != nullptr) {
|
||||
if (gBackgroundSound != NULL) {
|
||||
soundPause(gBackgroundSound);
|
||||
}
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ void backgroundSoundPause()
|
|||
// 0x450B64
|
||||
void backgroundSoundResume()
|
||||
{
|
||||
if (gBackgroundSound != nullptr) {
|
||||
if (gBackgroundSound != NULL) {
|
||||
soundResume(gBackgroundSound);
|
||||
}
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ void speechSetVolume(int volume)
|
|||
gSpeechVolume = volume;
|
||||
|
||||
if (gSpeechEnabled) {
|
||||
if (gSpeechSound != nullptr) {
|
||||
if (gSpeechSound != NULL) {
|
||||
soundSetVolume(gSpeechSound, (int)(volume * 0.69));
|
||||
}
|
||||
}
|
||||
|
@ -894,16 +894,16 @@ int speechLoad(const char* fname, int a2, int a3, int a4)
|
|||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("failed because sound could not be allocated.\n");
|
||||
}
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (soundSetFileIO(gSpeechSound, audioOpen, audioClose, audioRead, nullptr, audioSeek, gameSoundFileTellNotImplemented, audioGetSize)) {
|
||||
if (soundSetFileIO(gSpeechSound, audioOpen, audioClose, audioRead, NULL, audioSeek, gameSoundFileTellNotImplemented, audioGetSize)) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("failed because file IO could not be set for compression.\n");
|
||||
}
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -912,7 +912,7 @@ int speechLoad(const char* fname, int a2, int a3, int a4)
|
|||
debugPrint("failed because the file could not be found.\n");
|
||||
}
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -922,12 +922,12 @@ int speechLoad(const char* fname, int a2, int a3, int a4)
|
|||
debugPrint("failed because looping could not be set.\n");
|
||||
}
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (soundSetCallback(gSpeechSound, speechCallback, nullptr)) {
|
||||
if (soundSetCallback(gSpeechSound, speechCallback, NULL)) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("soundSetCallback failed for speech sound\n");
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ int speechLoad(const char* fname, int a2, int a3, int a4)
|
|||
debugPrint("failed on call to soundLoad.\n");
|
||||
}
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -967,7 +967,7 @@ int speechLoad(const char* fname, int a2, int a3, int a4)
|
|||
debugPrint("failed starting to play.\n");
|
||||
}
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -989,7 +989,7 @@ int _gsound_speech_play_preloaded()
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (gSpeechSound == nullptr) {
|
||||
if (gSpeechSound == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ int _gsound_speech_play_preloaded()
|
|||
|
||||
if (speechPlay() != 0) {
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -1019,9 +1019,9 @@ int _gsound_speech_play_preloaded()
|
|||
void speechDelete()
|
||||
{
|
||||
if (gGameSoundInitialized && gSpeechEnabled) {
|
||||
if (gSpeechSound != nullptr) {
|
||||
if (gSpeechSound != NULL) {
|
||||
soundDelete(gSpeechSound);
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1029,7 +1029,7 @@ void speechDelete()
|
|||
// 0x451054
|
||||
void speechPause()
|
||||
{
|
||||
if (gSpeechSound != nullptr) {
|
||||
if (gSpeechSound != NULL) {
|
||||
soundPause(gSpeechSound);
|
||||
}
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ void speechPause()
|
|||
// 0x451068
|
||||
void speechResume()
|
||||
{
|
||||
if (gSpeechSound != nullptr) {
|
||||
if (gSpeechSound != NULL) {
|
||||
soundResume(gSpeechSound);
|
||||
}
|
||||
}
|
||||
|
@ -1055,8 +1055,8 @@ int _gsound_play_sfx_file_volume(const char* a1, int a2)
|
|||
return -1;
|
||||
}
|
||||
|
||||
v1 = soundEffectLoadWithVolume(a1, nullptr, a2);
|
||||
if (v1 == nullptr) {
|
||||
v1 = soundEffectLoadWithVolume(a1, NULL, a2);
|
||||
if (v1 == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1069,11 +1069,11 @@ int _gsound_play_sfx_file_volume(const char* a1, int a2)
|
|||
Sound* soundEffectLoad(const char* name, Object* object)
|
||||
{
|
||||
if (!gGameSoundInitialized) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!gSoundEffectsEnabled) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gGameSoundDebugEnabled) {
|
||||
|
@ -1085,16 +1085,16 @@ Sound* soundEffectLoad(const char* name, Object* object)
|
|||
debugPrint("failed because there are already %d active effects.\n", _gsound_active_effect_counter);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Sound* sound = _gsound_get_sound_ready_for_effect();
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("failed.\n");
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
++_gsound_active_effect_counter;
|
||||
|
@ -1110,7 +1110,7 @@ Sound* soundEffectLoad(const char* name, Object* object)
|
|||
return sound;
|
||||
}
|
||||
|
||||
if (object != nullptr) {
|
||||
if (object != NULL) {
|
||||
if (FID_TYPE(object->fid) == OBJ_TYPE_CRITTER && (name[0] == 'H' || name[0] == 'N')) {
|
||||
char v9 = name[1];
|
||||
if (v9 == 'A' || v9 == 'F' || v9 == 'M') {
|
||||
|
@ -1179,7 +1179,7 @@ Sound* soundEffectLoad(const char* name, Object* object)
|
|||
debugPrint("failed.\n");
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x45145C
|
||||
|
@ -1187,7 +1187,7 @@ Sound* soundEffectLoadWithVolume(const char* name, Object* object, int volume)
|
|||
{
|
||||
Sound* sound = soundEffectLoad(name, object);
|
||||
|
||||
if (sound != nullptr) {
|
||||
if (sound != NULL) {
|
||||
soundSetVolume(sound, (volume * gSoundEffectsVolume) / VOLUME_MAX);
|
||||
}
|
||||
|
||||
|
@ -1233,7 +1233,7 @@ int _gsnd_anim_sound(Sound* sound, void* a2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1253,7 +1253,7 @@ int soundEffectPlay(Sound* sound)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1319,16 +1319,16 @@ char* sfxBuildCharName(Object* a1, int anim, int extra)
|
|||
char v9;
|
||||
|
||||
if (artCopyFileName(FID_TYPE(a1->fid), a1->fid & 0xFFF, v7) == -1) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (anim == ANIM_TAKE_OUT) {
|
||||
if (_art_get_code(anim, extra, &v8, &v9) == -1) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (_art_get_code(anim, (a1->fid & 0xF000) >> 12, &v8, &v9) == -1) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1370,7 +1370,7 @@ char* gameSoundBuildInterfaceName(const char* a1)
|
|||
// 0x451760
|
||||
char* sfxBuildWeaponName(int effectType, Object* weapon, int hitMode, Object* target)
|
||||
{
|
||||
int soundVariant;
|
||||
int v6;
|
||||
char weaponSoundCode;
|
||||
char effectTypeCode;
|
||||
char materialCode;
|
||||
|
@ -1384,18 +1384,18 @@ char* sfxBuildWeaponName(int effectType, Object* weapon, int hitMode, Object* ta
|
|||
if (hitMode != HIT_MODE_LEFT_WEAPON_PRIMARY
|
||||
&& hitMode != HIT_MODE_RIGHT_WEAPON_PRIMARY
|
||||
&& hitMode != HIT_MODE_PUNCH) {
|
||||
soundVariant = 2;
|
||||
v6 = 2;
|
||||
} else {
|
||||
soundVariant = 1;
|
||||
v6 = 1;
|
||||
}
|
||||
} else {
|
||||
soundVariant = 1;
|
||||
v6 = 1;
|
||||
}
|
||||
|
||||
int damageType = weaponGetDamageType(nullptr, weapon);
|
||||
int damageType = weaponGetDamageType(NULL, weapon);
|
||||
|
||||
// SFALL
|
||||
if (effectTypeCode != 'H' || target == nullptr || damageType == explosionGetDamageType() || damageType == DAMAGE_TYPE_PLASMA || damageType == DAMAGE_TYPE_EMP) {
|
||||
if (effectTypeCode != 'H' || target == NULL || damageType == explosionGetDamageType() || damageType == DAMAGE_TYPE_PLASMA || damageType == DAMAGE_TYPE_EMP) {
|
||||
materialCode = 'X';
|
||||
} else {
|
||||
const int type = FID_TYPE(target->fid);
|
||||
|
@ -1438,7 +1438,7 @@ char* sfxBuildWeaponName(int effectType, Object* weapon, int hitMode, Object* ta
|
|||
}
|
||||
}
|
||||
|
||||
snprintf(_sfx_file_name, sizeof(_sfx_file_name), "W%c%c%1d%cXX%1d", effectTypeCode, weaponSoundCode, soundVariant, materialCode, 1);
|
||||
snprintf(_sfx_file_name, sizeof(_sfx_file_name), "W%c%c%1d%cXX%1d", effectTypeCode, weaponSoundCode, v6, materialCode, 1);
|
||||
compat_strupr(_sfx_file_name);
|
||||
return _sfx_file_name;
|
||||
}
|
||||
|
@ -1531,8 +1531,8 @@ int soundPlayFile(const char* name)
|
|||
return -1;
|
||||
}
|
||||
|
||||
Sound* sound = soundEffectLoad(name, nullptr);
|
||||
if (sound == nullptr) {
|
||||
Sound* sound = soundEffectLoad(name, NULL);
|
||||
if (sound == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1551,7 +1551,7 @@ void _gsound_bkg_proc()
|
|||
int gameSoundFileOpen(const char* fname, int* sampleRate)
|
||||
{
|
||||
File* stream = fileOpen(fname, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1647,7 +1647,7 @@ bool gameSoundIsCompressed(char* filePath)
|
|||
void speechCallback(void* userData, int a2)
|
||||
{
|
||||
if (a2 == 1) {
|
||||
gSpeechSound = nullptr;
|
||||
gSpeechSound = NULL;
|
||||
|
||||
if (gSpeechEndCallback) {
|
||||
gSpeechEndCallback();
|
||||
|
@ -1659,7 +1659,7 @@ void speechCallback(void* userData, int a2)
|
|||
void backgroundSoundCallback(void* userData, int a2)
|
||||
{
|
||||
if (a2 == 1) {
|
||||
gBackgroundSound = nullptr;
|
||||
gBackgroundSound = NULL;
|
||||
|
||||
if (gBackgroundSoundEndCallback) {
|
||||
gBackgroundSoundEndCallback();
|
||||
|
@ -1693,7 +1693,7 @@ int _gsound_background_allocate(Sound** soundPtr, int a2, int a3)
|
|||
}
|
||||
|
||||
Sound* sound = soundAllocate(type, soundFlags);
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1737,7 +1737,7 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
snprintf(inPath, sizeof(inPath), "%s%s%s", _sound_music_path2, src, ".ACM");
|
||||
|
||||
FILE* inStream = compat_fopen(inPath, "rb");
|
||||
if (inStream == nullptr) {
|
||||
if (inStream == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Unable to find music file %s to copy down.\n", src);
|
||||
}
|
||||
|
@ -1746,7 +1746,7 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
}
|
||||
|
||||
FILE* outStream = compat_fopen(outPath, "wb");
|
||||
if (outStream == nullptr) {
|
||||
if (outStream == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Unable to open music file %s for copying to.", src);
|
||||
}
|
||||
|
@ -1757,7 +1757,7 @@ int gameSoundFindBackgroundSoundPathWithCopy(char* dest, const char* src)
|
|||
}
|
||||
|
||||
void* buffer = internal_malloc(0x2000);
|
||||
if (buffer == nullptr) {
|
||||
if (buffer == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Out of memory in gsound_background_find_with_copy.\n", src);
|
||||
}
|
||||
|
@ -1967,7 +1967,7 @@ int _gsound_get_music_path(char** out_value, const char* key)
|
|||
}
|
||||
|
||||
copy = (char*)internal_malloc(len + 2);
|
||||
if (copy == nullptr) {
|
||||
if (copy == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("Out of memory in gsound_get_music_path.\n");
|
||||
}
|
||||
|
@ -2004,7 +2004,7 @@ Sound* _gsound_get_sound_ready_for_effect()
|
|||
int rc;
|
||||
|
||||
Sound* sound = soundAllocate(SOUND_TYPE_MEMORY | SOUND_TYPE_FIRE_AND_FORGET, SOUND_FLAG_0x02 | SOUND_16BIT);
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint(" Can't allocate sound for effect. ");
|
||||
}
|
||||
|
@ -2013,13 +2013,13 @@ Sound* _gsound_get_sound_ready_for_effect()
|
|||
debugPrint("soundAllocate returned: %d, %s\n", 0, soundGetErrorDescription(0));
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (soundEffectsCacheInitialized()) {
|
||||
rc = soundSetFileIO(sound, soundEffectsCacheFileOpen, soundEffectsCacheFileClose, soundEffectsCacheFileRead, soundEffectsCacheFileWrite, soundEffectsCacheFileSeek, soundEffectsCacheFileTell, soundEffectsCacheFileLength);
|
||||
} else {
|
||||
rc = soundSetFileIO(sound, audioOpen, audioClose, audioRead, nullptr, audioSeek, gameSoundFileTellNotImplemented, audioGetSize);
|
||||
rc = soundSetFileIO(sound, audioOpen, audioClose, audioRead, NULL, audioSeek, gameSoundFileTellNotImplemented, audioGetSize);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
|
@ -2033,10 +2033,10 @@ Sound* _gsound_get_sound_ready_for_effect()
|
|||
|
||||
soundDelete(sound);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rc = soundSetCallback(sound, soundEffectCallback, nullptr);
|
||||
rc = soundSetCallback(sound, soundEffectCallback, NULL);
|
||||
if (rc != 0) {
|
||||
if (gGameSoundDebugEnabled) {
|
||||
debugPrint("failed because the callback could not be set.\n");
|
||||
|
@ -2048,7 +2048,7 @@ Sound* _gsound_get_sound_ready_for_effect()
|
|||
|
||||
soundDelete(sound);
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
soundSetVolume(sound, gSoundEffectsVolume);
|
||||
|
@ -2062,7 +2062,7 @@ Sound* _gsound_get_sound_ready_for_effect()
|
|||
bool _gsound_file_exists_f(const char* fname)
|
||||
{
|
||||
FILE* f = compat_fopen(fname, "rb");
|
||||
if (f == nullptr) {
|
||||
if (f == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2083,17 +2083,17 @@ int _gsound_setup_paths()
|
|||
// 0x452628
|
||||
int _gsound_sfx_q_start()
|
||||
{
|
||||
return ambientSoundEffectEventProcess(nullptr, nullptr);
|
||||
return ambientSoundEffectEventProcess(0, NULL);
|
||||
}
|
||||
|
||||
// 0x452634
|
||||
int ambientSoundEffectEventProcess(Object* a1, void* data)
|
||||
{
|
||||
_queue_clear_type(EVENT_TYPE_GSOUND_SFX_EVENT, nullptr);
|
||||
_queue_clear_type(EVENT_TYPE_GSOUND_SFX_EVENT, NULL);
|
||||
|
||||
AmbientSoundEffectEvent* soundEffectEvent = (AmbientSoundEffectEvent*)data;
|
||||
int ambientSoundEffectIndex = -1;
|
||||
if (soundEffectEvent != nullptr) {
|
||||
if (soundEffectEvent != NULL) {
|
||||
ambientSoundEffectIndex = soundEffectEvent->ambientSoundEffectIndex;
|
||||
} else {
|
||||
if (wmSfxMaxCount() > 0) {
|
||||
|
@ -2102,7 +2102,7 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
|
|||
}
|
||||
|
||||
AmbientSoundEffectEvent* nextSoundEffectEvent = (AmbientSoundEffectEvent*)internal_malloc(sizeof(*nextSoundEffectEvent));
|
||||
if (nextSoundEffectEvent == nullptr) {
|
||||
if (nextSoundEffectEvent == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2113,7 +2113,7 @@ int ambientSoundEffectEventProcess(Object* a1, void* data)
|
|||
int delay = 10 * randomBetween(15, 20);
|
||||
if (wmSfxMaxCount() > 0) {
|
||||
nextSoundEffectEvent->ambientSoundEffectIndex = wmSfxRollNextIdx();
|
||||
if (queueAddEvent(delay, nullptr, nextSoundEffectEvent, EVENT_TYPE_GSOUND_SFX_EVENT) == -1) {
|
||||
if (queueAddEvent(delay, NULL, nextSoundEffectEvent, EVENT_TYPE_GSOUND_SFX_EVENT) == -1) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
namespace fallout {
|
||||
|
||||
// 0x51DEF4
|
||||
static RectListNode* _rectList = nullptr;
|
||||
static RectListNode* _rectList = NULL;
|
||||
|
||||
// 0x4C6900
|
||||
void _GNW_rect_exit()
|
||||
{
|
||||
while (_rectList != nullptr) {
|
||||
while (_rectList != NULL) {
|
||||
RectListNode* next = _rectList->next;
|
||||
internal_free(_rectList);
|
||||
_rectList = next;
|
||||
|
@ -28,7 +28,7 @@ void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect)
|
|||
rectCopy(&v1, rect);
|
||||
|
||||
// NOTE: Original code is slightly different.
|
||||
while (*rectListNodePtr != nullptr) {
|
||||
while (*rectListNodePtr != NULL) {
|
||||
RectListNode* rectListNode = *rectListNodePtr;
|
||||
if (v1.right >= rectListNode->rect.left
|
||||
&& v1.bottom >= rectListNode->rect.top
|
||||
|
@ -44,7 +44,7 @@ void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect)
|
|||
|
||||
if (v2.top < v1.top) {
|
||||
RectListNode* newRectListNode = _rect_malloc();
|
||||
if (newRectListNode == nullptr) {
|
||||
if (newRectListNode == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect)
|
|||
|
||||
if (v2.bottom > v1.bottom) {
|
||||
RectListNode* newRectListNode = _rect_malloc();
|
||||
if (newRectListNode == nullptr) {
|
||||
if (newRectListNode == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect)
|
|||
|
||||
if (v2.left < v1.left) {
|
||||
RectListNode* newRectListNode = _rect_malloc();
|
||||
if (newRectListNode == nullptr) {
|
||||
if (newRectListNode == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect)
|
|||
|
||||
if (v2.right > v1.right) {
|
||||
RectListNode* newRectListNode = _rect_malloc();
|
||||
if (newRectListNode == nullptr) {
|
||||
if (newRectListNode == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -107,69 +107,13 @@ void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect)
|
|||
}
|
||||
}
|
||||
|
||||
// 0x4C6AAC
|
||||
RectListNode* rect_clip(Rect* b, Rect* t)
|
||||
{
|
||||
RectListNode* list = nullptr;
|
||||
Rect clipped_t;
|
||||
|
||||
if (rectIntersection(t, b, &clipped_t) == 0) {
|
||||
RectListNode** next = &list;
|
||||
Rect clipped_b[4];
|
||||
int k;
|
||||
|
||||
clipped_b[0].left = b->left;
|
||||
clipped_b[0].top = b->top;
|
||||
clipped_b[0].right = b->right;
|
||||
clipped_b[0].bottom = clipped_t.top - 1;
|
||||
|
||||
clipped_b[1].left = b->left;
|
||||
clipped_b[1].top = clipped_t.top;
|
||||
clipped_b[1].right = clipped_t.left - 1;
|
||||
clipped_b[1].bottom = clipped_t.bottom;
|
||||
|
||||
clipped_b[2].left = clipped_t.right + 1;
|
||||
clipped_b[2].top = clipped_t.top;
|
||||
clipped_b[2].right = b->right;
|
||||
clipped_b[2].bottom = clipped_t.bottom;
|
||||
|
||||
clipped_b[3].left = b->left;
|
||||
clipped_b[3].top = clipped_t.bottom + 1;
|
||||
clipped_b[3].right = b->right;
|
||||
clipped_b[3].bottom = b->bottom;
|
||||
|
||||
for (k = 0; k < 4; k++) {
|
||||
if (clipped_b[k].left <= clipped_b[k].right && clipped_b[k].top <= clipped_b[k].bottom) {
|
||||
*next = _rect_malloc();
|
||||
if (*next == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
(*next)->rect = clipped_b[k];
|
||||
(*next)->next = nullptr;
|
||||
next = &((*next)->next);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list = _rect_malloc();
|
||||
if (list == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
list->rect = *b;
|
||||
list->next = nullptr;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
// 0x4C6BB8
|
||||
RectListNode* _rect_malloc()
|
||||
{
|
||||
if (_rectList == nullptr) {
|
||||
if (_rectList == NULL) {
|
||||
for (int index = 0; index < 10; index++) {
|
||||
RectListNode* rectListNode = (RectListNode*)internal_malloc(sizeof(*rectListNode));
|
||||
if (rectListNode == nullptr) {
|
||||
if (rectListNode == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -178,8 +122,8 @@ RectListNode* _rect_malloc()
|
|||
}
|
||||
}
|
||||
|
||||
if (_rectList == nullptr) {
|
||||
return nullptr;
|
||||
if (_rectList == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RectListNode* rectListNode = _rectList;
|
||||
|
|
|
@ -27,7 +27,6 @@ typedef struct RectListNode {
|
|||
|
||||
void _GNW_rect_exit();
|
||||
void _rect_clip_list(RectListNode** rectListNodePtr, Rect* rect);
|
||||
RectListNode* rect_clip(Rect* b, Rect* t);
|
||||
RectListNode* _rect_malloc();
|
||||
void _rect_free(RectListNode* entry);
|
||||
void rectUnion(const Rect* s1, const Rect* s2, Rect* r);
|
||||
|
|
|
@ -52,21 +52,13 @@ unsigned char HighRGB(unsigned char color)
|
|||
return std::max(std::max(r, g), b);
|
||||
}
|
||||
|
||||
// 0x44ED98
|
||||
int load_lbm_to_buf(const char* path, unsigned char* buffer, int a3, int a4, int a5, int a6, int a7)
|
||||
{
|
||||
// TODO: Incomplete.
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 0x44F250
|
||||
int graphCompress(unsigned char* a1, unsigned char* a2, int a3)
|
||||
{
|
||||
_dad_2 = nullptr;
|
||||
_rson = nullptr;
|
||||
_lson = nullptr;
|
||||
_text_buf = nullptr;
|
||||
_dad_2 = NULL;
|
||||
_rson = NULL;
|
||||
_lson = NULL;
|
||||
_text_buf = NULL;
|
||||
|
||||
// NOTE: Original code is slightly different, it uses deep nesting or a
|
||||
// bunch of gotos.
|
||||
|
@ -75,20 +67,20 @@ int graphCompress(unsigned char* a1, unsigned char* a2, int a3)
|
|||
_dad_2 = (int*)internal_malloc(sizeof(*_dad_2) * 4104);
|
||||
_text_buf = (unsigned char*)internal_malloc(sizeof(*_text_buf) * 4122);
|
||||
|
||||
if (_lson == nullptr || _rson == nullptr || _dad_2 == nullptr || _text_buf == nullptr) {
|
||||
if (_lson == NULL || _rson == NULL || _dad_2 == NULL || _text_buf == NULL) {
|
||||
debugPrint("\nGRAPHLIB: Error allocating compression buffers!\n");
|
||||
|
||||
if (_dad_2 != nullptr) {
|
||||
if (_dad_2 != NULL) {
|
||||
internal_free(_dad_2);
|
||||
}
|
||||
|
||||
if (_rson != nullptr) {
|
||||
if (_rson != NULL) {
|
||||
internal_free(_rson);
|
||||
}
|
||||
if (_lson != nullptr) {
|
||||
if (_lson != NULL) {
|
||||
internal_free(_lson);
|
||||
}
|
||||
if (_text_buf != nullptr) {
|
||||
if (_text_buf != NULL) {
|
||||
internal_free(_text_buf);
|
||||
}
|
||||
|
||||
|
@ -355,7 +347,7 @@ static void _DeleteNode(int a1)
|
|||
int graphDecompress(unsigned char* src, unsigned char* dest, int length)
|
||||
{
|
||||
_text_buf = (unsigned char*)internal_malloc(sizeof(*_text_buf) * 4122);
|
||||
if (_text_buf == nullptr) {
|
||||
if (_text_buf == NULL) {
|
||||
debugPrint("\nGRAPHLIB: Error allocating decompression buffer!\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
namespace fallout {
|
||||
|
||||
unsigned char HighRGB(unsigned char color);
|
||||
int load_lbm_to_buf(const char* path, unsigned char* buffer, int a3, int a4, int a5, int a6, int a7);
|
||||
int graphCompress(unsigned char* a1, unsigned char* a2, int a3);
|
||||
int graphDecompress(unsigned char* a1, unsigned char* a2, int a3);
|
||||
void grayscalePaletteUpdate(int a1, int a2);
|
||||
|
|
80
src/heap.cc
80
src/heap.cc
|
@ -85,23 +85,23 @@ static bool heapBuildMoveableBlocksList(int extentIndex);
|
|||
// An array of pointers to free heap blocks.
|
||||
//
|
||||
// 0x518E9C
|
||||
static unsigned char** gHeapFreeBlocks = nullptr;
|
||||
static unsigned char** gHeapFreeBlocks = NULL;
|
||||
|
||||
// An array of moveable extents in heap.
|
||||
//
|
||||
// 0x518EA0
|
||||
static HeapMoveableExtent* gHeapMoveableExtents = nullptr;
|
||||
static HeapMoveableExtent* gHeapMoveableExtents = NULL;
|
||||
|
||||
// An array of pointers to moveable heap blocks.
|
||||
//
|
||||
// 0x518EA4
|
||||
static unsigned char** gHeapMoveableBlocks = nullptr;
|
||||
static unsigned char** gHeapMoveableBlocks = NULL;
|
||||
|
||||
// An array of indexes into [gHeapFreeBlocks] array to track which free blocks
|
||||
// were already reserved for subsequent moving.
|
||||
//
|
||||
// 0x518EA8
|
||||
static int* gHeapReservedFreeBlockIndexes = nullptr;
|
||||
static int* gHeapReservedFreeBlockIndexes = NULL;
|
||||
|
||||
// The length of the [gHeapFreeBlocks] array.
|
||||
//
|
||||
|
@ -139,26 +139,26 @@ static bool heapInternalsInit()
|
|||
// it has failed.
|
||||
do {
|
||||
gHeapFreeBlocks = (unsigned char**)internal_malloc(sizeof(*gHeapFreeBlocks) * HEAP_FREE_BLOCKS_INITIAL_LENGTH);
|
||||
if (gHeapFreeBlocks == nullptr) {
|
||||
if (gHeapFreeBlocks == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
gHeapFreeBlocksLength = HEAP_FREE_BLOCKS_INITIAL_LENGTH;
|
||||
|
||||
gHeapMoveableExtents = (HeapMoveableExtent*)internal_malloc(sizeof(*gHeapMoveableExtents) * HEAP_MOVEABLE_EXTENTS_INITIAL_LENGTH);
|
||||
if (gHeapMoveableExtents == nullptr) {
|
||||
if (gHeapMoveableExtents == NULL) {
|
||||
break;
|
||||
}
|
||||
gHeapMoveableExtentsLength = HEAP_MOVEABLE_EXTENTS_INITIAL_LENGTH;
|
||||
|
||||
gHeapMoveableBlocks = (unsigned char**)internal_malloc(sizeof(*gHeapMoveableBlocks) * HEAP_MOVEABLE_BLOCKS_INITIAL_LENGTH);
|
||||
if (gHeapMoveableBlocks == nullptr) {
|
||||
if (gHeapMoveableBlocks == NULL) {
|
||||
break;
|
||||
}
|
||||
gHeapMoveableBlocksLength = HEAP_MOVEABLE_BLOCKS_INITIAL_LENGTH;
|
||||
|
||||
gHeapReservedFreeBlockIndexes = (int*)internal_malloc(sizeof(*gHeapReservedFreeBlockIndexes) * HEAP_RESERVED_FREE_BLOCK_INDEXES_INITIAL_LENGTH);
|
||||
if (gHeapReservedFreeBlockIndexes == nullptr) {
|
||||
if (gHeapReservedFreeBlockIndexes == NULL) {
|
||||
break;
|
||||
}
|
||||
gHeapReservedFreeBlockIndexesLength = HEAP_RESERVED_FREE_BLOCK_INDEXES_INITIAL_LENGTH;
|
||||
|
@ -175,27 +175,27 @@ static bool heapInternalsInit()
|
|||
// 0x4533A0
|
||||
static void heapInternalsFree()
|
||||
{
|
||||
if (gHeapReservedFreeBlockIndexes != nullptr) {
|
||||
if (gHeapReservedFreeBlockIndexes != NULL) {
|
||||
internal_free(gHeapReservedFreeBlockIndexes);
|
||||
gHeapReservedFreeBlockIndexes = nullptr;
|
||||
gHeapReservedFreeBlockIndexes = NULL;
|
||||
}
|
||||
gHeapReservedFreeBlockIndexesLength = 0;
|
||||
|
||||
if (gHeapMoveableBlocks != nullptr) {
|
||||
if (gHeapMoveableBlocks != NULL) {
|
||||
internal_free(gHeapMoveableBlocks);
|
||||
gHeapMoveableBlocks = nullptr;
|
||||
gHeapMoveableBlocks = NULL;
|
||||
}
|
||||
gHeapMoveableBlocksLength = 0;
|
||||
|
||||
if (gHeapMoveableExtents != nullptr) {
|
||||
if (gHeapMoveableExtents != NULL) {
|
||||
internal_free(gHeapMoveableExtents);
|
||||
gHeapMoveableExtents = nullptr;
|
||||
gHeapMoveableExtents = NULL;
|
||||
}
|
||||
gHeapMoveableExtentsLength = 0;
|
||||
|
||||
if (gHeapFreeBlocks != nullptr) {
|
||||
if (gHeapFreeBlocks != NULL) {
|
||||
internal_free(gHeapFreeBlocks);
|
||||
gHeapFreeBlocks = nullptr;
|
||||
gHeapFreeBlocks = NULL;
|
||||
}
|
||||
gHeapFreeBlocksLength = 0;
|
||||
}
|
||||
|
@ -203,7 +203,7 @@ static void heapInternalsFree()
|
|||
// 0x452974
|
||||
bool heapInit(Heap* heap, int a2)
|
||||
{
|
||||
if (heap == nullptr) {
|
||||
if (heap == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ bool heapInit(Heap* heap, int a2)
|
|||
if (heapHandleListInit(heap)) {
|
||||
int size = (a2 >> 10) + a2;
|
||||
heap->data = (unsigned char*)internal_malloc(size);
|
||||
if (heap->data != nullptr) {
|
||||
if (heap->data != NULL) {
|
||||
heap->size = size;
|
||||
heap->freeBlocks = 1;
|
||||
heap->freeSize = heap->size - HEAP_BLOCK_OVERHEAD_SIZE;
|
||||
|
@ -248,24 +248,24 @@ bool heapInit(Heap* heap, int a2)
|
|||
// 0x452A3C
|
||||
bool heapFree(Heap* heap)
|
||||
{
|
||||
if (heap == nullptr) {
|
||||
if (heap == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int index = 0; index < heap->handlesLength; index++) {
|
||||
HeapHandle* handle = &(heap->handles[index]);
|
||||
if (handle->state == 4 && handle->data != nullptr) {
|
||||
if (handle->state == 4 && handle->data != NULL) {
|
||||
internal_free(handle->data);
|
||||
}
|
||||
}
|
||||
|
||||
if (heap->handles != nullptr) {
|
||||
if (heap->handles != NULL) {
|
||||
internal_free(heap->handles);
|
||||
heap->handles = nullptr;
|
||||
heap->handles = NULL;
|
||||
heap->handlesLength = 0;
|
||||
}
|
||||
|
||||
if (heap->data != nullptr) {
|
||||
if (heap->data != NULL) {
|
||||
internal_free(heap->data);
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ bool heapFree(Heap* heap)
|
|||
static bool heapHandleListInit(Heap* heap)
|
||||
{
|
||||
heap->handles = (HeapHandle*)internal_malloc(sizeof(*heap->handles) * HEAP_HANDLES_INITIAL_LENGTH);
|
||||
if (heap->handles == nullptr) {
|
||||
if (heap->handles == NULL) {
|
||||
debugPrint("Heap Error : Could not initialize handles.\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ static bool heapHandleListInit(Heap* heap)
|
|||
for (int index = 0; index < HEAP_HANDLES_INITIAL_LENGTH; index++) {
|
||||
HeapHandle* handle = &(heap->handles[index]);
|
||||
handle->state = HEAP_HANDLE_STATE_INVALID;
|
||||
handle->data = nullptr;
|
||||
handle->data = NULL;
|
||||
}
|
||||
|
||||
heap->handlesLength = HEAP_HANDLES_INITIAL_LENGTH;
|
||||
|
@ -309,7 +309,7 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4)
|
|||
|
||||
size += 4 - size % 4;
|
||||
|
||||
if (heap == nullptr || handleIndexPtr == nullptr || size == 0) {
|
||||
if (heap == NULL || handleIndexPtr == NULL || size == 0) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ bool heapBlockAllocate(Heap* heap, int* handleIndexPtr, int size, int a4)
|
|||
}
|
||||
|
||||
handle->state = HEAP_HANDLE_STATE_INVALID;
|
||||
handle->data = nullptr;
|
||||
handle->data = NULL;
|
||||
|
||||
debugPrint("Heap Error: Unknown block state during allocation.\n");
|
||||
|
||||
|
@ -422,7 +422,7 @@ err:
|
|||
// 0x452CB4
|
||||
bool heapBlockDeallocate(Heap* heap, int* handleIndexPtr)
|
||||
{
|
||||
if (heap == nullptr || handleIndexPtr == nullptr) {
|
||||
if (heap == NULL || handleIndexPtr == NULL) {
|
||||
debugPrint("Heap Error: Could not deallocate block.\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ bool heapBlockDeallocate(Heap* heap, int* handleIndexPtr)
|
|||
|
||||
// Reset handle
|
||||
handle->state = HEAP_HANDLE_STATE_INVALID;
|
||||
handle->data = nullptr;
|
||||
handle->data = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ bool heapBlockDeallocate(Heap* heap, int* handleIndexPtr)
|
|||
|
||||
// Reset handle
|
||||
handle->state = HEAP_HANDLE_STATE_INVALID;
|
||||
handle->data = nullptr;
|
||||
handle->data = NULL;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -493,7 +493,7 @@ bool heapBlockDeallocate(Heap* heap, int* handleIndexPtr)
|
|||
// 0x452DE0
|
||||
bool heapLock(Heap* heap, int handleIndex, unsigned char** bufferPtr)
|
||||
{
|
||||
if (heap == nullptr) {
|
||||
if (heap == NULL) {
|
||||
debugPrint("Heap Error: Could not lock block");
|
||||
return false;
|
||||
}
|
||||
|
@ -554,7 +554,7 @@ bool heapLock(Heap* heap, int handleIndex, unsigned char** bufferPtr)
|
|||
// 0x452EE4
|
||||
bool heapUnlock(Heap* heap, int handleIndex)
|
||||
{
|
||||
if (heap == nullptr) {
|
||||
if (heap == NULL) {
|
||||
debugPrint("Heap Error: Could not unlock block.\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ bool heapUnlock(Heap* heap, int handleIndex)
|
|||
// 0x4532AC
|
||||
static bool heapPrintStats(Heap* heap, char* dest, size_t size)
|
||||
{
|
||||
if (heap == nullptr || dest == nullptr) {
|
||||
if (heap == NULL || dest == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -649,7 +649,7 @@ static bool heapFindFreeHandle(Heap* heap, int* handleIndexPtr)
|
|||
|
||||
// If we're here the search above failed, we have to allocate more handles.
|
||||
HeapHandle* handles = (HeapHandle*)internal_realloc(heap->handles, sizeof(*handles) * (heap->handlesLength + HEAP_HANDLES_INITIAL_LENGTH));
|
||||
if (handles == nullptr) {
|
||||
if (handles == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ static bool heapFindFreeHandle(Heap* heap, int* handleIndexPtr)
|
|||
for (int index = heap->handlesLength; index < heap->handlesLength + HEAP_HANDLES_INITIAL_LENGTH; index++) {
|
||||
HeapHandle* handle = &(heap->handles[index]);
|
||||
handle->state = HEAP_HANDLE_STATE_INVALID;
|
||||
handle->data = nullptr;
|
||||
handle->data = NULL;
|
||||
}
|
||||
|
||||
*handleIndexPtr = heap->handlesLength;
|
||||
|
@ -725,7 +725,7 @@ static bool heapFindFreeBlock(Heap* heap, int size, void** blockPtr, int a4)
|
|||
// to index all blocks for longest moveable extent.
|
||||
if (maxBlocksCount > gHeapReservedFreeBlockIndexesLength) {
|
||||
int* indexes = (int*)internal_realloc(gHeapReservedFreeBlockIndexes, sizeof(*gHeapReservedFreeBlockIndexes) * maxBlocksCount);
|
||||
if (indexes == nullptr) {
|
||||
if (indexes == NULL) {
|
||||
goto system;
|
||||
}
|
||||
|
||||
|
@ -921,7 +921,7 @@ system:
|
|||
if (a4 == 0) {
|
||||
debugPrint("Allocating block from system memory...\n");
|
||||
unsigned char* block = (unsigned char*)internal_malloc(size + HEAP_BLOCK_OVERHEAD_SIZE);
|
||||
if (block == nullptr) {
|
||||
if (block == NULL) {
|
||||
debugPrint("fatal error: internal_malloc() failed in heap_find_free_block()!\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -952,7 +952,7 @@ static bool heapBuildMoveableBlocksList(int extentIndex)
|
|||
HeapMoveableExtent* extent = &(gHeapMoveableExtents[extentIndex]);
|
||||
if (extent->moveableBlocksLength > gHeapMoveableBlocksLength) {
|
||||
unsigned char** moveableBlocks = (unsigned char**)internal_realloc(gHeapMoveableBlocks, sizeof(*gHeapMoveableBlocks) * extent->moveableBlocksLength);
|
||||
if (moveableBlocks == nullptr) {
|
||||
if (moveableBlocks == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -990,7 +990,7 @@ static bool heapBuildFreeBlocksList(Heap* heap)
|
|||
|
||||
if (heap->freeBlocks > gHeapFreeBlocksLength) {
|
||||
unsigned char** freeBlocks = (unsigned char**)internal_realloc(gHeapFreeBlocks, sizeof(*freeBlocks) * heap->freeBlocks);
|
||||
if (freeBlocks == nullptr) {
|
||||
if (freeBlocks == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1063,7 +1063,7 @@ static bool heapBuildMoveableExtentsList(Heap* heap, int* moveableExtentsLengthP
|
|||
|
||||
if (maxExtentsCount > gHeapMoveableExtentsLength) {
|
||||
HeapMoveableExtent* moveableExtents = (HeapMoveableExtent*)internal_realloc(gHeapMoveableExtents, sizeof(*gHeapMoveableExtents) * maxExtentsCount);
|
||||
if (moveableExtents == nullptr) {
|
||||
if (moveableExtents == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
47
src/input.cc
47
src/input.cc
|
@ -4,7 +4,6 @@
|
|||
|
||||
#include "audio_engine.h"
|
||||
#include "color.h"
|
||||
#include "delay.h"
|
||||
#include "dinput.h"
|
||||
#include "draw.h"
|
||||
#include "kb.h"
|
||||
|
@ -49,10 +48,10 @@ static void _GNW95_process_key(KeyboardData* data);
|
|||
static void idleImpl();
|
||||
|
||||
// 0x51E234
|
||||
static IdleFunc* _idle_func = nullptr;
|
||||
static IdleFunc* _idle_func = NULL;
|
||||
|
||||
// 0x51E238
|
||||
static FocusFunc* _focus_func = nullptr;
|
||||
static FocusFunc* _focus_func = NULL;
|
||||
|
||||
// 0x51E23C
|
||||
static int gKeyboardKeyRepeatRate = 80;
|
||||
|
@ -150,7 +149,7 @@ int inputInit(int a1)
|
|||
gPauseKeyCode = KEY_ALT_P;
|
||||
gPauseHandler = pauseHandlerDefaultImpl;
|
||||
gScreenshotHandler = screenshotHandlerDefaultImpl;
|
||||
gTickerListHead = nullptr;
|
||||
gTickerListHead = NULL;
|
||||
gScreenshotKeyCode = KEY_ALT_C;
|
||||
|
||||
// SFALL: Set idle function.
|
||||
|
@ -169,7 +168,7 @@ void inputExit()
|
|||
directInputFree();
|
||||
|
||||
TickerListNode* curr = gTickerListHead;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
TickerListNode* next = curr->next;
|
||||
internal_free(curr);
|
||||
curr = next;
|
||||
|
@ -200,13 +199,6 @@ int inputGetInput()
|
|||
return -1;
|
||||
}
|
||||
|
||||
// 0x4C8BC8
|
||||
void get_input_position(int* x, int* y)
|
||||
{
|
||||
*x = _input_mx;
|
||||
*y = _input_my;
|
||||
}
|
||||
|
||||
// 0x4C8BDC
|
||||
void _process_bk()
|
||||
{
|
||||
|
@ -318,7 +310,7 @@ void tickersExecute()
|
|||
TickerListNode* curr = gTickerListHead;
|
||||
TickerListNode** currPtr = &(gTickerListHead);
|
||||
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
TickerListNode* next = curr->next;
|
||||
if (curr->flags & 1) {
|
||||
*currPtr = next;
|
||||
|
@ -336,7 +328,7 @@ void tickersExecute()
|
|||
void tickersAdd(TickerProc* proc)
|
||||
{
|
||||
TickerListNode* curr = gTickerListHead;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
if (curr->proc == proc) {
|
||||
if ((curr->flags & 0x01) != 0) {
|
||||
curr->flags &= ~0x01;
|
||||
|
@ -357,7 +349,7 @@ void tickersAdd(TickerProc* proc)
|
|||
void tickersRemove(TickerProc* proc)
|
||||
{
|
||||
TickerListNode* curr = gTickerListHead;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
if (curr->proc == proc) {
|
||||
curr->flags |= 0x01;
|
||||
return;
|
||||
|
@ -439,7 +431,7 @@ void pauseHandlerConfigure(int keyCode, PauseHandler* handler)
|
|||
{
|
||||
gPauseKeyCode = keyCode;
|
||||
|
||||
if (handler == nullptr) {
|
||||
if (handler == NULL) {
|
||||
handler = pauseHandlerDefaultImpl;
|
||||
}
|
||||
|
||||
|
@ -452,7 +444,7 @@ void takeScreenshot()
|
|||
int width = _scr_size.right - _scr_size.left + 1;
|
||||
int height = _scr_size.bottom - _scr_size.top + 1;
|
||||
gScreenshotBuffer = (unsigned char*)internal_malloc(width * height);
|
||||
if (gScreenshotBuffer == nullptr) {
|
||||
if (gScreenshotBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -463,7 +455,7 @@ void takeScreenshot()
|
|||
_mouse_blit = screenshotBlitter;
|
||||
|
||||
WindowDrawingProc2* v1 = _mouse_blit_trans;
|
||||
_mouse_blit_trans = nullptr;
|
||||
_mouse_blit_trans = NULL;
|
||||
|
||||
windowRefreshAll(&_scr_size);
|
||||
|
||||
|
@ -496,7 +488,7 @@ int screenshotHandlerDefaultImpl(int width, int height, unsigned char* data, uns
|
|||
snprintf(fileName, sizeof(fileName), "scr%.5d.bmp", index);
|
||||
|
||||
stream = compat_fopen(fileName, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -508,7 +500,7 @@ int screenshotHandlerDefaultImpl(int width, int height, unsigned char* data, uns
|
|||
}
|
||||
|
||||
stream = compat_fopen(fileName, "wb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -607,7 +599,7 @@ void screenshotHandlerConfigure(int keyCode, ScreenshotHandler* handler)
|
|||
{
|
||||
gScreenshotKeyCode = keyCode;
|
||||
|
||||
if (handler == nullptr) {
|
||||
if (handler == NULL) {
|
||||
handler = screenshotHandlerDefaultImpl;
|
||||
}
|
||||
|
||||
|
@ -642,7 +634,12 @@ void inputPauseForTocks(unsigned int delay)
|
|||
// 0x4C93B8
|
||||
void inputBlockForTocks(unsigned int ms)
|
||||
{
|
||||
delay_ms(ms);
|
||||
unsigned int start = SDL_GetTicks();
|
||||
unsigned int diff;
|
||||
do {
|
||||
// NOTE: Uninline
|
||||
diff = getTicksSince(start);
|
||||
} while (diff < ms);
|
||||
}
|
||||
|
||||
// 0x4C93E0
|
||||
|
@ -1197,19 +1194,19 @@ static void _GNW95_process_key(KeyboardData* data)
|
|||
// 0x4C9EEC
|
||||
void _GNW95_lost_focus()
|
||||
{
|
||||
if (_focus_func != nullptr) {
|
||||
if (_focus_func != NULL) {
|
||||
_focus_func(false);
|
||||
}
|
||||
|
||||
while (!gProgramIsActive) {
|
||||
_GNW95_process_message();
|
||||
|
||||
if (_idle_func != nullptr) {
|
||||
if (_idle_func != NULL) {
|
||||
_idle_func();
|
||||
}
|
||||
}
|
||||
|
||||
if (_focus_func != nullptr) {
|
||||
if (_focus_func != NULL) {
|
||||
_focus_func(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, uns
|
|||
int inputInit(int a1);
|
||||
void inputExit();
|
||||
int inputGetInput();
|
||||
void get_input_position(int* x, int* y);
|
||||
void _process_bk();
|
||||
void enqueueInputEvent(int a1);
|
||||
void inputEventQueueReset();
|
||||
|
|
|
@ -194,11 +194,11 @@ static Rect gInterfaceBarActionPointsBarRect;
|
|||
|
||||
// 0x518FE8
|
||||
static IndicatorDescription gIndicatorDescriptions[INDICATOR_COUNT] = {
|
||||
{ 102, true, nullptr }, // ADDICT
|
||||
{ 100, false, nullptr }, // SNEAK
|
||||
{ 101, false, nullptr }, // LEVEL
|
||||
{ 103, true, nullptr }, // POISONED
|
||||
{ 104, true, nullptr }, // RADIATED
|
||||
{ 102, true, NULL }, // ADDICT
|
||||
{ 100, false, NULL }, // SNEAK
|
||||
{ 101, false, NULL }, // LEVEL
|
||||
{ 103, true, NULL }, // POISONED
|
||||
{ 104, true, NULL }, // RADIATED
|
||||
};
|
||||
|
||||
// 0x519024
|
||||
|
@ -327,7 +327,7 @@ int interfaceInit()
|
|||
}
|
||||
|
||||
gInterfaceWindowBuffer = windowGetBuffer(gInterfaceBarWindow);
|
||||
if (gInterfaceWindowBuffer == nullptr) {
|
||||
if (gInterfaceWindowBuffer == NULL) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ int interfaceInit()
|
|||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
gInventoryButton = buttonCreate(gInterfaceBarWindow, 211 + gInterfaceBarContentOffset, 40, 32, 21, -1, -1, -1, KEY_LOWERCASE_I, _inventoryButtonNormalFrmImage.getData(), _inventoryButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
gInventoryButton = buttonCreate(gInterfaceBarWindow, 211 + gInterfaceBarContentOffset, 40, 32, 21, -1, -1, -1, KEY_LOWERCASE_I, _inventoryButtonNormalFrmImage.getData(), _inventoryButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (gInventoryButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -377,7 +377,7 @@ int interfaceInit()
|
|||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
gOptionsButton = buttonCreate(gInterfaceBarWindow, 210 + gInterfaceBarContentOffset, 61, 34, 34, -1, -1, -1, KEY_LOWERCASE_O, _optionsButtonNormalFrmImage.getData(), _optionsButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
gOptionsButton = buttonCreate(gInterfaceBarWindow, 210 + gInterfaceBarContentOffset, 61, 34, 34, -1, -1, -1, KEY_LOWERCASE_O, _optionsButtonNormalFrmImage.getData(), _optionsButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (gOptionsButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -403,7 +403,7 @@ int interfaceInit()
|
|||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
gSkilldexButton = buttonCreate(gInterfaceBarWindow, 523 + gInterfaceBarContentOffset, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_S, _skilldexButtonNormalFrmImage.getData(), _skilldexButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
gSkilldexButton = buttonCreate(gInterfaceBarWindow, 523 + gInterfaceBarContentOffset, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_S, _skilldexButtonNormalFrmImage.getData(), _skilldexButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (gSkilldexButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -430,7 +430,7 @@ int interfaceInit()
|
|||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
gMapButton = buttonCreate(gInterfaceBarWindow, 526 + gInterfaceBarContentOffset, 39, 41, 19, -1, -1, -1, KEY_TAB, _mapButtonNormalFrmImage.getData(), _mapButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
gMapButton = buttonCreate(gInterfaceBarWindow, 526 + gInterfaceBarContentOffset, 39, 41, 19, -1, -1, -1, KEY_TAB, _mapButtonNormalFrmImage.getData(), _mapButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (gMapButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -451,7 +451,7 @@ int interfaceInit()
|
|||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
gPipboyButton = buttonCreate(gInterfaceBarWindow, 526 + gInterfaceBarContentOffset, 77, 41, 19, -1, -1, -1, KEY_LOWERCASE_P, _pipboyButtonNormalFrmImage.getData(), _pipboyButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
gPipboyButton = buttonCreate(gInterfaceBarWindow, 526 + gInterfaceBarContentOffset, 77, 41, 19, -1, -1, -1, KEY_LOWERCASE_P, _pipboyButtonNormalFrmImage.getData(), _pipboyButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (gPipboyButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -472,7 +472,7 @@ int interfaceInit()
|
|||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
gCharacterButton = buttonCreate(gInterfaceBarWindow, 526 + gInterfaceBarContentOffset, 58, 41, 19, -1, -1, -1, KEY_LOWERCASE_C, _characterButtonNormalFrmImage.getData(), _characterButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
gCharacterButton = buttonCreate(gInterfaceBarWindow, 526 + gInterfaceBarContentOffset, 58, 41, 19, -1, -1, -1, KEY_LOWERCASE_C, _characterButtonNormalFrmImage.getData(), _characterButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (gCharacterButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -502,13 +502,13 @@ int interfaceInit()
|
|||
memcpy(_itemButtonUp, _itemButtonNormalFrmImage.getData(), sizeof(_itemButtonUp));
|
||||
memcpy(_itemButtonDown, _itemButtonPressedFrmImage.getData(), sizeof(_itemButtonDown));
|
||||
|
||||
gSingleAttackButton = buttonCreate(gInterfaceBarWindow, 267 + gInterfaceBarContentOffset, 26, 188, 67, -1, -1, -1, -20, _itemButtonUp, _itemButtonDown, nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
gSingleAttackButton = buttonCreate(gInterfaceBarWindow, 267 + gInterfaceBarContentOffset, 26, 188, 67, -1, -1, -1, -20, _itemButtonUp, _itemButtonDown, NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (gSingleAttackButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
}
|
||||
|
||||
buttonSetRightMouseCallbacks(gSingleAttackButton, -1, KEY_LOWERCASE_N, nullptr, nullptr);
|
||||
buttonSetRightMouseCallbacks(gSingleAttackButton, -1, KEY_LOWERCASE_N, NULL, NULL);
|
||||
buttonSetCallbacks(gSingleAttackButton, _gsound_lrg_butt_press, _gsound_lrg_butt_release);
|
||||
|
||||
fid = buildFid(OBJ_TYPE_INTERFACE, 6, 0, 0, 0);
|
||||
|
@ -530,7 +530,7 @@ int interfaceInit()
|
|||
}
|
||||
|
||||
// Swap hands button
|
||||
gChangeHandsButton = buttonCreate(gInterfaceBarWindow, 218 + gInterfaceBarContentOffset, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_B, _changeHandsButtonNormalFrmImage.getData(), _changeHandsButtonPressedFrmImage.getData(), nullptr, BUTTON_FLAG_TRANSPARENT);
|
||||
gChangeHandsButton = buttonCreate(gInterfaceBarWindow, 218 + gInterfaceBarContentOffset, 6, 22, 21, -1, -1, -1, KEY_LOWERCASE_B, _changeHandsButtonNormalFrmImage.getData(), _changeHandsButtonPressedFrmImage.getData(), NULL, BUTTON_FLAG_TRANSPARENT);
|
||||
if (gChangeHandsButton == -1) {
|
||||
// NOTE: Uninline.
|
||||
return intface_fatal_error(-1);
|
||||
|
@ -1053,8 +1053,8 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
|
||||
InterfaceItemState* leftItemState = &(gInterfaceItemStates[HAND_LEFT]);
|
||||
Object* item1 = critterGetItem1(gDude);
|
||||
if (item1 == leftItemState->item && leftItemState->item != nullptr) {
|
||||
if (leftItemState->item != nullptr) {
|
||||
if (item1 == leftItemState->item && leftItemState->item != NULL) {
|
||||
if (leftItemState->item != NULL) {
|
||||
leftItemState->isDisabled = dudeIsWeaponDisabled(item1);
|
||||
leftItemState->itemFid = itemGetInventoryFid(item1);
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
|
||||
leftItemState->item = item1;
|
||||
|
||||
if (item1 != nullptr) {
|
||||
if (item1 != NULL) {
|
||||
leftItemState->isDisabled = dudeIsWeaponDisabled(item1);
|
||||
leftItemState->primaryHitMode = HIT_MODE_LEFT_WEAPON_PRIMARY;
|
||||
leftItemState->secondaryHitMode = HIT_MODE_LEFT_WEAPON_SECONDARY;
|
||||
|
@ -1093,7 +1093,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
|
||||
// SFALL: Keep selected attack mode.
|
||||
// CE: Implementation is different.
|
||||
if (oldItem == nullptr) {
|
||||
if (oldItem == NULL) {
|
||||
leftItemState->action = oldAction;
|
||||
}
|
||||
}
|
||||
|
@ -1102,8 +1102,8 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
InterfaceItemState* rightItemState = &(gInterfaceItemStates[HAND_RIGHT]);
|
||||
|
||||
Object* item2 = critterGetItem2(gDude);
|
||||
if (item2 == rightItemState->item && rightItemState->item != nullptr) {
|
||||
if (rightItemState->item != nullptr) {
|
||||
if (item2 == rightItemState->item && rightItemState->item != NULL) {
|
||||
if (rightItemState->item != NULL) {
|
||||
rightItemState->isDisabled = dudeIsWeaponDisabled(rightItemState->item);
|
||||
rightItemState->itemFid = itemGetInventoryFid(rightItemState->item);
|
||||
}
|
||||
|
@ -1113,7 +1113,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
|
||||
rightItemState->item = item2;
|
||||
|
||||
if (item2 != nullptr) {
|
||||
if (item2 != NULL) {
|
||||
rightItemState->isDisabled = dudeIsWeaponDisabled(item2);
|
||||
rightItemState->primaryHitMode = HIT_MODE_RIGHT_WEAPON_PRIMARY;
|
||||
rightItemState->secondaryHitMode = HIT_MODE_RIGHT_WEAPON_SECONDARY;
|
||||
|
@ -1141,7 +1141,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
|
||||
// SFALL: Keep selected attack mode.
|
||||
// CE: Implementation is different.
|
||||
if (oldItem == nullptr) {
|
||||
if (oldItem == NULL) {
|
||||
rightItemState->action = oldAction;
|
||||
}
|
||||
}
|
||||
|
@ -1151,7 +1151,7 @@ int interfaceUpdateItems(bool animated, int leftItemAction, int rightItemAction)
|
|||
Object* newCurrentItem = gInterfaceItemStates[gInterfaceCurrentHand].item;
|
||||
if (newCurrentItem != oldCurrentItem) {
|
||||
int animationCode = 0;
|
||||
if (newCurrentItem != nullptr) {
|
||||
if (newCurrentItem != NULL) {
|
||||
if (itemGetType(newCurrentItem) == ITEM_TYPE_WEAPON) {
|
||||
animationCode = weaponGetAnimationCode(newCurrentItem);
|
||||
}
|
||||
|
@ -1180,7 +1180,7 @@ int interfaceBarSwapHands(bool animated)
|
|||
if (animated) {
|
||||
Object* item = gInterfaceItemStates[gInterfaceCurrentHand].item;
|
||||
int animationCode = 0;
|
||||
if (item != nullptr) {
|
||||
if (item != NULL) {
|
||||
if (itemGetType(item) == ITEM_TYPE_WEAPON) {
|
||||
animationCode = weaponGetAnimationCode(item);
|
||||
}
|
||||
|
@ -1298,7 +1298,7 @@ void _intface_use_item()
|
|||
gameMouseSetCursor(MOUSE_CURSOR_CROSSHAIR);
|
||||
gameMouseSetMode(GAME_MOUSE_MODE_CROSSHAIR);
|
||||
if (!isInCombat()) {
|
||||
_combat(nullptr);
|
||||
_combat(NULL);
|
||||
}
|
||||
}
|
||||
} else if (_proto_action_can_use_on(ptr->item->pid)) {
|
||||
|
@ -1389,7 +1389,7 @@ void interfaceBarEndButtonsShow(bool animated)
|
|||
int fid = buildFid(OBJ_TYPE_INTERFACE, 104, 0, 0, 0);
|
||||
CacheEntry* handle;
|
||||
Art* art = artLock(fid, &handle);
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1405,7 +1405,7 @@ void interfaceBarEndButtonsShow(bool animated)
|
|||
|
||||
if (getTicksSince(time) >= delay) {
|
||||
unsigned char* src = artGetFrameData(art, frame, 0);
|
||||
if (src != nullptr) {
|
||||
if (src != NULL) {
|
||||
blitBufferToBuffer(src, 57, 58, 57, gInterfaceWindowBuffer + gInterfaceBarWidth * 38 + 580 + gInterfaceBarContentOffset, gInterfaceBarWidth);
|
||||
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
|
||||
}
|
||||
|
@ -1446,7 +1446,7 @@ void interfaceBarEndButtonsHide(bool animated)
|
|||
int fid = buildFid(OBJ_TYPE_INTERFACE, 104, 0, 0, 0);
|
||||
CacheEntry* handle;
|
||||
Art* art = artLock(fid, &handle);
|
||||
if (art == nullptr) {
|
||||
if (art == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1465,7 +1465,7 @@ void interfaceBarEndButtonsHide(bool animated)
|
|||
if (getTicksSince(time) >= delay) {
|
||||
unsigned char* src = artGetFrameData(art, frame - 1, 0);
|
||||
unsigned char* dest = gInterfaceWindowBuffer + gInterfaceBarWidth * 38 + 580 + gInterfaceBarContentOffset;
|
||||
if (src != nullptr) {
|
||||
if (src != NULL) {
|
||||
blitBufferToBuffer(src, 57, 58, 57, dest, gInterfaceBarWidth);
|
||||
windowRefreshRect(gInterfaceBarWindow, &gInterfaceBarEndButtonsRect);
|
||||
}
|
||||
|
@ -1827,10 +1827,10 @@ static void interfaceBarSwapHandsAnimatePutAwayTakeOutSequence(int previousWeapo
|
|||
}
|
||||
|
||||
// TODO: Get rid of cast.
|
||||
animationRegisterCallbackForced(nullptr, nullptr, (AnimationCallback*)_intface_redraw_items_callback, -1);
|
||||
animationRegisterCallbackForced(NULL, NULL, (AnimationCallback*)_intface_redraw_items_callback, -1);
|
||||
|
||||
Object* item = gInterfaceItemStates[gInterfaceCurrentHand].item;
|
||||
if (item != nullptr && item->lightDistance > 4) {
|
||||
if (item != NULL && item->lightDistance > 4) {
|
||||
animationRegisterSetLightDistance(gDude, item->lightDistance, 0);
|
||||
}
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ static void interfaceBarSwapHandsAnimatePutAwayTakeOutSequence(int previousWeapo
|
|||
}
|
||||
|
||||
// TODO: Get rid of cast.
|
||||
animationRegisterCallbackForced(nullptr, nullptr, (AnimationCallback*)_intface_change_fid_callback, -1);
|
||||
animationRegisterCallbackForced(NULL, NULL, (AnimationCallback*)_intface_change_fid_callback, -1);
|
||||
|
||||
if (reg_anim_end() == -1) {
|
||||
return;
|
||||
|
@ -1900,7 +1900,7 @@ static int endTurnButtonInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
gEndTurnButton = buttonCreate(gInterfaceBarWindow, 590 + gInterfaceBarContentOffset, 43, 38, 22, -1, -1, -1, 32, _endTurnButtonNormalFrmImage.getData(), _endTurnButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
gEndTurnButton = buttonCreate(gInterfaceBarWindow, 590 + gInterfaceBarContentOffset, 43, 38, 22, -1, -1, -1, 32, _endTurnButtonNormalFrmImage.getData(), _endTurnButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (gEndTurnButton == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1952,7 +1952,7 @@ static int endCombatButtonInit()
|
|||
return -1;
|
||||
}
|
||||
|
||||
gEndCombatButton = buttonCreate(gInterfaceBarWindow, 590 + gInterfaceBarContentOffset, 65, 38, 22, -1, -1, -1, 13, _endCombatButtonNormalFrmImage.getData(), _endCombatButtonPressedFrmImage.getData(), nullptr, 0);
|
||||
gEndCombatButton = buttonCreate(gInterfaceBarWindow, 590 + gInterfaceBarContentOffset, 65, 38, 22, -1, -1, -1, 13, _endCombatButtonNormalFrmImage.getData(), _endCombatButtonPressedFrmImage.getData(), NULL, 0);
|
||||
if (gEndCombatButton == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -2034,7 +2034,7 @@ static int _intface_item_reload()
|
|||
return -1;
|
||||
}
|
||||
|
||||
const char* sfx = sfxBuildWeaponName(WEAPON_SOUND_EFFECT_READY, gInterfaceItemStates[gInterfaceCurrentHand].item, HIT_MODE_RIGHT_WEAPON_PRIMARY, nullptr);
|
||||
const char* sfx = sfxBuildWeaponName(WEAPON_SOUND_EFFECT_READY, gInterfaceItemStates[gInterfaceCurrentHand].item, HIT_MODE_RIGHT_WEAPON_PRIMARY, NULL);
|
||||
soundPlayFile(sfx);
|
||||
|
||||
return 0;
|
||||
|
@ -2222,7 +2222,7 @@ static int indicatorBarInit()
|
|||
IndicatorDescription* indicatorDescription = &(gIndicatorDescriptions[index]);
|
||||
|
||||
indicatorDescription->data = (unsigned char*)internal_malloc(INDICATOR_BOX_WIDTH * INDICATOR_BOX_HEIGHT);
|
||||
if (indicatorDescription->data == nullptr) {
|
||||
if (indicatorDescription->data == NULL) {
|
||||
debugPrint("\nINTRFACE: Error initializing indicator box graphics! **");
|
||||
|
||||
while (--index >= 0) {
|
||||
|
@ -2276,9 +2276,9 @@ static void interfaceBarFree()
|
|||
|
||||
for (int index = 0; index < INDICATOR_COUNT; index++) {
|
||||
IndicatorDescription* indicatorBoxDescription = &(gIndicatorDescriptions[index]);
|
||||
if (indicatorBoxDescription->data != nullptr) {
|
||||
if (indicatorBoxDescription->data != NULL) {
|
||||
internal_free(indicatorBoxDescription->data);
|
||||
indicatorBoxDescription->data = nullptr;
|
||||
indicatorBoxDescription->data = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@ static int _outputStr(char* a1);
|
|||
static int _checkWait(Program* program);
|
||||
static char* programGetCurrentProcedureName(Program* s);
|
||||
static opcode_t stackReadInt16(unsigned char* data, int pos);
|
||||
static int stackReadInt32(unsigned char* data, int pos);
|
||||
static void stackWriteInt16(int value, unsigned char* data, int pos);
|
||||
static void stackWriteInt32(int value, unsigned char* data, int pos);
|
||||
static void stackPushInt16(unsigned char* data, int* pointer, int value);
|
||||
static void stackPushInt32(unsigned char* data, int* pointer, int value);
|
||||
static int stackPopInt32(unsigned char* data, int* pointer);
|
||||
static opcode_t stackPopInt16(unsigned char* data, int* pointer);
|
||||
static int stackReadInt32(unsigned char* a1, int a2);
|
||||
static void stackWriteInt16(int value, unsigned char* a2, int a3);
|
||||
static void stackWriteInt32(int value, unsigned char* stack, int pos);
|
||||
static void stackPushInt16(unsigned char* a1, int* a2, int value);
|
||||
static void stackPushInt32(unsigned char* a1, int* a2, int value);
|
||||
static int stackPopInt32(unsigned char* a1, int* a2);
|
||||
static opcode_t stackPopInt16(unsigned char* a1, int* a2);
|
||||
static void _interpretIncStringRef(Program* program, opcode_t opcode, int value);
|
||||
static void programReturnStackPushInt16(Program* program, int value);
|
||||
static opcode_t programReturnStackPopInt16(Program* program);
|
||||
|
@ -51,7 +51,7 @@ static void opPush(Program* program);
|
|||
static void opPushBase(Program* program);
|
||||
static void opPopBase(Program* program);
|
||||
static void opPopToBase(Program* program);
|
||||
static void opSetGlobal(Program* program);
|
||||
static void op802C(Program* program);
|
||||
static void opDump(Program* program);
|
||||
static void opDelayedCall(Program* program);
|
||||
static void opConditionalCall(Program* program);
|
||||
|
@ -208,7 +208,7 @@ void _interpretOutputFunc(int (*func)(char*))
|
|||
// 0x467104
|
||||
int _interpretOutput(const char* format, ...)
|
||||
{
|
||||
if (_outputFunc == nullptr) {
|
||||
if (_outputFunc == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -230,17 +230,17 @@ static char* programGetCurrentProcedureName(Program* program)
|
|||
int procedureCount = stackReadInt32(program->procedures, 0);
|
||||
unsigned char* ptr = program->procedures + 4;
|
||||
|
||||
int procedureOffset = stackReadInt32(ptr, offsetof(Procedure, bodyOffset));
|
||||
int identifierOffset = stackReadInt32(ptr, offsetof(Procedure, nameOffset));
|
||||
int procedureOffset = stackReadInt32(ptr, 16);
|
||||
int identifierOffset = stackReadInt32(ptr, 0);
|
||||
|
||||
for (int index = 0; index < procedureCount; index++) {
|
||||
int nextProcedureOffset = stackReadInt32(ptr + 24, offsetof(Procedure, bodyOffset));
|
||||
int nextProcedureOffset = stackReadInt32(ptr + 24, 16);
|
||||
if (program->instructionPointer >= procedureOffset && program->instructionPointer < nextProcedureOffset) {
|
||||
return (char*)(program->identifiers + identifierOffset);
|
||||
}
|
||||
|
||||
ptr += 24;
|
||||
identifierOffset = stackReadInt32(ptr, offsetof(Procedure, nameOffset));
|
||||
identifierOffset = stackReadInt32(ptr, 0);
|
||||
}
|
||||
|
||||
return _aCouldnTFindPro;
|
||||
|
@ -258,7 +258,7 @@ static char* programGetCurrentProcedureName(Program* program)
|
|||
|
||||
debugPrint("\nError during execution: %s\n", string);
|
||||
|
||||
if (gInterpreterCurrentProgram == nullptr) {
|
||||
if (gInterpreterCurrentProgram == NULL) {
|
||||
debugPrint("No current script");
|
||||
} else {
|
||||
char* procedureName = programGetCurrentProcedureName(gInterpreterCurrentProgram);
|
||||
|
@ -402,11 +402,11 @@ void _interpretDecStringRef(Program* program, opcode_t opcode, int value)
|
|||
static void _detachProgram(Program* program)
|
||||
{
|
||||
Program* parent = program->parent;
|
||||
if (parent != nullptr) {
|
||||
if (parent != NULL) {
|
||||
parent->flags &= ~PROGRAM_FLAG_0x20;
|
||||
parent->flags &= ~PROGRAM_FLAG_0x0100;
|
||||
if (program == parent->child) {
|
||||
parent->child = nullptr;
|
||||
parent->child = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -427,14 +427,14 @@ void programFree(Program* program)
|
|||
_detachProgram(program);
|
||||
|
||||
Program* curr = program->child;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
// NOTE: Uninline.
|
||||
_purgeProgram(curr);
|
||||
|
||||
curr->parent = nullptr;
|
||||
curr->parent = NULL;
|
||||
|
||||
Program* next = curr->child;
|
||||
curr->child = nullptr;
|
||||
curr->child = NULL;
|
||||
|
||||
curr = next;
|
||||
}
|
||||
|
@ -442,15 +442,15 @@ void programFree(Program* program)
|
|||
// NOTE: Uninline.
|
||||
_purgeProgram(program);
|
||||
|
||||
if (program->dynamicStrings != nullptr) {
|
||||
if (program->dynamicStrings != NULL) {
|
||||
internal_free_safe(program->dynamicStrings, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 429
|
||||
}
|
||||
|
||||
if (program->data != nullptr) {
|
||||
if (program->data != NULL) {
|
||||
internal_free_safe(program->data, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 430
|
||||
}
|
||||
|
||||
if (program->name != nullptr) {
|
||||
if (program->name != NULL) {
|
||||
internal_free_safe(program->name, __FILE__, __LINE__); // "..\\int\\INTRPRET.C", 431
|
||||
}
|
||||
|
||||
|
@ -464,11 +464,11 @@ void programFree(Program* program)
|
|||
Program* programCreateByPath(const char* path)
|
||||
{
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
char err[260];
|
||||
snprintf(err, sizeof(err), "Couldn't open %s for read\n", path);
|
||||
programFatalError(err);
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int fileSize = fileGetSize(stream);
|
||||
|
@ -483,8 +483,8 @@ Program* programCreateByPath(const char* path)
|
|||
program->name = (char*)internal_malloc_safe(strlen(path) + 1, __FILE__, __LINE__); // ..\\int\\INTRPRET.C, 466
|
||||
strcpy(program->name, path);
|
||||
|
||||
program->child = nullptr;
|
||||
program->parent = nullptr;
|
||||
program->child = NULL;
|
||||
program->parent = NULL;
|
||||
program->field_78 = -1;
|
||||
program->exited = false;
|
||||
program->basePointer = -1;
|
||||
|
@ -528,7 +528,7 @@ char* programGetString(Program* program, opcode_t opcode, int offset)
|
|||
return (char*)(program->staticStrings + 4 + offset);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x46790C
|
||||
|
@ -554,7 +554,7 @@ static void programMarkHeap(Program* program)
|
|||
short next_len;
|
||||
short diff;
|
||||
|
||||
if (program->dynamicStrings == nullptr) {
|
||||
if (program->dynamicStrings == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -593,7 +593,7 @@ int programPushString(Program* program, char* string)
|
|||
unsigned char* v20;
|
||||
unsigned char* v23;
|
||||
|
||||
if (program == nullptr) {
|
||||
if (program == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -604,7 +604,7 @@ int programPushString(Program* program, char* string)
|
|||
v27++;
|
||||
}
|
||||
|
||||
if (program->dynamicStrings != nullptr) {
|
||||
if (program->dynamicStrings != NULL) {
|
||||
// TODO: Needs testing, lots of pointer stuff.
|
||||
unsigned char* heap = program->dynamicStrings + 4;
|
||||
while (*(unsigned short*)heap != 0x8000) {
|
||||
|
@ -712,7 +712,7 @@ static void opPopToBase(Program* program)
|
|||
}
|
||||
|
||||
// 0x467DE0
|
||||
static void opSetGlobal(Program* program)
|
||||
static void op802C(Program* program)
|
||||
{
|
||||
program->basePointer = program->stackValues->size();
|
||||
}
|
||||
|
@ -745,10 +745,10 @@ static void opDelayedCall(Program* program)
|
|||
delay += 1000 * _timerFunc() / _timerTick;
|
||||
}
|
||||
|
||||
int flags = stackReadInt32(procedure_ptr, offsetof(Procedure, flags));
|
||||
int flags = stackReadInt32(procedure_ptr, 4);
|
||||
|
||||
stackWriteInt32(delay, procedure_ptr, offsetof(Procedure, time));
|
||||
stackWriteInt32(flags | PROCEDURE_FLAG_TIMED, procedure_ptr, offsetof(Procedure, flags));
|
||||
stackWriteInt32(delay, procedure_ptr, 8);
|
||||
stackWriteInt32(flags | PROCEDURE_FLAG_TIMED, procedure_ptr, 4);
|
||||
}
|
||||
|
||||
// 0x468034
|
||||
|
@ -761,10 +761,10 @@ static void opConditionalCall(Program* program)
|
|||
}
|
||||
|
||||
unsigned char* procedure_ptr = program->procedures + 4 + 24 * data[0];
|
||||
int flags = stackReadInt32(procedure_ptr, offsetof(Procedure, flags));
|
||||
int flags = stackReadInt32(procedure_ptr, 4);
|
||||
|
||||
stackWriteInt32(flags | PROCEDURE_FLAG_CONDITIONAL, procedure_ptr, offsetof(Procedure, flags));
|
||||
stackWriteInt32(data[1], procedure_ptr, offsetof(Procedure, conditionOffset));
|
||||
stackWriteInt32(flags | PROCEDURE_FLAG_CONDITIONAL, procedure_ptr, 4);
|
||||
stackWriteInt32(data[1], procedure_ptr, 12);
|
||||
}
|
||||
|
||||
// 0x46817C
|
||||
|
@ -788,9 +788,9 @@ static void opCancel(Program* program)
|
|||
}
|
||||
|
||||
Procedure* proc = (Procedure*)(program->procedures + 4 + data * sizeof(*proc));
|
||||
proc->flags = 0;
|
||||
proc->time = 0;
|
||||
proc->conditionOffset = 0;
|
||||
proc->field_4 = 0;
|
||||
proc->field_8 = 0;
|
||||
proc->field_C = 0;
|
||||
}
|
||||
|
||||
// 0x468330
|
||||
|
@ -802,9 +802,9 @@ static void opCancelAll(Program* program)
|
|||
// TODO: Original code uses different approach, check.
|
||||
Procedure* proc = (Procedure*)(program->procedures + 4 + index * sizeof(*proc));
|
||||
|
||||
proc->flags = 0;
|
||||
proc->time = 0;
|
||||
proc->conditionOffset = 0;
|
||||
proc->field_4 = 0;
|
||||
proc->field_8 = 0;
|
||||
proc->field_C = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1131,12 +1131,7 @@ static void opConditionalOperatorLessThanEquals(Program* program)
|
|||
case VALUE_TYPE_PTR:
|
||||
switch (value[0].opcode) {
|
||||
case VALUE_TYPE_INT:
|
||||
if (value[0].integerValue > 0) {
|
||||
result = (uintptr_t)value[1].pointerValue <= (uintptr_t)value[0].integerValue;
|
||||
} else {
|
||||
// (ptr <= int{0 or negative}) means (ptr == nullptr)
|
||||
result = nullptr == value[1].pointerValue;
|
||||
}
|
||||
result = (uintptr_t)value[1].pointerValue <= (uintptr_t)value[0].integerValue;
|
||||
break;
|
||||
default:
|
||||
assert(false && "Should be unreachable");
|
||||
|
@ -1390,12 +1385,7 @@ static void opConditionalOperatorGreaterThan(Program* program)
|
|||
case VALUE_TYPE_PTR:
|
||||
switch (value[0].opcode) {
|
||||
case VALUE_TYPE_INT:
|
||||
if (value[0].integerValue > 0) {
|
||||
result = (uintptr_t)value[1].pointerValue > (uintptr_t)value[0].integerValue;
|
||||
} else {
|
||||
// (ptr > int{0 or negative}) means (ptr != nullptr)
|
||||
result = nullptr != value[1].pointerValue;
|
||||
}
|
||||
result = (uintptr_t)value[1].pointerValue > (uintptr_t)value[0].integerValue;
|
||||
break;
|
||||
default:
|
||||
assert(false && "Should be unreachable");
|
||||
|
@ -2040,12 +2030,12 @@ static void opCall(Program* program)
|
|||
|
||||
unsigned char* ptr = program->procedures + 4 + 24 * value;
|
||||
|
||||
int flags = stackReadInt32(ptr, offsetof(Procedure, flags));
|
||||
if ((flags & PROCEDURE_FLAG_IMPORTED) != 0) {
|
||||
int flags = stackReadInt32(ptr, 4);
|
||||
if ((flags & 4) != 0) {
|
||||
// TODO: Incomplete.
|
||||
} else {
|
||||
program->instructionPointer = stackReadInt32(ptr, offsetof(Procedure, bodyOffset));
|
||||
if ((flags & PROCEDURE_FLAG_CRITICAL) != 0) {
|
||||
program->instructionPointer = stackReadInt32(ptr, 16);
|
||||
if ((flags & 0x10) != 0) {
|
||||
program->flags |= PROGRAM_FLAG_CRITICAL_SECTION;
|
||||
}
|
||||
}
|
||||
|
@ -2248,7 +2238,7 @@ static void opFetchProcedureAddress(Program* program)
|
|||
{
|
||||
int procedureIndex = programStackPopInteger(program);
|
||||
|
||||
int address = stackReadInt32(program->procedures + 4 + sizeof(Procedure) * procedureIndex, offsetof(Procedure, bodyOffset));
|
||||
int address = stackReadInt32(program->procedures + 4 + sizeof(Procedure) * procedureIndex, 16);
|
||||
programStackPushInteger(program, address);
|
||||
}
|
||||
|
||||
|
@ -2308,8 +2298,8 @@ static void opExportProcedure(Program* program)
|
|||
|
||||
unsigned char* proc_ptr = program->procedures + 4 + sizeof(Procedure) * procedureIndex;
|
||||
|
||||
char* procedureName = programGetIdentifier(program, stackReadInt32(proc_ptr, offsetof(Procedure, nameOffset)));
|
||||
int procedureAddress = stackReadInt32(proc_ptr, offsetof(Procedure, bodyOffset));
|
||||
char* procedureName = programGetIdentifier(program, stackReadInt32(proc_ptr, 0));
|
||||
int procedureAddress = stackReadInt32(proc_ptr, 16);
|
||||
|
||||
if (externalProcedureCreate(program, procedureName, procedureAddress, argumentCount) != 0) {
|
||||
char err[256];
|
||||
|
@ -2338,7 +2328,7 @@ static void opExit(Program* program)
|
|||
program->flags |= PROGRAM_FLAG_EXITED;
|
||||
|
||||
Program* parent = program->parent;
|
||||
if (parent != nullptr) {
|
||||
if (parent != NULL) {
|
||||
if ((parent->flags & PROGRAM_FLAG_0x0100) != 0) {
|
||||
parent->flags &= ~PROGRAM_FLAG_0x0100;
|
||||
}
|
||||
|
@ -2354,7 +2344,7 @@ static void opExit(Program* program)
|
|||
static void opDetach(Program* program)
|
||||
{
|
||||
Program* parent = program->parent;
|
||||
if (parent == nullptr) {
|
||||
if (parent == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2362,7 +2352,7 @@ static void opDetach(Program* program)
|
|||
parent->flags &= ~PROGRAM_FLAG_0x0100;
|
||||
|
||||
if (parent->child == program) {
|
||||
parent->child = nullptr;
|
||||
parent->child = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2380,7 +2370,7 @@ static void opCallStart(Program* program)
|
|||
|
||||
// NOTE: Uninline.
|
||||
program->child = runScript(name);
|
||||
if (program->child == nullptr) {
|
||||
if (program->child == NULL) {
|
||||
char err[260];
|
||||
snprintf(err, sizeof(err), "Error spawning child %s", name);
|
||||
programFatalError(err);
|
||||
|
@ -2404,7 +2394,7 @@ static void opSpawn(Program* program)
|
|||
|
||||
// NOTE: Uninline.
|
||||
program->child = runScript(name);
|
||||
if (program->child == nullptr) {
|
||||
if (program->child == NULL) {
|
||||
char err[260];
|
||||
snprintf(err, sizeof(err), "Error spawning child %s", name);
|
||||
programFatalError(err);
|
||||
|
@ -2426,7 +2416,7 @@ static Program* forkProgram(Program* program)
|
|||
char* name = programStackPopString(program);
|
||||
Program* forked = runScript(name);
|
||||
|
||||
if (forked == nullptr) {
|
||||
if (forked == NULL) {
|
||||
char err[256];
|
||||
snprintf(err, sizeof(err), "couldn't fork script '%s'", name);
|
||||
programFatalError(err);
|
||||
|
@ -2451,19 +2441,19 @@ static void opExec(Program* program)
|
|||
Program* parent = program->parent;
|
||||
Program* fork = forkProgram(program);
|
||||
|
||||
if (parent != nullptr) {
|
||||
if (parent != NULL) {
|
||||
fork->parent = parent;
|
||||
parent->child = fork;
|
||||
}
|
||||
|
||||
fork->child = nullptr;
|
||||
fork->child = NULL;
|
||||
|
||||
program->parent = nullptr;
|
||||
program->parent = NULL;
|
||||
program->flags |= PROGRAM_FLAG_EXITED;
|
||||
|
||||
// probably inlining due to check for null
|
||||
parent = program->parent;
|
||||
if (parent != nullptr) {
|
||||
if (parent != NULL) {
|
||||
if ((parent->flags & PROGRAM_FLAG_0x0100) != 0) {
|
||||
parent->flags &= ~PROGRAM_FLAG_0x0100;
|
||||
}
|
||||
|
@ -2478,9 +2468,9 @@ static void opCheckProcedureArgumentCount(Program* program)
|
|||
int expectedArgumentCount = programStackPopInteger(program);
|
||||
int procedureIndex = programStackPopInteger(program);
|
||||
|
||||
int actualArgumentCount = stackReadInt32(program->procedures + 4 + 24 * procedureIndex, offsetof(Procedure, argCount));
|
||||
int actualArgumentCount = stackReadInt32(program->procedures + 4 + 24 * procedureIndex, 20);
|
||||
if (actualArgumentCount != expectedArgumentCount) {
|
||||
const char* identifier = programGetIdentifier(program, stackReadInt32(program->procedures + 4 + 24 * procedureIndex, offsetof(Procedure, nameOffset)));
|
||||
const char* identifier = programGetIdentifier(program, stackReadInt32(program->procedures + 4 + 24 * procedureIndex, 0));
|
||||
char err[260];
|
||||
snprintf(err, sizeof(err), "Wrong number of args to procedure %s\n", identifier);
|
||||
programFatalError(err);
|
||||
|
@ -2501,7 +2491,7 @@ static void opLookupStringProc(Program* program)
|
|||
// Start with 1 since we've skipped main procedure, which is always at
|
||||
// index 0.
|
||||
for (int index = 1; index < procedureCount; index++) {
|
||||
int offset = stackReadInt32(procedurePtr, offsetof(Procedure, nameOffset));
|
||||
int offset = stackReadInt32(procedurePtr, 0);
|
||||
const char* procedureName = programGetIdentifier(program, offset);
|
||||
if (compat_stricmp(procedureName, procedureNameToLookup) == 0) {
|
||||
programStackPushInteger(program, index);
|
||||
|
@ -2566,7 +2556,7 @@ void interpreterRegisterOpcodeHandlers()
|
|||
interpreterRegisterOpcode(OPCODE_POP_BASE, opPopBase);
|
||||
interpreterRegisterOpcode(OPCODE_POP_TO_BASE, opPopToBase);
|
||||
interpreterRegisterOpcode(OPCODE_PUSH_BASE, opPushBase);
|
||||
interpreterRegisterOpcode(OPCODE_SET_GLOBAL, opSetGlobal);
|
||||
interpreterRegisterOpcode(OPCODE_SET_GLOBAL, op802C);
|
||||
interpreterRegisterOpcode(OPCODE_FETCH_PROCEDURE_ADDRESS, opFetchProcedureAddress);
|
||||
interpreterRegisterOpcode(OPCODE_DUMP, opDump);
|
||||
interpreterRegisterOpcode(OPCODE_IF, opIf);
|
||||
|
@ -2657,7 +2647,7 @@ void _interpret(Program* program, int a2)
|
|||
if ((program->flags & PROGRAM_IS_WAITING) != 0) {
|
||||
_busy = 1;
|
||||
|
||||
if (program->checkWaitFunc != nullptr) {
|
||||
if (program->checkWaitFunc != NULL) {
|
||||
if (!program->checkWaitFunc(program)) {
|
||||
_busy = 0;
|
||||
continue;
|
||||
|
@ -2665,7 +2655,7 @@ void _interpret(Program* program, int a2)
|
|||
}
|
||||
|
||||
_busy = 0;
|
||||
program->checkWaitFunc = nullptr;
|
||||
program->checkWaitFunc = NULL;
|
||||
program->flags &= ~PROGRAM_IS_WAITING;
|
||||
}
|
||||
|
||||
|
@ -2683,7 +2673,7 @@ void _interpret(Program* program, int a2)
|
|||
|
||||
unsigned int opcodeIndex = opcode & 0x3FF;
|
||||
OpcodeHandler* handler = gInterpreterOpcodeHandlers[opcodeIndex];
|
||||
if (handler == nullptr) {
|
||||
if (handler == NULL) {
|
||||
snprintf(err, sizeof(err), "Undefined opcode %x.", opcode);
|
||||
programFatalError(err);
|
||||
}
|
||||
|
@ -2692,11 +2682,11 @@ void _interpret(Program* program, int a2)
|
|||
}
|
||||
|
||||
if ((program->flags & PROGRAM_FLAG_EXITED) != 0) {
|
||||
if (program->parent != nullptr) {
|
||||
if (program->parent != NULL) {
|
||||
if (program->parent->flags & PROGRAM_FLAG_0x20) {
|
||||
program->parent->flags &= ~PROGRAM_FLAG_0x20;
|
||||
program->parent->child = nullptr;
|
||||
program->parent = nullptr;
|
||||
program->parent->child = NULL;
|
||||
program->parent = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2786,11 +2776,11 @@ void _executeProc(Program* program, int procedureIndex)
|
|||
char err[256];
|
||||
|
||||
procedurePtr = program->procedures + 4 + sizeof(Procedure) * procedureIndex;
|
||||
procedureFlags = stackReadInt32(procedurePtr, offsetof(Procedure, flags));
|
||||
procedureFlags = stackReadInt32(procedurePtr, 4);
|
||||
if ((procedureFlags & PROCEDURE_FLAG_IMPORTED) != 0) {
|
||||
procedureIdentifier = programGetIdentifier(program, stackReadInt32(procedurePtr, offsetof(Procedure, nameOffset)));
|
||||
procedureIdentifier = programGetIdentifier(program, stackReadInt32(procedurePtr, 0));
|
||||
externalProgram = externalProcedureGetProgram(procedureIdentifier, &externalProcedureAddress, &externalProcedureArgumentCount);
|
||||
if (externalProgram != nullptr) {
|
||||
if (externalProgram != NULL) {
|
||||
if (externalProcedureArgumentCount == 0) {
|
||||
} else {
|
||||
snprintf(err, sizeof(err), "External procedure cannot take arguments in interrupt context");
|
||||
|
@ -2805,7 +2795,7 @@ void _executeProc(Program* program, int procedureIndex)
|
|||
_setupExternalCall(program, externalProgram, externalProcedureAddress, 28);
|
||||
|
||||
procedurePtr = externalProgram->procedures + 4 + sizeof(Procedure) * procedureIndex;
|
||||
procedureFlags = stackReadInt32(procedurePtr, offsetof(Procedure, flags));
|
||||
procedureFlags = stackReadInt32(procedurePtr, 4);
|
||||
|
||||
if ((procedureFlags & PROCEDURE_FLAG_CRITICAL) != 0) {
|
||||
// NOTE: Uninline.
|
||||
|
@ -2813,7 +2803,7 @@ void _executeProc(Program* program, int procedureIndex)
|
|||
_interpret(externalProgram, 0);
|
||||
}
|
||||
} else {
|
||||
procedureAddress = stackReadInt32(procedurePtr, offsetof(Procedure, bodyOffset));
|
||||
procedureAddress = stackReadInt32(procedurePtr, 16);
|
||||
|
||||
// NOTE: Uninline.
|
||||
_setupCall(program, procedureAddress, 20);
|
||||
|
@ -2836,7 +2826,7 @@ int programFindProcedure(Program* program, const char* name)
|
|||
|
||||
unsigned char* ptr = program->procedures + 4;
|
||||
for (int index = 0; index < procedureCount; index++) {
|
||||
int identifierOffset = stackReadInt32(ptr, offsetof(Procedure, nameOffset));
|
||||
int identifierOffset = stackReadInt32(ptr, offsetof(Procedure, field_0));
|
||||
if (compat_stricmp((char*)(program->identifiers + identifierOffset), name) == 0) {
|
||||
return index;
|
||||
}
|
||||
|
@ -2861,12 +2851,12 @@ void _executeProcedure(Program* program, int procedureIndex)
|
|||
jmp_buf env;
|
||||
|
||||
procedurePtr = program->procedures + 4 + sizeof(Procedure) * procedureIndex;
|
||||
procedureFlags = stackReadInt32(procedurePtr, offsetof(Procedure, flags));
|
||||
procedureFlags = stackReadInt32(procedurePtr, 4);
|
||||
|
||||
if ((procedureFlags & PROCEDURE_FLAG_IMPORTED) != 0) {
|
||||
procedureIdentifier = programGetIdentifier(program, stackReadInt32(procedurePtr, offsetof(Procedure, nameOffset)));
|
||||
procedureIdentifier = programGetIdentifier(program, stackReadInt32(procedurePtr, 0));
|
||||
externalProgram = externalProcedureGetProgram(procedureIdentifier, &externalProcedureAddress, &externalProcedureArgumentCount);
|
||||
if (externalProgram != nullptr) {
|
||||
if (externalProgram != NULL) {
|
||||
if (externalProcedureArgumentCount == 0) {
|
||||
// NOTE: Uninline.
|
||||
_setupExternalCall(program, externalProgram, externalProcedureAddress, 32);
|
||||
|
@ -2882,7 +2872,7 @@ void _executeProcedure(Program* program, int procedureIndex)
|
|||
_interpretOutput(err);
|
||||
}
|
||||
} else {
|
||||
procedureAddress = stackReadInt32(procedurePtr, offsetof(Procedure, bodyOffset));
|
||||
procedureAddress = stackReadInt32(procedurePtr, 16);
|
||||
|
||||
// NOTE: Uninline.
|
||||
_setupCall(program, procedureAddress, 24);
|
||||
|
@ -2913,19 +2903,19 @@ static void _doEvents()
|
|||
programListNode = gInterpreterProgramListHead;
|
||||
time = 1000 * _timerFunc() / _timerTick;
|
||||
|
||||
while (programListNode != nullptr) {
|
||||
while (programListNode != NULL) {
|
||||
procedureCount = stackReadInt32(programListNode->program->procedures, 0);
|
||||
|
||||
procedurePtr = programListNode->program->procedures + 4;
|
||||
for (procedureIndex = 0; procedureIndex < procedureCount; procedureIndex++) {
|
||||
procedureFlags = stackReadInt32(procedurePtr, offsetof(Procedure, flags));
|
||||
procedureFlags = stackReadInt32(procedurePtr, 4);
|
||||
if ((procedureFlags & PROCEDURE_FLAG_CONDITIONAL) != 0) {
|
||||
memcpy(env, programListNode->program, sizeof(env));
|
||||
oldProgramFlags = programListNode->program->flags;
|
||||
oldInstructionPointer = programListNode->program->instructionPointer;
|
||||
|
||||
programListNode->program->flags = 0;
|
||||
programListNode->program->instructionPointer = stackReadInt32(procedurePtr, offsetof(Procedure, conditionOffset));
|
||||
programListNode->program->instructionPointer = stackReadInt32(procedurePtr, 12);
|
||||
_interpret(programListNode->program, -1);
|
||||
|
||||
if ((programListNode->program->flags & PROGRAM_FLAG_0x04) == 0) {
|
||||
|
@ -2936,16 +2926,16 @@ static void _doEvents()
|
|||
|
||||
if (data != 0) {
|
||||
// NOTE: Uninline.
|
||||
stackWriteInt32(0, procedurePtr, offsetof(Procedure, flags));
|
||||
stackWriteInt32(0, procedurePtr, 4);
|
||||
_executeProc(programListNode->program, procedureIndex);
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(programListNode->program, env, sizeof(env));
|
||||
} else if ((procedureFlags & PROCEDURE_FLAG_TIMED) != 0) {
|
||||
if ((unsigned int)stackReadInt32(procedurePtr, offsetof(Procedure, time)) < time) {
|
||||
if ((unsigned int)stackReadInt32(procedurePtr, 8) < time) {
|
||||
// NOTE: Uninline.
|
||||
stackWriteInt32(0, procedurePtr, offsetof(Procedure, flags));
|
||||
stackWriteInt32(0, procedurePtr, 4);
|
||||
_executeProc(programListNode->program, procedureIndex);
|
||||
}
|
||||
}
|
||||
|
@ -2962,12 +2952,12 @@ static void programListNodeFree(ProgramListNode* programListNode)
|
|||
ProgramListNode* tmp;
|
||||
|
||||
tmp = programListNode->next;
|
||||
if (tmp != nullptr) {
|
||||
if (tmp != NULL) {
|
||||
tmp->prev = programListNode->prev;
|
||||
}
|
||||
|
||||
tmp = programListNode->prev;
|
||||
if (tmp != nullptr) {
|
||||
if (tmp != NULL) {
|
||||
tmp->next = programListNode->next;
|
||||
} else {
|
||||
gInterpreterProgramListHead = programListNode->next;
|
||||
|
@ -2983,9 +2973,9 @@ void programListNodeCreate(Program* program)
|
|||
ProgramListNode* programListNode = (ProgramListNode*)internal_malloc_safe(sizeof(*programListNode), __FILE__, __LINE__); // .\\int\\INTRPRET.C, 2907
|
||||
programListNode->program = program;
|
||||
programListNode->next = gInterpreterProgramListHead;
|
||||
programListNode->prev = nullptr;
|
||||
programListNode->prev = NULL;
|
||||
|
||||
if (gInterpreterProgramListHead != nullptr) {
|
||||
if (gInterpreterProgramListHead != NULL) {
|
||||
gInterpreterProgramListHead->prev = programListNode;
|
||||
}
|
||||
|
||||
|
@ -3010,7 +3000,7 @@ Program* runScript(char* name)
|
|||
|
||||
// NOTE: Uninline.
|
||||
program = programCreateByPath(_interpretMangleName(name));
|
||||
if (program != nullptr) {
|
||||
if (program != NULL) {
|
||||
// NOTE: Uninline.
|
||||
runProgram(program);
|
||||
_interpret(program, 24);
|
||||
|
@ -3032,9 +3022,9 @@ void _updatePrograms()
|
|||
sfall_gl_scr_update(_cpuBurstSize);
|
||||
|
||||
ProgramListNode* curr = gInterpreterProgramListHead;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
ProgramListNode* next = curr->next;
|
||||
if (curr->program != nullptr) {
|
||||
if (curr->program != NULL) {
|
||||
_interpret(curr->program, _cpuBurstSize);
|
||||
|
||||
if (curr->program->exited) {
|
||||
|
@ -3051,7 +3041,7 @@ void _updatePrograms()
|
|||
void programListFree()
|
||||
{
|
||||
ProgramListNode* curr = gInterpreterProgramListHead;
|
||||
while (curr != nullptr) {
|
||||
while (curr != NULL) {
|
||||
ProgramListNode* next = curr->next;
|
||||
programListNodeFree(curr);
|
||||
curr = next;
|
||||
|
@ -3074,12 +3064,12 @@ void interpreterRegisterOpcode(int opcode, OpcodeHandler* handler)
|
|||
static void interpreterPrintStats()
|
||||
{
|
||||
ProgramListNode* programListNode = gInterpreterProgramListHead;
|
||||
while (programListNode != nullptr) {
|
||||
while (programListNode != NULL) {
|
||||
Program* program = programListNode->program;
|
||||
if (program != nullptr) {
|
||||
if (program != NULL) {
|
||||
int total = 0;
|
||||
|
||||
if (program->dynamicStrings != nullptr) {
|
||||
if (program->dynamicStrings != NULL) {
|
||||
debugPrint("Program %s\n");
|
||||
|
||||
unsigned char* heap = program->dynamicStrings + sizeof(int);
|
||||
|
@ -3204,7 +3194,7 @@ void* programStackPopPointer(Program* program)
|
|||
// uninitialized exported variables designed to hold objects (pointers).
|
||||
// If this is one theses places simply return NULL.
|
||||
if (programValue.opcode == VALUE_TYPE_INT && programValue.integerValue == 0) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (programValue.opcode != VALUE_TYPE_PTR) {
|
||||
|
|
|
@ -133,12 +133,12 @@ enum RawValueType {
|
|||
typedef unsigned short opcode_t;
|
||||
|
||||
typedef struct Procedure {
|
||||
int nameOffset;
|
||||
int flags;
|
||||
int time;
|
||||
int conditionOffset;
|
||||
int bodyOffset;
|
||||
int argCount;
|
||||
int field_0;
|
||||
int field_4;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int field_14;
|
||||
} Procedure;
|
||||
|
||||
class ProgramValue {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -171,7 +171,7 @@ void opFillWin3x3(Program* program)
|
|||
int imageWidth;
|
||||
int imageHeight;
|
||||
unsigned char* imageData = datafileRead(mangledFileName, &imageWidth, &imageHeight);
|
||||
if (imageData == nullptr) {
|
||||
if (imageData == NULL) {
|
||||
programFatalError("cannot load 3x3 file '%s'", mangledFileName);
|
||||
}
|
||||
|
||||
|
@ -250,11 +250,11 @@ void opSelectFileList(Program* program)
|
|||
|
||||
int fileListLength;
|
||||
char** fileList = _getFileList(_interpretMangleName(pattern), &fileListLength);
|
||||
if (fileList != nullptr && fileListLength != 0) {
|
||||
if (fileList != NULL && fileListLength != 0) {
|
||||
int selectedIndex = _win_list_select(title,
|
||||
fileList,
|
||||
fileListLength,
|
||||
nullptr,
|
||||
NULL,
|
||||
320 - fontGetStringWidth(title) / 2,
|
||||
200,
|
||||
_colorTable[0x7FFF] | 0x10000);
|
||||
|
@ -281,7 +281,7 @@ void opTokenize(Program* program)
|
|||
|
||||
ProgramValue prevValue = programStackPopValue(program);
|
||||
|
||||
char* prev = nullptr;
|
||||
char* prev = NULL;
|
||||
if ((prevValue.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_INT) {
|
||||
if (prevValue.integerValue != 0) {
|
||||
programFatalError("Error, invalid arg 2 to tokenize. (only accept 0 for int value)");
|
||||
|
@ -293,11 +293,11 @@ void opTokenize(Program* program)
|
|||
}
|
||||
|
||||
char* string = programStackPopString(program);
|
||||
char* temp = nullptr;
|
||||
char* temp = NULL;
|
||||
|
||||
if (prev != nullptr) {
|
||||
if (prev != NULL) {
|
||||
char* start = strstr(string, prev);
|
||||
if (start != nullptr) {
|
||||
if (start != NULL) {
|
||||
start += strlen(prev);
|
||||
while (*start != ch && *start != '\0') {
|
||||
start++;
|
||||
|
@ -326,7 +326,7 @@ void opTokenize(Program* program)
|
|||
length++;
|
||||
}
|
||||
|
||||
if (string != nullptr) {
|
||||
if (string != NULL) {
|
||||
temp = (char*)internal_calloc_safe(1, length + 1, __FILE__, __LINE__); // "..\\int\\INTLIB.C", 248
|
||||
strncpy(temp, string, length);
|
||||
programStackPushString(program, temp);
|
||||
|
@ -335,7 +335,7 @@ void opTokenize(Program* program)
|
|||
}
|
||||
}
|
||||
|
||||
if (temp != nullptr) {
|
||||
if (temp != NULL) {
|
||||
internal_free_safe(temp, __FILE__, __LINE__); // "..\\int\\INTLIB.C" , 260
|
||||
}
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ void opPlayMovie(Program* program)
|
|||
|
||||
strcpy(gIntLibPlayMovieFileName, movieFileName);
|
||||
|
||||
if (strrchr(gIntLibPlayMovieFileName, '.') == nullptr) {
|
||||
if (strrchr(gIntLibPlayMovieFileName, '.') == NULL) {
|
||||
strcat(gIntLibPlayMovieFileName, ".mve");
|
||||
}
|
||||
|
||||
|
@ -616,7 +616,7 @@ void opPlayMovieRect(Program* program)
|
|||
|
||||
strcpy(gIntLibPlayMovieRectFileName, movieFileName);
|
||||
|
||||
if (strrchr(gIntLibPlayMovieRectFileName, '.') == nullptr) {
|
||||
if (strrchr(gIntLibPlayMovieRectFileName, '.') == NULL) {
|
||||
strcat(gIntLibPlayMovieRectFileName, ".mve");
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ static void opDeleteRegion(Program* program)
|
|||
|
||||
_selectWindowID(program->windowId);
|
||||
|
||||
const char* regionName = value.integerValue != -1 ? programGetString(program, value.opcode, value.integerValue) : nullptr;
|
||||
const char* regionName = value.integerValue != -1 ? programGetString(program, value.opcode, value.integerValue) : NULL;
|
||||
_windowDeleteRegion(regionName);
|
||||
}
|
||||
|
||||
|
@ -858,7 +858,7 @@ static void opSayReplyTitle(Program* program)
|
|||
{
|
||||
ProgramValue value = programStackPopValue(program);
|
||||
|
||||
char* string = nullptr;
|
||||
char* string = NULL;
|
||||
if ((value.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
string = programGetString(program, value.opcode, value.integerValue);
|
||||
}
|
||||
|
@ -874,7 +874,7 @@ static void opSayGoToReply(Program* program)
|
|||
{
|
||||
ProgramValue value = programStackPopValue(program);
|
||||
|
||||
char* string = nullptr;
|
||||
char* string = NULL;
|
||||
if ((value.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
string = programGetString(program, value.opcode, value.integerValue);
|
||||
}
|
||||
|
@ -897,7 +897,7 @@ void opSayReply(Program* program)
|
|||
if ((v2.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
v1 = programGetString(program, v2.opcode, v2.integerValue);
|
||||
} else {
|
||||
v1 = nullptr;
|
||||
v1 = NULL;
|
||||
}
|
||||
|
||||
if ((v3.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
|
@ -930,14 +930,14 @@ void opSayOption(Program* program)
|
|||
if ((v4.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
v1 = programGetString(program, v4.opcode, v4.integerValue);
|
||||
} else {
|
||||
v1 = nullptr;
|
||||
v1 = NULL;
|
||||
}
|
||||
|
||||
const char* v2;
|
||||
if ((v3.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
v2 = programGetString(program, v3.opcode, v3.integerValue);
|
||||
} else {
|
||||
v2 = nullptr;
|
||||
v2 = NULL;
|
||||
}
|
||||
|
||||
if (_dialogReply(v1, v2) != 0) {
|
||||
|
@ -1028,14 +1028,14 @@ void opSayMessage(Program* program)
|
|||
if ((v4.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
v1 = programGetString(program, v4.opcode, v4.integerValue);
|
||||
} else {
|
||||
v1 = nullptr;
|
||||
v1 = NULL;
|
||||
}
|
||||
|
||||
const char* v2;
|
||||
if ((v3.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_STRING) {
|
||||
v2 = programGetString(program, v3.opcode, v3.integerValue);
|
||||
} else {
|
||||
v2 = nullptr;
|
||||
v2 = NULL;
|
||||
}
|
||||
|
||||
if (sub_430FD4(v1, v2, _TimeOut) != 0) {
|
||||
|
@ -1201,7 +1201,7 @@ static void opDeleteButton(Program* program)
|
|||
_selectWindowID(program->windowId);
|
||||
|
||||
if ((value.opcode & 0xF7FF) == VALUE_TYPE_INT) {
|
||||
if (_windowDeleteButton(nullptr)) {
|
||||
if (_windowDeleteButton(NULL)) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -1424,13 +1424,13 @@ static void opDeleteKey(Program* program)
|
|||
|
||||
if (key == -1) {
|
||||
gIntLibGenericKeyHandlerProc = 0;
|
||||
gIntLibGenericKeyHandlerProgram = nullptr;
|
||||
gIntLibGenericKeyHandlerProgram = NULL;
|
||||
} else {
|
||||
if (key > INT_LIB_KEY_HANDLERS_CAPACITY - 1) {
|
||||
programFatalError("Key out of range");
|
||||
}
|
||||
|
||||
gIntLibKeyHandlerEntries[key].program = nullptr;
|
||||
gIntLibKeyHandlerEntries[key].program = NULL;
|
||||
gIntLibKeyHandlerEntries[key].proc = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1596,7 +1596,7 @@ void opSayReplyWindow(Program* program)
|
|||
v1 = _interpretMangleName(v1);
|
||||
v1 = strdup_safe(v1, __FILE__, __LINE__); // "..\\int\\INTLIB.C", 1510
|
||||
} else if ((v2.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_INT && v2.integerValue == 0) {
|
||||
v1 = nullptr;
|
||||
v1 = NULL;
|
||||
} else {
|
||||
programFatalError("Invalid arg 5 given to sayreplywindow");
|
||||
}
|
||||
|
@ -1644,7 +1644,7 @@ void opSayOptionWindow(Program* program)
|
|||
v1 = _interpretMangleName(v1);
|
||||
v1 = strdup_safe(v1, __FILE__, __LINE__); // "..\\int\\INTLIB.C", 1556
|
||||
} else if ((v2.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_INT && v2.integerValue == 0) {
|
||||
v1 = nullptr;
|
||||
v1 = NULL;
|
||||
} else {
|
||||
programFatalError("Invalid arg 5 given to sayoptionwindow");
|
||||
}
|
||||
|
@ -1677,10 +1677,10 @@ void opSayScrollUp(Program* program)
|
|||
int y = programStackPopInteger(program);
|
||||
int x = programStackPopInteger(program);
|
||||
|
||||
char* v1 = nullptr;
|
||||
char* v2 = nullptr;
|
||||
char* v3 = nullptr;
|
||||
char* v4 = nullptr;
|
||||
char* v1 = NULL;
|
||||
char* v2 = NULL;
|
||||
char* v3 = NULL;
|
||||
char* v4 = NULL;
|
||||
int v5 = 0;
|
||||
|
||||
if ((v6.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_INT) {
|
||||
|
@ -1749,10 +1749,10 @@ void opSayScrollDown(Program* program)
|
|||
int y = programStackPopInteger(program);
|
||||
int x = programStackPopInteger(program);
|
||||
|
||||
char* v1 = nullptr;
|
||||
char* v2 = nullptr;
|
||||
char* v3 = nullptr;
|
||||
char* v4 = nullptr;
|
||||
char* v1 = NULL;
|
||||
char* v2 = NULL;
|
||||
char* v3 = NULL;
|
||||
char* v4 = NULL;
|
||||
int v5 = 0;
|
||||
|
||||
if ((v6.opcode & VALUE_TYPE_MASK) == VALUE_TYPE_INT) {
|
||||
|
@ -1837,7 +1837,7 @@ static void intLibSoundCallback(void* userData, int a2)
|
|||
{
|
||||
if (a2 == 1) {
|
||||
Sound** sound = (Sound**)userData;
|
||||
*sound = nullptr;
|
||||
*sound = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1854,7 +1854,7 @@ static int intLibSoundDelete(int value)
|
|||
|
||||
int index = value & ~0xA0000000;
|
||||
Sound* sound = gIntLibSounds[index];
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1864,7 +1864,7 @@ static int intLibSoundDelete(int value)
|
|||
|
||||
soundDelete(sound);
|
||||
|
||||
gIntLibSounds[index] = nullptr;
|
||||
gIntLibSounds[index] = NULL;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -1899,7 +1899,7 @@ static int intLibSoundPlay(char* fileName, int mode)
|
|||
|
||||
int index;
|
||||
for (index = 0; index < INT_LIB_SOUNDS_CAPACITY; index++) {
|
||||
if (gIntLibSounds[index] == nullptr) {
|
||||
if (gIntLibSounds[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1909,7 +1909,7 @@ static int intLibSoundPlay(char* fileName, int mode)
|
|||
}
|
||||
|
||||
Sound* sound = gIntLibSounds[index] = soundAllocate(type, soundFlags);
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1984,7 +1984,7 @@ static int intLibSoundPlay(char* fileName, int mode)
|
|||
err:
|
||||
|
||||
soundDelete(sound);
|
||||
gIntLibSounds[index] = nullptr;
|
||||
gIntLibSounds[index] = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2001,7 +2001,7 @@ static int intLibSoundPause(int value)
|
|||
|
||||
int index = value & ~0xA0000000;
|
||||
Sound* sound = gIntLibSounds[index];
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2027,7 +2027,7 @@ static int intLibSoundRewind(int value)
|
|||
|
||||
int index = value & ~0xA0000000;
|
||||
Sound* sound = gIntLibSounds[index];
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2053,7 +2053,7 @@ static int intLibSoundResume(int value)
|
|||
|
||||
int index = value & ~0xA0000000;
|
||||
Sound* sound = gIntLibSounds[index];
|
||||
if (sound == nullptr) {
|
||||
if (sound == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -2152,16 +2152,16 @@ void intLibExit()
|
|||
_intExtraClose_();
|
||||
|
||||
for (int index = 0; index < INT_LIB_SOUNDS_CAPACITY; index++) {
|
||||
if (gIntLibSounds[index] != nullptr) {
|
||||
if (gIntLibSounds[index] != NULL) {
|
||||
intLibSoundDelete(index | 0xA0000000);
|
||||
}
|
||||
}
|
||||
|
||||
_nevs_close();
|
||||
|
||||
if (gIntLibProgramDeleteCallbacks != nullptr) {
|
||||
if (gIntLibProgramDeleteCallbacks != NULL) {
|
||||
internal_free_safe(gIntLibProgramDeleteCallbacks, __FILE__, __LINE__); // "..\\int\\INTLIB.C", 1976
|
||||
gIntLibProgramDeleteCallbacks = nullptr;
|
||||
gIntLibProgramDeleteCallbacks = NULL;
|
||||
gIntLibProgramDeleteCallbacksLength = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2173,7 +2173,7 @@ static bool intLibDoInput(int key)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (gIntLibGenericKeyHandlerProgram != nullptr) {
|
||||
if (gIntLibGenericKeyHandlerProgram != NULL) {
|
||||
if (gIntLibGenericKeyHandlerProc != 0) {
|
||||
_executeProc(gIntLibGenericKeyHandlerProgram, gIntLibGenericKeyHandlerProc);
|
||||
}
|
||||
|
@ -2181,7 +2181,7 @@ static bool intLibDoInput(int key)
|
|||
}
|
||||
|
||||
IntLibKeyHandlerEntry* entry = &(gIntLibKeyHandlerEntries[key]);
|
||||
if (entry->program == nullptr) {
|
||||
if (entry->program == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2291,13 +2291,13 @@ void intLibRegisterProgramDeleteCallback(IntLibProgramDeleteCallback* callback)
|
|||
{
|
||||
int index;
|
||||
for (index = 0; index < gIntLibProgramDeleteCallbacksLength; index++) {
|
||||
if (gIntLibProgramDeleteCallbacks[index] == nullptr) {
|
||||
if (gIntLibProgramDeleteCallbacks[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index == gIntLibProgramDeleteCallbacksLength) {
|
||||
if (gIntLibProgramDeleteCallbacks != nullptr) {
|
||||
if (gIntLibProgramDeleteCallbacks != NULL) {
|
||||
gIntLibProgramDeleteCallbacks = (IntLibProgramDeleteCallback**)internal_realloc_safe(gIntLibProgramDeleteCallbacks, sizeof(*gIntLibProgramDeleteCallbacks) * (gIntLibProgramDeleteCallbacksLength + 1), __FILE__, __LINE__); // ..\\int\\INTLIB.C, 2110
|
||||
} else {
|
||||
gIntLibProgramDeleteCallbacks = (IntLibProgramDeleteCallback**)internal_malloc_safe(sizeof(*gIntLibProgramDeleteCallbacks), __FILE__, __LINE__); // ..\\int\\INTLIB.C, 2112
|
||||
|
@ -2313,7 +2313,7 @@ void intLibRemoveProgramReferences(Program* program)
|
|||
{
|
||||
for (int index = 0; index < INT_LIB_KEY_HANDLERS_CAPACITY; index++) {
|
||||
if (program == gIntLibKeyHandlerEntries[index].program) {
|
||||
gIntLibKeyHandlerEntries[index].program = nullptr;
|
||||
gIntLibKeyHandlerEntries[index].program = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2321,7 +2321,7 @@ void intLibRemoveProgramReferences(Program* program)
|
|||
|
||||
for (int index = 0; index < gIntLibProgramDeleteCallbacksLength; index++) {
|
||||
IntLibProgramDeleteCallback* callback = gIntLibProgramDeleteCallbacks[index];
|
||||
if (callback != nullptr) {
|
||||
if (callback != NULL) {
|
||||
callback(program);
|
||||
}
|
||||
}
|
||||
|
|
819
src/inventory.cc
819
src/inventory.cc
File diff suppressed because it is too large
Load Diff
|
@ -23,11 +23,10 @@ int _inven_wield(Object* a1, Object* a2, int a3);
|
|||
int _invenWieldFunc(Object* a1, Object* a2, int a3, bool a4);
|
||||
int _inven_unwield(Object* critter_obj, int a2);
|
||||
int _invenUnwieldFunc(Object* obj, int a2, int a3);
|
||||
int inventoryOpenLooting(Object* looter, Object* target);
|
||||
int inventoryOpenStealing(Object* thief, Object* target);
|
||||
void inventoryOpenTrade(int win, Object* barterer, Object* playerTable, Object* bartererTable, int barterMod);
|
||||
int inventoryOpenLooting(Object* a1, Object* a2);
|
||||
int inventoryOpenStealing(Object* a1, Object* a2);
|
||||
void inventoryOpenTrade(int win, Object* a2, Object* a3, Object* a4, int a5);
|
||||
int _inven_set_timer(Object* a1);
|
||||
Object* inven_get_current_target_obj();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
|
|
300
src/item.cc
300
src/item.cc
File diff suppressed because it is too large
Load Diff
62
src/lips.cc
62
src/lips.cc
|
@ -36,16 +36,16 @@ LipsData gLipsData = {
|
|||
2,
|
||||
22528,
|
||||
0,
|
||||
nullptr,
|
||||
NULL,
|
||||
-1,
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
50,
|
||||
|
@ -221,10 +221,10 @@ static int lipsReadV1(LipsData* lipsData, File* stream)
|
|||
// NOTE: Original code is different. For unknown reason it assigns values
|
||||
// from file (integers) and treat them as pointers, which is obviously wrong
|
||||
// is in this case.
|
||||
lipsData->sound = nullptr;
|
||||
lipsData->field_14 = nullptr;
|
||||
lipsData->phonemes = nullptr;
|
||||
lipsData->markers = nullptr;
|
||||
lipsData->sound = NULL;
|
||||
lipsData->field_14 = NULL;
|
||||
lipsData->phonemes = NULL;
|
||||
lipsData->markers = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -250,14 +250,14 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
|||
strcat(path, "\\");
|
||||
|
||||
sep = strchr(path, '.');
|
||||
if (sep != nullptr) {
|
||||
if (sep != NULL) {
|
||||
*sep = '\0';
|
||||
}
|
||||
|
||||
strcpy(v60, audioFileName);
|
||||
|
||||
sep = strchr(v60, '.');
|
||||
if (sep != nullptr) {
|
||||
if (sep != NULL) {
|
||||
*sep = '\0';
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
|||
|
||||
// FIXME: stream is not closed if any error is encountered during reading.
|
||||
File* stream = fileOpen(path, "rb");
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
if (fileReadInt32(stream, &(gLipsData.version)) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -304,12 +304,12 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
|||
}
|
||||
|
||||
gLipsData.phonemes = (unsigned char*)internal_malloc(gLipsData.field_24);
|
||||
if (gLipsData.phonemes == nullptr) {
|
||||
if (gLipsData.phonemes == NULL) {
|
||||
debugPrint("Out of memory in lips_load_file.'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
for (i = 0; i < gLipsData.field_24; i++) {
|
||||
if (fileReadUInt8(stream, &(gLipsData.phonemes[i])) == -1) {
|
||||
debugPrint("lips_load_file: Error reading phoneme type.\n");
|
||||
|
@ -326,12 +326,12 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
|||
}
|
||||
|
||||
gLipsData.markers = (SpeechMarker*)internal_malloc(sizeof(*speech_marker) * gLipsData.field_2C);
|
||||
if (gLipsData.markers == nullptr) {
|
||||
if (gLipsData.markers == NULL) {
|
||||
debugPrint("Out of memory in lips_load_file.'\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
for (i = 0; i < gLipsData.field_2C; i++) {
|
||||
speech_marker = &(gLipsData.markers[i]);
|
||||
|
||||
|
@ -368,7 +368,7 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
|||
}
|
||||
}
|
||||
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
fileClose(stream);
|
||||
}
|
||||
|
||||
|
@ -399,34 +399,34 @@ int lipsLoad(const char* audioFileName, const char* headFileName)
|
|||
// 0x47B5D0
|
||||
static int _lips_make_speech()
|
||||
{
|
||||
if (gLipsData.field_14 != nullptr) {
|
||||
if (gLipsData.field_14 != NULL) {
|
||||
internal_free(gLipsData.field_14);
|
||||
gLipsData.field_14 = nullptr;
|
||||
gLipsData.field_14 = NULL;
|
||||
}
|
||||
|
||||
char path[COMPAT_MAX_PATH];
|
||||
char* v1 = _lips_fix_string(gLipsData.field_50, sizeof(gLipsData.field_50));
|
||||
snprintf(path, sizeof(path), "%s%s\\%s.%s", "SOUND\\SPEECH\\", _lips_subdir_name, v1, "ACM");
|
||||
|
||||
if (gLipsData.sound != nullptr) {
|
||||
if (gLipsData.sound != NULL) {
|
||||
soundDelete(gLipsData.sound);
|
||||
gLipsData.sound = nullptr;
|
||||
gLipsData.sound = NULL;
|
||||
}
|
||||
|
||||
gLipsData.sound = soundAllocate(SOUND_TYPE_MEMORY, SOUND_16BIT);
|
||||
if (gLipsData.sound == nullptr) {
|
||||
if (gLipsData.sound == NULL) {
|
||||
debugPrint("\nsoundAllocate falied in lips_make_speech!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (soundSetFileIO(gLipsData.sound, audioOpen, audioClose, audioRead, nullptr, audioSeek, nullptr, audioGetSize)) {
|
||||
if (soundSetFileIO(gLipsData.sound, audioOpen, audioClose, audioRead, NULL, audioSeek, NULL, audioGetSize)) {
|
||||
debugPrint("Ack!");
|
||||
debugPrint("Error!");
|
||||
}
|
||||
|
||||
if (soundLoad(gLipsData.sound, path)) {
|
||||
soundDelete(gLipsData.sound);
|
||||
gLipsData.sound = nullptr;
|
||||
gLipsData.sound = NULL;
|
||||
|
||||
debugPrint("lips_make_speech: soundLoad failed with path ");
|
||||
debugPrint("%s -- file probably doesn't exist.\n", path);
|
||||
|
@ -441,12 +441,12 @@ static int _lips_make_speech()
|
|||
// 0x47B730
|
||||
int lipsFree()
|
||||
{
|
||||
if (gLipsData.field_14 != nullptr) {
|
||||
if (gLipsData.field_14 != NULL) {
|
||||
internal_free(gLipsData.field_14);
|
||||
gLipsData.field_14 = nullptr;
|
||||
gLipsData.field_14 = NULL;
|
||||
}
|
||||
|
||||
if (gLipsData.sound != nullptr) {
|
||||
if (gLipsData.sound != NULL) {
|
||||
_head_marker_current = 0;
|
||||
|
||||
soundStop(gLipsData.sound);
|
||||
|
@ -455,17 +455,17 @@ int lipsFree()
|
|||
|
||||
soundDelete(gLipsData.sound);
|
||||
|
||||
gLipsData.sound = nullptr;
|
||||
gLipsData.sound = NULL;
|
||||
}
|
||||
|
||||
if (gLipsData.phonemes != nullptr) {
|
||||
if (gLipsData.phonemes != NULL) {
|
||||
internal_free(gLipsData.phonemes);
|
||||
gLipsData.phonemes = nullptr;
|
||||
gLipsData.phonemes = NULL;
|
||||
}
|
||||
|
||||
if (gLipsData.markers != nullptr) {
|
||||
if (gLipsData.markers != NULL) {
|
||||
internal_free(gLipsData.markers);
|
||||
gLipsData.markers = nullptr;
|
||||
gLipsData.markers = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
413
src/loadsave.cc
413
src/loadsave.cc
File diff suppressed because it is too large
Load Diff
|
@ -18,9 +18,8 @@ void _InitLoadSave();
|
|||
void _ResetLoadSave();
|
||||
int lsgSaveGame(int mode);
|
||||
int lsgLoadGame(int mode);
|
||||
bool _isLoadingGame();
|
||||
int _isLoadingGame();
|
||||
void lsgInit();
|
||||
int MapDirErase(const char* path, const char* extension);
|
||||
int _MapDirEraseFile_(const char* a1, const char* a2);
|
||||
|
||||
} // namespace fallout
|
||||
|
|
36
src/main.cc
36
src/main.cc
|
@ -69,7 +69,7 @@ static char _mainMap[] = "artemple.map";
|
|||
static int _main_game_paused = 0;
|
||||
|
||||
// 0x5194DC
|
||||
static char** _main_selfrun_list = nullptr;
|
||||
static char** _main_selfrun_list = NULL;
|
||||
|
||||
// 0x5194E0
|
||||
static int _main_selfrun_count = 0;
|
||||
|
@ -138,14 +138,14 @@ int falloutMain(int argc, char** argv)
|
|||
randomSeedPrerandom(-1);
|
||||
|
||||
// SFALL: Override starting map.
|
||||
char* mapName = nullptr;
|
||||
char* mapName = NULL;
|
||||
if (configGetString(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_STARTING_MAP_KEY, &mapName)) {
|
||||
if (*mapName == '\0') {
|
||||
mapName = nullptr;
|
||||
mapName = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
char* mapNameCopy = compat_strdup(mapName != nullptr ? mapName : _mainMap);
|
||||
char* mapNameCopy = compat_strdup(mapName != NULL ? mapName : _mainMap);
|
||||
_main_load_new(mapNameCopy);
|
||||
free(mapNameCopy);
|
||||
|
||||
|
@ -257,7 +257,7 @@ static bool falloutInit(int argc, char** argv)
|
|||
return false;
|
||||
}
|
||||
|
||||
if (_main_selfrun_list != nullptr) {
|
||||
if (_main_selfrun_list != NULL) {
|
||||
_main_selfrun_exit();
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ static int _main_load_new(char* mapFileName)
|
|||
_game_user_wants_to_quit = 0;
|
||||
_main_show_death_scene = 0;
|
||||
gDude->flags &= ~OBJECT_FLAT;
|
||||
objectShow(gDude, nullptr);
|
||||
objectShow(gDude, NULL);
|
||||
mouseHideCursor();
|
||||
|
||||
int win = windowCreate(0, 0, screenGetWidth(), screenGetHeight(), _colorTable[0], WINDOW_MODAL | WINDOW_MOVE_ON_TOP);
|
||||
|
@ -327,7 +327,7 @@ static int main_loadgame_new()
|
|||
|
||||
gDude->flags &= ~OBJECT_FLAT;
|
||||
|
||||
objectShow(gDude, nullptr);
|
||||
objectShow(gDude, NULL);
|
||||
mouseHideCursor();
|
||||
|
||||
_map_init();
|
||||
|
@ -341,7 +341,7 @@ static int main_loadgame_new()
|
|||
// 0x480E34
|
||||
static void main_unload_new()
|
||||
{
|
||||
objectHide(gDude, nullptr);
|
||||
objectHide(gDude, NULL);
|
||||
_map_exit();
|
||||
}
|
||||
|
||||
|
@ -395,13 +395,13 @@ static void mainLoop()
|
|||
// 0x480F38
|
||||
static void _main_selfrun_exit()
|
||||
{
|
||||
if (_main_selfrun_list != nullptr) {
|
||||
if (_main_selfrun_list != NULL) {
|
||||
selfrunFreeFileList(&_main_selfrun_list);
|
||||
}
|
||||
|
||||
_main_selfrun_count = 0;
|
||||
_main_selfrun_index = 0;
|
||||
_main_selfrun_list = nullptr;
|
||||
_main_selfrun_list = NULL;
|
||||
}
|
||||
|
||||
// 0x480F64
|
||||
|
@ -413,7 +413,7 @@ static void _main_selfrun_record()
|
|||
char** fileList;
|
||||
int fileListLength = fileNameListInit("maps\\*.map", &fileList, 0, 0);
|
||||
if (fileListLength != 0) {
|
||||
int selectedFileIndex = _win_list_select("Select Map", fileList, fileListLength, nullptr, 80, 80, 0x10000 | 0x100 | 4);
|
||||
int selectedFileIndex = _win_list_select("Select Map", fileList, fileListLength, 0, 80, 80, 0x10000 | 0x100 | 4);
|
||||
if (selectedFileIndex != -1) {
|
||||
// NOTE: It's size is likely 13 chars (on par with SelfrunData
|
||||
// fields), but due to the padding it takes 16 chars on stack.
|
||||
|
@ -451,7 +451,7 @@ static void _main_selfrun_record()
|
|||
|
||||
mainMenuWindowInit();
|
||||
|
||||
if (_main_selfrun_list != nullptr) {
|
||||
if (_main_selfrun_list != NULL) {
|
||||
_main_selfrun_exit();
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ static void showDeath()
|
|||
if (win != -1) {
|
||||
do {
|
||||
unsigned char* windowBuffer = windowGetBuffer(win);
|
||||
if (windowBuffer == nullptr) {
|
||||
if (windowBuffer == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -603,7 +603,7 @@ static void showDeath()
|
|||
sharedFpsLimiter.throttle();
|
||||
} while (keyCode == -1 && !_main_death_voiceover_done && getTicksSince(time) < delay);
|
||||
|
||||
speechSetEndCallback(nullptr);
|
||||
speechSetEndCallback(NULL);
|
||||
|
||||
speechDelete();
|
||||
|
||||
|
@ -647,7 +647,7 @@ static void _main_death_voiceover_callback()
|
|||
static int _mainDeathGrabTextFile(const char* fileName, char* dest)
|
||||
{
|
||||
const char* p = strrchr(fileName, '\\');
|
||||
if (p == nullptr) {
|
||||
if (p == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -655,7 +655,7 @@ static int _mainDeathGrabTextFile(const char* fileName, char* dest)
|
|||
snprintf(path, sizeof(path), "text\\%s\\cuts\\%s%s", settings.system.language.c_str(), p + 1, ".TXT");
|
||||
|
||||
File* stream = fileOpen(path, "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -684,7 +684,7 @@ static int _mainDeathWordWrap(char* text, int width, short* beginnings, short* c
|
|||
{
|
||||
while (true) {
|
||||
char* sep = strchr(text, ':');
|
||||
if (sep == nullptr) {
|
||||
if (sep == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -709,7 +709,7 @@ static int _mainDeathWordWrap(char* text, int width, short* beginnings, short* c
|
|||
beginnings[index]--;
|
||||
}
|
||||
|
||||
if (p != nullptr) {
|
||||
if (p != NULL) {
|
||||
*p = '\0';
|
||||
beginnings[index]++;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ static void main_menu_play_sound(const char* fileName);
|
|||
static int gMainMenuWindow = -1;
|
||||
|
||||
// 0x5194F4
|
||||
static unsigned char* gMainMenuWindowBuffer = nullptr;
|
||||
static unsigned char* gMainMenuWindowBuffer = NULL;
|
||||
|
||||
// 0x519504
|
||||
static bool _in_main_menu = false;
|
||||
|
@ -189,7 +189,7 @@ int mainMenuWindowInit()
|
|||
gMainMenuButtonKeyBindings[index],
|
||||
_mainMenuButtonNormalFrmImage.getData(),
|
||||
_mainMenuButtonPressedFrmImage.getData(),
|
||||
nullptr,
|
||||
0,
|
||||
BUTTON_FLAG_TRANSPARENT);
|
||||
if (gMainMenuButtons[index] == -1) {
|
||||
// NOTE: Uninline.
|
||||
|
|
106
src/map.cc
106
src/map.cc
|
@ -104,11 +104,11 @@ int gMapSid = -1;
|
|||
|
||||
// local_vars
|
||||
// 0x519568
|
||||
int* gMapLocalVars = nullptr;
|
||||
int* gMapLocalVars = NULL;
|
||||
|
||||
// map_vars
|
||||
// 0x51956C
|
||||
int* gMapGlobalVars = nullptr;
|
||||
static int* gMapGlobalVars = NULL;
|
||||
|
||||
// local_vars_num
|
||||
// 0x519570
|
||||
|
@ -116,7 +116,7 @@ int gMapLocalVarsLength = 0;
|
|||
|
||||
// map_vars_num
|
||||
// 0x519574
|
||||
int gMapGlobalVarsLength = 0;
|
||||
static int gMapGlobalVarsLength = 0;
|
||||
|
||||
// Current elevation.
|
||||
//
|
||||
|
@ -187,7 +187,7 @@ int isoInit()
|
|||
}
|
||||
|
||||
gIsoWindowBuffer = windowGetBuffer(gIsoWindow);
|
||||
if (gIsoWindowBuffer == nullptr) {
|
||||
if (gIsoWindowBuffer == NULL) {
|
||||
debugPrint("win_get_buf failed in iso_init\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ int _map_malloc_local_var(int a1)
|
|||
gMapLocalVarsLength += a1;
|
||||
|
||||
int* vars = (int*)internal_realloc(gMapLocalVars, sizeof(*vars) * gMapLocalVarsLength);
|
||||
if (vars == nullptr) {
|
||||
if (vars == NULL) {
|
||||
debugPrint("\nError: Ran out of memory!");
|
||||
}
|
||||
|
||||
|
@ -502,11 +502,11 @@ void mapSetStart(int tile, int elevation, int rotation)
|
|||
char* mapGetName(int map, int elevation)
|
||||
{
|
||||
if (map < 0 || map >= wmMapMaxCount()) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!elevationIsValid(elevation)) {
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
MessageListItem messageListItem;
|
||||
|
@ -760,7 +760,7 @@ int mapLoadByName(char* fileName)
|
|||
rc = -1;
|
||||
|
||||
char* extension = strstr(fileName, ".MAP");
|
||||
if (extension != nullptr) {
|
||||
if (extension != NULL) {
|
||||
strcpy(extension, ".SAV");
|
||||
|
||||
const char* filePath = mapBuildPath(fileName);
|
||||
|
@ -769,7 +769,7 @@ int mapLoadByName(char* fileName)
|
|||
|
||||
strcpy(extension, ".MAP");
|
||||
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
fileClose(stream);
|
||||
rc = mapLoadSaved(fileName);
|
||||
wmMapMusicStart();
|
||||
|
@ -779,14 +779,14 @@ int mapLoadByName(char* fileName)
|
|||
if (rc == -1) {
|
||||
const char* filePath = mapBuildPath(fileName);
|
||||
File* stream = fileOpen(filePath, "rb");
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
rc = mapLoad(stream);
|
||||
fileClose(stream);
|
||||
}
|
||||
|
||||
if (rc == 0) {
|
||||
strcpy(gMapHeader.name, fileName);
|
||||
gDude->data.critter.combat.whoHitMe = nullptr;
|
||||
gDude->data.critter.combat.whoHitMe = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -840,10 +840,10 @@ static int mapLoad(File* stream)
|
|||
|
||||
gMapSid = -1;
|
||||
|
||||
const char* error = nullptr;
|
||||
const char* error = NULL;
|
||||
|
||||
error = "Invalid file handle";
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -925,8 +925,8 @@ static int mapLoad(File* stream)
|
|||
}
|
||||
|
||||
lightSetAmbientIntensity(LIGHT_INTENSITY_MAX, false);
|
||||
objectSetLocation(gDude, gCenterTile, gElevation, nullptr);
|
||||
objectSetRotation(gDude, gEnteringRotation, nullptr);
|
||||
objectSetLocation(gDude, gCenterTile, gElevation, NULL);
|
||||
objectSetRotation(gDude, gEnteringRotation, NULL);
|
||||
gMapHeader.field_34 = wmMapMatchNameToIdx(gMapHeader.name);
|
||||
|
||||
if ((gMapHeader.flags & 1) == 0) {
|
||||
|
@ -934,11 +934,11 @@ static int mapLoad(File* stream)
|
|||
snprintf(path, sizeof(path), "maps\\%s", gMapHeader.name);
|
||||
|
||||
char* extension = strstr(path, ".MAP");
|
||||
if (extension == nullptr) {
|
||||
if (extension == NULL) {
|
||||
extension = strstr(path, ".map");
|
||||
}
|
||||
|
||||
if (extension != nullptr) {
|
||||
if (extension != NULL) {
|
||||
*extension = '\0';
|
||||
}
|
||||
|
||||
|
@ -959,7 +959,7 @@ static int mapLoad(File* stream)
|
|||
int fid = buildFid(OBJ_TYPE_MISC, 12, 0, 0, 0);
|
||||
objectCreateWithFidPid(&object, fid, -1);
|
||||
object->flags |= (OBJECT_LIGHT_THRU | OBJECT_NO_SAVE | OBJECT_HIDDEN);
|
||||
objectSetLocation(object, 1, 0, nullptr);
|
||||
objectSetLocation(object, 1, 0, NULL);
|
||||
object->sid = gMapSid;
|
||||
scriptSetFixedParam(gMapSid, (gMapHeader.flags & 1) == 0);
|
||||
|
||||
|
@ -980,11 +980,11 @@ static int mapLoad(File* stream)
|
|||
}
|
||||
}
|
||||
|
||||
error = nullptr;
|
||||
error = NULL;
|
||||
|
||||
err:
|
||||
|
||||
if (error != nullptr) {
|
||||
if (error != NULL) {
|
||||
char message[100]; // TODO: Size is probably wrong.
|
||||
snprintf(message, sizeof(message), "%s while loading map.", error);
|
||||
debugPrint(message);
|
||||
|
@ -998,7 +998,7 @@ err:
|
|||
interfaceBarShow();
|
||||
_proto_dude_update_gender();
|
||||
_map_place_dude_and_mouse();
|
||||
fileSetReadProgressHandler(nullptr, 0);
|
||||
fileSetReadProgressHandler(NULL, 0);
|
||||
isoEnable();
|
||||
_gmouse_disable_scrolling();
|
||||
gameMouseSetCursor(MOUSE_CURSOR_WAIT_PLANET);
|
||||
|
@ -1013,7 +1013,7 @@ err:
|
|||
|
||||
if (gMapTransition.map > 0) {
|
||||
if (gMapTransition.rotation >= 0) {
|
||||
objectSetRotation(gDude, gMapTransition.rotation, nullptr);
|
||||
objectSetRotation(gDude, gMapTransition.rotation, NULL);
|
||||
}
|
||||
} else {
|
||||
tileWindowRefresh();
|
||||
|
@ -1032,7 +1032,7 @@ err:
|
|||
rc = -1;
|
||||
}
|
||||
|
||||
fileSetReadProgressHandler(nullptr, 0);
|
||||
fileSetReadProgressHandler(NULL, 0);
|
||||
|
||||
if (gameUiIsDisabled() == 0) {
|
||||
_gmouse_enable_scrolling();
|
||||
|
@ -1100,7 +1100,7 @@ static int _map_age_dead_critters()
|
|||
}
|
||||
|
||||
Object* obj = objectFindFirst();
|
||||
while (obj != nullptr) {
|
||||
while (obj != NULL) {
|
||||
if (PID_TYPE(obj->pid) == OBJ_TYPE_CRITTER
|
||||
&& obj != gDude
|
||||
&& !objectIsPartyMember(obj)
|
||||
|
@ -1127,7 +1127,7 @@ static int _map_age_dead_critters()
|
|||
Object** objects = (Object**)internal_malloc(sizeof(*objects) * capacity);
|
||||
|
||||
obj = objectFindFirst();
|
||||
while (obj != nullptr) {
|
||||
while (obj != NULL) {
|
||||
int type = PID_TYPE(obj->pid);
|
||||
if (type == OBJ_TYPE_CRITTER) {
|
||||
if (obj != gDude && critterIsDead(obj)) {
|
||||
|
@ -1137,7 +1137,7 @@ static int _map_age_dead_critters()
|
|||
if (count >= capacity) {
|
||||
capacity *= 2;
|
||||
objects = (Object**)internal_realloc(objects, sizeof(*objects) * capacity);
|
||||
if (objects == nullptr) {
|
||||
if (objects == NULL) {
|
||||
debugPrint("\nError: Out of Memory!");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ static int _map_age_dead_critters()
|
|||
if (count >= capacity) {
|
||||
capacity *= 2;
|
||||
objects = (Object**)internal_realloc(objects, sizeof(*objects) * capacity);
|
||||
if (objects == nullptr) {
|
||||
if (objects == NULL) {
|
||||
debugPrint("\nError: Out of Memory!");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ static int _map_age_dead_critters()
|
|||
break;
|
||||
}
|
||||
|
||||
objectSetLocation(blood, obj->tile, obj->elevation, nullptr);
|
||||
objectSetLocation(blood, obj->tile, obj->elevation, NULL);
|
||||
|
||||
Proto* proto;
|
||||
protoGetProto(obj->pid, &proto);
|
||||
|
@ -1187,11 +1187,11 @@ static int _map_age_dead_critters()
|
|||
}
|
||||
}
|
||||
|
||||
objectSetFrame(blood, frame, nullptr);
|
||||
objectSetFrame(blood, frame, NULL);
|
||||
}
|
||||
|
||||
reg_anim_clear(obj);
|
||||
objectDestroy(obj, nullptr);
|
||||
objectDestroy(obj, NULL);
|
||||
}
|
||||
|
||||
internal_free(objects);
|
||||
|
@ -1212,7 +1212,7 @@ int _map_target_load_area()
|
|||
// 0x4835B4
|
||||
int mapSetTransition(MapTransition* transition)
|
||||
{
|
||||
if (transition == nullptr) {
|
||||
if (transition == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1261,9 +1261,9 @@ int mapHandleTransition()
|
|||
if (gMapTransition.tile != -1 && gMapTransition.tile != 0
|
||||
&& gMapHeader.field_34 != MAP_MODOC_BEDNBREAKFAST && gMapHeader.field_34 != MAP_THE_SQUAT_A
|
||||
&& elevationIsValid(gMapTransition.elevation)) {
|
||||
objectSetLocation(gDude, gMapTransition.tile, gMapTransition.elevation, nullptr);
|
||||
objectSetLocation(gDude, gMapTransition.tile, gMapTransition.elevation, NULL);
|
||||
mapSetElevation(gMapTransition.elevation);
|
||||
objectSetRotation(gDude, gMapTransition.rotation, nullptr);
|
||||
objectSetRotation(gDude, gMapTransition.rotation, NULL);
|
||||
}
|
||||
|
||||
if (tileSetCenter(gDude->tile, TILE_SET_CENTER_REFRESH_WINDOW) == -1) {
|
||||
|
@ -1286,7 +1286,7 @@ int mapHandleTransition()
|
|||
// 0x483784
|
||||
static void _map_fix_critter_combat_data()
|
||||
{
|
||||
for (Object* object = objectFindFirst(); object != nullptr; object = objectFindNext()) {
|
||||
for (Object* object = objectFindFirst(); object != NULL; object = objectFindNext()) {
|
||||
if (object->pid == -1) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1296,7 +1296,7 @@ static void _map_fix_critter_combat_data()
|
|||
}
|
||||
|
||||
if (object->data.critter.combat.whoHitMeCid == -1) {
|
||||
object->data.critter.combat.whoHitMe = nullptr;
|
||||
object->data.critter.combat.whoHitMe = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1318,7 +1318,7 @@ static int _map_save()
|
|||
if (gMapHeader.name[0] != '\0') {
|
||||
char* mapFileName = mapBuildPath(gMapHeader.name);
|
||||
File* stream = fileOpen(mapFileName, "wb");
|
||||
if (stream != nullptr) {
|
||||
if (stream != NULL) {
|
||||
rc = _map_save_file(stream);
|
||||
fileClose(stream);
|
||||
} else {
|
||||
|
@ -1340,7 +1340,7 @@ static int _map_save()
|
|||
// 0x483980
|
||||
static int _map_save_file(File* stream)
|
||||
{
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1364,13 +1364,13 @@ static int _map_save_file(File* stream)
|
|||
|
||||
if (tile == SQUARE_GRID_SIZE) {
|
||||
Object* object = objectFindFirstAtElevation(elevation);
|
||||
if (object != nullptr) {
|
||||
if (object != NULL) {
|
||||
// TODO: Implementation is slightly different, check in debugger.
|
||||
while (object != nullptr && (object->flags & OBJECT_NO_SAVE)) {
|
||||
while (object != NULL && (object->flags & OBJECT_NO_SAVE)) {
|
||||
object = objectFindNextAtElevation();
|
||||
}
|
||||
|
||||
if (object != nullptr) {
|
||||
if (object != NULL) {
|
||||
gMapHeader.flags &= ~_map_data_elev_flags[elevation];
|
||||
} else {
|
||||
gMapHeader.flags |= _map_data_elev_flags[elevation];
|
||||
|
@ -1552,7 +1552,7 @@ static int mapGlobalVariablesInit(int count)
|
|||
|
||||
if (count != 0) {
|
||||
gMapGlobalVars = (int*)internal_malloc(sizeof(*gMapGlobalVars) * count);
|
||||
if (gMapGlobalVars == nullptr) {
|
||||
if (gMapGlobalVars == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1567,9 +1567,9 @@ static int mapGlobalVariablesInit(int count)
|
|||
// 0x484038
|
||||
static void mapGlobalVariablesFree()
|
||||
{
|
||||
if (gMapGlobalVars != nullptr) {
|
||||
if (gMapGlobalVars != NULL) {
|
||||
internal_free(gMapGlobalVars);
|
||||
gMapGlobalVars = nullptr;
|
||||
gMapGlobalVars = NULL;
|
||||
gMapGlobalVarsLength = 0;
|
||||
}
|
||||
|
||||
|
@ -1597,7 +1597,7 @@ static int mapLocalVariablesInit(int count)
|
|||
|
||||
if (count != 0) {
|
||||
gMapLocalVars = (int*)internal_malloc(sizeof(*gMapLocalVars) * count);
|
||||
if (gMapLocalVars == nullptr) {
|
||||
if (gMapLocalVars == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1612,9 +1612,9 @@ static int mapLocalVariablesInit(int count)
|
|||
// 0x4840D4
|
||||
static void mapLocalVariablesFree()
|
||||
{
|
||||
if (gMapLocalVars != nullptr) {
|
||||
if (gMapLocalVars != NULL) {
|
||||
internal_free(gMapLocalVars);
|
||||
gMapLocalVars = nullptr;
|
||||
gMapLocalVars = NULL;
|
||||
gMapLocalVarsLength = 0;
|
||||
}
|
||||
|
||||
|
@ -1638,18 +1638,18 @@ static void _map_place_dude_and_mouse()
|
|||
{
|
||||
_obj_clear_seen();
|
||||
|
||||
if (gDude != nullptr) {
|
||||
if (gDude != NULL) {
|
||||
if (FID_ANIM_TYPE(gDude->fid) != ANIM_STAND) {
|
||||
objectSetFrame(gDude, 0, nullptr);
|
||||
objectSetFrame(gDude, 0, 0);
|
||||
gDude->fid = buildFid(OBJ_TYPE_CRITTER, gDude->fid & 0xFFF, ANIM_STAND, (gDude->fid & 0xF000) >> 12, gDude->rotation + 1);
|
||||
}
|
||||
|
||||
if (gDude->tile == -1) {
|
||||
objectSetLocation(gDude, gCenterTile, gElevation, nullptr);
|
||||
objectSetRotation(gDude, gMapHeader.enteringRotation, nullptr);
|
||||
objectSetLocation(gDude, gCenterTile, gElevation, NULL);
|
||||
objectSetRotation(gDude, gMapHeader.enteringRotation, 0);
|
||||
}
|
||||
|
||||
objectSetLight(gDude, 4, 0x10000, nullptr);
|
||||
objectSetLight(gDude, 4, 0x10000, 0);
|
||||
gDude->flags |= OBJECT_NO_SAVE;
|
||||
|
||||
_dude_stand(gDude, gDude->rotation, gDude->fid);
|
||||
|
@ -1746,7 +1746,7 @@ static int mapHeaderWrite(MapHeader* ptr, File* stream)
|
|||
if (fileWriteInt32(stream, ptr->darkness) == -1) return -1;
|
||||
if (fileWriteInt32(stream, ptr->globalVariablesCount) == -1) return -1;
|
||||
if (fileWriteInt32(stream, ptr->field_34) == -1) return -1;
|
||||
if (fileWriteUInt32(stream, ptr->lastVisitTime) == -1) return -1;
|
||||
if (fileWriteInt32(stream, ptr->lastVisitTime) == -1) return -1;
|
||||
if (fileWriteInt32List(stream, ptr->field_3C, 44) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -1766,7 +1766,7 @@ static int mapHeaderRead(MapHeader* ptr, File* stream)
|
|||
if (fileReadInt32(stream, &(ptr->darkness)) == -1) return -1;
|
||||
if (fileReadInt32(stream, &(ptr->globalVariablesCount)) == -1) return -1;
|
||||
if (fileReadInt32(stream, &(ptr->field_34)) == -1) return -1;
|
||||
if (fileReadUInt32(stream, &(ptr->lastVisitTime)) == -1) return -1;
|
||||
if (fileReadInt32(stream, &(ptr->lastVisitTime)) == -1) return -1;
|
||||
if (fileReadInt32List(stream, ptr->field_3C, 44) == -1) return -1;
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct MapHeader {
|
|||
int field_34;
|
||||
|
||||
// Time in game ticks when PC last visited this map.
|
||||
unsigned int lastVisitTime;
|
||||
int lastVisitTime;
|
||||
int field_3C[44];
|
||||
} MapHeader;
|
||||
|
||||
|
@ -69,9 +69,7 @@ typedef void IsoWindowRefreshProc(Rect* rect);
|
|||
|
||||
extern int gMapSid;
|
||||
extern int* gMapLocalVars;
|
||||
extern int* gMapGlobalVars;
|
||||
extern int gMapLocalVarsLength;
|
||||
extern int gMapGlobalVarsLength;
|
||||
extern int gElevation;
|
||||
|
||||
extern MessageList gMapMessageList;
|
||||
|
|
|
@ -1,180 +0,0 @@
|
|||
#include "mapper/map_func.h"
|
||||
|
||||
#include "actions.h"
|
||||
#include "color.h"
|
||||
#include "game_mouse.h"
|
||||
#include "input.h"
|
||||
#include "map.h"
|
||||
#include "memory.h"
|
||||
#include "mouse.h"
|
||||
#include "proto.h"
|
||||
#include "svga.h"
|
||||
#include "tile.h"
|
||||
#include "window_manager.h"
|
||||
#include "window_manager_private.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
// 0x5595CC
|
||||
static bool block_obj_view_on = false;
|
||||
|
||||
// 0x4825B0
|
||||
void setup_map_dirs()
|
||||
{
|
||||
// TODO: Incomplete.
|
||||
}
|
||||
|
||||
// 0x4826B4
|
||||
void copy_proto_lists()
|
||||
{
|
||||
// TODO: Incomplete.
|
||||
}
|
||||
|
||||
// 0x482708
|
||||
void place_entrance_hex()
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int tile;
|
||||
|
||||
while (inputGetInput() != -2) {
|
||||
}
|
||||
|
||||
if ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_DOWN) != 0) {
|
||||
if (_mouse_click_in(0, 0, _scr_size.right - _scr_size.left, _scr_size.bottom - _scr_size.top - 100)) {
|
||||
mouseGetPosition(&x, &y);
|
||||
|
||||
tile = tileFromScreenXY(x, y, gElevation);
|
||||
if (tile != -1) {
|
||||
if (tileSetCenter(tile, TILE_SET_CENTER_FLAG_IGNORE_SCROLL_RESTRICTIONS) == 0) {
|
||||
mapSetEnteringLocation(tile, gElevation, rotation);
|
||||
} else {
|
||||
win_timed_msg("ERROR: Entrance out of range!", _colorTable[31744]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 0x4841C4
|
||||
void pick_region(Rect* rect)
|
||||
{
|
||||
Rect temp;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
gameMouseSetCursor(MOUSE_CURSOR_PLUS);
|
||||
gameMouseObjectsHide();
|
||||
|
||||
while (1) {
|
||||
if (inputGetInput() == -2
|
||||
&& (mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_DOWN) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
get_input_position(&x, &y);
|
||||
temp.left = x;
|
||||
temp.top = y;
|
||||
temp.right = x;
|
||||
temp.bottom = y;
|
||||
|
||||
while ((mouseGetEvent() & MOUSE_EVENT_LEFT_BUTTON_UP) == 0) {
|
||||
inputGetInput();
|
||||
|
||||
get_input_position(&x, &y);
|
||||
|
||||
if (x != temp.right || y != temp.bottom) {
|
||||
erase_rect(rect);
|
||||
sort_rect(rect, &temp);
|
||||
draw_rect(rect, _colorTable[32747]);
|
||||
}
|
||||
}
|
||||
|
||||
erase_rect(rect);
|
||||
gameMouseSetCursor(MOUSE_CURSOR_ARROW);
|
||||
gameMouseObjectsShow();
|
||||
}
|
||||
|
||||
// 0x484294
|
||||
void sort_rect(Rect* a, Rect* b)
|
||||
{
|
||||
if (b->right > b->left) {
|
||||
a->left = b->left;
|
||||
a->right = b->right;
|
||||
} else {
|
||||
a->left = b->right;
|
||||
a->right = b->left;
|
||||
}
|
||||
|
||||
if (b->bottom > b->top) {
|
||||
a->top = b->top;
|
||||
a->bottom = b->bottom;
|
||||
} else {
|
||||
a->top = b->bottom;
|
||||
a->bottom = b->top;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x4842D4
|
||||
void draw_rect(Rect* rect, unsigned char color)
|
||||
{
|
||||
int width = rect->right - rect->left;
|
||||
int height = rect->bottom - rect->top;
|
||||
int max_dimension;
|
||||
|
||||
if (height < width) {
|
||||
max_dimension = width;
|
||||
} else {
|
||||
max_dimension = height;
|
||||
}
|
||||
|
||||
unsigned char* buffer = (unsigned char*)internal_malloc(max_dimension);
|
||||
if (buffer != NULL) {
|
||||
memset(buffer, color, max_dimension);
|
||||
_scr_blit(buffer, width, 1, 0, 0, width, 1, rect->left, rect->top);
|
||||
_scr_blit(buffer, 1, height, 0, 0, 1, height, rect->left, rect->top);
|
||||
_scr_blit(buffer, width, 1, 0, 0, width, 1, rect->left, rect->bottom);
|
||||
_scr_blit(buffer, 1, height, 0, 0, 1, height, rect->right, rect->top);
|
||||
internal_free(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
// 0x4843A0
|
||||
void erase_rect(Rect* rect)
|
||||
{
|
||||
Rect r = *rect;
|
||||
|
||||
r.bottom = rect->top;
|
||||
windowRefreshAll(&r);
|
||||
|
||||
r.bottom = rect->bottom;
|
||||
r.left = rect->right;
|
||||
windowRefreshAll(&r);
|
||||
|
||||
r.left = rect->left;
|
||||
r.top = rect->bottom;
|
||||
windowRefreshAll(&r);
|
||||
|
||||
r.top = rect->top;
|
||||
r.right = rect->left;
|
||||
windowRefreshAll(&r);
|
||||
}
|
||||
|
||||
// 0x484400
|
||||
int toolbar_proto(int type, int id)
|
||||
{
|
||||
if (id < proto_max_id(type)) {
|
||||
return (type << 24) | id;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x485D44
|
||||
bool map_toggle_block_obj_viewing_on()
|
||||
{
|
||||
return block_obj_view_on;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
|
@ -1,20 +0,0 @@
|
|||
#ifndef FALLOUT_MAPPER_MAP_FUNC_H_
|
||||
#define FALLOUT_MAPPER_MAP_FUNC_H_
|
||||
|
||||
#include "geometry.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
void setup_map_dirs();
|
||||
void copy_proto_lists();
|
||||
void place_entrance_hex();
|
||||
void pick_region(Rect* rect);
|
||||
void sort_rect(Rect* a, Rect* b);
|
||||
void draw_rect(Rect* rect, unsigned char color);
|
||||
void erase_rect(Rect* rect);
|
||||
int toolbar_proto(int type, int id);
|
||||
bool map_toggle_block_obj_viewing_on();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* FALLOUT_MAPPER_MAP_FUNC_H_ */
|
1743
src/mapper/mapper.cc
1743
src/mapper/mapper.cc
File diff suppressed because it is too large
Load Diff
|
@ -1,23 +0,0 @@
|
|||
#ifndef FALLOUT_MAPPER_MAPPER_H_
|
||||
#define FALLOUT_MAPPER_MAPPER_H_
|
||||
|
||||
#include "map.h"
|
||||
#include "obj_types.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
extern MapTransition mapInfo;
|
||||
|
||||
extern int menu_val_0[8];
|
||||
extern int menu_val_2[8];
|
||||
extern int menu_val_1[21];
|
||||
extern unsigned char* tool;
|
||||
extern int tool_win;
|
||||
|
||||
int mapper_main(int argc, char** argv);
|
||||
void print_toolbar_name(int object_type);
|
||||
int mapper_inven_unwield(Object* obj, int right_hand);
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* FALLOUT_MAPPER_MAPPER_H_ */
|
|
@ -1,607 +0,0 @@
|
|||
#include "mapper/mp_proto.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "art.h"
|
||||
#include "color.h"
|
||||
#include "combat_ai.h"
|
||||
#include "critter.h"
|
||||
#include "input.h"
|
||||
#include "kb.h"
|
||||
#include "mapper/mp_targt.h"
|
||||
#include "memory.h"
|
||||
#include "proto.h"
|
||||
#include "svga.h"
|
||||
#include "window_manager.h"
|
||||
#include "window_manager_private.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
#define CRITTER_FLAG_COUNT 10
|
||||
|
||||
#define YES 0
|
||||
#define NO 1
|
||||
|
||||
static int proto_choose_container_flags(Proto* proto);
|
||||
static int proto_subdata_setup_int_button(const char* title, int key, int value, int min_value, int max_value, int* y, int a7);
|
||||
static int proto_subdata_setup_fid_button(const char* title, int key, int fid, int* y, int a5);
|
||||
static int proto_subdata_setup_pid_button(const char* title, int key, int pid, int* y, int a5);
|
||||
static void proto_critter_flags_redraw(int win, int pid);
|
||||
static int proto_critter_flags_modify(int pid);
|
||||
static int mp_pick_kill_type();
|
||||
|
||||
static char kYes[] = "YES";
|
||||
static char kNo[] = "NO";
|
||||
|
||||
// 0x53DAFC
|
||||
static char default_proto_builder_name[36] = "EVERTS SCOTTY";
|
||||
|
||||
// 0x559924
|
||||
char* proto_builder_name = default_proto_builder_name;
|
||||
|
||||
// 0x559B94
|
||||
static const char* wall_light_strs[] = {
|
||||
"North/South",
|
||||
"East/West",
|
||||
"North Corner",
|
||||
"South Corner",
|
||||
"East Corner",
|
||||
"West Corner",
|
||||
};
|
||||
|
||||
// 0x559C50
|
||||
static char* yesno[] = {
|
||||
kYes,
|
||||
kNo,
|
||||
};
|
||||
|
||||
// 0x559C58
|
||||
int edit_window_color = 1;
|
||||
|
||||
// 0x559C60
|
||||
bool can_modify_protos = false;
|
||||
|
||||
// 0x559C68
|
||||
static int subwin = -1;
|
||||
|
||||
// 0x559C6C
|
||||
static int critFlagList[CRITTER_FLAG_COUNT] = {
|
||||
CRITTER_NO_STEAL,
|
||||
CRITTER_NO_DROP,
|
||||
CRITTER_NO_LIMBS,
|
||||
CRITTER_NO_AGE,
|
||||
CRITTER_NO_HEAL,
|
||||
CRITTER_INVULNERABLE,
|
||||
CRITTER_FLAT,
|
||||
CRITTER_SPECIAL_DEATH,
|
||||
CRITTER_LONG_LIMBS,
|
||||
CRITTER_NO_KNOCKBACK,
|
||||
};
|
||||
|
||||
// 0x559C94
|
||||
static const char* critFlagStrs[CRITTER_FLAG_COUNT] = {
|
||||
"_Steal",
|
||||
"_Drop",
|
||||
"_Limbs",
|
||||
"_Ages",
|
||||
"_Heal",
|
||||
"Invuln.,",
|
||||
"_Flattens",
|
||||
"Special",
|
||||
"Rng",
|
||||
"_Knock",
|
||||
};
|
||||
|
||||
// 0x4922F8
|
||||
void init_mapper_protos()
|
||||
{
|
||||
edit_window_color = _colorTable[10570];
|
||||
can_modify_protos = target_overriden();
|
||||
}
|
||||
|
||||
// 0x492840
|
||||
int proto_choose_container_flags(Proto* proto)
|
||||
{
|
||||
int win = windowCreate(320,
|
||||
185,
|
||||
220,
|
||||
205,
|
||||
edit_window_color,
|
||||
WINDOW_MOVE_ON_TOP);
|
||||
if (win == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
_win_register_text_button(win,
|
||||
10,
|
||||
11,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
'1',
|
||||
"Magic Hands Grnd",
|
||||
0);
|
||||
|
||||
if ((proto->item.data.container.openFlags & 0x1) != 0) {
|
||||
windowDrawText(win,
|
||||
yesno[YES],
|
||||
50,
|
||||
125,
|
||||
15,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(win,
|
||||
yesno[NO],
|
||||
50,
|
||||
125,
|
||||
15,
|
||||
_colorTable[32747] | 0x10000);
|
||||
}
|
||||
|
||||
_win_register_text_button(win,
|
||||
10,
|
||||
32,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
'2',
|
||||
"Cannot Pick Up",
|
||||
0);
|
||||
|
||||
if (_proto_action_can_pickup(proto->pid)) {
|
||||
windowDrawText(win,
|
||||
yesno[YES],
|
||||
50,
|
||||
125,
|
||||
36,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(win,
|
||||
yesno[NO],
|
||||
50,
|
||||
125,
|
||||
36,
|
||||
_colorTable[32747] | 0x10000);
|
||||
}
|
||||
|
||||
windowDrawBorder(win);
|
||||
windowRefresh(win);
|
||||
|
||||
while (1) {
|
||||
sharedFpsLimiter.mark();
|
||||
|
||||
int input = inputGetInput();
|
||||
if (input == KEY_ESCAPE
|
||||
|| input == KEY_BAR
|
||||
|| input == KEY_RETURN) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (input == '1') {
|
||||
proto->item.data.container.openFlags ^= 0x1;
|
||||
|
||||
if ((proto->item.data.container.openFlags & 0x1) != 0) {
|
||||
windowDrawText(win,
|
||||
yesno[YES],
|
||||
50,
|
||||
125,
|
||||
15,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(win,
|
||||
yesno[NO],
|
||||
50,
|
||||
125,
|
||||
15,
|
||||
_colorTable[32747] | 0x10000);
|
||||
}
|
||||
|
||||
windowRefresh(win);
|
||||
} else if (input == '2') {
|
||||
proto->item.extendedFlags ^= 0x8000;
|
||||
|
||||
if (_proto_action_can_pickup(proto->pid)) {
|
||||
windowDrawText(win,
|
||||
yesno[YES],
|
||||
50,
|
||||
125,
|
||||
36,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(win,
|
||||
yesno[NO],
|
||||
50,
|
||||
125,
|
||||
36,
|
||||
_colorTable[32747] | 0x10000);
|
||||
}
|
||||
|
||||
windowRefresh(win);
|
||||
}
|
||||
|
||||
renderPresent();
|
||||
sharedFpsLimiter.throttle();
|
||||
}
|
||||
|
||||
windowDestroy(win);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x492A3C
|
||||
int proto_subdata_setup_int_button(const char* title, int key, int value, int min_value, int max_value, int* y, int a7)
|
||||
{
|
||||
char text[36];
|
||||
int button_x;
|
||||
int value_offset_x;
|
||||
|
||||
button_x = 10;
|
||||
value_offset_x = 90;
|
||||
|
||||
if (a7 == 9) {
|
||||
*y -= 189;
|
||||
}
|
||||
|
||||
if (a7 > 8) {
|
||||
button_x = 165;
|
||||
value_offset_x -= 16;
|
||||
}
|
||||
|
||||
_win_register_text_button(subwin,
|
||||
button_x,
|
||||
*y,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
key,
|
||||
title,
|
||||
0);
|
||||
|
||||
if (value >= min_value && value < max_value) {
|
||||
sprintf(text, "%d", value);
|
||||
windowDrawText(subwin,
|
||||
text,
|
||||
38,
|
||||
button_x + value_offset_x,
|
||||
*y + 4,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(subwin,
|
||||
"<ERROR>",
|
||||
38,
|
||||
button_x + value_offset_x,
|
||||
*y + 4,
|
||||
_colorTable[31744] | 0x10000);
|
||||
}
|
||||
|
||||
*y += 21;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x492B28
|
||||
int proto_subdata_setup_fid_button(const char* title, int key, int fid, int* y, int a5)
|
||||
{
|
||||
char text[36];
|
||||
char* pch;
|
||||
int button_x;
|
||||
int value_offset_x;
|
||||
|
||||
button_x = 10;
|
||||
value_offset_x = 90;
|
||||
|
||||
if (a5 == 9) {
|
||||
*y -= 189;
|
||||
}
|
||||
|
||||
if (a5 > 8) {
|
||||
button_x = 165;
|
||||
value_offset_x -= 16;
|
||||
}
|
||||
|
||||
_win_register_text_button(subwin,
|
||||
button_x,
|
||||
*y,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
key,
|
||||
title,
|
||||
0);
|
||||
|
||||
if (art_list_str(fid, text) != -1) {
|
||||
pch = strchr(text, '.');
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
windowDrawText(subwin,
|
||||
text,
|
||||
80,
|
||||
button_x + value_offset_x,
|
||||
*y + 4,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(subwin,
|
||||
"None",
|
||||
80,
|
||||
button_x + value_offset_x,
|
||||
*y + 4,
|
||||
_colorTable[992] | 0x10000);
|
||||
}
|
||||
|
||||
*y += 21;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x492C20
|
||||
int proto_subdata_setup_pid_button(const char* title, int key, int pid, int* y, int a5)
|
||||
{
|
||||
int button_x;
|
||||
int value_offset_x;
|
||||
|
||||
button_x = 10;
|
||||
value_offset_x = 90;
|
||||
|
||||
if (a5 == 9) {
|
||||
*y -= 189;
|
||||
}
|
||||
|
||||
if (a5 > 8) {
|
||||
button_x = 165;
|
||||
value_offset_x = 74;
|
||||
}
|
||||
|
||||
_win_register_text_button(subwin,
|
||||
button_x,
|
||||
*y,
|
||||
-1,
|
||||
-1,
|
||||
-1,
|
||||
key,
|
||||
title,
|
||||
0);
|
||||
|
||||
if (pid != -1) {
|
||||
windowDrawText(subwin,
|
||||
protoGetName(pid),
|
||||
49,
|
||||
button_x + value_offset_x,
|
||||
*y + 4,
|
||||
_colorTable[32747] | 0x10000);
|
||||
} else {
|
||||
windowDrawText(subwin,
|
||||
"None",
|
||||
49,
|
||||
button_x + value_offset_x,
|
||||
*y + 4,
|
||||
_colorTable[992] | 0x10000);
|
||||
}
|
||||
|
||||
*y += 21;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x495438
|
||||
const char* proto_wall_light_str(int flags)
|
||||
{
|
||||
if ((flags & 0x8000000) != 0) {
|
||||
return wall_light_strs[1];
|
||||
}
|
||||
|
||||
if ((flags & 0x10000000) != 0) {
|
||||
return wall_light_strs[2];
|
||||
}
|
||||
|
||||
if ((flags & 0x20000000) != 0) {
|
||||
return wall_light_strs[3];
|
||||
}
|
||||
|
||||
if ((flags & 0x40000000) != 0) {
|
||||
return wall_light_strs[4];
|
||||
}
|
||||
|
||||
if ((flags & 0x80000000) != 0) {
|
||||
return wall_light_strs[5];
|
||||
}
|
||||
|
||||
return wall_light_strs[0];
|
||||
}
|
||||
|
||||
// 0x4960B8
|
||||
void proto_critter_flags_redraw(int win, int pid)
|
||||
{
|
||||
int index;
|
||||
int color;
|
||||
int x = 110;
|
||||
|
||||
for (index = 0; index < CRITTER_FLAG_COUNT; index++) {
|
||||
if (_critter_flag_check(pid, critFlagList[index])) {
|
||||
color = _colorTable[992];
|
||||
} else {
|
||||
color = _colorTable[10570];
|
||||
}
|
||||
|
||||
windowDrawText(win, critFlagStrs[index], 44, x, 195, color | 0x10000);
|
||||
x += 48;
|
||||
}
|
||||
}
|
||||
|
||||
// 0x496120
|
||||
int proto_critter_flags_modify(int pid)
|
||||
{
|
||||
Proto* proto;
|
||||
int rc;
|
||||
int flags = 0;
|
||||
int index;
|
||||
|
||||
if (protoGetProto(pid, &proto) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Can't be stolen from?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_NO_STEAL;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Can't Drop items?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_NO_DROP;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Can't lose limbs?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_NO_LIMBS;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Dead Bodies Can't Age?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_NO_AGE;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Can't Heal by Aging?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_NO_HEAL;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Is Invlunerable????", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_INVULNERABLE;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Can't Flatten on Death?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_FLAT;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Has Special Death?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_SPECIAL_DEATH;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Has Extra Hand-To-Hand Range?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_LONG_LIMBS;
|
||||
}
|
||||
|
||||
rc = win_yes_no("Can't be knocked back?", 340, 200, _colorTable[15855]);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rc == 1) {
|
||||
flags |= CRITTER_NO_KNOCKBACK;
|
||||
}
|
||||
|
||||
if (!can_modify_protos) {
|
||||
win_timed_msg("Can't modify protos!", _colorTable[31744] | 0x10000);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (index = 0; index < CRITTER_FLAG_COUNT; index++) {
|
||||
if ((critFlagList[index] & flags) != 0) {
|
||||
critter_flag_set(pid, critFlagList[index]);
|
||||
} else {
|
||||
critter_flag_unset(pid, critFlagList[index]);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x497520
|
||||
int mp_pick_kill_type()
|
||||
{
|
||||
char* names[KILL_TYPE_COUNT];
|
||||
int index;
|
||||
|
||||
for (index = 0; index < KILL_TYPE_COUNT; index++) {
|
||||
names[index] = killTypeGetName(index);
|
||||
}
|
||||
|
||||
return _win_list_select("Kill Type",
|
||||
names,
|
||||
KILL_TYPE_COUNT,
|
||||
NULL,
|
||||
50,
|
||||
100,
|
||||
_colorTable[15855]);
|
||||
}
|
||||
|
||||
// 0x497568
|
||||
int proto_pick_ai_packet(int* value)
|
||||
{
|
||||
int count;
|
||||
char** names;
|
||||
int index;
|
||||
int rc;
|
||||
|
||||
count = combat_ai_num();
|
||||
if (count <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
names = (char**)internal_malloc(sizeof(char*) * count);
|
||||
for (index = 0; index < count; index++) {
|
||||
names[index] = (char*)internal_malloc(strlen(combat_ai_name(index)) + 1);
|
||||
strcpy(names[index], combat_ai_name(index));
|
||||
}
|
||||
|
||||
rc = _win_list_select("AI Packet",
|
||||
names,
|
||||
count,
|
||||
NULL,
|
||||
50,
|
||||
100,
|
||||
_colorTable[15855]);
|
||||
if (rc != -1) {
|
||||
*value = rc;
|
||||
}
|
||||
|
||||
for (index = 0; index < count; index++) {
|
||||
internal_free(names[index]);
|
||||
}
|
||||
|
||||
internal_free(names);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef FALLOUT_MAPPER_MP_PROTO_H_
|
||||
#define FALLOUT_MAPPER_MP_PROTO_H_
|
||||
|
||||
namespace fallout {
|
||||
|
||||
extern char* proto_builder_name;
|
||||
extern bool can_modify_protos;
|
||||
|
||||
void init_mapper_protos();
|
||||
const char* proto_wall_light_str(int flags);
|
||||
int proto_pick_ai_packet(int* value);
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* FALLOUT_MAPPER_MP_PROTO_H_ */
|
|
@ -1,90 +0,0 @@
|
|||
#include "mapper/mp_scrpt.h"
|
||||
|
||||
#include "art.h"
|
||||
#include "object.h"
|
||||
#include "scripts.h"
|
||||
#include "tile.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
// 0x49B170
|
||||
int map_scr_remove_spatial(int tile, int elevation)
|
||||
{
|
||||
Script* scr;
|
||||
Object* obj;
|
||||
Rect rect;
|
||||
|
||||
scr = scriptGetFirstSpatialScript(elevation);
|
||||
while (scr != NULL) {
|
||||
if (builtTileGetTile(scr->sp.built_tile) == tile) {
|
||||
scriptRemove(scr->sid);
|
||||
|
||||
scr = scriptGetFirstSpatialScript(elevation);
|
||||
continue;
|
||||
}
|
||||
|
||||
scr = scriptGetNextSpatialScript();
|
||||
}
|
||||
|
||||
obj = objectFindFirstAtElevation(elevation);
|
||||
while (obj != NULL) {
|
||||
if (obj->tile == tile && buildFid(OBJ_TYPE_INTERFACE, 3, 0, 0, 0) == obj->fid) {
|
||||
objectDestroy(obj, &rect);
|
||||
tileWindowRefreshRect(&rect, elevation);
|
||||
|
||||
obj = objectFindFirstAtElevation(elevation);
|
||||
continue;
|
||||
}
|
||||
|
||||
obj = objectFindNextAtElevation();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B214
|
||||
int map_scr_remove_all_spatials()
|
||||
{
|
||||
int elevation;
|
||||
Script* scr;
|
||||
Object* obj;
|
||||
int sid;
|
||||
|
||||
for (elevation = 0; elevation < ELEVATION_COUNT; elevation++) {
|
||||
scr = scriptGetFirstSpatialScript(elevation);
|
||||
while (scr != NULL) {
|
||||
scriptRemove(scr->sid);
|
||||
|
||||
scr = scriptGetFirstSpatialScript(elevation);
|
||||
}
|
||||
|
||||
obj = objectFindFirstAtElevation(elevation);
|
||||
while (obj != NULL) {
|
||||
if (buildFid(OBJ_TYPE_INTERFACE, 3, 0, 0, 0) == obj->fid) {
|
||||
objectDestroy(obj, NULL);
|
||||
|
||||
obj = objectFindFirstAtElevation(elevation);
|
||||
continue;
|
||||
}
|
||||
|
||||
obj = objectFindNextAtElevation();
|
||||
}
|
||||
}
|
||||
|
||||
tileWindowRefresh();
|
||||
|
||||
for (sid = 0; sid < 15000; sid++) {
|
||||
if (scriptGetScript(sid, &scr) != -1) {
|
||||
if (scr->owner != NULL) {
|
||||
if (scr->owner->pid == 0x500000C) {
|
||||
scr->owner->sid = -1;
|
||||
scriptRemove(sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef FALLOUT_MAPPER_MP_SCRPTR_H_
|
||||
#define FALLOUT_MAPPER_MP_SCRPTR_H_
|
||||
|
||||
namespace fallout {
|
||||
|
||||
int map_scr_remove_spatial(int tile, int elevation);
|
||||
int map_scr_remove_all_spatials();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* FALLOUT_MAPPER_MP_SCRPTR_H_ */
|
|
@ -1,531 +0,0 @@
|
|||
#include "mapper/mp_targt.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "art.h"
|
||||
#include "game.h"
|
||||
#include "map.h"
|
||||
#include "mapper/mp_proto.h"
|
||||
#include "memory.h"
|
||||
#include "proto.h"
|
||||
#include "window_manager_private.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
#define TARGET_DAT "target.dat"
|
||||
|
||||
typedef struct TargetNode {
|
||||
TargetSubNode subnode;
|
||||
struct TargetNode* next;
|
||||
} TargetNode;
|
||||
|
||||
typedef struct TargetList {
|
||||
TargetNode* tail;
|
||||
int count;
|
||||
int next_tid;
|
||||
} TargetList;
|
||||
|
||||
// 0x53F354
|
||||
static char default_target_path_base[] = "\\fallout2\\dev\\proto\\";
|
||||
|
||||
// 0x559CC4
|
||||
static TargetList targetlist = { NULL, 0, 0 };
|
||||
|
||||
// 0x559CD0
|
||||
static char* target_path_base = default_target_path_base;
|
||||
|
||||
// 0x559DBC
|
||||
static bool tgt_overriden = false;
|
||||
|
||||
// 0x49B2F0
|
||||
void target_override_protection()
|
||||
{
|
||||
char* name;
|
||||
|
||||
tgt_overriden = true;
|
||||
|
||||
name = getenv("MAIL_NAME");
|
||||
if (name != NULL) {
|
||||
// NOTE: Unsafe, backing buffer is 32 byte max.
|
||||
strcpy(proto_builder_name, strupr(name));
|
||||
} else {
|
||||
strcpy(proto_builder_name, "UNKNOWN");
|
||||
}
|
||||
}
|
||||
|
||||
// 0x49B2F0
|
||||
bool target_overriden()
|
||||
{
|
||||
return tgt_overriden;
|
||||
}
|
||||
|
||||
// 0x49B34C
|
||||
void target_make_path(char* path, int pid)
|
||||
{
|
||||
if (_cd_path_base[0] != '\0' && _cd_path_base[1] == ':') {
|
||||
strncpy(path, _cd_path_base, 2);
|
||||
strcat(path, target_path_base);
|
||||
} else {
|
||||
strcpy(path, target_path_base);
|
||||
}
|
||||
|
||||
if (pid != -1) {
|
||||
strcat(path, artGetObjectTypeName(PID_TYPE(pid)));
|
||||
}
|
||||
}
|
||||
|
||||
// 0x49B424
|
||||
int target_init()
|
||||
{
|
||||
target_remove_all();
|
||||
target_header_load();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B434
|
||||
int target_exit()
|
||||
{
|
||||
if (can_modify_protos) {
|
||||
target_header_save();
|
||||
target_remove_all();
|
||||
} else {
|
||||
target_remove_all();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B454
|
||||
int target_header_save()
|
||||
{
|
||||
char path[COMPAT_MAX_PATH];
|
||||
FILE* stream;
|
||||
|
||||
target_make_path(path, -1);
|
||||
strcat(path, TARGET_DAT);
|
||||
|
||||
stream = fopen(path, "wb");
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fwrite(&targetlist, sizeof(targetlist), 1, stream) != 1) {
|
||||
// FIXME: Leaking `stream`.
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B4E8
|
||||
int target_header_load()
|
||||
{
|
||||
char path[COMPAT_MAX_PATH];
|
||||
FILE* stream;
|
||||
|
||||
target_make_path(path, -1);
|
||||
strcat(path, TARGET_DAT);
|
||||
|
||||
stream = fopen(path, "rb");
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fread(&targetlist, sizeof(targetlist), 1, stream) != 1) {
|
||||
// FIXME: Leaking `stream`.
|
||||
return -1;
|
||||
}
|
||||
|
||||
targetlist.tail = NULL;
|
||||
targetlist.count = 0;
|
||||
|
||||
fclose(stream);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B58C
|
||||
int target_save(int pid)
|
||||
{
|
||||
char path[COMPAT_MAX_PATH];
|
||||
size_t len;
|
||||
char* extension;
|
||||
FILE* stream;
|
||||
TargetSubNode* subnode;
|
||||
|
||||
if (target_ptr(pid, &subnode) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
target_make_path(path, pid);
|
||||
|
||||
len = strlen(path);
|
||||
path[len] = '\\';
|
||||
_proto_list_str(pid, path + len + 1);
|
||||
|
||||
extension = strchr(path + len + 1, '.');
|
||||
if (extension != NULL) {
|
||||
strcpy(extension + 1, "tgt");
|
||||
} else {
|
||||
strcat(path, ".tgt");
|
||||
}
|
||||
|
||||
stream = fopen(path, "wb");
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (subnode != NULL) {
|
||||
fwrite(subnode, sizeof(TargetSubNode), 1, stream);
|
||||
subnode = subnode->next;
|
||||
}
|
||||
|
||||
fclose(stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B6BC
|
||||
int target_load(int pid, TargetSubNode** subnode_ptr)
|
||||
{
|
||||
char path[COMPAT_MAX_PATH];
|
||||
size_t len;
|
||||
char* extension;
|
||||
FILE* stream;
|
||||
TargetSubNode* subnode;
|
||||
|
||||
target_make_path(path, pid);
|
||||
|
||||
len = strlen(path);
|
||||
path[len] = '\\';
|
||||
_proto_list_str(pid, path + len + 1);
|
||||
|
||||
extension = strchr(path + len + 1, '.');
|
||||
if (extension != NULL) {
|
||||
strcpy(extension + 1, "tgt");
|
||||
} else {
|
||||
strcat(path, ".tgt");
|
||||
}
|
||||
|
||||
stream = fopen(path, "rb");
|
||||
if (stream == NULL) {
|
||||
*subnode_ptr = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (target_find_free_subnode(&subnode) == -1) {
|
||||
*subnode_ptr = NULL;
|
||||
// FIXME: Leaks `stream`.
|
||||
return -1;
|
||||
}
|
||||
|
||||
fread(subnode, sizeof(TargetSubNode), 1, stream);
|
||||
|
||||
*subnode_ptr = subnode;
|
||||
|
||||
while (subnode->next != NULL) {
|
||||
subnode->next = (TargetSubNode*)internal_malloc(sizeof(TargetSubNode));
|
||||
if (subnode->next == NULL) {
|
||||
// FIXME: Leaks `stream`.
|
||||
return -1;
|
||||
}
|
||||
|
||||
subnode = subnode->next;
|
||||
fread(subnode, sizeof(TargetSubNode), 1, stream);
|
||||
}
|
||||
|
||||
fclose(stream);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49B9C0
|
||||
int target_find_free_subnode(TargetSubNode** subnode_ptr)
|
||||
{
|
||||
TargetNode* node = (TargetNode*)internal_malloc(sizeof(TargetNode));
|
||||
if (node == NULL) {
|
||||
*subnode_ptr = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
*subnode_ptr = &(node->subnode);
|
||||
|
||||
node->subnode.pid = -1;
|
||||
node->subnode.next = NULL;
|
||||
node->next = targetlist.tail;
|
||||
|
||||
targetlist.tail = node;
|
||||
targetlist.count++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BA10
|
||||
int target_new(int pid, int* tid_ptr)
|
||||
{
|
||||
TargetSubNode* subnode;
|
||||
TargetSubNode* new_subnode;
|
||||
|
||||
if (target_ptr(pid, &subnode) == -1) {
|
||||
if (target_find_free_subnode(&subnode) == -1) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
new_subnode = (TargetSubNode*)internal_malloc(sizeof(TargetSubNode));
|
||||
if (new_subnode == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
new_subnode->next = NULL;
|
||||
|
||||
while (subnode->next != NULL) {
|
||||
subnode = subnode->next;
|
||||
}
|
||||
|
||||
subnode->next = new_subnode;
|
||||
|
||||
new_subnode->pid = pid;
|
||||
new_subnode->tid = targetlist.next_tid;
|
||||
|
||||
*tid_ptr = targetlist.next_tid;
|
||||
|
||||
targetlist.count++;
|
||||
targetlist.next_tid++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BBD4
|
||||
int target_remove(int pid)
|
||||
{
|
||||
TargetNode* node;
|
||||
TargetSubNode* subnode;
|
||||
TargetSubNode* subnode_next;
|
||||
|
||||
node = targetlist.tail;
|
||||
while (node != NULL) {
|
||||
if (node->subnode.pid == pid) {
|
||||
break;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
subnode = node->subnode.next;
|
||||
|
||||
if (node == targetlist.tail) {
|
||||
targetlist.tail = targetlist.tail->next;
|
||||
}
|
||||
|
||||
internal_free(node);
|
||||
|
||||
while (subnode != NULL) {
|
||||
subnode_next = subnode->next;
|
||||
internal_free(subnode);
|
||||
subnode = subnode_next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BC3C
|
||||
int target_remove_tid(int pid, int tid)
|
||||
{
|
||||
TargetNode* node;
|
||||
TargetSubNode* subnode;
|
||||
TargetSubNode* subnode_next;
|
||||
|
||||
node = targetlist.tail;
|
||||
while (node != NULL) {
|
||||
if (node->subnode.pid == pid) {
|
||||
break;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
|
||||
if (node == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (node->subnode.tid == tid) {
|
||||
subnode_next = node->subnode.next;
|
||||
if (subnode_next != NULL) {
|
||||
memcpy(&(node->subnode), subnode_next, sizeof(TargetSubNode));
|
||||
internal_free(subnode_next);
|
||||
} else {
|
||||
target_remove(pid);
|
||||
}
|
||||
|
||||
// FIXME: Should probably return 0 here.
|
||||
} else {
|
||||
subnode = &(node->subnode);
|
||||
while (subnode != NULL) {
|
||||
subnode_next = subnode->next;
|
||||
if (subnode_next->tid == tid) {
|
||||
subnode->next = subnode_next->next;
|
||||
internal_free(subnode_next);
|
||||
return 0;
|
||||
}
|
||||
|
||||
subnode = subnode_next;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 0x49BCBC
|
||||
int target_remove_all()
|
||||
{
|
||||
TargetNode* node;
|
||||
TargetNode* node_next;
|
||||
TargetSubNode* subnode;
|
||||
TargetSubNode* subnode_next;
|
||||
|
||||
node = targetlist.tail;
|
||||
targetlist.tail = NULL;
|
||||
|
||||
while (node != NULL) {
|
||||
node_next = node->next;
|
||||
|
||||
subnode = node->subnode.next;
|
||||
while (subnode != NULL) {
|
||||
subnode_next = subnode->next;
|
||||
internal_free(subnode);
|
||||
subnode = subnode_next;
|
||||
}
|
||||
|
||||
internal_free(node);
|
||||
node = node_next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BD00
|
||||
int target_ptr(int pid, TargetSubNode** subnode_ptr)
|
||||
{
|
||||
TargetNode* node = targetlist.tail;
|
||||
while (node != NULL) {
|
||||
if (node->subnode.pid == pid) {
|
||||
*subnode_ptr = &(node->subnode);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return target_load(pid, subnode_ptr);
|
||||
}
|
||||
|
||||
// 0x49BD38
|
||||
int target_tid_ptr(int pid, int tid, TargetSubNode** subnode_ptr)
|
||||
{
|
||||
TargetSubNode* subnode;
|
||||
if (target_ptr(pid, &subnode) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while (subnode != NULL) {
|
||||
if (subnode->tid == tid) {
|
||||
*subnode_ptr = subnode;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 0x49BD98
|
||||
int pick_rot()
|
||||
{
|
||||
int value;
|
||||
win_get_num_i(&value,
|
||||
-1,
|
||||
5,
|
||||
false,
|
||||
"Rotation",
|
||||
100,
|
||||
100);
|
||||
return value;
|
||||
}
|
||||
|
||||
// 0x49BDD0
|
||||
int target_pick_global_var(int* value_ptr)
|
||||
{
|
||||
int value;
|
||||
int rc;
|
||||
|
||||
if (gGameGlobalVarsLength == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = win_get_num_i(&value,
|
||||
0,
|
||||
gGameGlobalVarsLength - 1,
|
||||
false,
|
||||
"Global Variable Index #:",
|
||||
100,
|
||||
100);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value_ptr = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BE20
|
||||
int target_pick_map_var(int* value_ptr)
|
||||
{
|
||||
int value;
|
||||
int rc;
|
||||
|
||||
if (gMapGlobalVarsLength == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = win_get_num_i(&value,
|
||||
0,
|
||||
gMapGlobalVarsLength - 1,
|
||||
false,
|
||||
"Map Variable Index #:",
|
||||
100,
|
||||
100);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value_ptr = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 0x49BE70
|
||||
int target_pick_local_var(int* value_ptr)
|
||||
{
|
||||
int value;
|
||||
int rc;
|
||||
|
||||
if (gMapLocalVarsLength == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = win_get_num_i(&value,
|
||||
0,
|
||||
gMapLocalVarsLength - 1,
|
||||
false,
|
||||
"Local Variable Index #:",
|
||||
100,
|
||||
100);
|
||||
if (rc == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
*value_ptr = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
|
@ -1,72 +0,0 @@
|
|||
#ifndef FALLOUT_MAPPER_MP_TARGT_H_
|
||||
#define FALLOUT_MAPPER_MP_TARGT_H_
|
||||
|
||||
namespace fallout {
|
||||
|
||||
typedef struct TargetSubNode {
|
||||
int pid;
|
||||
int tid;
|
||||
int field_8;
|
||||
int field_C;
|
||||
int field_10;
|
||||
int field_14;
|
||||
int field_18;
|
||||
int field_1C;
|
||||
int field_20;
|
||||
int field_24;
|
||||
struct TargetSubNode* next;
|
||||
int field_2C;
|
||||
int field_30;
|
||||
int field_34;
|
||||
int field_38;
|
||||
int field_3C;
|
||||
int field_40;
|
||||
int field_44;
|
||||
int field_48;
|
||||
int field_4C;
|
||||
int field_50;
|
||||
int field_54;
|
||||
int field_58;
|
||||
int field_5C;
|
||||
int field_60;
|
||||
int field_64;
|
||||
int field_68;
|
||||
int field_6C;
|
||||
int field_70;
|
||||
int field_74;
|
||||
int field_78;
|
||||
int field_7C;
|
||||
int field_80;
|
||||
int field_84;
|
||||
int field_88;
|
||||
int field_8C;
|
||||
int field_90;
|
||||
int field_94;
|
||||
int field_98;
|
||||
int field_9C;
|
||||
} TargetSubNode;
|
||||
|
||||
void target_override_protection();
|
||||
bool target_overriden();
|
||||
void target_make_path(char* path, int pid);
|
||||
int target_init();
|
||||
int target_exit();
|
||||
int target_header_save();
|
||||
int target_header_load();
|
||||
int target_save(int pid);
|
||||
int target_load(int pid, TargetSubNode** subnode_ptr);
|
||||
int target_find_free_subnode(TargetSubNode** subnode_ptr);
|
||||
int target_new(int pid, int* tid_ptr);
|
||||
int target_remove(int pid);
|
||||
int target_remove_tid(int pid, int tid);
|
||||
int target_remove_all();
|
||||
int target_ptr(int pid, TargetSubNode** subnode_ptr);
|
||||
int target_tid_ptr(int pid, int tid, TargetSubNode** subnode_ptr);
|
||||
int pick_rot();
|
||||
int target_pick_global_var(int* value_ptr);
|
||||
int target_pick_map_var(int* value_ptr);
|
||||
int target_pick_local_var(int* value_ptr);
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* FALLOUT_MAPPER_MP_TARGT_H_ */
|
|
@ -1,13 +0,0 @@
|
|||
#include "mapper/mp_text.h"
|
||||
|
||||
namespace fallout {
|
||||
|
||||
// 0x49DAC4
|
||||
int proto_build_all_texts()
|
||||
{
|
||||
// TODO: Incomplete.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
|
@ -1,10 +0,0 @@
|
|||
#ifndef FALLOUT_MAPPER_MP_TEXT_H_
|
||||
#define FALLOUT_MAPPER_MP_TEXT_H_
|
||||
|
||||
namespace fallout {
|
||||
|
||||
int proto_build_all_texts();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
#endif /* FALLOUT_MAPPER_MP_TEXT_H_ */
|
|
@ -32,6 +32,7 @@ typedef struct MemoryBlockFooter {
|
|||
static void* memoryBlockMallocImpl(size_t size);
|
||||
static void* memoryBlockReallocImpl(void* ptr, size_t size);
|
||||
static void memoryBlockFreeImpl(void* ptr);
|
||||
static void memoryBlockPrintStats();
|
||||
static void* mem_prep_block(void* block, size_t size);
|
||||
static void memoryBlockValidate(void* block);
|
||||
|
||||
|
@ -59,8 +60,8 @@ static size_t gMemoryBlocksMaximumSize = 0;
|
|||
// 0x4C5A80
|
||||
char* internal_strdup(const char* string)
|
||||
{
|
||||
char* copy = nullptr;
|
||||
if (string != nullptr) {
|
||||
char* copy = NULL;
|
||||
if (string != NULL) {
|
||||
copy = (char*)gMallocProc(strlen(string) + 1);
|
||||
strcpy(copy, string);
|
||||
}
|
||||
|
@ -76,14 +77,14 @@ void* internal_malloc(size_t size)
|
|||
// 0x4C5AD8
|
||||
static void* memoryBlockMallocImpl(size_t size)
|
||||
{
|
||||
void* ptr = nullptr;
|
||||
void* ptr = NULL;
|
||||
|
||||
if (size != 0) {
|
||||
size += sizeof(MemoryBlockHeader) + sizeof(MemoryBlockFooter);
|
||||
size += sizeof(int) - size % sizeof(int);
|
||||
|
||||
unsigned char* block = (unsigned char*)malloc(size);
|
||||
if (block != nullptr) {
|
||||
if (block != NULL) {
|
||||
// NOTE: Uninline.
|
||||
ptr = mem_prep_block(block, size);
|
||||
|
||||
|
@ -111,7 +112,7 @@ void* internal_realloc(void* ptr, size_t size)
|
|||
// 0x4C5B58
|
||||
static void* memoryBlockReallocImpl(void* ptr, size_t size)
|
||||
{
|
||||
if (ptr != nullptr) {
|
||||
if (ptr != NULL) {
|
||||
unsigned char* block = (unsigned char*)ptr - sizeof(MemoryBlockHeader);
|
||||
|
||||
MemoryBlockHeader* header = (MemoryBlockHeader*)block;
|
||||
|
@ -127,7 +128,7 @@ static void* memoryBlockReallocImpl(void* ptr, size_t size)
|
|||
}
|
||||
|
||||
unsigned char* newBlock = (unsigned char*)realloc(block, size);
|
||||
if (newBlock != nullptr) {
|
||||
if (newBlock != NULL) {
|
||||
gMemoryBlocksCurrentSize += size;
|
||||
if (gMemoryBlocksCurrentSize > gMemoryBlocksMaximumSize) {
|
||||
gMemoryBlocksMaximumSize = gMemoryBlocksCurrentSize;
|
||||
|
@ -144,7 +145,7 @@ static void* memoryBlockReallocImpl(void* ptr, size_t size)
|
|||
} else {
|
||||
gMemoryBlocksCurrentCount--;
|
||||
}
|
||||
ptr = nullptr;
|
||||
ptr = NULL;
|
||||
}
|
||||
} else {
|
||||
ptr = gMallocProc(size);
|
||||
|
@ -162,7 +163,7 @@ void internal_free(void* ptr)
|
|||
// 0x4C5C2C
|
||||
static void memoryBlockFreeImpl(void* ptr)
|
||||
{
|
||||
if (ptr != nullptr) {
|
||||
if (ptr != NULL) {
|
||||
void* block = (unsigned char*)ptr - sizeof(MemoryBlockHeader);
|
||||
MemoryBlockHeader* header = (MemoryBlockHeader*)block;
|
||||
|
||||
|
@ -175,8 +176,10 @@ static void memoryBlockFreeImpl(void* ptr)
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: Not used.
|
||||
//
|
||||
// 0x4C5C5C
|
||||
void mem_check()
|
||||
static void memoryBlockPrintStats()
|
||||
{
|
||||
if (gMallocProc == memoryBlockMallocImpl) {
|
||||
debugPrint("Current memory allocated: %6d blocks, %9u bytes total\n", gMemoryBlocksCurrentCount, gMemoryBlocksCurrentSize);
|
||||
|
|
|
@ -9,7 +9,6 @@ char* internal_strdup(const char* string);
|
|||
void* internal_malloc(size_t size);
|
||||
void* internal_realloc(void* ptr, size_t size);
|
||||
void internal_free(void* ptr);
|
||||
void mem_check();
|
||||
|
||||
} // namespace fallout
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static int memoryManagerPrintError(const char* format, ...)
|
|||
|
||||
int length = 0;
|
||||
|
||||
if (gMemoryManagerPrintErrorProc != nullptr) {
|
||||
if (gMemoryManagerPrintErrorProc != NULL) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
length = vsnprintf(err, sizeof(err), format, args);
|
||||
|
@ -91,7 +91,7 @@ void memoryManagerSetProcs(MallocProc* mallocProc, ReallocProc* reallocProc, Fre
|
|||
void* internal_malloc_safe(size_t size, const char* file, int line)
|
||||
{
|
||||
void* ptr = gMemoryManagerMallocProc(size);
|
||||
if (ptr == nullptr) {
|
||||
if (ptr == NULL) {
|
||||
memoryManagerFatalAllocationError("malloc", size, file, line);
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ void* internal_malloc_safe(size_t size, const char* file, int line)
|
|||
void* internal_realloc_safe(void* ptr, size_t size, const char* file, int line)
|
||||
{
|
||||
ptr = gMemoryManagerReallocProc(ptr, size);
|
||||
if (ptr == nullptr) {
|
||||
if (ptr == NULL) {
|
||||
memoryManagerFatalAllocationError("realloc", size, file, line);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ void* internal_realloc_safe(void* ptr, size_t size, const char* file, int line)
|
|||
// 0x484688
|
||||
void internal_free_safe(void* ptr, const char* file, int line)
|
||||
{
|
||||
if (ptr == nullptr) {
|
||||
if (ptr == NULL) {
|
||||
memoryManagerPrintError("free: free of a null ptr, %s %d\n", file, line);
|
||||
exit(1);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ void internal_free_safe(void* ptr, const char* file, int line)
|
|||
void* internal_calloc_safe(int count, int size, const char* file, int line)
|
||||
{
|
||||
void* ptr = gMemoryManagerMallocProc(count * size);
|
||||
if (ptr == nullptr) {
|
||||
if (ptr == NULL) {
|
||||
memoryManagerFatalAllocationError("calloc", size, file, line);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ char* strdup_safe(const char* string, const char* file, int line)
|
|||
{
|
||||
size_t size = strlen(string) + 1;
|
||||
char* copy = (char*)gMemoryManagerMallocProc(size);
|
||||
if (copy == nullptr) {
|
||||
if (copy == NULL) {
|
||||
memoryManagerFatalAllocationError("strdup", size, file, line);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,13 +54,13 @@ static char _Error_1[] = "Error";
|
|||
static const char* gBadwordsReplacements = "!@#$%&*@#*!&$%#&%#*%!$&%@*$@&";
|
||||
|
||||
// 0x519598
|
||||
static char** gBadwords = nullptr;
|
||||
static char** gBadwords = NULL;
|
||||
|
||||
// 0x51959C
|
||||
static int gBadwordsCount = 0;
|
||||
|
||||
// 0x5195A0
|
||||
static int* gBadwordsLengths = nullptr;
|
||||
static int* gBadwordsLengths = NULL;
|
||||
|
||||
// Default text for getmsg when no entry is found.
|
||||
//
|
||||
|
@ -78,7 +78,7 @@ static MessageListRepositoryState* _messageListRepositoryState;
|
|||
int badwordsInit()
|
||||
{
|
||||
File* stream = fileOpen("data\\badwords.txt", "rt");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -90,13 +90,13 @@ int badwordsInit()
|
|||
}
|
||||
|
||||
gBadwords = (char**)internal_malloc(sizeof(*gBadwords) * gBadwordsCount);
|
||||
if (gBadwords == nullptr) {
|
||||
if (gBadwords == NULL) {
|
||||
fileClose(stream);
|
||||
return -1;
|
||||
}
|
||||
|
||||
gBadwordsLengths = (int*)internal_malloc(sizeof(*gBadwordsLengths) * gBadwordsCount);
|
||||
if (gBadwordsLengths == nullptr) {
|
||||
if (gBadwordsLengths == NULL) {
|
||||
internal_free(gBadwords);
|
||||
fileClose(stream);
|
||||
return -1;
|
||||
|
@ -117,7 +117,7 @@ int badwordsInit()
|
|||
}
|
||||
|
||||
gBadwords[index] = internal_strdup(word);
|
||||
if (gBadwords[index] == nullptr) {
|
||||
if (gBadwords[index] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -161,9 +161,9 @@ void badwordsExit()
|
|||
// 0x48494C
|
||||
bool messageListInit(MessageList* messageList)
|
||||
{
|
||||
if (messageList != nullptr) {
|
||||
if (messageList != NULL) {
|
||||
messageList->entries_num = 0;
|
||||
messageList->entries = nullptr;
|
||||
messageList->entries = NULL;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -174,27 +174,27 @@ bool messageListFree(MessageList* messageList)
|
|||
int i;
|
||||
MessageListItem* entry;
|
||||
|
||||
if (messageList == nullptr) {
|
||||
if (messageList == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < messageList->entries_num; i++) {
|
||||
entry = &(messageList->entries[i]);
|
||||
|
||||
if (entry->audio != nullptr) {
|
||||
if (entry->audio != NULL) {
|
||||
internal_free(entry->audio);
|
||||
}
|
||||
|
||||
if (entry->text != nullptr) {
|
||||
if (entry->text != NULL) {
|
||||
internal_free(entry->text);
|
||||
}
|
||||
}
|
||||
|
||||
messageList->entries_num = 0;
|
||||
|
||||
if (messageList->entries != nullptr) {
|
||||
if (messageList->entries != NULL) {
|
||||
internal_free(messageList->entries);
|
||||
messageList->entries = nullptr;
|
||||
messageList->entries = NULL;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -215,11 +215,11 @@ bool messageListLoad(MessageList* messageList, const char* path)
|
|||
|
||||
success = false;
|
||||
|
||||
if (messageList == nullptr) {
|
||||
if (messageList == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (path == nullptr) {
|
||||
if (path == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -228,14 +228,14 @@ bool messageListLoad(MessageList* messageList, const char* path)
|
|||
file_ptr = fileOpen(localized_path, "rt");
|
||||
|
||||
// SFALL: Fallback to english if requested localization does not exist.
|
||||
if (file_ptr == nullptr) {
|
||||
if (file_ptr == NULL) {
|
||||
if (compat_stricmp(settings.system.language.c_str(), ENGLISH) != 0) {
|
||||
snprintf(localized_path, sizeof(localized_path), "%s\\%s\\%s", "text", ENGLISH, path);
|
||||
file_ptr = fileOpen(localized_path, "rt");
|
||||
}
|
||||
}
|
||||
|
||||
if (file_ptr == nullptr) {
|
||||
if (file_ptr == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -291,11 +291,11 @@ bool messageListGetItem(MessageList* msg, MessageListItem* entry)
|
|||
int index;
|
||||
MessageListItem* ptr;
|
||||
|
||||
if (msg == nullptr) {
|
||||
if (msg == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entry == nullptr) {
|
||||
if (entry == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -320,11 +320,11 @@ bool messageListGetItem(MessageList* msg, MessageListItem* entry)
|
|||
// 0x484CB8
|
||||
bool _message_make_path(char* dest, size_t size, const char* path)
|
||||
{
|
||||
if (dest == nullptr) {
|
||||
if (dest == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (path == nullptr) {
|
||||
if (path == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -381,17 +381,17 @@ static bool _message_add(MessageList* msg, MessageListItem* new_entry)
|
|||
if (_message_find(msg, new_entry->num, &index)) {
|
||||
existing_entry = &(msg->entries[index]);
|
||||
|
||||
if (existing_entry->audio != nullptr) {
|
||||
if (existing_entry->audio != NULL) {
|
||||
internal_free(existing_entry->audio);
|
||||
}
|
||||
|
||||
if (existing_entry->text != nullptr) {
|
||||
if (existing_entry->text != NULL) {
|
||||
internal_free(existing_entry->text);
|
||||
}
|
||||
} else {
|
||||
if (msg->entries != nullptr) {
|
||||
if (msg->entries != NULL) {
|
||||
entries = (MessageListItem*)internal_realloc(msg->entries, sizeof(MessageListItem) * (msg->entries_num + 1));
|
||||
if (entries == nullptr) {
|
||||
if (entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ static bool _message_add(MessageList* msg, MessageListItem* new_entry)
|
|||
}
|
||||
} else {
|
||||
msg->entries = (MessageListItem*)internal_malloc(sizeof(MessageListItem));
|
||||
if (msg->entries == nullptr) {
|
||||
if (msg->entries == NULL) {
|
||||
return false;
|
||||
}
|
||||
msg->entries_num = 0;
|
||||
|
@ -412,18 +412,18 @@ static bool _message_add(MessageList* msg, MessageListItem* new_entry)
|
|||
|
||||
existing_entry = &(msg->entries[index]);
|
||||
existing_entry->flags = 0;
|
||||
existing_entry->audio = nullptr;
|
||||
existing_entry->text = nullptr;
|
||||
existing_entry->audio = 0;
|
||||
existing_entry->text = 0;
|
||||
msg->entries_num++;
|
||||
}
|
||||
|
||||
existing_entry->audio = internal_strdup(new_entry->audio);
|
||||
if (existing_entry->audio == nullptr) {
|
||||
if (existing_entry->audio == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
existing_entry->text = internal_strdup(new_entry->text);
|
||||
if (existing_entry->text == nullptr) {
|
||||
if (existing_entry->text == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -537,7 +537,7 @@ char* getmsg(MessageList* msg, MessageListItem* entry, int num)
|
|||
// 0x485078
|
||||
bool messageListFilterBadwords(MessageList* messageList)
|
||||
{
|
||||
if (messageList == nullptr) {
|
||||
if (messageList == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -567,7 +567,7 @@ bool messageListFilterBadwords(MessageList* messageList)
|
|||
// already masked words on every iteration.
|
||||
for (char* p = _bad_copy;; p++) {
|
||||
const char* substr = strstr(p, gBadwords[badwordIndex]);
|
||||
if (substr == nullptr) {
|
||||
if (substr == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -591,7 +591,7 @@ bool messageListFilterBadwords(MessageList* messageList)
|
|||
|
||||
void messageListFilterGenderWords(MessageList* messageList, int gender)
|
||||
{
|
||||
if (messageList == nullptr) {
|
||||
if (messageList == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -606,13 +606,13 @@ void messageListFilterGenderWords(MessageList* messageList, int gender)
|
|||
char* text = item->text;
|
||||
char* sep;
|
||||
|
||||
while ((sep = strchr(text, '^')) != nullptr) {
|
||||
while ((sep = strchr(text, '^')) != NULL) {
|
||||
*sep = '\0';
|
||||
char* start = strrchr(text, '<');
|
||||
char* end = strchr(sep + 1, '>');
|
||||
*sep = '^';
|
||||
|
||||
if (start != nullptr && end != nullptr) {
|
||||
if (start != NULL && end != NULL) {
|
||||
char* src;
|
||||
size_t length;
|
||||
if (gender == GENDER_FEMALE) {
|
||||
|
|
28
src/mouse.cc
28
src/mouse.cc
|
@ -43,13 +43,13 @@ static unsigned char gMouseDefaultCursor[MOUSE_DEFAULT_CURSOR_SIZE] = {
|
|||
static int _mouse_idling = 0;
|
||||
|
||||
// 0x51E294
|
||||
static unsigned char* gMouseCursorData = nullptr;
|
||||
static unsigned char* gMouseCursorData = NULL;
|
||||
|
||||
// 0x51E298
|
||||
static unsigned char* _mouse_shape = nullptr;
|
||||
static unsigned char* _mouse_shape = NULL;
|
||||
|
||||
// 0x51E29C
|
||||
static unsigned char* _mouse_fptr = nullptr;
|
||||
static unsigned char* _mouse_fptr = NULL;
|
||||
|
||||
// 0x51E2A0
|
||||
static double gMouseSensitivity = 1.0;
|
||||
|
@ -133,7 +133,7 @@ int mouseInit()
|
|||
|
||||
mousePrepareDefaultCursor();
|
||||
|
||||
if (mouseSetFrame(nullptr, 0, 0, 0, 0, 0, 0) == -1) {
|
||||
if (mouseSetFrame(NULL, 0, 0, 0, 0, 0, 0) == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -156,14 +156,14 @@ void mouseFree()
|
|||
{
|
||||
mouseDeviceUnacquire();
|
||||
|
||||
if (gMouseCursorData != nullptr) {
|
||||
if (gMouseCursorData != NULL) {
|
||||
internal_free(gMouseCursorData);
|
||||
gMouseCursorData = nullptr;
|
||||
gMouseCursorData = NULL;
|
||||
}
|
||||
|
||||
if (_mouse_fptr != nullptr) {
|
||||
if (_mouse_fptr != NULL) {
|
||||
tickersRemove(_mouse_anim);
|
||||
_mouse_fptr = nullptr;
|
||||
_mouse_fptr = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -197,7 +197,7 @@ int mouseSetFrame(unsigned char* a1, int width, int height, int pitch, int a5, i
|
|||
v8 = a6;
|
||||
v9 = a1;
|
||||
|
||||
if (a1 == nullptr) {
|
||||
if (a1 == NULL) {
|
||||
// NOTE: Original code looks tail recursion optimization.
|
||||
return mouseSetFrame(gMouseDefaultCursor, MOUSE_DEFAULT_CURSOR_WIDTH, MOUSE_DEFAULT_CURSOR_HEIGHT, MOUSE_DEFAULT_CURSOR_WIDTH, 1, 1, _colorTable[0]);
|
||||
}
|
||||
|
@ -211,14 +211,14 @@ int mouseSetFrame(unsigned char* a1, int width, int height, int pitch, int a5, i
|
|||
|
||||
if (width != gMouseCursorWidth || height != gMouseCursorHeight) {
|
||||
unsigned char* buf = (unsigned char*)internal_malloc(width * height);
|
||||
if (buf == nullptr) {
|
||||
if (buf == NULL) {
|
||||
if (!cursorWasHidden) {
|
||||
mouseShowCursor();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gMouseCursorData != nullptr) {
|
||||
if (gMouseCursorData != NULL) {
|
||||
internal_free(gMouseCursorData);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ int mouseSetFrame(unsigned char* a1, int width, int height, int pitch, int a5, i
|
|||
|
||||
if (_mouse_fptr) {
|
||||
tickersRemove(_mouse_anim);
|
||||
_mouse_fptr = nullptr;
|
||||
_mouse_fptr = NULL;
|
||||
}
|
||||
|
||||
v11 = _mouse_hotx - v7;
|
||||
|
@ -710,7 +710,7 @@ void mouseGetPositionInWindow(int win, int* x, int* y)
|
|||
mouseGetPosition(x, y);
|
||||
|
||||
Window* window = windowGetWindow(win);
|
||||
if (window != nullptr) {
|
||||
if (window != NULL) {
|
||||
*x -= window->rect.left;
|
||||
*y -= window->rect.top;
|
||||
}
|
||||
|
@ -719,7 +719,7 @@ void mouseGetPositionInWindow(int win, int* x, int* y)
|
|||
bool mouseHitTestInWindow(int win, int left, int top, int right, int bottom)
|
||||
{
|
||||
Window* window = windowGetWindow(win);
|
||||
if (window != nullptr) {
|
||||
if (window != NULL) {
|
||||
left += window->rect.left;
|
||||
top += window->rect.top;
|
||||
right += window->rect.left;
|
||||
|
|
|
@ -72,18 +72,18 @@ void mouseManagerFreeCacheEntry(MouseManagerCacheEntry* entry)
|
|||
{
|
||||
switch (entry->type) {
|
||||
case MOUSE_MANAGER_MOUSE_TYPE_STATIC:
|
||||
if (entry->staticData != nullptr) {
|
||||
if (entry->staticData->data != nullptr) {
|
||||
if (entry->staticData != NULL) {
|
||||
if (entry->staticData->data != NULL) {
|
||||
internal_free_safe(entry->staticData->data, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 120
|
||||
entry->staticData->data = nullptr;
|
||||
entry->staticData->data = NULL;
|
||||
}
|
||||
internal_free_safe(entry->staticData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 123
|
||||
entry->staticData = nullptr;
|
||||
entry->staticData = NULL;
|
||||
}
|
||||
break;
|
||||
case MOUSE_MANAGER_MOUSE_TYPE_ANIMATED:
|
||||
if (entry->animatedData != nullptr) {
|
||||
if (entry->animatedData->field_0 != nullptr) {
|
||||
if (entry->animatedData != NULL) {
|
||||
if (entry->animatedData->field_0 != NULL) {
|
||||
for (int index = 0; index < entry->animatedData->frameCount; index++) {
|
||||
internal_free_safe(entry->animatedData->field_0[index], __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 134
|
||||
internal_free_safe(entry->animatedData->field_4[index], __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 135
|
||||
|
@ -94,7 +94,7 @@ void mouseManagerFreeCacheEntry(MouseManagerCacheEntry* entry)
|
|||
internal_free_safe(entry->animatedData->field_C, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 140
|
||||
}
|
||||
internal_free_safe(entry->animatedData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 143
|
||||
entry->animatedData = nullptr;
|
||||
entry->animatedData = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ MouseManagerCacheEntry* mouseManagerFindCacheEntry(const char* fileName, unsigne
|
|||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 0x48568C
|
||||
|
@ -208,18 +208,18 @@ void mouseManagerInit()
|
|||
// 0x48569C
|
||||
void mouseManagerExit()
|
||||
{
|
||||
mouseSetFrame(nullptr, 0, 0, 0, 0, 0, 0);
|
||||
mouseSetFrame(NULL, 0, 0, 0, 0, 0, 0);
|
||||
|
||||
if (gMouseManagerCurrentStaticData != nullptr) {
|
||||
if (gMouseManagerCurrentStaticData != NULL) {
|
||||
internal_free_safe(gMouseManagerCurrentStaticData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 243
|
||||
gMouseManagerCurrentStaticData = nullptr;
|
||||
gMouseManagerCurrentStaticData = NULL;
|
||||
}
|
||||
|
||||
// NOTE: Uninline.
|
||||
mouseManagerFlushCache();
|
||||
|
||||
gMouseManagerCurrentPalette = nullptr;
|
||||
gMouseManagerCurrentAnimatedData = nullptr;
|
||||
gMouseManagerCurrentPalette = NULL;
|
||||
gMouseManagerCurrentAnimatedData = 0;
|
||||
}
|
||||
|
||||
// 0x485704
|
||||
|
@ -229,7 +229,7 @@ void mouseManagerUpdate()
|
|||
return;
|
||||
}
|
||||
|
||||
if (gMouseManagerCurrentAnimatedData == nullptr) {
|
||||
if (gMouseManagerCurrentAnimatedData == NULL) {
|
||||
debugPrint("Animating == 1 but curAnim == 0\n");
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ int mouseManagerSetFrame(char* fileName, int a2)
|
|||
int temp;
|
||||
int type;
|
||||
MouseManagerCacheEntry* cacheEntry = mouseManagerFindCacheEntry(fileName, &palette, &temp, &temp, &temp, &temp, &type);
|
||||
if (cacheEntry != nullptr) {
|
||||
if (cacheEntry != NULL) {
|
||||
if (type == MOUSE_MANAGER_MOUSE_TYPE_ANIMATED) {
|
||||
cacheEntry->animatedData->field_24 = a2;
|
||||
if (cacheEntry->animatedData->field_24 >= cacheEntry->animatedData->field_26) {
|
||||
|
@ -321,18 +321,18 @@ int mouseManagerSetFrame(char* fileName, int a2)
|
|||
}
|
||||
|
||||
if (gMouseManagerIsAnimating) {
|
||||
gMouseManagerCurrentPalette = nullptr;
|
||||
gMouseManagerCurrentPalette = 0;
|
||||
gMouseManagerIsAnimating = 0;
|
||||
gMouseManagerCurrentAnimatedData = nullptr;
|
||||
gMouseManagerCurrentAnimatedData = 0;
|
||||
} else {
|
||||
if (gMouseManagerCurrentStaticData != nullptr) {
|
||||
if (gMouseManagerCurrentStaticData != NULL) {
|
||||
internal_free_safe(gMouseManagerCurrentStaticData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 337
|
||||
gMouseManagerCurrentStaticData = nullptr;
|
||||
gMouseManagerCurrentStaticData = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
File* stream = fileOpen(mangledFileName, "r");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("mouseSetFrame: couldn't find %s\n", mangledFileName);
|
||||
return false;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ int mouseManagerSetFrame(char* fileName, int a2)
|
|||
|
||||
// NOTE: Uninline.
|
||||
char* sep = strchr(string, ' ');
|
||||
if (sep == nullptr) {
|
||||
if (sep == NULL) {
|
||||
// FIXME: Leaks stream.
|
||||
return false;
|
||||
}
|
||||
|
@ -384,7 +384,7 @@ int mouseManagerSetFrame(char* fileName, int a2)
|
|||
|
||||
// NOTE: Uninline.
|
||||
char* sep = strchr(string, ' ');
|
||||
if (sep == nullptr) {
|
||||
if (sep == NULL) {
|
||||
debugPrint("Bad line %s in %s\n", string, fileName);
|
||||
// FIXME: Leaking stream.
|
||||
return false;
|
||||
|
@ -438,7 +438,7 @@ bool mouseManagerSetMouseShape(char* fileName, int a2, int a3)
|
|||
MouseManagerCacheEntry* cacheEntry = mouseManagerFindCacheEntry(fileName, &palette, &temp, &temp, &width, &height, &type);
|
||||
char* mangledFileName = gMouseManagerNameMangler(fileName);
|
||||
|
||||
if (cacheEntry == nullptr) {
|
||||
if (cacheEntry == NULL) {
|
||||
MouseManagerStaticData* staticData;
|
||||
staticData = (MouseManagerStaticData*)internal_malloc_safe(sizeof(*staticData), __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 430
|
||||
staticData->data = datafileReadRaw(mangledFileName, &width, &height);
|
||||
|
@ -460,7 +460,7 @@ bool mouseManagerSetMouseShape(char* fileName, int a2, int a3)
|
|||
|
||||
switch (type) {
|
||||
case MOUSE_MANAGER_MOUSE_TYPE_STATIC:
|
||||
if (gMouseManagerCurrentStaticData != nullptr) {
|
||||
if (gMouseManagerCurrentStaticData != NULL) {
|
||||
internal_free_safe(gMouseManagerCurrentStaticData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 446
|
||||
}
|
||||
|
||||
|
@ -490,15 +490,15 @@ bool mouseManagerSetMousePointer(char* fileName)
|
|||
int height;
|
||||
int type;
|
||||
MouseManagerCacheEntry* cacheEntry = mouseManagerFindCacheEntry(fileName, &palette, &v1, &v2, &width, &height, &type);
|
||||
if (cacheEntry != nullptr) {
|
||||
if (gMouseManagerCurrentStaticData != nullptr) {
|
||||
if (cacheEntry != NULL) {
|
||||
if (gMouseManagerCurrentStaticData != NULL) {
|
||||
internal_free_safe(gMouseManagerCurrentStaticData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 482
|
||||
gMouseManagerCurrentStaticData = nullptr;
|
||||
gMouseManagerCurrentStaticData = NULL;
|
||||
}
|
||||
|
||||
gMouseManagerCurrentPalette = nullptr;
|
||||
gMouseManagerCurrentPalette = NULL;
|
||||
gMouseManagerIsAnimating = false;
|
||||
gMouseManagerCurrentAnimatedData = nullptr;
|
||||
gMouseManagerCurrentAnimatedData = 0;
|
||||
|
||||
switch (type) {
|
||||
case MOUSE_MANAGER_MOUSE_TYPE_STATIC:
|
||||
|
@ -527,13 +527,13 @@ bool mouseManagerSetMousePointer(char* fileName)
|
|||
}
|
||||
|
||||
char* dot = strrchr(fileName, '.');
|
||||
if (dot != nullptr && compat_stricmp(dot + 1, "mou") == 0) {
|
||||
if (dot != NULL && compat_stricmp(dot + 1, "mou") == 0) {
|
||||
return mouseManagerSetMouseShape(fileName, 0, 0);
|
||||
}
|
||||
|
||||
char* mangledFileName = gMouseManagerNameMangler(fileName);
|
||||
File* stream = fileOpen(mangledFileName, "r");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("Can't find %s\n", mangledFileName);
|
||||
return false;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ bool mouseManagerSetMousePointer(char* fileName)
|
|||
} else {
|
||||
// NOTE: Uninline.
|
||||
char* sep = strchr(string, ' ');
|
||||
if (sep != nullptr) {
|
||||
if (sep != NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -592,8 +592,8 @@ void mouseManagerResetMouse()
|
|||
|
||||
switch (entry->type) {
|
||||
case MOUSE_MANAGER_MOUSE_TYPE_STATIC:
|
||||
if (gMouseManagerCurrentStaticData != nullptr) {
|
||||
if (gMouseManagerCurrentStaticData != nullptr) {
|
||||
if (gMouseManagerCurrentStaticData != NULL) {
|
||||
if (gMouseManagerCurrentStaticData != NULL) {
|
||||
internal_free_safe(gMouseManagerCurrentStaticData, __FILE__, __LINE__); // "..\\int\\MOUSEMGR.C", 572
|
||||
}
|
||||
|
||||
|
@ -613,7 +613,7 @@ void mouseManagerResetMouse()
|
|||
}
|
||||
break;
|
||||
case MOUSE_MANAGER_MOUSE_TYPE_ANIMATED:
|
||||
if (gMouseManagerCurrentAnimatedData != nullptr) {
|
||||
if (gMouseManagerCurrentAnimatedData != NULL) {
|
||||
for (int index = 0; index < gMouseManagerCurrentAnimatedData->frameCount; index++) {
|
||||
memcpy(gMouseManagerCurrentAnimatedData->field_0[index], gMouseManagerCurrentAnimatedData->field_4[index], imageWidth * imageHeight);
|
||||
sub_42EE84(gMouseManagerCurrentAnimatedData->field_0[index], entry->palette, imageWidth, imageHeight);
|
||||
|
|
88
src/movie.cc
88
src/movie.cc
|
@ -204,7 +204,7 @@ static File* _alphaHandle;
|
|||
// 0x638EC0
|
||||
static unsigned char* _alphaBuf;
|
||||
|
||||
static SDL_Surface* gMovieSdlSurface = nullptr;
|
||||
static SDL_Surface* gMovieSdlSurface = NULL;
|
||||
static int gMovieFileStreamPointerKey = 0;
|
||||
|
||||
// NOTE: Unused.
|
||||
|
@ -307,7 +307,7 @@ static void movieDirectImpl(SDL_Surface* surface, int srcWidth, int srcHeight, i
|
|||
destRect.x += gMovieWindowRect.left;
|
||||
destRect.y += gMovieWindowRect.top;
|
||||
|
||||
if (_movieCaptureFrameFunc != nullptr) {
|
||||
if (_movieCaptureFrameFunc != NULL) {
|
||||
if (SDL_LockSurface(surface) == 0) {
|
||||
_movieCaptureFrameFunc(static_cast<unsigned char*>(surface->pixels),
|
||||
srcWidth,
|
||||
|
@ -326,7 +326,7 @@ static void movieDirectImpl(SDL_Surface* surface, int srcWidth, int srcHeight, i
|
|||
// backbuffer surface (with palette set), all we get is shiny white box.
|
||||
SDL_SetSurfacePalette(surface, gSdlSurface->format->palette);
|
||||
SDL_BlitSurface(surface, &srcRect, gSdlSurface, &destRect);
|
||||
SDL_BlitSurface(gSdlSurface, nullptr, gSdlTextureSurface, nullptr);
|
||||
SDL_BlitSurface(gSdlSurface, NULL, gSdlTextureSurface, NULL);
|
||||
renderPresent();
|
||||
}
|
||||
|
||||
|
@ -351,16 +351,16 @@ static void movieBufferedImpl(SDL_Surface* a1, int a2, int a3, int a4, int a5, i
|
|||
return;
|
||||
}
|
||||
|
||||
if (_movieCaptureFrameFunc != nullptr) {
|
||||
if (_movieCaptureFrameFunc != NULL) {
|
||||
_movieCaptureFrameFunc(static_cast<unsigned char*>(a1->pixels), a2, a3, a1->pitch, _movieRect.left, _movieRect.top, a6, a7);
|
||||
}
|
||||
|
||||
if (_movieFrameGrabFunc != nullptr) {
|
||||
if (_movieFrameGrabFunc != NULL) {
|
||||
_movieFrameGrabFunc(static_cast<unsigned char*>(a1->pixels), a2, a3, a1->pitch);
|
||||
} else {
|
||||
MovieBlitFunc* func = gMovieBlitFuncs[_movieAlphaFlag][_movieScaleFlag][_movieSubRectFlag];
|
||||
if (func(gMovieWindow, static_cast<unsigned char*>(a1->pixels), a2, a3, a1->pitch) != 0) {
|
||||
if (_moviePreDrawFunc != nullptr) {
|
||||
if (_moviePreDrawFunc != NULL) {
|
||||
_moviePreDrawFunc(gMovieWindow, &_movieRect);
|
||||
}
|
||||
|
||||
|
@ -515,7 +515,7 @@ static void _cleanupMovie(int a1)
|
|||
return;
|
||||
}
|
||||
|
||||
if (_endMovieFunc != nullptr) {
|
||||
if (_endMovieFunc != NULL) {
|
||||
_endMovieFunc(gMovieWindow, _movieX, _movieY, _movieW, _movieH);
|
||||
}
|
||||
|
||||
|
@ -524,12 +524,12 @@ static void _cleanupMovie(int a1)
|
|||
_MVE_rmFrameCounts(&frame, &dropped);
|
||||
debugPrint("Frames %d, dropped %d\n", frame, dropped);
|
||||
|
||||
if (_lastMovieBuffer != nullptr) {
|
||||
if (_lastMovieBuffer != NULL) {
|
||||
internal_free_safe(_lastMovieBuffer, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 787
|
||||
_lastMovieBuffer = nullptr;
|
||||
_lastMovieBuffer = NULL;
|
||||
}
|
||||
|
||||
if (gMovieSdlSurface != nullptr) {
|
||||
if (gMovieSdlSurface != NULL) {
|
||||
if (SDL_LockSurface(gMovieSdlSurface) == 0) {
|
||||
_lastMovieBuffer = (unsigned char*)internal_malloc_safe(_lastMovieBH * _lastMovieBW, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 802
|
||||
blitBufferToBuffer((unsigned char*)gMovieSdlSurface->pixels + gMovieSdlSurface->pitch * _lastMovieSX + _lastMovieSY, _lastMovieBW, _lastMovieBH, gMovieSdlSurface->pitch, _lastMovieBuffer, _lastMovieBW);
|
||||
|
@ -538,7 +538,7 @@ static void _cleanupMovie(int a1)
|
|||
debugPrint("Couldn't lock movie surface\n");
|
||||
}
|
||||
|
||||
gMovieSdlSurface = nullptr;
|
||||
gMovieSdlSurface = NULL;
|
||||
}
|
||||
|
||||
if (a1) {
|
||||
|
@ -549,27 +549,27 @@ static void _cleanupMovie(int a1)
|
|||
|
||||
fileClose(gMovieFileStream);
|
||||
|
||||
if (_alphaWindowBuf != nullptr) {
|
||||
if (_alphaWindowBuf != NULL) {
|
||||
blitBufferToBuffer(_alphaWindowBuf, _movieW, _movieH, _movieW, windowGetBuffer(gMovieWindow) + _movieY * windowGetWidth(gMovieWindow) + _movieX, windowGetWidth(gMovieWindow));
|
||||
windowRefreshRect(gMovieWindow, &_movieRect);
|
||||
}
|
||||
|
||||
if (_alphaHandle != nullptr) {
|
||||
if (_alphaHandle != NULL) {
|
||||
fileClose(_alphaHandle);
|
||||
_alphaHandle = nullptr;
|
||||
_alphaHandle = NULL;
|
||||
}
|
||||
|
||||
if (_alphaBuf != nullptr) {
|
||||
if (_alphaBuf != NULL) {
|
||||
internal_free_safe(_alphaBuf, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 840
|
||||
_alphaBuf = nullptr;
|
||||
_alphaBuf = NULL;
|
||||
}
|
||||
|
||||
if (_alphaWindowBuf != nullptr) {
|
||||
if (_alphaWindowBuf != NULL) {
|
||||
internal_free_safe(_alphaWindowBuf, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 845
|
||||
_alphaWindowBuf = nullptr;
|
||||
_alphaWindowBuf = NULL;
|
||||
}
|
||||
|
||||
while (gMovieSubtitleHead != nullptr) {
|
||||
while (gMovieSubtitleHead != NULL) {
|
||||
MovieSubtitleListNode* next = gMovieSubtitleHead->next;
|
||||
internal_free_safe(gMovieSubtitleHead->text, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 851
|
||||
internal_free_safe(gMovieSubtitleHead, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 852
|
||||
|
@ -591,7 +591,7 @@ void movieExit()
|
|||
|
||||
if (_lastMovieBuffer) {
|
||||
internal_free_safe(_lastMovieBuffer, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 869
|
||||
_lastMovieBuffer = nullptr;
|
||||
_lastMovieBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -645,7 +645,7 @@ int movieSetFlags(int flags)
|
|||
// 0x48725C
|
||||
void _movieSetPaletteFunc(MovieSetPaletteEntriesProc* proc)
|
||||
{
|
||||
gMovieSetPaletteEntriesProc = proc != nullptr ? proc : _setSystemPaletteEntries;
|
||||
gMovieSetPaletteEntriesProc = proc != NULL ? proc : _setSystemPaletteEntries;
|
||||
}
|
||||
|
||||
// 0x487274
|
||||
|
@ -657,25 +657,25 @@ void movieSetPaletteProc(MovieSetPaletteProc* proc)
|
|||
// 0x4872E8
|
||||
static void _cleanupLast()
|
||||
{
|
||||
if (_lastMovieBuffer != nullptr) {
|
||||
if (_lastMovieBuffer != NULL) {
|
||||
internal_free_safe(_lastMovieBuffer, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 981
|
||||
_lastMovieBuffer = nullptr;
|
||||
_lastMovieBuffer = NULL;
|
||||
}
|
||||
|
||||
gMovieSdlSurface = nullptr;
|
||||
gMovieSdlSurface = NULL;
|
||||
}
|
||||
|
||||
// 0x48731C
|
||||
static File* movieOpen(char* filePath)
|
||||
{
|
||||
gMovieFileStream = fileOpen(filePath, "rb");
|
||||
if (gMovieFileStream == nullptr) {
|
||||
if (_failedOpenFunc == nullptr) {
|
||||
if (gMovieFileStream == NULL) {
|
||||
if (_failedOpenFunc == NULL) {
|
||||
debugPrint("Couldn't find movie file %s\n", filePath);
|
||||
return nullptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (gMovieFileStream == nullptr && _failedOpenFunc(filePath) != 0) {
|
||||
while (gMovieFileStream == NULL && _failedOpenFunc(filePath) != 0) {
|
||||
gMovieFileStream = fileOpen(filePath, "rb");
|
||||
}
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ static void movieLoadSubtitles(char* filePath)
|
|||
_subtitleW = windowGetWidth(gMovieWindow);
|
||||
_subtitleH = fontGetLineHeight() + 4;
|
||||
|
||||
if (gMovieBuildSubtitleFilePathProc != nullptr) {
|
||||
if (gMovieBuildSubtitleFilePathProc != NULL) {
|
||||
filePath = gMovieBuildSubtitleFilePathProc(filePath);
|
||||
}
|
||||
|
||||
|
@ -697,13 +697,13 @@ static void movieLoadSubtitles(char* filePath)
|
|||
|
||||
debugPrint("Opening subtitle file %s\n", path);
|
||||
File* stream = fileOpen(path, "r");
|
||||
if (stream == nullptr) {
|
||||
if (stream == NULL) {
|
||||
debugPrint("Couldn't open subtitle file %s\n", path);
|
||||
gMovieFlags &= ~MOVIE_EXTENDED_FLAG_0x10;
|
||||
return;
|
||||
}
|
||||
|
||||
MovieSubtitleListNode* prev = nullptr;
|
||||
MovieSubtitleListNode* prev = NULL;
|
||||
int subtitleCount = 0;
|
||||
while (!fileEof(stream)) {
|
||||
char string[260];
|
||||
|
@ -714,29 +714,29 @@ static void movieLoadSubtitles(char* filePath)
|
|||
}
|
||||
|
||||
MovieSubtitleListNode* subtitle = (MovieSubtitleListNode*)internal_malloc_safe(sizeof(*subtitle), __FILE__, __LINE__); // "..\\int\\MOVIE.C", 1050
|
||||
subtitle->next = nullptr;
|
||||
subtitle->next = NULL;
|
||||
|
||||
subtitleCount++;
|
||||
|
||||
char* pch;
|
||||
|
||||
pch = strchr(string, '\n');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
pch = strchr(string, '\r');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
pch = strchr(string, ':');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
subtitle->num = atoi(string);
|
||||
subtitle->text = strdup_safe(pch + 1, __FILE__, __LINE__); // "..\\int\\MOVIE.C", 1058
|
||||
|
||||
if (prev != nullptr) {
|
||||
if (prev != NULL) {
|
||||
prev->next = subtitle;
|
||||
} else {
|
||||
gMovieSubtitleHead = subtitle;
|
||||
|
@ -756,7 +756,7 @@ static void movieLoadSubtitles(char* filePath)
|
|||
// 0x48755C
|
||||
static void movieRenderSubtitles()
|
||||
{
|
||||
if (gMovieSubtitleHead == nullptr) {
|
||||
if (gMovieSubtitleHead == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -775,7 +775,7 @@ static void movieRenderSubtitles()
|
|||
int dropped;
|
||||
_MVE_rmFrameCounts(&frame, &dropped);
|
||||
|
||||
while (gMovieSubtitleHead != nullptr) {
|
||||
while (gMovieSubtitleHead != NULL) {
|
||||
if (frame < gMovieSubtitleHead->num) {
|
||||
break;
|
||||
}
|
||||
|
@ -825,7 +825,7 @@ static int _movieStart(int win, char* filePath, int (*a3)())
|
|||
_cleanupLast();
|
||||
|
||||
gMovieFileStream = movieOpen(filePath);
|
||||
if (gMovieFileStream == nullptr) {
|
||||
if (gMovieFileStream == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -866,11 +866,11 @@ static int _movieStart(int win, char* filePath, int (*a3)())
|
|||
debugPrint("not scaled\n");
|
||||
}
|
||||
|
||||
if (_startMovieFunc != nullptr) {
|
||||
if (_startMovieFunc != NULL) {
|
||||
_startMovieFunc(gMovieWindow);
|
||||
}
|
||||
|
||||
if (_alphaHandle != nullptr) {
|
||||
if (_alphaHandle != NULL) {
|
||||
int size;
|
||||
fileReadInt32(_alphaHandle, &size);
|
||||
|
||||
|
@ -903,7 +903,7 @@ static bool _localMovieCallback()
|
|||
{
|
||||
movieRenderSubtitles();
|
||||
|
||||
if (_movieCallback != nullptr) {
|
||||
if (_movieCallback != NULL) {
|
||||
_movieCallback();
|
||||
}
|
||||
|
||||
|
@ -946,7 +946,7 @@ int _movieRunRect(int win, char* filePath, int a3, int a4, int a5, int a6)
|
|||
// 0x487B7C
|
||||
static int _stepMovie()
|
||||
{
|
||||
if (_alphaHandle != nullptr) {
|
||||
if (_alphaHandle != NULL) {
|
||||
int size;
|
||||
fileReadInt32(_alphaHandle, &size);
|
||||
fileRead(_alphaBuf, 1, size, _alphaHandle);
|
||||
|
@ -997,7 +997,7 @@ void _movieUpdate()
|
|||
return;
|
||||
}
|
||||
|
||||
if (gMoviePaletteProc != nullptr) {
|
||||
if (gMoviePaletteProc != NULL) {
|
||||
int frame;
|
||||
int dropped;
|
||||
_MVE_rmFrameCounts(&frame, &dropped);
|
||||
|
|
|
@ -41,7 +41,7 @@ static void movieEffectsClear();
|
|||
static bool gMovieEffectsInitialized = false;
|
||||
|
||||
// 0x5195F4
|
||||
static MovieEffect* gMovieEffectHead = nullptr;
|
||||
static MovieEffect* gMovieEffectHead = NULL;
|
||||
|
||||
// 0x638EC4
|
||||
static unsigned char _source_palette[768];
|
||||
|
@ -70,8 +70,8 @@ void movieEffectsReset()
|
|||
return;
|
||||
}
|
||||
|
||||
movieSetPaletteProc(nullptr);
|
||||
_movieSetPaletteFunc(nullptr);
|
||||
movieSetPaletteProc(NULL);
|
||||
_movieSetPaletteFunc(NULL);
|
||||
movieEffectsClear();
|
||||
|
||||
_inside_fade = false;
|
||||
|
@ -86,8 +86,8 @@ void movieEffectsExit()
|
|||
return;
|
||||
}
|
||||
|
||||
movieSetPaletteProc(nullptr);
|
||||
_movieSetPaletteFunc(nullptr);
|
||||
movieSetPaletteProc(NULL);
|
||||
_movieSetPaletteFunc(NULL);
|
||||
movieEffectsClear();
|
||||
|
||||
_inside_fade = false;
|
||||
|
@ -102,13 +102,13 @@ int movieEffectsLoad(const char* filePath)
|
|||
return -1;
|
||||
}
|
||||
|
||||
movieSetPaletteProc(nullptr);
|
||||
_movieSetPaletteFunc(nullptr);
|
||||
movieSetPaletteProc(NULL);
|
||||
_movieSetPaletteFunc(NULL);
|
||||
movieEffectsClear();
|
||||
_inside_fade = false;
|
||||
memset(_source_palette, 0, sizeof(_source_palette));
|
||||
|
||||
if (filePath == nullptr) {
|
||||
if (filePath == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ int movieEffectsLoad(const char* filePath)
|
|||
strcpy(path, filePath);
|
||||
|
||||
char* pch = strrchr(path, '.');
|
||||
if (pch != nullptr) {
|
||||
if (pch != NULL) {
|
||||
*pch = '\0';
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ int movieEffectsLoad(const char* filePath)
|
|||
}
|
||||
|
||||
movieEffectFrameList = (int*)internal_malloc(sizeof(*movieEffectFrameList) * movieEffectsLength);
|
||||
if (movieEffectFrameList == nullptr) {
|
||||
if (movieEffectFrameList == NULL) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ int movieEffectsLoad(const char* filePath)
|
|||
}
|
||||
|
||||
MovieEffect* movieEffect = (MovieEffect*)internal_malloc(sizeof(*movieEffect));
|
||||
if (movieEffect == nullptr) {
|
||||
if (movieEffect == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -231,8 +231,8 @@ void _moviefx_stop()
|
|||
return;
|
||||
}
|
||||
|
||||
movieSetPaletteProc(nullptr);
|
||||
_movieSetPaletteFunc(nullptr);
|
||||
movieSetPaletteProc(NULL);
|
||||
_movieSetPaletteFunc(NULL);
|
||||
|
||||
movieEffectsClear();
|
||||
|
||||
|
@ -244,14 +244,14 @@ void _moviefx_stop()
|
|||
static void _moviefx_callback_func(int frame)
|
||||
{
|
||||
MovieEffect* movieEffect = gMovieEffectHead;
|
||||
while (movieEffect != nullptr) {
|
||||
while (movieEffect != NULL) {
|
||||
if (frame >= movieEffect->startFrame && frame <= movieEffect->endFrame) {
|
||||
break;
|
||||
}
|
||||
movieEffect = movieEffect->next;
|
||||
}
|
||||
|
||||
if (movieEffect != nullptr) {
|
||||
if (movieEffect != NULL) {
|
||||
unsigned char palette[768];
|
||||
int step = frame - movieEffect->startFrame + 1;
|
||||
|
||||
|
@ -272,7 +272,7 @@ static void _moviefx_callback_func(int frame)
|
|||
paletteSetEntries(palette);
|
||||
}
|
||||
|
||||
_inside_fade = movieEffect != nullptr;
|
||||
_inside_fade = movieEffect != NULL;
|
||||
}
|
||||
|
||||
// 0x4882AC
|
||||
|
@ -289,13 +289,13 @@ static void _moviefx_palette_func(unsigned char* palette, int start, int end)
|
|||
static void movieEffectsClear()
|
||||
{
|
||||
MovieEffect* movieEffect = gMovieEffectHead;
|
||||
while (movieEffect != nullptr) {
|
||||
while (movieEffect != NULL) {
|
||||
MovieEffect* next = movieEffect->next;
|
||||
internal_free(movieEffect);
|
||||
movieEffect = next;
|
||||
}
|
||||
|
||||
gMovieEffectHead = nullptr;
|
||||
gMovieEffectHead = NULL;
|
||||
}
|
||||
|
||||
} // namespace fallout
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "audio_engine.h"
|
||||
#include "delay.h"
|
||||
#include "platform_compat.h"
|
||||
|
||||
namespace fallout {
|
||||
|
@ -165,7 +164,7 @@ static int dword_51EE0C = 1;
|
|||
// TODO: There is a default function (not yet implemented).
|
||||
//
|
||||
// 0x51EE14
|
||||
static void (*_pal_SetPalette)(unsigned char*, int, int) = nullptr;
|
||||
static void (*_pal_SetPalette)(unsigned char*, int, int) = NULL;
|
||||
|
||||
// 0x51EE18
|
||||
static int _rm_hold = 0;
|
||||
|
@ -528,7 +527,7 @@ void movieLibSetReadProc(MovieReadProc* readProc)
|
|||
// 0x4F4890
|
||||
static void _MVE_MemInit(STRUCT_6B3690* a1, int a2, void* a3)
|
||||
{
|
||||
if (a3 == nullptr) {
|
||||
if (a3 == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -542,7 +541,7 @@ static void _MVE_MemInit(STRUCT_6B3690* a1, int a2, void* a3)
|
|||
// 0x4F48C0
|
||||
static void _MVE_MemFree(STRUCT_6B3690* a1)
|
||||
{
|
||||
if (a1->field_8 && gMovieLibFreeProc != nullptr) {
|
||||
if (a1->field_8 && gMovieLibFreeProc != NULL) {
|
||||
gMovieLibFreeProc(a1->field_0);
|
||||
a1->field_8 = 0;
|
||||
}
|
||||
|
@ -681,7 +680,7 @@ static int _ioReset(int stream)
|
|||
_io_handle = stream;
|
||||
|
||||
mve = (Mve*)_ioRead(sizeof(Mve));
|
||||
if (mve == nullptr) {
|
||||
if (mve == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -714,11 +713,11 @@ static void* _ioRead(int size)
|
|||
void* buf;
|
||||
|
||||
buf = _MVE_MemAlloc(&_io_mem_buf, size);
|
||||
if (buf == nullptr) {
|
||||
return nullptr;
|
||||
if (buf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gMovieLibReadProc(_io_handle, buf, size) < 1 ? nullptr : buf;
|
||||
return gMovieLibReadProc(_io_handle, buf, size) < 1 ? NULL : buf;
|
||||
}
|
||||
|
||||
// 0x4F4D40
|
||||
|
@ -730,15 +729,15 @@ static void* _MVE_MemAlloc(STRUCT_6B3690* a1, unsigned int a2)
|
|||
return a1->field_0;
|
||||
}
|
||||
|
||||
if (gMovieLibMallocProc == nullptr) {
|
||||
return nullptr;
|
||||
if (gMovieLibMallocProc == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_MVE_MemFree(a1);
|
||||
|
||||
ptr = gMovieLibMallocProc(a2 + 100);
|
||||
if (ptr == nullptr) {
|
||||
return nullptr;
|
||||
if (ptr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_MVE_MemInit(a1, a2 + 100, ptr);
|
||||
|
@ -754,8 +753,8 @@ static unsigned char* _ioNextRecord()
|
|||
unsigned char* buf;
|
||||
|
||||
buf = (unsigned char*)_ioRead((_io_next_hdr & 0xFFFF) + 4);
|
||||
if (buf == nullptr) {
|
||||
return nullptr;
|
||||
if (buf == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_io_next_hdr = *(int*)(buf + (_io_next_hdr & 0xFFFF));
|
||||
|
@ -795,8 +794,6 @@ static int _syncWait()
|
|||
if (_sync_active) {
|
||||
if (((_sync_time + 1000 * compat_timeGetTime()) & 0x80000000) != 0) {
|
||||
result = 1;
|
||||
|
||||
delay_ms(-(_sync_time + 1000 * compat_timeGetTime()) / 1000 - 3);
|
||||
while (((_sync_time + 1000 * compat_timeGetTime()) & 0x80000000) != 0)
|
||||
;
|
||||
}
|
||||
|
@ -848,8 +845,8 @@ int _MVE_rmStepMovie()
|
|||
}
|
||||
|
||||
LABEL_5:
|
||||
v21 = nullptr;
|
||||
v3 = nullptr;
|
||||
v21 = NULL;
|
||||
v3 = NULL;
|
||||
if (!v1) {
|
||||
v6 = -2;
|
||||
_MVE_rmEndMovie();
|
||||
|
@ -981,7 +978,7 @@ LABEL_5:
|
|||
if (v1[1] & _rm_track_bit) {
|
||||
v14 = (unsigned char*)v1 + 6;
|
||||
if ((v5 >> 16) != 8) {
|
||||
v14 = nullptr;
|
||||
v14 = NULL;
|
||||
}
|
||||
_CallsSndBuff_Loc(v14, v1[2]);
|
||||
}
|
||||
|
@ -1151,7 +1148,6 @@ static int _MVE_sndConfigure(int a1, int a2, int a3, int a4, int a5, int a6)
|
|||
}
|
||||
|
||||
// 0x4F56C0
|
||||
// Looks like this function is not used
|
||||
static void _MVE_syncSync()
|
||||
{
|
||||
if (_sync_active) {
|
||||
|
@ -1298,10 +1294,6 @@ static void _MVE_sndSync()
|
|||
break;
|
||||
}
|
||||
v0 = true;
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
delay_ms(1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dword_6B3660 != dword_6B3AE4) {
|
||||
|
@ -1326,10 +1318,6 @@ static int _syncWaitLevel(int a1)
|
|||
v2 = _sync_time + a1;
|
||||
do {
|
||||
result = v2 + 1000 * compat_timeGetTime();
|
||||
if (result < 0) {
|
||||
delay_ms(-result / 1000 - 3);
|
||||
}
|
||||
result = v2 + 1000 * compat_timeGetTime();
|
||||
} while (result < 0);
|
||||
|
||||
_sync_time += _sync_wait_quanta;
|
||||
|
@ -1418,9 +1406,9 @@ static int _MVE_sndAdd(unsigned char* dest, unsigned char** src_ptr, int a3, int
|
|||
|
||||
src = *src_ptr;
|
||||
|
||||
if (*src_ptr == nullptr) {
|
||||
if (*src_ptr == NULL) {
|
||||
memset(dest, dword_6B36A0 < 1 ? 0x80 : 0, a3);
|
||||
*src_ptr = nullptr;
|
||||
*src_ptr = NULL;
|
||||
return a4;
|
||||
}
|
||||
|
||||
|
@ -1476,14 +1464,14 @@ static void _MVE_sndResume()
|
|||
// 0x4F5CB0
|
||||
static int _nfConfig(int a1, int a2, int a3, int a4)
|
||||
{
|
||||
if (gMovieSdlSurface1 != nullptr) {
|
||||
if (gMovieSdlSurface1 != NULL) {
|
||||
SDL_FreeSurface(gMovieSdlSurface1);
|
||||
gMovieSdlSurface1 = nullptr;
|
||||
gMovieSdlSurface1 = NULL;
|
||||
}
|
||||
|
||||
if (gMovieSdlSurface2 != nullptr) {
|
||||
if (gMovieSdlSurface2 != NULL) {
|
||||
SDL_FreeSurface(gMovieSdlSurface2);
|
||||
gMovieSdlSurface2 = nullptr;
|
||||
gMovieSdlSurface2 = NULL;
|
||||
}
|
||||
|
||||
byte_6B400D = a1;
|
||||
|
@ -1513,12 +1501,12 @@ static int _nfConfig(int a1, int a2, int a3, int a4)
|
|||
}
|
||||
|
||||
gMovieSdlSurface1 = SDL_CreateRGBSurface(0, _mveBW, _mveBH, depth, rmask, gmask, bmask, 0);
|
||||
if (gMovieSdlSurface1 == nullptr) {
|
||||
if (gMovieSdlSurface1 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
gMovieSdlSurface2 = SDL_CreateRGBSurface(0, _mveBW, _mveBH, depth, rmask, gmask, bmask, 0);
|
||||
if (gMovieSdlSurface2 == nullptr) {
|
||||
if (gMovieSdlSurface2 == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1541,7 +1529,7 @@ static int _nfConfig(int a1, int a2, int a3, int a4)
|
|||
// 0x4F5E60
|
||||
static bool movieLockSurfaces()
|
||||
{
|
||||
if (gMovieSdlSurface1 != nullptr && gMovieSdlSurface2 != nullptr) {
|
||||
if (gMovieSdlSurface1 != NULL && gMovieSdlSurface2 != NULL) {
|
||||
if (SDL_LockSurface(gMovieSdlSurface1) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1716,14 +1704,14 @@ static void _MVE_sndRelease()
|
|||
// 0x4F6390
|
||||
static void _nfRelease()
|
||||
{
|
||||
if (gMovieSdlSurface1 != nullptr) {
|
||||
if (gMovieSdlSurface1 != NULL) {
|
||||
SDL_FreeSurface(gMovieSdlSurface1);
|
||||
gMovieSdlSurface1 = nullptr;
|
||||
gMovieSdlSurface1 = NULL;
|
||||
}
|
||||
|
||||
if (gMovieSdlSurface2 != nullptr) {
|
||||
if (gMovieSdlSurface2 != NULL) {
|
||||
SDL_FreeSurface(gMovieSdlSurface2);
|
||||
gMovieSdlSurface2 = nullptr;
|
||||
gMovieSdlSurface2 = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1791,7 +1779,7 @@ static void _MVE_frClose(STRUCT_4F6930* a1)
|
|||
_nfRelease();
|
||||
_frLoad(&v1);
|
||||
|
||||
if (gMovieLibFreeProc != nullptr) {
|
||||
if (gMovieLibFreeProc != NULL) {
|
||||
gMovieLibFreeProc(a1);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue