Skip to content

Commit f982972

Browse files
authored
Merge branch 'master' into Premake_updates
2 parents 4a5d59a + c98430b commit f982972

File tree

23 files changed

+833
-526
lines changed

23 files changed

+833
-526
lines changed

examples/Test/Main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
#if defined(GTA3) or defined(GTAVC) or defined(GTASA)
44
#include <CMessages.h>
5+
#elif defined (GTA2)
6+
#include <CHud.h>
57
#endif
68

79
using namespace plugin;
@@ -18,6 +20,8 @@ struct Main
1820
{
1921
#if defined(GTA3) or defined(GTAVC) or defined(GTASA)
2022
CMessages::AddMessageJumpQ("Hello, world!", 500, 0);
23+
#elif defined (GTA2)
24+
GetHud()->m_HudMessage.SetHudMessage(L"Hello, world!", MESSAGE_DISPLAY_NOW);
2125
#endif
2226
}
2327
} gInstance;

examples/Texture/Main.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
11
#include "plugin.h"
2+
#include "SpriteLoader.h"
23
#include "CSprite2d.h"
34

45
using namespace plugin;
56

67
class TextureExample {
78
public:
8-
TextureExample() {
9-
static CSprite2d sprite;
9+
static inline plugin::SpriteLoader spriteLoader = {};
1010

11-
Events::drawingEvent += [] {
12-
if(!sprite.m_pTexture) // load texture only once
13-
sprite.m_pTexture = RwD3D9DDSTextureRead(PLUGIN_PATH((char*)"image"), 0); // rw api gives you ability to load dds images
11+
TextureExample() {
12+
Events::drawHudEvent += [] {
13+
auto sprite = spriteLoader.GetSprite("image"); // get sprite called image
1414
sprite.Draw(CRect(10.0f, 10.0f, 300.0f, 300.0f), CRGBA(255, 255, 255, 255)); // draw sprite
1515
};
1616

17+
Events::initRwEvent += []() {
18+
spriteLoader.LoadSpriteFromFolder(PLUGIN_PATH("image.png")); // load single sprite called image.png
19+
};
20+
1721
Events::shutdownRwEvent += [] {
18-
sprite.Delete(); // delete loaded texture
22+
spriteLoader.Clear(); // delete any loaded sprites
1923
};
2024
}
2125
} texExample;

plugin_II/game_II/CHud.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void CHud::DrawSprite(int id1, int id2, int x, int y, char style, int const& mod
2929
plugin::CallStd<0x4C71B0, int, int, int, int, char, int const&, int, int, char>(id1, id2, x, y, style, mode, enableAlpha, alpha, unk);
3030
}
3131

32-
void CHudMessage::SetHudMessage(wchar_t* str, int priority) {
32+
void CHudMessage::SetHudMessage(const wchar_t* str, int priority) {
3333
plugin::CallMethod<0x4C6060>(this, str, priority);
3434
}
3535

plugin_II/game_II/CHud.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class CHudMessage {
6666
int m_nType;
6767

6868
public:
69-
void SetHudMessage(wchar_t* str, int priority);
69+
void SetHudMessage(const wchar_t* str, int priority);
7070
};
7171

7272
VALIDATE_SIZE(CHudMessage, 0x1C8);

plugin_III/game_III/CGame.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,7 @@ CSprite2d* LoadSplash(const char* name) {
139139
RsEventStatus RsEventHandler(RsEvent event, void* param) {
140140
return plugin::CallAndReturnDyn<RsEventStatus>(0x584A20, event, param);
141141
}
142+
143+
void RenderScene() {
144+
plugin::Call<0x48E030>();
145+
}

plugin_III/game_III/CGame.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ extern class CSprite2d* LoadSplash(const char* name);
5050

5151
extern RsEventStatus RsEventHandler(RsEvent event, void* param);
5252

53+
extern void RenderScene();
54+
5355
#include "meta/meta.CGame.h"

plugin_III/game_III/CRect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
class CRect {
1313
public:
1414
float left;
15-
float top;
16-
float right;
1715
float bottom;
16+
float right;
17+
float top;
1818

1919
CRect(plugin::dummy_func_t) {}
2020

plugin_iii_unreal/game_iii_unreal/CRect.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
class CRect {
1111
public:
1212
float left;
13-
float top;
14-
float right;
1513
float bottom;
14+
float right;
15+
float top;
1616

1717
public:
1818
CRect(plugin::dummy_func_t) {

plugin_sa/game_sa/CGame.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,7 @@ void DoRwStuffEndOfFrame() {
231231
RsEventStatus RsEventHandler(RsEvent event, void* param) {
232232
return plugin::CallAndReturnDyn<RsEventStatus>(0x619B60, event, param);
233233
}
234+
235+
void RenderScene() {
236+
plugin::Call<0x53DF40>();
237+
}

plugin_sa/game_sa/CGame.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,6 @@ SUPPORTED_10US void ValidateVersion();
5858
SUPPORTED_10US void D3DDeviceRestoreCallback();
5959
SUPPORTED_10US bool DoHaspChecks();
6060
extern RsEventStatus RsEventHandler(RsEvent event, void* param);
61+
extern void RenderScene();
6162

6263
#include "meta/meta.CGame.h"

0 commit comments

Comments
 (0)