Commit Graph
100 Commits
Author SHA1 Message Date
Asdow dcf202990f Remove duplicate header includes 2025-01-05 17:08:02 +02:00
Asdow db40cd433e Move mapscreen bottom coordinates' initialization
Fixes radar map's initial  position in strategic screen being in the top right corner.
2025-01-05 17:08:02 +02:00
Asdow 3cfde817ba Set table mouse_region priorities lower than bookmark bar 2024-12-30 21:21:30 +02:00
Asdow 4ed7b1fb98 Increase selection window size 2024-12-25 22:03:03 +02:00
Asdow 5499d1fba2 Whitespace formatting 2024-12-25 22:03:03 +02:00
Asdow 22af6e8ec8 Implement mousewheel scroll for selection window 2024-12-25 22:03:03 +02:00
Asdow a9ab60e5e5 Fix road tiles for big maps 2024-12-25 17:35:11 +02:00
Asdow c30b1c1b25 Reimplement UB pricing for AIM 2024-12-24 22:48:41 +02:00
Asdow 5b966b4df9 Provide MAX_TACTICAL_ENEMIES to lua 2024-12-24 00:16:09 +02:00
Asdow eb7837bc3e Increase filename buffer length
The mapeditor filedialog is big enough to show longer filenames than 20 characters.
2024-12-23 20:45:48 +02:00
Asdow c88fbbe749 Fix assertion error due to too long filenames 2024-12-23 20:45:48 +02:00
Asdow a580052e40 Read new tags
Maybe *this* time it'll finally be fixed. Sigh...
2024-12-23 19:26:37 +02:00
Asdow 7fa8ff930b Remove unused tag
PercentCounterForceFrequency is never read from items.xml and INVTYPE doesn't have a field for it either
2024-12-22 00:08:45 +02:00
Asdow c7d021f5f3 Read updated items.xml format
Requires accompanying GameDir change.

