Commit Graph
114 Commits
Author SHA1 Message Date
Asdow c341402fe1 set functions static 2025-12-03 23:52:05 +02:00
Asdow 80b1af930a include cleanup 2025-12-03 23:52:05 +02:00
Asdow c1b8309753 Expand UB_SetNumberJa25EnemiesInSurfaceSector
* Allow adding jeeps and robots to sectors now
* From Lua side, it is now possible to add differing amount of arguments to the function. Minimum required is 3 (sector x & y and amount of admins)
So all of the following examples will work correctly:

- UB_SetNumberJa25EnemiesInSurfaceSector( x, y, ubNumAdmins )

- UB_SetNumberJa25EnemiesInSurfaceSector( x, y, ubNumAdmins, ubNumTroops )

- - UB_SetNumberJa25EnemiesInSurfaceSector( x, y, ubNumAdmins, ubNumTroops,ubNumElites )

- UB_SetNumberJa25EnemiesInSurfaceSector( x, y, ubNumAdmins, ubNumTroops,ubNumElites, ubNumTanks )

- UB_SetNumberJa25EnemiesInSurfaceSector( x, y, ubNumAdmins, ubNumTroops,ubNumElites, ubNumTanks , ubNumJeeps )

- UB_SetNumberJa25EnemiesInSurfaceSector( x, y, ubNumAdmins, ubNumTroops,ubNumElites, ubNumTanks , ubNumJeeps, ubNumRobots )
2025-11-29 11:46:45 +02:00
Asdow 584f6b47e6 Supply ProfileID to LUA scripts instead of SoldierID
Lua scripts expect to receive the same profileID value back from l_FindSolderByProfileID() that is supplied to it on the script side. This is a bit suboptimal as we constantly keep searching for the correct soldier on different calls to C++ side with the way it works now.
2025-10-11 11:43:37 +03:00
Asdow e1acf181df Add FIXME 2025-09-29 11:58:55 +03:00
Asdow 0f8c14e72e Remove FindSoldierByProfileID_()
All the calls where this was used are functionally identical when we just supply UID to the original FindSoldierByProfileID() call with fPlayerMercsOnly set to FALSE
2025-09-29 11:58:55 +03:00
Asdow ecea18f57c Add FIXME to l_ActionInProgress 2025-09-29 11:58:55 +03:00
Asdow e63e936715 Clean up
* Removed superfluous for-if loops
* Wrapped function contents inside if(lua_gettop(L)) scopes similar to other, already fixed functions
* Harmonized whitespace
* Added FIXMEs to two unfinished functions
2025-09-29 11:58:55 +03:00
Asdow a15ed3aceb Fix l_SoldierGiveItem(lua_State* L)
Don't use SoldierID when matching for profile id
2025-09-29 11:58:55 +03:00
Asdow 0cb13650ed Fix whitespace formatting 2025-09-29 11:58:55 +03:00
Asdow 601ef4dc30 Remove duplicate includes 2025-09-29 11:58:55 +03:00
Asdow 82aca548f5 Merge branch 'master' into ExtraMercs 2025-09-24 16:14:10 +03:00
BeatAroundTheBuscherandGitHub ed00830202 Fixes Upper/Lower Casing for include paths (#487)
* Fixing upper/lower case for includes

types.h, zconf.h and zlib.h were renamed so that global includes like Types.h
are not used.
2025-08-16 22:01:12 -03:00
Asdow c62d767622 Update to Master 2025-08-08 18:00:31 +03:00
Marco Antonio J. Costa 70f09471c2 just cast g_lang into lua's language code
because magically I got the enum order right first try
2024-12-31 16:28:44 -03:00
Asdow de56f653ec Use SoldierID 2024-11-30 23:47:00 +02:00
Asdow 0dc2ceabb2 Use SoldierID 2024-11-21 19:48:54 +02:00
Asdow 1ec2867ced Use SoldierID
Fixed if conditions as well
SOLDIERTYPE::ubProfile would never match with values above NOBODY
2024-11-20 23:02:39 +02:00
Asdow a9120ef984 Remove unused function 2024-11-20 22:35:55 +02:00
Asdow 8e4307b2fb Use SoldierID 2024-11-20 19:56:38 +02:00
Asdow f50bdf99cc Convert to SoldierID 2024-11-17 20:41:09 +02:00
Asdow 34f0b40f93 Convert functions and globals to SoldierID 2024-11-17 14:53:52 +02:00
Asdow 3ff4cc0c19 GENERAL_SAVE_INFO members to SoldierID 2024-11-16 01:22:20 +02:00
Asdow cba88ab2bc Update LuaInitNPCs.cpp
convert l_ACTION_ITEM_SEX (lua_State *L) to use SoldierID properly
2024-11-15 01:34:10 +02:00
Asdow 508310be3e Change UINT8 to UINT16 for soldierInitLists & hostiles in sector 2024-11-10 01:19:05 +02:00
Asdow 10250dc035 Merge branch 'master' into ExtraMercs 2024-11-09 13:44:53 +02:00
AsdowandGitHub bf01f87cb4 Revert "Cache result of evaluating strategicmap.lua (#32)" (#293)
This reverts commit 8f22d13fd9.
2024-03-16 13:00:04 +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
Asdow 03482ffc3d Merge branch 'master' into ExtraMercs 2023-07-26 13:17:49 +03:00
Marco Antonio Jaguaribe CostaandAsdow 8b1c4effa0 nuke all the #if 0's
scripted commit:

find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';'

https://coan2.sourceforge.net/coan_man_1.html
2023-01-19 00:13:08 +02:00
majcostaandGitHub 24425a82b1 More unused stuff removal (#49)
* More unused stuff removal

delete:
- giant 'metaheaders' (JA2 All.h, Laptop All.h, etc), preferring to add #includes directly where needed
- unused ExceptionHandling and DbMan translation units
- unused WizShare.h, Bitmap.h, trle.h, video_private.h headers

* remove mentions from vc proj files too

* remove preprocessor conditionals for unused definitions

find . -iname '*.h' -o -iname '*.cpp' -exec unifdef.exe -m -UPRECOMPILED_HEADERS -UJA2_PRECOMPILED_HEADERS -UWIZ8_PRECOMPILED_HEADERS -UPRECOMPILEDHEADERS {} ';'

then manually fixed a couple files the tool errored out on

* yes, the comments too

as title
2023-01-03 15:51:48 +02:00
AsdowandGitHub 8f22d13fd9 Cache result of evaluating strategicmap.lua (#32) 2022-11-23 21:59:27 +02:00
Asdow 1f0a8f46e8 Import changes from the local SVN working copy 2022-10-10 10:08:44 +03:00
Sevenfm 0fdaba84f6 World items patch (by Asdow).
Adds timing logs to savegame function, similar to how we already had in loading a save file. 
Uses a global struct for unloaded sectors' inventory instead of using map item temp files every time unloaded inventory is accessed.
From timing loading and saving functions with a save that has dozens of sectors with hundreds of items each, saving is a little bit slower than before, because map item temp files have to be written to disk just before the save, when that wasn't the case before (from ~0.3 s -> ~0.5s). It is offset by a decrease in loading a game (from ~1.1s -> 0.745s), once an older save is saved at least once. Any unloaded sector inventory access during gameplay is considerably faster and for example the autoresolve lag when militia is using sector equipment is completely gone for me.
Preserves save game compatibility

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9277 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2022-01-26 01:02:30 +00:00
Sevenfm 0a717c2697 Removed option AI_DECISION_INFO.
Added quest debug logging to Logs\QuestInfo.txt

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9177 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-10-14 08:35:32 +00:00
Flugente 58379b84cd Minor code improvements
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9147 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-24 19:16:12 +00:00
Flugente 6cad680b02 We can now use interactive actions to alter decals on walls, so it is possible to simulate taking off an object from the scenery and add it as an item.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=363513&#msg_363513

Requires GameDir >= r2601

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9141 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-13 19:50:49 +00:00
Flugente 8d112e5191 Added lua function for finding/creating/destroying items in a soldier's inventory
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9132 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-08 19:23:26 +00:00
Flugente 3f4da5fad5 Interactive actions now allows displaying images.
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=23144&goto=363478&#msg_363478

GameDir >= r2597 recommended.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9131 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-07-07 20:05:42 +00:00
Sevenfm b6f15b2347 Add robots to enemy groups (by rftr).
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8956 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2021-04-03 03:32:40 +00:00
Flugente 8e4961f021 Fix: various compile warnings
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8872 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-07-24 19:27:34 +00:00
Flugente 3b3abc2bc6 We can play external dialogue lines for NPC merchants via the lua function HandleNPCMerchantQuote(...)
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&th=20611&goto=360388&#msg_360388

Requires GameDir >= r2550.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8821 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-06-17 20:21:39 +00:00
Flugente 97fa0c8e90 Added interface functions fo lua
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8819 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-06-11 18:33:20 +00:00
Flugente ea1892c788 New feature: factories allows facilities to create items
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=360075&#msg_360075

Requires GameDir >= r2534

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8804 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-05-17 20:52:27 +00:00
Sevenfm 9e1b5338a6 More AI logging information.
PanicAI: use correct movement and stealth mode when determining AP needed.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8768 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-03-08 22:39:21 +00:00
Sevenfm 8b53d273f9 New tags in CivGroupNames.xml: Side, CustomSide allow setting custom side for civilian group.
NewEye: fix possible bug.
InitShopKeeperSubTitledText: correctly initialize data.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8764 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-02-27 10:51:45 +00:00
Sevenfm 77f5a7770d l_SetMercProfiles: allow serting zero values for sSectorX and sSectorY.
Added more restriction for using grenades in CalcBestThrow:
- blinded soldier can only attack recently seen/heard opponents
- limit explosives type when attacking zombies
- limit smoke grenade use
- limit explosives type when attacking robots, vehicles and tanks
- don't use grenades against dying enemies
- limit explosives type when attacking collapsed enemies
- don't use flare if soldier is in light
- don't use flares against opponents on roof

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8736 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-20 18:01:18 +00:00
Sevenfm 6386338422 Lua code improvements.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8727 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-09 12:19:56 +00:00
Sevenfm e35c52821f Improved Lua code:
- default values
- array bounds
- min/max values
- correct variable types

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8726 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-09 12:11:18 +00:00
Sevenfm 9e6412a937 Lua: initialize return values to prevent returning garbage if soldier is not found.
Improved r8104 fix to allow Fatima quest (civilians and NPCs with profile can go off screen).

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8725 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2020-01-08 17:17:59 +00:00