Save some editor gadget pointers

This commit is contained in:
Kp 2016-09-24 18:06:11 +00:00
parent 8585bd7d7c
commit 69eec0d71f
5 changed files with 72 additions and 47 deletions

View file

@ -67,7 +67,7 @@ namespace {
struct hostage_dialog
{
std::unique_ptr<UI_GADGET_USERBOX> hostageViewBox;
std::unique_ptr<UI_GADGET_BUTTON> quitButton;
std::unique_ptr<UI_GADGET_BUTTON> quitButton, next, prev, compress, delete_object, new_object;
vclip *vclip_ptr; // Used for the vclip on monitor
fix64 time;
@ -279,11 +279,11 @@ static int hostage_dialog_created(UI_DIALOG *const w, hostage_dialog *const h)
h->hostageViewBox = ui_add_gadget_userbox(w, 10, 90+10, 64, 64);
// A bunch of buttons...
int i = 90;
ui_add_gadget_button(w, 155, i, 140, 26, "Next Hostage", SelectNextHostage); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "Prev Hostage", SelectPrevHostage); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "Compress All", CompressHostages); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "Delete", ObjectDelete); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "Create New", PlaceHostage); i += 29;
h->next = ui_add_gadget_button(w, 155, i, 140, 26, "Next Hostage", SelectNextHostage); i += 29;
h->prev = ui_add_gadget_button(w, 155, i, 140, 26, "Prev Hostage", SelectPrevHostage); i += 29;
h->compress = ui_add_gadget_button(w, 155, i, 140, 26, "Compress All", CompressHostages); i += 29;
h->delete_object = ui_add_gadget_button(w, 155, i, 140, 26, "Delete", ObjectDelete); i += 29;
h->new_object = ui_add_gadget_button(w, 155, i, 140, 26, "Create New", PlaceHostage); i += 29;
h->time = timer_query();
LastHostageIndex = -2; // Set to some dummy value so everything works ok on the first frame.
return 0;

View file

@ -66,14 +66,13 @@ namespace {
struct trigger_dialog
{
std::unique_ptr<UI_GADGET_USERBOX> wallViewBox;
std::unique_ptr<UI_GADGET_BUTTON> quitButton;
std::unique_ptr<UI_GADGET_BUTTON> quitButton, remove_trigger, bind_wall, bind_matcen, enable_all_triggers;
array<std::unique_ptr<UI_GADGET_CHECKBOX>, NUM_TRIGGER_FLAGS> triggerFlag;
int old_trigger_num;
};
}
//-----------------------------------------------------------------
// Adds a trigger to wall, and returns the trigger number.
// If there is a trigger already present, it returns the trigger number. (To be replaced)
@ -331,10 +330,10 @@ static int trigger_dialog_created(UI_DIALOG *const w, trigger_dialog *const t)
// A bunch of buttons...
i = 80;
ui_add_gadget_button(w, 155, i, 140, 26, "Remove Trigger", trigger_remove); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "Bind Wall", bind_wall_to_trigger); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "Bind Matcen", bind_matcen_to_trigger); i += 29;
ui_add_gadget_button(w, 155, i, 140, 26, "All Triggers ON", trigger_turn_all_ON); i += 29;
t->remove_trigger = ui_add_gadget_button(w, 155, i, 140, 26, "Remove Trigger", trigger_remove); i += 29;
t->bind_wall = ui_add_gadget_button(w, 155, i, 140, 26, "Bind Wall", bind_wall_to_trigger); i += 29;
t->bind_matcen = ui_add_gadget_button(w, 155, i, 140, 26, "Bind Matcen", bind_matcen_to_trigger); i += 29;
t->enable_all_triggers = ui_add_gadget_button(w, 155, i, 140, 26, "All Triggers ON", trigger_turn_all_ON); i += 29;
t->old_trigger_num = -2; // Set to some dummy value so everything works ok on the first frame.
return 1;

View file

