diff --git a/SpaceCadetPinball/control.cpp b/SpaceCadetPinball/control.cpp index 9f7b395..bc92071 100644 --- a/SpaceCadetPinball/control.cpp +++ b/SpaceCadetPinball/control.cpp @@ -5,11 +5,28 @@ #include "pb.h" #include "TBlocker.h" #include "TBumper.h" +#include "TComponentGroup.h" +#include "TFlagSpinner.h" #include "TLight.h" +#include "TLightBargraph.h" #include "TLightGroup.h" +#include "TLightRollover.h" #include "TPinballTable.h" +#include "TPopupTarget.h" #include "TSink.h" +#include "TSoloTarget.h" #include "TSound.h" +#include "TTripwire.h" +#include "TDrain.h" +#include "TFlipper.h" +#include "TGate.h" +#include "THole.h" +#include "TKickback.h" +#include "TKickout.h" +#include "TOneway.h" +#include "TRamp.h" +#include "TPlunger.h" +#include "TWall.h" int control::pbctrl_state; @@ -39,236 +56,236 @@ int control_kickout_score2[1] = {20000}; int control_kickout_score3[1] = {50000}; -component_tag control_attack_bump_tag = {"attack_bumpers", nullptr}; -component_tag control_block1_tag = {"v_bloc1", nullptr}; -component_tag control_bmpr_inc_lights_tag = {"bmpr_inc_lights", nullptr}; -component_tag control_bpr_solotgt_lights_tag = {"bpr_solotgt_lights", nullptr}; -component_tag control_bsink_arrow_lights_tag = {"bsink_arrow_lights", nullptr}; -component_tag control_bumber_target_lights_tag = {"bumper_target_lights", nullptr}; -component_tag control_bump1_tag = {"a_bump1", nullptr}; -component_tag control_bump2_tag = {"a_bump2", nullptr}; -component_tag control_bump3_tag = {"a_bump3", nullptr}; -component_tag control_bump4_tag = {"a_bump4", nullptr}; -component_tag control_bump5_tag = {"a_bump5", nullptr}; -component_tag control_bump6_tag = {"a_bump6", nullptr}; -component_tag control_bump7_tag = {"a_bump7", nullptr}; -component_tag control_drain_tag = {"drain", nullptr}; -component_tag control_flag1_tag = {"a_flag1", nullptr}; -component_tag control_flag2_tag = {"a_flag2", nullptr}; -component_tag control_flip1_tag = {"a_flip1", nullptr}; -component_tag control_flip2_tag = {"a_flip2", nullptr}; -component_tag control_fuel_bargraph_tag = {"fuel_bargraph", nullptr}; -component_tag control_gate1_tag = {"v_gate1", nullptr}; -component_tag control_gate2_tag = {"v_gate2", nullptr}; -component_tag control_goal_lights_tag = {"goal_lights", nullptr}; -component_tag control_hyper_lights_tag = {"hyperspace_lights", nullptr}; -component_tag control_info_text_box_tag = {"info_text_box", nullptr}; -component_tag control_kicker1_tag = {"a_kick1", nullptr}; -component_tag control_kicker2_tag = {"a_kick2", nullptr}; -component_tag control_kickout1_tag = {"a_kout1", nullptr}; -component_tag control_kickout2_tag = {"a_kout2", nullptr}; -component_tag control_kickout3_tag = {"a_kout3", nullptr}; -component_tag control_l_trek_lights_tag = {"l_trek_lights", nullptr}; -component_tag control_launch_bump_tag = {"launch_bumpers", nullptr}; -component_tag control_lchute_tgt_lights_tag = {"lchute_tgt_lights", nullptr}; -component_tag control_lite1_tag = {"lite1", nullptr}; -component_tag control_lite2_tag = {"lite2", nullptr}; -component_tag control_lite3_tag = {"lite3", nullptr}; -component_tag control_lite4_tag = {"lite4", nullptr}; -component_tag control_lite5_tag = {"lite5", nullptr}; -component_tag control_lite6_tag = {"lite6", nullptr}; -component_tag control_lite7_tag = {"lite7", nullptr}; -component_tag control_lite8_tag = {"lite8", nullptr}; -component_tag control_lite9_tag = {"lite9", nullptr}; -component_tag control_lite10_tag = {"lite10", nullptr}; -component_tag control_lite11_tag = {"lite11", nullptr}; -component_tag control_lite12_tag = {"lite12", nullptr}; -component_tag control_lite13_tag = {"lite13", nullptr}; -component_tag control_lite16_tag = {"lite16", nullptr}; -component_tag control_lite17_tag = {"lite17", nullptr}; -component_tag control_lite18_tag = {"lite18", nullptr}; -component_tag control_lite19_tag = {"lite19", nullptr}; -component_tag control_lite20_tag = {"lite20", nullptr}; -component_tag control_lite21_tag = {"lite21", nullptr}; -component_tag control_lite22_tag = {"lite22", nullptr}; -component_tag control_lite23_tag = {"lite23", nullptr}; -component_tag control_lite24_tag = {"lite24", nullptr}; -component_tag control_lite25_tag = {"lite25", nullptr}; -component_tag control_lite26_tag = {"lite26", nullptr}; -component_tag control_lite27_tag = {"lite27", nullptr}; -component_tag control_lite28_tag = {"lite28", nullptr}; -component_tag control_lite29_tag = {"lite29", nullptr}; -component_tag control_lite30_tag = {"lite30", nullptr}; -component_tag control_lite54_tag = {"lite54", nullptr}; -component_tag control_lite55_tag = {"lite55", nullptr}; -component_tag control_lite56_tag = {"lite56", nullptr}; -component_tag control_lite58_tag = {"lite58", nullptr}; -component_tag control_lite59_tag = {"lite59", nullptr}; -component_tag control_lite60_tag = {"lite60", nullptr}; -component_tag control_lite61_tag = {"lite61", nullptr}; -component_tag control_lite62_tag = {"lite62", nullptr}; -component_tag control_lite67_tag = {"lite67", nullptr}; -component_tag control_lite68_tag = {"lite68", nullptr}; -component_tag control_lite69_tag = {"lite69", nullptr}; -component_tag control_lite70_tag = {"lite70", nullptr}; -component_tag control_lite71_tag = {"lite71", nullptr}; -component_tag control_lite72_tag = {"lite72", nullptr}; -component_tag control_lite77_tag = {"lite77", nullptr}; -component_tag control_lite84_tag = {"lite84", nullptr}; -component_tag control_lite85_tag = {"lite85", nullptr}; -component_tag control_lite101_tag = {"lite101", nullptr}; -component_tag control_lite102_tag = {"lite102", nullptr}; -component_tag control_lite103_tag = {"lite103", nullptr}; -component_tag control_lite104_tag = {"lite104", nullptr}; -component_tag control_lite105_tag = {"lite105", nullptr}; -component_tag control_lite106_tag = {"lite106", nullptr}; -component_tag control_lite107_tag = {"lite107", nullptr}; -component_tag control_lite108_tag = {"lite108", nullptr}; -component_tag control_lite109_tag = {"lite109", nullptr}; -component_tag control_lite110_tag = {"lite110", nullptr}; -component_tag control_lite130_tag = {"lite130", nullptr}; -component_tag control_lite131_tag = {"lite131", nullptr}; -component_tag control_lite132_tag = {"lite132", nullptr}; -component_tag control_lite133_tag = {"lite133", nullptr}; -component_tag control_lite169_tag = {"lite169", nullptr}; -component_tag control_lite170_tag = {"lite170", nullptr}; -component_tag control_lite171_tag = {"lite171", nullptr}; -component_tag control_lite195_tag = {"lite195", nullptr}; -component_tag control_lite196_tag = {"lite196", nullptr}; -component_tag control_lite198_tag = {"lite198", nullptr}; -component_tag control_lite199_tag = {"lite199", nullptr}; -component_tag control_lite200_tag = {"lite200", nullptr}; -component_tag control_lite300_tag = {"lite300", nullptr}; -component_tag control_lite301_tag = {"lite301", nullptr}; -component_tag control_lite302_tag = {"lite302", nullptr}; -component_tag control_lite303_tag = {"lite303", nullptr}; -component_tag control_lite304_tag = {"lite304", nullptr}; -component_tag control_lite305_tag = {"lite305", nullptr}; -component_tag control_lite306_tag = {"lite306", nullptr}; -component_tag control_lite307_tag = {"lite307", nullptr}; -component_tag control_lite308_tag = {"lite308", nullptr}; -component_tag control_lite309_tag = {"lite309", nullptr}; -component_tag control_lite310_tag = {"lite310", nullptr}; -component_tag control_lite311_tag = {"lite311", nullptr}; -component_tag control_lite312_tag = {"lite312", nullptr}; -component_tag control_lite313_tag = {"lite313", nullptr}; -component_tag control_lite314_tag = {"lite314", nullptr}; -component_tag control_lite315_tag = {"lite315", nullptr}; -component_tag control_lite316_tag = {"lite316", nullptr}; -component_tag control_lite317_tag = {"lite317", nullptr}; -component_tag control_lite318_tag = {"lite318", nullptr}; -component_tag control_lite319_tag = {"lite319", nullptr}; -component_tag control_lite320_tag = {"lite320", nullptr}; -component_tag control_lite321_tag = {"lite321", nullptr}; -component_tag control_lite322_tag = {"lite322", nullptr}; -component_tag control_literoll179_tag = {"literoll179", nullptr}; -component_tag control_literoll180_tag = {"literoll180", nullptr}; -component_tag control_literoll181_tag = {"literoll181", nullptr}; -component_tag control_literoll182_tag = {"literoll182", nullptr}; -component_tag control_literoll183_tag = {"literoll183", nullptr}; -component_tag control_literoll184_tag = {"literoll184", nullptr}; -component_tag control_middle_circle_tag = {"middle_circle", nullptr}; -component_tag control_mission_text_box_tag = {"mission_text_box", nullptr}; -component_tag control_oneway1_tag = {"s_onewy1", nullptr}; -component_tag control_oneway4_tag = {"s_onewy4", nullptr}; -component_tag control_oneway10_tag = {"s_onewy10", nullptr}; -component_tag control_outer_circle_tag = {"outer_circle", nullptr}; -component_tag control_plunger_tag = {"plunger", nullptr}; -component_tag control_r_trek_lights_tag = {"r_trek_lights", nullptr}; -component_tag control_ramp_bmpr_inc_lights_tag = {"ramp_bmpr_inc_lights", nullptr}; -component_tag control_ramp_hole_tag = {"ramp_hole", nullptr}; -component_tag control_ramp_tag = {"ramp", nullptr}; -component_tag control_ramp_tgt_lights_tag = {"ramp_tgt_lights", nullptr}; -component_tag control_rebo1_tag = {"v_rebo1", nullptr}; -component_tag control_rebo2_tag = {"v_rebo2", nullptr}; -component_tag control_rebo3_tag = {"v_rebo3", nullptr}; -component_tag control_rebo4_tag = {"v_rebo4", nullptr}; -component_tag control_roll1_tag = {"a_roll1", nullptr}; -component_tag control_roll2_tag = {"a_roll2", nullptr}; -component_tag control_roll3_tag = {"a_roll3", nullptr}; -component_tag control_roll4_tag = {"a_roll4", nullptr}; -component_tag control_roll5_tag = {"a_roll5", nullptr}; -component_tag control_roll6_tag = {"a_roll6", nullptr}; -component_tag control_roll7_tag = {"a_roll7", nullptr}; -component_tag control_roll8_tag = {"a_roll8", nullptr}; -component_tag control_roll9_tag = {"a_roll9", nullptr}; -component_tag control_roll110_tag = {"a_roll110", nullptr}; -component_tag control_roll111_tag = {"a_roll111", nullptr}; -component_tag control_roll112_tag = {"a_roll112", nullptr}; -component_tag control_roll179_tag = {"a_roll179", nullptr}; -component_tag control_roll180_tag = {"a_roll180", nullptr}; -component_tag control_roll181_tag = {"a_roll181", nullptr}; -component_tag control_roll182_tag = {"a_roll182", nullptr}; -component_tag control_roll183_tag = {"a_roll183", nullptr}; -component_tag control_roll184_tag = {"a_roll184", nullptr}; -component_tag control_sink1_tag = {"v_sink1", nullptr}; -component_tag control_sink2_tag = {"v_sink2", nullptr}; -component_tag control_sink3_tag = {"v_sink3", nullptr}; -component_tag control_sink7_tag = {"v_sink7", nullptr}; -component_tag control_skill_shot_lights_tag = {"skill_shot_lights", nullptr}; -component_tag control_soundwave3_tag = {"soundwave3", nullptr}; -component_tag control_soundwave7_tag = {"soundwave7", nullptr}; -component_tag control_soundwave8_tag = {"soundwave8", nullptr}; -component_tag control_soundwave9_tag = {"soundwave9", nullptr}; -component_tag control_soundwave10_tag = {"soundwave10", nullptr}; -component_tag control_soundwave14_1_tag = {"soundwave14", nullptr}; -component_tag control_soundwave14_2_tag = {"soundwave14", nullptr}; -component_tag control_soundwave21_tag = {"soundwave21", nullptr}; -component_tag control_soundwave23_tag = {"soundwave23", nullptr}; -component_tag control_soundwave24_tag = {"soundwave24", nullptr}; -component_tag control_soundwave25_tag = {"soundwave25", nullptr}; -component_tag control_soundwave26_tag = {"soundwave26", nullptr}; -component_tag control_soundwave27_tag = {"soundwave27", nullptr}; -component_tag control_soundwave28_tag = {"soundwave28", nullptr}; -component_tag control_soundwave30_tag = {"soundwave30", nullptr}; -component_tag control_soundwave35_1_tag = {"soundwave35", nullptr}; -component_tag control_soundwave35_2_tag = {"soundwave35", nullptr}; -component_tag control_soundwave36_1_tag = {"soundwave36", nullptr}; -component_tag control_soundwave36_2_tag = {"soundwave36", nullptr}; -component_tag control_soundwave38_tag = {"soundwave38", nullptr}; -component_tag control_soundwave39_tag = {"soundwave39", nullptr}; -component_tag control_soundwave40_tag = {"soundwave40", nullptr}; -component_tag control_soundwave41_tag = {"soundwave41", nullptr}; -component_tag control_soundwave44_tag = {"soundwave44", nullptr}; -component_tag control_soundwave45_tag = {"soundwave45", nullptr}; -component_tag control_soundwave46_tag = {"soundwave46", nullptr}; -component_tag control_soundwave47_tag = {"soundwave47", nullptr}; -component_tag control_soundwave48_tag = {"soundwave48", nullptr}; -component_tag control_soundwave49D_tag = {"soundwave49D", nullptr}; -component_tag control_soundwave50_1_tag = {"soundwave50", nullptr}; -component_tag control_soundwave50_2_tag = {"soundwave50", nullptr}; -component_tag control_soundwave52_tag = {"soundwave52", nullptr}; -component_tag control_soundwave59_tag = {"soundwave59", nullptr}; -component_tag control_target1_tag = {"a_targ1", nullptr}; -component_tag control_target2_tag = {"a_targ2", nullptr}; -component_tag control_target3_tag = {"a_targ3", nullptr}; -component_tag control_target4_tag = {"a_targ4", nullptr}; -component_tag control_target5_tag = {"a_targ5", nullptr}; -component_tag control_target6_tag = {"a_targ6", nullptr}; -component_tag control_target7_tag = {"a_targ7", nullptr}; -component_tag control_target8_tag = {"a_targ8", nullptr}; -component_tag control_target9_tag = {"a_targ9", nullptr}; -component_tag control_target10_tag = {"a_targ10", nullptr}; -component_tag control_target11_tag = {"a_targ11", nullptr}; -component_tag control_target12_tag = {"a_targ12", nullptr}; -component_tag control_target13_tag = {"a_targ13", nullptr}; -component_tag control_target14_tag = {"a_targ14", nullptr}; -component_tag control_target15_tag = {"a_targ15", nullptr}; -component_tag control_target16_tag = {"a_targ16", nullptr}; -component_tag control_target17_tag = {"a_targ17", nullptr}; -component_tag control_target18_tag = {"a_targ18", nullptr}; -component_tag control_target19_tag = {"a_targ19", nullptr}; -component_tag control_target20_tag = {"a_targ20", nullptr}; -component_tag control_target21_tag = {"a_targ21", nullptr}; -component_tag control_target22_tag = {"a_targ22", nullptr}; -component_tag control_top_circle_tgt_lights_tag = {"top_circle_tgt_lights", nullptr}; -component_tag control_top_target_lights_tag = {"top_target_lights", nullptr}; -component_tag control_trip1_tag = {"s_trip1", nullptr}; -component_tag control_trip2_tag = {"s_trip2", nullptr}; -component_tag control_trip3_tag = {"s_trip3", nullptr}; -component_tag control_trip4_tag = {"s_trip4", nullptr}; -component_tag control_trip5_tag = {"s_trip5", nullptr}; -component_tag control_worm_hole_lights_tag = {"worm_hole_lights", nullptr}; +component_tag control_attack_bump_tag = {"attack_bumpers", nullptr}; +component_tag control_launch_bump_tag = {"launch_bumpers", nullptr}; +component_tag control_block1_tag = {"v_bloc1", nullptr}; +component_tag control_bump1_tag = {"a_bump1", nullptr}; +component_tag control_bump2_tag = {"a_bump2", nullptr}; +component_tag control_bump3_tag = {"a_bump3", nullptr}; +component_tag control_bump4_tag = {"a_bump4", nullptr}; +component_tag control_bump5_tag = {"a_bump5", nullptr}; +component_tag control_bump6_tag = {"a_bump6", nullptr}; +component_tag control_bump7_tag = {"a_bump7", nullptr}; +component_tag control_drain_tag = {"drain", nullptr}; +component_tag control_flag1_tag = {"a_flag1", nullptr}; +component_tag control_flag2_tag = {"a_flag2", nullptr}; +component_tag control_flip1_tag = {"a_flip1", nullptr}; +component_tag control_flip2_tag = {"a_flip2", nullptr}; +component_tag control_fuel_bargraph_tag = {"fuel_bargraph", nullptr}; +component_tag control_gate1_tag = {"v_gate1", nullptr}; +component_tag control_gate2_tag = {"v_gate2", nullptr}; +component_tag control_info_text_box_tag = {"info_text_box", nullptr}; +component_tag control_kicker1_tag = {"a_kick1", nullptr}; +component_tag control_kicker2_tag = {"a_kick2", nullptr}; +component_tag control_kickout1_tag = {"a_kout1", nullptr}; +component_tag control_kickout2_tag = {"a_kout2", nullptr}; +component_tag control_kickout3_tag = {"a_kout3", nullptr}; +component_tag control_lite1_tag = {"lite1", nullptr}; +component_tag control_lite2_tag = {"lite2", nullptr}; +component_tag control_lite3_tag = {"lite3", nullptr}; +component_tag control_lite4_tag = {"lite4", nullptr}; +component_tag control_lite5_tag = {"lite5", nullptr}; +component_tag control_lite6_tag = {"lite6", nullptr}; +component_tag control_lite7_tag = {"lite7", nullptr}; +component_tag control_lite8_tag = {"lite8", nullptr}; +component_tag control_lite9_tag = {"lite9", nullptr}; +component_tag control_lite10_tag = {"lite10", nullptr}; +component_tag control_lite11_tag = {"lite11", nullptr}; +component_tag control_lite12_tag = {"lite12", nullptr}; +component_tag control_lite13_tag = {"lite13", nullptr}; +component_tag control_lite16_tag = {"lite16", nullptr}; +component_tag control_lite17_tag = {"lite17", nullptr}; +component_tag control_lite18_tag = {"lite18", nullptr}; +component_tag control_lite19_tag = {"lite19", nullptr}; +component_tag control_lite20_tag = {"lite20", nullptr}; +component_tag control_lite21_tag = {"lite21", nullptr}; +component_tag control_lite22_tag = {"lite22", nullptr}; +component_tag control_lite23_tag = {"lite23", nullptr}; +component_tag control_lite24_tag = {"lite24", nullptr}; +component_tag control_lite25_tag = {"lite25", nullptr}; +component_tag control_lite26_tag = {"lite26", nullptr}; +component_tag control_lite27_tag = {"lite27", nullptr}; +component_tag control_lite28_tag = {"lite28", nullptr}; +component_tag control_lite29_tag = {"lite29", nullptr}; +component_tag control_lite30_tag = {"lite30", nullptr}; +component_tag control_lite54_tag = {"lite54", nullptr}; +component_tag control_lite55_tag = {"lite55", nullptr}; +component_tag control_lite56_tag = {"lite56", nullptr}; +component_tag control_lite58_tag = {"lite58", nullptr}; +component_tag control_lite59_tag = {"lite59", nullptr}; +component_tag control_lite60_tag = {"lite60", nullptr}; +component_tag control_lite61_tag = {"lite61", nullptr}; +component_tag control_lite62_tag = {"lite62", nullptr}; +component_tag control_lite67_tag = {"lite67", nullptr}; +component_tag control_lite68_tag = {"lite68", nullptr}; +component_tag control_lite69_tag = {"lite69", nullptr}; +component_tag control_lite70_tag = {"lite70", nullptr}; +component_tag control_lite71_tag = {"lite71", nullptr}; +component_tag control_lite72_tag = {"lite72", nullptr}; +component_tag control_lite77_tag = {"lite77", nullptr}; +component_tag control_lite84_tag = {"lite84", nullptr}; +component_tag control_lite85_tag = {"lite85", nullptr}; +component_tag control_lite101_tag = {"lite101", nullptr}; +component_tag control_lite102_tag = {"lite102", nullptr}; +component_tag control_lite103_tag = {"lite103", nullptr}; +component_tag control_lite104_tag = {"lite104", nullptr}; +component_tag control_lite105_tag = {"lite105", nullptr}; +component_tag control_lite106_tag = {"lite106", nullptr}; +component_tag control_lite107_tag = {"lite107", nullptr}; +component_tag control_lite108_tag = {"lite108", nullptr}; +component_tag control_lite109_tag = {"lite109", nullptr}; +component_tag control_lite110_tag = {"lite110", nullptr}; +component_tag control_lite130_tag = {"lite130", nullptr}; +component_tag control_lite131_tag = {"lite131", nullptr}; +component_tag control_lite132_tag = {"lite132", nullptr}; +component_tag control_lite133_tag = {"lite133", nullptr}; +component_tag control_lite169_tag = {"lite169", nullptr}; +component_tag control_lite170_tag = {"lite170", nullptr}; +component_tag control_lite171_tag = {"lite171", nullptr}; +component_tag control_lite195_tag = {"lite195", nullptr}; +component_tag control_lite196_tag = {"lite196", nullptr}; +component_tag control_lite198_tag = {"lite198", nullptr}; +component_tag control_lite199_tag = {"lite199", nullptr}; +component_tag control_lite200_tag = {"lite200", nullptr}; +component_tag control_lite300_tag = {"lite300", nullptr}; +component_tag control_lite301_tag = {"lite301", nullptr}; +component_tag control_lite302_tag = {"lite302", nullptr}; +component_tag control_lite303_tag = {"lite303", nullptr}; +component_tag control_lite304_tag = {"lite304", nullptr}; +component_tag control_lite305_tag = {"lite305", nullptr}; +component_tag control_lite306_tag = {"lite306", nullptr}; +component_tag control_lite307_tag = {"lite307", nullptr}; +component_tag control_lite308_tag = {"lite308", nullptr}; +component_tag control_lite309_tag = {"lite309", nullptr}; +component_tag control_lite310_tag = {"lite310", nullptr}; +component_tag control_lite311_tag = {"lite311", nullptr}; +component_tag control_lite312_tag = {"lite312", nullptr}; +component_tag control_lite313_tag = {"lite313", nullptr}; +component_tag control_lite314_tag = {"lite314", nullptr}; +component_tag control_lite315_tag = {"lite315", nullptr}; +component_tag control_lite316_tag = {"lite316", nullptr}; +component_tag control_lite317_tag = {"lite317", nullptr}; +component_tag control_lite318_tag = {"lite318", nullptr}; +component_tag control_lite319_tag = {"lite319", nullptr}; +component_tag control_lite320_tag = {"lite320", nullptr}; +component_tag control_lite321_tag = {"lite321", nullptr}; +component_tag control_lite322_tag = {"lite322", nullptr}; +component_tag control_literoll179_tag = {"literoll179", nullptr}; +component_tag control_literoll180_tag = {"literoll180", nullptr}; +component_tag control_literoll181_tag = {"literoll181", nullptr}; +component_tag control_literoll182_tag = {"literoll182", nullptr}; +component_tag control_literoll183_tag = {"literoll183", nullptr}; +component_tag control_literoll184_tag = {"literoll184", nullptr}; +component_tag control_middle_circle_tag = {"middle_circle", nullptr}; +component_tag control_lchute_tgt_lights_tag = {"lchute_tgt_lights", nullptr}; +component_tag control_l_trek_lights_tag = {"l_trek_lights", nullptr}; +component_tag control_goal_lights_tag = {"goal_lights", nullptr}; +component_tag control_hyper_lights_tag = {"hyperspace_lights", nullptr}; +component_tag control_bmpr_inc_lights_tag = {"bmpr_inc_lights", nullptr}; +component_tag control_bpr_solotgt_lights_tag = {"bpr_solotgt_lights", nullptr}; +component_tag control_bsink_arrow_lights_tag = {"bsink_arrow_lights", nullptr}; +component_tag control_bumber_target_lights_tag = {"bumper_target_lights", nullptr}; +component_tag control_outer_circle_tag = {"outer_circle", nullptr}; +component_tag control_r_trek_lights_tag = {"r_trek_lights", nullptr}; +component_tag control_ramp_bmpr_inc_lights_tag = {"ramp_bmpr_inc_lights", nullptr}; +component_tag control_ramp_tgt_lights_tag = {"ramp_tgt_lights", nullptr}; +component_tag control_skill_shot_lights_tag = {"skill_shot_lights", nullptr}; +component_tag control_top_circle_tgt_lights_tag = {"top_circle_tgt_lights", nullptr}; +component_tag control_top_target_lights_tag = {"top_target_lights", nullptr}; +component_tag control_worm_hole_lights_tag = {"worm_hole_lights", nullptr}; +component_tag control_mission_text_box_tag = {"mission_text_box", nullptr}; +component_tag control_oneway1_tag = {"s_onewy1", nullptr}; +component_tag control_oneway4_tag = {"s_onewy4", nullptr}; +component_tag control_oneway10_tag = {"s_onewy10", nullptr}; +component_tag control_plunger_tag = {"plunger", nullptr}; +component_tag control_ramp_hole_tag = {"ramp_hole", nullptr}; +component_tag control_ramp_tag = {"ramp", nullptr}; +component_tag control_rebo1_tag = {"v_rebo1", nullptr}; +component_tag control_rebo2_tag = {"v_rebo2", nullptr}; +component_tag control_rebo3_tag = {"v_rebo3", nullptr}; +component_tag control_rebo4_tag = {"v_rebo4", nullptr}; +component_tag control_roll1_tag = {"a_roll1", nullptr}; +component_tag control_roll2_tag = {"a_roll2", nullptr}; +component_tag control_roll3_tag = {"a_roll3", nullptr}; +component_tag control_roll4_tag = {"a_roll4", nullptr}; +component_tag control_roll5_tag = {"a_roll5", nullptr}; +component_tag control_roll6_tag = {"a_roll6", nullptr}; +component_tag control_roll7_tag = {"a_roll7", nullptr}; +component_tag control_roll8_tag = {"a_roll8", nullptr}; +component_tag control_roll9_tag = {"a_roll9", nullptr}; +component_tag control_roll110_tag = {"a_roll110", nullptr}; +component_tag control_roll111_tag = {"a_roll111", nullptr}; +component_tag control_roll112_tag = {"a_roll112", nullptr}; +component_tag control_roll179_tag = {"a_roll179", nullptr}; +component_tag control_roll180_tag = {"a_roll180", nullptr}; +component_tag control_roll181_tag = {"a_roll181", nullptr}; +component_tag control_roll182_tag = {"a_roll182", nullptr}; +component_tag control_roll183_tag = {"a_roll183", nullptr}; +component_tag control_roll184_tag = {"a_roll184", nullptr}; +component_tag control_sink1_tag = {"v_sink1", nullptr}; +component_tag control_sink2_tag = {"v_sink2", nullptr}; +component_tag control_sink3_tag = {"v_sink3", nullptr}; +component_tag control_sink7_tag = {"v_sink7", nullptr}; +component_tag control_soundwave3_tag = {"soundwave3", nullptr}; +component_tag control_soundwave7_tag = {"soundwave7", nullptr}; +component_tag control_soundwave8_tag = {"soundwave8", nullptr}; +component_tag control_soundwave9_tag = {"soundwave9", nullptr}; +component_tag control_soundwave10_tag = {"soundwave10", nullptr}; +component_tag control_soundwave14_1_tag = {"soundwave14", nullptr}; +component_tag control_soundwave14_2_tag = {"soundwave14", nullptr}; +component_tag control_soundwave21_tag = {"soundwave21", nullptr}; +component_tag control_soundwave23_tag = {"soundwave23", nullptr}; +component_tag control_soundwave24_tag = {"soundwave24", nullptr}; +component_tag control_soundwave25_tag = {"soundwave25", nullptr}; +component_tag control_soundwave26_tag = {"soundwave26", nullptr}; +component_tag control_soundwave27_tag = {"soundwave27", nullptr}; +component_tag control_soundwave28_tag = {"soundwave28", nullptr}; +component_tag control_soundwave30_tag = {"soundwave30", nullptr}; +component_tag control_soundwave35_1_tag = {"soundwave35", nullptr}; +component_tag control_soundwave35_2_tag = {"soundwave35", nullptr}; +component_tag control_soundwave36_1_tag = {"soundwave36", nullptr}; +component_tag control_soundwave36_2_tag = {"soundwave36", nullptr}; +component_tag control_soundwave38_tag = {"soundwave38", nullptr}; +component_tag control_soundwave39_tag = {"soundwave39", nullptr}; +component_tag control_soundwave40_tag = {"soundwave40", nullptr}; +component_tag control_soundwave41_tag = {"soundwave41", nullptr}; +component_tag control_soundwave44_tag = {"soundwave44", nullptr}; +component_tag control_soundwave45_tag = {"soundwave45", nullptr}; +component_tag control_soundwave46_tag = {"soundwave46", nullptr}; +component_tag control_soundwave47_tag = {"soundwave47", nullptr}; +component_tag control_soundwave48_tag = {"soundwave48", nullptr}; +component_tag control_soundwave49D_tag = {"soundwave49D", nullptr}; +component_tag control_soundwave50_1_tag = {"soundwave50", nullptr}; +component_tag control_soundwave50_2_tag = {"soundwave50", nullptr}; +component_tag control_soundwave52_tag = {"soundwave52", nullptr}; +component_tag control_soundwave59_tag = {"soundwave59", nullptr}; +component_tag control_target1_tag = {"a_targ1", nullptr}; +component_tag control_target2_tag = {"a_targ2", nullptr}; +component_tag control_target3_tag = {"a_targ3", nullptr}; +component_tag control_target4_tag = {"a_targ4", nullptr}; +component_tag control_target5_tag = {"a_targ5", nullptr}; +component_tag control_target6_tag = {"a_targ6", nullptr}; +component_tag control_target7_tag = {"a_targ7", nullptr}; +component_tag control_target8_tag = {"a_targ8", nullptr}; +component_tag control_target9_tag = {"a_targ9", nullptr}; +component_tag control_target10_tag = {"a_targ10", nullptr}; +component_tag control_target11_tag = {"a_targ11", nullptr}; +component_tag control_target12_tag = {"a_targ12", nullptr}; +component_tag control_target13_tag = {"a_targ13", nullptr}; +component_tag control_target14_tag = {"a_targ14", nullptr}; +component_tag control_target15_tag = {"a_targ15", nullptr}; +component_tag control_target16_tag = {"a_targ16", nullptr}; +component_tag control_target17_tag = {"a_targ17", nullptr}; +component_tag control_target18_tag = {"a_targ18", nullptr}; +component_tag control_target19_tag = {"a_targ19", nullptr}; +component_tag control_target20_tag = {"a_targ20", nullptr}; +component_tag control_target21_tag = {"a_targ21", nullptr}; +component_tag control_target22_tag = {"a_targ22", nullptr}; +component_tag control_trip1_tag = {"s_trip1", nullptr}; +component_tag control_trip2_tag = {"s_trip2", nullptr}; +component_tag control_trip3_tag = {"s_trip3", nullptr}; +component_tag control_trip4_tag = {"s_trip4", nullptr}; +component_tag control_trip5_tag = {"s_trip5", nullptr}; TPinballTable* control::TableG; @@ -365,7 +382,7 @@ component_info control::score_components[88] }; -component_tag* control::simple_components[142] +component_tag_base* control::simple_components[142] { &control_lite8_tag, &control_lite9_tag, @@ -539,10 +556,10 @@ void control::make_links(TPinballTable* table) } -TPinballComponent* control::make_component_link(component_tag* tag) +TPinballComponent* control::make_component_link(component_tag_base* tag) { - if (tag->Component) - return tag->Component; + if (tag->GetComponent()) + return tag->GetComponent(); auto compList = TableG->ComponentList; for (int index = 0; index < compList->Count(); index++) @@ -552,7 +569,7 @@ TPinballComponent* control::make_component_link(component_tag* tag) { if (!strcmp(comp->GroupName, tag->Name)) { - tag->Component = comp; + tag->SetComponent(comp); return comp; } } @@ -792,29 +809,29 @@ void control::pbctrl_bdoor_controller(int key) void control::table_add_extra_ball(float count) { ++TableG->ExtraBalls; - static_cast(control_soundwave28_tag.Component)->Play(); + control_soundwave28_tag.Component->Play(); auto msg = pinball::get_rc_string(9, 0); - static_cast(control_info_text_box_tag.Component)->Display(msg, count); + control_info_text_box_tag.Component->Display(msg, count); } void control::table_set_bonus_hold() { control_lite58_tag.Component->Message(19, 0.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(52, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(52, 0), 2.0); } void control::table_set_bonus() { TableG->ScoreSpecial2Flag = 1; control_lite59_tag.Component->Message(9, 60.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(4, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(4, 0), 2.0); } void control::table_set_jackpot() { TableG->ScoreSpecial3Flag = 1; control_lite60_tag.Component->Message(9, 60.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(15, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(15, 0), 2.0); } void control::table_set_flag_lights() @@ -822,12 +839,12 @@ void control::table_set_flag_lights() control_lite20_tag.Component->Message(9, 60.0); control_lite19_tag.Component->Message(9, 60.0); control_lite61_tag.Component->Message(9, 60.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(51, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(51, 0), 2.0); } void control::table_set_multiball() { - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(16, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(16, 0), 2.0); } int control::cheat_bump_rank() @@ -835,9 +852,9 @@ int control::cheat_bump_rank() return 0; } -bool control::light_on(component_tag* tag) +bool control::light_on(component_tag* tag) { - auto light = static_cast(tag->Component); + auto light = tag->Component; return light->BmpIndex1 || light->FlasherFlag2 || light->FlasherActive; } @@ -883,8 +900,8 @@ int control::AddRankProgress(int rank) middleCircle->Message(41, 5.0); auto rankText = pinball::get_rc_string(RankRcArray[midActiveCount], 1); sprintf_s(Buffer, pinball::get_rc_string(83, 0), rankText); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave10_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave10_tag.Component->Play(); } } else if (activeCount >= 3 * totalCount / 4) @@ -992,10 +1009,10 @@ void control::DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballCompon int count = control_skill_shot_lights_tag.Component->Message(37, 0.0); if (count) { - static_cast(control_soundwave3_tag.Component)->Play(); + control_soundwave3_tag.Component->Play(); int score = TableG->AddScore(caller->get_scoring(count - 1)); sprintf_s(Buffer, pinball::get_rc_string(21, 0), score); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); if (!light_on(&control_lite56_tag)) { control_l_trek_lights_tag.Component->Message(34, 0.0); @@ -1047,7 +1064,7 @@ void control::DrainBallBlockerControl(int code, TPinballComponent* caller) void control::LaunchRampControl(int code, TPinballComponent* caller) { - TPinballComponent* sound; + TSound* sound; char Buffer[64]; if (code == 63) @@ -1057,8 +1074,8 @@ void control::LaunchRampControl(int code, TPinballComponent* caller) { someFlag = 1; int addedScore = SpecialAddScore(TableG->ScoreSpecial1); - sprintf_s(Buffer, static_cast(pinball::get_rc_string(10, 0)), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + sprintf_s(Buffer, pinball::get_rc_string(10, 0), addedScore); + control_info_text_box_tag.Component->Display(Buffer, 2.0); } if (light_on(&control_lite55_tag)) someFlag |= 2u; @@ -1084,7 +1101,7 @@ void control::LaunchRampControl(int code, TPinballComponent* caller) TableG->AddScore(caller->get_scoring(0)); sound = control_soundwave30_tag.Component; } - static_cast(sound)->Play(); + sound->Play(); } } @@ -1113,13 +1130,13 @@ void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller) TLight* light; if (control_roll3_tag.Component == caller) { - light = static_cast(control_lite8_tag.Component); + light = control_lite8_tag.Component; } else { - light = static_cast(control_lite9_tag.Component); + light = control_lite9_tag.Component; if (control_roll2_tag.Component != caller) - light = static_cast(control_lite10_tag.Component); + light = control_lite10_tag.Component; } if (!light->FlasherActive) { @@ -1135,11 +1152,10 @@ void control::ReentryLanesRolloverControl(int code, TPinballComponent* caller) { control_bmpr_inc_lights_tag.Component->Message(7, 5.0); control_bmpr_inc_lights_tag.Component->Message(0, 0.0); - if (static_cast(control_bump1_tag.Component)->BmpIndex < 3) + if (control_bump1_tag.Component->BmpIndex < 3) { control_attack_bump_tag.Component->Message(12, 0.0); - static_cast(control_info_text_box_tag.Component)->Display( - pinball::get_rc_string(5, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(5, 0), 2.0); } control_attack_bump_tag.Component->Message(48, 60.0); } @@ -1153,6 +1169,7 @@ void control::BumperGroupControl(int code, TPinballComponent* caller) { if (code == 61) { + /*Bug in the original. Caller (TComponentGroup) is accessed beyond bounds at 0x4E*/ if (static_cast(caller)->BmpIndex) { caller->Message(48, 60.0); @@ -1169,13 +1186,13 @@ void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller) { if (control_roll112_tag.Component == caller) { - light = static_cast(control_lite171_tag.Component); + light = control_lite171_tag.Component; } else { - light = static_cast(control_lite170_tag.Component); + light = control_lite170_tag.Component; if (control_roll111_tag.Component != caller) - light = static_cast(control_lite169_tag.Component); + light = control_lite169_tag.Component; } if (!light->FlasherActive) { @@ -1191,11 +1208,10 @@ void control::LaunchLanesRolloverControl(int code, TPinballComponent* caller) { control_ramp_bmpr_inc_lights_tag.Component->Message(7, 5.0); control_ramp_bmpr_inc_lights_tag.Component->Message(0, 0.0); - if (static_cast(control_bump5_tag.Component)->BmpIndex < 3) + if (control_bump5_tag.Component->BmpIndex < 3) { control_launch_bump_tag.Component->Message(12, 0.0); - static_cast(control_info_text_box_tag.Component)->Display( - pinball::get_rc_string(6, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(6, 0), 2.0); } control_launch_bump_tag.Component->Message(48, 60.0); } @@ -1217,7 +1233,7 @@ void control::OutLaneRolloverControl(int code, TPinballComponent* caller) } else { - static_cast(control_soundwave26_tag.Component)->Play(); + control_soundwave26_tag.Component->Play(); } if (control_roll4_tag.Component == caller) { @@ -1269,15 +1285,15 @@ void control::BonusLaneRolloverControl(int code, TPinballComponent* caller) { int addedScore = SpecialAddScore(TableG->ScoreSpecial2); sprintf_s(Buffer, pinball::get_rc_string(3, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); control_lite16_tag.Component->Message(20, 0.0); - static_cast(control_soundwave50_1_tag.Component)->Play(); + control_soundwave50_1_tag.Component->Play(); } else { TableG->AddScore(caller->get_scoring(0)); - static_cast(control_soundwave25_tag.Component)->Play(); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_soundwave25_tag.Component->Play(); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } control_fuel_bargraph_tag.Component->Message(45, 11.0); } @@ -1294,7 +1310,7 @@ void control::FuelRollover1Control(int code, TPinballComponent* caller) else { control_fuel_bargraph_tag.Component->Message(45, 1.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1311,7 +1327,7 @@ void control::FuelRollover2Control(int code, TPinballComponent* caller) else { control_fuel_bargraph_tag.Component->Message(45, 3.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1328,7 +1344,7 @@ void control::FuelRollover3Control(int code, TPinballComponent* caller) else { control_fuel_bargraph_tag.Component->Message(45, 5.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1345,7 +1361,7 @@ void control::FuelRollover4Control(int code, TPinballComponent* caller) else { control_fuel_bargraph_tag.Component->Message(45, 7.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1362,7 +1378,7 @@ void control::FuelRollover5Control(int code, TPinballComponent* caller) else { control_fuel_bargraph_tag.Component->Message(45, 9.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1379,7 +1395,7 @@ void control::FuelRollover6Control(int code, TPinballComponent* caller) else { control_fuel_bargraph_tag.Component->Message(45, 11.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } TableG->AddScore(caller->get_scoring(0)); } @@ -1436,7 +1452,7 @@ void control::BonusLightControl(int code, TPinballComponent* caller) void control::BoosterTargetControl(int code, TPinballComponent* caller) { - TPinballComponent* sound = nullptr; + TSound* sound = nullptr; if (code == 63 && !caller->MessageField) { @@ -1486,7 +1502,7 @@ void control::BoosterTargetControl(int code, TPinballComponent* caller) } } if (sound) - static_cast(sound)->Play(); + sound->Play(); control_target1_tag.Component->MessageField = 0; control_target1_tag.Component->Message(50, 0.0); @@ -1540,7 +1556,7 @@ void control::MultiplierLightGroupControl(int code, TPinballComponent* caller) TableG->ScoreMultiplier = 4; caller->Message(19, 0.0); caller->Message(43, 30.0); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(59, 0), 2.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(59, 0), 2.0); break; case 65: TableG->ScoreMultiplier = 0; @@ -1574,12 +1590,12 @@ void control::FuelSpotTargetControl(int code, TPinballComponent* caller) { control_top_circle_tgt_lights_tag.Component->Message(16, 2.0); control_fuel_bargraph_tag.Component->Message(45, 11.0); - static_cast(control_soundwave25_tag.Component)->Play(); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(44, 0), 2.0); + control_soundwave25_tag.Component->Play(); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(44, 0), 2.0); } else { - static_cast(control_soundwave49D_tag.Component)->Play(); + control_soundwave49D_tag.Component->Play(); } } } @@ -1606,14 +1622,14 @@ void control::MissionSpotTargetControl(int code, TPinballComponent* caller) } lite->Message(15, 2.0); - TPinballComponent* sound; - if (!light_on(&control_lite198_tag) || static_cast(control_lite198_tag.Component)->FlasherActive) + TSound* sound; + if (!light_on(&control_lite198_tag) || control_lite198_tag.Component->FlasherActive) { sound = control_soundwave52_tag.Component; } else sound = control_soundwave49D_tag.Component; - static_cast(sound)->Play(); + sound->Play(); TableG->AddScore(caller->get_scoring(0)); if (control_ramp_tgt_lights_tag.Component->Message(37, 0.0) == 3) control_ramp_tgt_lights_tag.Component->Message(16, 2.0); @@ -1645,13 +1661,13 @@ void control::LeftHazardSpotTargetControl(int code, TPinballComponent* caller) TableG->AddScore(caller->get_scoring(0)); if (control_lchute_tgt_lights_tag.Component->Message(37, 0.0) == 3) { - static_cast(control_soundwave14_1_tag.Component)->Play(); + control_soundwave14_1_tag.Component->Play(); control_gate1_tag.Component->Message(53, 0.0); control_lchute_tgt_lights_tag.Component->Message(16, 2.0); } else { - static_cast(control_soundwave49D_tag.Component)->Play(); + control_soundwave49D_tag.Component->Play(); } } } @@ -1672,7 +1688,7 @@ void control::BlackHoleKickoutControl(int code, TPinballComponent* caller) { int addedScore = TableG->AddScore(caller->get_scoring(0)); sprintf_s(Buffer, pinball::get_rc_string(80, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); caller->Message(55, -1.0); } } @@ -1700,10 +1716,10 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller) { auto addedScore = TableG->AddScore(caller->get_scoring(0)); sprintf_s(Buffer, pinball::get_rc_string(81, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); control_lite62_tag.Component->Message(20, 0.0); caller->UnknownBaseFlag2 = 0; - auto duration = static_cast(control_soundwave7_tag.Component)->Play(); + auto duration = control_soundwave7_tag.Component->Play(); caller->Message(55, duration); break; } @@ -1716,9 +1732,9 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller) } else { - sprintf_s(Buffer, static_cast(pinball::get_rc_string(45, 0))); + sprintf_s(Buffer, pinball::get_rc_string(45, 0)); } - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); control_lite62_tag.Component->Message(4, 0.0); control_kickout1_tag.Component->UnknownBaseFlag2 = 1; break; @@ -1778,8 +1794,7 @@ void control::MissionControl(int code, TPinballComponent* caller) control_l_trek_lights_tag.Component->Message(20, 0.0); control_r_trek_lights_tag.Component->Message(34, 0.0); control_r_trek_lights_tag.Component->Message(20, 0.0); - static_cast(control_mission_text_box_tag.Component)->Display( - pinball::get_rc_string(109, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(109, 0), 4.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); } @@ -1789,8 +1804,7 @@ void control::MissionControl(int code, TPinballComponent* caller) { if (control_fuel_bargraph_tag.Component->Message(37, 0.0) == 1) { - static_cast(control_mission_text_box_tag.Component)->Display( - pinball::get_rc_string(116, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(116, 0), 4.0); } break; } @@ -1923,23 +1937,23 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) { auto addedScore = TableG->AddScore(caller->get_scoring(0)); sprintf_s(Buffer, pinball::get_rc_string(12, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); break; } case 1: { auto addedScore = SpecialAddScore(TableG->ScoreSpecial3); sprintf_s(Buffer, pinball::get_rc_string(14, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); TableG->ScoreSpecial3 = 20000; break; } case 2: { - DrainBallBlockerControl(52, static_cast(control_block1_tag.Component)); + DrainBallBlockerControl(52, control_block1_tag.Component); auto addedScore = TableG->AddScore(caller->get_scoring(2)); sprintf_s(Buffer, pinball::get_rc_string(2, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); break; } case 3: @@ -1947,7 +1961,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) ExtraBallLightControl(19, nullptr); auto addedScore = TableG->AddScore(caller->get_scoring(3)); sprintf_s(Buffer, pinball::get_rc_string(8, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); break; } case 4: @@ -1967,7 +1981,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) someFlag = 1; auto addedScore = SpecialAddScore(TableG->ScoreSpecial1); sprintf_s(Buffer, pinball::get_rc_string(10, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); } if (light_on(&control_lite26_tag)) someFlag |= 2u; @@ -1997,8 +2011,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) GravityWellKickoutControl(64, nullptr); } - TPinballComponent* sound; - + TSound* sound; if (someFlag) { if (someFlag == 1) @@ -2009,9 +2022,9 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) { if (someFlag <= 1 || someFlag > 3) { - auto duration = static_cast(control_soundwave41_tag.Component)->Play(); - static_cast(control_soundwave36_1_tag.Component)->Play(); - static_cast(control_soundwave50_2_tag.Component)->Play(); + auto duration = control_soundwave41_tag.Component->Play(); + control_soundwave36_1_tag.Component->Play(); + control_soundwave50_2_tag.Component->Play(); control_lite25_tag.Component->Message(7, 5.0); caller->Message(55, duration); return; @@ -2040,7 +2053,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller) break; } } - auto duration = static_cast(sound)->Play(); + auto duration = sound->Play(); control_lite25_tag.Component->Message(7, 5.0); caller->Message(55, duration); } @@ -2105,7 +2118,7 @@ void control::MedalTargetControl(int code, TPinballComponent* caller) text = pinball::get_rc_string(55, 0); break; } - static_cast(control_info_text_box_tag.Component)->Display(text, 2.0); + control_info_text_box_tag.Component->Display(text, 2.0); control_target6_tag.Component->MessageField = 0; control_target6_tag.Component->Message(50, 0.0); control_target5_tag.Component->MessageField = 0; @@ -2151,7 +2164,7 @@ void control::MultiplierTargetControl(int code, TPinballComponent* caller) break; } - static_cast(control_info_text_box_tag.Component)->Display(text, 2.0); + control_info_text_box_tag.Component->Display(text, 2.0); control_target9_tag.Component->MessageField = 0; control_target9_tag.Component->Message(50, 0.0); control_target8_tag.Component->MessageField = 0; @@ -2177,10 +2190,10 @@ void control::BallDrainControl(int code, TPinballComponent* caller) TableG->Message(1022, 0.0); if (pb::chk_highscore()) { - static_cast(control_soundwave3_tag.Component)->Play(); + control_soundwave3_tag.Component->Play(); TableG->LightGroup->Message(16, 3.0); char* v11 = pinball::get_rc_string(177, 0); - static_cast(control_mission_text_box_tag.Component)->Display(v11, -1.0); + control_mission_text_box_tag.Component->Display(v11, -1.0); } } else @@ -2204,25 +2217,23 @@ void control::BallDrainControl(int code, TPinballComponent* caller) } if (light_on(&control_lite200_tag)) { - static_cast(control_soundwave27_tag.Component)->Play(); + control_soundwave27_tag.Component->Play(); control_lite200_tag.Component->Message(19, 0.0); - static_cast(control_info_text_box_tag.Component)->Display( - pinball::get_rc_string(96, 0), -1.0); - static_cast(control_soundwave59_tag.Component)->Play(); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(96, 0), -1.0); + control_soundwave59_tag.Component->Play(); } else if (light_on(&control_lite199_tag)) { - static_cast(control_soundwave27_tag.Component)->Play(); + control_soundwave27_tag.Component->Play(); control_lite199_tag.Component->Message(20, 0.0); control_lite200_tag.Component->Message(19, 0.0); - static_cast(control_info_text_box_tag.Component)-> - Display(pinball::get_rc_string(95, 0), 2.0); - static_cast(control_soundwave59_tag.Component)->Play(); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(95, 0), 2.0); + control_soundwave59_tag.Component->Play(); --TableG->UnknownP78; } else if (TableG->UnknownP75) { - static_cast(control_soundwave27_tag.Component)->Play(); + control_soundwave27_tag.Component->Play(); --TableG->UnknownP75; } else @@ -2231,14 +2242,14 @@ void control::BallDrainControl(int code, TPinballComponent* caller) { int time = SpecialAddScore(TableG->ScoreSpecial2); sprintf_s(Buffer, pinball::get_rc_string(94, 0), time); - static_cast(control_info_text_box_tag.Component)->Display(Buffer, 2.0); + control_info_text_box_tag.Component->Display(Buffer, 2.0); } if (TableG->ExtraBalls) { TableG->ExtraBalls--; char* shootAgainText; - static_cast(control_soundwave59_tag.Component)->Play(); + control_soundwave59_tag.Component->Play(); switch (TableG->CurrentPlayer) { case 0: @@ -2255,7 +2266,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller) shootAgainText = pinball::get_rc_string(100, 0); break; } - static_cast(control_info_text_box_tag.Component)->Display(shootAgainText, -1.0); + control_info_text_box_tag.Component->Display(shootAgainText, -1.0); } else { @@ -2269,7 +2280,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller) { control_lite199_tag.Component->MessageField = 1; } - static_cast(control_soundwave27_tag.Component)->Play(); + control_soundwave27_tag.Component->Play(); } control_bmpr_inc_lights_tag.Component->Message(20, 0.0); control_ramp_bmpr_inc_lights_tag.Component->Message(20, 0.0); @@ -2381,12 +2392,12 @@ void control::AlienMenaceController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(175, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(175, 0), -1.0); return; } if (control_bump1_tag.Component == caller) { - if (static_cast(control_bump1_tag.Component)->BmpIndex) + if (control_bump1_tag.Component->BmpIndex) { control_lite307_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 20; @@ -2415,9 +2426,9 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller) { return; } - sprintf_s(Buffer, static_cast(pinball::get_rc_string(107, 0)), + sprintf_s(Buffer, pinball::get_rc_string(107, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_bump1_tag.Component == caller @@ -2436,14 +2447,13 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller) control_lite311_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(130, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(130, 0), 4.0); int addedScore = SpecialAddScore(750000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(7)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2461,7 +2471,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) else if (code == 63) { if (control_kickout3_tag.Component == caller - && static_cast(control_bump5_tag.Component)->BmpIndex) + && control_bump5_tag.Component->BmpIndex) { if (light_on(&control_lite316_tag)) control_lite316_tag.Component->Message(20, 0.0); @@ -2469,14 +2479,13 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) control_lite314_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(124, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(124, 0), 4.0); int addedScore = SpecialAddScore(1000000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(8)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2490,10 +2499,9 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) { return; } - if (static_cast(control_bump5_tag.Component)->BmpIndex) + if (control_bump5_tag.Component->BmpIndex) { - static_cast(control_mission_text_box_tag.Component)->Display( - pinball::get_rc_string(123, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(123, 0), -1.0); if (light_on(&control_lite316_tag)) control_lite316_tag.Component->Message(20, 0.0); if (!light_on(&control_lite314_tag)) @@ -2503,8 +2511,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller) } else { - static_cast(control_mission_text_box_tag.Component)->Display( - pinball::get_rc_string(122, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(122, 0), -1.0); if (light_on(&control_lite314_tag)) control_lite314_tag.Component->Message(20, 0.0); if (!light_on(&control_lite316_tag)) @@ -2557,7 +2564,7 @@ void control::BugHuntController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(125, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_target1_tag.Component == caller @@ -2597,14 +2604,13 @@ void control::BugHuntController(int code, TPinballComponent* caller) control_lite319_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(126, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(126, 0), 4.0); int addedScore = SpecialAddScore(750000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(7)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2629,7 +2635,7 @@ void control::CosmicPlagueController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(139, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_flag1_tag.Component == caller || control_flag2_tag.Component == caller) @@ -2665,7 +2671,7 @@ void control::CosmicPlaguePartTwoController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(140, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(140, 0), -1.0); return; } if (control_roll9_tag.Component == caller) @@ -2673,13 +2679,13 @@ void control::CosmicPlaguePartTwoController(int code, TPinballComponent* caller) control_lite310_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(141, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(141, 0), 4.0); int addedScore = SpecialAddScore(1750000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(11)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2701,7 +2707,7 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(137, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_roll4_tag.Component == caller || control_roll8_tag.Component == caller) @@ -2717,14 +2723,13 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller) control_lite320_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(138, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(138, 0), 4.0); int addedScore = SpecialAddScore(1250000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(9)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2775,7 +2780,7 @@ void control::GameoverController(int code, TPinballComponent* caller) if (playerNScoreText != nullptr) { sprintf_s(Buffer, playerNScoreText, playerScore); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 3.0); + control_mission_text_box_tag.Component->Display(Buffer, 3.0); int msgField = nextPlayerId == TableG->PlayerCount ? 0x200 : nextPlayerId | 0x100; control_mission_text_box_tag.Component->MessageField = msgField; return; @@ -2815,7 +2820,7 @@ void control::GameoverController(int code, TPinballComponent* caller) if (highScoreNText != nullptr) { sprintf_s(Buffer, highScoreNText, highScore); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 3.0); + control_mission_text_box_tag.Component->Display(Buffer, 3.0); int msgField = nextHidhscoreId == 5 ? 0 : nextHidhscoreId | 0x200; control_mission_text_box_tag.Component->MessageField = msgField; return; @@ -2824,7 +2829,7 @@ void control::GameoverController(int code, TPinballComponent* caller) } control_mission_text_box_tag.Component->MessageField = 0x100; - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(172, 0), 10.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(172, 0), 10.0); } void control::LaunchTrainingController(int code, TPinballComponent* caller) @@ -2843,7 +2848,7 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(110, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_ramp_tag.Component == caller) @@ -2858,14 +2863,13 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller) control_lite317_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(111, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(111, 0), 4.0); int addedScore = SpecialAddScore(500000); - sprintf_s(Buffer, static_cast(pinball::get_rc_string(78, 0)), addedScore); + sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(6)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2889,7 +2893,7 @@ void control::MaelstromController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(148, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_target1_tag.Component == caller @@ -2933,7 +2937,7 @@ void control::MaelstromPartEightController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(155, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(155, 0), -1.0); return; } if (control_kickout2_tag.Component == caller) @@ -2944,11 +2948,11 @@ void control::MaelstromPartEightController(int code, TPinballComponent* caller) MissionControl(66, nullptr); int addedScore = SpecialAddScore(5000000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); - static_cast(control_info_text_box_tag.Component)->Display(pinball::get_rc_string(48, 0), 4.0); + control_info_text_box_tag.Component->Display(pinball::get_rc_string(48, 0), 4.0); if (!AddRankProgress(18)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -2965,7 +2969,7 @@ void control::MaelstromPartFiveController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(152, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(152, 0), -1.0); return; } if (control_ramp_tag.Component == caller) @@ -2989,7 +2993,7 @@ void control::MaelstromPartFourController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(151, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(151, 0), -1.0); return; } if (control_roll184_tag.Component == caller) @@ -3015,7 +3019,7 @@ void control::MaelstromPartSevenController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(154, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(154, 0), -1.0); return; } if (control_sink1_tag.Component == caller @@ -3042,7 +3046,7 @@ void control::MaelstromPartSixController(int code, TPinballComponent* caller) { return; } - static_cast(control_mission_text_box_tag.Component)->Display(pinball::get_rc_string(153, 0), -1.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(153, 0), -1.0); return; } if (control_flag1_tag.Component == caller || control_flag2_tag.Component == caller) @@ -3077,7 +3081,7 @@ void control::MaelstromPartThreeController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(150, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_roll3_tag.Component == caller @@ -3131,7 +3135,7 @@ void control::MaelstromPartTwoController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(149, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_target10_tag.Component == caller @@ -3183,7 +3187,7 @@ void control::PracticeMissionController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(107, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } @@ -3203,14 +3207,13 @@ void control::PracticeMissionController(int code, TPinballComponent* caller) control_lite311_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(108, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(108, 0), 4.0); int addedScore = SpecialAddScore(500000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(6)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } @@ -3237,7 +3240,7 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller) return; } sprintf_s(Buffer, pinball::get_rc_string(134, 0), control_lite56_tag.Component->MessageField); - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, -1.0); + control_mission_text_box_tag.Component->Display(Buffer, -1.0); return; } if (control_roll3_tag.Component == caller @@ -3267,14 +3270,13 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller) control_lite321_tag.Component->Message(20, 0.0); control_lite198_tag.Component->MessageField = 1; MissionControl(66, nullptr); - static_cast(control_mission_text_box_tag.Component)-> - Display(pinball::get_rc_string(136, 0), 4.0); + control_mission_text_box_tag.Component->Display(pinball::get_rc_string(136, 0), 4.0); int addedScore = SpecialAddScore(1250000); sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore); if (!AddRankProgress(9)) { - static_cast(control_mission_text_box_tag.Component)->Display(Buffer, 8.0); - static_cast(control_soundwave9_tag.Component)->Play(); + control_mission_text_box_tag.Component->Display(Buffer, 8.0); + control_soundwave9_tag.Component->Play(); } } } diff --git a/SpaceCadetPinball/control.h b/SpaceCadetPinball/control.h index 45ca79d..06a3cb9 100644 --- a/SpaceCadetPinball/control.h +++ b/SpaceCadetPinball/control.h @@ -1,12 +1,47 @@ #pragma once +class TLight; +class TSound; class TPinballTable; class TPinballComponent; -struct component_tag +struct component_tag_base { LPCSTR Name; - TPinballComponent* Component; + + component_tag_base(LPCSTR name) + { + Name = name; + } + + virtual ~component_tag_base() = default; + virtual TPinballComponent* GetComponent() = 0; + virtual void SetComponent(TPinballComponent* comp) = 0; +}; + +/* Original did not have this template. It supposedly cast TSound and TTextBox from TPinballComponent in tags*/ +template +struct component_tag : component_tag_base +{ + static_assert(std::is_base_of::value, "T must inherit from TPinballComponent"); + T* Component; + + component_tag(LPCSTR name, TPinballComponent* component): component_tag_base(name) + { + component_tag::SetComponent(component); + } + + TPinballComponent* GetComponent() override + { + return static_cast(Component); + } + + void SetComponent(TPinballComponent* comp) override + { + Component = dynamic_cast(comp); + if (comp) + assertm(Component, "Wrong component type"); + } }; @@ -19,7 +54,7 @@ struct component_control struct component_info { - component_tag* Tag; + component_tag_base* Tag; component_control Control; }; @@ -29,12 +64,12 @@ class control public: static TPinballTable* TableG; static component_info score_components[88]; - static component_tag* simple_components[142]; + static component_tag_base* simple_components[142]; static int table_unlimited_balls; static int RankRcArray[9], MissionRcArray[17]; static void make_links(TPinballTable* table); - static TPinballComponent* make_component_link(component_tag* tag); + static TPinballComponent* make_component_link(component_tag_base* tag); static void handler(int code, TPinballComponent* cmp); static void pbctrl_bdoor_controller(int key); static void table_add_extra_ball(float count); @@ -44,7 +79,7 @@ public: static void table_set_flag_lights(); static void table_set_multiball(); static int cheat_bump_rank(); - static bool light_on(struct component_tag* tag); + static bool light_on(component_tag* tag); static int SpecialAddScore(int score); static int AddRankProgress(int rank); static void AdvanceWormHoleDestination(int flag); diff --git a/SpaceCadetPinball/pch.h b/SpaceCadetPinball/pch.h index 6b6ed30..e0ebb64 100644 --- a/SpaceCadetPinball/pch.h +++ b/SpaceCadetPinball/pch.h @@ -16,6 +16,7 @@ #include #include #include +#include /*For control template*/ //#include // Use (void) to silent unused warnings.