Skip to content

Commit dec5091

Browse files
committed
float the uints
1 parent 65af2ec commit dec5091

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

Source/Lua/LuaBindingsManagers.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,21 +262,21 @@ LuaBindingRegisterFunctionDefinitionForType(ManagerLuaBindings, PrimitiveMan) {
262262
.def("DrawTextPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& text, bool isSmall, int alignment)) & PrimitiveMan::DrawTextPrimitive)
263263
.def("DrawTextPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& text, bool isSmall, int alignment, float rotAngle)) & PrimitiveMan::DrawTextPrimitive)
264264
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame)) & PrimitiveMan::DrawBitmapPrimitive)
265-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale)) & PrimitiveMan::DrawBitmapPrimitive)
265+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale)) & PrimitiveMan::DrawBitmapPrimitive)
266266
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
267-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
267+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
268268
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame)) & PrimitiveMan::DrawBitmapPrimitive)
269-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale)) & PrimitiveMan::DrawBitmapPrimitive)
269+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale)) & PrimitiveMan::DrawBitmapPrimitive)
270270
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
271-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
271+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
272272
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle)) & PrimitiveMan::DrawBitmapPrimitive)
273-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle, unsigned int scale)) & PrimitiveMan::DrawBitmapPrimitive)
273+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle, float scale)) & PrimitiveMan::DrawBitmapPrimitive)
274274
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
275-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
275+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(const Vector& start, const std::string& filePath, float rotAngle, float scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
276276
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle)) & PrimitiveMan::DrawBitmapPrimitive)
277-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle, unsigned int scale)) & PrimitiveMan::DrawBitmapPrimitive)
277+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle, float scale)) & PrimitiveMan::DrawBitmapPrimitive)
278278
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
279-
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
279+
.def("DrawBitmapPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, const std::string& filePath, float rotAngle, float scale, bool hFlipped, bool vFlipped)) & PrimitiveMan::DrawBitmapPrimitive)
280280
.def("DrawIconPrimitive", (void(PrimitiveMan::*)(const Vector& start, Entity* entity)) & PrimitiveMan::DrawIconPrimitive)
281281
.def("DrawIconPrimitive", (void(PrimitiveMan::*)(int player, const Vector& start, Entity* entity)) & PrimitiveMan::DrawIconPrimitive)
282282

Source/Managers/PrimitiveMan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ void PrimitiveMan::DrawTextPrimitive(int player, const Vector& start, const std:
217217
SchedulePrimitive(std::make_unique<TextPrimitive>(player, start, text, isSmall, alignment, rotAngle));
218218
}
219219

220-
void PrimitiveMan::DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale, bool hFlipped, bool vFlipped) {
220+
void PrimitiveMan::DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale, bool hFlipped, bool vFlipped) {
221221
SchedulePrimitive(std::make_unique<BitmapPrimitive>(player, centerPos, moSprite, rotAngle, frame, scale, hFlipped, vFlipped));
222222
}
223223

224-
void PrimitiveMan::DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped) {
224+
void PrimitiveMan::DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, float scale, bool hFlipped, bool vFlipped) {
225225
SchedulePrimitive(std::make_unique<BitmapPrimitive>(player, centerPos, filePath, rotAngle, scale, hFlipped, vFlipped));
226226
}
227227

