Skip to content

Commit

Permalink
Merge pull request scp-fs2open#5979 from MjnMixael/fix_select_zoom
Browse files Browse the repository at this point in the history
Unhardcode renderSelectModel zoom value
  • Loading branch information
JohnAFernandez committed Feb 7, 2024
2 parents 6593565 + a0f4c4d commit d34570a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions code/scripting/api/objs/shipclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")
{
Expand All @@ -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())
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions code/scripting/api/objs/weaponclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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), "
"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")
{
Expand All @@ -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())
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d34570a

Please sign in to comment.