View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0002374 | FSSCP | user interface | public | 2011-01-08 02:23 | 2012-02-14 00:50 |
| Reporter | MjnMixael | Assigned To | Zacam | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | 3.6.13 | ||||
| Summary | 0002374: Weapon Tech Models Clipping | ||||
| Description | Primary and secondary weapon tech models clip the edge of the viewport. | ||||
| Additional Information | It would be nice to see it resolved with a View Pos and Zoom weapons.tbl options. | ||||
| Tags | No tags attached. | ||||
|
2011-01-08 02:23
|
|
|
|
Mantis-2374.patch (8,809 bytes)
Index: missionui/missionscreencommon.cpp
===================================================================
--- missionui/missionscreencommon.cpp (revision 8411)
+++ missionui/missionscreencommon.cpp (working copy)
@@ -31,6 +31,7 @@
#include "ui/uidefs.h"
#include "anim/animplay.h"
#include "ship/ship.h"
+#include "weapon/weapon.h"
#include "render/3d.h"
#include "lighting/lighting.h"
#include "network/multi.h"
@@ -1446,16 +1447,17 @@
bs = &pm->submodel[0];
}
- vec3d weap_closeup;
+ vec3d weap_closeup = Weapon_info->closeup_pos;
float y_closeup;
+ float tm_zoom = Weapon_info->closeup_zoom;
//Find the center of teh submodel
weap_closeup.xyz.x = -(bs->min.xyz.z + (bs->max.xyz.z - bs->min.xyz.z)/2.0f);
weap_closeup.xyz.y = -(bs->min.xyz.y + (bs->max.xyz.y - bs->min.xyz.y)/2.0f);
//weap_closeup.xyz.z = (weap_closeup.xyz.x/tanf(zoom / 2.0f));
- weap_closeup.xyz.z = -(bs->rad/tanf(zoom/2.0f));
+ weap_closeup.xyz.z = -(bs->rad/tanf(tm_zoom/2.0f));
- y_closeup = -(weap_closeup.xyz.y/tanf(zoom / 2.0f));
+ y_closeup = -(weap_closeup.xyz.y/tanf(tm_zoom / 2.0f));
if(y_closeup < weap_closeup.xyz.z)
{
weap_closeup.xyz.z = y_closeup;
@@ -1464,7 +1466,7 @@
{
weap_closeup.xyz.z = bs->min.xyz.x;
}
- g3_set_view_matrix( &weap_closeup, &vmd_identity_matrix, zoom);
+ g3_set_view_matrix( &weap_closeup, &vmd_identity_matrix, tm_zoom);
if (!Cmdline_nohtl) {
gr_set_proj_matrix(0.5f*Proj_fov, gr_screen.clip_aspect, 0.05f, 1000.0f);
@@ -1544,36 +1546,35 @@
rot_angles.b = 0.0f;
rot_angles.h = *rotation_buffer;
vm_rotate_matrix_by_angles(&model_orient, &rot_angles);
-
+
gr_set_clip(x1, y1, x2, y2, resize);
vec3d wire_normal,ship_normal,plane_point;
// Clip the wireframe below the scanline
wire_normal.xyz.x = 0.0f;
wire_normal.xyz.y = 1.0f;
wire_normal.xyz.z = 0.0f;
-
+
// Clip the ship above the scanline
ship_normal.xyz.x = 0.0f;
ship_normal.xyz.y = -1.0f;
ship_normal.xyz.z = 0.0f;
polymodel *pm = model_get(model_id);
-
+
//Make the clipping plane
float clip = -pm->rad*0.7f;
- if(time < 1.5f && time >= 0.5f) // Phase 1 Move down
+ if (time < 1.5f && time >= 0.5f) // Phase 1 Move down
clip = pm->rad*(time-1.0f)*1.4f;
- if(time >= 1.5f)
+
+ if (time >= 1.5f)
clip = pm->rad*(time-2.0f)*(-1.4f); // Phase 2 Move up
+
vm_vec_scale_sub(&plane_point,&vmd_zero_vector,&wire_normal,clip);
-
+
g3_start_frame(1);
- if(closeup_pos != NULL)
- {
+ if ( (closeup_pos != NULL) && (vm_vec_mag(closeup_pos) != 0.0f) ) {
g3_set_view_matrix(closeup_pos, &vmd_identity_matrix, closeup_zoom);
- }
- else
- {
+ } else {
vec3d pos = { { { 0.0f, 0.0f, -(pm->rad * 1.5f) } } };
g3_set_view_matrix(&pos, &vmd_identity_matrix, closeup_zoom);
}
@@ -1589,7 +1590,7 @@
float offset = size*0.5f*MIN(MAX(time-3.0f,0.0f),0.6f)*1.66667f;
if(time < 1.5f && time >= 0.5f) // Clip the grid if were in phase 1
g3_start_user_clip_plane(&plane_point,&wire_normal);
-
+
g3_start_instance_angles(&vmd_zero_vector,&view_angles);
if( time < 0.5f ) // Do the expanding scanline in phase 0
{
Index: missionui/missionweaponchoice.cpp
===================================================================
--- missionui/missionweaponchoice.cpp (revision 8411)
+++ missionui/missionweaponchoice.cpp (working copy)
@@ -2647,7 +2647,7 @@
if(Wl_icons[Selected_wl_class].model_index != -1) {
static float WeapSelectScreenWeapRot = 0.0f;
- wl_icon_info *sel_icon = &Wl_icons[Selected_wl_class];
+ wl_icon_info *sel_icon = &Wl_icons[Selected_wl_class];
weapon_info *wip = &Weapon_info[Selected_wl_class];
draw_model_rotating(sel_icon->model_index,
weapon_ani_coords[0],
@@ -2655,8 +2655,8 @@
gr_screen.res == 0 ? 202 : 332,
gr_screen.res == 0 ? 185 : 260,
&WeapSelectScreenWeapRot,
- NULL,
- .65f,
+ &Weapon_info->closeup_pos,
+ Weapon_info->closeup_zoom * 0.65f,
REVOLUTION_RATE,
MR_IS_MISSILE | MR_LOCK_DETAIL | MR_AUTOCENTER | MR_NO_FOGGING,
true,
@@ -2714,7 +2714,7 @@
if(icon->model_index != -1)
{
//Draw the model
- draw_model_icon(icon->model_index, MR_LOCK_DETAIL | MR_NO_FOGGING | MR_NO_LIGHTING, 0.4f, sx, sy, w, h, NULL);
+ draw_model_icon(icon->model_index, MR_LOCK_DETAIL | MR_NO_FOGGING | MR_NO_LIGHTING, Weapon_info->closeup_zoom / 2.5f, sx, sy, w, h, NULL);
}
else if(icon->laser_bmap != -1)
{
@@ -2959,7 +2959,7 @@
if(icon->model_index != -1)
{
//Draw the model
- draw_model_icon(icon->model_index, MR_LOCK_DETAIL | MR_NO_FOGGING | MR_NO_LIGHTING, .5f / 1.25f, x, y, 56, 24, NULL);
+ draw_model_icon(icon->model_index, MR_LOCK_DETAIL | MR_NO_FOGGING | MR_NO_LIGHTING, Weapon_info->closeup_zoom * 0.4f, x, y, 56, 24, NULL);
}
else if(icon->laser_bmap != -1)
{
Index: weapon/weapon.h
===================================================================
--- weapon/weapon.h (revision 8411)
+++ weapon/weapon.h (working copy)
@@ -293,20 +293,23 @@
char alt_name[NAME_LENGTH]; // alt name of this weapon
char title[WEAPON_TITLE_LEN]; // official title of weapon (used by tooltips)
char *desc; // weapon's description (used by tooltips)
- int subtype; // one of the WP_* macros above
- int render_type; // rendering method, laser, pof, avi
+ int subtype; // one of the WP_* macros above
+ int render_type; // rendering method, laser, pof, avi
char pofbitmap_name[MAX_FILENAME_LEN]; // Name of the pof representing this if POF, or bitmap filename if bitmap
- int model_num; // modelnum of weapon -- -1 if no model
- char external_model_name[MAX_FILENAME_LEN]; //the model rendered on the weapon points of a ship
- int external_model_num; //the model rendered on the weapon points of a ship
- int hud_target_lod; // LOD to use when rendering weapon model to the hud targetbox
- int num_detail_levels; // number of LODs defined in table (optional)
+ int model_num; // modelnum of weapon -- -1 if no model
+ char external_model_name[MAX_FILENAME_LEN]; //the model rendered on the weapon points of a ship
+ int external_model_num; //the model rendered on the weapon points of a ship
+ int hud_target_lod; // LOD to use when rendering weapon model to the hud targetbox
+ int num_detail_levels; // number of LODs defined in table (optional)
int detail_distance[MAX_MODEL_DETAIL_LEVELS]; // LOD distances define in table (optional)
char *tech_desc; // weapon's description (in tech database)
char tech_anim_filename[MAX_FILENAME_LEN]; // weapon's tech room animation
char tech_title[NAME_LENGTH]; // weapon's name (in tech database)
+ char tech_model[MAX_FILENAME_LEN]; //Image to display in the techroom (TODO) or the weapon selection screen if the ANI isn't specified/missing
- char tech_model[MAX_FILENAME_LEN]; //Image to display in the techroom (TODO) or the weapon selection screen if the ANI isn't specified/missing
+ vec3d closeup_pos; // position for camera to set an offset for viewing the weapon model
+ float closeup_zoom; // zoom when using weapon model in closeup view in loadout selection
+
char hud_filename[MAX_FILENAME_LEN]; //Name of image to display on HUD in place of text
int hud_image_index; //teh index of the image
Index: weapon/weapons.cpp
===================================================================
--- weapon/weapons.cpp (revision 8411)
+++ weapon/weapons.cpp (working copy)
@@ -805,6 +805,9 @@
wip->detail_distance[i] = -1;
}
+ vm_vec_zero(&wip->closeup_pos);
+ wip->closeup_zoom = 1.0f;
+
generic_anim_init(&wip->laser_bitmap);
generic_anim_init(&wip->laser_glow_bitmap);
@@ -1180,8 +1183,34 @@
stuff_malloc_string(&wip->tech_desc, F_MULTITEXT);
}
- if(optional_string("$Tech Model:")) {
+ if (optional_string("$Tech Model:")) {
stuff_string(wip->tech_model, F_NAME, MAX_FILENAME_LEN);
+
+ if (optional_string("+Closeup_pos:")) {
+ stuff_vector(&wip->closeup_pos);
+ } else if (first_time && strlen(wip->tech_model)) {
+ // Calculate from the model file. This is inefficient, but whatever
+ int model_idx = model_load(wip->tech_model, 0, NULL);
+ polymodel *pm = model_get(model_idx);
+
+ // Go through, find best
+ wip->closeup_pos.xyz.z = fabsf(pm->maxs.xyz.z);
+
+ float temp = fabsf(pm->mins.xyz.z);
+ if (temp > wip->closeup_pos.xyz.z) {
+ wip->closeup_pos.xyz.z = temp;
+ }
+
+ // Now multiply by 2
+ wip->closeup_pos.xyz.z *= -2.0f;
+
+ // We're done with the model.
+ model_unload(model_idx);
+ }
+
+ if (optional_string("+Closeup_zoom:")) {
+ stuff_float(&wip->closeup_zoom);
+ }
}
// Weapon fadein effect, used when no ani is specified or weapon_select_3d is active
|
|
|
Patch added for review. Thank to Valathil for that last "d'uh" piece I was missing. |
|
|
Fix committed to trunk@8414. |
|
|
Fix committed to antipodes@8416. |
|
|
Fix committed to fs2_open_3_6_14@8485. |
|
|
Fix committed to fs2_open_3_6_14@8486. |
|
fs2open: trunk r8414 2012-02-01 09:11 Ported: N/A Details Diff |
Fix for Mantis 0002374: Adds "+Closeup_pos:" and "+Closeup_zoom:" as entries following "$Tech Model:" for the weapons.tbl. For entries not using a dedicated $Tech Model, simply specify the $Tech Model as the same POF used in $Model to adjust Loadout Screen viewing position and zoom. |
Affected Issues 0002374 |
|
| mod - /trunk/fs2_open/code/weapon/weapons.cpp | Diff File | ||
| mod - /trunk/fs2_open/code/weapon/weapon.h | Diff File | ||
| mod - /trunk/fs2_open/code/missionui/missionweaponchoice.cpp | Diff File | ||
| mod - /trunk/fs2_open/code/missionui/missionscreencommon.cpp | Diff File | ||
|
fs2open: antipodes r8416 2012-02-01 12:31 Ported: N/A Details Diff |
Fix for the Fix for Mantis 0002374: Had only updated the Effect 2 portion of the missionscreencommon. Don't I feel silly now. Did a little housekeeping while at it. |
Affected Issues 0002374 |
|
| mod - /trunk/fs2_open/code/missionui/missionscreencommon.cpp | Diff File | ||
| mod - /branches/antipodes/code/missionui/missionscreencommon.cpp | Diff File | ||
|
fs2open: fs2_open_3_6_14 r8485 2012-02-13 19:49 Ported: N/A Details Diff |
Backport: Trunk r8414; Fix for Mantis 0002374: Adds "+Closeup_pos:" and "+Closeup_zoom:" as entries following "$Tech Model:" for the weapons.tbl. For entries not using a dedicated $Tech Model, simply specify the $Tech Model as the same POF used in $Model to adjust Loadout Screen viewing position and zoom. |
Affected Issues 0002374 |
|
| mod - /branches/fs2_open_3_6_14/code/weapon/weapons.cpp | Diff File | ||
| mod - /branches/fs2_open_3_6_14/code/weapon/weapon.h | Diff File | ||
| mod - /branches/fs2_open_3_6_14/code/missionui/missionweaponchoice.cpp | Diff File | ||
| mod - /branches/fs2_open_3_6_14/code/missionui/missionscreencommon.cpp | Diff File | ||
|
fs2open: fs2_open_3_6_14 r8486 2012-02-13 19:50 Ported: N/A Details Diff |
Backport: Trunk r8416; Fix for the Fix for Mantis 0002374: Had only updated the Effect 2 portion of the missionscreencommon. Don't I feel silly now. Did a little housekeeping while at it. |
Affected Issues 0002374 |
|
| mod - /branches/fs2_open_3_6_14/code/missionui/missionscreencommon.cpp | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2011-01-08 02:23 | MjnMixael | New Issue | |
| 2011-01-08 02:23 | MjnMixael | File Added: screen0078.zip | |
| 2011-01-08 02:25 | Zacam | Reproducibility | have not tried => always |
| 2011-01-08 02:25 | Zacam | Product Version | Antipodes 8 => 3.6.13 |
| 2011-01-08 02:25 | Zacam | Additional Information Updated | |
| 2012-01-30 19:08 | Zacam | Assigned To | => Zacam |
| 2012-01-30 19:08 | Zacam | Status | new => assigned |
| 2012-01-31 10:33 | Zacam | File Added: Mantis-2374.patch | |
| 2012-01-31 15:02 | Zacam | File Deleted: Mantis-2374.patch | |
| 2012-01-31 18:13 | Zacam | File Added: Mantis-2374.patch | |
| 2012-01-31 18:14 | Zacam | Note Added: 0013210 | |
| 2012-01-31 18:14 | Zacam | Status | assigned => code review |
| 2012-02-01 14:11 | Zacam | Changeset attached | => fs2open trunk r8414 |
| 2012-02-01 14:11 | Zacam | Note Added: 0013222 | |
| 2012-02-01 14:11 | Zacam | Status | code review => resolved |
| 2012-02-01 14:11 | Zacam | Resolution | open => fixed |
| 2012-02-01 17:31 | Zacam | Changeset attached | => fs2open antipodes r8416 |
| 2012-02-01 17:31 | Zacam | Note Added: 0013225 | |
| 2012-02-14 00:49 | Zacam | Changeset attached | => fs2open fs2_open_3_6_14 r8485 |
| 2012-02-14 00:49 | Zacam | Note Added: 0013310 | |
| 2012-02-14 00:50 | Zacam | Changeset attached | => fs2open fs2_open_3_6_14 r8486 |
| 2012-02-14 00:50 | Zacam | Note Added: 0013311 |