From d10816a26b9e6e101f1db95b9872492dabb80f02 Mon Sep 17 00:00:00 2001 From: avolkov Date: Fri, 29 Apr 2005 10:33:38 +0000 Subject: [PATCH] Fix for comm design flaw: separating uninit_race() into post_encounter() and real uninit_race(); fixes bug #519 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1695 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/comm.c | 10 ++++++++-- sc2/src/sc2code/comm/arilou/arilouc.c | 10 ++++++++-- sc2/src/sc2code/comm/blackur/blackurc.c | 8 ++++++++ sc2/src/sc2code/comm/chmmr/chmmrc.c | 8 ++++++++ sc2/src/sc2code/comm/comandr/comandr.c | 8 ++++++++ sc2/src/sc2code/comm/druuge/druugec.c | 10 ++++++++-- sc2/src/sc2code/comm/ilwrath/ilwrathc.c | 8 ++++++++ sc2/src/sc2code/comm/melnorm/melnorm.c | 10 ++++++++-- sc2/src/sc2code/comm/mycon/myconc.c | 8 ++++++++ sc2/src/sc2code/comm/orz/orzc.c | 10 ++++++++-- sc2/src/sc2code/comm/pkunk/pkunkc.c | 10 ++++++++-- sc2/src/sc2code/comm/rebel/rebel.c | 8 ++++++++ sc2/src/sc2code/comm/shofixt/shofixt.c | 8 ++++++++ sc2/src/sc2code/comm/slyhome/slyhome.c | 8 ++++++++ sc2/src/sc2code/comm/slyland/slyland.c | 8 ++++++++ sc2/src/sc2code/comm/spahome/spahome.c | 10 ++++++++-- sc2/src/sc2code/comm/spathi/spathic.c | 10 ++++++++-- sc2/src/sc2code/comm/starbas/starbas.c | 10 ++++++++-- sc2/src/sc2code/comm/supox/supoxc.c | 8 ++++++++ sc2/src/sc2code/comm/syreen/syreenc.c | 8 ++++++++ sc2/src/sc2code/comm/talkpet/talkpet.c | 8 ++++++++ sc2/src/sc2code/comm/thradd/thraddc.c | 8 ++++++++ sc2/src/sc2code/comm/umgah/umgahc.c | 10 ++++++++-- sc2/src/sc2code/comm/urquan/urquanc.c | 10 ++++++++-- sc2/src/sc2code/comm/utwig/utwigc.c | 8 ++++++++ sc2/src/sc2code/comm/vux/vuxc.c | 8 ++++++++ sc2/src/sc2code/comm/yehat/yehatc.c | 8 ++++++++ sc2/src/sc2code/comm/zoqfot/zoqfotc.c | 8 ++++++++ sc2/src/sc2code/globdata.h | 4 +++- 29 files changed, 227 insertions(+), 23 deletions(-) diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index 1e5da9fa3..e43045452 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -2051,7 +2051,8 @@ HailAlien (void) (*CommData.init_encounter_func) (); DoInput ((PVOID)&ES, FALSE); if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) - (*CommData.uninit_encounter_func) (); + (*CommData.post_encounter_func) (); + (*CommData.uninit_encounter_func) (); LockMutex (GraphicsLock); @@ -2175,7 +2176,12 @@ InitCommunication (RESOURCE which_comm) cur_comm = 0; } else if (LocDataPtr) - (*CommData.uninit_encounter_func) (); + { // only when comm initied successfully + if (!(GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))) + (*CommData.post_encounter_func) (); // process states + + (*CommData.uninit_encounter_func) (); // cleanup + } SetResourceIndex (hOldIndex); CloseResourceIndex (hIndex); diff --git a/sc2/src/sc2code/comm/arilou/arilouc.c b/sc2/src/sc2code/comm/arilou/arilouc.c index 387ef168f..9bdf0df13 100644 --- a/sc2/src/sc2code/comm/arilou/arilouc.c +++ b/sc2/src/sc2code/comm/arilou/arilouc.c @@ -26,6 +26,7 @@ static LOCDATA arilou_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)ARILOU_PMAP_ANIM, /* AlienFrame */ (FONT)ARILOU_FONT, /* AlienFont */ @@ -784,6 +785,12 @@ ExitIntro: static COUNT uninit_arilou (void) +{ + return (0); +} + +static void +post_arilou_enc (void) { BYTE Manner; @@ -810,8 +817,6 @@ uninit_arilou (void) SET_GAME_STATE (ARILOU_MANNER, 3); } } - - return (0); } LOCDATAPTR @@ -820,6 +825,7 @@ init_arilou_comm (void) LOCDATAPTR retval; arilou_desc.init_encounter_func = Intro; + arilou_desc.post_encounter_func = post_arilou_enc; arilou_desc.uninit_encounter_func = uninit_arilou; arilou_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/blackur/blackurc.c b/sc2/src/sc2code/comm/blackur/blackurc.c index 4e6b6a456..0e6467849 100644 --- a/sc2/src/sc2code/comm/blackur/blackurc.c +++ b/sc2/src/sc2code/comm/blackur/blackurc.c @@ -23,6 +23,7 @@ static LOCDATA blackurq_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)BLACKURQ_PMAP_ANIM, /* AlienFrame */ (FONT)BLACKURQ_FONT, /* AlienFont */ @@ -529,12 +530,19 @@ uninit_blackurq (void) return (0); } +static void +post_blackurq_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_blackurq_comm (void) { LOCDATAPTR retval; blackurq_desc.init_encounter_func = Intro; + blackurq_desc.post_encounter_func = post_blackurq_enc; blackurq_desc.uninit_encounter_func = uninit_blackurq; blackurq_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/chmmr/chmmrc.c b/sc2/src/sc2code/comm/chmmr/chmmrc.c index fc27198c7..91bab7d7c 100644 --- a/sc2/src/sc2code/comm/chmmr/chmmrc.c +++ b/sc2/src/sc2code/comm/chmmr/chmmrc.c @@ -26,6 +26,7 @@ static LOCDATA chmmr_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)CHMMR_PMAP_ANIM, /* AlienFrame */ (FONT)CHMMR_FONT, /* AlienFont */ @@ -600,12 +601,19 @@ uninit_chmmr (void) return (0); } +static void +post_chmmr_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_chmmr_comm (void) { LOCDATAPTR retval; chmmr_desc.init_encounter_func = Intro; + chmmr_desc.post_encounter_func = post_chmmr_enc; chmmr_desc.uninit_encounter_func = uninit_chmmr; chmmr_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/comandr/comandr.c b/sc2/src/sc2code/comm/comandr/comandr.c index a28fad036..410a6f043 100644 --- a/sc2/src/sc2code/comm/comandr/comandr.c +++ b/sc2/src/sc2code/comm/comandr/comandr.c @@ -25,6 +25,7 @@ static LOCDATA commander_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)COMMANDER_PMAP_ANIM, /* AlienFrame */ (FONT)COMMANDER_FONT, /* AlienFont */ @@ -669,12 +670,19 @@ uninit_commander (void) return (0); } +static void +post_commander_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_commander_comm () { LOCDATAPTR retval; commander_desc.init_encounter_func = Intro; + commander_desc.post_encounter_func = post_commander_enc; commander_desc.uninit_encounter_func = uninit_commander; if (GET_GAME_STATE (RADIOACTIVES_PROVIDED)) diff --git a/sc2/src/sc2code/comm/druuge/druugec.c b/sc2/src/sc2code/comm/druuge/druugec.c index ed10a8a95..79b4bcffe 100644 --- a/sc2/src/sc2code/comm/druuge/druugec.c +++ b/sc2/src/sc2code/comm/druuge/druugec.c @@ -27,6 +27,7 @@ static LOCDATA druuge_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)DRUUGE_PMAP_ANIM, /* AlienFrame */ (FONT)DRUUGE_FONT, /* AlienFont */ @@ -876,6 +877,12 @@ ExitIntro: static COUNT uninit_druuge (void) +{ + return (0); +} + +static void +post_druuge_enc (void) { if (GET_GAME_STATE (BATTLE_SEGUE) == 1 && !GET_GAME_STATE (DRUUGE_MANNER)) @@ -886,8 +893,6 @@ uninit_druuge (void) SET_GAME_STATE (DRUUGE_VISITS, 0); } } - - return (0); } LOCDATAPTR @@ -896,6 +901,7 @@ init_druuge_comm (void) LOCDATAPTR retval; druuge_desc.init_encounter_func = Intro; + druuge_desc.post_encounter_func = post_druuge_enc; druuge_desc.uninit_encounter_func = uninit_druuge; druuge_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/ilwrath/ilwrathc.c b/sc2/src/sc2code/comm/ilwrath/ilwrathc.c index 8076a9d11..0b00b3aad 100644 --- a/sc2/src/sc2code/comm/ilwrath/ilwrathc.c +++ b/sc2/src/sc2code/comm/ilwrath/ilwrathc.c @@ -26,6 +26,7 @@ static LOCDATA ilwrath_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)ILWRATH_PMAP_ANIM, /* AlienFrame */ (FONT)ILWRATH_FONT, /* AlienFont */ @@ -601,12 +602,19 @@ uninit_ilwrath (void) return (0); } +static void +post_ilwrath_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_ilwrath_comm (void) { LOCDATAPTR retval; ilwrath_desc.init_encounter_func = Intro; + ilwrath_desc.post_encounter_func = post_ilwrath_enc; ilwrath_desc.uninit_encounter_func = uninit_ilwrath; ilwrath_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/melnorm/melnorm.c b/sc2/src/sc2code/comm/melnorm/melnorm.c index 780d8cd8b..af9f393ce 100644 --- a/sc2/src/sc2code/comm/melnorm/melnorm.c +++ b/sc2/src/sc2code/comm/melnorm/melnorm.c @@ -42,6 +42,7 @@ static NUMBER_SPEECH_DESC melnorme_numbers_english; static LOCDATA melnorme_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)MELNORME_PMAP_ANIM, /* AlienFrame */ (FONT)MELNORME_FONT, /* AlienFont */ @@ -1839,12 +1840,16 @@ Intro (void) static COUNT uninit_melnorme (void) +{ + return (0); +} + +static void +post_melnorme_enc (void) { LockMutex (GraphicsLock); DrawStatusMessage (0); UnlockMutex (GraphicsLock); - - return (0); } LOCDATAPTR @@ -1853,6 +1858,7 @@ init_melnorme_comm (void) LOCDATAPTR retval; melnorme_desc.init_encounter_func = Intro; + melnorme_desc.post_encounter_func = post_melnorme_enc; melnorme_desc.uninit_encounter_func = uninit_melnorme; melnorme_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/mycon/myconc.c b/sc2/src/sc2code/comm/mycon/myconc.c index aa0ffa668..3f977197f 100644 --- a/sc2/src/sc2code/comm/mycon/myconc.c +++ b/sc2/src/sc2code/comm/mycon/myconc.c @@ -27,6 +27,7 @@ static LOCDATA mycon_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)MYCON_PMAP_ANIM, /* AlienFrame */ (FONT)MYCON_FONT, /* AlienFont */ @@ -599,12 +600,19 @@ uninit_mycon (void) return (0); } +static void +post_mycon_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_mycon_comm (void) { LOCDATAPTR retval; mycon_desc.init_encounter_func = Intro; + mycon_desc.post_encounter_func = post_mycon_enc; mycon_desc.uninit_encounter_func = uninit_mycon; mycon_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/orz/orzc.c b/sc2/src/sc2code/comm/orz/orzc.c index 58a946c55..c72493329 100644 --- a/sc2/src/sc2code/comm/orz/orzc.c +++ b/sc2/src/sc2code/comm/orz/orzc.c @@ -25,6 +25,7 @@ static LOCDATA orz_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)ORZ_PMAP_ANIM, /* AlienFrame */ (FONT)ORZ_FONT, /* AlienFont */ @@ -847,6 +848,12 @@ ExitIntro: static COUNT uninit_orz (void) +{ + return (0); +} + +static void +post_orz_enc (void) { BYTE Manner; @@ -861,8 +868,6 @@ uninit_orz (void) SET_GAME_STATE (TAALO_VISITS, 0); } } - - return (0); } LOCDATAPTR @@ -871,6 +876,7 @@ init_orz_comm (void) LOCDATAPTR retval; orz_desc.init_encounter_func = Intro; + orz_desc.post_encounter_func = post_orz_enc; orz_desc.uninit_encounter_func = uninit_orz; orz_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/pkunk/pkunkc.c b/sc2/src/sc2code/comm/pkunk/pkunkc.c index 916f104a9..05983859f 100644 --- a/sc2/src/sc2code/comm/pkunk/pkunkc.c +++ b/sc2/src/sc2code/comm/pkunk/pkunkc.c @@ -27,6 +27,7 @@ static LOCDATA pkunk_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)PKUNK_PMAP_ANIM, /* AlienFrame */ (FONT)PKUNK_FONT, /* AlienFont */ @@ -1083,6 +1084,12 @@ ExitIntro: // Called after combat or communications static COUNT uninit_pkunk (void) +{ + return (0); +} + +static void +post_pkunk_enc (void) { BYTE Manner; @@ -1096,8 +1103,6 @@ uninit_pkunk (void) SET_GAME_STATE (PKUNK_HOME_VISITS, 0); } } - - return (0); } LOCDATAPTR @@ -1106,6 +1111,7 @@ init_pkunk_comm (void) LOCDATAPTR retval; pkunk_desc.init_encounter_func = Intro; + pkunk_desc.post_encounter_func = post_pkunk_enc; pkunk_desc.uninit_encounter_func = uninit_pkunk; pkunk_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/rebel/rebel.c b/sc2/src/sc2code/comm/rebel/rebel.c index a509338c8..6f85129de 100644 --- a/sc2/src/sc2code/comm/rebel/rebel.c +++ b/sc2/src/sc2code/comm/rebel/rebel.c @@ -26,6 +26,7 @@ static LOCDATA yehat_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)YEHAT_PMAP_ANIM, /* AlienFrame */ (FONT)YEHAT_FONT, /* AlienFont */ @@ -411,12 +412,19 @@ uninit_yehat (void) return (0); } +static void +post_yehat_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_rebel_yehat_comm (void) { LOCDATAPTR retval; yehat_desc.init_encounter_func = Intro; + yehat_desc.post_encounter_func = post_yehat_enc; yehat_desc.uninit_encounter_func = uninit_yehat; yehat_desc.AlienTextTemplate.baseline.x = SIS_SCREEN_WIDTH * 2 / 3; diff --git a/sc2/src/sc2code/comm/shofixt/shofixt.c b/sc2/src/sc2code/comm/shofixt/shofixt.c index 9adabdc0f..539d73604 100644 --- a/sc2/src/sc2code/comm/shofixt/shofixt.c +++ b/sc2/src/sc2code/comm/shofixt/shofixt.c @@ -26,6 +26,7 @@ static LOCDATA shofixti_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SHOFIXTI_PMAP_ANIM, /* AlienFrame */ (FONT)SHOFIXTI_FONT, /* AlienFont */ @@ -629,12 +630,19 @@ uninit_shofixti (void) return(0); } +static void +post_shofixti_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_shofixti_comm (void) { LOCDATAPTR retval; shofixti_desc.init_encounter_func = Intro; + shofixti_desc.post_encounter_func = post_shofixti_enc; shofixti_desc.uninit_encounter_func = uninit_shofixti; shofixti_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/slyhome/slyhome.c b/sc2/src/sc2code/comm/slyhome/slyhome.c index e1efa9015..25430eb89 100644 --- a/sc2/src/sc2code/comm/slyhome/slyhome.c +++ b/sc2/src/sc2code/comm/slyhome/slyhome.c @@ -25,6 +25,7 @@ static LOCDATA slylandro_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SLYLANDRO_PMAP_ANIM, /* AlienFrame */ (FONT)SLYLANDRO_FONT, /* AlienFont */ @@ -889,12 +890,19 @@ uninit_slylandro (void) return (0); } +static void +post_slylandro_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_slylandro_comm (void) { LOCDATAPTR retval; slylandro_desc.init_encounter_func = Intro; + slylandro_desc.post_encounter_func = post_slylandro_enc; slylandro_desc.uninit_encounter_func = uninit_slylandro; slylandro_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/slyland/slyland.c b/sc2/src/sc2code/comm/slyland/slyland.c index f884b1ec4..cab012ef1 100644 --- a/sc2/src/sc2code/comm/slyland/slyland.c +++ b/sc2/src/sc2code/comm/slyland/slyland.c @@ -27,6 +27,7 @@ static LOCDATA slylandro_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SLYLAND_PMAP_ANIM, /* AlienFrame */ (FONT)SLYLAND_FONT, /* AlienFont */ @@ -374,12 +375,19 @@ uninit_slyland (void) return (0); } +static void +post_slyland_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_slyland_comm (void) { LOCDATAPTR retval; slylandro_desc.init_encounter_func = Intro; + slylandro_desc.post_encounter_func = post_slyland_enc; slylandro_desc.uninit_encounter_func = uninit_slyland; slylandro_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/spahome/spahome.c b/sc2/src/sc2code/comm/spahome/spahome.c index 17863902c..f267955fc 100644 --- a/sc2/src/sc2code/comm/spahome/spahome.c +++ b/sc2/src/sc2code/comm/spahome/spahome.c @@ -27,6 +27,7 @@ static LOCDATA spahome_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SPATHI_HOME_PMAP_ANIM, /* AlienFrame */ (FONT)SPATHI_FONT, /* AlienFont */ @@ -958,6 +959,12 @@ Intro (void) static COUNT uninit_spahome (void) +{ + return (0); +} + +static void +post_spahome_enc (void) { BYTE Manner; @@ -971,8 +978,6 @@ uninit_spahome (void) SET_GAME_STATE (SPATHI_HOME_VISITS, 0); } } - - return (0); } LOCDATAPTR @@ -981,6 +986,7 @@ init_spahome_comm () LOCDATAPTR retval; spahome_desc.init_encounter_func = Intro; + spahome_desc.post_encounter_func = post_spahome_enc; spahome_desc.uninit_encounter_func = uninit_spahome; spahome_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/spathi/spathic.c b/sc2/src/sc2code/comm/spathi/spathic.c index 857c7bbbc..13f5307aa 100644 --- a/sc2/src/sc2code/comm/spathi/spathic.c +++ b/sc2/src/sc2code/comm/spathi/spathic.c @@ -26,6 +26,7 @@ static LOCDATA spathi_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SPATHI_PMAP_ANIM, /* AlienFrame */ (FONT)SPATHI_FONT, /* AlienFont */ @@ -754,6 +755,12 @@ Intro (void) static COUNT uninit_spathi (void) +{ + return (0); +} + +static void +post_spathi_enc (void) { BYTE Manner; @@ -775,8 +782,6 @@ uninit_spathi (void) } } } - - return (0); } LOCDATAPTR @@ -785,6 +790,7 @@ init_spathi_comm (void) LOCDATAPTR retval; spathi_desc.init_encounter_func = Intro; + spathi_desc.post_encounter_func = post_spathi_enc; spathi_desc.uninit_encounter_func = uninit_spathi; spathi_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/starbas/starbas.c b/sc2/src/sc2code/comm/starbas/starbas.c index 80239242c..51d78a3a4 100644 --- a/sc2/src/sc2code/comm/starbas/starbas.c +++ b/sc2/src/sc2code/comm/starbas/starbas.c @@ -43,6 +43,7 @@ static void SellMinerals (RESPONSE_REF R); static LOCDATA commander_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)COMMANDER_PMAP_ANIM, /* AlienFrame */ (FONT)COMMANDER_FONT, /* AlienFont */ @@ -1925,14 +1926,18 @@ Intro (void) static COUNT uninit_starbase (void) +{ + return (0); +} + +static void +post_starbase_enc (void) { SET_GAME_STATE (MOONBASE_ON_SHIP, 0); if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2) { SET_GAME_STATE (CHMMR_BOMB_STATE, 3); } - - return (0); } LOCDATAPTR @@ -1941,6 +1946,7 @@ init_starbase_comm () LOCDATAPTR retval; commander_desc.init_encounter_func = Intro; + commander_desc.post_encounter_func = post_starbase_enc; commander_desc.uninit_encounter_func = uninit_starbase; commander_desc.AlienTextWidth = 143; diff --git a/sc2/src/sc2code/comm/supox/supoxc.c b/sc2/src/sc2code/comm/supox/supoxc.c index ff4f81104..e79d9db49 100644 --- a/sc2/src/sc2code/comm/supox/supoxc.c +++ b/sc2/src/sc2code/comm/supox/supoxc.c @@ -26,6 +26,7 @@ static LOCDATA supox_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SUPOX_PMAP_ANIM, /* AlienFrame */ (FONT)SUPOX_FONT, /* AlienFont */ @@ -670,12 +671,19 @@ uninit_supox (void) return (0); } +static void +post_supox_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_supox_comm (void) { LOCDATAPTR retval; supox_desc.init_encounter_func = Intro; + supox_desc.post_encounter_func = post_supox_enc; supox_desc.uninit_encounter_func = uninit_supox; supox_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/syreen/syreenc.c b/sc2/src/sc2code/comm/syreen/syreenc.c index 6dfeea16c..4a8ed2ee3 100644 --- a/sc2/src/sc2code/comm/syreen/syreenc.c +++ b/sc2/src/sc2code/comm/syreen/syreenc.c @@ -26,6 +26,7 @@ static LOCDATA syreen_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)SYREEN_PMAP_ANIM, /* AlienFrame */ (FONT)SYREEN_FONT, /* AlienFont */ @@ -835,12 +836,19 @@ uninit_syreen (void) return (0); } +static void +post_syreen_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_syreen_comm (void) { LOCDATAPTR retval; syreen_desc.init_encounter_func = Intro; + syreen_desc.post_encounter_func = post_syreen_enc; syreen_desc.uninit_encounter_func = uninit_syreen; syreen_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/talkpet/talkpet.c b/sc2/src/sc2code/comm/talkpet/talkpet.c index c59e6583b..b3dce1da3 100644 --- a/sc2/src/sc2code/comm/talkpet/talkpet.c +++ b/sc2/src/sc2code/comm/talkpet/talkpet.c @@ -26,6 +26,7 @@ static LOCDATA talkpet_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)TALKING_PET_PMAP_ANIM, /* AlienFrame */ (FONT)TALKING_PET_FONT, /* AlienFont */ @@ -790,12 +791,19 @@ uninit_talkpet (void) return (0); } +static void +post_talkpet_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_talkpet_comm (void) { LOCDATAPTR retval; talkpet_desc.init_encounter_func = Intro; + talkpet_desc.post_encounter_func = post_talkpet_enc; talkpet_desc.uninit_encounter_func = uninit_talkpet; talkpet_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/thradd/thraddc.c b/sc2/src/sc2code/comm/thradd/thraddc.c index 8a7563270..425849a4f 100644 --- a/sc2/src/sc2code/comm/thradd/thraddc.c +++ b/sc2/src/sc2code/comm/thradd/thraddc.c @@ -27,6 +27,7 @@ static LOCDATA thradd_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)THRADD_PMAP_ANIM, /* AlienFrame */ (FONT)THRADD_FONT, /* AlienFont */ @@ -911,12 +912,19 @@ uninit_thradd (void) return (0); } +static void +post_thradd_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_thradd_comm (void) { LOCDATAPTR retval; thradd_desc.init_encounter_func = Intro; + thradd_desc.post_encounter_func = post_thradd_enc; thradd_desc.uninit_encounter_func = uninit_thradd; thradd_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/umgah/umgahc.c b/sc2/src/sc2code/comm/umgah/umgahc.c index 4720ea5a0..62b22c04e 100644 --- a/sc2/src/sc2code/comm/umgah/umgahc.c +++ b/sc2/src/sc2code/comm/umgah/umgahc.c @@ -26,6 +26,7 @@ static LOCDATA umgah_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)UMGAH_PMAP_ANIM, /* AlienFrame */ (FONT)UMGAH_FONT, /* AlienFont */ @@ -681,13 +682,17 @@ Intro (void) static COUNT uninit_umgah (void) +{ + return (0); +} + +static void +post_umgah_enc (void) { if (!GET_GAME_STATE (UMGAH_ZOMBIE_BLOBBIES)) { SET_GAME_STATE (MET_NORMAL_UMGAH, 1); } - - return (0); } LOCDATAPTR @@ -696,6 +701,7 @@ init_umgah_comm (void) LOCDATAPTR retval; umgah_desc.init_encounter_func = Intro; + umgah_desc.post_encounter_func = post_umgah_enc; umgah_desc.uninit_encounter_func = uninit_umgah; umgah_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/urquan/urquanc.c b/sc2/src/sc2code/comm/urquan/urquanc.c index a139bc12f..04999a6d5 100644 --- a/sc2/src/sc2code/comm/urquan/urquanc.c +++ b/sc2/src/sc2code/comm/urquan/urquanc.c @@ -23,6 +23,7 @@ static LOCDATA urquan_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)URQUAN_PMAP_ANIM, /* AlienFrame */ (FONT)URQUAN_FONT, /* AlienFont */ @@ -521,11 +522,15 @@ ExitIntro: static COUNT uninit_urquan (void) { - SET_GAME_STATE (PLAYER_HYPNOTIZED, 0); - return (0); } +static void +post_urquan_enc (void) +{ + SET_GAME_STATE (PLAYER_HYPNOTIZED, 0); +} + LOCDATAPTR init_urquan_comm (void) { @@ -534,6 +539,7 @@ init_urquan_comm (void) BYTE b0, b1, b2, b3; urquan_desc.init_encounter_func = Intro; + urquan_desc.post_encounter_func = post_urquan_enc; urquan_desc.uninit_encounter_func = uninit_urquan; urquan_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/utwig/utwigc.c b/sc2/src/sc2code/comm/utwig/utwigc.c index 7b6493938..f16930bc2 100644 --- a/sc2/src/sc2code/comm/utwig/utwigc.c +++ b/sc2/src/sc2code/comm/utwig/utwigc.c @@ -27,6 +27,7 @@ static LOCDATA utwig_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)UTWIG_PMAP_ANIM, /* AlienFrame */ (FONT)UTWIG_FONT, /* AlienFont */ @@ -939,12 +940,19 @@ uninit_utwig (void) return (0); } +static void +post_utwig_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_utwig_comm (void) { LOCDATAPTR retval; utwig_desc.init_encounter_func = Intro; + utwig_desc.post_encounter_func = post_utwig_enc; utwig_desc.uninit_encounter_func = uninit_utwig; utwig_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/vux/vuxc.c b/sc2/src/sc2code/comm/vux/vuxc.c index 5fecfdb7b..a9d053795 100644 --- a/sc2/src/sc2code/comm/vux/vuxc.c +++ b/sc2/src/sc2code/comm/vux/vuxc.c @@ -23,6 +23,7 @@ static LOCDATA vux_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)VUX_PMAP_ANIM, /* AlienFrame */ (FONT)VUX_FONT, /* AlienFont */ @@ -754,12 +755,19 @@ uninit_vux (void) return (0); } +static void +post_vux_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_vux_comm (void) { LOCDATAPTR retval; vux_desc.init_encounter_func = Intro; + vux_desc.post_encounter_func = post_vux_enc; vux_desc.uninit_encounter_func = uninit_vux; vux_desc.AlienTextTemplate.baseline.x = diff --git a/sc2/src/sc2code/comm/yehat/yehatc.c b/sc2/src/sc2code/comm/yehat/yehatc.c index c71e7cba0..eaf9536be 100644 --- a/sc2/src/sc2code/comm/yehat/yehatc.c +++ b/sc2/src/sc2code/comm/yehat/yehatc.c @@ -28,6 +28,7 @@ static LOCDATA yehat_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)YEHAT_PMAP_ANIM, /* AlienFrame */ (FONT)YEHAT_FONT, /* AlienFont */ @@ -649,12 +650,19 @@ uninit_yehat (void) return (0); } +static void +post_yehat_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_yehat_comm (void) { LOCDATAPTR retval; yehat_desc.init_encounter_func = Intro; + yehat_desc.post_encounter_func = post_yehat_enc; yehat_desc.uninit_encounter_func = uninit_yehat; yehat_desc.AlienTextTemplate.baseline.x = SIS_SCREEN_WIDTH * 2 / 3; diff --git a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c index 056a435ad..97f0f7631 100644 --- a/sc2/src/sc2code/comm/zoqfot/zoqfotc.c +++ b/sc2/src/sc2code/comm/zoqfot/zoqfotc.c @@ -43,6 +43,7 @@ static LOCDATA zoqfot_desc = { NULL_PTR, /* init_encounter_func */ + NULL_PTR, /* post_encounter_func */ NULL_PTR, /* uninit_encounter_func */ (FRAME)ZOQFOTPIK_PMAP_ANIM, /* AlienFrame */ (FONT)ZOQFOTPIK_FONT, /* AlienFont */ @@ -925,12 +926,19 @@ uninit_zoqfot (void) return (0); } +static void +post_zoqfot_enc (void) +{ + // nothing defined so far +} + LOCDATAPTR init_zoqfot_comm (void) { LOCDATAPTR retval; zoqfot_desc.init_encounter_func = Intro; + zoqfot_desc.post_encounter_func = post_zoqfot_enc; zoqfot_desc.uninit_encounter_func = uninit_zoqfot; zoqfot_desc.AlienTextTemplate.align = ALIGN_CENTER; diff --git a/sc2/src/sc2code/globdata.h b/sc2/src/sc2code/globdata.h index 7261dc5cb..2c6938446 100644 --- a/sc2/src/sc2code/globdata.h +++ b/sc2/src/sc2code/globdata.h @@ -115,8 +115,10 @@ typedef struct { void (*init_encounter_func) (void); /* Called when entering communications */ + void (*post_encounter_func) (void); + /* Called when leaving communications or combat normally */ COUNT (*uninit_encounter_func) (void); - /* Called when leaving communications or combat */ + /* Called when encounter is done for cleanup */ FRAME AlienFrame; FONT AlienFont;