Fixed flickering when switching control in gl_partycontrol

This commit is contained in:
NovaRain
2019-07-12 07:36:47 +08:00
parent 9a5ea216c4
commit b41a870f3b
2 changed files with 18 additions and 11 deletions
Binary file not shown.
+15 -8
View File
@@ -23,7 +23,7 @@ variable
noCheckArray, noCheckArray,
pidList, pidList,
lightInt, lightDist, npcControl, lightInt, lightDist, npcControl,
displayName, displayNameColor, displayName, displayNameColor, isShowTag,
inControl := false, inControl := false,
hasGeckoSkinning := false; hasGeckoSkinning := false;
@@ -43,7 +43,7 @@ procedure combatturn_handler begin
//display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + ", arg3: " + arg3); //display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + ", arg3: " + arg3);
if npcControl then begin if npcControl then begin
if lightInt then lightInt := round((lightInt / 65536.0) * 100); // calc percent of intensity if lightInt then lightInt := round((lightInt / 65536.0) * 100); // calc percent of intensity
obj_set_light_level(npcControl, lightInt, lightDist); // restore/off light for NPC obj_set_light_level(npcControl, lightInt, lightDist); // restore light for prev. controlled NPC
end end
pid := obj_pid(critter); pid := obj_pid(critter);
@@ -59,37 +59,44 @@ procedure combatturn_handler begin
if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1); if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1);
inControl := true; inControl := true;
end else if npcControl then begin end else if npcControl then begin
obj_set_light_level(dude_obj, 100, 4); // set default light obj_set_light_level(dude_obj, 100, 4); // set dude default light
npcControl := 0; npcControl := 0; // dude control
end end
if inControl then begin if inControl then begin
// center the screen on the controlled critter and remove roof tiles // center the screen on the controlled critter/dude and remove roof tiles
move_to(dude_obj, dude_tile, dude_elevation); move_to(dude_obj, dude_tile, dude_elevation);
if (displayName and critter != real_dude_obj) then begin if (displayName and critter != real_dude_obj) then begin
set_iface_tag_text(displayName, obj_name(critter), displayNameColor); set_iface_tag_text(displayName, obj_name(critter), displayNameColor);
show_iface_tag(displayName); show_iface_tag(displayName);
isShowTag := true;
end end
end end
end else if inControl then begin end else if inControl then begin
if displayName then hide_iface_tag(displayName); if isShowTag then begin
if ((status == 0 or status == -1) and dude_obj != real_dude_obj) then begin hide_iface_tag(displayName);
isShowTag := false;
end
if (status < 0 or AllowControl(pid) == false) then begin
if (dude_obj != real_dude_obj) then begin
set_dude_obj(real_dude_obj); set_dude_obj(real_dude_obj);
obj_set_light_level(dude_obj, 100, 4); obj_set_light_level(dude_obj, 100, 4);
npcControl := 0; npcControl := 0;
end end
end end
end
end end
procedure gamemodechange_handler begin procedure gamemodechange_handler begin
if not(hasGeckoSkinning) then hasGeckoSkinning := has_trait(TRAIT_PERK, real_dude_obj, PERK_gecko_skinning_perk); if not(hasGeckoSkinning) then hasGeckoSkinning := has_trait(TRAIT_PERK, real_dude_obj, PERK_gecko_skinning_perk);
if (inControl and not(get_game_mode BWAND COMBAT)) then begin if (inControl and not(get_game_mode BWAND COMBAT)) then begin
inControl := false; inControl := false;
npcControl := 0;
move_to(dude_obj, dude_tile, dude_elevation); move_to(dude_obj, dude_tile, dude_elevation);
end end
end end
procedure inventorymove_handler begin procedure inventorymove_handler begin
if (inControl and get_sfall_arg == 3) then begin // armor slot if (npcControl and get_sfall_arg == 3) then begin // armor slot
if (obj_pid(dude_obj) == PID_MARCUS or proto_data(obj_pid(dude_obj), cr_body_type) != CR_BODY_BIPED) then begin if (obj_pid(dude_obj) == PID_MARCUS or proto_data(obj_pid(dude_obj), cr_body_type) != CR_BODY_BIPED) then begin
display_msg(message_str_game(GAME_MSG_PROTO, 675)); display_msg(message_str_game(GAME_MSG_PROTO, 675));
set_sfall_return(true); set_sfall_return(true);