Source/Managers/PrimitiveMan.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ namespace RTE {
317317
/// @param rotAngle Rotation angle in radians.
318318
/// @param frame Frame to draw.
319319
/// @param scale Drawing scale.
320-
void DrawBitmapPrimitive(const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale) { DrawBitmapPrimitive(-1, centerPos, moSprite, rotAngle, scale, frame, false, false); }
320+
void DrawBitmapPrimitive(const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale) { DrawBitmapPrimitive(-1, centerPos, moSprite, rotAngle, scale, frame, false, false); }
321321

322322
/// Schedule to draw a bitmap primitive with the option to flip the primitive horizontally and vertically.
323323
/// @param centerPos Position of primitive's center in scene coordinates.
@@ -336,7 +336,7 @@ namespace RTE {
336336
/// @param scale Drawing scale.
337337
/// @param hFlipped Whether to flip the sprite horizontally.
338338
/// @param vFlipped Whether to flip the sprite vertically.
339-
void DrawBitmapPrimitive(const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(-1, centerPos, moSprite, rotAngle, frame, scale, hFlipped, vFlipped); }
339+
void DrawBitmapPrimitive(const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(-1, centerPos, moSprite, rotAngle, frame, scale, hFlipped, vFlipped); }
340340

341341
/// Schedule to draw a bitmap primitive visible only to a specified player.
342342
/// @param player Player screen to draw primitive on.
@@ -353,7 +353,7 @@ namespace RTE {
353353
/// @param rotAngle Rotation angle in radians.
354354
/// @param frame Frame to draw.
355355
/// @param scale Drawing scale.
356-
void DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale) { DrawBitmapPrimitive(player, centerPos, moSprite, rotAngle, frame, scale, false, false); }
356+
void DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale) { DrawBitmapPrimitive(player, centerPos, moSprite, rotAngle, frame, scale, false, false); }
357357

358358
/// Schedule to draw a bitmap primitive visible only to a specified player with the option to flip the primitive horizontally or vertically.
359359
/// @param player Player screen to draw primitive on.
@@ -363,7 +363,7 @@ namespace RTE {
363363
/// @param frame Frame to draw.
364364
/// @param hFlipped Whether to flip the sprite horizontally.
365365
/// @param vFlipped Whether to flip the sprite vertically.
366-
void DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(player, centerPos, moSprite, rotAngle, frame, 1u, false, false); }
366+
void DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(player, centerPos, moSprite, rotAngle, frame, 1.0f, false, false); }
367367

368368
/// Schedule to draw a bitmap primitive visible only to a specified player with the option to flip the primitive horizontally or vertically.
369369
/// @param player Player screen to draw primitive on.
@@ -374,7 +374,7 @@ namespace RTE {
374374
/// @param scale Drawing scale.
375375
/// @param hFlipped Whether to flip the sprite horizontally.
376376
/// @param vFlipped Whether to flip the sprite vertically.
377-
void DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale, bool hFlipped, bool vFlipped);
377+
void DrawBitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale, bool hFlipped, bool vFlipped);
378378

379379
/// Schedule to draw a bitmap primitive.
380380
/// @param centerPos Position of primitive's center in scene coordinates.
@@ -387,7 +387,7 @@ namespace RTE {
387387
/// @param filePath Path to the bitmap to draw.
388388
/// @param rotAngle Rotation angle in radians.
389389
/// @param scale Drawing scale.
390-
void DrawBitmapPrimitive(const Vector& centerPos, const std::string& filePath, float rotAngle, unsigned int scale) { DrawBitmapPrimitive(-1, centerPos, filePath, rotAngle, scale, false, false); }
390+
void DrawBitmapPrimitive(const Vector& centerPos, const std::string& filePath, float rotAngle, float scale) { DrawBitmapPrimitive(-1, centerPos, filePath, rotAngle, scale, false, false); }
391391

392392
/// Schedule to draw a bitmap primitive with the option to flip the primitive horizontally and vertically.
393393
/// @param centerPos Position of primitive's center in scene coordinates.
@@ -404,7 +404,7 @@ namespace RTE {
404404
/// @param scale Drawing scale.
405405
/// @param hFlipped Whether to flip the sprite horizontally.
406406
/// @param vFlipped Whether to flip the sprite vertically.
407-
void DrawBitmapPrimitive(const Vector& centerPos, const std::string& filePath, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(-1, centerPos, filePath, rotAngle, scale, hFlipped, vFlipped); }
407+
void DrawBitmapPrimitive(const Vector& centerPos, const std::string& filePath, float rotAngle, float scale, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(-1, centerPos, filePath, rotAngle, scale, hFlipped, vFlipped); }
408408

409409
/// Schedule to draw a bitmap primitive visible only to a specified player.
410410
/// @param player Player screen to draw primitive on.
@@ -419,7 +419,7 @@ namespace RTE {
419419
/// @param filePath Path to the bitmap to draw.
420420
/// @param rotAngle Rotation angle in radians.
421421
/// @param scale Drawing scale.
422-
void DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, unsigned int scale) { DrawBitmapPrimitive(player, centerPos, filePath, rotAngle, scale, false, false); }
422+
void DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, float scale) { DrawBitmapPrimitive(player, centerPos, filePath, rotAngle, scale, false, false); }
423423

424424
/// Schedule to draw a bitmap primitive visible only to a specified player with the option to flip the primitive horizontally or vertically.
425425
/// @param player Player screen to draw primitive on.
@@ -428,7 +428,7 @@ namespace RTE {
428428
/// @param rotAngle Rotation angle in radians.
429429
/// @param hFlipped Whether to flip the sprite horizontally.
430430
/// @param vFlipped Whether to flip the sprite vertically.
431-
void DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(player, centerPos, filePath, rotAngle, 1u, false, false); }
431+
void DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, bool hFlipped, bool vFlipped) { DrawBitmapPrimitive(player, centerPos, filePath, rotAngle, 1.0f, false, false); }
432432