@ -74,7 +74,7 @@ namespace {
struct robot_dialog
{
std::unique_ptr<UI_GADGET_USERBOX> robotViewBox, containsViewBox;
std::unique_ptr<UI_GADGET_BUTTON> quitButton;
std::unique_ptr<UI_GADGET_BUTTON> quitButton, prev_powerup_type, next_powerup_type, prev_powerup_id, next_powerup_id, prev_powerup_count, next_powerup_count, prev_robot_type, next_robot_type, next_segment, prev_object, next_object, delete_object, new_object, set_path;
array<std::unique_ptr<UI_GADGET_RADIO>, NUM_BOXES> initialMode;
fix64 time;
vms_angvec angles, goody_angles;
@ -485,12 +485,12 @@ int do_robot_dialog()
static int robot_dialog_created(UI_DIALOG *const w, robot_dialog *const r)
{
r->quitButton = ui_add_gadget_button(w, 20, 286, 40, 32, "Done", NULL);
ui_add_gadget_button(w, GOODY_X+50, GOODY_Y-3, 25, 22, "<<", GoodyPrevType);
ui_add_gadget_button(w, GOODY_X+80, GOODY_Y-3, 25, 22, ">>", GoodyNextType);
ui_add_gadget_button(w, GOODY_X+50, GOODY_Y+21, 25, 22, "<<", GoodyPrevID);
ui_add_gadget_button(w, GOODY_X+80, GOODY_Y+21, 25, 22, ">>", GoodyNextID);
ui_add_gadget_button(w, GOODY_X+50, GOODY_Y+45, 25, 22, "<<", GoodyPrevCount);
ui_add_gadget_button(w, GOODY_X+80, GOODY_Y+45, 25, 22, ">>", GoodyNextCount);
r->prev_powerup_type = ui_add_gadget_button(w, GOODY_X+50, GOODY_Y-3, 25, 22, "<<", GoodyPrevType);
r->next_powerup_type = ui_add_gadget_button(w, GOODY_X+80, GOODY_Y-3, 25, 22, ">>", GoodyNextType);
r->prev_powerup_id = ui_add_gadget_button(w, GOODY_X+50, GOODY_Y+21, 25, 22, "<<", GoodyPrevID);
r->next_powerup_id = ui_add_gadget_button(w, GOODY_X+80, GOODY_Y+21, 25, 22, ">>", GoodyNextID);
r->prev_powerup_count = ui_add_gadget_button(w, GOODY_X+50, GOODY_Y+45, 25, 22, "<<", GoodyPrevCount);
r->next_powerup_count = ui_add_gadget_button(w, GOODY_X+80, GOODY_Y+45, 25, 22, ">>", GoodyNextCount);
r->initialMode[0] = ui_add_gadget_radio(w, 6, 58, 16, 16, 0, "Hover");
r->initialMode[1] = ui_add_gadget_radio(w, 76, 58, 16, 16, 0, "Normal");
r->initialMode[2] = ui_add_gadget_radio(w, 6, 78, 16, 16, 0, "(hide)");
@ -503,14 +503,14 @@ static int robot_dialog_created(UI_DIALOG *const w, robot_dialog *const r)
r->containsViewBox = ui_add_gadget_userbox(w, 10, 202, 100, 80);
// A bunch of buttons...
int i = 135;
ui_add_gadget_button(w, 190, i, 53, 26, "<<Typ", RobotPrevType);
ui_add_gadget_button(w, 247, i, 53, 26, "Typ>>", RobotNextType); i += 29;
ui_add_gadget_button(w, 190, i, 110, 26, "Next in Seg", LocalObjectSelectNextinSegment); i += 29;
ui_add_gadget_button(w, 190, i, 53, 26, "<<Obj", LocalObjectSelectPrevinMine);
ui_add_gadget_button(w, 247, i, 53, 26, ">>Obj", LocalObjectSelectNextinMine); i += 29;
ui_add_gadget_button(w, 190, i, 110, 26, "Delete", LocalObjectDelete); i += 29;
ui_add_gadget_button(w, 190, i, 110, 26, "Create New", LocalObjectPlaceObject); i += 29;
ui_add_gadget_button(w, 190, i, 110, 26, "Set Path", med_set_ai_path);
r->prev_robot_type = ui_add_gadget_button(w, 190, i, 53, 26, "<<Typ", RobotPrevType);
r->next_robot_type = ui_add_gadget_button(w, 247, i, 53, 26, "Typ>>", RobotNextType); i += 29;
r->next_segment = ui_add_gadget_button(w, 190, i, 110, 26, "Next in Seg", LocalObjectSelectNextinSegment); i += 29;
r->prev_object = ui_add_gadget_button(w, 190, i, 53, 26, "<<Obj", LocalObjectSelectPrevinMine);
r->next_object = ui_add_gadget_button(w, 247, i, 53, 26, ">>Obj", LocalObjectSelectNextinMine); i += 29;
r->delete_object = ui_add_gadget_button(w, 190, i, 110, 26, "Delete", LocalObjectDelete); i += 29;
r->new_object = ui_add_gadget_button(w, 190, i, 110, 26, "Create New", LocalObjectPlaceObject); i += 29;
r->set_path = ui_add_gadget_button(w, 190, i, 110, 26, "Set Path", med_set_ai_path);
r->time = timer_query();
r->old_object = -2; // Set to some dummy value so everything works ok on the first frame.
if ( Cur_object_index == object_none)

View file

@ -23,6 +23,7 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*
*/
#include <memory>
#include <stdlib.h>
#include <stdio.h>
#include "inferno.h"
@ -55,9 +56,21 @@ static int ObjectPage = 0;
#include "hostage.h"
#include "powerup.h"
namespace {
vms_angvec objpage_view_orient;
fix objpage_view_dist;
class object_dialog
{
public:
std::unique_ptr<UI_GADGET_BUTTON> prev_object, next_object, first_object, last_object, dec_pitch, inc_pitch, dec_bank, inc_bank, dec_heading, inc_heading, inc_z, dec_z, reset_orient;
};
}
static object_dialog objpage_dialog;
//this is bad to have the extern, but this snapshot stuff is special
//canvas set
@ -318,21 +331,22 @@ void objpage_init( UI_DIALOG *dlg )
//Assert (N_powerup_types < MAX_POWERUP_TYPES );
// Assert (N_robot_types < MAX_ROBOTS);
ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y - 27, 30, 20, "<<", objpage_goto_prev );
ui_add_gadget_button( dlg, OBJCURBOX_X + 32, OBJCURBOX_Y - 27, 30, 20, ">>", objpage_goto_next );
auto &o = objpage_dialog;
o.prev_object = ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y - 27, 30, 20, "<<", objpage_goto_prev );
o.next_object = ui_add_gadget_button( dlg, OBJCURBOX_X + 32, OBJCURBOX_Y - 27, 30, 20, ">>", objpage_goto_next );
ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y - 54, 30, 20, "B", objpage_goto_first );
ui_add_gadget_button( dlg, OBJCURBOX_X + 32, OBJCURBOX_Y - 54, 30, 20, "E", objpage_goto_last );
o.first_object = ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y - 54, 30, 20, "B", objpage_goto_first );
o.last_object = ui_add_gadget_button( dlg, OBJCURBOX_X + 32, OBJCURBOX_Y - 54, 30, 20, "E", objpage_goto_last );
ui_add_gadget_button( dlg, OBJCURBOX_X + 25, OBJCURBOX_Y + 62, 22, 13, "P-", objpage_decrease_pitch );
ui_add_gadget_button( dlg, OBJCURBOX_X + 25, OBJCURBOX_Y + 90, 22, 13, "P+", objpage_increase_pitch );
ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y + 90, 22, 13, "B-", objpage_decrease_bank );
ui_add_gadget_button( dlg, OBJCURBOX_X + 50, OBJCURBOX_Y + 90, 22, 13, "B+", objpage_increase_bank );
ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y + 76, 22, 13, "H-", objpage_decrease_heading );
ui_add_gadget_button( dlg, OBJCURBOX_X + 50, OBJCURBOX_Y + 76, 22, 13, "H+", objpage_increase_heading );
ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y + 62, 22, 13, "Z+", objpage_increase_z );
ui_add_gadget_button( dlg, OBJCURBOX_X + 50, OBJCURBOX_Y + 62, 22, 13, "Z-", objpage_decrease_z );
ui_add_gadget_button( dlg, OBJCURBOX_X + 25, OBJCURBOX_Y + 76, 22, 13, "R", objpage_reset_orient );
o.dec_pitch = ui_add_gadget_button( dlg, OBJCURBOX_X + 25, OBJCURBOX_Y + 62, 22, 13, "P-", objpage_decrease_pitch );
o.inc_pitch = ui_add_gadget_button( dlg, OBJCURBOX_X + 25, OBJCURBOX_Y + 90, 22, 13, "P+", objpage_increase_pitch );
o.dec_bank = ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y + 90, 22, 13, "B-", objpage_decrease_bank );
o.inc_bank = ui_add_gadget_button( dlg, OBJCURBOX_X + 50, OBJCURBOX_Y + 90, 22, 13, "B+", objpage_increase_bank );
o.dec_heading = ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y + 76, 22, 13, "H-", objpage_decrease_heading );
o.inc_heading = ui_add_gadget_button( dlg, OBJCURBOX_X + 50, OBJCURBOX_Y + 76, 22, 13, "H+", objpage_increase_heading );
o.inc_z = ui_add_gadget_button( dlg, OBJCURBOX_X + 00, OBJCURBOX_Y + 62, 22, 13, "Z+", objpage_increase_z );
o.dec_z = ui_add_gadget_button( dlg, OBJCURBOX_X + 50, OBJCURBOX_Y + 62, 22, 13, "Z-", objpage_decrease_z );
o.reset_orient = ui_add_gadget_button( dlg, OBJCURBOX_X + 25, OBJCURBOX_Y + 76, 22, 13, "R", objpage_reset_orient );
for (int i=0;i<OBJS_PER_PAGE;i++)
ObjBox[i] = ui_add_gadget_userbox( dlg, OBJBOX_X + (i/2)*(2+OBJBOX_W), OBJBOX_Y + (i%2)*(2+OBJBOX_H), OBJBOX_W, OBJBOX_H);

