Skip to content

Commit e15384f

Browse files
Script enhancements (#527)
* Fix for remaster darkpilo.cfg which is not located in the game folder. * Add for linux compatibility * Update Linux pathing. * fix for nix paths * change the path path based on testing on proton. * Add random call to force script * Send text messages to hud directly from script. --------- Co-authored-by: Karjala22 <78927981+Karjala22@users.noreply.github.com>
1 parent bf3d3ca commit e15384f

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

TheForceEngine/TFE_DarkForces/Scripting/gs_game.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#include "gs_game.h"
2-
#include <TFE_System/system.h>
2+
#include <TFE_DarkForces/hud.h>
3+
#include <TFE_DarkForces/random.h>
34
#include <TFE_DarkForces/time.h>
4-
5+
#include <TFE_System/system.h>
6+
#include <string>
57
#include <angelscript.h>
68

79
using namespace TFE_Jedi;
@@ -15,12 +17,24 @@ namespace TFE_DarkForces
1517
return f32(s_curTick) * c_timeScale;
1618
}
1719

20+
s32 GS_Game::scriptRandom(s32 value)
21+
{
22+
return random(value);
23+
}
24+
25+
void GS_Game::text(string msg)
26+
{
27+
TFE_DarkForces::hud_sendTextMessage(msg.c_str(), 0, false);
28+
}
29+
1830
bool GS_Game::scriptRegister(ScriptAPI api)
1931
{
2032
ScriptClassBegin("Game", "game", api);
2133
{
2234
// Functions
2335
ScriptObjMethod("float getGameTime()", getGameTime);
36+
ScriptObjMethod("int random(int)", scriptRandom);
37+
ScriptObjMethod("void text(string)", text);
2438
}
2539
ScriptClassEnd();
2640
}

TheForceEngine/TFE_DarkForces/Scripting/gs_game.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// in order to properly test elements in isolation without having
77
// to "play" the game as intended.
88
//////////////////////////////////////////////////////////////////////
9+
#include <string>
910
#include <TFE_System/system.h>
1011
#include <TFE_System/types.h>
1112
#include <TFE_ForceScript/scriptInterface.h>
@@ -19,6 +20,8 @@ namespace TFE_DarkForces
1920
bool scriptRegister(ScriptAPI api) override;
2021

2122
f32 getGameTime();
23+
s32 scriptRandom(s32 value);
24+
void text(std::string msg);
2225
};
2326
}
2427

0 commit comments

Comments
 (0)