Compare commits

..
198 Commits
Author SHA1 Message Date
NovaRain a62a4d6911 Added SpecialDeathGVAR option to override the global variable number for special death.
Minor fix for Stats.ini.
2019-03-17 10:38:32 +08:00
NovaRain 20746abba2 Fixed range for object ID.
Minor edits to documents.
2019-03-16 08:53:20 +08:00
NovaRain e11755cb2d Added CorpseDeleteTime option (from Mr.Stalin)
Fixed some functionality issues of fake perks.
2019-03-15 19:20:30 +08:00
NovaRain 83b0862db6 Fixed the removal of party member's corpse (from Mr.Stalin)
Now items in party member's inventory are not removed along with the corpse.
2019-03-14 13:44:38 +08:00
NovaRain 386b5a6678 Fixed critters not being healed over time when entering the map if 'dead_bodies_age=No' is set in maps.txt.
Added additional checks for the amounts to properly compare the effects of drugs.
2019-03-13 11:55:33 +08:00
NovaRain 5bd69dfee2 Tweaked the code of the fix in previous commit. 2019-03-13 00:09:46 +08:00
NovaRain a388a9e602 Fixed NPC stuck in a loop of reloading melee/unarmed weapons when out of ammo (from Mr.Stalin) 2019-03-12 11:50:22 +08:00
NovaRain 69bea44481 Fixed broken get_perk_available script function. 2019-03-11 11:31:36 +08:00
NovaRain e2fc1ee0ec Minor edits on Perks.cpp and related code. 2019-03-11 10:22:17 +08:00
NovaRain 912abbd213 Fix item_d_load_subfix in the previous commit. 2019-03-06 21:28:08 +08:00
NovaRain 653b419be6 Backported the fix of active drug pids from the develop branch. 2019-03-06 09:35:53 +08:00
NovaRain 4480ecfcad Tweaked the code of item_d_take_drug_hack in Bugs.cpp. 2019-03-05 12:41:51 +08:00
NovaRain 08b9d98d3b Fixed the screen not returning to the player when moving a controlled critter to another elevation of the map.
Refactored some code in Bugs.cpp.
2019-03-04 12:55:34 +08:00
NovaRain c20e709659 Moved RemoveCriticalTimelimits to Criticals.cpp. 2019-03-03 12:02:19 +08:00
NovaRain 68a345f398 Moved the code of set_map_time_multi to WorldmapOps.hpp, and NPCAutoLevel to PartyControl.cpp.
Removed validate_test example function from release builds.
2019-02-27 12:27:22 +08:00
NovaRain 730cd212a4 Fixed a crash bug when trying to use explosives if using a books ini file.
Fixed some bugs in BugFixes.cpp.
2019-02-25 23:54:47 +08:00
NovaRain ce0f5ea8c9 Added a new argument to REMOVEINVENOBJ hook (from Mr.Stalin) 2019-02-25 20:44:49 +08:00
NovaRain 2ce1c0f36e Fixed inconsistent return value of get_npc_level.
Some edits to documents.
2019-02-25 12:32:56 +08:00
NovaRain 72e370117e Expanded get/inc_npc_level functions to accept party member PIDs (from Mr.Stalin)
Some code correction in Skills.cpp.
2019-02-24 20:14:36 +08:00
NovaRain 6ab45bbc3c Fixed incorrect skill point cost for negative skill levels when using a skills ini file (from Mr.Stalin) 2019-02-23 22:21:37 +08:00
NovaRain 7bcf06c227 Fixed the negative skill points of a skill not being taken into account when calculating the skill level (from Mr.Stalin, #202)
Fixed the return value of has_skill function for incorrect skill numbers.
2019-02-21 10:57:53 +08:00
NovaRain bc8f7477c7 Fixed the reserved item FRM being displayed in the top-left corner when in the loot/barter screens. 2019-02-20 10:04:54 +08:00
NovaRain f5c570ddc1 Removed MultiPatches from ddraw.ini, now it's always enabled.
Minor edits to main.cpp and Arrays.cpp.
Updated version number.
2019-02-19 12:07:40 +08:00
NovaRain 504f66f002 Moved DontDeleteProtos option from main.cpp to DebugEditor.cpp.
Updated Auto Doors script mod from Mr.Stalin and ddraw.ini.
2019-02-11 13:59:37 +08:00
NovaRain 76f2301b6c Minor edits to speed tweak and documents. 2019-02-10 09:56:28 +08:00
NovaRain 4788ac757b Formatted code in Arrays.cpp and added checks for the integrity of sfallgv.sav when loading a saved game.
Fixed unregistering hook procedure.
2019-02-09 09:55:43 +08:00
NovaRain a71b33aab1 Fixed crash when saving the game with speed tweak enabled. 2019-02-09 08:09:25 +08:00
NovaRain 222f3eaf68 Refactored and fixed speed patch related code (from Mr.Stalin)
Rewrote ASM code of WorldMapFpsPatch functions.
2019-02-08 12:53:13 +08:00
NovaRain 823d2b92f7 Minor refactoring of ScriptValue and some script function handlers. 2019-02-06 12:00:30 +08:00
NovaRain f478e9a1f9 Changed sfall to stop loading save if there's error on data files.
Minor simplified a couple of assembly in LoadGameHook.cpp.
2019-02-06 09:33:02 +08:00
NovaRain 8718b86440 Refactored error handling of saving/loading sfall save data files. 2019-02-05 11:11:56 +08:00
NovaRain 67adb9b592 Revert the change of get_year code to pure assembly.
Minor edits to main.cpp.
2019-02-04 17:55:16 +08:00
NovaRain ca5781a44a Refactored world map related code/funcs in main.cpp (from Mr.Stalin)
Fixed TimeLimit option and removed the pointless value of -2 (now it works the same as -3).
Fixed the slow mouse cursor on the world map when WorldMapFPSPatch is enabled.
2019-02-03 09:32:16 +08:00
NovaRain 4edf36a1dc Removed some more unnecessary memset code.
Added note on effect flags to CriticalOverrides.ini.
2019-01-31 09:12:15 +08:00
NovaRain 4a5f556cd3 Removed some unnecessary memset code.
Minor code corrections.
2019-01-30 00:15:12 +08:00
NovaRain 2b7754746c Refactored code in Books.cpp.
Increased the maximum number of books in BooksFile to 50.
Moved scattered Cpp11_emu.h includes from various cpp files to main.h.
2019-01-29 11:11:03 +08:00
NovaRain 8a4a83c8f8 Added HideObjIsNullMsg option to [Debugging].
Moved DebugEditor option from MiscPatches.cpp to DebugEditor.cpp.
2019-01-27 10:43:54 +08:00
NovaRain c04df22c48 Added two bug fixes for loading a game saved in combat mode (from Mr.Stalin) 2019-01-27 09:22:03 +08:00
NovaRain 8e0ccc576c Fixed pickup_obj/drop_obj/use_obj script functions (from Mr.Stalin)
Fixed a crash when calling use_obj/use_obj_on_obj functions without using set_self in global scripts.
2019-01-25 00:31:23 +08:00
NovaRain 42566cc9da Added AttackComplexFix option (from Mr.Stalin) 2019-01-23 09:33:54 +08:00
NovaRain 9e1c68e78d Fixed bugs in attack_complex and critter_mod_skill script functions. 2019-01-22 17:06:36 +08:00
NovaRain 9765396b08 Fixed set_self function for use_obj_on_obj, attack, attack_complex vanilla functions (from Mr.Stalin) (#214) 2019-01-22 09:47:19 +08:00
NovaRain b008502e13 Added error message when the name for sfall global variable is not equal to 8 characters.
Fixed error in FileSystem.cpp from the previous commit.
Updated version number.
2019-01-21 13:55:42 +08:00
NovaRain d71efe5b82 Corrected code in FileSystem.cpp (from Mr.Stalin)
Added fix for db_freadInt_ engine function from BugFixes.cpp when enabling UseFileSystemOverride.
2019-01-20 22:16:38 +08:00
NovaRain 120888e5ed Added "art_cache_clear" script function. 2019-01-20 09:10:58 +08:00
NovaRain 7b5075042d Fixed and refactored code in FileSystem.cpp (from Mr.Stalin) 2019-01-20 00:20:51 +08:00
NovaRain 12ad41043d Refactored ASM code in FileSystem.cpp (from Mr.Stalin) 2019-01-17 10:10:38 +08:00
NovaRain e509932add Added support for returning integer values to abs math function.
Minor code refactoring in Skills.cpp.
2019-01-16 11:38:49 +08:00
NovaRain ba3ad33587 Fixed a bug that broke the calculation of the skill point cost for increasing skill levels (#226)
Updated version number for hot fix.
2019-01-14 09:34:19 +08:00
NovaRain 6e74c3166a Refactored ASM code in Sound.cpp (from Mr.Stalin)
Minor fix for "path_find_to" script function.
Changed the two wrapper functions in ObjectsOps.hpp using dev branch as ref.
Changed some code in ObjectsOps.hpp for edited wrapper functions.
Moved obj_under_cursor to ObjectsOps.hpp.
Reformatted Karma/Worldmap related code in main.cpp as in dev branch.
2019-01-08 13:28:00 +08:00
NovaRain e320acce0b Expanded create/temp_array functions to allow creating a new "lookup" type of associative array (from Mr.Stalin) 2019-01-08 06:52:00 +08:00
NovaRain 4f48926105 Added support for sorting associative arrays by keys or values (from Mr.Stalin) 2019-01-07 15:13:22 +08:00
NovaRain 5611931063 Fixed a crash bug when using sorting functions on an associative array(map) (from Mr.Stalin) 2019-01-06 11:59:09 +08:00
NovaRain f00022fed6 Moved ModifiedIni to main.cpp. 2019-01-04 21:08:30 +08:00
NovaRain 78815425e2 Refactored ASM code in KillCounter.cpp.
Reformatted and tweaked code in Explosions.cpp.
2019-01-03 11:07:57 +08:00
NovaRain 9ddddcc120 Changed INVENTORYMOVE hook to be called before displaying the 'Move Items' window for drag and drop ammo on weapons. 2019-01-03 09:35:26 +08:00
NovaRain 11c15cec93 Refactored some ASM code in BurstMods.cpp, Inventory.cpp, Credits.cpp, AnimationsAtOnceLimit.cpp. 2019-01-01 10:27:40 +08:00
NovaRain f36bd6fb61 Improved the functionality of ElevatorsFile to allow to change the FRM images of the elevator panel and create new elevator types (from Mr.Stalin) 2018-12-31 10:10:06 +08:00
NovaRain 26ab38c6c3 Changed critical table to be loaded before global scripts.
Removed redundant ClearGlobals() in LoadGameHook.cpp (already run in ResetState(1) above)
Updated version number and year.
2018-12-30 10:08:47 +08:00
NovaRain 9b50e6be1e Added UseWalkDistance option (from Mr.Stalin) (#46) 2018-12-28 20:06:55 +08:00
NovaRain 2427634ee8 Added a fix to the following script functions to ensure they set the correct object: (from Mr.Stalin)
set_critter_burst_disable, set_critter_pickpocket_mod, set_critter_skill_mod, set_critter_hit_chance_mod, set_*_knockback
2018-12-28 10:04:22 +08:00
NovaRain 36d1d0a5fc Refactored HeroAppearance.cpp (from Mr.Stalin) 2018-12-27 16:03:13 +08:00
NovaRain 486f00cdf4 Refactored assembler code in Skills.cpp. 2018-12-26 10:23:21 +08:00
NovaRain b6fd424665 Added missing return values for HOOK_INVENWIELD. 2018-12-25 10:02:39 +08:00
NovaRain 3d679db758 Added a fix to prevent sfall from loading global scripts with an extension that exceeds three characters (from Mr.Stalin)
Replaced some pushad/popad opcodes with pushadc/popadc ASM macros.
2018-12-25 01:25:37 +08:00
NovaRain 92e1f919d9 Refactored SafeWrite.cpp. 2018-12-20 09:37:47 +08:00
NovaRain d259e8c903 Formatted code in HeroAppearance.cpp. 2018-12-18 07:54:19 +08:00
NovaRain dea0e596c3 Minor code edit on main.cpp. 2018-12-17 09:44:36 +08:00
NovaRain 90b39f3dde Replaced some values with constants in Perks.cpp. 2018-12-16 11:39:56 +08:00
NovaRain c80224f661 Simplified and reformatted code in Perks.cpp (from Mr.Stalin)
Replaced some 'strcpy_s' usages to 'strncpy_s' in Perks.cpp.
2018-12-15 18:55:40 +08:00
NovaRain d7d8de5e1a Added "get/set_object_data" script functions (from Mr.Stalin)
Changed read_byte, read_short, read_int, and read_string functions to not require AllowUnsafeScripting.
2018-12-05 10:17:26 +08:00
NovaRain 0a21e4abfa Fixed a bug in the hero appearance mod that caused the player to disappear after saving the game when player's base FID is greater than 255.
Replaced old SafeWrite usages with corresponding Hook/MakeCall functions in HeroAppearance.cpp.
2018-12-04 09:45:55 +08:00
NovaRain 1340eeb0d3 Fixed the return values of a hook getting corrupted if another hook was called during the execution of the current hook (from Mr.Stalin)
Added a fix to prevent hook scripts from being executed when the depth limit is exceeded.
2018-12-03 20:43:03 +08:00
NovaRain a350fed4d1 Added a fix for unable to sell/give items in barter screen when the player/party member is overloaded (from Mr.Stalin)
Added a variant of MakeCall/Jump with 3 arguments to replace some SafeWrite 0x90 code for trailing NOPs.
2018-11-30 11:35:14 +08:00
NovaRain 402d4f40f2 Changed some MakeJump usages to MakeCall in Stats.cpp, Knockback.cpp, and main.cpp.
(see Mr.Stalin's comments in commit c990b6701d)
2018-11-29 09:56:41 +08:00
NovaRain 0f49c7f68d Refactored the code in Knockback.cpp.
Edited part of HookScripts.cpp (ref. commit 0a3745f8f5)
Minor edits to some code files.
2018-11-28 21:35:47 +08:00
NovaRain deb0299776 Added an option to fix AI not taking chem_primary_desire in AI.txt as drug use preference when using drugs in their inventory (from Mr.Stalin)
Minor edits to some code files.
2018-11-26 09:59:14 +08:00
NovaRain 4bb3fa0275 Merged two Glovz's fix functions and reorganized Glovz's/YAAM code layout a bit.
Fixed a bug in Stats.cpp that caused critical hits to ignore critical table roll value and only have the lowest level effect.
Minor edits to MainMenu.cpp.
2018-11-20 23:44:27 +08:00
NovaRain da31455cef Fixed missing AC/DR mod stats when examining ammo in barter screen.
Added an option to display full item description for weapon/ammo in barter screen.
Minor code correction in ScriptExtender.cpp.
Minor edits to document.
Updated version number.
2018-11-20 07:23:25 +08:00
NovaRain 4da10e2fdb Fixed the missing return value of -1 for HOOK_USEOBJON. 2018-11-16 06:34:47 +08:00
NovaRain 5426d043c1 Fixed unable to click the pop-up message box when death from radiation was triggered during resting. 2018-11-14 07:14:39 +08:00
NovaRain 719cec74d1 Added a fix to display a pop-up message box about death from radiation. 2018-11-13 21:37:48 +08:00
NovaRain 627fe11c29 Fixed determine_to_hit_func_ engine function taking distance into account when called from determine_to_hit_no_range_ (from Mr.Stalin) 2018-11-12 13:14:07 +08:00
NovaRain dcca405b89 Added an additional mode to SpeedInterfaceCounterAnims (from Mr.Stalin)
Refactored the code of Stats.cpp.
Unified stat_level_ usages in Inventory.cpp, LoadGameHook.cpp and skills.cpp.
2018-11-10 10:08:08 +08:00
NovaRain cce9437d19 Removed the pop-up message box about not finding the original ddraw.dll, now the error is reported in the log file.
Added a note about setting a custom background for the character screen to the hero appearance mod.
2018-11-09 10:01:10 +08:00
NovaRain 09b3bf3aed Added DisplaySwiftLearnerExp option (from Crafty)
Minor edits to some documents/code.
2018-11-07 09:39:11 +08:00
NovaRain 08a891a0fc Added "obj_under_cursor" script function.
Backported some script functions from 4.0: lock_is_jammed, unjam_lock.
2018-11-04 09:14:02 +08:00
NovaRain e9df81ac78 Changed PartyMemberExtraInfo to not show "Addict" text (in dark green) on the combat control panel if the party member is not addicted to drugs. 2018-11-02 22:49:14 +08:00
NovaRain 3e982be4b6 Removed RemoveWindowRounding option because it doesn't affect anything. 2018-11-01 09:54:37 +08:00
NovaRain 8a888f387d Adjusted the position of ExtraSaveSlots page buttons a bit. 2018-10-31 07:16:17 +08:00
NovaRain 712b4de5f7 Changed the debug editor to require sfall debugging mode.
Some minor code edits.
2018-10-29 11:14:30 +08:00
NovaRain a3b456cf0a Added a new return value to HOOK_KEYPRESS to override the pressed key (from Crafty)
Added check for map being loaded to KeyPress/MouseClick hooks.
2018-10-28 08:51:01 +08:00
NovaRain 9f689863d7 Added a new setting to DebugMode to send debug output to both the screen and the debug log (from Crafty)
Simplified the code for ObjCanSeeObj_ShootThru_Fix a bit (from Mr.Stalin)
Changed sfall to not to create sfallfs.sav when UseFileSystemOverride is disabled.
2018-10-27 09:46:35 +08:00
NovaRain b5306406b3 Replaced some __cdecl calling conventions with __fastcall.
(from Mr.Stalin - Reason: The compiler can use the arguments for its own purposes, which can spoil the stored value on the stack.)
Added extra notes for some options to ddraw.ini.
2018-10-26 06:51:52 +08:00
NovaRain ce3b9c172c Minor edit to the fade patch. 2018-10-24 12:00:52 +08:00
NovaRain b8a77d77fb Added missing functions from the source library ddraw.dll to export from sfall (from Mr.Stalin)
Simplified the code in SuperSave.cpp.
Minor edits to ddraw.ini.
2018-10-23 11:50:55 +08:00
NovaRain a01da656c7 Fixed showing game movies and subtitles for DX9 mode when not using the hi-res patch, and added logging messages for DX9 mode (from Mr.Stalin)
Changed DisplayNPCExtraInfo to PartyMemberExtraInfo.
2018-10-19 11:07:30 +08:00
NovaRain 5eda8dd7a0 Backported a new mode of metarule2_explosions from 4.0. 2018-10-17 22:30:07 +08:00
NovaRain c05babeda7 Added DisplayNPCExtraInfo option to ddraw.ini for previous commit. 2018-10-17 09:34:14 +08:00
NovaRain cc2b95d64e Added displaying party member's current level & AC & addict flag info to the combat control panel (from Mr.Stalin)
Added additional notes to HOOK_COMBATDAMAGE in hookscripts.txt (#204)
2018-10-16 10:14:32 +08:00
NovaRain fb62bd51b5 Simplified some byte writing in a few options. 2018-10-15 09:57:55 +08:00
NovaRain f4d7ccef40 Fixed typo in the previous commit. 2018-10-14 10:15:02 +08:00
NovaRain 85bb34377c Added missing argument validation to refactored fs_* opcodes.
Minor edits to Criticals.cpp.
2018-10-14 10:06:06 +08:00
NovaRain af24c6eae4 Fixed the exploit that allows you to gain excessive skill points from Tag! perk before leaving the character screen (from Mr.Stalin) 2018-10-12 19:27:04 +08:00
NovaRain 930f463000 Backported expanded is_iface_tag_active function from 4.0, and refactored show/hide_iface_tag functions as well.
Minor edits to a couple of documents.
2018-10-11 23:56:11 +08:00
NovaRain e1aefcc1ed Refactored BonusHtHDamageFix/DisplayBonusDamage code in AmmoMod.cpp (from Mr.Stalin)
Fixed DisplayBonusDamage not being applied on Melee Damage stat in the character screen when BonusHtHDamageFix is enabled.
Reimplemented INTFACEUSE/INTFACELOOT/BARTER game mode flags, and backported inventory_redraw script function from 4.0.
2018-10-11 11:19:22 +08:00
NovaRain 25554ff0b2 Added FastMoveFromContainer as the auxiliary option for ItemFastMoveKey (from Mr.Stalin)
Refactored the code of StackEmptyWeapons.
Added missing argument validation for backported script functions.
2018-10-10 18:27:54 +08:00
NovaRain dad0860d6e Changed implementation of StartGDialogFix, additionally fixed the game crash if calling start_gdialog function outside of talk_p_proc procedure for talking heads.
Fixed "Heave Ho!" perk increasing strength stat above 10 when determining the max range of thrown weapons.
Moved SpecialUnarmedAttacksFix to BugFixes.cpp and simplified the code.
Added comments to old ApplyHeaveHoFix in Perks.cpp.
Backported some non-hook related script functions from 4.0: item_weight, get/set_outline, get/set_flags, tile_refresh_display, outlined_object, get/set_cursor_mode, display_stats, get/set_map_enter_position, attack_is_aimed.
2018-10-10 17:24:05 +08:00
NovaRain a7e492a80f Backported get/set_proto_data changes and LoadProtoMaxLimit option from the develop branch.
Added more definitions to define_extra.h.
2018-10-08 21:45:16 +08:00
NovaRain d9b748c261 Backported UseScrollingQuestsList imporvements from 4.1.
Added sound effect to ExtraSaveSlots page buttons (from Mr.Stalin)
2018-10-06 23:18:07 +08:00
NovaRain 0aad511e3e Refactored ASM code in ScriptExtender.cpp according to the develop branch, and edited the code style.
Moved NegateFix to Bugs.cpp and simplified its code.
2018-10-05 10:13:01 +08:00
NovaRain d117296990 Backported "create_win" script function and InterfaceDontMoveOnTop option from the developt branch.
Updated version number.
2018-10-02 12:15:48 +08:00
NovaRain e672db53c7 Backported AllowDShowSound improvements from the develop branch:
* Added volume control support for alternative sound files.
* Added mode 2 to play alternative music files even if original acm files are not present in the music folder.
* Added AllowDShowMovies option to separate avi files playback from enabling DX9 mode.
* Fixed initialization bug when DX9 mode is disabled.
* Small refactoring on ASM code.

Added missing FadeMultiplier option to ddraw.ini.
2018-10-01 12:16:42 +08:00
NovaRain 25bbd91fc5 Fixed the mood argument of start_gdialog function being ignored for talking heads (from Crafty)
Fixed the broken obj_can_hear_obj script function (from Mr.Stalin)
Simplified the code of disabling losing unused perks.
2018-09-30 16:31:29 +08:00
NovaRain 8db528330b Fixed the max text width of player name in inventory.
Added an 8 lines limit to the underline position fix.
Some minor ASM code edits.
Minor edit to document.
2018-09-25 14:17:45 +08:00
NovaRain f761f7834e Refactored fs_* opcodes with ASM macros and opcode handlers. 2018-09-25 12:29:33 +08:00
NovaRain f6c4e5133c Fixed ai_retrieve_object_ engine function not returning the requested object when there are different objects with the same ID (from Mr.Stalin)
Added info about map_*_p_proc procedures to the global script section in notes.txt.
2018-09-23 08:15:52 +08:00
NovaRain 2e30c86467 Added "get_current_inven_size" script function. 2018-09-21 19:27:57 +08:00
NovaRain 1679f7c59d Backported CritterInvSizeLimitMode related fixes/improvements from the develop branch:
* Changed item_total_weight/item_c_curr_size engine functions to return the weight and size of equipped(hidden) items on NPCs when exchanging/bartering items.
* Fixed CritterInvSizeLimitMode not properly checking the weight of equipped items when mode is set to 4+.
* Added inventory size check to "Take All" button.
* Added additional note to CritterInvSizeLimitMode in ddraw.ini, and changed CritterInvSizeLimit to its default value.
2018-09-20 09:48:27 +08:00
NovaRain 9a4cbd4fa9 Excluded inventory size features for NPCs when CritterInvSizeLimitMode is set to PC only. 2018-09-16 10:25:45 +08:00
NovaRain 0c561ba677 Backported refactored CritterInvSizeLimitMode option from the develop branch (from Mr.Stalin)
Added party member's current/max inventory size info to the combat control panel.
Removed redundant functions from FalloutEngine.cpp.
2018-09-15 11:41:46 +08:00
NovaRain 20ccdacee8 Fixed the underline position in the inventory display window when the item name is longer than one line (from Mr.Stalin)
Simplified the code of SuperStimExploitFix and corrected the return value for the change.
2018-09-12 22:45:58 +08:00
NovaRain d44663ce76 Backported two bug fixes from the develop branch:
* Fixed broken get/reset_critical_table functions (from Mr.Stalin)
* Fixed the encounter description being displayed in two lines instead of one (from Crafty)
2018-09-11 16:15:25 +08:00
NovaRain a196160258 Changed the fix for multihex critter moving in combat to a more proper one (from Mr.Stalin)
Added AIBestWeaponFix option to ddraw.ini.
2018-09-02 18:07:05 +08:00
NovaRain 55a97a5793 Fixed multihex critters moving too close and overlapping their targets in combat (from Crafty)
Fixed critters not checking weapon perks properly when searching for the best weapon (from Mr.Stalin)
2018-08-21 07:18:35 +08:00
NovaRain 3eaa64ee16 Added extra comment for CarChargingFix to ddraw.ini. 2018-08-14 23:57:29 +08:00
NovaRain aa9257ab1c Fixed obj_can_see_obj not checking if source and target objects are on the same elevation before calling is_within_perception_ (from Mr.Stalin) 2018-08-10 22:37:55 +08:00
NovaRain 81a8fd4863 Added a fix for the display issue in the pipboy when a quest list is too long with UseScrollingQuestsList diabled (from Mr.Stalin)
Added a fix for the clickability issue of holodisk list in the pipboy (from Mr.Stalin)
2018-08-06 21:10:09 +08:00
NovaRain ed260ad7e5 Minor edit to the description of CityRepsList in ddraw.ini, to avoid misunderstanding.
Updated version number.
2018-07-28 22:33:28 +08:00
NovaRain 9dce3c8d62 Fixed an issue with file IDs of additional game msg files being shifted when a file in ExtraGameMsgFileList is missing. 2018-07-24 09:39:26 +08:00
NovaRain f28a179c78 Added more info to the comments of various keys in [Input] section in ddraw.ini. 2018-06-12 20:53:03 +08:00
NovaRain 540abbe273 Fixed a bug in DisplaySecondWeaponRange that didn't display correct weapon range when the secondary mode is aimed (e.g. spear and throwing knife)
Added more info about unwielding in HOKK_INVENWIELD to hookscripts.txt.
2018-06-11 13:47:20 +08:00
NovaRain 8dda3940d0 Added ItemFastMoveKey and ItemCounterDefaultMax options from 4.0 develop branch (commit aaa76cb3d1)
Set ReloadReserve to be disabled by default.
2018-06-06 06:54:55 +08:00
NovaRain 44b9b24490 Minor edits to documents. 2018-06-04 21:28:05 +08:00
NovaRain dafbc357b2 Added more detail to the comment of previous commit. 2018-06-02 18:13:33 +08:00
Mr.StalinandNovaRain 02572a5193 Fix bug "walking dead" for critters in combat mode after their death. (#160) 2018-06-02 18:10:49 +08:00
NovaRain cab19b5ca0 Fixed the backported code in commit d6952a0c93 not working when enabling AnimationsAtOnceLimit.
Reorganized the layout of AnimationsAtOnceLimit.cpp to be more in-line with 4.0 code.
2018-06-02 08:21:19 +08:00
NovaRain d6952a0c93 Backported the fix for the crash when the critter goes through a door with animation trigger from commit 56945c7437. 2018-06-01 23:42:52 +08:00
NovaRain b996867d65 Minor edit to the code in Explosions.cpp. 2018-05-30 21:21:23 +08:00
NovaRain bd18c240f9 Simplified the ASM code of get_mouse_buttons() a bit. 2018-05-30 09:37:58 +08:00
NovaRain 2ad28e3086 Added WorldMapFontPatch option to use Fallout's normal text font instead of DOS-like font on the world map. (#48) 2018-05-30 09:33:40 +08:00
NovaRain ef5ff4e90f Expanded get_mouse_buttons function to return a value for the middle mouse button (from Mr.Stalin) 2018-05-29 09:32:16 +08:00
NovaRain 0a672c1e10 Added MoreTiles option to increase the limit of FRM images for tiles from 4096 to 16383 (from Crafty)
Added sfall log messages to both options in Tiles.cpp and edited the code style.
2018-05-28 10:15:02 +08:00
NovaRain 01214633f4 Simplified the code in BarBoxes.cpp.
Updated version number.
Fixed a minor typo in function notes.txt.
2018-05-27 16:42:34 +08:00
NovaRain 334e98c4c1 Backported DisplaySecondWeaponRange option from 'develop' branch.
Improved DisablePipboyAlarm so that when the player press Z key they won't see a blank Pipboy screen.
Simplified the HookCall usages in TimeLimit option.
2018-05-27 16:09:21 +08:00
NovaRain 78a29ad556 Simplified the code from commit 716bfd4156. 2018-05-15 20:23:34 +08:00
NovaRain e5d14ff845 Minor edit to FixCharScrnBack() in HeroAppearance.cpp. 2018-05-14 21:16:44 +08:00
mr.StalinandNovaRain 716bfd4156 Hero Appearance mod: Loads the custom background frm for the character windows. (#150)
AppChCrt.frm (for the character creation) and AppChEdt.frm (for the character screen) should be placed in art/intrface, and the image size must be 640x480.
2018-05-14 09:56:56 +08:00
NovaRain 9b67db7208 Fixed broken get_attack_type function (from Mr.Stalin and Crafty)
Replaced some SafeWriteX usages with SafeMemSet for writing serial NOPs.
Minor edits to documents.
2018-05-08 15:39:39 +08:00
NovaRain e92ded34e4 Added "floor2" script function to work with ceil (#109)
Added the missing description of ceil to notes.txt.
Disabled ceil marco in lib.math.h.
Removed duplications in Utils.h.
2018-04-28 11:16:10 +08:00
NovaRain 1689542165 Fixed the last additional notification boxes to the interface being missing (#140) 2018-04-26 10:11:22 +08:00
NovaRain 2c86201db9 Updated README.txt for info about additional headers/libraries.
(cherry picked from commit e474ba1660)
2018-04-21 09:19:20 +08:00
NovaRain d7c9acf713 Added set_ini_setting to documents, and updated info for get_ini_setting.
Updated credits.
Replacing a couple of strcpy usages with strcpy_s.
2018-04-21 08:49:56 +08:00
mr.StalinandNovaRain 399da0d322 Scripting function "set_ini_setting" for FuncX [sfall v3.8] (#139)
* Added new script function "set_ini_setting" for FuncX (#85)

* Small fix for sf_set_ini_setting function.

* Refactoring code for set/get_ini* functions.
2018-04-21 08:42:12 +08:00
NovaRain 774adaa3b0 Revert "Fixed a bug when using HOOK_ITEMDAMAGE and calling item_w_damage_ engine function at the same time. It would result in player self-damaging when attacking targets."
This reverts commit b4d174d91b.
2018-04-13 20:43:33 +08:00
NovaRain b4d174d91b Fixed a bug when using HOOK_ITEMDAMAGE and calling item_w_damage_ engine function at the same time. It would result in player self-damaging when attacking targets.
Set DataLoadOrderPatch to be enabled by default, for preventing partial of a game crash issue due to unusual game folders setup. #136
2018-04-13 11:09:37 +08:00
NovaRain 3291f6fe17 Added a fix for being at incorrect hex after map change when the exit hex in source map is at the same position as some exit hex in destination map (from Crafty) #134 2018-04-02 23:22:46 +08:00
NovaRain 84f442ca08 Rewrote the fix for player's base EMP DR as an engine-level fix (from Crafty) 2018-04-01 12:48:13 +08:00
NovaRain f5c35eb639 Fixed typos in hookscripts.txt. 2018-03-23 23:10:17 +08:00
NovaRain 514894ed59 Fixed typos in sfall function notes.txt. 2018-03-23 22:06:02 +08:00
NovaRain 204810d067 Fixed the long existing slotdat.ini function in ExtraSaveSlots.
Reduced duplication in ExtraSaveSlots code.
Unified the indent style in ExtraSaveSlots.cpp.
Updated version number.
2018-03-16 12:49:39 +08:00
NovaRain ec4ba13a28 Fixed add_mult_objs_to_inven only adding 500 of an object when the value of "count" argument is over 99999. #129 2018-01-17 07:37:03 +08:00
NovaRain 14a6ef7fc6 Made sure the value of player's base EMP DR is set correctly. 2018-01-02 23:25:27 +08:00
NovaRain c3a74070ca Updated version number and the year.
Set the copyright string in the same way as 4.0 build.
2018-01-02 10:26:32 +08:00
NovaRain 302fd4bb51 Condensed the code in ApplyHeaveHoFix a bit. 2018-01-02 10:02:04 +08:00
NovaRain c7520c71cf Fixed player's base EMP DR isn't properly initialized when creating a new character and then starting the game. 2017-12-15 07:34:10 +08:00
NovaRain 45632d6887 Changed sneak_success to call is_pc_sneak_working_ engine function, which takes player's current sneaking status into account as well, instead of only returning the result of last sneak attempt. 2017-12-05 10:25:11 +08:00
NovaRain 866c9165c0 Replaced hex values with proper VAR_TYPE_* defines for code readability. 2017-12-03 23:29:28 +08:00
NovaRain 813abbf452 Added missing entry of block_combat script function in opcode list. 2017-12-03 02:40:36 +08:00
NovaRain c6864e01f6 Added the damage type offset of weapon proto to define_extra.h.
Fixed a typo in hookscripts.txt.
Added a new example mod gl_autodoors (by Mr.Stalin) to modderspack. #19
2017-11-28 00:30:29 +08:00
NovaRain 0eab48932a Tweaked the way DebugMode works, now only DebugMode=2 sends debug output to a debug.log file. Any other non-0 value sends debug output to the screen. #123 2017-11-07 10:44:57 +08:00
NovaRain 6c3efc5b84 Replaced some SafeWrite* usages in old code with corresponding HookCall/MakeCall/MakeJump for code readability.
Edited code style in Perks.cpp.
2017-11-06 15:21:08 +08:00
NovaRain cb8d7dc94a Enabled mouse scroll control in barter and loot screens when the cursor is hovering over other lists, also enabled scrolling through the display monitor (from Crafty) #120
Rearraged the code style in dinput.cpp.
Updated version number.
2017-10-25 11:40:46 +08:00
NovaRain 5786cfb267 Fix crash when calling partyMemberGetCurLevel_ on a critter that has no data in party.txt.
Updated version number.
2017-10-18 14:56:38 +08:00
NovaRain 78dfb530a9 Moved LoadHeroAppearance() from MainMenuHook to NewGame2. No reason to run it on the main menu where player appearance can't display. 2017-09-19 15:27:08 +08:00
NovaRain d588f2e691 Edited code style in HeroAppearance.cpp/h, also removed some redundant blank lines. 2017-09-19 10:43:31 +08:00
NovaRain daf7a82997 Added descriptions for the variables in Perks.ini.
(cherry picked from commit 848f29b468)
2017-09-12 15:39:39 +08:00
NovaRain 9ad2b19e1a Removed the redundant LoadHeroAppearance calling.
(now it's called during LoadGame_, which is earlier than LoadGame2_After)
2017-09-09 18:59:21 +08:00
NovaRain 4b66dd3682 Reverted LoadGame to previous revision, but also kept EndLoadHook and changed it to only call LoadHeroAppearance.
(attempted to fix issue #117 and #94)
2017-09-05 09:21:22 +08:00
NovaRain 4899aeece1 Changed new function names in the previous commit to PascalCase style. 2017-09-01 09:45:33 +08:00
NovaRainandGitHub 946266e367 Merge pull request #107 from FakelsHub/crafty_features/combat_proc
Added calls to unimplemented script procedures: combat_is_starting_p_proc/combat_is_over_p_proc (from Crafty)
2017-09-01 09:40:47 +08:00
NovaRain 438ea071fc Removed the backported new modes for get_game_mode in commit a93ad5a9ba. 2017-08-24 21:46:42 +08:00
NovaRain 89760235c7 Removed unimplemented HEROWIN game mode from header files.
Cleared some obsoleted/unused code from main.cpp & LoadGameHook.cpp.
2017-08-23 13:42:58 +08:00
NovaRain 321f1c6034 Fixed the double damage effect of Silent Death perk not being applied to critical hits (from Crafty) 2017-08-21 23:18:32 +08:00
NovaRain 513338f160 Fixed incorrect argument description for get/set_proto_data in sfall opcode list.txt.
Removed incorrect PROTO_CR_FLAGS value in define_extra.h (was actually critter's IN), and renamed PROTO_CR_ACTION_FLAGS to its correct name #112

(cherry picked from commit ad17773ace)
2017-08-21 11:33:37 +08:00
NovaRain 08b92542f4 Fixed the incorrect description in HOOK_COMBATDAMAGE.
(cherry picked from commit 85cdd8973e)
2017-08-19 08:49:56 +08:00
NovaRain 46013c94b0 Added SSL library files and define_lite.h (from 4.0 development branch) 2017-08-18 15:52:14 +08:00
NovaRain 7a4ab59089 Added missing description for set_car_current_town.
Removed trailing spaces in MetaruleOp.hpp.
2017-08-13 11:38:18 +08:00
NovaRain e505e204cb Two bug fixes from Crafty:
1. Fixed the displayed message when the attack randomly hits a target that is not a critter and has a script attached.
2. Fixed damage_p_proc being called for misses if the target is not a critter.
2017-08-07 13:24:11 +08:00
NovaRain 7343754d53 Fixed Bonus Move APs being replenished when you save and load the game in combat (from Crafty)
Replaced all usages of MakeCall with 3 arguments with either MakeJump or MakeCall (2 arguments) to improve code readability (ref. commit 96fa2668cc)
2017-07-26 23:13:40 +08:00
NovaRain ae1e17d359 Added a note for argnum in set_sfall_arg().
Fixed incorrect set_sfall_arg usage in the example.
Removed a redundant line in sfall opcode list.txt.
2017-07-25 23:14:50 +08:00
NovaRain 32dbe5581d Replaced hs_*.int scripts in example mods with normal global scripts with register_hook.
(cherry picked from commit e7e286013f)
2017-07-06 21:04:51 +08:00
NovaRain a93ad5a9ba Added new modes for get_game_mode to match Crafty's (backported from 4.0 development branch, commit c32dc7664e) 2017-06-22 09:41:05 +08:00
NovaRain 874b047ce1 Added Attack Type argument for HOOK_COMBATDAMAGE (from Crafty) #100 2017-06-14 12:45:13 +08:00
NovaRain afa590c5a8 Minor edits to ddraw.ini. 2017-06-02 11:49:02 +08:00
NovaRain b89c52fcec Added DontTurnOffSneakIfYouRun option to prevent the player from running while sneaking without Silent Running perk (from Crafty)
Added sfall log text for DisablePipboyAlarm.
2017-05-26 10:10:16 +08:00
NovaRain ec2d323f75 Changed LoadGame2_After to be called before LoadGame state is ended (backported from 4.0 development branch, commit c2e6d743a3)
Updated version number.
Minor edits to scripting documents.
2017-05-23 21:05:04 +08:00
Mr.Stalin 586679b07f Added scripting procedure handlers combat_is_starting_p_proc/combat_is_over_p_proc from Crafry. 2017-05-12 18:28:46 +03:00
606 changed files with 35950 additions and 87574 deletions
-1
View File
@@ -1 +0,0 @@
*.ssl linguist-language=Pascal
-12
View File
@@ -1,12 +0,0 @@
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
# target-branch: "develop"
labels:
- "dependencies"
-62
View File
@@ -1,62 +0,0 @@
name: Build
on:
push:
branches:
- 'master'
- 'develop'
- 'github-action'
paths:
- '.github/workflows/build.yml'
- 'action.yml'
- 'sfall/**'
pull_request:
branches:
- 'master'
- 'develop'
paths:
- '.github/workflows/build.yml'
- 'action.yml'
- 'sfall/**'
jobs:
Build:
name: sfall
runs-on: windows-2022
steps:
- name: Clone sfall
uses: actions/checkout@v7
# Action is used twice for self-testing only
# DevXP build results are intentionally *not* included in artifact
- name: ReleaseXP build
id: build
uses: ./
with:
release-xp: true
dev-xp: false
- name: DevXP build
uses: ./
with:
release-xp: false
dev-xp: true
- name: Prepare artifacts
run: |
:
mkdir -p sfall-build
cp artifacts/ddraw.ini sfall-build
cp artifacts/sfall_dat/sfall.dat sfall-build
cp "${{ steps.build.outputs.release-xp }}" sfall-build
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: sfall-build
path: sfall-build
retention-days: 30
-34
View File
@@ -1,34 +0,0 @@
name: github pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install dependencies
run: |
sudo apt update && sudo apt -y -qq install bundler python3-pip
pip3 install ruamel.yaml --user
- name: Build
run: ./docs/generate.sh
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
-11
View File
@@ -26,7 +26,6 @@
*.exe
*.out
*.app
!ducible.exe
# NetBeans
nbproject/private/
@@ -47,8 +46,6 @@ nb-configuration.xml
*.user
*.userosscache
*.sln.docstates
*.VC.db
*.VC.opendb
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
@@ -56,10 +53,8 @@ nb-configuration.xml
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Dd]evXP/
[Rr]elease/
[Rr]eleases/
[Rr]eleaseXP/
x64/
x86/
build/
@@ -225,9 +220,3 @@ FakesAssemblies/
# Visual Studio 6 workspace options file
*.opt
sfall/postbuild.cmd
# jekyll build files
docs/_site
docs/.sass-cache
docs/.jekyll-metadata
docs/pages/*.md
-1150
View File
File diff suppressed because it is too large Load Diff
-394
View File
@@ -1,394 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using File = System.IO.File;
using StreamReader = System.IO.StreamReader;
using MemoryStream = System.IO.MemoryStream;
using BinaryReader = System.IO.BinaryReader;
using BinaryWriter = System.IO.BinaryWriter;
namespace FalloutClient {
public partial class DebugEditor : Form
{
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
private struct ByteConverter {
[System.Runtime.InteropServices.FieldOffset(0)]
private int i;
[System.Runtime.InteropServices.FieldOffset(0)]
private float f;
public int GetAsInt(float f) {
this.f = f;
return i;
}
public float GetAsFloat(int i) {
this.i = i;
return f;
}
public byte[] GetAsBytes(ulong ul) {
byte[] b = new byte[8];
for (int i = 0; i < 8; i++) b[i] = (byte)((ul & ((ulong)0xff << (i * 8))) >> (i * 8));
return b;
}
}
private static ByteConverter converter = new ByteConverter();
private enum Mode { Globals, MapVars, SGlobals, Arrays, Critters, LocalVars }
private readonly EditorConnection connection;
private Mode mode;
private readonly Dictionary<int, string> GlobNames = new Dictionary<int, string>();
private readonly Dictionary<uint, string> CritNames = new Dictionary<uint, string>();
private void Redraw() {
bCrittersLvar.Enabled = false;
bEdit.Enabled = false;
Column2.ReadOnly = false;
Column3.ReadOnly = false;
Column2.HeaderText = "Value (Int)";
Column3.HeaderText = "Value (Float)";
dataGridView1.SelectionMode = DataGridViewSelectionMode.CellSelect;
dataGridView1.SuspendLayout();
dataGridView1.Rows.Clear();
switch (mode) {
case Mode.Globals:
for (int i = 0; i < connection.Globals.Length; i++) {
string name = GlobNames.ContainsKey(i) ? GlobNames[i] : "";
dataGridView1.Rows.Add(i, name, connection.Globals[i], converter.GetAsFloat(connection.Globals[i]));
}
break;
case Mode.MapVars:
for (int i = 0; i < connection.MapVars.Length; i++) {
dataGridView1.Rows.Add(i, "", connection.MapVars[i], converter.GetAsFloat(connection.MapVars[i]));
}
break;
case Mode.SGlobals:
for (int i = 0; i < connection.SGlobalKeys.Length; i++) {
string s = connection.SGlobalKeys[i] > 0xffffffff
? new string(System.Text.ASCIIEncoding.ASCII.GetChars(converter.GetAsBytes(connection.SGlobalKeys[i])))
: (connection.SGlobalKeys[i].ToString());
dataGridView1.Rows.Add(s, "", connection.sGlobals[i], converter.GetAsFloat(connection.sGlobals[i]));
}
break;
case Mode.Arrays:
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Column2.ReadOnly = true;
Column3.ReadOnly = true;
Column2.HeaderText = "Array size";
Column3.HeaderText = "Array flags";
bEdit.Enabled = true;
for (int i = 0; i < connection.Arrays.Length; i++) {
bool isMap = connection.ArrayIsMap[i];
int arrlen = connection.ArrayLengths[i];
if (isMap) arrlen /= 2;
dataGridView1.Rows.Add(connection.Arrays[i], isMap ? "Map" : "", arrlen, "0x" + connection.ArrayFlag[i].ToString("x").ToUpper());
}
break;
case Mode.Critters:
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
Column2.ReadOnly = true;
Column3.ReadOnly = true;
Column2.HeaderText = "PID";
Column3.HeaderText = "Pointer";
bEdit.Enabled = true;
bCrittersLvar.Enabled = true;
for (int i = 0; i < connection.Critters.Length / 2; i++) {
uint modcrit = (connection.Critters[i, 0] & 0xfffff);
string name = CritNames.ContainsKey(modcrit) ? CritNames[modcrit] : "";
dataGridView1.Rows.Add(i + 1, name, connection.Critters[i, 0].ToString("x").ToUpper(), connection.Critters[i, 1].ToString());
}
break;
}
dataGridView1.ResumeLayout();
}
internal DebugEditor(EditorConnection connection) {
InitializeComponent();
this.connection = connection;
mode = Mode.Globals;
if (File.Exists(".\\data\\data\\vault13.gam")) {
StreamReader sr=new StreamReader(".\\data\\data\\vault13.gam");
int gvar = 0;
while (!sr.EndOfStream) {
string line = sr.ReadLine().TrimStart();
if (line.StartsWith("GVAR_")) GlobNames[gvar++] = line.Remove(line.IndexOf(':')).TrimEnd();
}
sr.Close();
} else if (File.Exists("globals.txt")) {
StreamReader sr = new StreamReader("globals.txt");
while (!sr.EndOfStream) {
string[] line = sr.ReadLine().Split(' ');
GlobNames[int.Parse(line[0])] = line[1];
}
sr.Close();
}
if (File.Exists("critters.txt")) {
StreamReader sr = new StreamReader("critters.txt");
while (!sr.EndOfStream) {
string line = sr.ReadLine();
CritNames[uint.Parse(line.Remove(line.IndexOf(' ')))] = line.Substring(line.IndexOf(' ') + 1);
}
sr.Close();
}
Redraw();
redrawTimer.Start();
}
private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) {
connection.WriteDataType(DataTypeSend.Exit);
connection.Close();
}
private void bGlobals_Click(object sender, EventArgs e) {
mode = Mode.Globals;
Redraw();
}
private void bMapVars_Click(object sender, EventArgs e) {
mode = Mode.MapVars;
Redraw();
}
private void bSGlobals_Click(object sender, EventArgs e) {
mode = Mode.SGlobals;
Redraw();
}
private void bArrays_Click(object sender, EventArgs e) {
mode = Mode.Arrays;
Redraw();
}
private void bCritters_Click(object sender, EventArgs e) {
mode = Mode.Critters;
Redraw();
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
int[] array = null;
DataTypeSend dts;
switch (mode) {
case Mode.Globals:
array = connection.Globals;
dts = DataTypeSend.SetGlobal;
break;
case Mode.MapVars:
array = connection.MapVars;
dts = DataTypeSend.SetMapVar;
break;
case Mode.SGlobals:
array = connection.sGlobals;
dts = DataTypeSend.SetSGlobal;
break;
default:
return;
}
redrawTimer.Stop();
if (e.ColumnIndex == 2) {
string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
int val;
if (str == null || !int.TryParse(str, out val)) {
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = array[e.RowIndex];
} else {
array[e.RowIndex] = val;
connection.WriteDataType(dts);
connection.WriteInt(e.RowIndex);
connection.WriteInt(val);
}
} else {
string str = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
float val;
if (str == null || !float.TryParse(str, out val)) {
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = array[e.RowIndex];
} else {
array[e.RowIndex] = converter.GetAsInt(val);
connection.WriteDataType(dts);
connection.WriteInt(e.RowIndex);
connection.WriteInt(converter.GetAsInt(val));
}
}
redrawTimer.Start();
}
private void bEdit_Click(object sender, EventArgs e) {
if (dataGridView1.SelectedRows.Count == 0) return;
int i = (int)dataGridView1.SelectedRows[0].Tag;
redrawTimer.Stop();
switch (mode) {
case Mode.Arrays: {
DataType[] types = new DataType[connection.ArrayLengths[i]];
int[] lenType = new int[connection.ArrayLengths[i]];
string[] strings = new string[connection.ArrayLengths[i]];
connection.WriteDataType(DataTypeSend.GetArray); // code
connection.WriteInt(i); // index
int lenData = 0;
for (int j = 0; j < strings.Length; j++) {
types[j] = (DataType)connection.ReadInt();
lenType[j] = connection.ReadInt(); // len data of type
lenData += lenType[j];
}
byte[] buf = connection.ReadBytes(lenData); // read data
BinaryReader br = new BinaryReader(new MemoryStream(buf));
for (int j = 0; j < strings.Length; j++) {
switch (types[j]) {
case DataType.None:
br.BaseStream.Position += 4;
break;
case DataType.Int:
strings[j] = br.ReadInt32().ToString();
break;
case DataType.Float:
strings[j] = br.ReadSingle().ToString();
break;
case DataType.String:
byte[] bytes = br.ReadBytes(lenType[j]);
strings[j] = System.Text.Encoding.ASCII.GetString(bytes, 0, Array.IndexOf<byte>(bytes, 0));
break;
}
}
br.Close();
strings = EditorWindow.ShowEditor(this, null, types, strings, connection.ArrayIsMap[i]);
if (strings != null) { // save
MemoryStream ms = new MemoryStream(lenData);
BinaryWriter bw = new BinaryWriter(ms);
for (int j = 0; j < strings.Length; j++) {
switch (types[j]) {
case DataType.None:
bw.BaseStream.Position += 4;
break;
case DataType.Int:
bw.Write(int.Parse(strings[j]));
break;
case DataType.Float:
bw.Write(float.Parse(strings[j]));
break;
case DataType.String:
byte[] bytes = System.Text.Encoding.ASCII.GetBytes(strings[j]);
if (bytes.Length < lenType[j])
bw.Write(bytes);
else
bw.Write(bytes, 0, lenType[j] - 1);
bw.Write((byte)0);
break;
}
}
// send data to sfall
connection.WriteDataType(DataTypeSend.SetArray);
connection.WriteInt(i); // index
connection.WriteInt(lenData);
connection.WriteBytes(ms.GetBuffer(), 0, lenData);
bw.Close();
}
}
break;
case Mode.Critters: {
DataType[] types = new DataType[33];
string[] strings = new string[33];
string[] names = new string[33];
connection.WriteDataType(DataTypeSend.RetrieveCritter);
connection.WriteInt(i);
BinaryReader br = new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(33 * 4)));
for (int j = 0; j < 33; j++) {
types[j] = DataType.Int;
strings[j] = br.ReadInt32().ToString();
}
br.Close();
names[0] = " ID";
names[1] = " Tile";
names[6] = " Current frame";
names[7] = " Rotation";
names[8] = " FID";
names[9] = " Flags";
names[10] = " Elevation";
names[11] = " Inventory count";
names[13] = " Inventory pointer";
names[14] = " Reaction";
names[15] = " Combat state";
names[16] = " Current AP";
names[17] = " Combat flags";
names[18] = " Last Turn Damage";
names[19] = " AI Packet";
names[20] = " Team";
names[21] = " Who hit me";
names[22] = " HP";
names[23] = " Rads";
names[24] = " Poison";
names[25] = " Proto ID";
names[26] = " Combat ID";
names[29] = " Outline flags";
names[30] = " Script ID";
names[32] = " Script index";
strings = EditorWindow.ShowEditor(this, names, types, strings);
if (strings != null) {
MemoryStream ms = new MemoryStream(33 * 4);
BinaryWriter bw = new BinaryWriter(ms);
for (int j = 0; j < 33; j++) bw.Write(int.Parse(strings[j]));
connection.WriteDataType(DataTypeSend.SetCritter);
connection.WriteInt(i);
connection.WriteBytes(ms.GetBuffer(), 0, 33 * 4);
bw.Close();
}
}
break;
}
redrawTimer.Start();
}
private void bCrittersLvar_Click(object sender, EventArgs e) {
if (dataGridView1.SelectedRows.Count == 0) return;
int i = (int)dataGridView1.SelectedRows[0].Tag;
connection.WriteDataType(DataTypeSend.RetrieveCritter);
connection.WriteInt(i);
BinaryReader br = new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(33 * 4)));
br.BaseStream.Position = 30 * 4;
int sid = br.ReadInt32();
br.Close();
if (sid != -1) {
connection.WriteDataType(DataTypeSend.GetLocal);
connection.WriteInt(sid);
int totalVar = connection.ReadInt();
string[] values = new string[totalVar];
if (totalVar > 0) {
br = new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(totalVar * 4)));
for (int j = 0; j < totalVar; j++) {
values[j] = br.ReadInt32().ToString();
}
br.Close();
}
values = EditorWindow.ShowEditor(this, values);
if (values != null) {
int countVar = values.Length;
MemoryStream ms = new MemoryStream(countVar * 4);
BinaryWriter bw = new BinaryWriter(ms);
for (int j = 0; j < countVar; j++) bw.Write(int.Parse(values[j]));
connection.WriteDataType(DataTypeSend.SetLocal);
connection.WriteInt(sid);
connection.WriteInt(countVar);
connection.WriteBytes(ms.GetBuffer(), 0, countVar * 4);
bw.Close();
}
} else {
MessageBox.Show("This critter has no script attached.");
}
}
private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
bEdit.PerformClick();
}
private void dataGridView1_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e) {
dataGridView1.Rows[e.RowIndex].Tag = e.RowIndex;
}
private void timer1_Tick(object sender, EventArgs e) {
connection.WriteDataType(DataTypeSend.RedrawGame);
}
}
}
-131
View File
@@ -1,131 +0,0 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace FalloutClient {
public enum DataType : int { None = 0, Int = 1, Float = 2, String = 3 }
public partial class EditorWindow : Form
{
private readonly DataType[] types = null;
private string[] values;
private bool save;
private static bool valueInHex = false;
private void ConvertValues(bool toHex) {
for (int i = 0; i < values.Length; i++) {
if (toHex) {
if (types == null || types[i] == DataType.Int) {
int val = int.Parse(values[i]);
values[i] = "0x" + val.ToString("x").ToUpper();
}
} else {
if (types == null || types[i] == DataType.Int) {
values[i] = Convert.ToInt32(values[i], 16).ToString();
}
}
}
}
private EditorWindow(string[] names, DataType[] types, string[] values, bool isMap) {
this.types = types;
this.values = values;
InitializeComponent();
checkBox.Checked = EditorWindow.valueInHex;
dataGridView1.SuspendLayout();
if (valueInHex) ConvertValues(true);
if (names == null)
for (int i = 0; i < types.Length; i++) {
string element = i.ToString();
if (isMap && (i % 2) == 0) element += " - Key";
dataGridView1.Rows.Add(element, types[i].ToString(), values[i]);
}
else
for (int i = 0; i < types.Length; i++) dataGridView1.Rows.Add("[0x" + (i * 4).ToString("x").ToUpper() + "]" + names[i], types[i].ToString(), values[i]);
dataGridView1.ResumeLayout();
}
public static string[] ShowEditor(DebugEditor form, string[] names, DataType[] types, string[] values, bool isMap = false) {
form.redrawTimer.Start();
EditorWindow editor = new EditorWindow(names, types, values, isMap);
editor.ShowDialog();
form.redrawTimer.Stop();
if (editor.save) {
if (valueInHex) editor.ConvertValues(false);
return editor.values;
}
return null;
}
private EditorWindow(string[] values) {
this.values = values;
InitializeComponent();
checkBox.Checked = EditorWindow.valueInHex;
dataGridView1.SuspendLayout();
if (valueInHex) ConvertValues(true);
for (int i = 0; i < values.Length; i++) {
dataGridView1.Rows.Add(i.ToString(), "Int", values[i]);
}
dataGridView1.ResumeLayout();
}
public static string[] ShowEditor(DebugEditor form, string[] lvalues) {
form.redrawTimer.Start();
EditorWindow editor = new EditorWindow(lvalues);
editor.ShowDialog();
form.redrawTimer.Stop();
if (editor.save) {
if (valueInHex) editor.ConvertValues(false);
return editor.values;
}
return null;
}
private bool CheckInput(DataType type, string str) {
switch (type) {
case DataType.Int:
if (valueInHex) {
try {
Convert.ToInt32(str, 16);
return true;
} catch (Exception) {
return false;
}
}
int i;
return int.TryParse(str, out i);
case DataType.Float:
float f;
return float.TryParse(str, out f);
}
return true;
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
string str = (string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
if (str != null && CheckInput(((types != null) ? types[e.RowIndex] : DataType.Int), str))
values[e.RowIndex] = str;
else
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = values[e.RowIndex];
}
private void bCancel_Click(object sender, EventArgs e) {
Close();
}
private void bSave_Click(object sender, EventArgs e) {
save = true;
Close();
}
private void checkBox_Click(object sender, EventArgs e) {
valueInHex = checkBox.Checked;
ConvertValues(valueInHex);
for (int i = 0; i < values.Length; i++) {
dataGridView1.Rows[i].Cells[2].Value = values[i];
}
}
}
}
-38
View File
@@ -1,38 +0,0 @@
using System;
using System.Windows.Forms;
using System.IO;
namespace FalloutClient {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length == 1 && args[0] == "-debugedit") {
Application.Run(new DebugEditor(new EditorConnection()));
} else {
MessageBox.Show("The debug editor can only be run from the game.\n" +
"Use the key assigned to the DebugEditorKey option in ddraw.ini to run the debugger.",
"sfall Debug Editor", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
}
enum DataTypeSend {
SetGlobal = 0,
SetMapVar = 1,
RetrieveCritter = 2,
SetCritter = 3,
SetSGlobal = 4,
GetArray = 9,
SetArray = 10,
GetLocal = 11,
SetLocal = 12,
Exit = 254,
RedrawGame = 255
}
}
+8 -7
View File
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -664,11 +664,12 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
@@ -23,20 +23,17 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.dataGridView1 = new System.Windows.Forms.DataGridView();
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.bGlobals = new System.Windows.Forms.Button();
this.bMapVars = new System.Windows.Forms.Button();
this.bCritters = new System.Windows.Forms.Button();
this.bSGlobals = new System.Windows.Forms.Button();
this.bArrays = new System.Windows.Forms.Button();
this.Column0 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.bEdit = new System.Windows.Forms.Button();
this.redrawTimer = new System.Windows.Forms.Timer(this.components);
this.bCrittersLvar = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
@@ -44,38 +41,84 @@
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeight = 22;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column0,
this.Column1,
this.Column2,
this.Column3});
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dataGridView1.Size = new System.Drawing.Size(561, 354);
this.dataGridView1.Size = new System.Drawing.Size(444, 215);
this.dataGridView1.TabIndex = 0;
this.dataGridView1.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellDoubleClick);
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
this.dataGridView1.RowsAdded += new System.Windows.Forms.DataGridViewRowsAddedEventHandler(this.dataGridView1_RowsAdded);
//
// bGlobals
//
this.bGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bGlobals.Location = new System.Drawing.Point(12, 233);
this.bGlobals.Name = "bGlobals";
this.bGlobals.Size = new System.Drawing.Size(100, 23);
this.bGlobals.TabIndex = 1;
this.bGlobals.Text = "Globals";
this.bGlobals.UseVisualStyleBackColor = true;
this.bGlobals.Click += new System.EventHandler(this.bGlobals_Click);
//
// bMapVars
//
this.bMapVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bMapVars.Location = new System.Drawing.Point(118, 233);
this.bMapVars.Name = "bMapVars";
this.bMapVars.Size = new System.Drawing.Size(100, 23);
this.bMapVars.TabIndex = 2;
this.bMapVars.Text = "Map variables";
this.bMapVars.UseVisualStyleBackColor = true;
this.bMapVars.Click += new System.EventHandler(this.bMapVars_Click);
//
// bCritters
//
this.bCritters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bCritters.Location = new System.Drawing.Point(118, 262);
this.bCritters.Name = "bCritters";
this.bCritters.Size = new System.Drawing.Size(100, 23);
this.bCritters.TabIndex = 3;
this.bCritters.Text = "Critters";
this.bCritters.UseVisualStyleBackColor = true;
this.bCritters.Click += new System.EventHandler(this.bCritters_Click);
//
// bSGlobals
//
this.bSGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bSGlobals.Location = new System.Drawing.Point(225, 233);
this.bSGlobals.Name = "bSGlobals";
this.bSGlobals.Size = new System.Drawing.Size(100, 23);
this.bSGlobals.TabIndex = 4;
this.bSGlobals.Text = "sfall globals";
this.bSGlobals.UseVisualStyleBackColor = true;
this.bSGlobals.Click += new System.EventHandler(this.bSGlobals_Click);
//
// bArrays
//
this.bArrays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bArrays.Location = new System.Drawing.Point(12, 262);
this.bArrays.Name = "bArrays";
this.bArrays.Size = new System.Drawing.Size(100, 23);
this.bArrays.TabIndex = 5;
this.bArrays.Text = "sfall arrays";
this.bArrays.UseVisualStyleBackColor = true;
this.bArrays.Click += new System.EventHandler(this.bArrays_Click);
//
// Column0
//
this.Column0.HeaderText = "ID";
this.Column0.Name = "Column0";
this.Column0.ReadOnly = true;
this.Column0.Width = 50;
//
// Column1
//
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.Column1.HeaderText = "Name";
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
@@ -90,65 +133,10 @@
this.Column3.HeaderText = "Value (Float)";
this.Column3.Name = "Column3";
//
// bGlobals
//
this.bGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bGlobals.Location = new System.Drawing.Point(12, 372);
this.bGlobals.Name = "bGlobals";
this.bGlobals.Size = new System.Drawing.Size(100, 23);
this.bGlobals.TabIndex = 1;
this.bGlobals.Text = "Globals";
this.bGlobals.UseVisualStyleBackColor = true;
this.bGlobals.Click += new System.EventHandler(this.bGlobals_Click);
//
// bMapVars
//
this.bMapVars.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bMapVars.Location = new System.Drawing.Point(118, 372);
this.bMapVars.Name = "bMapVars";
this.bMapVars.Size = new System.Drawing.Size(100, 23);
this.bMapVars.TabIndex = 2;
this.bMapVars.Text = "Map variables";
this.bMapVars.UseVisualStyleBackColor = true;
this.bMapVars.Click += new System.EventHandler(this.bMapVars_Click);
//
// bCritters
//
this.bCritters.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bCritters.Location = new System.Drawing.Point(12, 401);
this.bCritters.Name = "bCritters";
this.bCritters.Size = new System.Drawing.Size(100, 23);
this.bCritters.TabIndex = 3;
this.bCritters.Text = "Critters";
this.bCritters.UseVisualStyleBackColor = true;
this.bCritters.Click += new System.EventHandler(this.bCritters_Click);
//
// bSGlobals
//
this.bSGlobals.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bSGlobals.Location = new System.Drawing.Point(367, 372);
this.bSGlobals.Name = "bSGlobals";
this.bSGlobals.Size = new System.Drawing.Size(100, 23);
this.bSGlobals.TabIndex = 4;
this.bSGlobals.Text = "sfall globals";
this.bSGlobals.UseVisualStyleBackColor = true;
this.bSGlobals.Click += new System.EventHandler(this.bSGlobals_Click);
//
// bArrays
//
this.bArrays.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bArrays.Location = new System.Drawing.Point(473, 372);
this.bArrays.Name = "bArrays";
this.bArrays.Size = new System.Drawing.Size(100, 23);
this.bArrays.TabIndex = 5;
this.bArrays.Text = "sfall arrays";
this.bArrays.UseVisualStyleBackColor = true;
this.bArrays.Click += new System.EventHandler(this.bArrays_Click);
//
// bEdit
//
this.bEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bEdit.Location = new System.Drawing.Point(473, 401);
this.bEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bEdit.Location = new System.Drawing.Point(225, 262);
this.bEdit.Name = "bEdit";
this.bEdit.Size = new System.Drawing.Size(100, 23);
this.bEdit.TabIndex = 6;
@@ -156,29 +144,11 @@
this.bEdit.UseVisualStyleBackColor = true;
this.bEdit.Click += new System.EventHandler(this.bEdit_Click);
//
// redrawTimer
//
this.redrawTimer.Interval = 200;
this.redrawTimer.Tick += new System.EventHandler(this.timer1_Tick);
//
// bCrittersLvar
//
this.bCrittersLvar.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bCrittersLvar.Enabled = false;
this.bCrittersLvar.Location = new System.Drawing.Point(118, 401);
this.bCrittersLvar.Name = "bCrittersLvar";
this.bCrittersLvar.Size = new System.Drawing.Size(100, 23);
this.bCrittersLvar.TabIndex = 7;
this.bCrittersLvar.Text = "Local variables";
this.bCrittersLvar.UseVisualStyleBackColor = true;
this.bCrittersLvar.Click += new System.EventHandler(this.bCrittersLvar_Click);
//
// DebugEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(585, 436);
this.Controls.Add(this.bCrittersLvar);
this.ClientSize = new System.Drawing.Size(468, 297);
this.Controls.Add(this.bEdit);
this.Controls.Add(this.bArrays);
this.Controls.Add(this.bSGlobals);
@@ -186,10 +156,8 @@
this.Controls.Add(this.bMapVars);
this.Controls.Add(this.bGlobals);
this.Controls.Add(this.dataGridView1);
this.MinimumSize = new System.Drawing.Size(450, 300);
this.Name = "DebugEditor";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "sfall Debug Editor";
this.Text = "DebugEditor";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DebugEditor_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
@@ -204,13 +172,11 @@
private System.Windows.Forms.Button bCritters;
private System.Windows.Forms.Button bSGlobals;
private System.Windows.Forms.Button bArrays;
private System.Windows.Forms.Button bEdit;
private System.Windows.Forms.DataGridViewTextBoxColumn Column0;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
internal System.Windows.Forms.Timer redrawTimer;
private System.Windows.Forms.Button bCrittersLvar;
private System.Windows.Forms.Button bEdit;
}
}
+300
View File
@@ -0,0 +1,300 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using File=System.IO.File;
using StreamReader=System.IO.StreamReader;
using MemoryStream=System.IO.MemoryStream;
using BinaryReader=System.IO.BinaryReader;
using BinaryWriter=System.IO.BinaryWriter;
namespace FalloutClient {
public partial class DebugEditor : Form {
[System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Explicit)]
private struct ByteConverter {
[System.Runtime.InteropServices.FieldOffset(0)]
private int i;
[System.Runtime.InteropServices.FieldOffset(0)]
private float f;
public int GetAsInt(float f) {
this.f=f;
return i;
}
public float GetAsFloat(int i) {
this.i=i;
return f;
}
public byte[] GetAsBytes(ulong ul) {
byte[] b=new byte[8];
for(int i=0;i<8;i++) b[i]=(byte)((ul&((ulong)0xff<<(i*8)))>>(i*8));
return b;
}
}
private static ByteConverter converter=new ByteConverter();
private enum Mode { Globals, MapVars, SGlobals, Arrays, Critters }
private readonly EditorConnection connection;
private Mode mode;
private readonly Dictionary<int, string> GlobNames=new Dictionary<int, string>();
private readonly Dictionary<uint, string> CritNames=new Dictionary<uint, string>();
private void Redraw() {
dataGridView1.SuspendLayout();
dataGridView1.Rows.Clear();
switch(mode) {
case Mode.Globals:
Column2.ReadOnly=false;
Column3.ReadOnly=false;
Column2.HeaderText="Value (Int)";
Column3.HeaderText="Value (Float)";
bEdit.Enabled=false;
for(int i=0;i<connection.Globals.Length;i++) {
string name=GlobNames.ContainsKey(i)?GlobNames[i]:"";
dataGridView1.Rows.Add(i, name, connection.Globals[i], converter.GetAsFloat(connection.Globals[i]));
}
break;
case Mode.MapVars:
Column2.ReadOnly=false;
Column3.ReadOnly=false;
Column2.HeaderText="Value (Int)";
Column3.HeaderText="Value (Float)";
bEdit.Enabled=false;
for(int i=0;i<connection.MapVars.Length;i++) {
dataGridView1.Rows.Add(i, "", connection.MapVars[i], converter.GetAsFloat(connection.MapVars[i]));
}
break;
case Mode.SGlobals:
Column2.ReadOnly=false;
Column3.ReadOnly=false;
Column2.HeaderText="Value (Int)";
Column3.HeaderText="Value (Float)";
bEdit.Enabled=false;
for(int i=0;i<connection.SGlobalKeys.Length;i++) {
string s=connection.SGlobalKeys[i]>0xffffffff?new string(System.Text.ASCIIEncoding.ASCII.GetChars(converter.GetAsBytes(connection.SGlobalKeys[i]))):("0x"+connection.SGlobalKeys[i].ToString("x"));
dataGridView1.Rows.Add(s, "", connection.sGlobals[i], converter.GetAsFloat(connection.sGlobals[i]));
}
break;
case Mode.Arrays:
Column2.ReadOnly=true;
Column3.ReadOnly=true;
Column2.HeaderText="Array length";
Column3.HeaderText="Element size";
bEdit.Enabled=true;
for(int i=0;i<connection.Arrays.Length;i++) {
dataGridView1.Rows.Add(connection.Arrays[i], "", connection.ArrayLengths[i], connection.ArrayDataSizes[i]);
}
break;
case Mode.Critters:
Column2.ReadOnly=true;
Column3.ReadOnly=true;
Column2.HeaderText="pid";
Column3.HeaderText="";
bEdit.Enabled=true;
for(int i=0;i<connection.Critters.Length;i++) {
uint modcrit=(connection.Critters[i]&0xfffff);
string name=CritNames.ContainsKey(modcrit)?CritNames[modcrit]:"";
dataGridView1.Rows.Add(i+1, name, connection.Critters[i].ToString("x"), "");
}
break;
}
dataGridView1.ResumeLayout();
}
internal DebugEditor(EditorConnection connection) {
InitializeComponent();
this.connection=connection;
mode=Mode.Globals;
if(File.Exists("globals.txt")) {
StreamReader sr=new StreamReader("globals.txt");
while(!sr.EndOfStream) {
string[] line=sr.ReadLine().Split(' ');
GlobNames[int.Parse(line[0])]=line[1];
}
sr.Close();
}
if(File.Exists("critters.txt")) {
StreamReader sr=new StreamReader("critters.txt");
while(!sr.EndOfStream) {
string line=sr.ReadLine();
CritNames[uint.Parse(line.Remove(line.IndexOf(' ')))]=line.Substring(line.IndexOf(' ')+1);
}
sr.Close();
}
Redraw();
}
private void DebugEditor_FormClosing(object sender, FormClosingEventArgs e) {
connection.WriteDataType(DataTypeSend.Exit);
connection.Close();
}
private void bGlobals_Click(object sender, EventArgs e) {
mode=Mode.Globals;
Redraw();
}
private void bMapVars_Click(object sender, EventArgs e) {
mode=Mode.MapVars;
Redraw();
}
private void bSGlobals_Click(object sender, EventArgs e) {
mode=Mode.SGlobals;
Redraw();
}
private void bArrays_Click(object sender, EventArgs e) {
mode=Mode.Arrays;
Redraw();
}
private void bCritters_Click(object sender, EventArgs e) {
mode=Mode.Critters;
Redraw();
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
int[] array=null;
DataTypeSend dts;
switch(mode) {
case Mode.Globals:
array=connection.Globals;
dts=DataTypeSend.SetGlobal;
break;
case Mode.MapVars:
array=connection.MapVars;
dts=DataTypeSend.SetMapVar;
break;
case Mode.SGlobals:
array=connection.sGlobals;
dts=DataTypeSend.SetSGlobal;
break;
default:
return;
}
if(e.ColumnIndex==2) {
int val;
if(!int.TryParse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out val)) {
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=array[e.RowIndex];
} else {
array[e.RowIndex]=val;
connection.WriteDataType(dts);
connection.WriteInt(e.RowIndex);
connection.WriteInt(val);
}
} else {
float val;
if(!float.TryParse(dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out val)) {
dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=array[e.RowIndex];
} else {
array[e.RowIndex]=converter.GetAsInt(val);
connection.WriteDataType(dts);
connection.WriteInt(e.RowIndex);
connection.WriteInt(converter.GetAsInt(val));
}
}
}
private void bEdit_Click(object sender, EventArgs e) {
if(dataGridView1.SelectedRows.Count!=1) return;
int i=dataGridView1.SelectedRows[0].Index;
switch(mode) {
case Mode.Arrays: {
DataType[] types=new DataType[connection.ArrayLengths[i]];
string[] strings=new string[connection.ArrayLengths[i]];
connection.WriteDataType(DataTypeSend.GetArray);
connection.WriteInt(i);
for(int j=0;j<strings.Length;j++) types[j]=(DataType)connection.ReadInt();
byte[] buf=connection.ReadBytes(connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
MemoryStream ms=new MemoryStream(buf);
BinaryReader br=new BinaryReader(ms);
for(int j=0;j<strings.Length;j++) {
ms.Position=j*connection.ArrayDataSizes[i];
switch(types[j]) {
case DataType.Int:
strings[j]=br.ReadInt32().ToString();
break;
case DataType.Float:
strings[j]=br.ReadSingle().ToString();
break;
case DataType.String:
byte[] bytes=br.ReadBytes(connection.ArrayDataSizes[i]);
strings[j]=System.Text.Encoding.ASCII.GetString(bytes, 0, Array.IndexOf<byte>(bytes, 0));
break;
}
}
br.Close();
strings=EditorWindow.ShowEditor(null, types, strings);
if(strings!=null) {
connection.WriteDataType(DataTypeSend.SetArray);
connection.WriteInt(i);
ms=new MemoryStream(connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
BinaryWriter bw=new BinaryWriter(ms);
for(int j=0;j<strings.Length;j++) {
ms.Position=j*connection.ArrayDataSizes[i];
switch(types[j]) {
case DataType.Int:
bw.Write(int.Parse(strings[j]));
break;
case DataType.Float:
bw.Write(float.Parse(strings[j]));
break;
case DataType.String:
byte[] bytes=System.Text.Encoding.ASCII.GetBytes(strings[j]);
if(bytes.Length<connection.ArrayDataSizes[i]) bw.Write(bytes);
else bw.Write(bytes, 0, connection.ArrayDataSizes[i]-1);
bw.Write(0);
break;
}
}
connection.WriteBytes(ms.GetBuffer(), 0, connection.ArrayLengths[i]*connection.ArrayDataSizes[i]);
bw.Close();
}
}
break;
case Mode.Critters: {
DataType[] types=new DataType[29];
string[] strings=new string[29];
string[] names=new string[29];
connection.WriteDataType(DataTypeSend.RetrieveCritter);
connection.WriteInt(i);
BinaryReader br=new BinaryReader(new System.IO.MemoryStream(connection.ReadBytes(29*4)));
for(int j=0;j<29;j++) {
types[j]=DataType.Int;
strings[j]=br.ReadInt32().ToString();
names[j]="0x"+(j*4).ToString("x");
}
br.Close();
names[1]="Tile";
names[10]="Elevation";
names[11]="Inventory count";
names[13]="Inventory pointer";
names[16]="Current AP";
names[17]="Crippled limbs";
names[22]="HP";
names[23]="Rads";
names[24]="Poison";
names[25]="Proto ID";
strings=EditorWindow.ShowEditor(names, types, strings);
if(strings!=null) {
MemoryStream ms=new MemoryStream(29*4);
BinaryWriter bw=new BinaryWriter(ms);
for(int j=0;j<29;j++) bw.Write(int.Parse(strings[j]));
connection.WriteDataType(DataTypeSend.SetCritter);
connection.WriteInt(i);
connection.WriteBytes(ms.GetBuffer(), 0, 29*4);
bw.Close();
}
}
break;
}
}
}
}
@@ -129,7 +129,4 @@
<metadata name="Column3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="redrawTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
@@ -3,9 +3,7 @@ using System.Net.Sockets;
using System.IO;
namespace FalloutClient {
class EditorConnection
{
class EditorConnection {
private TcpClient client;
private NetworkStream stream;
private BinaryReader br;
@@ -13,81 +11,73 @@ namespace FalloutClient {
public readonly int[] Globals;
public readonly int[] MapVars;
public readonly uint[,] Critters;
public readonly uint[] Critters;
public readonly ulong[] SGlobalKeys;
public readonly int[] sGlobals;
public readonly uint[] Arrays;
public readonly int[] ArrayLengths;
public readonly int[] ArrayFlag;
public readonly bool[] ArrayIsMap;
public readonly int[] ArrayDataSizes;
public EditorConnection() {
System.Threading.Thread.Sleep(1000);
client = new TcpClient("127.0.0.1", 4245);
stream = client.GetStream();
br = new BinaryReader(stream);
bw = new BinaryWriter(stream);
Globals = new int[br.ReadInt32()];
MapVars = new int[br.ReadInt32()];
SGlobalKeys = new ulong[br.ReadInt32()];
sGlobals = new int[SGlobalKeys.Length];
Arrays = new uint[br.ReadInt32()];
ArrayLengths = new int[Arrays.Length];
ArrayFlag = new int[Arrays.Length];
ArrayIsMap = new bool[Arrays.Length];
Critters = new uint[br.ReadInt32(), 2];
client=new TcpClient("127.0.0.1", 4245);
stream=client.GetStream();
br=new BinaryReader(stream);
bw=new BinaryWriter(stream);
Globals=new int[br.ReadInt32()];
MapVars=new int[br.ReadInt32()];
SGlobalKeys=new ulong[br.ReadInt32()];
sGlobals=new int[SGlobalKeys.Length];
Arrays=new uint[br.ReadInt32()];
ArrayLengths=new int[Arrays.Length];
ArrayDataSizes=new int[Arrays.Length];
Critters=new uint[br.ReadInt32()];
for (int i = 0; i < Globals.Length; i++) Globals[i] = br.ReadInt32();
for (int i = 0; i < MapVars.Length; i++) MapVars[i] = br.ReadInt32();
for (int i = 0; i < sGlobals.Length; i++) {
SGlobalKeys[i] = br.ReadUInt64();
sGlobals[i] = br.ReadInt32();
for(int i=0;i<Globals.Length;i++) Globals[i]=br.ReadInt32();
for(int i=0;i<MapVars.Length;i++) MapVars[i]=br.ReadInt32();
for(int i=0;i<sGlobals.Length;i++) {
SGlobalKeys[i]=br.ReadUInt64();
sGlobals[i]=br.ReadInt32();
br.ReadInt32();
}
for (int i = 0; i < Arrays.Length; i++) {
Arrays[i] = br.ReadUInt32();
ArrayIsMap[i] = (br.ReadInt32() != 0);
ArrayLengths[i] = br.ReadInt32();
ArrayFlag[i] = br.ReadInt32();
}
for (int i = 0; i < Critters.Length / 2; i++) {
Critters[i, 0] = br.ReadUInt32();
Critters[i, 1] = br.ReadUInt32();
for(int i=0;i<Arrays.Length;i++) {
Arrays[i]=br.ReadUInt32();
ArrayLengths[i]=br.ReadInt32();
ArrayDataSizes[i]=br.ReadInt32();
}
for(int i=0;i<Critters.Length;i++) Critters[i]=br.ReadUInt32();
}
public void Close() {
stream.Close();
client.Close();
stream = null;
client = null;
stream=null;
client=null;
}
public void WriteDataType(DataTypeSend type) {
stream.WriteByte((byte)type);
//bw.Write((byte)type);
}
public void WriteByte(byte b) { bw.Write(b); }
public void WriteInt16(short value) { bw.Write(value); }
public void WriteInt(int value) { bw.Write(value); }
public void WriteBytes(byte[] buf) { bw.Write(buf); }
public void WriteBytes(byte[] buf, int start, int len) {
bw.Write(buf, start, len);
}
public void Read(byte[] buffer) {
int upto = 0;
while (upto < buffer.Length) {
upto += stream.Read(buffer, upto, buffer.Length - upto);
int upto=0;
while(upto<buffer.Length) {
upto+=stream.Read(buffer, upto, buffer.Length-upto);
}
}
public void Read(byte[] buffer, int offset, int length) {
int upto = 0;
int upto=0;
//System.Diagnostics.Debug.WriteLine("Read - offset: "+offset+" length: "+length);
while (upto < length) {
upto += stream.Read(buffer, offset + upto, length - upto);
while(upto<length) {
upto+=stream.Read(buffer, offset+upto, length-upto);
}
}
public int ReadByte() {
@@ -29,14 +29,13 @@
this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.checkBox = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
this.SuspendLayout();
//
// bSave
//
this.bSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.bSave.Location = new System.Drawing.Point(12, 336);
this.bSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bSave.Location = new System.Drawing.Point(281, 265);
this.bSave.Name = "bSave";
this.bSave.Size = new System.Drawing.Size(75, 23);
this.bSave.TabIndex = 0;
@@ -47,7 +46,7 @@
// bCancel
//
this.bCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.bCancel.Location = new System.Drawing.Point(371, 336);
this.bCancel.Location = new System.Drawing.Point(200, 265);
this.bCancel.Name = "bCancel";
this.bCancel.Size = new System.Drawing.Size(75, 23);
this.bCancel.TabIndex = 1;
@@ -59,77 +58,49 @@
//
this.dataGridView1.AllowUserToAddRows = false;
this.dataGridView1.AllowUserToDeleteRows = false;
this.dataGridView1.AllowUserToResizeRows = false;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeight = 22;
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.Column1,
this.Column2,
this.Column3});
this.dataGridView1.Location = new System.Drawing.Point(12, 12);
this.dataGridView1.MultiSelect = false;
this.dataGridView1.Name = "dataGridView1";
this.dataGridView1.RowHeadersVisible = false;
this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
this.dataGridView1.Size = new System.Drawing.Size(434, 318);
this.dataGridView1.Size = new System.Drawing.Size(344, 247);
this.dataGridView1.TabIndex = 2;
this.dataGridView1.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellEndEdit);
//
// Column1
//
this.Column1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.Column1.HeaderText = "Element";
this.Column1.HeaderText = "Name";
this.Column1.Name = "Column1";
this.Column1.ReadOnly = true;
this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
//
// Column2
//
this.Column2.HeaderText = "Type";
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
this.Column2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Column2.Width = 75;
//
// Column3
//
this.Column3.HeaderText = "Value";
this.Column3.Name = "Column3";
this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
this.Column3.Width = 150;
//
// checkBox
//
this.checkBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBox.AutoSize = true;
this.checkBox.Location = new System.Drawing.Point(103, 341);
this.checkBox.Name = "checkBox";
this.checkBox.Size = new System.Drawing.Size(91, 17);
this.checkBox.TabIndex = 3;
this.checkBox.Text = "Values in Hex";
this.checkBox.UseVisualStyleBackColor = true;
this.checkBox.Click += new System.EventHandler(this.checkBox_Click);
//
// EditorWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(458, 371);
this.Controls.Add(this.checkBox);
this.ClientSize = new System.Drawing.Size(368, 300);
this.Controls.Add(this.dataGridView1);
this.Controls.Add(this.bCancel);
this.Controls.Add(this.bSave);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MinimumSize = new System.Drawing.Size(300, 200);
this.Name = "EditorWindow";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Edit Values";
this.Text = "EditorWindow";
((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -141,6 +112,5 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
private System.Windows.Forms.CheckBox checkBox;
}
}
+56
View File
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace FalloutClient {
public enum DataType : int { None=0, Int=1, Float=2, String=3 }
public partial class EditorWindow : Form {
private readonly DataType[] types;
private readonly string[] values;
private bool save;
private EditorWindow(string[] names, DataType[] types, string[] values) {
this.types=types;
this.values=values;
InitializeComponent();
dataGridView1.SuspendLayout();
if(names==null) for(int i=0;i<types.Length;i++) dataGridView1.Rows.Add(i.ToString(), types[i].ToString(), values[i]);
else for(int i=0;i<types.Length;i++) dataGridView1.Rows.Add(names[i], types[i].ToString(), values[i]);
dataGridView1.ResumeLayout();
}
public static string[] ShowEditor(string[] names, DataType[] types, string[] values) {
EditorWindow editor=new EditorWindow(names, types, values);
editor.ShowDialog();
if(editor.save) return editor.values;
else return null;
}
private bool CheckInput(DataType type, string str) {
switch(type) {
case DataType.Int:
int i;
return int.TryParse(str, out i);
case DataType.Float:
float f;
return float.TryParse(str, out f);
}
return true;
}
private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) {
string str=(string)dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
if(CheckInput(types[e.RowIndex], str)) values[e.RowIndex]=str;
else dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value=values[e.RowIndex];
}
private void bCancel_Click(object sender, EventArgs e) {
Close();
}
private void bSave_Click(object sender, EventArgs e) {
save=true;
Close();
}
}
}
@@ -9,28 +9,13 @@
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FalloutClient</RootNamespace>
<AssemblyName>FalloutDebug</AssemblyName>
<AssemblyName>FalloutClient</AssemblyName>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>false</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -42,14 +27,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@@ -79,18 +62,6 @@
<DependentUpon>EditorWindow.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
@@ -100,7 +71,6 @@
</Target>
-->
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
<PostBuildEvent>copy "$(TargetPath)" "C:\Games\Fallout2\$(TargetName)$(TargetExt)"</PostBuildEvent>
</PropertyGroup>
</Project>
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SfallDebugEditor", "SfallDebugEditor.csproj", "{80ED0DCE-100E-4EC9-A79D-2FBFA4CAD1E3}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MPClient", "MPClient.csproj", "{80ED0DCE-100E-4EC9-A79D-2FBFA4CAD1E3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+28
View File
@@ -0,0 +1,28 @@
using System;
using System.Windows.Forms;
using System.IO;
namespace FalloutClient {
static class Program {
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if(args.Length==1&&args[0]=="-debugedit") {
Application.Run(new DebugEditor(new EditorConnection()));
} else {
throw new Exception("Multiplayer is no longer supported");
}
}
}
enum DataTypeSend {
Mouse=0, LMouseDown=1, LMouseUp=2, RMouseDown=3, RMouseUp=4, TakeChar=5, ReleaseChar=6,
SetGlobal=0, SetMapVar=1, RetrieveCritter=2, SetCritter=3, SetSGlobal=4, GetArray=9, SetArray=10,
Exit=254
}
}

Some files were not shown because too many files have changed in this diff Show More