Removed ItemFlag as an xml tag and added  bitmask flags as their own individual tags. Makes modding easier when the flags can be modified without math in the xml files
2024-12-22 00:08:45 +02:00
AsdowandGitHub dcde413b7b Initialize AI morale to normal instead of hopeless (#345) 2024-12-05 23:05:50 +02:00
Asdow febb283c3a Allow bloodcats in RED state to roam farther
Bloodcat lair had a few cats with CLOSE PATROL orders, resulting them to move only 15 tiles from their starting point, allowing them to be picked off from afar with scoped rifles.
2024-12-05 22:56:57 +02:00
Asdow 678ef822ca Fix passive bloodcats 2024-12-05 22:56:57 +02:00
AsdowandGitHub 1eff9f6aaa Fix bloodcat ambush endless loop (#343)
Some bloodcats during ambushes could have ubInsertionDirection with values > 100, which then causes endless looping in pathfinding algorithms as valid direction values range from 0 to 7
2024-12-05 16:13:09 +02:00
AsdowandGitHub 11bb0f741f Fix music playing when crepitus is present (#341)
UseCreatureMusic( HostileZombiesPresent() ); was overriding the music mode set in PrepareCreaturesForBattle() when encountering crepitus or being in the creature caves, resulting in regular tense and battle music being played.
2024-12-02 01:10:58 +02:00
AsdowandGitHub 1cd94cda23 Fix inventory cloning bug (#338)
- If we have a sector already loaded (eg. Drassen airport)
- Squad in a different sector encounters enemies and goes to autoresolve
- After pressing DONE in autoresolve screen -> we miss calling the TrashWorld() function in CheckAndHandleUnloadingOfCurrentWorld() due to battle sector not being the same as loaded sector.
- Selected sector gets reset from Drassen airport to invalid values by same function
- Now we have the loaded sector's whole inventory existing in gWorldItems
 - Enter any other sector in tactical mode and the gWorldItems gets added into its sector inventory in EnterSector()

Because the TrashItems() work in a way where it only sets gWorldItems elements to not existing if it finds them in a loaded map's structure data, we will pretty much always have that original bugged out set of items present in gWorlItems and they will constantly be added to sector inventories from then on once the bug has been triggered.
2024-11-16 16:05:14 +02:00
AsdowandGitHub f48fadb802 Improve AbstractXMLParser error reporting (#330)
The more detailed error message that used to go only to Livelog.txt is now also displayed in the ingame error screen, providing more helpful error message to players when making bug reports/asking for help
2024-11-08 23:50:52 +02:00
AsdowandGitHub 8040c5d826 Use functions for logging load & save game times (#328)
Less copy and paste. Allows these very simple timings to be logged from elsewhere as well.
2024-10-04 17:29:47 +03:00
AsdowandGitHub 93e89798ec Merc can be assigned to patient in well-fed state (#327)
Previously merc had to be in overfed state for both food and water
2024-10-02 21:24:02 +03:00
AsdowandGitHub 49a119e6b9 Convert INVTYPE boolean fields to flagmask (#325)
Rearranged fields from largest to smallest to remove alignment padding
2024-08-22 08:48:29 +03:00
AsdowandGitHub ce02a488f0 Remove sleep() (#324)
Near instantaneous program exit when we let the CPU do its thing :)
2024-08-15 00:50:13 +03:00
AsdowandGitHub caa02cd6b7 Read new MercOpinions.xml format (#323)
Requires accompanying gameDir change.

MercOpinions.xml now only contains opinions that are not 0. A new tag with fields "id" and "modifier" are used instead of old ones that had 255 <Opinion%d> $value$ </Opinion%d> tags for all profiles.

Loading time of MercOpinions.xml went down from ~4.047 s to 0.011 s due to this change with default 1.13 VFS config.

A small cmd utility tool for converting existing MercOpinions.xml data into the new format is available at https://github.com/Asdow/JA2-ConvertXMLData/tree/master
2024-08-13 00:29:48 +03:00
AsdowandGitHub 3391c6d777 Ignore mercs away on minievents for food status updates (#322) 2024-08-11 13:30:49 +03:00
AsdowandGitHub 2307508a85 Use auto & to prevent an unnecessary copy (#321) 2024-08-10 21:56:35 +03:00
AsdowandGitHub a26845b608 Check that a dropped backpack belongs to a controllable merc (#320)
Fixes handle BP pickup behavior if a merc drops a backpack and then leaves the sector.
2024-08-10 20:14:15 +03:00
AsdowandGitHub f7f214f347 Fix CTD (#304)
Fix illegal array access when creating an IMP and the help texts are referenced.
With the missing comma, the array length was 5 and it's supposed to be 6.
2024-05-25 20:59:00 +03:00
AsdowandGitHub bf01f87cb4 Revert "Cache result of evaluating strategicmap.lua (#32)" (#293)
This reverts commit 8f22d13fd9.
2024-03-16 13:00:04 +02:00
AsdowandGitHub 9dfbc7d394 Use correct gridno for XY conversion (#289) 2024-03-13 19:29:28 +02:00
AsdowandGitHub 65698284c3 Re-enable extracover check for A* (#283)
Allows smarter pathfinding for AI, only done during turnbased pathing  to alleviate its extra cost
2024-02-11 14:57:53 +02:00
AsdowandGitHub 4338b5b909 Fix AI tactical retreat (#282)
Only perform tactical traversal if pSoldier is at the map edge
2024-02-11 12:42:21 +02:00
AsdowandGitHub ef69f9b2e6 Allow enemy to retreat (#279)
This check was preventing enemies from retreating into another sector if tactical AI retreat was enabled, leading into AI deadlock every time AI_ACTION_RUNAWAY was the decision.
2024-02-11 00:27:14 +02:00
AsdowandGitHub 28a4db0355 Guard against nullptr dereference (#278)
Encountered a situation where a pSoldier between bFirstID and bLastID was null and then we'd dereference it.
2024-02-10 17:18:19 +02:00
AsdowandGitHub d296789929 LOBOT: enemies wear pistol holsters (by Seven) (#271) 2024-01-30 22:53:19 +02:00
AsdowandGitHub 0910dba472 Revert "Disable AI logging by default" (#270)
This reverts commit 5a74323d1f.
2024-01-30 11:44:00 +02:00
AsdowandGitHub bb63cb9aa3 Merge pull request #268 from 1dot13/custom-music
Allow custom music to be added
2024-01-29 21:50:08 +02:00
Asdow a80fea00e2 Rename 2nd original battle music
If "Battle B" music file is found, use it instead of tensor B for the second original battle music. Allows us to replace either the enemy present or battle version of the same track instead of always both when "tensor B" is replaced.
2024-01-29 21:39:13 +02:00
Asdow e93dc3fb6d Allow separate enemy present & battle music for nighttime
Defaults to regular enemypresent and battle music if no nighttime music tracks are found
2024-01-29 21:37:05 +02:00
Asdow 51c3967c42 Smarter string formatting
Accept filenames with two digit running number
2024-01-29 21:37:05 +02:00
Asdow 2697a17010 Check if pSoldier is null
Prevent nullptr dereference in AI logging function
2024-01-28 11:16:41 +02:00
Asdow 5a74323d1f Disable AI logging by default
We only want this on when specifically debugging/working on AI.
2024-01-28 11:16:41 +02:00
Asdow 7546a23d0d Allow custom music to be added
Additional music can be added by placing sound files into Dataa/Music folder following this naming convention

musicmode_runningNumber.fileformat, so for example:

Mainmenu_001.mp3
Mainmenu_002.ogg
Laptop_002.ogg
Tactical_003.wav

*****************************************************************
Different musicmodes are

Mainmenu_ 		<-- Mainmenu music
Laptop_ 		<-- Laptop music
Tactical_		<-- Tactical with nothing special going on
Enemy_			<-- Tactical, enemy present
Battle_			<-- Tactical, enemy present and visible
Victory_		<-- Tactical, battle victory
Death_			<-- Tactical, battle defeat
Creepy_			<-- Tactical, creatures present
CreepyBattle_	<-- Tactical, creatures present and visible

Music files can be .mp3, .ogg or .wav formats and 100 songs in each category is supported.
The running numbering starts from 000

*****************************************************************
A few filenames are treated in a special way to facilitate easy replacement of original music.
To replace original music, insert the following named files into this folder

"menumix1"			<-- Mainmenu music
"marimbad 2"		<-- Laptop music
"nothing A"			<-- Tactical with nothing special going on
"nothing B"
"nothing C"
"nothing D"
"tensor A"			<-- Tactical, enemy present
"tensor B"
"tensor C"
"triumph"
"death"
"battle A"			<-- Tactical, enemy present and visible
"tensor B"			<-- This file is also used as battle music
"creepy"			<-- Tactical, creatures present
"creature battle"	<-- Tactical, creatures present and visible
2024-01-27 14:29:51 +02:00
AsdowandGitHub c7bd75b60d Merc arrival location fix (#263)
* User center insertion point for merc arrival

instead of initial arrival gridno that is meant only for the very first helidrop arrival at the start of a game.

* Prevent possible nullptr dereference
2024-01-24 00:35:39 +02:00
AsdowandGitHub 57bf3d9fa7 Call RemovePlayerFromGroup instead of RemoveGroup (#260)
There was a bug in a provided save where a merc's group had persistent flag set, even though the assignment was DRILL_MILITIA, which should never have a persistent group. When the code was calling RemoveGroup instead of RemovePlayerFromGroup at this point, it would crash the game with an assertion error in CancelEmptyPersistentGroupMovement() as the group in fact was not empty! Now we're removing the merc first and then checking if the group is empty and if so, attempt to delete it.
2024-01-03 00:39:44 +02:00
AsdowandGitHub 62dd0914fc Allocate one INT8 for ZStripInfo pbZChange (#256)
Fixes assertion errors in DEBUG build when LOBOT is enabled.
2023-12-24 17:29:01 +02:00
AsdowandGitHub 3d5294003a Copy drag info to dummy soldier (#255)
Fixes merc location shifted by one tile during loading a save when A* pathfinding is enabled
2023-12-24 13:48:21 +02:00
AsdowandGitHub f88b07b99b Fix loading item temp files (#245)
Call PruneWorldItems() before sectorinfo gets written to the save file.
Resetting the SF_ITEM_TEMP_FILE_EXISTS  would not transfer correctly into the save file.
2023-10-22 14:52:21 +03:00
Asdow 3f7b35c1a1 Delete JA2Prototypes.h 2023-10-21 15:38:31 +03:00
Asdow 153eb5fb10 Delete JA2 Demo Ads.h 2023-10-21 15:38:31 +03:00
Asdow f5f3bb94de Remove Install & RegInst .cpp and .h
Unused
2023-10-21 15:38:31 +03:00
Asdow 58a682db89 Remove flic.cpp & h
Not used anywhere and even inside the .cpp functions such as FlicPlay() had everything commented out and replaced with "return 1"
2023-10-21 15:38:31 +03:00
Asdow 2849590ef2 Remove readdir.cpp & h
Unused
2023-10-21 15:38:31 +03:00
Asdow 5b635784cd Remove FileCat.cpp & .h
Not used anywhere in the code.
Moved ChompSlash from FileCat.cpp to image.cpp, as the only two references besides ones in filecat.cpp for the function were in there. The references are inside an #ifdef 0 block so they are not compiled currently, but this should prevent them from not working IF we ever enable them
2023-10-21 15:38:31 +03:00
Asdow d43a597423 Remove commented out ifdefs 2023-10-21 15:38:31 +03:00
Asdow 5a7ef1930f Remove unused defines 2023-10-21 15:38:31 +03:00
Asdow 1483f15832 Remove unused globals 2023-10-21 15:38:31 +03:00
Asdow db0787b5a3 Remove unused functions
GetFreeSpaceOnHardDriveWhereGameIsRunningFrom()
GetFreeSpaceOnHardDrive()
FileReadLine() <- non VFS version
DoesUserHaveEnoughHardDriveSpace()
2023-10-21 15:38:31 +03:00
Asdow b7f974f41b Remove unused AddSubdirectoryToPath() & FileIsOlderThanFile() 2023-10-21 15:38:31 +03:00
Asdow c07f3f460b Remove unused autosave and filetime functions 2023-10-21 15:38:31 +03:00
Asdow eff1ccfe63 Remove unused functions
FileDebug()
DirectoryExists()
FileCopy()
FileMove()
2023-10-21 15:38:31 +03:00
Asdow 62b8d272e6 Remove GetHandleToRealFile() 2023-10-21 15:38:31 +03:00
Asdow 6c0b62cb42 Remove W32toSGPFileFind() 2023-10-21 15:38:31 +03:00
Asdow 02f733ce2f Remove CreateFileHandle() & DestroyFileHandle() 2023-10-21 15:38:31 +03:00
AsdowandGitHub 8f454e2aab Container.cpp & .h delete (#242)
* Remove GetFilesInDirectory()
* Remove BuildFileDirectory
* Remove container.cpp & .h

Not used in the code
2023-10-20 21:30:39 +03:00
AsdowandGitHub a47ed9ed55 Correct for loop end condition (#241) 2023-10-19 19:08:39 +03:00
AsdowandGitHub 5ec08231a3 Match new with delete (#238)
Only applicable if we actually fail to create a vsurface
2023-10-10 23:37:11 +03:00
AsdowandGitHub 7483829c65 Merge pull request #236 from 1dot13/container
Remove use of Container.cpp in vsurface, dialogue and event systems
2023-10-10 23:02:49 +03:00
Asdow d6a3a27b58 Address review feedback
* Dialogue control.cpp
* vsurface.cpp
* Event pump.cpp
2023-10-10 19:53:19 +03:00
Asdow f00214d00d Use std::queue and std::vector in event system
instead of old custom code from container.cpp

* Removed initialize and shutdown event manager calls from Init.cpp as they were only used to create and destroy the old HLIST globals

* Moved code from Event Manager.cpp to Event Pump.cpp as the event queue system is only used in said file.

* Removed now useless event manager.cpp and .h files
2023-10-09 23:07:54 +03:00
Asdow 029af63eb8 Remove unused global 2023-10-09 23:01:49 +03:00
Asdow d3b4874af0 Remove unused global 2023-10-09 23:01:49 +03:00
Asdow 8525d3f869 Use std::vector for HVSURFACE->RegionList
Replaces the use of old custom list implementation in container.cpp
2023-10-09 23:01:33 +03:00
AsdowandGitHub 48722f26d6 Merge pull request #237 from 1dot13/remove-novfs-ifdefs
Remove ifdefs related to USE_VFS
2023-10-08 18:53:35 +03:00
Asdow 5a922e3a42 Remove useless function 2023-10-08 16:48:18 +03:00
Asdow f11534e792 Remove orphan function declaration 2023-10-08 16:47:38 +03:00
Asdow f5e0d0bbd8 Remove useless function 2023-10-08 16:47:13 +03:00
Asdow 74a25a2069 Remove empty function 2023-10-08 16:46:36 +03:00
Asdow 0b5f14a3ad Remove empty function 2023-10-08 16:46:01 +03:00
Asdow 4b1de56b01 Remove #ifdefs for USE_VFS 2023-10-08 16:45:06 +03:00
Asdow 56a55f1bc4 Use std::queue instead of old custom queue
implemented in container.cpp
2023-10-07 18:53:39 +03:00
AsdowandGitHub b8a870df02 Reduce code duplication (#233)
* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Add direction utility function

We have a lot of places in the code that calculate direction based on center cell coordinates, but lack a utility function for it similar to other direction methods.

* Use utility function for calculating direction

* Use ConvertGridNoToCenterCellXY

* Use utility function for direction

* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY

* Remove CenterX & CenterY functions

Use ConvertGridNoToCenterCellXY instead

* Remove CenterX & CenterY calls from UB configuration

* Address review feedback

* Remove duplicate function

ConvertGridNoToCenterCellXY and ConvertMapPosToWorldTileCenter do the exact same thing

* Use PythSpacesAway instead of GetRangeFromGridNoDiff

Both functions calculate the same thing

* Remove GetRangeFromGridNoDiff

* Remove calls to abs()

The values end up being squared anyways making these unnecessary
2023-10-07 15:14:15 +03:00
AsdowandGitHub fc5573f73d Correct check for stance (#222)
Same issue as in commit 23ceb0f
2023-09-05 18:57:40 +03:00
AsdowandGitHub 23ceb0fa4c Fix bug in OCTH prone CTH calculation (by Seven) (#221)
GetToHitBonus() expects BOOLEAN for fProneStance argument, with no comparison to ANIM_PRONE, the ubEndHeight ends up adding bipod bonuses to *all* stances
2023-09-05 17:33:42 +03:00
AsdowandGitHub 43c6943399 Don't modify gMAXITEM_READ when reading localized file (#198) 2023-08-04 14:25:35 +03:00
AsdowandGitHub 52ccc7cc3c Fix widescreen UI militia popup box y-coordinate (#196) 2023-08-04 13:45:54 +03:00
AsdowandGitHub d14c92e2a9 Add /lib/ folder to gitignore (#188) 2023-07-27 12:07:35 +03:00
AsdowandGitHub 0decb14856 Prevent endless clock (#186)
Stop AI from attempting to steal a weapon that has a sling attachment, which prevents stealing. (by Seven)
2023-07-26 10:18:13 +03:00
AsdowandGitHub 2163a66169 Prevent writing past array capacity (#185)
Game would crash with stack-based buffer overrun when a MOLLE item had enough attachments and their texts were written past attachString capacity
2023-07-25 14:19:30 +03:00
AsdowandGitHub c036160959 fix radarmap drawing in tactical inventory view (#177)
720p resolution with 10 man squads had radarscreen rendered in a wrong location
2023-07-14 07:56:27 +03:00
AsdowandGitHub 82aa1a6f7d Fix bug that prevented arms dealer inventory from restocking (#169)
if (numTotalItems.count(usItemIndex) == 1 ) would prevent dealers to reorder items if their current stock was zero
2023-06-22 15:59:27 +03:00
AsdowandGitHub 2571979f8a Fix message box text drawing in 720p when map inventory is up (#168)
Old 720p resolution had character inventory drawn over the message box so messages were hidden when inventory is up. New widescreen UI is similar to all the other higher resolutions where this is not the case anymore.
2023-06-12 14:47:24 +03:00
AsdowandGitHub 986d280193 Enable bigger squad sizes for 720p resolution (#160) 2023-05-28 16:32:12 +03:00
AsdowandGitHub 744e9c92ec Prevent illegal array access (#159)
When using mousewheel to switch between pages in features screen, the HandleHighLightedText() function sometimes would retain valid bHighlight index, but toggle_box_array[bHighlight] == -1, which is used to access z113FeaturesToggleText[] and would later trigger Assertion in gprintfdirty() with pFontString == NULL
2023-05-28 15:05:43 +03:00
AsdowandGitHub f2ab296b49 Display icon and tooltip for belt fed weapons (#155) 2023-05-26 08:12:55 +03:00
AsdowandGitHub 66c7fc1c8d Remove compiler warning for exceeding stack size (#154)
Use std::map & std::set instead of two 16001 elements long arrays
2023-05-25 23:36:55 +03:00
AsdowandGitHub e4e1d472fd Remove compiler warning for exceeding stack size. (#153)
* Use std::map instead of 16001 elements long array
* Remove old commented out code
2023-05-25 22:46:18 +03:00
AsdowandGitHub 35bb9a70ec Do not load language specific icon file (#146)
Unnecessary, as there is no translated text in the image files
2023-05-19 16:47:42 +03:00