433433
/// Schedule to draw a bitmap primitive visible only to a specified player with the option to flip the primitive horizontally or vertically.
434434
/// @param player Player screen to draw primitive on.
@@ -438,7 +438,7 @@ namespace RTE {
438438
/// @param scale Drawing scale.
439439
/// @param hFlipped Whether to flip the sprite horizontally.
440440
/// @param vFlipped Whether to flip the sprite vertically.
441-
void DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped);
441+
void DrawBitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, float scale, bool hFlipped, bool vFlipped);
442442

443443
/// Schedule to draw the GUI icon of an object.
444444
/// @param centerPos Position of primitive's center in scene coordinates.

Source/System/GraphicalPrimitive.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,12 @@ void BitmapPrimitive::Draw(BITMAP* drawScreen, const Vector& targetPos) {
504504
return;
505505
}
506506

507-
BITMAP* bitmapToDraw = create_bitmap_ex(8, m_Bitmap->w * m_Scale, m_Bitmap->h * m_Scale);
507+
BITMAP* bitmapToDraw = create_bitmap_ex(8, (int)(m_Bitmap->w * m_Scale), (int)(m_Bitmap->h * m_Scale));
508508
clear_to_color(bitmapToDraw, ColorKeys::g_MaskColor);
509-
if (m_Scale == 1u) {
509+
if (m_Scale == 1.0f) {
510510
draw_sprite(bitmapToDraw, m_Bitmap, 0, 0);
511511
} else {
512-
stretch_sprite(bitmapToDraw, m_Bitmap, 0, 0, m_Bitmap->w * m_Scale, m_Bitmap->h * m_Scale);
512+
stretch_sprite(bitmapToDraw, m_Bitmap, 0, 0, (int)(m_Bitmap->w * m_Scale), (int)(m_Bitmap->h * m_Scale));
513513
}
514514

515515
if (m_HFlipped || m_VFlipped) {

Source/System/GraphicalPrimitive.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ namespace RTE {
537537
float m_RotAngle = 0; //!< Angle to rotate bitmap in radians.
538538
bool m_HFlipped = false; //!< Whether the Bitmap to draw should be horizontally flipped.
539539
bool m_VFlipped = false; //!< Whether the Bitmap to draw should be vertically flipped.
540-
unsigned int m_Scale = 1u;
540+
float m_Scale = 1.0;
541541

542542
/// Constructor method for BitmapPrimitive object.
543543
/// @param player Player screen to draw this primitive on.
@@ -547,7 +547,7 @@ namespace RTE {
547547
/// @param scale BITMAP scale.
548548
/// @param hFlipped Whether the BITMAP to draw should be horizontally flipped.
549549
/// @param vFlipped Whether the BITMAP to draw should be vertically flipped.
550-
BitmapPrimitive(int player, const Vector& centerPos, BITMAP* bitmap, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped) :
550+
BitmapPrimitive(int player, const Vector& centerPos, BITMAP* bitmap, float rotAngle, float scale, bool hFlipped, bool vFlipped) :
551551
m_Bitmap(bitmap), m_RotAngle(rotAngle), m_HFlipped(hFlipped), m_VFlipped(vFlipped) {
552552

553553
m_StartPos = centerPos;
@@ -563,7 +563,7 @@ namespace RTE {
563563
/// @param hFlipped Whether the BITMAP to draw should be horizontally flipped.
564564
/// @param vFlipped Whether the BITMAP to draw should be vertically flipped.
565565
BitmapPrimitive(int player, const Vector& centerPos, BITMAP* bitmap, float rotAngle, bool hFlipped, bool vFlipped) :
566-
BitmapPrimitive(player, centerPos, bitmap, rotAngle, 1u, hFlipped, vFlipped) {}
566+
BitmapPrimitive(player, centerPos, bitmap, rotAngle, 1.0f, hFlipped, vFlipped) {}
567567

568568
/// Constructor method for BitmapPrimitive object.
569569
/// @param player Player screen to draw this primitive on.
@@ -574,7 +574,7 @@ namespace RTE {
574574
/// @param scale BITMAP scale.
575575
/// @param hFlipped Whether the BITMAP to draw should be horizontally flipped.
576576
/// @param vFlipped Whether the BITMAP to draw should be vertically flipped.
577-
BitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, unsigned int scale, bool hFlipped, bool vFlipped) :
577+
BitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, float scale, bool hFlipped, bool vFlipped) :
578578
m_Bitmap(moSprite->GetSpriteFrame(frame)), m_RotAngle(rotAngle), m_HFlipped(hFlipped), m_VFlipped(vFlipped) {
579579

580580
m_StartPos = centerPos;
@@ -591,7 +591,7 @@ namespace RTE {
591591
/// @param hFlipped Whether the BITMAP to draw should be horizontally flipped.
592592
/// @param vFlipped Whether the BITMAP to draw should be vertically flipped.
593593
BitmapPrimitive(int player, const Vector& centerPos, const MOSprite* moSprite, float rotAngle, unsigned int frame, bool hFlipped, bool vFlipped) :
594-
BitmapPrimitive(player, centerPos, moSprite, rotAngle, frame, 1u, hFlipped, vFlipped) {}
594+
BitmapPrimitive(player, centerPos, moSprite, rotAngle, frame, 1.0f, hFlipped, vFlipped) {}
595595

596596
/// Constructor method for BitmapPrimitive object.
597597
/// @param player Player screen to draw this primitive on.
@@ -601,7 +601,7 @@ namespace RTE {
601601
/// @param scale BITMAP scale.
602602
/// @param hFlipped Whether the BITMAP to draw should be horizontally flipped.
603603
/// @param vFlipped Whether the BITMAP to draw should be vertically flipped.
604-
BitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, unsigned int scale, bool hFlipped, bool vFlipped) :
604+
BitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, float scale, bool hFlipped, bool vFlipped) :
605605
m_Bitmap(ContentFile(filePath.c_str()).GetAsBitmap()), m_RotAngle(rotAngle), m_HFlipped(hFlipped), m_VFlipped(vFlipped) {
606606

607607
m_StartPos = centerPos;
@@ -616,7 +616,7 @@ namespace RTE {
616616
/// @param hFlipped Whether the BITMAP to draw should be horizontally flipped.
617617
/// @param vFlipped Whether the BITMAP to draw should be vertically flipped.
618618
BitmapPrimitive(int player, const Vector& centerPos, const std::string& filePath, float rotAngle, bool hFlipped, bool vFlipped) :
619-
BitmapPrimitive(player, centerPos, filePath, rotAngle, 1u, hFlipped, vFlipped) {}
619+
BitmapPrimitive(player, centerPos, filePath, rotAngle, 1.0f, hFlipped, vFlipped) {}
620620

621621
private:
622622
static const PrimitiveType c_PrimitiveType; //!< Type identifier of this primitive.

0 commit comments

Comments
 (0)