From 63990c54a90e82a7815ccb5e45fb8ba485c2e80d Mon Sep 17 00:00:00 2001 From: mjn-mixael Date: Mon, 5 Feb 2024 16:14:07 -0600 Subject: [PATCH 1/2] unhardcode zoom value --- code/scripting/api/objs/shipclass.cpp | 9 +++++---- code/scripting/api/objs/weaponclass.cpp | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/code/scripting/api/objs/shipclass.cpp b/code/scripting/api/objs/shipclass.cpp index 4ddae12e7fd..3e1de4edd1c 100644 --- a/code/scripting/api/objs/shipclass.cpp +++ b/code/scripting/api/objs/shipclass.cpp @@ -1267,10 +1267,10 @@ ADE_FUNC(renderTechModel2, l_Shipclass, "number X1, number Y1, number X2, number ADE_FUNC(renderSelectModel, l_Shipclass, - "boolean restart, number x, number y, [number width = 629, number height = 355, number = currentEffectSetting]", + "boolean restart, number x, number y, [number width = 629, number height = 355, number currentEffectSetting = default, number zoom = 1.3]", "Draws the 3D select ship model with the chosen effect at the specified coordinates. Restart should " "be true on the first frame this is called and false on subsequent frames. Valid selection effects are 1 (fs1) or 2 (fs2), " - "defaults to the mod setting or the model's setting.", + "defaults to the mod setting or the model's setting. Zoom is a multiplier to the model's closeup_zoom value.", "boolean", "true if rendered, false if error") { @@ -1281,7 +1281,8 @@ ADE_FUNC(renderSelectModel, int x2 = 629; int y2 = 355; int effect = -1; - if (!ade_get_args(L, "obii|iii", l_Shipclass.Get(&idx), &restart, &x1, &y1, &x2, &y2, &effect)) + float zoom = 1.3f; + if (!ade_get_args(L, "obii|iiif", l_Shipclass.Get(&idx), &restart, &x1, &y1, &x2, &y2, &effect, &zoom)) return ADE_RETURN_NIL; if (idx < 0 || idx >= ship_info_size()) @@ -1331,7 +1332,7 @@ ADE_FUNC(renderSelectModel, y2, &ShipRot, &sip->closeup_pos, - sip->closeup_zoom * 1.3f, + sip->closeup_zoom * zoom, rev_rate, MR_AUTOCENTER | MR_NO_FOGGING, GR_RESIZE_NONE, diff --git a/code/scripting/api/objs/weaponclass.cpp b/code/scripting/api/objs/weaponclass.cpp index 384d102ed5d..970848065e1 100644 --- a/code/scripting/api/objs/weaponclass.cpp +++ b/code/scripting/api/objs/weaponclass.cpp @@ -846,11 +846,11 @@ ADE_FUNC(renderTechModel2, ADE_FUNC(renderSelectModel, l_Weaponclass, - "number x, number y, [number width = 629, number height = 355, number = currentEffectSetting]", + "number x, number y, [number width = 629, number height = 355, number currentEffectSetting = default, zoom = 0.65]", "Draws the 3D select weapon model with the chosen effect at the specified coordinates. Restart should " "be true on the first frame this is called and false on subsequent frames. Note that primary weapons " "will not render anything if they do not have a valid pof model defined! Valid selection effects are 1 (fs1) or 2 (fs2), " - "defaults to the mod setting or the model's setting.", + "defaults to the mod setting or the model's setting. Zoom is a multiplier to the model's closeup_zoom value.", "boolean", "true if rendered, false if error") { @@ -861,7 +861,8 @@ ADE_FUNC(renderSelectModel, int x2 = 629; int y2 = 355; int effect = -1; - if (!ade_get_args(L, "obii|iii", l_Weaponclass.Get(&idx), &restart, &x1, &y1, &x2, &y2, &effect)) + float zoom = 0.65f; + if (!ade_get_args(L, "obii|iiif", l_Weaponclass.Get(&idx), &restart, &x1, &y1, &x2, &y2, &effect, &zoom)) return ADE_RETURN_NIL; if (idx < 0 || idx >= weapon_info_size()) @@ -903,7 +904,7 @@ ADE_FUNC(renderSelectModel, y2, &WepRot, &wip->closeup_pos, - wip->closeup_zoom * 0.65f, + wip->closeup_zoom * zoom, REVOLUTION_RATE, MR_IS_MISSILE | MR_AUTOCENTER | MR_NO_FOGGING, GR_RESIZE_NONE, From a0f4c4d2b372875801d591eb89397a514070c080 Mon Sep 17 00:00:00 2001 From: mjn-mixael Date: Mon, 5 Feb 2024 16:20:33 -0600 Subject: [PATCH 2/2] documentation error --- code/scripting/api/objs/weaponclass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/scripting/api/objs/weaponclass.cpp b/code/scripting/api/objs/weaponclass.cpp index 970848065e1..8ec8188ad52 100644 --- a/code/scripting/api/objs/weaponclass.cpp +++ b/code/scripting/api/objs/weaponclass.cpp @@ -846,7 +846,7 @@ ADE_FUNC(renderTechModel2, ADE_FUNC(renderSelectModel, l_Weaponclass, - "number x, number y, [number width = 629, number height = 355, number currentEffectSetting = default, zoom = 0.65]", + "number x, number y, [number width = 629, number height = 355, number currentEffectSetting = default, number zoom = 0.65]", "Draws the 3D select weapon model with the chosen effect at the specified coordinates. Restart should " "be true on the first frame this is called and false on subsequent frames. Note that primary weapons " "will not render anything if they do not have a valid pof model defined! Valid selection effects are 1 (fs1) or 2 (fs2), "