Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit 51ad061

Browse files
committed
Fixed primitives not drawing when called to draw without player argument (draw for everyone) with lua
1 parent e3d56a1 commit 51ad061

File tree

3 files changed

+7
-74
lines changed

3 files changed

+7
-74
lines changed

Managers/PrimitiveMan.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,6 @@ namespace RTE {
66

77
const std::string PrimitiveMan::c_ClassName = "PrimitiveMan";
88

9-
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
10-
11-
void PrimitiveMan::DrawBitmapPrimitive(Vector start, Entity *entity, float rotAngle, unsigned short frame) {
12-
const MOSprite *moSprite = dynamic_cast<MOSprite *>(entity);
13-
if (moSprite) {
14-
BITMAP *pBitmap = moSprite->GetSpriteFrame(frame);
15-
if (pBitmap) { m_Primitives.push_back(new BitmapPrimitive(start, pBitmap, rotAngle)); }
16-
}
17-
}
18-
199
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2010

2111
void PrimitiveMan::DrawBitmapPrimitive(short player, Vector start, Entity *entity, float rotAngle, unsigned short frame) {

Managers/PrimitiveMan.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ namespace RTE {
5151
/// <param name="start">Start position of primitive in scene coordinates.</param>
5252
/// <param name="end">End position of primitive in scene coordinates.</param>
5353
/// <param name="color">Color to draw primitive with.</param>
54-
void DrawLinePrimitive(Vector start, Vector end, unsigned char color) { m_Primitives.push_back(new LinePrimitive(start, end, color)); }
54+
void DrawLinePrimitive(Vector start, Vector end, unsigned char color) { m_Primitives.push_back(new LinePrimitive(-1, start, end, color)); }
5555

5656
/// <summary>
5757
/// Schedule to draw a line primitive visible only to a specified player.
@@ -68,7 +68,7 @@ namespace RTE {
6868
/// <param name="start">Start position of primitive in scene coordinates.</param>
6969
/// <param name="end">End position of primitive in scene coordinates.</param>
7070
/// <param name="color">Color to draw primitive with.</param>
71-
void DrawBoxPrimitive(Vector start, Vector end, unsigned char color) { m_Primitives.push_back(new BoxPrimitive(start, end, color)); }
71+
void DrawBoxPrimitive(Vector start, Vector end, unsigned char color) { m_Primitives.push_back(new BoxPrimitive(-1, start, end, color)); }
7272

7373
/// <summary>
7474
/// Schedule to draw a box primitive visible only to a specified player.
@@ -85,7 +85,7 @@ namespace RTE {
8585
/// <param name="start">Start position of primitive in scene coordinates.</param>
8686
/// <param name="end">End position of primitive in scene coordinates.</param>
8787
/// <param name="color">Color to draw primitive with.</param>
88-
void DrawBoxFillPrimitive(Vector start, Vector end, unsigned char color) { m_Primitives.push_back(new BoxFillPrimitive(start, end, color)); }
88+
void DrawBoxFillPrimitive(Vector start, Vector end, unsigned char color) { m_Primitives.push_back(new BoxFillPrimitive(-1, start, end, color)); }
8989

9090
/// <summary>
9191
/// Schedule to draw a filled box primitive visible only to a specified player.
@@ -102,7 +102,7 @@ namespace RTE {
102102
/// <param name="pos">Position of primitive in scene coordinates.</param>
103103
/// <param name="radius">Radius of circle primitive.</param>
104104
/// <param name="color">Color to draw primitive with.</param>
105-
void DrawCirclePrimitive(Vector pos, short radius, unsigned char color) {m_Primitives.push_back(new CirclePrimitive(pos, radius, color));}
105+
void DrawCirclePrimitive(Vector pos, short radius, unsigned char color) {m_Primitives.push_back(new CirclePrimitive(-1, pos, radius, color));}
106106

107107
/// <summary>
108108
/// Schedule to draw a circle primitive visible only to a specified player.
@@ -119,7 +119,7 @@ namespace RTE {
119119
/// <param name="pos">Position of primitive in scene coordinates.</param>
120120
/// <param name="radius">Radius of circle primitive.</param>
121121
/// <param name="color">Color to fill primitive with.</param>
122-
void DrawCircleFillPrimitive(Vector pos, short radius, unsigned char color) {m_Primitives.push_back(new CircleFillPrimitive(pos, radius, color));}
122+
void DrawCircleFillPrimitive(Vector pos, short radius, unsigned char color) {m_Primitives.push_back(new CircleFillPrimitive(-1, pos, radius, color));}
123123

124124
/// <summary>
125125
/// Schedule to draw a filled circle primitive visible only to a specified player.
@@ -137,7 +137,7 @@ namespace RTE {
137137
/// <param name="text">Text string to draw.</param>
138138
/// <param name="isSmall">Use small or large font. True for small font.</param>
139139
/// <param name="alignment">Alignment of text.</param>
140-
void DrawTextPrimitive(Vector start, std::string text, bool isSmall, short alignment) {m_Primitives.push_back(new TextPrimitive(start, text, isSmall, alignment));}
140+
void DrawTextPrimitive(Vector start, std::string text, bool isSmall, short alignment) {m_Primitives.push_back(new TextPrimitive(-1, start, text, isSmall, alignment));}
141141

142142
/// <summary>
143143
/// Schedule to draw a text primitive visible only to a specified player.
@@ -156,7 +156,7 @@ namespace RTE {
156156
/// <param name="entity">An entity to draw sprite from.</param>
157157
/// <param name="rotAngle">Rotation angle in radians.</param>
158158
/// <param name="">Frame to draw.</param>
159-
void DrawBitmapPrimitive(Vector start, Entity *entity, float rotAngle, unsigned short frame);
159+
void DrawBitmapPrimitive(Vector start, Entity *entity, float rotAngle, unsigned short frame) { DrawBitmapPrimitive(-1, start, entity, rotAngle, frame); }
160160

161161
/// <summary>
162162
/// Schedule to draw a bitmap primitive visible only to a specified player.

System/Primitive.h

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ namespace RTE {
5858

5959
public:
6060

61-
/// <summary>
62-
/// Constructor method for LinePrimitive object.
63-
/// </summary>
64-
/// <param name="start">Start position of the primitive.</param>
65-
/// <param name="end">End position of the primitive.</param>
66-
/// <param name="color">Color to draw this primitive with.</param>
67-
LinePrimitive(Vector start, Vector end, unsigned char color) { LinePrimitive(-1, start, end, color); }
68-
6961
/// <summary>
7062
/// Constructor method for LinePrimitive object.
7163
/// </summary>
@@ -97,14 +89,6 @@ namespace RTE {
9789

9890
public:
9991

100-
/// <summary>
101-
/// Constructor method for BoxPrimitive object.
102-
/// </summary>
103-
/// <param name="start">Start position of the primitive.</param>
104-
/// <param name="end">End position of the primitive.</param>
105-
/// <param name="color">Color to draw this primitive with.</param>
106-
BoxPrimitive(Vector start, Vector end, unsigned char color) { BoxPrimitive(-1, start, end, color); }
107-
10892
/// <summary>
10993
/// Constructor method for BoxPrimitive object.
11094
/// </summary>
@@ -136,14 +120,6 @@ namespace RTE {
136120

137121
public:
138122

139-
/// <summary>
140-
/// Constructor method for BoxFillPrimitive object.
141-
/// </summary>
142-
/// <param name="start">Start position of the primitive.</param>
143-
/// <param name="end">End position of the primitive.</param>
144-
/// <param name="color">Color to draw this primitive with.</param>
145-
BoxFillPrimitive(Vector start, Vector end, unsigned char color) { BoxFillPrimitive(-1, start, end, color); }
146-
147123
/// <summary>
148124
/// Constructor method for BoxFillPrimitive object.
149125
/// </summary>
@@ -182,14 +158,6 @@ namespace RTE {
182158
/// </summary>
183159
CirclePrimitive() { m_Radius = 0; }
184160

185-
/// <summary>
186-
/// Constructor method for CirclePrimitive object.
187-
/// </summary>
188-
/// <param name="pos">Position of this primitive.</param>
189-
/// <param name="radius">Radius of the circle primitive.</param>
190-
/// <param name="color">Color to draw this primitive with.</param>
191-
CirclePrimitive(Vector pos, short radius, unsigned char color) { CirclePrimitive(-1, pos, radius, color); }
192-
193161
/// <summary>
194162
/// Constructor method for CirclePrimitive object.
195163
/// </summary>
@@ -228,14 +196,6 @@ namespace RTE {
228196
/// </summary>
229197
CircleFillPrimitive() { m_Radius = 0; }
230198

231-
/// <summary>
232-
/// Constructor method for CircleFillPrimitive object.
233-
/// </summary>
234-
/// <param name="pos">Position of this primitive.</param>
235-
/// <param name="radius">Radius of the circle primitive.</param>
236-
/// <param name="color">Color to draw this primitive with.</param>
237-
CircleFillPrimitive(Vector pos, short radius, unsigned char color) { CircleFillPrimitive(-1, pos, radius, color); }
238-
239199
/// <summary>
240200
/// Constructor method for CircleFillPrimitive object.
241201
/// </summary>
@@ -281,15 +241,6 @@ namespace RTE {
281241
m_Player = -1;
282242
}
283243

284-
/// <summary>
285-
/// Constructor method for TextPrimitive object.
286-
/// </summary>
287-
/// <param name="pos">Position of this primitive.</param>
288-
/// <param name="text">String containing text to draw.</param>
289-
/// <param name="isSmall">Use small or large font. True for small font.</param>
290-
/// <param name="alignment">Alignment of text.</param>
291-
TextPrimitive(Vector pos, std::string text, bool isSmall, short alignment) { TextPrimitive(-1, pos, text, isSmall, alignment); }
292-
293244
/// <summary>
294245
/// Constructor method for TextPrimitive object.
295246
/// </summary>
@@ -335,14 +286,6 @@ namespace RTE {
335286
m_Player = -1;
336287
}
337288

338-
/// <summary>
339-
/// Constructor method for BitmapPrimitive object.
340-
/// </summary>
341-
/// <param name="pos">Position of this primitive.</param>
342-
/// <param name="bitmap">Bitmap to draw.</param>
343-
/// <param name="rotAngle">Angle to rotate bitmap in radians.</param>
344-
BitmapPrimitive(Vector pos, BITMAP * bitmap, float rotAngle) { BitmapPrimitive(-1, pos, bitmap, rotAngle); }
345-
346289
/// <summary>
347290
/// Constructor method for BitmapPrimitive object.
348291
/// </summary>

0 commit comments

Comments
 (0)