118 Commits
Author SHA1 Message Date
CptMoore 936921ffc3 Test header change 2024-02-04 10:52:17 +01:00
CptMoore 910b4f4319 Test implementation change 2024-02-04 10:51:40 +01:00
CptMoore 27db22b96f Added build caching 2024-02-04 10:48:02 +01:00
CptMooreandGitHub 32cae66229 Merge pull request #275 from 1dot13/try-number-3
Another fix for new release steps
2024-02-04 08:44:53 +01:00
CptMoore b081f2af88 Another fix for new release steps 2024-02-04 08:44:12 +01:00
CptMooreandGitHub 8b02dfe66a Merge pull request #274 from 1dot13/new-artifacts-upload
Updated github actions, fix for new release steps
2024-02-04 08:20:04 +01:00
CptMoore c1e72eaab2 Updated github actions, fix for new release steps 2024-02-04 08:16:09 +01:00
CptMooreandGitHub ec1f6e651b Merge pull request #273 from 1dot13/simplified-release-steps
Simplified release steps
2024-02-04 07:35:04 +01:00
CptMooreandGitHub 082b42ef73 Simplified release github steps 2024-02-04 07:34:02 +01: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
olafwqqandGitHub fd4b531d53 Fix GetAllForticationGridNo (#259)
It was still returning gridnos as 16-bit integers.
2024-01-02 11:53:29 +02:00
olafwqqandGitHub 4d09bea13e Address two compiler warnings (#258) 2024-01-01 22:43:31 +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
Marco Antonio Jaguaribe Costaandmajcosta f11393728c Unbreak Github Actions
our CI expects GameVersion.cpp to be at the root directory. just unbreak
for now.
2023-10-23 19:28:23 -03:00
majcostaandGitHub ae55496e39 Move main executable source to its own directory (#248)
* Move main executable files to their own directory

* Adapt the build to the new file structure

... and fix some weird #include's that were relying on the project root
being an include directory.
2023-10-23 15:46:51 -03:00
Marco Antonio Jaguaribe Costaandmajcosta 5d3118ea75 pluck multiplayer into its own lib 2023-10-23 10:36:35 -03:00
majcostaandGitHub 381ab936eb Rename 'Standard Gaming Platform' to 'sgp' (#246)
* rename 'Standard Gaming Platform' to 'sgp'

* Adapt CMakeLists.txt files to renamed SGP directory

* Lowercase it
2023-10-23 10:18:20 -03: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
KittyandGitHub 8080b06be4 Merge pull request #239 from zwwooooo/master
Fixed "14POINTARIAL" font height for Chinese Version.
2023-10-15 18:21:59 +02:00
zwwooooo e6f1f40aea Fixed "14POINTARIAL" font height for Chinese Version. 2023-10-15 22:05:59 +08: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
Marco Antonio Jaguaribe Costaandmajcosta eca4086d30 inherit minimum cmake version from ja2
all this does is silence the warning that cmake 2.6 is deprecated, we're
never building bfVFS standalone anyway
2023-10-07 09:21:11 -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
Marco Antonio Jaguaribe Costaandmajcosta b68f206969 remove annoying warning on MSVC 19.37.32822
`register` keyword does exactly nothing:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/c5033?view=msvc-170
2023-10-07 09:13:55 -03:00
Andrzej FałkowskiandGitHub 8d49e74df4 Face gear render fixes (#232)
* Face gear is shaded the same as a face

* Render continue button above icons and facegear

* Face gear rendered below "hatch" (inactivity overlay)

* Consistent naming
2023-10-03 15:20:36 +03:00
Andrzej FałkowskiandGitHub 14ec138fc7 Fixed UI movement mode not switching to crawl on character collapse, leading to deadlocks (#231) 2023-10-02 19:32:15 +03:00
Andrzej FałkowskiandGitHub a3be3ecd7e Specific drug types and drug items for background and facilities. (#226) 2023-10-02 19:30:59 +03:00
Andrzej FałkowskiandGitHub 9033e1097a Radar and overhead map color variants (#219) 2023-10-02 19:30:17 +03:00
Xiaoxun92andGitHub 4ebae982dd Downgrade startup ini errors to warnings (#229) 2023-09-22 18:10:08 -07:00
sun-alfandGitHub 8a241d277d Merge pull request #228 from 1dot13/master_1dot13
[Fix] One of optimizations in (2482234e) commit is not suitable for M…
2023-09-14 00:37:04 +02:00
sun-alf 5bfd19e5a8 [Fix] One of optimizations in (2482234e) commit is not suitable for MOLLE stuff in 1.13
It is revealed, MOLLE things in 1.13 are configured in XMLs using both NAS and OAS (old attachment system) methods even if NAS is enabled in New Game Options. Given this, logic of SetAttachmentSlotsFlag() cannot be splitted onto NAS and OAS parts, and both Attachment[] and AttachmentPoints must be checked disregarding the NAS option.
2023-09-14 01:04:55 +03:00
KittyandGitHub 07591e50f5 Merge pull request #225 from zwwooooo/master
Chinese translation update(by TBS)
2023-09-11 17:07:21 +02:00
zwwooooo 556641377c Chinese translation update(by TBS) 2023-09-10 22:31:47 +08:00
zwwooooo 985dace82e Merge branch 'master' of github.com:1dot13/source 2023-09-10 22:03:41 +08:00
sun-alfandGitHub bb73a458ee Merge pull request #224 from 1dot13/master_1dot13
Master 1dot13
2023-09-10 10:21:03 +02:00
sun-alf f8637e5972 [~] Performance optimizations around Attachment[] and Launchable[] arrays
AIMNAS with its ~50K elements in Attachment[] suffered of performance drop when MOLLE stuff is in the visible inventory. To resolve it the following is done:
* Introduce gMAXATTACHMENTS_READ with actual number of elements in Attachment[]; according refactoring.
* Introduce gMAXLAUNCHABLES_READ with actual number of elements in Launchable[]; according refactoring.
* Introduce std::multimap AttachmentBackmap for quick access to attachments using itemId as a key.
* Sort Attachment[] by attachmentIndex right after loading from XML. According order in XML is not needed anymore.
* Introduce FindAttachmentRange() for quick access to attachments using attachmentId as a key (binary search in Attachment[]).
In a few words, GetHelpTextForItemInLaptop(), ValidAttachment(), SetAttachmentSlotsFlag() were heavily optimized.
2023-09-08 21:58:14 +03:00
sun-alf 4c861e441a [Fix] Revive FPS drawing overlay
To enable built-in FPS, change gbFPSDisplay to SHOW_FULL_FPS (1) in debugger (or change it in src code and rebuild).
2023-09-08 21:58:13 +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
rftrdevandGitHub 28aa73a859 Clamp coolness to valid values when generating ARC ammo cache (#220)
Fixes #217
2023-09-02 23:01:17 -07:00
KittyandGitHub cd186a2b1c Merge pull request #218 from andrzejfalkowski/loading-screens-multi-res
Loadscreen - Multiple resolutions and stretch modes
2023-09-02 16:13:52 +02:00
Andrzej Fałkowski 019b9c4907 Merge branch 'master' into loading-screens-multi-res 2023-08-31 23:29:21 +02:00
KittyandGitHub 5740a0af08 Merge pull request #214 from andrzejfalkowski/face-gear-offset-fix
Face gear offset fix
2023-08-30 19:42:55 +02:00
KittyandGitHub 9a46abe394 Merge pull request #215 from kitty624/Backgrounds
Fix character check for backgrounds during IMP creation
2023-08-30 19:40:31 +02:00
kitty624 7910be0ab7 Fix personality check for backgrounds during IMP creation 2023-08-30 19:34:30 +02:00
Andrzej Fałkowski ee3d2472e7 Removed unnecessary offset for face gear 2023-08-29 21:25:14 +02:00
Andrzej FałkowskiandGitHub 7edecd6849 Fixed vehicle body not properly removed when destroyed during ramming (#210) 2023-08-28 16:26:46 +03:00
Andrzej FałkowskiandGitHub d56288e313 Fixed incorrect vehicle group id after reloading the game and vehicle movement plot issues. (#207) 2023-08-28 16:26:34 +03:00
Andrzej FałkowskiandGitHub 3ddacf1a44 Fix vehicles consuming fuel after instant movement cancel (#213) 2023-08-28 16:26:02 +03:00
rftrdevandGitHub 8ec02b2d40 Add version info to main menu (#209) 2023-08-23 01:21:22 -07:00
rftrdevandGitHub 6bae48658e Fix personality check for backgrounds during IMP creation (#208) 2023-08-23 00:34:54 -07:00
KittyandGitHub 28a5c76775 Merge pull request #206 from kitty624/ExtraItems
Update XML.h

- added path to sub-directory for Extra Items
- to avoid cluttering up the parent directory when using this feature
- it allows to place extra items in sector via xml and based on difficulty level
- the new directory "ExtraItems" will contain more details on how-to-use
2023-08-22 00:36:01 +02:00
kitty624 1289c399ce Update XML.h
- added path to sub-directory for Extra Items
- to avoid cluttering up the parent directory when using this feature
- it allows to place extra items in sector via xml and based on difficulty level
- the new directory "ExtraItems" will contain more details on how-to-use
2023-08-22 00:22:20 +02:00
Andrzej FałkowskiandGitHub 1e1d456fd2 Prevent deadlocks due to self-healing interactive spots and self-attacking (#205) 2023-08-21 19:44:02 +03:00
Andrzej FałkowskiandGitHub 2060022e94 Battle Panel Multi Resolution (#203)
* Battle panel interface with support for multiple resolutions and scrollable list

* Support for localized versions of battle panel

* Removed commented out code

* Fixed wrong copypasta in German version
2023-08-20 20:52:34 +03:00
Andrzej Fałkowski 8f08eb15d2 Merge branch 'master' into loading-screens-multi-res 2023-08-19 23:02:54 +02:00
Andrzej Fałkowski 5400fb019d Loading screen multiple resolutions support and stretch modes, loading bar fixes 2023-08-19 22:30:57 +02:00
rftrdevandGitHub b91871b518 Move grenade bonuses from Demolitions to Throwing (#202)
* Copy grenade settings from demolitions to throwing

* Fix setting strings

* Add throwing bonuses to the same spots as demolitions

* Delete grenade bonuses from Demolitions

* Update text

* Reapply throwing check
2023-08-11 11:27:29 -07:00
rftrdevandGitHub aaeea9aac8 Replace evolution with growth rates (#201) 2023-08-09 18:36:44 -07: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
CptMooreandGitHub 200ac73f7a Merge pull request #195 from 1dot13/another-try-to-fix-latest-1
Update build.yml
2023-07-31 00:28:50 +02:00
CptMooreandGitHub 1bb8a214c9 Update build.yml 2023-07-31 00:28:42 +02:00
CptMooreandGitHub f78d91f3a3 Merge pull request #194 from 1dot13/another-try-to-fix-latest
Update build.yml
2023-07-30 23:34:09 +02:00
CptMooreandGitHub 32e49784a0 Update build.yml 2023-07-30 23:33:28 +02:00
CptMooreandGitHub 8824d32da9 Merge pull request #193 from 1dot13/correct-working-dir
Update build.yml
2023-07-30 19:23:13 +02:00
CptMooreandGitHub 2345dd0ae6 Update build.yml 2023-07-30 19:22:23 +02:00
CptMooreandGitHub cc6adb70f6 Merge pull request #191 from 1dot13/create-latest-tag-explicitly
Create latest tag explicitly
2023-07-30 09:53:06 +02:00
CptMooreandGitHub f16f137f2b Create latest tag explicitly
Apparently the github API does too much magic, lets hope removing a step will make it behave
2023-07-30 09:48:11 +02:00
zwwooooo 7383d6b3f6 Merge branch 'master' of github.com:1dot13/source 2023-05-26 15:35:00 +08:00
zwwooooo 2e5aabe615 Merge branch 'master' of github.com:1dot13/source 2023-04-12 16:44:15 +08:00
zwwooooo 0ac6c3eb2d Chinese translation update(by TBS) 2023-04-12 13:54:16 +08:00
zwwooooo 700734db10 Merge branch 'master' of github.com:1dot13/source 2023-04-12 13:49:10 +08:00
zwwooooo 7a198acdec Merge branch 'master' of github.com:1dot13/source 2023-01-11 15:24:44 +08:00
zwwooooo 62029a8ea9 Chinese translation update(by TBS) 2023-01-11 14:31:08 +08:00
340 changed files with 4599 additions and 11666 deletions
+33 -54
View File
@@ -154,7 +154,7 @@ jobs:
cat dist/versions.env cat dist/versions.env
- name: Upload - name: Upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: versions.env name: versions.env
path: dist/ path: dist/
@@ -169,6 +169,8 @@ jobs:
with: with:
language: ${{ matrix.language }} language: ${{ matrix.language }}
assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }} assemble: ${{ needs.workflow_setup.outputs.assemble_release == 'true' }}
# TODO check if English and German build faster for code changes on master, if not remove caching
build-cache-enabled: ${{ matrix.language == 'English' || matrix.language == 'German' }}
# at least English and some other lang have to work # at least English and some other lang have to work
continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }} continue-on-error: ${{ matrix.language != 'English' && matrix.language != 'German' }}
@@ -179,64 +181,41 @@ jobs:
steps: steps:
- name: Download artifacts - name: Download artifacts
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
path: artifacts path: dist
pattern: '*_release'
merge-multiple: true
- name: Move release archives to dist/ - name: Checkout Repo
shell: bash if: github.ref == 'refs/heads/master'
uses: actions/checkout@v4
with:
path: source
fetch-depth: 1
sparse-checkout: 'README.md'
- name: Create latest pre-release
if: github.ref == 'refs/heads/master'
working-directory: source
run: | run: |
set -eux gh release delete latest --cleanup-tag || true
mkdir dist/ git tag -d latest || true
mv artifacts/*_release/* dist/ git push --delete origin refs/tags/latest || true
git tag latest
- name: Delete Latest git push --force origin refs/tags/latest
if: startsWith(github.ref, 'refs/tags/v') == false gh release create latest ../dist/* \
uses: dev-drprasad/delete-tag-and-release@v1.0 --generate-notes \
with: --title "Latest (unstable)" \
tag_name: "latest" --verify-tag \
--prerelease
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: release_latest
name: Release Latest
if: startsWith(github.ref, 'refs/tags/v') == false
uses: ncipollo/release-action@v1
with:
allowUpdates: false
artifactErrorsFailBuild: true
artifacts: dist/*
draft: false
generateReleaseNotes: true
makeLatest: true
name: "Latest (unstable)"
prerelease: true
tag: "latest"
- id: release_tag - name: Upload to tagged release
name: Release Tag
uses: ncipollo/release-action@v1
if: startsWith(github.ref, 'refs/tags/v') if: startsWith(github.ref, 'refs/tags/v')
with: working-directory: source
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: dist/*
draft: false
generateReleaseNotes: true
makeLatest: true
omitBodyDuringUpdate: true
omitDraftDuringUpdate: true
omitNameDuringUpdate: true
omitPrereleaseDuringUpdate: true
- name: Show release outputs
shell: bash
run: | run: |
echo 'id: ' exit 0
echo -n '${{ steps.release_tag.outputs.id }}' gh release upload "$GITHUB_REF_NAME" ../dist/* --clobber
echo -n '${{ steps.release_latest.outputs.id }}' env:
echo '' GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
echo ''
echo 'url:'
echo -n '${{ steps.release_tag.outputs.html_url }}'
echo -n '${{ steps.release_latest.outputs.html_url }}'
echo ''
+36 -17
View File
@@ -13,6 +13,11 @@ on:
required: true required: true
default: true default: true
type: boolean type: boolean
build-cache-enabled:
description: 'enable sscache'
required: true
default: false
type: boolean
continue-on-error: continue-on-error:
description: 'allows a language to fail, used when building all languages' description: 'allows a language to fail, used when building all languages'
required: false required: false
@@ -27,13 +32,15 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor] application: [ja2, ja2mapeditor, ja2ub, ja2ubmapeditor]
env:
SCCACHE_GHA_ENABLED: ${{ inputs.build-cache-enabled }}
steps: steps:
- name: Checkout source - name: Checkout source
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Download versions.env - name: Download versions.env
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: versions.env name: versions.env
path: artifacts path: artifacts
@@ -41,6 +48,7 @@ jobs:
shell: bash shell: bash
run: cat artifacts/versions.env >> $GITHUB_ENV run: cat artifacts/versions.env >> $GITHUB_ENV
# TODO: Move this into CMake, just taking the GitHub Actions parameters as -D variables
- name: Update GameVersion.cpp - name: Update GameVersion.cpp
shell: bash shell: bash
run: | run: |
@@ -49,9 +57,9 @@ jobs:
GAME_VERSION=$(echo "$GAME_VERSION" | tr -cd '[:print:]' | tr -d '"\\') GAME_VERSION=$(echo "$GAME_VERSION" | tr -cd '[:print:]' | tr -d '"\\')
GAME_BUILD="${INPUTS_LANGUAGE:0:2} $GAME_BUILD_INFORMATION" GAME_BUILD="${INPUTS_LANGUAGE:0:2} $GAME_BUILD_INFORMATION"
GAME_BUILD=$(echo "$GAME_BUILD" | tr -cd '[:print:]' | tr -d '"\\') GAME_BUILD=$(echo "$GAME_BUILD" | tr -cd '[:print:]' | tr -d '"\\')
sed -i "s|@Version@|${GAME_VERSION:0:15}|" GameVersion.cpp sed -i "s|@Version@|${GAME_VERSION:0:15}|" Ja2/GameVersion.cpp
sed -i "s|@Build@|${GAME_BUILD:0:255}|" GameVersion.cpp sed -i "s|@Build@|${GAME_BUILD:0:255}|" Ja2/GameVersion.cpp
cat GameVersion.cpp cat Ja2/GameVersion.cpp
- name: Prepare build properties - name: Prepare build properties
shell: bash shell: bash
@@ -68,15 +76,25 @@ jobs:
JA2Application=$JA2Application JA2Application=$JA2Application
" >> $GITHUB_ENV " >> $GITHUB_ENV
- uses: microsoft/setup-msbuild@v1.1 - uses: microsoft/setup-msbuild@v2
with: with:
msbuild-architecture: x86 msbuild-architecture: x86
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
with: with:
arch: x86 arch: x86
- name: Prepare build cache
if: ${{ inputs.build-cache-enabled }}
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ inputs.language }}_${{ matrix.application }}
save: ${{ github.ref == 'refs/heads/master' }}
variant: sccache
- name: Prepare build - name: Prepare build
run: | run: >
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application" cmake -S . -B build -GNinja
-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_BUILD_TYPE=Release
-DLanguages="$Env:JA2Language" -DApplications="$Env:JA2Application"
- name: Build - name: Build
run: | run: |
cmake --build build/ -- -v cmake --build build/ -- -v
@@ -86,7 +104,7 @@ jobs:
find build/ find build/
- name: Upload - name: Upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.language }}_${{ matrix.application }} name: ${{ inputs.language }}_${{ matrix.application }}
path: build/*.exe path: build/*.exe
@@ -99,7 +117,7 @@ jobs:
steps: steps:
- name: Download versions.env - name: Download versions.env
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: versions.env name: versions.env
path: artifacts path: artifacts
@@ -108,7 +126,7 @@ jobs:
run: cat artifacts/versions.env >> $GITHUB_ENV run: cat artifacts/versions.env >> $GITHUB_ENV
- name: Checkout gamedir - name: Checkout gamedir
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: ${{ env.GAMEDIR_REPOSITORY }} repository: ${{ env.GAMEDIR_REPOSITORY }}
ref: ${{ env.GAMEDIR_COMMIT_SHA }} ref: ${{ env.GAMEDIR_COMMIT_SHA }}
@@ -116,7 +134,7 @@ jobs:
- name: Checkout gamedir-languages - name: Checkout gamedir-languages
if: inputs.language != 'English' if: inputs.language != 'English'
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }} repository: ${{ env.GAMEDIR_LANGUAGES_REPOSITORY }}
ref: ${{ env.GAMEDIR_LANGUAGES_COMMIT_SHA }} ref: ${{ env.GAMEDIR_LANGUAGES_COMMIT_SHA }}
@@ -130,25 +148,25 @@ jobs:
cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/ cp -a gamedir-languages/${{ inputs.language }}_Version/* gamedir/
- name: Download ja2 - name: Download ja2
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: ${{ inputs.language }}_ja2 name: ${{ inputs.language }}_ja2
path: artifacts/ja2 path: artifacts/ja2
- name: Download ja2mapeditor - name: Download ja2mapeditor
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: ${{ inputs.language }}_ja2mapeditor name: ${{ inputs.language }}_ja2mapeditor
path: artifacts/ja2mapeditor path: artifacts/ja2mapeditor
- name: Download ja2ub - name: Download ja2ub
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: ${{ inputs.language }}_ja2ub name: ${{ inputs.language }}_ja2ub
path: artifacts/ja2ub path: artifacts/ja2ub
- name: Download ja2ubmapeditor - name: Download ja2ubmapeditor
uses: actions/download-artifact@v3 uses: actions/download-artifact@v4
with: with:
name: ${{ inputs.language }}_ja2ubmapeditor name: ${{ inputs.language }}_ja2ubmapeditor
path: artifacts/ja2ubmapeditor path: artifacts/ja2ubmapeditor
@@ -198,7 +216,8 @@ jobs:
7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" . 7z a -bb -xr'!.*' "../dist/${DIST_NAME}.7z" .
- name: Upload - name: Upload
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.language }}_release name: ${{ inputs.language }}_release
path: dist/ path: dist/
compression-level: 0
+13 -75
View File
@@ -22,8 +22,8 @@ set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)
# TODO: build our own Lua 5.1.2 from source so we can use whichever # TODO: build our own Lua 5.1.2 from source so we can use whichever
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP USE_VFS _CRT_SECURE_NO_DEPRECATE) add_compile_definitions(CINTERFACE XML_STATIC VFS_STATIC VFS_WITH_SLF VFS_WITH_7ZIP _CRT_SECURE_NO_DEPRECATE)
include_directories(${CMAKE_SOURCE_DIR} "ext/VFS/include" Utils TileEngine TacticalAI ModularizedTacticalAI Tactical Strategic "Standard Gaming Platform" Res Lua Laptop Multiplayer "Multiplayer/raknet" Editor Console) include_directories(Ja2 "ext/VFS/include" Utils TileEngine TacticalAI "ModularizedTacticalAI/include" Tactical Strategic sgp "Ja2/Res" Lua Laptop Multiplayer Editor Console)
# external libraries # external libraries
add_subdirectory("ext/libpng") add_subdirectory("ext/libpng")
@@ -38,90 +38,28 @@ add_subdirectory("ext/export/src")
# by header files do not rely on Applications or Languages preprocessor definitions, # by header files do not rely on Applications or Languages preprocessor definitions,
# and therefore only need to be compiled once. Good. # and therefore only need to be compiled once. Good.
add_subdirectory(Lua) add_subdirectory(Lua)
add_subdirectory(Multiplayer)
# static libraries whose source files, header files or header files included # static libraries whose source files, header files or header files included
# by header files rely on Application and Language preprocessor definitions, and # by header files rely on Application and Language preprocessor definitions, and
# therefore need to be compiled multiple times. Very Bad. # therefore need to be compiled multiple times. Very Bad.
add_subdirectory(TileEngine)
add_subdirectory(TacticalAI)
add_subdirectory(Utils)
add_subdirectory(Strategic)
add_subdirectory("Standard Gaming Platform")
add_subdirectory(Laptop)
add_subdirectory(Editor)
add_subdirectory(Console)
add_subdirectory(Tactical)
add_subdirectory(ModularizedTacticalAI)
# TODO: Rename 'Standard Gaming Platform' directory to 'SGP' so this can be refactored away
set(Ja2_Libs set(Ja2_Libs
TileEngine TileEngine
TacticalAI TacticalAI
Utils Utils
Strategic Strategic
SGP sgp
Laptop Laptop
Editor Editor
Console Console
Tactical Tactical
ModularizedTacticalAI ModularizedTacticalAI
) )
foreach(lib IN LISTS Ja2_Libs)
add_subdirectory(${lib})
endforeach()
# TODO: Move these units into their own directory to declutter the root dir and CMakeLists.txt file add_subdirectory(Ja2)
set(Ja2Src
"aniviewscreen.cpp"
"Credits.cpp"
"Fade Screen.cpp"
"FeaturesScreen.cpp"
"GameInitOptionsScreen.cpp"
"gameloop.cpp"
"gamescreen.cpp"
"GameSettings.cpp"
"GameVersion.cpp"
"HelpScreen.cpp"
"Init.cpp"
"Intro.cpp"
"JA2 Splash.cpp"
"Ja25Update.cpp"
"jascreens.cpp"
"Language Defines.cpp"
"Loading Screen.cpp"
"MainMenuScreen.cpp"
"MessageBoxScreen.cpp"
"MPChatScreen.cpp"
"MPConnectScreen.cpp"
"MPHostScreen.cpp"
"MPJoinScreen.cpp"
"MPScoreScreen.cpp"
"MPXmlTeams.cpp"
"Multiplayer/client.cpp"
"Multiplayer/server.cpp"
"Multiplayer/transfer_rules.cpp"
"Options Screen.cpp"
"profiler.cpp"
"SaveLoadGame.cpp"
"SaveLoadScreen.cpp"
"SCREENS.cpp"
"Sys Globals.cpp"
"ub_config.cpp"
"XML_DifficultySettings.cpp"
"XML_IntroFiles.cpp"
"XML_Layout_MainMenu.cpp"
Res/ja2.rc
)
set(Ja2_Libraries
"${PROJECT_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
Lua
"${PROJECT_SOURCE_DIR}/lua51.lib"
"${PROJECT_SOURCE_DIR}/lua51.vc9.lib"
"Winmm.lib"
"${PROJECT_SOURCE_DIR}/SMACKW32.LIB"
"${PROJECT_SOURCE_DIR}/binkw32.lib"
bfVFS
"${PROJECT_SOURCE_DIR}/Multiplayer/raknet/RakNetLibStatic.lib"
"ws2_32.lib"
)
# simple function to validate Languages and Application choices # simple function to validate Languages and Application choices
include(cmake/ValidateOptions.cmake) include(cmake/ValidateOptions.cmake)
@@ -160,7 +98,7 @@ foreach(lang IN LISTS LangTargets)
set(isUb $<STREQUAL:${exe},JA2UB>) set(isUb $<STREQUAL:${exe},JA2UB>)
set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>) set(isUbEditor $<STREQUAL:${exe},JA2UBMAPEDITOR>)
# static library for an app/lang combination, e.g. JA2_ENGLISH_SGP.lib # static library for an app/lang combination, e.g. JA2_ENGLISH_sgp.lib
add_library(${VeryBadLib}) add_library(${VeryBadLib})
target_sources(${VeryBadLib} PRIVATE ${${lib}Src}) target_sources(${VeryBadLib} PRIVATE ${${lib}Src})
@@ -174,9 +112,9 @@ foreach(lang IN LISTS LangTargets)
target_link_libraries(${Executable} PUBLIC ${VeryBadLib}) target_link_libraries(${Executable} PUBLIC ${VeryBadLib})
endforeach() endforeach()
# for SGP only # for sgp only
target_link_libraries(${Executable}_SGP PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib") target_link_libraries(${Executable}_sgp PRIVATE "ddraw.lib" "${PROJECT_SOURCE_DIR}/fmodvc.lib")
target_link_libraries(${Executable}_SGP PUBLIC libpng) target_link_libraries(${Executable}_sgp PUBLIC libpng)
target_compile_definitions(${Executable}_SGP PRIVATE NO_ZLIB_COMPRESSION) target_compile_definitions(${Executable}_sgp PRIVATE NO_ZLIB_COMPRESSION)
endforeach() endforeach()
endforeach() endforeach()
+2 -41
View File
@@ -83,9 +83,7 @@ INT32 iCurrFileShown;
INT32 iLastFileClicked; INT32 iLastFileClicked;
INT32 iLastClickTime; INT32 iLastClickTime;
#ifdef USE_VFS
CHAR8 gzProfileName[FILENAME_BUFLEN];//dnl ch81 021213 CHAR8 gzProfileName[FILENAME_BUFLEN];//dnl ch81 021213
#endif
CHAR16 gzFilename[FILENAME_BUFLEN];//dnl ch39 190909 CHAR16 gzFilename[FILENAME_BUFLEN];//dnl ch39 190909
extern INT16 gsSelSectorX; extern INT16 gsSelSectorX;
extern INT16 gsSelSectorY; extern INT16 gsSelSectorY;
@@ -165,7 +163,6 @@ void LoadSaveScreenEntry()
} }
iTopFileShown = iTotalFiles = 0; iTopFileShown = iTotalFiles = 0;
#ifdef USE_VFS//dnl ch37 300909
gzProfileName[0] = 0;//dnl ch81 021213 gzProfileName[0] = 0;//dnl ch81 021213
FDLG_LIST* TempFileList = NULL; FDLG_LIST* TempFileList = NULL;
vfs::CProfileStack* st = getVFS()->getProfileStack(); vfs::CProfileStack* st = getVFS()->getProfileStack();
@@ -220,25 +217,6 @@ void LoadSaveScreenEntry()
} }
while(FileList->pPrev) while(FileList->pPrev)
FileList = FileList->pPrev; FileList = FileList->pPrev;
#else
if(GetFileFirst("MAPS\\*.dat", &FileInfo))
{
if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
{
FileList = AddToFDlgList(FileList, &FileInfo);
iTotalFiles++;
}
while(GetFileNext(&FileInfo))
{
if(strlen(FileInfo.zFileName) < FILENAME_BUFLEN)
{
FileList = AddToFDlgList(FileList, &FileInfo);
iTotalFiles++;
}
}
GetFileClose(&FileInfo);
}
#endif
swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" ); swprintf( zOrigName, L"%s Map (*.dat)", iCurrentAction == ACTION_SAVE_MAP ? L"Save" : L"Load" );
swprintf( gzFilename, L"%S", gubFilename ); swprintf( gzFilename, L"%S", gubFilename );
@@ -283,7 +261,8 @@ UINT32 ProcessLoadSaveScreenMessageBoxResult()
{ {
if( gfReadOnly ) if( gfReadOnly )
{ {
FileClearAttributes( gszCurrFilename ); // Other call sites have replaced this with FileDelete(); for VFS, should we do the same here?
//FileClearAttributes( gszCurrFilename );
gfReadOnly = FALSE; gfReadOnly = FALSE;
} }
FileDelete( gszCurrFilename ); FileDelete( gszCurrFilename );
@@ -468,19 +447,6 @@ UINT32 LoadSaveScreenHandle(void)
} }
sprintf(gszCurrFilename, "MAPS\\%S", gzFilename); sprintf(gszCurrFilename, "MAPS\\%S", gzFilename);
gfFileExists = FALSE; gfFileExists = FALSE;
#ifndef USE_VFS
gfReadOnly = FALSE;
if(FileExists(gszCurrFilename))
{
gfFileExists = TRUE;
if(GetFileFirst(gszCurrFilename, &FileInfo))
{
if(FileInfo.uiFileAttribs & (FILE_IS_READONLY|FILE_IS_DIRECTORY|FILE_IS_HIDDEN|FILE_IS_SYSTEM|FILE_IS_OFFLINE|FILE_IS_TEMPORARY))
gfReadOnly = TRUE;
GetFileClose(&FileInfo);
}
}
#else
gfReadOnly = TRUE; gfReadOnly = TRUE;
vfs::CProfileStack* st = getVFS()->getProfileStack(); vfs::CProfileStack* st = getVFS()->getProfileStack();
vfs::CProfileStack::Iterator it = st->begin(); vfs::CProfileStack::Iterator it = st->begin();
@@ -502,7 +468,6 @@ UINT32 LoadSaveScreenHandle(void)
} }
it.next(); it.next();
} }
#endif
if(gfReadOnly) if(gfReadOnly)
{ {
CreateMessageBox(L" File is read only! Choose a different name? "); CreateMessageBox(L" File is read only! Choose a different name? ");
@@ -726,7 +691,6 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
iLastClickTime = iCurrClickTime; iLastClickTime = iCurrClickTime;
iLastFileClicked = x; iLastFileClicked = x;
//dnl ch81 021213 //dnl ch81 021213
#ifdef USE_VFS
gzProfileName[0] = 0; gzProfileName[0] = 0;
while(FListNode = FListNode->pPrev) while(FListNode = FListNode->pPrev)
{ {
@@ -737,7 +701,6 @@ void SelectFileDialogYPos( UINT16 usRelativeYPos )
break; break;
} }
} }
#endif
break; break;
} }
FListNode = FListNode->pNext; FListNode = FListNode->pNext;
@@ -950,7 +913,6 @@ void HandleMainKeyEvents( InputAtom *pEvent )
SetInputFieldStringWith16BitString(0, L""); SetInputFieldStringWith16BitString(0, L"");
wcscpy(gzFilename, L""); wcscpy(gzFilename, L"");
} }
#ifdef USE_VFS
gzProfileName[0] = 0; gzProfileName[0] = 0;
while(curr = curr->pPrev) while(curr = curr->pPrev)
{ {
@@ -961,7 +923,6 @@ void HandleMainKeyEvents( InputAtom *pEvent )
break; break;
} }
} }
#endif
} }
} }
} }
-2
View File
@@ -51,9 +51,7 @@ extern CHAR16 gzErrorCatchString[ 256 ];
//dnl ch81 031213 //dnl ch81 031213
extern CHAR16 gzFilename[FILENAME_BUFLEN]; extern CHAR16 gzFilename[FILENAME_BUFLEN];
#ifdef USE_VFS
extern CHAR8 gzProfileName[FILENAME_BUFLEN]; extern CHAR8 gzProfileName[FILENAME_BUFLEN];
#endif
#endif #endif
#endif #endif
+2 -177
View File
@@ -1923,40 +1923,14 @@ BOOLEAN HandleSummaryInput( InputAtom *pEvent )
void CreateGlobalSummary() void CreateGlobalSummary()
{ {
#ifndef USE_VFS
FILE *fp;
STRING512 Dir;
STRING512 ExecDir;
#endif
OutputDebugString( "Generating GlobalSummary Information...\n" ); OutputDebugString( "Generating GlobalSummary Information...\n" );
gfGlobalSummaryExists = FALSE; gfGlobalSummaryExists = FALSE;
//Set current directory to JA2\DevInfo which contains all of the summary data //Set current directory to JA2\DevInfo which contains all of the summary data
#ifndef USE_VFS
GetExecutableDirectory( ExecDir );
sprintf( Dir, "%s\\DevInfo", ExecDir );
// Snap: save current directory
//GetFileManCurrentDirectory( DataDir );
//Directory doesn't exist, so create it, and continue.
if( !MakeFileManDirectory( Dir ) )
AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." );
if( !SetFileManCurrentDirectory( Dir ) )
AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." );
//Generate a simple readme file.
fp = fopen( "readme.txt", "w" );
Assert( fp );
fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.",
"This directory or it's contents shouldn't be included with final release." );
fclose( fp );
#else
vfs::COpenWriteFile wfile(L"DevInfo\\readme.txt",true,true); vfs::COpenWriteFile wfile(L"DevInfo\\readme.txt",true,true);
std::string str = "This information is used in conjunction with the editor.\n"; std::string str = "This information is used in conjunction with the editor.\n";
str += "This directory or it's contents shouldn't be included with final release.\n"; str += "This directory or it's contents shouldn't be included with final release.\n";
SGP_TRYCATCH_RETHROW( wfile->write(str.c_str(), str.length()), L"" ); SGP_TRYCATCH_RETHROW( wfile->write(str.c_str(), str.length()), L"" );
#endif
// Snap: Restore the data directory once we are finished. // Snap: Restore the data directory once we are finished.
//SetFileManCurrentDirectory( DataDir ); //SetFileManCurrentDirectory( DataDir );
@@ -2203,7 +2177,8 @@ void SummarySaveMapCallback( GUI_BUTTON *btn, INT32 reason )
{ {
CHAR8 filename[40]; CHAR8 filename[40];
sprintf( filename, "MAPS\\%S", gszDisplayName ); sprintf( filename, "MAPS\\%S", gszDisplayName );
FileClearAttributes( filename ); // Other call sites have replaced this with FileDelete(); for VFS, should we do the same here?
//FileClearAttributes( filename );
} }
if( ExternalSaveMap( gszDisplayName ) ) if( ExternalSaveMap( gszDisplayName ) )
{ {
@@ -2281,12 +2256,6 @@ void CalculateOverrideStatus()
void LoadGlobalSummary() void LoadGlobalSummary()
{ {
HWFILE hfile; HWFILE hfile;
#ifndef USE_VFS
STRING512 DataDir;
STRING512 ExecDir;
STRING512 DevInfoDir;
STRING512 MapsDir;
#endif
UINT32 uiNumBytesRead; UINT32 uiNumBytesRead;
FLOAT dMajorVersion; FLOAT dMajorVersion;
INT32 x,y; INT32 x,y;
@@ -2295,34 +2264,16 @@ void LoadGlobalSummary()
OutputDebugString( "Executing LoadGlobalSummary()...\n" ); OutputDebugString( "Executing LoadGlobalSummary()...\n" );
// Snap: save current directory // Snap: save current directory
#ifndef USE_VFS
GetFileManCurrentDirectory( DataDir );
#endif
gfMustForceUpdateAllMaps = FALSE; gfMustForceUpdateAllMaps = FALSE;
gusNumberOfMapsToBeForceUpdated = 0; gusNumberOfMapsToBeForceUpdated = 0;
gfGlobalSummaryExists = FALSE; gfGlobalSummaryExists = FALSE;
//Set current directory to JA2\DevInfo which contains all of the summary data //Set current directory to JA2\DevInfo which contains all of the summary data
#ifndef USE_VFS
GetExecutableDirectory( ExecDir );
sprintf( DevInfoDir, "%s\\DevInfo", ExecDir );
sprintf( MapsDir, "%s\\Maps", DataDir );
//Check to make sure we have a DevInfo directory. If we don't create one!
if( !SetFileManCurrentDirectory( DevInfoDir ) )
{
OutputDebugString( "LoadGlobalSummary() aborted -- doesn't exist on this local computer.\n");
return;
}
#endif
//TEMP //TEMP
#ifndef USE_VFS
FileDelete( "_global.sum" );
#else
if(FileExists("DevInfo\\_global.sum")) if(FileExists("DevInfo\\_global.sum"))
{ {
FileDelete( "DevInfo\\_global.sum" ); FileDelete( "DevInfo\\_global.sum" );
} }
#endif
gfGlobalSummaryExists = TRUE; gfGlobalSummaryExists = TRUE;
//Analyse all sectors to see if matching maps exist. For any maps found, the information //Analyse all sectors to see if matching maps exist. For any maps found, the information
@@ -2337,19 +2288,12 @@ void LoadGlobalSummary()
sprintf( szSector, "%c%d", 'A' + y, x + 1 ); sprintf( szSector, "%c%d", 'A' + y, x + 1 );
//main ground level //main ground level
#ifndef USE_VFS
sprintf( szFilename, "%c%d.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= GROUND_LEVEL_MASK; gbSectorLevels[x][y] |= GROUND_LEVEL_MASK;
@@ -2359,27 +2303,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s.sum", szSector ); sprintf( szFilename, "DevInfo\\%s.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//main B1 level //main B1 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b1.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b1.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_b1.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= BASEMENT1_LEVEL_MASK; gbSectorLevels[x][y] |= BASEMENT1_LEVEL_MASK;
@@ -2389,27 +2322,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_b1.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b1.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_b1.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//main B2 level //main B2 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b2.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b2.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_b2.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= BASEMENT2_LEVEL_MASK; gbSectorLevels[x][y] |= BASEMENT2_LEVEL_MASK;
@@ -2419,27 +2341,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_b2.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b2.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_b2.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//main B3 level //main B3 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b3.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b3.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_b3.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= BASEMENT3_LEVEL_MASK; gbSectorLevels[x][y] |= BASEMENT3_LEVEL_MASK;
@@ -2449,27 +2360,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_b3.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b3.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_b3.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//alternate ground level //alternate ground level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_a.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_a.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= ALTERNATE_GROUND_MASK; gbSectorLevels[x][y] |= ALTERNATE_GROUND_MASK;
@@ -2479,27 +2379,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_a.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_a.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//alternate B1 level //alternate B1 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b1_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b1_a.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_b1_a.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= ALTERNATE_B1_MASK; gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;
@@ -2509,27 +2398,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_b1_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b1_a.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_b1_a.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//alternate B2 level //alternate B2 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b2_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b2_a.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_b2_a.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= ALTERNATE_B2_MASK; gbSectorLevels[x][y] |= ALTERNATE_B2_MASK;
@@ -2539,27 +2417,16 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_b2_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b2_a.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_b2_a.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
//alternate B3 level //alternate B3 level
#ifndef USE_VFS
sprintf( szFilename, "%c%d_b3_a.dat", 'A' + y, x + 1 );
SetFileManCurrentDirectory( MapsDir );
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
SetFileManCurrentDirectory( DevInfoDir );
#else
sprintf( szFilename, "Maps\\%c%d_b3_a.dat", 'A' + y, x + 1 ); sprintf( szFilename, "Maps\\%c%d_b3_a.dat", 'A' + y, x + 1 );
hfile = NULL; hfile = NULL;
if(FileExists(szFilename)) if(FileExists(szFilename))
{ {
hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE ); hfile = FileOpen( szFilename, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
} }
#endif
if( hfile ) if( hfile )
{ {
gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;; gbSectorLevels[x][y] |= ALTERNATE_B1_MASK;;
@@ -2569,20 +2436,12 @@ void LoadGlobalSummary()
} }
else else
{ {
#ifndef USE_VFS
sprintf( szFilename, "%s_b3_a.sum", szSector );
#else
sprintf( szFilename, "DevInfo\\%s_b3_a.sum", szSector ); sprintf( szFilename, "DevInfo\\%s_b3_a.sum", szSector );
#endif
FileDelete( szFilename ); FileDelete( szFilename );
} }
} }
OutputDebugString( (LPCSTR)String("Sector Row %c complete... \n", y + 'A') ); OutputDebugString( (LPCSTR)String("Sector Row %c complete... \n", y + 'A') );
} }
#ifndef USE_VFS
// Snap: Restore the data directory once we are finished.
SetFileManCurrentDirectory( DataDir );
#endif
//sprintf( MapsDir, "%s\\Data", ExecDir ); //sprintf( MapsDir, "%s\\Data", ExecDir );
//SetFileManCurrentDirectory( MapsDir ); //SetFileManCurrentDirectory( MapsDir );
@@ -2599,39 +2458,6 @@ void LoadGlobalSummary()
void GenerateSummaryList() void GenerateSummaryList()
{ {
#ifndef USE_VFS
FILE *fp;
STRING512 DataDir;
STRING512 ExecDir;
STRING512 Dir;
// Snap: save current directory
GetFileManCurrentDirectory( DataDir );
//Set current directory to JA2\DevInfo which contains all of the summary data
GetExecutableDirectory( ExecDir );
sprintf( Dir, "%s\\DevInfo", ExecDir );
if( !SetFileManCurrentDirectory( Dir ) )
{
//Directory doesn't exist, so create it, and continue.
if( !MakeFileManDirectory( Dir ) )
AssertMsg( 0, "Can't create new directory, JA2\\DevInfo for summary information." );
if( !SetFileManCurrentDirectory( Dir ) )
AssertMsg( 0, "Can't set to new directory, JA2\\DevInfo for summary information." );
//Generate a simple readme file.
fp = fopen( "readme.txt", "w" );
Assert( fp );
fprintf( fp, "%s\n%s\n", "This information is used in conjunction with the editor.",
"This directory or it's contents shouldn't be included with final release." );
fclose( fp );
}
// Snap: Restore the data directory once we are finished.
SetFileManCurrentDirectory( DataDir );
//Set current directory back to data directory!
//sprintf( Dir, "%s\\Data", ExecDir );
//SetFileManCurrentDirectory( Dir );
#else
try try
{ {
vfs::COpenWriteFile wfile(L"DevInfo/readme.txt",true,true); vfs::COpenWriteFile wfile(L"DevInfo/readme.txt",true,true);
@@ -2643,7 +2469,6 @@ void GenerateSummaryList()
{ {
SGP_RETHROW(L"Could not create readme.txt", ex); SGP_RETHROW(L"Could not create readme.txt", ex);
} }
#endif
} }
//dnl ch28 260909 //dnl ch28 260909
+19 -9
View File
@@ -79,8 +79,6 @@
class OBJECTTYPE; class OBJECTTYPE;
class SOLDIERTYPE; class SOLDIERTYPE;
extern CHAR8 *szMusicList[NUM_MUSIC];
BOOLEAN gfCorruptMap = FALSE; BOOLEAN gfCorruptMap = FALSE;
BOOLEAN gfCorruptSchedules = FALSE; BOOLEAN gfCorruptSchedules = FALSE;
BOOLEAN gfProfileDataLoaded = FALSE; BOOLEAN gfProfileDataLoaded = FALSE;
@@ -169,6 +167,7 @@ LEVELNODE *gCursorNode = NULL;
INT32 gsCursorGridNo; INT32 gsCursorGridNo;
INT32 giMusicID = 0; INT32 giMusicID = 0;
NewMusicList gMusicMode = MUSICLIST_MAIN_MENU;
void EraseWorldData( ); void EraseWorldData( );
@@ -1616,16 +1615,27 @@ void HandleKeyboardShortcuts( )
break; break;
case F4: case F4:
#ifdef NEWMUSIC MusicPlay(gMusicMode, giMusicID);
MusicPlay( giMusicID, MUSIC_OLD_TYPE, FALSE ); ScreenMsg( FONT_YELLOW, MSG_INTERFACE, L"%S", MusicLists[gMusicMode][giMusicID] );
#else
MusicPlay( giMusicID );
#endif
ScreenMsg( FONT_YELLOW, MSG_DEBUG, L"%S", szMusicList[giMusicID] ); // Select next track
giMusicID++; giMusicID++;
if( giMusicID >= NUM_MUSIC ) if (giMusicID >= MusicLists[gMusicMode].size())
{
giMusicID = 0; giMusicID = 0;
for (size_t i = 0; i < MAX_MUSIC; i++)
{
if (gMusicMode == i)
{
gMusicMode = static_cast<NewMusicList>(i + 1);
if (gMusicMode == MAX_MUSIC)
{
gMusicMode = MUSICLIST_MAIN_MENU;
}
break;
}
}
}
break; break;
case F5: case F5:
-6
View File
@@ -1,6 +0,0 @@
#ifndef _JA2_DEMO_ADS_H
#define _JA2_DEMO_ADS_H
#include "types.h"
#endif
-13
View File
@@ -1,13 +0,0 @@
#ifndef _JA2PROTOTYPES_H
#define _JA2PROTOTYPES_H
/*
* This header does not define any structures. It simply provides a way for all code that only needs a pointer
* reference to structures, to have it without getting locked into mutual includes and other
* hard-to-trace-and-fix behavior. More class and struct defs can be added as necessary.
*/
class SOLDIERTYPE;
struct AnimationSurfaceType;
#endif
+52
View File
@@ -0,0 +1,52 @@
set(Ja2Src
"${CMAKE_CURRENT_SOURCE_DIR}/aniviewscreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Credits.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Fade Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/FeaturesScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameInitOptionsScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/gameloop.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/gamescreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameSettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/GameVersion.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/HelpScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Init.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Intro.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/JA2 Splash.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Ja25Update.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/jascreens.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Language Defines.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Loading Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MainMenuScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MessageBoxScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPChatScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPConnectScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPHostScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPJoinScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPScoreScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/MPXmlTeams.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Options Screen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/profiler.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadGame.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadScreen.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/SCREENS.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Sys Globals.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/ub_config.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_DifficultySettings.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_IntroFiles.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/XML_Layout_MainMenu.cpp"
${CMAKE_CURRENT_SOURCE_DIR}/Res/ja2.rc
PARENT_SCOPE)
set(Ja2_Libraries
"${CMAKE_SOURCE_DIR}/libexpatMT.lib"
"Dbghelp.lib"
Lua
"${CMAKE_SOURCE_DIR}/lua51.lib"
"${CMAKE_SOURCE_DIR}/lua51.vc9.lib"
"Winmm.lib"
"${CMAKE_SOURCE_DIR}/SMACKW32.LIB"
"${CMAKE_SOURCE_DIR}/binkw32.lib"
bfVFS
"ws2_32.lib"
Multiplayer
PARENT_SCOPE)
View File
View File
View File
View File
+14 -5
View File
@@ -1079,6 +1079,9 @@ void LoadGameExternalOptions()
gGameExternalOptions.ubMercRandomExpRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_EXP_RANGE", 1, 0, 4); gGameExternalOptions.ubMercRandomExpRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_EXP_RANGE", 1, 0, 4);
gGameExternalOptions.fMercRandomStartSalary = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_START_SALARY", FALSE); gGameExternalOptions.fMercRandomStartSalary = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_START_SALARY", FALSE);
gGameExternalOptions.ubMercRandomStartSalaryPercentMod = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_START_SALARY_PERCENTAGE_MAX_MODIFIER", 30, 0, 100); gGameExternalOptions.ubMercRandomStartSalaryPercentMod = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_START_SALARY_PERCENTAGE_MAX_MODIFIER", 30, 0, 100);
gGameExternalOptions.fMercGrowthModifiersEnabled = iniReader.ReadBoolean("Recruitment Settings", "MERCS_GROWTH_MODIFIERS_ENABLED", FALSE);
gGameExternalOptions.fMercRandomGrowthModifiers = iniReader.ReadBoolean("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS", FALSE);
gGameExternalOptions.iMercRandomGrowthModifiersRange = iniReader.ReadInteger("Recruitment Settings", "MERCS_RANDOM_GROWTH_MODIFIERS_RANGE", 5, -50, 50);
//################# Financial Settings ################# //################# Financial Settings #################
@@ -1148,6 +1151,8 @@ void LoadGameExternalOptions()
gGameExternalOptions.gfUseExternalLoadscreens = iniReader.ReadBoolean("Graphics Settings","USE_EXTERNALIZED_LOADSCREENS", FALSE); gGameExternalOptions.gfUseExternalLoadscreens = iniReader.ReadBoolean("Graphics Settings","USE_EXTERNALIZED_LOADSCREENS", FALSE);
gGameExternalOptions.ubLoadscreenStretchMode = iniReader.ReadInteger("Graphics Settings", "LOADSCREEN_STRETCH_MODE", 0, 0, 2);
if (!is_networked) if (!is_networked)
gGameExternalOptions.gfUseLoadScreenHints = iniReader.ReadBoolean("Graphics Settings","USE_LOADSCREENHINTS", TRUE); gGameExternalOptions.gfUseLoadScreenHints = iniReader.ReadBoolean("Graphics Settings","USE_LOADSCREENHINTS", TRUE);
else else
@@ -1180,6 +1185,12 @@ void LoadGameExternalOptions()
// Flugente: additional decals on objects (cracked walls, blood spatters etc.) // Flugente: additional decals on objects (cracked walls, blood spatters etc.)
gGameExternalOptions.fAdditionalDecals = iniReader.ReadBoolean( "Graphics Settings", "ADDITIONAL_DECALS", FALSE ); gGameExternalOptions.fAdditionalDecals = iniReader.ReadBoolean( "Graphics Settings", "ADDITIONAL_DECALS", FALSE );
// anv: map color variants
gGameExternalOptions.ubRadarMapModeDay = iniReader.ReadInteger("Graphics Settings", "RADAR_MAP_MODE_DAY", 0, 0, 2);
gGameExternalOptions.ubRadarMapModeNight = iniReader.ReadInteger("Graphics Settings", "RADAR_MAP_MODE_NIGHT", 3, 0, 3);
gGameExternalOptions.ubOverheadMapModeDay = iniReader.ReadInteger("Graphics Settings", "OVERHEAD_MAP_MODE_DAY", 0, 0, 2);
gGameExternalOptions.ubOverheadMapModeNight = iniReader.ReadInteger("Graphics Settings", "OVERHEAD_MAP_MODE_NIGHT", 0, 0, 3);
//################# Sound Settings ################# //################# Sound Settings #################
gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME", 0, 0, 1000 /*1000 = 10x?*/); gGameExternalOptions.guiWeaponSoundEffectsVolume = iniReader.ReadInteger("Sound Settings","WEAPON_SOUND_EFFECTS_VOLUME", 0, 0, 1000 /*1000 = 10x?*/);
@@ -2480,8 +2491,6 @@ void LoadGameExternalOptions()
gGameExternalOptions.ubTeachBonusToTrain = iniReader.ReadInteger("Strategic Assignment Settings","TEACHER_TRAIT_BONUS_TO_TRAINING_EFFICIENCY",30, 0, 100); gGameExternalOptions.ubTeachBonusToTrain = iniReader.ReadInteger("Strategic Assignment Settings","TEACHER_TRAIT_BONUS_TO_TRAINING_EFFICIENCY",30, 0, 100);
gGameExternalOptions.ubMinSkillToTeach = iniReader.ReadInteger("Strategic Assignment Settings","MIN_SKILL_REQUIRED_TO_TEACH_OTHER",25, 0, 100); gGameExternalOptions.ubMinSkillToTeach = iniReader.ReadInteger("Strategic Assignment Settings","MIN_SKILL_REQUIRED_TO_TEACH_OTHER",25, 0, 100);
gGameExternalOptions.bDisableEvolution = iniReader.ReadBoolean("Strategic Assignment Settings", "DISABLE_EVOLUTION", TRUE );
// HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainees will go to sleep when their trainer goes to sleep. 3 = Trainer will go to sleep if all trainees are asleep. 1 = Both. 0 = Neither. // HEADROCK HAM B2.8: New Trainer Relations: 2 = Trainees will go to sleep when their trainer goes to sleep. 3 = Trainer will go to sleep if all trainees are asleep. 1 = Both. 0 = Neither.
gGameExternalOptions.ubSmartTrainingSleep = iniReader.ReadInteger("Strategic Assignment Settings","SYNCHRONIZED_SLEEPING_HOURS_WHEN_TRAINING_TOGETHER", 0, 0, 3); gGameExternalOptions.ubSmartTrainingSleep = iniReader.ReadInteger("Strategic Assignment Settings","SYNCHRONIZED_SLEEPING_HOURS_WHEN_TRAINING_TOGETHER", 0, 0, 3);
@@ -2784,6 +2793,9 @@ void LoadSkillTraitsExternalSettings()
gSkillTraitValues.ubTHBladesSilentCriticalHitChance = iniReader.ReadInteger("Throwing","TH_BLADES_SILENT_CRITICAL_HIT_CHANCE", 20, 0, 100); gSkillTraitValues.ubTHBladesSilentCriticalHitChance = iniReader.ReadInteger("Throwing","TH_BLADES_SILENT_CRITICAL_HIT_CHANCE", 20, 0, 100);
gSkillTraitValues.ubTHBladesCriticalHitMultiplierBonus = iniReader.ReadInteger("Throwing","SILENT_CRITICAL_HIT_MULTIPLIER_BONUS", 1, 0, 50); gSkillTraitValues.ubTHBladesCriticalHitMultiplierBonus = iniReader.ReadInteger("Throwing","SILENT_CRITICAL_HIT_MULTIPLIER_BONUS", 1, 0, 50);
gSkillTraitValues.ubTHBladesAimClicksAdded = iniReader.ReadInteger("Throwing","POSSIBLE_AIM_CLICK_ADDED_TH_KNIVES", 1, 0, 5); gSkillTraitValues.ubTHBladesAimClicksAdded = iniReader.ReadInteger("Throwing","POSSIBLE_AIM_CLICK_ADDED_TH_KNIVES", 1, 0, 5);
gSkillTraitValues.ubTHAPsNeededToThrowGrenadesReduction = iniReader.ReadInteger("Throwing","APS_NEEDED_TO_THROW_GRENADES_REDUCTION", 25, 0, 90);
gSkillTraitValues.ubTHMaxRangeToThrowGrenades = iniReader.ReadInteger("Throwing","MAX_RANGE_TO_THROW_GRENADES", 20, 0, 250);
gSkillTraitValues.ubTHCtHWhenThrowingGrenades = iniReader.ReadInteger("Throwing","CTH_WHEN_THROWING_GRENADES", 30, 0, 100);
// NIGHT OPS // NIGHT OPS
gSkillTraitValues.ubNOeSightRangeBonusInDark = iniReader.ReadInteger("Night Ops","SIGHT_RANGE_BONUS_IN_DARK", 1, 0, 100); gSkillTraitValues.ubNOeSightRangeBonusInDark = iniReader.ReadInteger("Night Ops","SIGHT_RANGE_BONUS_IN_DARK", 1, 0, 100);
@@ -2810,9 +2822,6 @@ void LoadSkillTraitsExternalSettings()
gSkillTraitValues.usBBIncreasedNeededDamageToFallDown = iniReader.ReadInteger("Bodybuilding","INCREASE_DAMAGE_NEEDED_TO_FALL_DOWN_IF_HIT_TO_LEGS", 100, 0, 500); gSkillTraitValues.usBBIncreasedNeededDamageToFallDown = iniReader.ReadInteger("Bodybuilding","INCREASE_DAMAGE_NEEDED_TO_FALL_DOWN_IF_HIT_TO_LEGS", 100, 0, 500);
// DEMOLITIONS // DEMOLITIONS
gSkillTraitValues.ubDEAPsNeededToThrowGrenadesReduction = iniReader.ReadInteger("Demolitions","APS_NEEDED_TO_THROW_GRENADES_REDUCTION", 25, 0, 90);
gSkillTraitValues.ubDEMaxRangeToThrowGrenades = iniReader.ReadInteger("Demolitions","MAX_RANGE_TO_THROW_GRENADES", 20, 0, 250);
gSkillTraitValues.ubDECtHWhenThrowingGrenades = iniReader.ReadInteger("Demolitions","CTH_WHEN_THROWING_GRENADES", 30, 0, 100);
gSkillTraitValues.ubDEDamageOfBombsAndMines = iniReader.ReadInteger("Demolitions","DAMAGE_OF_PLACED_BOMBS_AND_MINES", 25, 0, 250); gSkillTraitValues.ubDEDamageOfBombsAndMines = iniReader.ReadInteger("Demolitions","DAMAGE_OF_PLACED_BOMBS_AND_MINES", 25, 0, 250);
gSkillTraitValues.ubDEAttachDetonatorCheckBonus = iniReader.ReadInteger("Demolitions","ATTACH_DETONATOR_CHECK_BONUS", 50, 0, 250); gSkillTraitValues.ubDEAttachDetonatorCheckBonus = iniReader.ReadInteger("Demolitions","ATTACH_DETONATOR_CHECK_BONUS", 50, 0, 250);
gSkillTraitValues.ubDEPlantAndRemoveBombCheckBonus = iniReader.ReadInteger("Demolitions","PLANT_AND_REMOVE_BOMBS_AND_MINES_BONUS", 50, 0, 250); gSkillTraitValues.ubDEPlantAndRemoveBombCheckBonus = iniReader.ReadInteger("Demolitions","PLANT_AND_REMOVE_BOMBS_AND_MINES_BONUS", 50, 0, 250);
+14 -6
View File
@@ -781,6 +781,7 @@ typedef struct
INT32 ubEnemiesItemDrop; INT32 ubEnemiesItemDrop;
BOOLEAN gfUseExternalLoadscreens; BOOLEAN gfUseExternalLoadscreens;
UINT32 ubLoadscreenStretchMode; // added by anv
BOOLEAN gfUseLoadScreenHints; // added by Flugente BOOLEAN gfUseLoadScreenHints; // added by Flugente
UINT32 ubAdditionalDelayUntilLoadScreenDisposal; // added by WANNE to have time to read the load screen hints UINT32 ubAdditionalDelayUntilLoadScreenDisposal; // added by WANNE to have time to read the load screen hints
@@ -816,9 +817,6 @@ typedef struct
INT32 ubRpcBonusToTrainMilitia; INT32 ubRpcBonusToTrainMilitia;
INT32 ubMinSkillToTeach; INT32 ubMinSkillToTeach;
// Flugente: disable evolution setting in MercProfiles.xml
BOOLEAN bDisableEvolution;
INT32 ubLowActivityLevel; INT32 ubLowActivityLevel;
INT32 ubMediumActivityLevel; INT32 ubMediumActivityLevel;
INT32 ubHighActivityLevel; INT32 ubHighActivityLevel;
@@ -954,6 +952,12 @@ typedef struct
BOOLEAN fAdditionalDecals; // Flugente: show additional decals on objects (cracked walls, blood spatters etc.) BOOLEAN fAdditionalDecals; // Flugente: show additional decals on objects (cracked walls, blood spatters etc.)
// anv: map color variants
UINT8 ubRadarMapModeDay;
UINT8 ubRadarMapModeNight;
UINT8 ubOverheadMapModeDay;
UINT8 ubOverheadMapModeNight;
//enable ext mouse key //enable ext mouse key
BOOLEAN bAltAimEnabled; BOOLEAN bAltAimEnabled;
BOOLEAN bAimedBurstEnabled; BOOLEAN bAimedBurstEnabled;
@@ -1440,6 +1444,10 @@ typedef struct
UINT8 ubMercRandomStartSalaryPercentMod; UINT8 ubMercRandomStartSalaryPercentMod;
BOOLEAN fMercGrowthModifiersEnabled;
BOOLEAN fMercRandomGrowthModifiers;
INT16 iMercRandomGrowthModifiersRange;
BOOLEAN fBobbyRayFastShipments; BOOLEAN fBobbyRayFastShipments;
BOOLEAN fGridExitInTurnBased; BOOLEAN fGridExitInTurnBased;
@@ -2176,6 +2184,9 @@ typedef struct
UINT8 ubTHBladesSilentCriticalHitChance; UINT8 ubTHBladesSilentCriticalHitChance;
UINT8 ubTHBladesCriticalHitMultiplierBonus; UINT8 ubTHBladesCriticalHitMultiplierBonus;
UINT8 ubTHBladesAimClicksAdded; UINT8 ubTHBladesAimClicksAdded;
UINT8 ubTHAPsNeededToThrowGrenadesReduction;
UINT8 ubTHMaxRangeToThrowGrenades;
UINT8 ubTHCtHWhenThrowingGrenades;
// NIGHT OPS // NIGHT OPS
UINT8 ubNOeSightRangeBonusInDark; UINT8 ubNOeSightRangeBonusInDark;
@@ -2202,9 +2213,6 @@ typedef struct
UINT16 usBBIncreasedNeededDamageToFallDown; UINT16 usBBIncreasedNeededDamageToFallDown;
// DEMOLITIONS // DEMOLITIONS
UINT8 ubDEAPsNeededToThrowGrenadesReduction;
UINT8 ubDEMaxRangeToThrowGrenades;
UINT8 ubDECtHWhenThrowingGrenades;
UINT8 ubDEDamageOfBombsAndMines; UINT8 ubDEDamageOfBombsAndMines;
UINT8 ubDEAttachDetonatorCheckBonus; UINT8 ubDEAttachDetonatorCheckBonus;
UINT8 ubDEPlantAndRemoveBombCheckBonus; UINT8 ubDEPlantAndRemoveBombCheckBonus;
+2 -1
View File
@@ -23,6 +23,7 @@ extern CHAR16 zBuildInformation[256];
// Keeps track of the saved game version. Increment the saved game version whenever // Keeps track of the saved game version. Increment the saved game version whenever
// you will invalidate the saved game file // you will invalidate the saved game file
#define GROWTH_MODIFIERS 184
#define REBELCOMMAND 183 #define REBELCOMMAND 183
#define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us #define DRAGSTRUCTURE 182 // Flugente: we can drag structures behind us
#define DISABILITYFLAGMASK 181 // Flugente: disabilities get a flagmask #define DISABILITYFLAGMASK 181 // Flugente: disabilities get a flagmask
@@ -104,7 +105,7 @@ extern CHAR16 zBuildInformation[256];
#define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes #define AP100_SAVEGAME_DATATYPE_CHANGE 105 // Before this, we didn't have the 100AP structure changes
#define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system #define NIV_SAVEGAME_DATATYPE_CHANGE 102 // Before this, we used the old structure system
#define SAVE_GAME_VERSION REBELCOMMAND #define SAVE_GAME_VERSION GROWTH_MODIFIERS
//#define RUSSIANGOLD //#define RUSSIANGOLD
#ifdef __cplusplus #ifdef __cplusplus
View File
-8
View File
@@ -1514,12 +1514,6 @@ UINT32 InitializeJA2(void)
// INit intensity tables // INit intensity tables
BuildIntensityTable( ); BuildIntensityTable( );
// Init Event Manager
if ( !InitializeEventManager( ) )
{
return( ERROR_SCREEN );
}
// Initailize World // Initailize World
if ( !InitializeWorld( ) ) if ( !InitializeWorld( ) )
{ {
@@ -1698,8 +1692,6 @@ void ShutdownJA2(void)
ShutdownJA2Sound( ); ShutdownJA2Sound( );
ShutdownEventManager( );
ShutdownBaseDirtyRectQueue( ); ShutdownBaseDirtyRectQueue( );
// Unload any text box images! // Unload any text box images!
View File
View File
View File
View File
-1
View File
@@ -11,7 +11,6 @@
#include "Animation Cache.h" #include "Animation Cache.h"
#include "Animation Data.h" #include "Animation Data.h"
#include "Animation Control.h" #include "Animation Control.h"
#include "container.h"
#include <math.h> #include <math.h>
#include "pathai.h" #include "pathai.h"
#include "Random.h" #include "Random.h"
View File
+81 -20
View File
@@ -23,6 +23,7 @@ extern BOOLEAN gfSchedulesHosed;
#include "Ja25 Strategic Ai.h" #include "Ja25 Strategic Ai.h"
#endif #endif
UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING; UINT8 gubLastLoadingScreenID = LOADINGSCREEN_NOTHING;
FLOAT fLoadingScreenAspectRatio;
//BOOLEAN bShowSmallImage = FALSE; //BOOLEAN bShowSmallImage = FALSE;
SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS]; SECTOR_LOADSCREENS gSectorLoadscreens[MAX_SECTOR_LOADSCREENS];
@@ -343,6 +344,62 @@ static void BuildLoadscreenFilename(std::string& dst, const char* path, int reso
dst.append(".sti"); dst.append(".sti");
} }
std::string GetResolutionSuffix(SCREEN_RESOLUTION resolution)
{
switch (resolution)
{
case _960x540: return "_960x540";
case _800x600: return "_800x600";
case _1024x600: return "_1024x600";
case _1280x720: return "_1280x720";
case _1024x768: return "_1024x768";
case _1280x768: return "_1280x768";
case _1360x768: return "_1360x768";
case _1366x768: return "_1366x768";
case _1280x800: return "_1280x800";
case _1440x900: return "_1440x900";
case _1600x900: return "_1600x900";
case _1280x960: return "_1280x960";
case _1440x960: return "_1440x960";
case _1770x1000: return "_1770x1000";
case _1280x1024: return "_1280x1024";
case _1360x1024: return "_1360x1024";
case _1600x1024: return "_1600x1024";
case _1440x1050: return "_1440x1050";
case _1680x1050: return "_1680x1050";
case _1920x1080: return "_1920x1080";
case _1600x1200: return "_1600x1200";
case _1920x1200: return "_1920x1200";
case _2560x1440: return "_2560x1440";
case _2560x1600: return "_2560x1600";
default: return "";
}
}
std::string FindBestFittingLoadscreenFilename(const std::string& baseName, SCREEN_RESOLUTION resolution)
{
for (SCREEN_RESOLUTION res = resolution; res <= _2560x1600; res = (SCREEN_RESOLUTION)(res + 1))
{
std::string fileName = baseName + GetResolutionSuffix(res);
if (FileExists((CHAR8*)((fileName + ".png").c_str())))
{
return fileName + ".png";
}
if (FileExists((CHAR8*)((fileName + ".sti").c_str())))
{
return fileName + ".sti";
}
}
if (FileExists((CHAR8*)((baseName + ".png").c_str())))
{
return baseName + ".png";
}
return baseName + ".sti";
}
//sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER, //sets up the loadscreen with specified ID, and draws it to the FRAME_BUFFER,
//and refreshing the screen with it. //and refreshing the screen with it.
void DisplayLoadScreenWithID( UINT8 ubLoadScreenID ) void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
@@ -420,27 +477,8 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
} }
} }
std::string strImage; std::string strImage = FindBestFittingLoadscreenFilename(imagePath, (SCREEN_RESOLUTION)iResolution);
BuildLoadscreenFilename(strImage, imagePath.c_str(), 0, imageFormat.c_str());
strImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile)-1);
if ( !FileExists(vs_desc.ImageFile) )
{
std::string strImage;
BuildLoadscreenFilename(strImage, imagePath.c_str(), 0, "png");
strImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile) - 1); strImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile) - 1);
if (!FileExists(vs_desc.ImageFile))
{
std::string strImage("LOADSCREENS\\");
BuildLoadscreenFilename(strImage, LoadScreenNames[1], 0, imageFormat.c_str());
strImage.copy(vs_desc.ImageFile, sizeof(vs_desc.ImageFile) - 1);
}
}
} }
else else
{ {
@@ -476,6 +514,28 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
//Blit the background image //Blit the background image
GetVideoSurface(&hVSurface, uiLoadScreen); GetVideoSurface(&hVSurface, uiLoadScreen);
fLoadingScreenAspectRatio = (FLOAT)hVSurface->usWidth / (FLOAT)hVSurface->usHeight;
FLOAT fScreenAspectRatio = (FLOAT)SCREEN_WIDTH / (FLOAT)SCREEN_HEIGHT;
if (gGameExternalOptions.ubLoadscreenStretchMode == 1 ||
(gGameExternalOptions.ubLoadscreenStretchMode == 2 && fLoadingScreenAspectRatio > fScreenAspectRatio))
{
// match height, preserve aspect ratio
INT32 iCalculatedWidth = (INT32)(SCREEN_HEIGHT * fLoadingScreenAspectRatio + 0.5f);
SrcRect.iLeft = 0;
SrcRect.iTop = 0;
SrcRect.iRight = hVSurface->usWidth;
SrcRect.iBottom = hVSurface->usHeight;
DstRect.iLeft = (SCREEN_WIDTH - iCalculatedWidth) / 2;
DstRect.iTop = 0;
DstRect.iRight = SCREEN_WIDTH - ((SCREEN_WIDTH - iCalculatedWidth) / 2);
DstRect.iBottom = SCREEN_HEIGHT;
}
else
{
// vanilla (stretch to fit)
// Stretch the background image // Stretch the background image
SrcRect.iLeft = 0; SrcRect.iLeft = 0;
SrcRect.iTop = 0; SrcRect.iTop = 0;
@@ -486,6 +546,7 @@ void DisplayLoadScreenWithID( UINT8 ubLoadScreenID )
DstRect.iTop = 0; DstRect.iTop = 0;
DstRect.iRight = SCREEN_WIDTH; DstRect.iRight = SCREEN_WIDTH;
DstRect.iBottom = SCREEN_HEIGHT; DstRect.iBottom = SCREEN_HEIGHT;
}
BltStretchVideoSurface( FRAME_BUFFER, uiLoadScreen, 0, 0, 0, &SrcRect, &DstRect ); BltStretchVideoSurface( FRAME_BUFFER, uiLoadScreen, 0, 0, 0, &SrcRect, &DstRect );
@@ -84,6 +84,8 @@ enum
//For use by the game loader, before it can possibly know the situation. //For use by the game loader, before it can possibly know the situation.
extern UINT8 gubLastLoadingScreenID; extern UINT8 gubLastLoadingScreenID;
extern FLOAT fLoadingScreenAspectRatio;
//returns the UINT8 ID for the specified sector. //returns the UINT8 ID for the specified sector.
UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ ); UINT8 GetLoadScreenID( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ );
@@ -248,7 +248,6 @@ BOOLEAN InitMainMenu( )
{ {
is_networked = FALSE; is_networked = FALSE;
#ifdef USE_VFS
// remove Multiplayer profile if it exists // remove Multiplayer profile if it exists
vfs::CProfileStack *PS = getVFS()->getProfileStack(); vfs::CProfileStack *PS = getVFS()->getProfileStack();
vfs::CVirtualProfile *pProf = PS->getProfile("_MULTIPLAYER"); vfs::CVirtualProfile *pProf = PS->getProfile("_MULTIPLAYER");
@@ -256,7 +255,6 @@ BOOLEAN InitMainMenu( )
{ {
SGP_THROW_IFFALSE(PS->popProfile(), "Leaving Multiplayer mode : Could not remove \"_MULTIPLAYER\" profile"); SGP_THROW_IFFALSE(PS->popProfile(), "Leaving Multiplayer mode : Could not remove \"_MULTIPLAYER\" profile");
} }
#endif
// Snap: UN-Init MP save game directory // Snap: UN-Init MP save game directory
if ( !InitSaveDir() ) if ( !InitSaveDir() )
@@ -855,6 +853,9 @@ void RenderMainMenu()
DrawTextToScreen( L"BLOCKFONTNARROW: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 445, 640, BLOCKFONTNARROW, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen( L"BLOCKFONTNARROW: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 445, 640, BLOCKFONTNARROW, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen( L"FONT14HUMANIST: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 465, 640, FONT14HUMANIST, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED ); DrawTextToScreen( L"FONT14HUMANIST: ÄÀÁÂÇËÈÉÊÏÖÒÓÔÜÙÚÛäàáâçëèéêïöòóôüùúûÌÎìî"/*gzCopyrightText[ 0 ]*/, 0, 465, 640, FONT14HUMANIST, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
#else #else
CHAR16 text[128];
swprintf(text, L"%s: %s %S %s", pMessageStrings[ MSG_VERSION ], zProductLabel, czVersionString, zBuildInformation );
DrawTextToScreen( text, 10, 10, SCREEN_WIDTH, TINYFONT1, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, LEFT_JUSTIFIED );
DrawTextToScreen( gzCopyrightText[ 0 ], 0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED ); DrawTextToScreen( gzCopyrightText[ 0 ], 0, SCREEN_HEIGHT - 20, SCREEN_WIDTH, FONT10ARIAL, FONT_MCOLOR_WHITE, FONT_MCOLOR_BLACK, FALSE, CENTER_JUSTIFIED );
#endif #endif
View File
View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

+129 -116
View File
@@ -1294,7 +1294,16 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for
numBytesRead = ReadFieldByField( hFile, &this->bSex, sizeof(this->bSex), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSex, sizeof(this->bSex), sizeof(INT8), numBytesRead);
numBytesRead = ReadFieldByField( hFile, &this->bArmourAttractiveness, sizeof(this->bArmourAttractiveness), sizeof(INT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bArmourAttractiveness, sizeof(this->bArmourAttractiveness), sizeof(INT8), numBytesRead);
numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags2, sizeof(this->ubMiscFlags2), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags2, sizeof(this->ubMiscFlags2), sizeof(UINT8), numBytesRead);
numBytesRead = ReadFieldByField( hFile, &this->bEvolution, sizeof(this->bEvolution), sizeof(INT8), numBytesRead); if (guiCurrentSaveGameVersion < GROWTH_MODIFIERS)
{
numBytesRead = ReadFieldByField( hFile, &this->fRegresses, sizeof(this->fRegresses), sizeof(INT8), numBytesRead);
// convert old evolution to regresses boolean
this->fRegresses = this->fRegresses == 2 ? TRUE : FALSE; // 2 == CharacterEvolution::DEVOLVES
}
else
{
numBytesRead = ReadFieldByField( hFile, &this->fRegresses, sizeof(this->fRegresses), sizeof(INT8), numBytesRead);
}
numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags, sizeof(this->ubMiscFlags), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->ubMiscFlags, sizeof(this->ubMiscFlags), sizeof(UINT8), numBytesRead);
numBytesRead = ReadFieldByField( hFile, &this->bSexist, sizeof(this->bSexist), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bSexist, sizeof(this->bSexist), sizeof(UINT8), numBytesRead);
numBytesRead = ReadFieldByField( hFile, &this->bLearnToHate, sizeof(this->bLearnToHate), sizeof(UINT8), numBytesRead); numBytesRead = ReadFieldByField( hFile, &this->bLearnToHate, sizeof(this->bLearnToHate), sizeof(UINT8), numBytesRead);
@@ -1637,6 +1646,70 @@ BOOLEAN MERCPROFILESTRUCT::Load(HWFILE hFile, bool forceLoadOldVersion, bool for
return( FALSE ); return( FALSE );
} }
} }
// rftr: growth modifiers
if (guiCurrentSaveGameVersion >= GROWTH_MODIFIERS)
{
if (!FileRead(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesRead))
{
return(FALSE);
}
if ( !FileRead( hFile, &this->bGrowthModifierStrength, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierAgility, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierDexterity, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierWisdom, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierMarksmanship, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierExplosive, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierLeadership, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierMedical, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierMechanical, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
if ( !FileRead( hFile, &this->bGrowthModifierExpLevel, sizeof(INT8), &uiNumBytesRead) )
{
return( FALSE );
}
}
else
{
// zero out growth modifiers for upgrading savegames
this->bGrowthModifierLife = 0;
this->bGrowthModifierStrength = 0;
this->bGrowthModifierAgility = 0;
this->bGrowthModifierDexterity = 0;
this->bGrowthModifierWisdom = 0;
this->bGrowthModifierMarksmanship = 0;
this->bGrowthModifierExplosive = 0;
this->bGrowthModifierLeadership = 0;
this->bGrowthModifierMedical = 0;
this->bGrowthModifierMechanical = 0;
this->bGrowthModifierExpLevel = 0;
}
} }
if ( this->uiProfileChecksum != this->GetChecksum() ) if ( this->uiProfileChecksum != this->GetChecksum() )
@@ -1754,6 +1827,52 @@ BOOLEAN MERCPROFILESTRUCT::Save(HWFILE hFile)
return( FALSE ); return( FALSE );
} }
// rftr: growth modifiers
if (!FileWrite(hFile, &this->bGrowthModifierLife, sizeof(INT8), &uiNumBytesWritten))
{
return(FALSE);
}
if ( !FileWrite( hFile, &this->bGrowthModifierStrength, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierAgility, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierDexterity, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierWisdom, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierMarksmanship, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierExplosive, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierLeadership, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierMedical, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierMechanical, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
if ( !FileWrite( hFile, &this->bGrowthModifierExpLevel, sizeof(INT8), &uiNumBytesWritten) )
{
return( FALSE );
}
return TRUE; return TRUE;
} }
@@ -3434,33 +3553,6 @@ BOOLEAN Inventory::Save( HWFILE hFile, bool fSavingMap )
// The save directory now resides in the data directory (default or custom) // The save directory now resides in the data directory (default or custom)
BOOLEAN InitSaveDir() BOOLEAN InitSaveDir()
{ {
#ifndef USE_VFS
// Look for a custom data dir first
std::string dataDir = gCustomDataCat.GetRootDir();
if( dataDir.empty() || FileGetAttributes( (STR) dataDir.c_str() ) == 0xFFFFFFFF ) {
dataDir = gDefaultDataCat.GetRootDir();
}
// The locale-specific save dir location is of the form L"..\\SavedGames"
// This has not changed; instead, we strip the ".." at the beginning
if(is_networked)
{
sprintf( gSaveDir, "%s%S", dataDir.c_str(), pMessageStrings[ MSG_MPSAVEDIRECTORY ] + 2 );
}
else
sprintf( gSaveDir, "%s%S", dataDir.c_str(), pMessageStrings[ MSG_SAVEDIRECTORY ] + 2 );
// This was moved here from SaveGame
//Check to see if the save directory exists
if( FileGetAttributes( (STR) gSaveDir ) == 0xFFFFFFFF )
{
//ok the direcotry doesnt exist, create it
if( !MakeFileManDirectory( (CHAR8 *)gSaveDir ) )
{
return FALSE;
}
}
#else
if(is_networked) if(is_networked)
{ {
sprintf( gSaveDir, "%s", vfs::String::as_utf8(pMessageStrings[ MSG_MPSAVEDIRECTORY ] + 3).c_str() ); sprintf( gSaveDir, "%s", vfs::String::as_utf8(pMessageStrings[ MSG_MPSAVEDIRECTORY ] + 3).c_str() );
@@ -3469,7 +3561,6 @@ BOOLEAN InitSaveDir()
{ {
sprintf( gSaveDir, "%s", vfs::String::as_utf8(pMessageStrings[ MSG_SAVEDIRECTORY ] + 3).c_str() ); sprintf( gSaveDir, "%s", vfs::String::as_utf8(pMessageStrings[ MSG_SAVEDIRECTORY ] + 3).c_str() );
} }
#endif
return TRUE; return TRUE;
} }
@@ -6694,15 +6785,6 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
//Reset the Ai Timer clock //Reset the Ai Timer clock
giRTAILastUpdateTime = 0; giRTAILastUpdateTime = 0;
//if we are in tactical
if( guiScreenToGotoAfterLoadingSavedGame == GAME_SCREEN )
{
//Initialize the current panel
InitializeCurrentPanel( );
SelectSoldier( gusSelectedSoldier, FALSE, TRUE );
}
uiRelEndPerc += 1; uiRelEndPerc += 1;
SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." ); SetRelativeStartAndEndPercentage( 0, uiRelStartPerc, uiRelEndPerc, L"Final Checks..." );
RenderProgressBar( 0, 100 ); RenderProgressBar( 0, 100 );
@@ -6831,6 +6913,15 @@ BOOLEAN LoadSavedGame( int ubSavedGameID )
RemoveLoadingScreenProgressBar(); RemoveLoadingScreenProgressBar();
//if we are in tactical
if (guiScreenToGotoAfterLoadingSavedGame == GAME_SCREEN)
{
//Initialize the current panel
InitializeCurrentPanel();
SelectSoldier(gusSelectedSoldier, FALSE, TRUE);
}
// sevenfm: reset sound map // sevenfm: reset sound map
ResetSoundMap(); ResetSoundMap();
@@ -9592,21 +9683,6 @@ BOOLEAN SaveMeanwhileDefsFromSaveGameFile( HWFILE hFile )
return( TRUE ); return( TRUE );
} }
BOOLEAN DoesUserHaveEnoughHardDriveSpace()
{
UINT32 uiBytesFree=0;
uiBytesFree = GetFreeSpaceOnHardDriveWhereGameIsRunningFrom( );
//check to see if there is enough hard drive space
if( uiBytesFree < REQUIRED_FREE_SPACE )
{
return( FALSE );
}
return( TRUE );
}
#ifdef JA2BETAVERSION #ifdef JA2BETAVERSION
void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID ) void InitShutDownMapTempFileTest( BOOLEAN fInit, STR pNameOfFile, UINT8 ubSaveGameID )
@@ -9870,69 +9946,6 @@ void UpdateMercMercContractInfo()
} }
} }
INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave )
{
CHAR zFileName1[MAX_PATH];
CHAR zFileName2[MAX_PATH];
HWFILE hFile;
BOOLEAN fFile1Exist, fFile2Exist;
SGP_FILETIME CreationTime1, LastAccessedTime1, LastWriteTime1;
SGP_FILETIME CreationTime2, LastAccessedTime2, LastWriteTime2;
fFile1Exist = FALSE;
fFile2Exist = FALSE;
//The name of the file
sprintf( zFileName1, "%s\\Auto%02d.%S", gSaveDir, 0, pMessageStrings[ MSG_SAVEEXTENSION ] );
sprintf( zFileName2, "%s\\Auto%02d.%S", gSaveDir, 1, pMessageStrings[ MSG_SAVEEXTENSION ] );
if( FileExists( zFileName1 ) )
{
hFile = FileOpen( zFileName1, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
GetFileManFileTime( hFile, &CreationTime1, &LastAccessedTime1, &LastWriteTime1 );
FileClose( hFile );
fFile1Exist = TRUE;
}
if( FileExists( zFileName2 ) )
{
hFile = FileOpen( zFileName2, FILE_ACCESS_READ | FILE_OPEN_EXISTING, FALSE );
GetFileManFileTime( hFile, &CreationTime2, &LastAccessedTime2, &LastWriteTime2 );
FileClose( hFile );
fFile2Exist = TRUE;
}
if( !fFile1Exist && !fFile2Exist )
return( -1 );
else if( fFile1Exist && !fFile2Exist )
{
if( fLatestAutoSave )
return( 0 );
else
return( -1 );
}
else if( !fFile1Exist && fFile2Exist )
{
if( fLatestAutoSave )
return( 1 );
else
return( -1 );
}
else
{
if( CompareSGPFileTimes( &LastWriteTime1, &LastWriteTime2 ) > 0 )
return( 0 );
else
return( 1 );
}
}
void HandleOldBobbyRMailOrders() void HandleOldBobbyRMailOrders()
{ {
-3
View File
@@ -93,13 +93,10 @@ BOOLEAN CopySavedSoldierInfoToNewSoldier( SOLDIERTYPE *pDestSourceInfo, SOLDIERT
BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile ); BOOLEAN SaveFilesToSavedGame( STR pSrcFileName, HWFILE hFile );
BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile ); BOOLEAN LoadFilesFromSavedGame( STR pSrcFileName, HWFILE hFile );
BOOLEAN DoesUserHaveEnoughHardDriveSpace();
void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ ); void GetBestPossibleSectorXYZValues( INT16 *psSectorX, INT16 *psSectorY, INT8 *pbSectorZ );
extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav) extern UINT32 guiLastSaveGameNum; // The end turn auto save number (0 = Auto00.sav, 1 = Auto01.sav)
INT8 GetNumberForAutoSave( BOOLEAN fLatestAutoSave );
/*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory, /*CHRISL: This function is designed to allow reading the save game file one field at a time. We currently save structures by saving a block of memory,
but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved but variables are stored in memory so that they fit neatly into a WORD resulting in the program automatically adding some padding. This padding is saved
@@ -1350,7 +1350,6 @@ BOOLEAN InitSaveGameArray()
gbSaveGameArray[VAL_SLOT_START + cnt] = TRUE; gbSaveGameArray[VAL_SLOT_START + cnt] = TRUE;
// anv: read last modified date property of save file // anv: read last modified date property of save file
#ifdef USE_VFS
// get full path to save file // get full path to save file
vfs::Path vfsPath; vfs::Path vfsPath;
vfs::COpenReadFile rfile(zSaveGameName); vfs::COpenReadFile rfile(zSaveGameName);
@@ -1369,7 +1368,6 @@ BOOLEAN InitSaveGameArray()
// close // close
CloseHandle( hFile ); CloseHandle( hFile );
rfile->close(); rfile->close();
#endif
} }
} }
else else
View File
View File
View File
View File
@@ -11,7 +11,6 @@
#include "input.h" #include "input.h"
#include "font.h" #include "font.h"
#include "screenids.h" #include "screenids.h"
#include "container.h"
#include "overhead.h" #include "overhead.h"
#include "sysutil.h" #include "sysutil.h"
#include "Font Control.h" #include "Font Control.h"
View File
View File
+10 -2
View File
@@ -166,6 +166,7 @@ UINT32 MainGameScreenInit(void)
UnLockVideoSurface( FRAME_BUFFER); UnLockVideoSurface( FRAME_BUFFER);
InitializeBackgroundRects(); InitializeBackgroundRects();
InitializeBaseDirtyRectQueue();
//EnvSetTimeInHours(ENV_TIME_12); //EnvSetTimeInHours(ENV_TIME_12);
@@ -188,8 +189,8 @@ UINT32 MainGameScreenInit(void)
giFPSOverlay = RegisterVideoOverlay( ( VOVERLAY_STARTDISABLED | VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc ); giFPSOverlay = RegisterVideoOverlay( ( VOVERLAY_STARTDISABLED | VOVERLAY_DIRTYBYTEXT ), &VideoOverlayDesc );
// SECOND, PERIOD COUNTER // SECOND, PERIOD COUNTER
VideoOverlayDesc.sLeft = 30; VideoOverlayDesc.sLeft = 0;
VideoOverlayDesc.sTop = 0; VideoOverlayDesc.sTop = 12;
VideoOverlayDesc.sX = VideoOverlayDesc.sLeft; VideoOverlayDesc.sX = VideoOverlayDesc.sLeft;
VideoOverlayDesc.sY = VideoOverlayDesc.sTop; VideoOverlayDesc.sY = VideoOverlayDesc.sTop;
swprintf( VideoOverlayDesc.pzText, L"Levelnodes: 100000" ); swprintf( VideoOverlayDesc.pzText, L"Levelnodes: 100000" );
@@ -627,7 +628,14 @@ UINT32 MainGameScreenHandle(void)
InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE ); InternalLocateGridNo( gGameUBOptions.LOCATEGRIDNO, TRUE );
} }
#else #else
if (gfFirstHeliRun)
{
InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE ); InternalLocateGridNo( gGameExternalOptions.iInitialMercArrivalLocation, TRUE );
}
else
{
InternalLocateGridNo(gMapInformation.sCenterGridNo, TRUE);
}
#endif #endif
// Flugente: we might have reloaded the game, so we are currently not dropping mercs out of a helicopter // Flugente: we might have reloaded the game, so we are currently not dropping mercs out of a helicopter
gfIngagedInDrop = FALSE; gfIngagedInDrop = FALSE;
View File
View File
+20 -53
View File
@@ -122,46 +122,33 @@ void DisplayFrameRate( )
uiFrameCount = 0; uiFrameCount = 0;
} }
// Create string
SetFont( SMALLFONT1 );
//DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String( "FPS: %d ", __min( uiFPS, 1000 ) ) );
if ( uiFPS < 20 )
{
SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_LTRED );
}
else
{
SetFontBackground( FONT_MCOLOR_BLACK );
SetFontForeground( FONT_MCOLOR_DKGRAY );
}
if ( gbFPSDisplay == SHOW_FULL_FPS ) if ( gbFPSDisplay == SHOW_FULL_FPS )
{ {
memset(&VideoOverlayDesc, 0, sizeof(VideoOverlayDesc));
// FRAME RATE // FRAME RATE
memset( &VideoOverlayDesc, 0, sizeof( VideoOverlayDesc ) ); VideoOverlayDesc.uiFontID = SMALLFONT1;
swprintf( VideoOverlayDesc.pzText, L"%ld", __min( uiFPS, 1000 ) ); VideoOverlayDesc.ubFontBack = FONT_MCOLOR_BLACK;
VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT; VideoOverlayDesc.ubFontFore = uiFPS < 20 ? FONT_MCOLOR_LTRED : FONT_MCOLOR_DKGRAY;
swprintf( VideoOverlayDesc.pzText, L"FPS: %ld", __min( uiFPS, 1000 ) );
VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT | VOVERLAY_DESC_FONT | VOVERLAY_DESC_DISABLED;
UpdateVideoOverlay( &VideoOverlayDesc, giFPSOverlay, FALSE ); UpdateVideoOverlay( &VideoOverlayDesc, giFPSOverlay, FALSE );
// TIMER COUNTER // TIMER COUNTER
swprintf( VideoOverlayDesc.pzText, L"%ld", __min( giTimerDiag, 1000 ) ); swprintf( VideoOverlayDesc.pzText, L"Frame: %04ld ms", __min( giTimerDiag, 10000 ) );
VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT; VideoOverlayDesc.uiFlags = VOVERLAY_DESC_TEXT | VOVERLAY_DESC_DISABLED;
UpdateVideoOverlay( &VideoOverlayDesc, giCounterPeriodOverlay, FALSE ); UpdateVideoOverlay( &VideoOverlayDesc, giCounterPeriodOverlay, FALSE );
//if( GetMouseMapPos( &usMapPos) )
if( GetMouseMapPos( &usMapPos) ) //{
{
//gprintfdirty( 0, 315, L"(%d)",sMapPos); //gprintfdirty( 0, 315, L"(%d)",sMapPos);
//mprintf( 0,315,L"(%d)",sMapPos); //mprintf( 0,315,L"(%d)",sMapPos);
} //}
else //else
{ //{
//gprintfdirty( 0, 315, L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y ); //gprintfdirty( 0, 315, L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y );
//mprintf( 0,315,L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y ); //mprintf( 0,315,L"(%d %d)",gusMouseXPos, gusMouseYPos - INTERFACE_START_Y );
} //}
} }
if ( ( gTacticalStatus.uiFlags & GODMODE ) ) if ( ( gTacticalStatus.uiFlags & GODMODE ) )
@@ -409,48 +396,28 @@ UINT32 InitScreenHandle(void)
// Handle queued .ini file error messages // Handle queued .ini file error messages
int y = 40; int y = 40;
#ifdef USE_VFS
sgp::Logger_ID ini_id = sgp::Logger::instance().createLogger(); sgp::Logger_ID ini_id = sgp::Logger::instance().createLogger();
sgp::Logger::instance().connectFile(ini_id, L"ERROR_REPORT.iniErrorMessages.txt", false, sgp::Logger::FLUSH_ON_DELETE); sgp::Logger::instance().connectFile(ini_id, L"iniErrorReport.txt", false, sgp::Logger::FLUSH_ON_DELETE);
sgp::Logger::LogInstance logger = sgp::Logger::instance().logger(ini_id); sgp::Logger::LogInstance logger = sgp::Logger::instance().logger(ini_id);
#endif
while (! iniErrorMessages.empty()) { while (! iniErrorMessages.empty()) {
#ifndef USE_VFS
FILE *file_pointer;
#endif
static BOOL iniErrorMessage_create_out_file = TRUE; static BOOL iniErrorMessage_create_out_file = TRUE;
std::string iniErrorMessage = iniErrorMessages.top(); std::string iniErrorMessage = iniErrorMessages.top();
CHAR16 str[256]; CHAR16 str[256];
if (iniErrorMessage_create_out_file) if (iniErrorMessage_create_out_file)
{ {
#ifndef USE_VFS
fopen_s( &file_pointer, "..\\ERROR_REPORT.iniErrorMessages.txt", "w" );
#endif
y += 25; y += 25;
swprintf( str, L"%S", "ERROR_REPORT.iniErrorMessages.txt has been created. Please review its content." ); swprintf( str, L"%S", "Warning: found the following ini errors. iniErrorReport.txt has been created." );
DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_RED, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED ); DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_ORANGE, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED );
iniErrorMessage_create_out_file = FALSE; iniErrorMessage_create_out_file = FALSE;
} }
else
{
#ifndef USE_VFS
fopen_s( &file_pointer, "..\\ERROR_REPORT.iniErrorMessages.txt", "a+" );
#endif
}
y += 25; y += 25;
swprintf( str, L"%S", iniErrorMessage.c_str() ); swprintf( str, L"%S", iniErrorMessage.c_str() );
#ifndef USE_VFS
fprintf_s (file_pointer , "%S\n" , str );
fclose( file_pointer );
#else
logger << iniErrorMessage << sgp::endl; logger << iniErrorMessage << sgp::endl;
#endif DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_ORANGE, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED );
DisplayWrappedString( 10, y, 560, 2, FONT12ARIAL, FONT_RED, str, FONT_BLACK, TRUE, LEFT_JUSTIFIED );
iniErrorMessages.pop();
if (iniErrorMessages.empty()) {for(int x=0 ; x <= 65535*2 ; x++);} iniErrorMessages.pop();
} }
InvalidateScreen( ); InvalidateScreen( );
View File
View File
View File
View File
View File
View File
View File
View File
+63 -82
View File
@@ -362,6 +362,29 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber );
void HandleBobbyRGunsKeyBoardInput(); void HandleBobbyRGunsKeyBoardInput();
void HandleBobbyRayMouseWheel(void); void HandleBobbyRayMouseWheel(void);
// Appends source STR16 to target STR16 using decorators ("\n" and "...").
// Returns TRUE if everything fits target, FALSE otherwise.
static BOOLEAN DecorateAppendString(STR16 target, size_t targetCapacity, STR16 source, UINT32 frontDecoratorsCnt = 1)
{
const CHAR16 DECORATOR0[] = L"\n";
const CHAR16 DECORATOR1[] = L"\n...";
BOOLEAN result = FALSE;
size_t decoratorLen = wcslen(DECORATOR0) * frontDecoratorsCnt;
if (wcslen(target) + decoratorLen + wcslen(source) + 1 < targetCapacity)
{
for (UINT32 i = 0; i < frontDecoratorsCnt; i++)
wcscat(target, DECORATOR0);
wcscat(target, source);
result = TRUE;
}
else if (wcslen(target) + wcslen(DECORATOR1) + 1 < targetCapacity)
{
wcscat(target, DECORATOR1);
} // otherwise don't even touch the target
return result;
}
void GameInitBobbyRGuns() void GameInitBobbyRGuns()
{ {
guiTempCurrentMode=0; guiTempCurrentMode=0;
@@ -4089,6 +4112,7 @@ void HandleBobbyRayMouseWheel(void)
void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber ) void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
{ {
const size_t ATTACHMENTS_STRBUF_SIZE = 3800;
CHAR16 zItemName[ SIZE_ITEM_NAME ]; CHAR16 zItemName[ SIZE_ITEM_NAME ];
UINT8 ubItemCount=0; UINT8 ubItemCount=0;
@@ -4115,12 +4139,9 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
// HEADROCK HAM 3: Variables for "Possible Attachment List" // HEADROCK HAM 3: Variables for "Possible Attachment List"
BOOLEAN fAttachmentsFound = FALSE; BOOLEAN fAttachmentsFound = FALSE;
// Contains entire string of attachment names // Contains entire string of attachment names
CHAR16 attachStr[3900]; CHAR16 attachStr[ATTACHMENTS_STRBUF_SIZE];
// Contains current attachment string
CHAR16 attachStr2[100];
// Contains temporary attachment list before added to string constant from text.h // Contains temporary attachment list before added to string constant from text.h
CHAR16 attachStr3[3900]; CHAR16 attachStr3[ATTACHMENTS_STRBUF_SIZE];
UINT16 usAttachment;
CreateItem(usItemNumber, 100, &pObject); CreateItem(usItemNumber, 100, &pObject);
INT16 ubAttackAPs = BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], &pObject, NULL ); INT16 ubAttackAPs = BaseAPsToShootOrStab( APBPConstants[DEFAULT_APS], APBPConstants[DEFAULT_AIMSKILL], &pObject, NULL );
@@ -4146,109 +4167,69 @@ void GetHelpTextForItemInLaptop( STR16 pzStr, UINT16 usItemNumber )
else else
wcscat( apStr, L" / -" ); wcscat( apStr, L" / -" );
// HEADROCK HAM 3: Empty these strings first, to avoid crashes. Please keep this here. attachStr[0] = 0;
swprintf( attachStr, L"" ); attachStr3[0] = 0;
swprintf( attachStr2, L"" );
swprintf( attachStr3, L"" );
// HEADROCK HAM 3: Generate list of possible attachments to a gun (Guns only!) // HEADROCK HAM 3: Generate list of possible attachments to a gun (Guns only!)
if (gGameExternalOptions.fBobbyRayTooltipsShowAttachments) if (gGameExternalOptions.fBobbyRayTooltipsShowAttachments)
{ {
UINT16 iLoop = 0; if (UsingNewAttachmentSystem())
// Check entire attachment list
while( 1 )
{ {
//Madd: Common Attachment Framework std::pair<std::multimap<UINT16, AttachmentStruct>::iterator, std::multimap<UINT16, AttachmentStruct>::iterator> range;
//TODO: Note that the items in this list will be duplicated if they are present in both the CAF and the old attachment method std::multimap<UINT16, AttachmentStruct>::iterator it;
//need to refactor this to work more like the NAS attachment slots method range = AttachmentBackmap.equal_range(Item[usItemNumber].uiIndex);
usAttachment = 0; for (it = range.first; it != range.second; it++)
if ( IsAttachmentPointAvailable(Item[usItemNumber].uiIndex, iLoop) )
{ {
usAttachment = iLoop; UINT16 attachmentId = it->second.attachmentIndex;
// If the attachment is not hidden if (!Item[attachmentId].hiddenaddon && !Item[attachmentId].hiddenattachment && ItemIsLegal(attachmentId, TRUE))
if (usAttachment > 0 && !Item[ usAttachment ].hiddenaddon && !Item[ usAttachment ].hiddenattachment)
{ {
if (wcslen( attachStr3 ) + wcslen(Item[usAttachment].szItemName) > 3800)
{
// End list early to avoid stack overflow
wcscat( attachStr3, L"\n..." );
break;
}
else
{// Add the attachment's name to the list.
fAttachmentsFound = TRUE; fAttachmentsFound = TRUE;
swprintf( attachStr2, L"\n%s", Item[ usAttachment ].szItemName ); if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[attachmentId].szItemName) == FALSE)
wcscat( attachStr3, attachStr2);
}
}
}
// Is the weapon we're checking the same as the one we're tooltipping?
usAttachment = 0;
if (Attachment[iLoop][1] == Item[usItemNumber].uiIndex)
{
usAttachment = Attachment[iLoop][0];
}
// If the attachment is not hidden
if (usAttachment > 0 && !Item[ usAttachment ].hiddenaddon && !Item[ usAttachment ].hiddenattachment)
{
if (wcslen( attachStr3 ) + wcslen(Item[usAttachment].szItemName) > 3800)
{
// End list early to avoid stack overflow
wcscat( attachStr3, L"\n..." );
break; break;
} }
else }
{// Add the attachment's name to the list. }
else // old attachment system
{
for (UINT32 itemId = 1; itemId < gMAXITEMS_READ; itemId++)
{
// If the attachment is not hidden and attachable to the gun (usItemNumber)
if (!Item[itemId].hiddenaddon && !Item[itemId].hiddenattachment &&
ItemIsLegal(itemId, TRUE) && IsAttachmentPointAvailable(Item[usItemNumber].uiIndex, itemId))
{
fAttachmentsFound = TRUE; fAttachmentsFound = TRUE;
swprintf( attachStr2, L"\n%s", Item[ usAttachment ].szItemName ); if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[itemId].szItemName) == FALSE)
wcscat( attachStr3, attachStr2);
}
}
iLoop++;
if (Attachment[iLoop][0] == 0 && Item[iLoop].usItemClass == 0)
{
// Reached end of list
break; break;
} }
} }
}
if (fAttachmentsFound) if (fAttachmentsFound)
{ {
// Add extra empty line and attachment list title DecorateAppendString(attachStr, ATTACHMENTS_STRBUF_SIZE, gWeaponStatsDesc[14], 2); // 2 new lines and "Attachments:" title
swprintf( attachStr, L"\n \n%s", gWeaponStatsDesc[ 14 ] ); DecorateAppendString(attachStr, ATTACHMENTS_STRBUF_SIZE, attachStr3, 0); // no new line, list of attachments (starts with new line)
wcscat( attachStr, attachStr3 );
} }
} }
//Sum up default attachments. //Sum up default attachments.
BOOLEAN fFoundDefault = FALSE; BOOLEAN fFoundDefault = FALSE;
swprintf( attachStr2, L"" ); attachStr3[0] = 0;
swprintf( attachStr3, L"" ); for (UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++)
for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++){
if(Item[usItemNumber].defaultattachments[cnt] != 0){
if (wcslen( attachStr ) + wcslen(attachStr3) + wcslen(Item[ Item[usItemNumber].defaultattachments[cnt] ].szItemName) > 3800)
{ {
// End list early to avoid stack overflow if (Item[usItemNumber].defaultattachments[cnt] != 0)
wcscat( attachStr3, L"\n..." ); {
if (DecorateAppendString(attachStr3, ATTACHMENTS_STRBUF_SIZE, Item[Item[usItemNumber].defaultattachments[cnt]].szItemName) == FALSE)
break; break;
}
fFoundDefault = TRUE; fFoundDefault = TRUE;
swprintf( attachStr2, L"\n%s", Item[ Item[usItemNumber].defaultattachments[cnt] ].szItemName ); }
wcscat( attachStr3, attachStr2 ); else // If we found an empty entry, we can assume the rest will be empty too.
} else {
//If we found an empty entry, we can assume the rest will be empty too.
break; break;
} }
}
if(fFoundDefault){ if (fFoundDefault)
//Found at least one default attachment, write it to the attachment string. {
CHAR16 defaultStr[50]; DecorateAppendString(attachStr, ATTACHMENTS_STRBUF_SIZE, gWeaponStatsDesc[17], 2); // 2 new lines and "Default:" title
swprintf( defaultStr, L"\n \n%s", gWeaponStatsDesc[ 17 ] ); DecorateAppendString(attachStr, ATTACHMENTS_STRBUF_SIZE, attachStr3, 0); // no new line, list of attachments (starts with new line)
wcscat( attachStr, defaultStr );
wcscat( attachStr, attachStr3 );
} }
// HEADROCK HAM 3: Added last string (attachStr), for display of the possible attachment list. // HEADROCK HAM 3: Added last string (attachStr), for display of the possible attachment list.
+1 -1
View File
@@ -21,7 +21,7 @@
#include "QuestText.h" //quest: name #include "QuestText.h" //quest: name
#include "laptop.h" //ui positions #include "laptop.h" //ui positions
#include "Utilities.h" #include "Utilities.h"
#include "Utils/Cursors.h" #include "Cursors.h"
#include "sysutil.h" //extra Buffer for scaling image #include "sysutil.h" //extra Buffer for scaling image
#include "vsurface.h" //fill extra buffer with black color #include "vsurface.h" //fill extra buffer with black color
#include "Text.h" #include "Text.h"
+1 -1
View File
@@ -36,7 +36,7 @@
#include "laptop.h"//UI dimensions, mouse regions #include "laptop.h"//UI dimensions, mouse regions
#include "Utilities.h"//file names #include "Utilities.h"//file names
#include "vobject.h"//video objects #include "vobject.h"//video objects
#include "Utils/Cursors.h" #include "Cursors.h"
#include "Text.h"//button text #include "Text.h"//button text
#include "Button System.h" #include "Button System.h"
#include "Encyclopedia_new.h" #include "Encyclopedia_new.h"
+4 -2
View File
@@ -15,6 +15,8 @@
#include "CharProfile.h" #include "CharProfile.h"
#include "soldier profile type.h" #include "soldier profile type.h"
#include "IMP Compile Character.h" #include "IMP Compile Character.h"
#include "IMP Disability Trait.h"
#include "IMP Character Trait.h"
#include "GameSettings.h" #include "GameSettings.h"
#include "Interface.h" #include "Interface.h"
@@ -671,7 +673,7 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber )
return FALSE; return FALSE;
} }
switch ( iPersonality ) switch ( iChosenDisabilityTrait() )
{ {
case HEAT_INTOLERANT: case HEAT_INTOLERANT:
if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 ) if ( zBackground[ ubNumber ].value[BG_DESERT] > 0 )
@@ -707,7 +709,7 @@ BOOLEAN IsBackGroundAllowed( UINT16 ubNumber )
break; break;
} }
switch ( iAttitude ) switch ( iChosenCharacterTrait() )
{ {
case CHAR_TRAIT_SOCIABLE: case CHAR_TRAIT_SOCIABLE:
if ( zBackground[ ubNumber ].uiFlags & BACKGROUND_XENOPHOBIC ) if ( zBackground[ ubNumber ].uiFlags & BACKGROUND_XENOPHOBIC )
-11
View File
@@ -1336,16 +1336,6 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId )
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: Nickname.dat")); DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("WriteOutCurrentImpCharacter: Nickname.dat"));
#ifndef USE_VFS
char zFileName[13];
char temp;
for(int i=0;i < 9;i++) // Madd: I couldn't get strcpy or anything to work here... weird... if s/o wants to fix it, go ahead
{
temp = (char) gMercProfiles[iProfileId].zNickname[i];
zFileName[i] = temp;
}
#else
char zFileName[32]; char zFileName[32];
if(vfs::Settings::getUseUnicode()) if(vfs::Settings::getUseUnicode())
{ {
@@ -1355,7 +1345,6 @@ void WriteOutCurrentImpCharacter( INT32 iProfileId )
{ {
vfs::String::narrow(gMercProfiles[iProfileId].zNickname, 10, zFileName, 32); vfs::String::narrow(gMercProfiles[iProfileId].zNickname, 10, zFileName, 32);
} }
#endif
// Changed by ADB, rev 1513 // Changed by ADB, rev 1513
//strcat(zFileName,IMP_FILENAME_SUFFIX); //strcat(zFileName,IMP_FILENAME_SUFFIX);
-1
View File
@@ -476,7 +476,6 @@ void GameInitFiles( )
{ {
if ( FileExists( FILES_DAT_FILE ) == TRUE ) if ( FileExists( FILES_DAT_FILE ) == TRUE )
{ {
FileClearAttributes( FILES_DAT_FILE );
FileDelete( FILES_DAT_FILE ); FileDelete( FILES_DAT_FILE );
} }
-1
View File
@@ -460,7 +460,6 @@ void GameInitFinances()
// unlink Finances data file // unlink Finances data file
if( (FileExists( FINANCES_DATA_FILE ) ) ) if( (FileExists( FINANCES_DATA_FILE ) ) )
{ {
FileClearAttributes( FINANCES_DATA_FILE );
FileDelete( FINANCES_DATA_FILE ); FileDelete( FINANCES_DATA_FILE );
} }
GetBalanceFromDisk( ); GetBalanceFromDisk( );
-1
View File
@@ -227,7 +227,6 @@ void GameInitHistory()
if( ( FileExists( HISTORY_DATA_FILE ) ) ) if( ( FileExists( HISTORY_DATA_FILE ) ) )
{ {
// unlink history file // unlink history file
FileClearAttributes( HISTORY_DATA_FILE );
FileDelete( HISTORY_DATA_FILE ); FileDelete( HISTORY_DATA_FILE );
} }
-4
View File
@@ -7136,28 +7136,24 @@ void ClearOutTempLaptopFiles( void )
// file file // file file
if ( (FileExists( "files.dat" ) == TRUE ) ) if ( (FileExists( "files.dat" ) == TRUE ) )
{ {
FileClearAttributes( "files.dat" );
FileDelete( "files.dat" ); FileDelete( "files.dat" );
} }
// finances // finances
if ( (FileExists( "finances.dat" ) == TRUE ) ) if ( (FileExists( "finances.dat" ) == TRUE ) )
{ {
FileClearAttributes( "finances.dat" );
FileDelete( "finances.dat" ); FileDelete( "finances.dat" );
} }
// email // email
if ( (FileExists( "email.dat" ) == TRUE ) ) if ( (FileExists( "email.dat" ) == TRUE ) )
{ {
FileClearAttributes( "email.dat" );
FileDelete( "email.dat" ); FileDelete( "email.dat" );
} }
// history // history
if ( (FileExists( "history.dat" ) == TRUE ) ) if ( (FileExists( "history.dat" ) == TRUE ) )
{ {
FileClearAttributes( "history.dat" );
FileDelete( "history.dat" ); FileDelete( "history.dat" );
} }
} }
+201 -27
View File
@@ -2170,7 +2170,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot)
for ( int i = APPROACH_FRIENDLY; i <= APPROACH_RECRUIT; ++i ) for ( int i = APPROACH_FRIENDLY; i <= APPROACH_RECRUIT; ++i )
{ {
mprintf( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), szLaptopStatText[7 + i] ); mprintf( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), szLaptopStatText[LAPTOP_STAT_TEXT_FRIENDLY_APPROACH-1 + i] ); // APPROACH_FRIENDLY is 1 so fix the offset
CHAR16 sStr[200]; CHAR16 sStr[200];
swprintf( sStr, L"" ); swprintf( sStr, L"" );
@@ -2180,7 +2180,7 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot)
swprintf( sStr, L"%d", val ); swprintf( sStr, L"%d", val );
FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH - 20, 0, sStr, PERS_FONT, &sX, &sY ); FindFontRightCoordinates( (INT16)(pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, sStr, PERS_FONT, &sX, &sY );
mprintf( sX, (pPersonnelScreenPoints[loc].y + 15), sStr ); mprintf( sX, (pPersonnelScreenPoints[loc].y + 15), sStr );
// Add specific region for fast help window // Add specific region for fast help window
@@ -2205,10 +2205,10 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot)
if ( (gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) ) if ( (gMercProfiles[pSoldier->ubProfile].ubMiscFlags3 & PROFILE_MISC_FLAG3_GOODGUY) )
{ {
CHAR16 sStr1[200]; CHAR16 sStr1[200];
swprintf( sStr1, szLaptopStatText[6] ); swprintf( sStr1, szLaptopStatText[LAPTOP_STAT_TEXT_GOOD_GUY] );
CHAR16 sStr2[200]; CHAR16 sStr2[200];
swprintf( sStr2, szLaptopStatText[7], pSoldier->GetName( ) ); swprintf( sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_REFUSES_TO_ATTACK_NON_HOSTILES], pSoldier->GetName( ) );
sX = pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH); sX = pPersonnelScreenPoints[loc].x + (iSlot*TEXT_BOX_WIDTH);
@@ -2233,16 +2233,190 @@ void DisplayCharPersonality(INT32 iId, INT32 iSlot)
++region; ++region;
} }
if ( !gGameExternalOptions.bDisableEvolution ) if (gGameExternalOptions.fMercGrowthModifiersEnabled)
{
if (gMercProfiles[pSoldier->ubProfile].fRegresses)
{ {
CHAR16 sStr2[200]; CHAR16 sStr2[200];
swprintf( sStr2, szLaptopStatText[12 + gMercProfiles[pSoldier->ubProfile].bEvolution], pSoldier->GetName() ); swprintf(sStr2, szLaptopStatText[LAPTOP_STAT_TEXT_MERC_REGRESSES]);
mprintf( (INT16)( pPersonnelScreenPoints[loc].x + ( iSlot*TEXT_BOX_WIDTH ) ), ( pPersonnelScreenPoints[loc].y + 15 ), sStr2 ); mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + 15), sStr2);
++loc; ++loc;
++region; ++region;
} }
else
{
const int THRESHOLD_FAST = -3; // this value and below: "fast"
const int THRESHOLD_SLOW = 3; // this value and above: "slow"
int yOffset = 15;
CHAR16 statTxt[200];
// health
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_HEALTH_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLife >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// strength
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_STRENGTH_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierStrength >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// agility
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_AGILITY_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierAgility >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// dexterity
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_DEXTERITY_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierDexterity >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// wisdom
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_WISDOM_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierWisdom >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// marksmanship
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MARKSMANSHIP_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMarksmanship >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// explosives
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPLOSIVES_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExplosive >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// leadership
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_LEADERSHIP_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierLeadership >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// medical
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MEDICAL_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMedical >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// mechanical
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_MECHANICAL_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierMechanical >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
yOffset += 10;
}
// exp level
{
swprintf(statTxt, szLaptopStatText[LAPTOP_STAT_TEXT_EXPERIENCE_SPEED]);
mprintf((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel <= THRESHOLD_FAST)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_FAST]);
else if (gMercProfiles[pSoldier->ubProfile].bGrowthModifierExpLevel >= THRESHOLD_SLOW)
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_SLOW]);
else
swprintf(statTxt, L"%s", szLaptopStatText[LAPTOP_STAT_TEXT_AVERAGE]);
FindFontRightCoordinates((INT16)(pPersonnelScreenPoints[loc].x + (iSlot * TEXT_BOX_WIDTH)), 0, TEXT_BOX_WIDTH, 0, statTxt, PERS_FONT, &sX, &sY);
mprintf(sX, (pPersonnelScreenPoints[loc].y + yOffset), statTxt);
}
}
}
} }
@@ -7991,6 +8165,21 @@ void AssignPersonnelSkillTraitHelpText( UINT8 ubTraitNumber, BOOLEAN fExpertLeve
wcscat( apStr, atStr ); wcscat( apStr, atStr );
} }
if( gSkillTraitValues.ubTHAPsNeededToThrowGrenadesReduction != 0 )
{
swprintf( atStr, gzIMPMinorTraitsHelpTextsThrowing[10], gSkillTraitValues.ubTHAPsNeededToThrowGrenadesReduction, sSpecialCharacters[0]);
wcscat( apStr, atStr );
}
if( gSkillTraitValues.ubTHMaxRangeToThrowGrenades != 0 )
{
swprintf( atStr, gzIMPMinorTraitsHelpTextsThrowing[11], gSkillTraitValues.ubTHMaxRangeToThrowGrenades, sSpecialCharacters[0]);
wcscat( apStr, atStr );
}
if( gSkillTraitValues.ubTHCtHWhenThrowingGrenades != 0 )
{
swprintf( atStr, gzIMPMinorTraitsHelpTextsThrowing[12], gSkillTraitValues.ubTHCtHWhenThrowingGrenades, sSpecialCharacters[0]);
wcscat( apStr, atStr );
}
break; break;
} }
case NIGHT_OPS_NT: case NIGHT_OPS_NT:
@@ -8096,44 +8285,29 @@ void AssignPersonnelSkillTraitHelpText( UINT8 ubTraitNumber, BOOLEAN fExpertLeve
case DEMOLITIONS_NT: case DEMOLITIONS_NT:
{ {
swprintf( apStr, L"" ); swprintf( apStr, L"" );
if( gSkillTraitValues.ubDEAPsNeededToThrowGrenadesReduction != 0 )
{
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[0], gSkillTraitValues.ubDEAPsNeededToThrowGrenadesReduction, sSpecialCharacters[0]);
wcscat( apStr, atStr );
}
if( gSkillTraitValues.ubDEMaxRangeToThrowGrenades != 0 )
{
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[1], gSkillTraitValues.ubDEMaxRangeToThrowGrenades, sSpecialCharacters[0]);
wcscat( apStr, atStr );
}
if( gSkillTraitValues.ubDECtHWhenThrowingGrenades != 0 )
{
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[2], gSkillTraitValues.ubDECtHWhenThrowingGrenades, sSpecialCharacters[0]);
wcscat( apStr, atStr );
}
if( gSkillTraitValues.ubDEDamageOfBombsAndMines != 0 ) if( gSkillTraitValues.ubDEDamageOfBombsAndMines != 0 )
{ {
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[3], gSkillTraitValues.ubDEDamageOfBombsAndMines, sSpecialCharacters[0]); swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[0], gSkillTraitValues.ubDEDamageOfBombsAndMines, sSpecialCharacters[0]);
wcscat( apStr, atStr ); wcscat( apStr, atStr );
} }
if( gSkillTraitValues.ubDEAttachDetonatorCheckBonus != 0 ) if( gSkillTraitValues.ubDEAttachDetonatorCheckBonus != 0 )
{ {
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[4], gSkillTraitValues.ubDEAttachDetonatorCheckBonus, sSpecialCharacters[0]); swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[1], gSkillTraitValues.ubDEAttachDetonatorCheckBonus, sSpecialCharacters[0]);
wcscat( apStr, atStr ); wcscat( apStr, atStr );
} }
if( gSkillTraitValues.ubDEPlantAndRemoveBombCheckBonus != 0 ) if( gSkillTraitValues.ubDEPlantAndRemoveBombCheckBonus != 0 )
{ {
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[5], gSkillTraitValues.ubDEPlantAndRemoveBombCheckBonus, sSpecialCharacters[0]); swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[2], gSkillTraitValues.ubDEPlantAndRemoveBombCheckBonus, sSpecialCharacters[0]);
wcscat( apStr, atStr ); wcscat( apStr, atStr );
} }
if( gSkillTraitValues.ubDEPlacedBombLevelBonus != 0 ) if( gSkillTraitValues.ubDEPlacedBombLevelBonus != 0 )
{ {
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[6], gSkillTraitValues.ubDEPlacedBombLevelBonus); swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[3], gSkillTraitValues.ubDEPlacedBombLevelBonus);
wcscat( apStr, atStr ); wcscat( apStr, atStr );
} }
if( gSkillTraitValues.ubDEShapedChargeDamageMultiplier != 0 ) if( gSkillTraitValues.ubDEShapedChargeDamageMultiplier != 0 )
{ {
swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[7], gSkillTraitValues.ubDEShapedChargeDamageMultiplier); swprintf( atStr, gzIMPMinorTraitsHelpTextsDemolitions[4], gSkillTraitValues.ubDEShapedChargeDamageMultiplier);
wcscat( apStr, atStr ); wcscat( apStr, atStr );
} }
break; break;
+12
View File
@@ -0,0 +1,12 @@
add_library(Multiplayer
"client.cpp"
"server.cpp"
"transfer_rules.cpp"
)
target_include_directories(Multiplayer PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
"raknet"
)
target_link_libraries(Multiplayer PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/raknet/RakNetLibStatic.lib"
)

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