View file

@ -63,6 +63,18 @@ int TextureLights = DXX_TEXTURE_INITIALIZER(263, 275);
int TextureEffects = DXX_TEXTURE_INITIALIZER(327, 308);
int TextureMetals = DXX_TEXTURE_INITIALIZER(156, 202);
namespace {
class texture_dialog
{
public:
std::unique_ptr<UI_GADGET_BUTTON> prev_texture, next_texture, first_texture, metal_texture, light_texture, effects_texture;
};
}
static texture_dialog texpage_dialog;
static int TexturePage = 0;
static grs_subcanvas_ptr TmapnameCanvas;
@ -173,14 +185,14 @@ int texpage_grab_current(int n)
void texpage_init( UI_DIALOG * dlg )
{
ui_add_gadget_button( dlg, TMAPCURBOX_X + 00, TMAPCURBOX_Y - 24, 30, 20, "<<", texpage_goto_prev );
ui_add_gadget_button( dlg, TMAPCURBOX_X + 32, TMAPCURBOX_Y - 24, 30, 20, ">>", texpage_goto_next );
auto &t = texpage_dialog;
t.prev_texture = ui_add_gadget_button( dlg, TMAPCURBOX_X + 00, TMAPCURBOX_Y - 24, 30, 20, "<<", texpage_goto_prev );
t.next_texture = ui_add_gadget_button( dlg, TMAPCURBOX_X + 32, TMAPCURBOX_Y - 24, 30, 20, ">>", texpage_goto_next );
ui_add_gadget_button( dlg, TMAPCURBOX_X + 00, TMAPCURBOX_Y - 48, 15, 20, "T", texpage_goto_first );
ui_add_gadget_button( dlg, TMAPCURBOX_X + 17, TMAPCURBOX_Y - 48, 15, 20, "M", texpage_goto_metals );
ui_add_gadget_button( dlg, TMAPCURBOX_X + 34, TMAPCURBOX_Y - 48, 15, 20, "L", texpage_goto_lights );
ui_add_gadget_button( dlg, TMAPCURBOX_X + 51, TMAPCURBOX_Y - 48, 15, 20, "E", texpage_goto_effects );
t.first_texture = ui_add_gadget_button( dlg, TMAPCURBOX_X + 00, TMAPCURBOX_Y - 48, 15, 20, "T", texpage_goto_first );
t.metal_texture = ui_add_gadget_button( dlg, TMAPCURBOX_X + 17, TMAPCURBOX_Y - 48, 15, 20, "M", texpage_goto_metals );
t.light_texture = ui_add_gadget_button( dlg, TMAPCURBOX_X + 34, TMAPCURBOX_Y - 48, 15, 20, "L", texpage_goto_lights );
t.effects_texture = ui_add_gadget_button( dlg, TMAPCURBOX_X + 51, TMAPCURBOX_Y - 48, 15, 20, "E", texpage_goto_effects );
for (int i=0;i<TMAPS_PER_PAGE;i++)
TmapBox[i] = ui_add_gadget_userbox( dlg, TMAPBOX_X + (i/3)*(2+TMAPBOX_W), TMAPBOX_Y + (i%3)*(2+TMAPBOX_H), TMAPBOX_W, TMAPBOX_H);