From b41a870f3b32428beba50f1277635a4d75d1f04d Mon Sep 17 00:00:00 2001 From: NovaRain Date: Fri, 12 Jul 2019 07:36:47 +0800 Subject: [PATCH] Fixed flickering when switching control in gl_partycontrol --- artifacts/mods/gl_partycontrol.int | Bin 3828 -> 3904 bytes artifacts/mods/gl_partycontrol.ssl | 29 ++++++++++++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/artifacts/mods/gl_partycontrol.int b/artifacts/mods/gl_partycontrol.int index ce8f92b4ba56612bac46dc3bf6627ef2162bb3c3..dae6ac02a8c535e3d40ddd278104b6c13b7c505e 100644 GIT binary patch delta 1090 zcmew&dq7U0f$0Dv0|SFl122eXQJN@VSYO5f0TK`jMzVm!nHd-uRA3?yn&k@v0|OHS z1A_^K4KVBp3>e8(0bwzsS-ACMU5tGv1oKjHOnx2_(Y6)L?Xg@&Et-{~L@Oq(LIAX_IYOGZ}A8 zUdF1+=rs8XYb4{d$$D(cf~P>T42%sz5Or+xCMU5OGH#nZg)LJs4J^mnAk?4_VzK*7 z=3|dlod#kvFo0|T1sco-_FD}S4f+jIAX)ZZlP9ptGv1oKf!$F08c2kJvB78pD1eVN zl{J_^%;PYa{D-}h{Qy{=YjO{Vt{`WFFo?&=(!c_tC!gZbW$y#A88|2Z;}92wu-Rbl zh69X@3=9il5yf3LnU8y_bpceR5yWpiVh|I+qTu9%9JxF$2w5JN$@jPmc=$CM zQ=nS6O^)I*X8bd`k4KM*S8MV<9u+Bm4X{BB4MI@b0un5|S(E?p=rb;wtix-_m^3+# zSDo?Kg_eEBqf$0Dv0|SFl122eX5t}GrSf9cG0TK`jMzVm!nHd-uRA3?yn&lA#0|OHS z1A_^K4>tr@(z|-$pVlF15<<10mlFT|Nn0=Zjc6vu!c-%C5Q$t zC5Td((>WJ_`5@(BuQ0GR2sPdXi9uB|fC3B@`mg}wyw)Jm;0p6116Uq8Ksi4^0-#|( zl6NNSa|N*HfQ)6}oZQBxD9H)&2iGRB7zfO?TvH|=;F4$LnEZ}QU(f|j?$cyFZgEkU zhW(8U2N)R{7#6~u#H}?sihHV{3RpdJgApWjxlc{vk>TV10dWpUj{C=CEuI1%zB`R6 z5G6cWlb7)rGj5oCi${-%=iX#4UKJ+3JChA~#Tn%$d+_QrhE1;EHDnZQs^cgEAui%>j004u= A@&Et; diff --git a/artifacts/mods/gl_partycontrol.ssl b/artifacts/mods/gl_partycontrol.ssl index cf0254c2..29f8225e 100644 --- a/artifacts/mods/gl_partycontrol.ssl +++ b/artifacts/mods/gl_partycontrol.ssl @@ -23,7 +23,7 @@ variable noCheckArray, pidList, lightInt, lightDist, npcControl, - displayName, displayNameColor, + displayName, displayNameColor, isShowTag, inControl := false, hasGeckoSkinning := false; @@ -43,7 +43,7 @@ procedure combatturn_handler begin //display_msg("Combat Turn: " + status + ", by " + obj_name(critter) + ", arg3: " + arg3); if npcControl then begin 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 pid := obj_pid(critter); @@ -59,23 +59,29 @@ procedure combatturn_handler begin if hasGeckoSkinning then critter_add_trait(critter, TRAIT_PERK, PERK_gecko_skinning_perk, 1); inControl := true; end else if npcControl then begin - obj_set_light_level(dude_obj, 100, 4); // set default light - npcControl := 0; + obj_set_light_level(dude_obj, 100, 4); // set dude default light + npcControl := 0; // dude control end 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); if (displayName and critter != real_dude_obj) then begin set_iface_tag_text(displayName, obj_name(critter), displayNameColor); show_iface_tag(displayName); + isShowTag := true; end end end else if inControl then begin - if displayName then hide_iface_tag(displayName); - if ((status == 0 or status == -1) and dude_obj != real_dude_obj) then begin - set_dude_obj(real_dude_obj); - obj_set_light_level(dude_obj, 100, 4); - npcControl := 0; + if isShowTag 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); + obj_set_light_level(dude_obj, 100, 4); + npcControl := 0; + end end end end @@ -84,12 +90,13 @@ procedure gamemodechange_handler begin 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 inControl := false; + npcControl := 0; move_to(dude_obj, dude_tile, dude_elevation); end end 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 display_msg(message_str_game(GAME_MSG_PROTO, 675)); set_sfall_return(true);