summaryrefslogtreecommitdiff
path: root/src/uqm/comm
diff options
context:
space:
mode:
Diffstat (limited to 'src/uqm/comm')
-rw-r--r--src/uqm/comm/Makeinfo4
-rw-r--r--src/uqm/comm/arilou/Makeinfo2
-rw-r--r--src/uqm/comm/arilou/arilouc.c855
-rw-r--r--src/uqm/comm/arilou/resinst.h9
-rw-r--r--src/uqm/comm/arilou/strings.h123
-rw-r--r--src/uqm/comm/blackur/Makeinfo2
-rw-r--r--src/uqm/comm/blackur/blackurc.c567
-rw-r--r--src/uqm/comm/blackur/resinst.h9
-rw-r--r--src/uqm/comm/blackur/strings.h103
-rw-r--r--src/uqm/comm/chmmr/Makeinfo2
-rw-r--r--src/uqm/comm/chmmr/chmmrc.c641
-rw-r--r--src/uqm/comm/chmmr/resinst.h9
-rw-r--r--src/uqm/comm/chmmr/strings.h105
-rw-r--r--src/uqm/comm/comandr/Makeinfo2
-rw-r--r--src/uqm/comm/comandr/comandr.c694
-rw-r--r--src/uqm/comm/comandr/resinst.h12
-rw-r--r--src/uqm/comm/comandr/strings.h127
-rw-r--r--src/uqm/comm/commall.h26
-rw-r--r--src/uqm/comm/druuge/Makeinfo2
-rw-r--r--src/uqm/comm/druuge/druugec.c926
-rw-r--r--src/uqm/comm/druuge/resinst.h9
-rw-r--r--src/uqm/comm/druuge/strings.h132
-rw-r--r--src/uqm/comm/ilwrath/Makeinfo2
-rw-r--r--src/uqm/comm/ilwrath/ilwrathc.c649
-rw-r--r--src/uqm/comm/ilwrath/resinst.h9
-rw-r--r--src/uqm/comm/ilwrath/strings.h135
-rw-r--r--src/uqm/comm/melnorm/Makeinfo2
-rw-r--r--src/uqm/comm/melnorm/melnorm.c1855
-rw-r--r--src/uqm/comm/melnorm/resinst.h9
-rw-r--r--src/uqm/comm/melnorm/strings.h309
-rw-r--r--src/uqm/comm/mycon/Makeinfo2
-rw-r--r--src/uqm/comm/mycon/myconc.c643
-rw-r--r--src/uqm/comm/mycon/resinst.h9
-rw-r--r--src/uqm/comm/mycon/strings.h136
-rw-r--r--src/uqm/comm/orz/Makeinfo2
-rw-r--r--src/uqm/comm/orz/orzc.c898
-rw-r--r--src/uqm/comm/orz/resinst.h9
-rw-r--r--src/uqm/comm/orz/strings.h143
-rw-r--r--src/uqm/comm/pkunk/Makeinfo2
-rw-r--r--src/uqm/comm/pkunk/pkunkc.c1148
-rw-r--r--src/uqm/comm/pkunk/resinst.h9
-rw-r--r--src/uqm/comm/pkunk/strings.h214
-rw-r--r--src/uqm/comm/rebel/Makeinfo2
-rw-r--r--src/uqm/comm/rebel/rebel.c449
-rw-r--r--src/uqm/comm/rebel/strings.h61
-rw-r--r--src/uqm/comm/shofixt/Makeinfo2
-rw-r--r--src/uqm/comm/shofixt/resinst.h9
-rw-r--r--src/uqm/comm/shofixt/shofixt.c652
-rw-r--r--src/uqm/comm/shofixt/strings.h122
-rw-r--r--src/uqm/comm/slyhome/Makeinfo2
-rw-r--r--src/uqm/comm/slyhome/resinst.h9
-rw-r--r--src/uqm/comm/slyhome/slyhome.c921
-rw-r--r--src/uqm/comm/slyhome/strings.h143
-rw-r--r--src/uqm/comm/slyland/Makeinfo2
-rw-r--r--src/uqm/comm/slyland/resinst.h9
-rw-r--r--src/uqm/comm/slyland/slyland.c518
-rw-r--r--src/uqm/comm/slyland/strings.h113
-rw-r--r--src/uqm/comm/spahome/Makeinfo2
-rw-r--r--src/uqm/comm/spahome/spahome.c1018
-rw-r--r--src/uqm/comm/spahome/strings.h174
-rw-r--r--src/uqm/comm/spathi/Makeinfo2
-rw-r--r--src/uqm/comm/spathi/resinst.h14
-rw-r--r--src/uqm/comm/spathi/spathic.c834
-rw-r--r--src/uqm/comm/spathi/strings.h160
-rw-r--r--src/uqm/comm/starbas/Makeinfo2
-rw-r--r--src/uqm/comm/starbas/starbas.c1961
-rw-r--r--src/uqm/comm/starbas/strings.h327
-rw-r--r--src/uqm/comm/supox/Makeinfo2
-rw-r--r--src/uqm/comm/supox/resinst.h9
-rw-r--r--src/uqm/comm/supox/strings.h124
-rw-r--r--src/uqm/comm/supox/supoxc.c708
-rw-r--r--src/uqm/comm/syreen/Makeinfo2
-rw-r--r--src/uqm/comm/syreen/resinst.h9
-rw-r--r--src/uqm/comm/syreen/strings.h158
-rw-r--r--src/uqm/comm/syreen/syreenc.c878
-rw-r--r--src/uqm/comm/talkpet/Makeinfo2
-rw-r--r--src/uqm/comm/talkpet/resinst.h9
-rw-r--r--src/uqm/comm/talkpet/strings.h140
-rw-r--r--src/uqm/comm/talkpet/talkpet.c841
-rw-r--r--src/uqm/comm/thradd/Makeinfo2
-rw-r--r--src/uqm/comm/thradd/resinst.h9
-rw-r--r--src/uqm/comm/thradd/strings.h181
-rw-r--r--src/uqm/comm/thradd/thraddc.c954
-rw-r--r--src/uqm/comm/umgah/Makeinfo2
-rw-r--r--src/uqm/comm/umgah/resinst.h9
-rw-r--r--src/uqm/comm/umgah/strings.h114
-rw-r--r--src/uqm/comm/umgah/umgahc.c729
-rw-r--r--src/uqm/comm/urquan/Makeinfo2
-rw-r--r--src/uqm/comm/urquan/resinst.h9
-rw-r--r--src/uqm/comm/urquan/strings.h101
-rw-r--r--src/uqm/comm/urquan/urquanc.c555
-rw-r--r--src/uqm/comm/utwig/Makeinfo2
-rw-r--r--src/uqm/comm/utwig/resinst.h10
-rw-r--r--src/uqm/comm/utwig/strings.h144
-rw-r--r--src/uqm/comm/utwig/utwigc.c996
-rw-r--r--src/uqm/comm/vux/Makeinfo2
-rw-r--r--src/uqm/comm/vux/resinst.h9
-rw-r--r--src/uqm/comm/vux/strings.h129
-rw-r--r--src/uqm/comm/vux/vuxc.c796
-rw-r--r--src/uqm/comm/yehat/Makeinfo2
-rw-r--r--src/uqm/comm/yehat/resinst.h11
-rw-r--r--src/uqm/comm/yehat/strings.h102
-rw-r--r--src/uqm/comm/yehat/yehatc.c685
-rw-r--r--src/uqm/comm/zoqfot/Makeinfo2
-rw-r--r--src/uqm/comm/zoqfot/resinst.h9
-rw-r--r--src/uqm/comm/zoqfot/strings.h365
-rw-r--r--src/uqm/comm/zoqfot/zoqfotc.c975
107 files changed, 27842 insertions, 0 deletions
diff --git a/src/uqm/comm/Makeinfo b/src/uqm/comm/Makeinfo
new file mode 100644
index 0000000..3f87e5b
--- /dev/null
+++ b/src/uqm/comm/Makeinfo
@@ -0,0 +1,4 @@
+uqm_SUBDIRS="arilou blackur chmmr comandr druuge ilwrath melnorm mycon
+ orz pkunk rebel shofixt slyhome slyland spahome spathi starbas supox
+ syreen talkpet thradd umgah urquan utwig vux yehat zoqfot"
+uqm_HFILES="commall.h"
diff --git a/src/uqm/comm/arilou/Makeinfo b/src/uqm/comm/arilou/Makeinfo
new file mode 100644
index 0000000..27cb053
--- /dev/null
+++ b/src/uqm/comm/arilou/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="arilouc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/arilou/arilouc.c b/src/uqm/comm/arilou/arilouc.c
new file mode 100644
index 0000000..13f2d72
--- /dev/null
+++ b/src/uqm/comm/arilou/arilouc.c
@@ -0,0 +1,855 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/gameev.h"
+
+
+static LOCDATA arilou_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ ARILOU_PMAP_ANIM, /* AlienFrame */
+ ARILOU_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ ARILOU_COLOR_MAP, /* AlienColorMap */
+ ARILOU_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ ARILOU_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 20, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 4, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 1) | (1L << 16)
+ },
+ {
+ 13, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 0) | (1L << 16)
+ },
+ {
+ 22, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1L << 16)
+ },
+ {
+ 31, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4)
+ },
+ {
+ 40, /* StartIndex */
+ 10, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 3)
+ },
+ {
+ 50, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 7)
+ },
+ {
+ 59, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 67, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5)
+ },
+ {
+ 76, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 9)
+ },
+ {
+ 85, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 8)
+ },
+ {
+ 94, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 103, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 13)
+ },
+ {
+ 112, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 121, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 11)
+ },
+ {
+ 129, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1L << 15)
+ },
+ {
+ 138, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 14)
+ },
+ {
+ 146, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 0) | (1 << 1) | (1 << 2)
+ },
+ { /* Hands moving (right up) */
+ 155, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 19), /* BlockMask */
+ },
+ { /* Hands moving (left up) */
+ 157, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 19), /* BlockMask */
+ },
+ { /* Stars flashing next to the head */
+ 159, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 17) | (1 << 18), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye_angry_space))
+ NPCPhrase (GOODBYE_ANGRY_SPACE);
+ else if (PLAYER_SAID (R, bye_friendly_space))
+ NPCPhrase (GOODBYE_FRIENDLY_SPACE);
+ else if (PLAYER_SAID (R, bye_friendly_homeworld))
+ NPCPhrase (GOODBYE_FRDLY_HOMEWORLD);
+ else if (PLAYER_SAID (R, lets_fight))
+ NPCPhrase (NO_FIGHT);
+ else if (PLAYER_SAID (R, bug_eyed_fruitcakes))
+ {
+ NPCPhrase (WE_NEVER_FRIENDS);
+
+ SET_GAME_STATE (ARILOU_MANNER, 2);
+ }
+ else if (PLAYER_SAID (R, best_if_i_killed_you))
+ {
+ NPCPhrase (WICKED_HUMAN);
+
+ SET_GAME_STATE (ARILOU_MANNER, 2);
+ }
+}
+
+static void
+ArilouHome (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[4];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = pStr[3] = 0;
+ if (PLAYER_SAID (R, confused_by_hello))
+ NPCPhrase (CONFUSED_RESPONSE);
+ else if (PLAYER_SAID (R, happy_by_hello))
+ NPCPhrase (HAPPY_RESPONSE);
+ else if (PLAYER_SAID (R, miffed_by_hello))
+ NPCPhrase (MIFFED_RESPONSE);
+ else if (PLAYER_SAID (R, ok_lets_be_friends))
+ NPCPhrase (NO_ALLY_BUT_MUCH_GIVE);
+ else if (PLAYER_SAID (R, what_about_war))
+ {
+ NPCPhrase (ABOUT_WAR);
+
+ SET_GAME_STATE (ARILOU_STACK_1, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_urquan))
+ {
+ NPCPhrase (ABOUT_URQUAN);
+
+ SET_GAME_STATE (ARILOU_STACK_1, 2);
+ }
+ else if (PLAYER_SAID (R, tell_arilou_about_tpet))
+ {
+ NPCPhrase (BAD_NEWS_ABOUT_TPET);
+
+ LastStack = 1;
+ SET_GAME_STATE (ARILOU_STACK_2, 1);
+ }
+ else if (PLAYER_SAID (R, what_do_about_tpet))
+ {
+ NPCPhrase (DANGEROUS_BUT_USEFUL);
+
+ LastStack = 1;
+ SET_GAME_STATE (ARILOU_STACK_2, 2);
+ }
+ else if (PLAYER_SAID (R, learned_about_umgah))
+ {
+ if (GET_GAME_STATE (ARILOU_CHECKED_UMGAH) != 2)
+ NPCPhrase (NO_NEWS_YET);
+ else
+ {
+ NPCPhrase (UMGAH_UNDER_COMPULSION);
+
+ LastStack = 1;
+ }
+
+ DISABLE_PHRASE (learned_about_umgah);
+ }
+ else if (PLAYER_SAID (R, umgah_acting_weird))
+ {
+ NPCPhrase (WELL_GO_CHECK);
+
+ SET_GAME_STATE (ARILOU_CHECKED_UMGAH, 1);
+ AddEvent (RELATIVE_EVENT, 0, 10, 0, ARILOU_UMGAH_CHECK);
+ DISABLE_PHRASE (umgah_acting_weird);
+ }
+ else if (PLAYER_SAID (R, what_do_now))
+ {
+ NPCPhrase (GO_FIND_OUT);
+
+ SET_GAME_STATE (ARILOU_CHECKED_UMGAH, 3);
+ }
+ else if (PLAYER_SAID (R, what_did_on_earth))
+ {
+ NPCPhrase (DID_THIS);
+
+ LastStack = 2;
+ SET_GAME_STATE (ARILOU_STACK_3, 1);
+ }
+ else if (PLAYER_SAID (R, why_did_this))
+ {
+ NPCPhrase (IDF_PARASITES);
+
+ LastStack = 2;
+ SET_GAME_STATE (ARILOU_STACK_3, 2);
+ }
+ else if (PLAYER_SAID (R, tell_more))
+ {
+ NPCPhrase (NOT_NOW);
+
+ LastStack = 2;
+ SET_GAME_STATE (ARILOU_STACK_3, 3);
+ }
+ else if (PLAYER_SAID (R, what_give_me))
+ {
+ NPCPhrase (ABOUT_PORTAL);
+
+ LastStack = 3;
+ SET_GAME_STATE (KNOW_ARILOU_WANT_WRECK, 1);
+
+ R = about_portal_again;
+ DISABLE_PHRASE (what_give_me);
+ }
+ else if (PLAYER_SAID (R, what_about_tpet))
+ {
+ NPCPhrase (ABOUT_TPET);
+
+ SET_GAME_STATE (ARILOU_STACK_4, 1);
+ }
+ else if (PLAYER_SAID (R, about_portal_again))
+ {
+ NPCPhrase (PORTAL_AGAIN);
+
+ DISABLE_PHRASE (about_portal_again);
+ }
+ else if (PLAYER_SAID (R, got_it))
+ {
+ if (GET_GAME_STATE (ARILOU_HOME_VISITS) == 1)
+ NPCPhrase (CLEVER_HUMAN);
+ NPCPhrase (GIVE_PORTAL);
+
+ SET_GAME_STATE (PORTAL_KEY_ON_SHIP, 0);
+ SET_GAME_STATE (PORTAL_SPAWNER, 1);
+ SET_GAME_STATE (PORTAL_SPAWNER_ON_SHIP, 1);
+ }
+#ifdef NEVER
+ else if (PLAYER_SAID (R, got_tpet))
+ {
+ NPCPhrase (OK_GOT_TPET);
+
+ SET_GAME_STATE (ARILOU_STACK_2, 1);
+ }
+#endif /* NEVER */
+
+ switch (GET_GAME_STATE (ARILOU_STACK_1))
+ {
+ case 0:
+ pStr[0] = what_about_war;
+ break;
+ case 1:
+ pStr[0] = what_about_urquan;
+ break;
+ }
+ if (GET_GAME_STATE (TALKING_PET))
+ {
+#ifdef NEVER
+ if (GET_GAME_STATE (ARILOU_STACK_2) == 0)
+ pStr[1] = got_tpet;
+#endif /* NEVER */
+ }
+ else
+ {
+ if (GET_GAME_STATE (TALKING_PET_VISITS))
+ {
+ switch (GET_GAME_STATE (ARILOU_STACK_2))
+ {
+ case 0:
+ pStr[1] = tell_arilou_about_tpet;
+ break;
+ case 1:
+ pStr[1] = what_do_about_tpet;
+ break;
+ }
+ }
+ else if (GET_GAME_STATE (KNOW_UMGAH_ZOMBIES))
+ {
+ if (!GET_GAME_STATE (ARILOU_CHECKED_UMGAH))
+ pStr[1] = umgah_acting_weird;
+ else if (PHRASE_ENABLED (learned_about_umgah) && PHRASE_ENABLED (umgah_acting_weird))
+ pStr[1] = learned_about_umgah;
+ else if (GET_GAME_STATE (ARILOU_CHECKED_UMGAH) == 2)
+ pStr[1] = what_do_now;
+ }
+ }
+ switch (GET_GAME_STATE (ARILOU_STACK_3))
+ {
+ case 0:
+ pStr[2] = what_did_on_earth;
+ break;
+ case 1:
+ pStr[2] = why_did_this;
+ break;
+ case 2:
+ pStr[2] = tell_more;
+ break;
+ }
+ if (!GET_GAME_STATE (KNOW_ARILOU_WANT_WRECK))
+ pStr[3] = what_give_me;
+ else if (!GET_GAME_STATE (ARILOU_STACK_4))
+ pStr[3] = what_about_tpet;
+
+ if (pStr[LastStack])
+ Response (pStr[LastStack], ArilouHome);
+ for (i = 0; i < 4; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ Response (pStr[i], ArilouHome);
+ }
+
+ if (GET_GAME_STATE (KNOW_ARILOU_WANT_WRECK))
+ {
+ if (GET_GAME_STATE (PORTAL_KEY_ON_SHIP))
+ Response (got_it, ArilouHome);
+ else if (PHRASE_ENABLED (about_portal_again) && !GET_GAME_STATE (PORTAL_SPAWNER))
+ Response (about_portal_again, ArilouHome);
+ }
+ if (GET_GAME_STATE (ARILOU_MANNER) != 3)
+ Response (best_if_i_killed_you, ExitConversation);
+ Response (bye_friendly_homeworld, ExitConversation);
+}
+
+static void
+AngryHomeArilou (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, invaders_from_mars))
+ {
+ NPCPhrase (HAD_OUR_REASONS);
+
+ DISABLE_PHRASE (invaders_from_mars);
+ }
+ else if (PLAYER_SAID (R, why_should_i_trust))
+ {
+ NPCPhrase (TRUST_BECAUSE);
+
+ DISABLE_PHRASE (why_should_i_trust);
+ }
+ else if (PLAYER_SAID (R, what_about_interference))
+ {
+ NPCPhrase (INTERFERENCE_NECESSARY);
+
+ DISABLE_PHRASE (what_about_interference);
+ }
+ else if (PLAYER_SAID (R, i_just_like_to_leave))
+ {
+ NPCPhrase (SORRY_NO_LEAVE);
+
+ DISABLE_PHRASE (i_just_like_to_leave);
+ }
+
+ if (PHRASE_ENABLED (invaders_from_mars))
+ Response (invaders_from_mars, AngryHomeArilou);
+ else
+ {
+ Response (bug_eyed_fruitcakes, ExitConversation);
+ }
+ if (PHRASE_ENABLED (why_should_i_trust))
+ Response (why_should_i_trust, AngryHomeArilou);
+ else if (PHRASE_ENABLED (what_about_interference))
+ Response (what_about_interference, AngryHomeArilou);
+ Response (ok_lets_be_friends, ArilouHome);
+ Response (i_just_like_to_leave, AngryHomeArilou);
+}
+
+static void
+AngrySpaceArilou (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, im_sorry))
+ {
+ NPCPhrase (APOLOGIZE_AT_HOMEWORLD);
+
+ DISABLE_PHRASE (im_sorry);
+ }
+
+ Response (lets_fight, ExitConversation);
+ if (PHRASE_ENABLED (im_sorry))
+ {
+ Response (im_sorry, AngrySpaceArilou);
+ }
+ Response (bye_angry_space, ExitConversation);
+}
+
+static void
+FriendlySpaceArilou (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, confused_by_hello))
+ NPCPhrase (CONFUSED_RESPONSE);
+ else if (PLAYER_SAID (R, happy_by_hello))
+ NPCPhrase (HAPPY_RESPONSE);
+ else if (PLAYER_SAID (R, miffed_by_hello))
+ NPCPhrase (MIFFED_RESPONSE);
+ else if (PLAYER_SAID (R, whats_up_1)
+ || PLAYER_SAID (R, whats_up_2))
+ {
+ NumVisits = GET_GAME_STATE (ARILOU_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ARILOU_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_2);
+ }
+ else if (PLAYER_SAID (R, why_you_here))
+ {
+ NPCPhrase (LEARN_THINGS);
+
+ SET_GAME_STATE (ARILOU_STACK_5, 1);
+ }
+ else if (PLAYER_SAID (R, what_things))
+ {
+ NPCPhrase (THESE_THINGS);
+
+ SET_GAME_STATE (ARILOU_STACK_5, 2);
+ }
+ else if (PLAYER_SAID (R, why_do_it))
+ {
+ NPCPhrase (DO_IT_BECAUSE);
+
+ SET_GAME_STATE (ARILOU_STACK_5, 3);
+ }
+ else if (PLAYER_SAID (R, give_me_info_1)
+ || PLAYER_SAID (R, give_me_info_2))
+ {
+ NumVisits = GET_GAME_STATE (ARILOU_HINTS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ARILOU_HINTS_1);
+ break;
+ case 1:
+ NPCPhrase (ARILOU_HINTS_2);
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) < 2)
+ {
+ SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 2);
+ }
+ break;
+ case 2:
+ NPCPhrase (ARILOU_HINTS_3);
+ SET_GAME_STATE (KNOW_URQUAN_STORY, 1);
+ SET_GAME_STATE (KNOW_KOHR_AH_STORY, 1);
+ break;
+ case 3:
+ NPCPhrase (ARILOU_HINTS_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ARILOU_HINTS, NumVisits);
+
+ DISABLE_PHRASE (give_me_info_2);
+ }
+
+ switch (GET_GAME_STATE (ARILOU_STACK_5))
+ {
+ case 0:
+ Response (why_you_here, FriendlySpaceArilou);
+ break;
+ case 1:
+ Response (what_things, FriendlySpaceArilou);
+ break;
+ case 2:
+ Response (why_do_it, FriendlySpaceArilou);
+ break;
+ }
+ if (PHRASE_ENABLED (whats_up_2))
+ {
+ if (GET_GAME_STATE (ARILOU_INFO) == 0)
+ Response (whats_up_1, FriendlySpaceArilou);
+ else
+ Response (whats_up_2, FriendlySpaceArilou);
+ }
+ if (PHRASE_ENABLED (give_me_info_2))
+ {
+ if (GET_GAME_STATE (ARILOU_HINTS) == 0)
+ Response (give_me_info_1, FriendlySpaceArilou);
+ else
+ Response (give_me_info_2, FriendlySpaceArilou);
+ }
+ Response (bye_friendly_space, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits, Manner;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+ else if (!GET_GAME_STATE (MET_ARILOU))
+ {
+ RESPONSE_FUNC RespFunc;
+
+ if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
+ {
+ NPCPhrase (INIT_HELLO);
+ RespFunc = (RESPONSE_FUNC)FriendlySpaceArilou;
+ }
+ else
+ {
+ NPCPhrase (FRDLY_HOMEWORLD_HELLO_1);
+ RespFunc = (RESPONSE_FUNC)ArilouHome;
+ SET_GAME_STATE (ARILOU_HOME_VISITS, 1);
+ }
+ Response (confused_by_hello, RespFunc);
+ Response (happy_by_hello, RespFunc);
+ Response (miffed_by_hello, RespFunc);
+ SET_GAME_STATE (MET_ARILOU, 1);
+ return;
+ }
+
+ Manner = GET_GAME_STATE (ARILOU_MANNER);
+ if (Manner == 2)
+ {
+ NumVisits = GET_GAME_STATE (ARILOU_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_GOODBYE_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_GOODBYE_2);
+ break;
+ case 2:
+ NPCPhrase (HOSTILE_GOODBYE_3);
+ break;
+ case 3:
+ NPCPhrase (HOSTILE_GOODBYE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ARILOU_VISITS, NumVisits);
+
+ setSegue (Segue_peace);
+ }
+ else if (Manner == 1)
+ {
+ if (GET_GAME_STATE (ARILOU_SPACE_SIDE) > 1)
+ {
+ NPCPhrase (INIT_ANGRY_HWLD_HELLO);
+ SET_GAME_STATE (ARILOU_HOME_VISITS, 1);
+
+ AngryHomeArilou ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (ARILOU_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ANGRY_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ANGRY_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ARILOU_VISITS, NumVisits);
+
+ AngrySpaceArilou ((RESPONSE_REF)0);
+ }
+ }
+ else
+ {
+ if (GET_GAME_STATE (ARILOU_SPACE_SIDE) <= 1)
+ {
+ NumVisits = GET_GAME_STATE (ARILOU_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ARILOU_VISITS, NumVisits);
+
+ FriendlySpaceArilou ((RESPONSE_REF)0);
+ }
+ else
+ {
+ if (!GET_GAME_STATE (PORTAL_SPAWNER)
+ && GET_GAME_STATE (KNOW_ARILOU_WANT_WRECK))
+ {
+ NumVisits = GET_GAME_STATE (NO_PORTAL_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GOT_PART_YET_1);
+ break;
+ case 1:
+ NPCPhrase (GOT_PART_YET_1);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (NO_PORTAL_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (ARILOU_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FRDLY_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (FRDLY_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (FRDLY_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (FRDLY_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ARILOU_HOME_VISITS, NumVisits);
+ }
+
+ ArilouHome ((RESPONSE_REF)0);
+ }
+ }
+}
+
+static COUNT
+uninit_arilou (void)
+{
+ return (0);
+}
+
+static void
+post_arilou_enc (void)
+{
+ BYTE Manner;
+
+ if (getSegue () == Segue_hostile
+ && (Manner = GET_GAME_STATE (ARILOU_MANNER)) != 2)
+ {
+ SET_GAME_STATE (ARILOU_MANNER, 1);
+ if (Manner != 1)
+ {
+ SET_GAME_STATE (ARILOU_VISITS, 0);
+ SET_GAME_STATE (ARILOU_HOME_VISITS, 0);
+ }
+ }
+
+ if (GET_GAME_STATE (ARILOU_SPACE_SIDE) > 1
+ && GET_GAME_STATE (ARILOU_HOME_VISITS) <= 1)
+ {
+ SET_GAME_STATE (UMGAH_ZOMBIE_BLOBBIES, 1);
+ SET_GAME_STATE (UMGAH_VISITS, 0);
+ SET_GAME_STATE (UMGAH_HOME_VISITS, 0);
+
+ if (GET_GAME_STATE (ARILOU_MANNER) < 2)
+ {
+ SET_GAME_STATE (ARILOU_MANNER, 3);
+ }
+ }
+}
+
+LOCDATA*
+init_arilou_comm (void)
+{
+ LOCDATA *retval;
+
+ arilou_desc.init_encounter_func = Intro;
+ arilou_desc.post_encounter_func = post_arilou_enc;
+ arilou_desc.uninit_encounter_func = uninit_arilou;
+
+ arilou_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ arilou_desc.AlienTextBaseline.y = 0;
+ arilou_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (ARILOU_SPACE_SIDE) > 1
+ || GET_GAME_STATE (ARILOU_MANNER) == 3
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &arilou_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/arilou/resinst.h b/src/uqm/comm/arilou/resinst.h
new file mode 100644
index 0000000..991ea37
--- /dev/null
+++ b/src/uqm/comm/arilou/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define ARILOU_COLOR_MAP "comm.arilou.colortable"
+#define ARILOU_CONVERSATION_PHRASES "comm.arilou.dialogue"
+#define ARILOU_FONT "comm.arilou.font"
+#define ARILOU_MUSIC "comm.arilou.music"
+#define ARILOU_PMAP_ANIM "comm.arilou.graphics"
diff --git a/src/uqm/comm/arilou/strings.h b/src/uqm/comm/arilou/strings.h
new file mode 100644
index 0000000..1f80468
--- /dev/null
+++ b/src/uqm/comm/arilou/strings.h
@@ -0,0 +1,123 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ARILOU_STRINGS_H
+#define ARILOU_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ INIT_HELLO,
+ confused_by_hello,
+ CONFUSED_RESPONSE,
+ happy_by_hello,
+ HAPPY_RESPONSE,
+ miffed_by_hello,
+ MIFFED_RESPONSE,
+ FRIENDLY_SPACE_HELLO_1,
+ FRIENDLY_SPACE_HELLO_2,
+ FRIENDLY_SPACE_HELLO_3,
+ FRIENDLY_SPACE_HELLO_4,
+ FRDLY_HOMEWORLD_HELLO_1,
+ FRDLY_HOMEWORLD_HELLO_2,
+ FRDLY_HOMEWORLD_HELLO_3,
+ FRDLY_HOMEWORLD_HELLO_4,
+ whats_up_1,
+ whats_up_2,
+ GENERAL_INFO_1,
+ GENERAL_INFO_2,
+ GENERAL_INFO_3,
+ GENERAL_INFO_4,
+ why_you_here,
+ LEARN_THINGS,
+ what_things,
+ THESE_THINGS,
+ why_do_it,
+ DO_IT_BECAUSE,
+ give_me_info_1,
+ ARILOU_HINTS_1,
+ give_me_info_2,
+ ARILOU_HINTS_2,
+ ARILOU_HINTS_3,
+ ARILOU_HINTS_4,
+ bye_friendly_space,
+ GOODBYE_FRIENDLY_SPACE,
+ GOT_PART_YET_1,
+ GOT_PART_YET_2,
+ INIT_ANGRY_HWLD_HELLO,
+ invaders_from_mars,
+ HAD_OUR_REASONS,
+ bug_eyed_fruitcakes,
+ WE_NEVER_FRIENDS,
+ ok_lets_be_friends,
+ NO_ALLY_BUT_MUCH_GIVE,
+ why_should_i_trust,
+ TRUST_BECAUSE,
+ what_about_interference,
+ INTERFERENCE_NECESSARY,
+ i_just_like_to_leave,
+ SORRY_NO_LEAVE,
+ what_about_war,
+ ABOUT_WAR,
+ what_about_urquan,
+ ABOUT_URQUAN,
+ best_if_i_killed_you,
+ WICKED_HUMAN,
+ what_did_on_earth,
+ DID_THIS,
+ why_did_this,
+ IDF_PARASITES,
+ tell_more,
+ NOT_NOW,
+ umgah_acting_weird,
+ learned_about_umgah,
+ WELL_GO_CHECK,
+ NO_NEWS_YET,
+ UMGAH_UNDER_COMPULSION,
+ what_do_now,
+ GO_FIND_OUT,
+ tell_arilou_about_tpet,
+ BAD_NEWS_ABOUT_TPET,
+ what_do_about_tpet,
+ DANGEROUS_BUT_USEFUL,
+ what_give_me,
+ ABOUT_PORTAL,
+ what_about_tpet,
+ ABOUT_TPET,
+ about_portal_again,
+ PORTAL_AGAIN,
+ got_it,
+ CLEVER_HUMAN,
+ GIVE_PORTAL,
+ bye_friendly_homeworld,
+ GOODBYE_FRDLY_HOMEWORLD,
+ HOSTILE_GOODBYE_1,
+ HOSTILE_GOODBYE_2,
+ HOSTILE_GOODBYE_3,
+ HOSTILE_GOODBYE_4,
+ ANGRY_SPACE_HELLO_1,
+ ANGRY_SPACE_HELLO_2,
+ lets_fight,
+ NO_FIGHT,
+ im_sorry,
+ APOLOGIZE_AT_HOMEWORLD,
+ bye_angry_space,
+ GOODBYE_ANGRY_SPACE,
+ OUT_TAKES,
+};
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/blackur/Makeinfo b/src/uqm/comm/blackur/Makeinfo
new file mode 100644
index 0000000..1927a56
--- /dev/null
+++ b/src/uqm/comm/blackur/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="blackurc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/blackur/blackurc.c b/src/uqm/comm/blackur/blackurc.c
new file mode 100644
index 0000000..1b47a7b
--- /dev/null
+++ b/src/uqm/comm/blackur/blackurc.c
@@ -0,0 +1,567 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+static LOCDATA blackurq_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ BLACKURQ_PMAP_ANIM, /* AlienFrame */
+ BLACKURQ_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ BLACKURQ_COLOR_MAP, /* AlienColorMap */
+ BLACKURQ_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ BLACKURQ_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 8, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 7, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 23, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 26, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 29, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 33, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 38, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 1, /* StartIndex */
+ 2, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 6, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 2, /* StartIndex */
+ 5, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, bye))
+ {
+ if (GET_GAME_STATE (KOHR_AH_BYES) == 0)
+ NPCPhrase (GOODBYE_AND_DIE);
+ else
+ NPCPhrase (DIE_HUMAN /* GOODBYE_AND_DIE_2 */);
+
+ SET_GAME_STATE (KOHR_AH_BYES, 1);
+ }
+ else if (PLAYER_SAID (R, guess_thats_all))
+ NPCPhrase (THEN_DIE);
+ else if (PLAYER_SAID (R, what_are_you_hovering_over))
+ {
+ NPCPhrase (BONE_PILE);
+
+ SET_GAME_STATE (KOHR_AH_INFO, 1);
+ }
+ else if (PLAYER_SAID (R, you_sure_are_creepy))
+ {
+ NPCPhrase (YES_CREEPY);
+
+ SET_GAME_STATE (KOHR_AH_INFO, 2);
+ }
+ else if (PLAYER_SAID (R, stop_that_gross_blinking))
+ {
+ NPCPhrase (DIE_HUMAN);
+
+ SET_GAME_STATE (KOHR_AH_INFO, 3);
+ }
+ else if (PLAYER_SAID (R, threat_1)
+ || PLAYER_SAID (R, threat_2)
+ || PLAYER_SAID (R, threat_3)
+ || PLAYER_SAID (R, threat_4))
+ {
+ NumVisits = GET_GAME_STATE (KOHR_AH_REASONS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (RESISTANCE_IS_USELESS_1);
+ break;
+ case 1:
+ NPCPhrase (RESISTANCE_IS_USELESS_2);
+ break;
+ case 2:
+ NPCPhrase (RESISTANCE_IS_USELESS_3);
+ break;
+ case 3:
+ NPCPhrase (RESISTANCE_IS_USELESS_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (KOHR_AH_REASONS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, plead_1)
+ || PLAYER_SAID (R, plead_2)
+ || PLAYER_SAID (R, plead_3)
+ || PLAYER_SAID (R, plead_4))
+ {
+ NumVisits = GET_GAME_STATE (KOHR_AH_PLEAD);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (PLEADING_IS_USELESS_1);
+ break;
+ case 1:
+ NPCPhrase (PLEADING_IS_USELESS_2);
+ break;
+ case 2:
+ // This response disabled due to lack of a speech file.
+ // NPCPhrase (PLEADING_IS_USELESS_3);
+ // break;
+ case 3:
+ NPCPhrase (PLEADING_IS_USELESS_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (KOHR_AH_PLEAD, NumVisits);
+ }
+ else if (PLAYER_SAID (R, why_kill_all_1)
+ || PLAYER_SAID (R, why_kill_all_2)
+ || PLAYER_SAID (R, why_kill_all_3)
+ || PLAYER_SAID (R, why_kill_all_4))
+ {
+ NumVisits = GET_GAME_STATE (KOHR_AH_REASONS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (KILL_BECAUSE_1);
+ break;
+ case 1:
+ NPCPhrase (KILL_BECAUSE_2);
+ break;
+ case 2:
+ NPCPhrase (KILL_BECAUSE_3);
+ break;
+ case 3:
+ NPCPhrase (KILL_BECAUSE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (KOHR_AH_REASONS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, please_dont_kill_1)
+ || PLAYER_SAID (R, please_dont_kill_2)
+ || PLAYER_SAID (R, please_dont_kill_3)
+ || PLAYER_SAID (R, please_dont_kill_4))
+ {
+ NumVisits = GET_GAME_STATE (KOHR_AH_PLEAD);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (WILL_KILL_1);
+ break;
+ case 1:
+ NPCPhrase (WILL_KILL_2);
+ break;
+ case 2:
+ NPCPhrase (WILL_KILL_3);
+ break;
+ case 3:
+ NPCPhrase (WILL_KILL_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (KOHR_AH_PLEAD, NumVisits);
+ }
+ else if (PLAYER_SAID (R, bye_frenzy_1)
+ || PLAYER_SAID (R, bye_frenzy_2)
+ || PLAYER_SAID (R, bye_frenzy_3)
+ || PLAYER_SAID (R, bye_frenzy_4))
+ {
+ NumVisits = GET_GAME_STATE (KOHR_AH_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GOODBYE_AND_DIE_FRENZY_1);
+ break;
+ case 1:
+ NPCPhrase (GOODBYE_AND_DIE_FRENZY_2);
+ break;
+ case 2:
+ NPCPhrase (GOODBYE_AND_DIE_FRENZY_3);
+ break;
+ case 3:
+ NPCPhrase (GOODBYE_AND_DIE_FRENZY_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (KOHR_AH_INFO, NumVisits);
+ }
+}
+
+static void
+Frenzy (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ switch (GET_GAME_STATE (KOHR_AH_REASONS))
+ {
+ case 0:
+ Response (why_kill_all_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (why_kill_all_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (why_kill_all_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (why_kill_all_4, CombatIsInevitable);
+ break;
+ }
+ switch (GET_GAME_STATE (KOHR_AH_PLEAD))
+ {
+ case 0:
+ Response (please_dont_kill_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (please_dont_kill_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (please_dont_kill_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (please_dont_kill_4, CombatIsInevitable);
+ break;
+ }
+ switch (GET_GAME_STATE (KOHR_AH_INFO))
+ {
+ case 0:
+ Response (bye_frenzy_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (bye_frenzy_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (bye_frenzy_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (bye_frenzy_4, CombatIsInevitable);
+ break;
+ }
+}
+
+static void
+KohrAhStory (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, key_phrase))
+ {
+ NPCPhrase (RESPONSE_TO_KEY_PHRASE);
+
+ SET_GAME_STATE (KNOW_KOHR_AH_STORY, 2);
+ }
+ else if (PLAYER_SAID (R, why_do_you_destroy))
+ {
+ NPCPhrase (WE_WERE_SLAVES);
+
+ DISABLE_PHRASE (why_do_you_destroy);
+ }
+ else if (PLAYER_SAID (R, relationship_with_urquan))
+ {
+ NPCPhrase (WE_ARE_URQUAN_TOO);
+
+ DISABLE_PHRASE (relationship_with_urquan);
+ }
+ else if (PLAYER_SAID (R, what_about_culture))
+ {
+ NPCPhrase (BONE_GARDENS);
+
+ DISABLE_PHRASE (what_about_culture);
+ }
+ else if (PLAYER_SAID (R, how_leave_me_alone))
+ {
+ NPCPhrase (YOU_DIE);
+
+ DISABLE_PHRASE (how_leave_me_alone);
+ }
+
+ if (PHRASE_ENABLED (why_do_you_destroy))
+ Response (why_do_you_destroy, KohrAhStory);
+ if (PHRASE_ENABLED (relationship_with_urquan))
+ Response (relationship_with_urquan, KohrAhStory);
+ if (PHRASE_ENABLED (what_about_culture))
+ Response (what_about_culture, KohrAhStory);
+ if (PHRASE_ENABLED (how_leave_me_alone))
+ Response (how_leave_me_alone, KohrAhStory);
+ Response (guess_thats_all, CombatIsInevitable);
+}
+
+static void
+DieHuman (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ switch (GET_GAME_STATE (KOHR_AH_REASONS))
+ {
+ case 0:
+ Response (threat_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (threat_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (threat_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (threat_4, CombatIsInevitable);
+ break;
+ }
+ if (GET_GAME_STATE (KNOW_KOHR_AH_STORY) == 1)
+ {
+ Response (key_phrase, KohrAhStory);
+ }
+ switch (GET_GAME_STATE (KOHR_AH_INFO))
+ {
+ case 0:
+ Response (what_are_you_hovering_over, CombatIsInevitable);
+ break;
+ case 1:
+ Response (you_sure_are_creepy, CombatIsInevitable);
+ break;
+ case 2:
+ Response (stop_that_gross_blinking, CombatIsInevitable);
+ break;
+ }
+ switch (GET_GAME_STATE (KOHR_AH_PLEAD))
+ {
+ case 0:
+ Response (plead_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (plead_2, CombatIsInevitable);
+ break;
+ case 2:
+ // This response disabled due to lack of a speech file.
+ // Response (plead_3, CombatIsInevitable);
+ // break;
+ case 3:
+ Response (plead_4, CombatIsInevitable);
+ break;
+ }
+ Response (bye, CombatIsInevitable);
+}
+
+static void
+Intro (void)
+{
+ DWORD GrpOffs;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (KOHR_AH_KILLED_ALL))
+ {
+ NPCPhrase (GAME_OVER_DUDE);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (!GET_GAME_STATE (KOHR_AH_SENSES_EVIL)
+ && GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ {
+ NPCPhrase (SENSE_EVIL);
+ SET_GAME_STATE (KOHR_AH_SENSES_EVIL, 1);
+ }
+
+ GrpOffs = GET_GAME_STATE_32 (SAMATRA_GRPOFFS0);
+ if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
+ && GLOBAL (BattleGroupRef)
+ && GLOBAL (BattleGroupRef) == GrpOffs)
+ {
+ NPCPhrase (HELLO_SAMATRA);
+
+ SET_GAME_STATE (AWARE_OF_SAMATRA, 1);
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (KOHR_AH_VISITS);
+ if (GET_GAME_STATE (KOHR_AH_FRENZY))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (WE_KILL_ALL_1);
+ break;
+ case 1:
+ NPCPhrase (WE_KILL_ALL_2);
+ break;
+ case 2:
+ NPCPhrase (WE_KILL_ALL_3);
+ break;
+ case 3:
+ NPCPhrase (WE_KILL_ALL_4);
+ --NumVisits;
+ break;
+ }
+
+ Frenzy ((RESPONSE_REF)0);
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_AND_DIE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_AND_DIE_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_AND_DIE_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_AND_DIE_4);
+ --NumVisits;
+ break;
+ }
+
+ DieHuman ((RESPONSE_REF)0);
+ }
+ SET_GAME_STATE (KOHR_AH_VISITS, NumVisits);
+ }
+}
+
+static COUNT
+uninit_blackurq (void)
+{
+ return (0);
+}
+
+static void
+post_blackurq_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_blackurq_comm (void)
+{
+ LOCDATA *retval;
+
+ blackurq_desc.init_encounter_func = Intro;
+ blackurq_desc.post_encounter_func = post_blackurq_enc;
+ blackurq_desc.uninit_encounter_func = uninit_blackurq;
+
+ blackurq_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ blackurq_desc.AlienTextBaseline.y = 0;
+ blackurq_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (!GET_GAME_STATE (KOHR_AH_KILLED_ALL)
+ && LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
+ {
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ setSegue (Segue_peace);
+ }
+ retval = &blackurq_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/blackur/resinst.h b/src/uqm/comm/blackur/resinst.h
new file mode 100644
index 0000000..d0c2313
--- /dev/null
+++ b/src/uqm/comm/blackur/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define BLACKURQ_COLOR_MAP "comm.kohrah.colortable"
+#define BLACKURQ_CONVERSATION_PHRASES "comm.kohrah.dialogue"
+#define BLACKURQ_FONT "comm.kohrah.font"
+#define BLACKURQ_MUSIC "comm.kohrah.music"
+#define BLACKURQ_PMAP_ANIM "comm.kohrah.graphics"
diff --git a/src/uqm/comm/blackur/strings.h b/src/uqm/comm/blackur/strings.h
new file mode 100644
index 0000000..06a9351
--- /dev/null
+++ b/src/uqm/comm/blackur/strings.h
@@ -0,0 +1,103 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef BLACKUR_STRINGS_H
+#define BLACKUR_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ SENSE_EVIL,
+ HELLO_AND_DIE_1,
+ HELLO_AND_DIE_2,
+ HELLO_AND_DIE_3,
+ HELLO_AND_DIE_4,
+ HELLO_AND_DIE_5,
+ HELLO_AND_DIE_6,
+ HELLO_AND_DIE_7,
+ HELLO_AND_DIE_8,
+ HELLO_SAMATRA,
+ WE_KILL_ALL_1,
+ WE_KILL_ALL_2,
+ WE_KILL_ALL_3,
+ WE_KILL_ALL_4,
+ why_kill_all_1,
+ why_kill_all_2,
+ why_kill_all_3,
+ why_kill_all_4,
+ KILL_BECAUSE_1,
+ KILL_BECAUSE_2,
+ KILL_BECAUSE_3,
+ KILL_BECAUSE_4,
+ please_dont_kill_1,
+ WILL_KILL_1,
+ please_dont_kill_2,
+ WILL_KILL_2,
+ please_dont_kill_3,
+ WILL_KILL_3,
+ please_dont_kill_4,
+ WILL_KILL_4,
+ bye_frenzy_1,
+ bye_frenzy_2,
+ bye_frenzy_3,
+ bye_frenzy_4,
+ GOODBYE_AND_DIE_FRENZY_1,
+ GOODBYE_AND_DIE_FRENZY_2,
+ GOODBYE_AND_DIE_FRENZY_3,
+ GOODBYE_AND_DIE_FRENZY_4,
+ threat_1,
+ RESISTANCE_IS_USELESS_1,
+ threat_2,
+ RESISTANCE_IS_USELESS_2,
+ threat_3,
+ RESISTANCE_IS_USELESS_3,
+ threat_4,
+ RESISTANCE_IS_USELESS_4,
+ key_phrase,
+ RESPONSE_TO_KEY_PHRASE,
+ why_do_you_destroy,
+ WE_WERE_SLAVES,
+ relationship_with_urquan,
+ WE_ARE_URQUAN_TOO,
+ what_about_culture,
+ BONE_GARDENS,
+ how_leave_me_alone,
+ YOU_DIE,
+ guess_thats_all,
+ THEN_DIE,
+ what_are_you_hovering_over,
+ BONE_PILE,
+ you_sure_are_creepy,
+ YES_CREEPY,
+ stop_that_gross_blinking,
+ DIE_HUMAN,
+ plead_1,
+ PLEADING_IS_USELESS_1,
+ plead_2,
+ PLEADING_IS_USELESS_2,
+ plead_3,
+ PLEADING_IS_USELESS_3,
+ plead_4,
+ PLEADING_IS_USELESS_4,
+ bye,
+ GOODBYE_AND_DIE,
+ GAME_OVER_DUDE,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/chmmr/Makeinfo b/src/uqm/comm/chmmr/Makeinfo
new file mode 100644
index 0000000..f01e2b8
--- /dev/null
+++ b/src/uqm/comm/chmmr/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="chmmrc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/chmmr/chmmrc.c b/src/uqm/comm/chmmr/chmmrc.c
new file mode 100644
index 0000000..1b35fc0
--- /dev/null
+++ b/src/uqm/comm/chmmr/chmmrc.c
@@ -0,0 +1,641 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/hyper.h"
+ // for SOL_X/SOL_Y
+
+
+static LOCDATA chmmr_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ CHMMR_PMAP_ANIM, /* AlienFrame */
+ CHMMR_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ CHMMR_COLOR_MAP, /* AlienColorMap */
+ CHMMR_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ CHMMR_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 6, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 12, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 17, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 27, /* StartIndex */
+ 20, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 47, /* StartIndex */
+ 14, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 61, /* StartIndex */
+ 24, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 11, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 60, 0, /* FrameRate */
+ ONE_SECOND / 60, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye))
+ NPCPhrase (GOODBYE);
+ else if (PLAYER_SAID (R, bye_shielded))
+ NPCPhrase (GOODBYE_SHIELDED);
+ else if (PLAYER_SAID (R, bye_after_bomb))
+ NPCPhrase (GOODBYE_AFTER_BOMB);
+ else if (PLAYER_SAID (R, proceed))
+ {
+ int i;
+
+ NPCPhrase (TAKE_2_WEEKS);
+
+ SetRaceAllied (CHMMR_SHIP, TRUE);
+
+ SET_GAME_STATE (CHMMR_HOME_VISITS, 0);
+ SET_GAME_STATE (CHMMR_STACK, 0);
+ SET_GAME_STATE (CHMMR_BOMB_STATE, 2);
+ SET_GAME_STATE (UTWIG_BOMB_ON_SHIP, 0);
+ GLOBAL_SIS (ResUnits) = 1000000L;
+ GLOBAL_SIS (NumLanders) = 0;
+ GLOBAL (ModuleCost[PLANET_LANDER]) = 0;
+
+#define EARTH_INDEX 2 /* earth is 3rd planet --> 3 - 1 = 2 */
+/* Magic numbers for Earth */
+#define EARTH_OUTER_X (-725)
+#define EARTH_OUTER_Y (597)
+#define EARTH_INNER_X (121)
+#define EARTH_INNER_Y (113)
+/* Magic numbers for Earth Starbase */
+#define STARBASE_INNER_X (86)
+#define STARBASE_INNER_Y (113)
+
+ /* transport player to Earth */
+ GLOBAL_SIS (log_x) = UNIVERSE_TO_LOGX (SOL_X);
+ GLOBAL_SIS (log_y) = UNIVERSE_TO_LOGY (SOL_Y);
+ GLOBAL (ShipFacing) = 1;
+ /* At Earth or at Starbase */
+ GLOBAL (ip_planet) = EARTH_INDEX + 1;
+ GLOBAL (in_orbit) = 0;
+ /* XXX : this should be unhardcoded eventually */
+ GLOBAL (ip_location.x) = EARTH_OUTER_X;
+ GLOBAL (ip_location.y) = EARTH_OUTER_Y;
+
+ if (GET_GAME_STATE (STARBASE_AVAILABLE))
+ { /* Normal game mode - you are transported to Starbase */
+ GLOBAL_SIS (FuelOnBoard) = FUEL_RESERVE;
+ GLOBAL_SIS (CrewEnlisted) = 0;
+ GLOBAL_SIS (TotalElementMass) = 0;
+ GLOBAL (ModuleCost[STORAGE_BAY]) = 0; /* disable Storage Bay */
+ for (i = 0; i < NUM_ELEMENT_CATEGORIES; ++i)
+ GLOBAL_SIS (ElementAmounts[i]) = 0;
+ for (i = NUM_BOMB_MODULES; i < NUM_MODULE_SLOTS; ++i)
+ GLOBAL_SIS (ModuleSlots[i]) = EMPTY_SLOT + 2;
+
+ /* XXX : this should be unhardcoded eventually */
+ /* transport to Starbase */
+ GLOBAL (ShipStamp.origin.x) = STARBASE_INNER_X - SAFE_X;
+ GLOBAL (ShipStamp.origin.y) = STARBASE_INNER_Y - SAFE_Y;
+ }
+ else
+ { /* 'Beating Game Differently' mode - never visited Starbase,
+ * so you are transported to Earth */
+ /* compress the layout -- move all to front */
+ for (i = NUM_MODULE_SLOTS - 1; i > 0; --i)
+ {
+ int m;
+
+ /* find next unused slot */
+ for (; i > 0
+ && GLOBAL_SIS (ModuleSlots[i]) != EMPTY_SLOT + 2;
+ --i)
+ ;
+ if (i == 0)
+ break;
+ /* find next module to move */
+ for (m = i - 1; m >= 0
+ && GLOBAL_SIS (ModuleSlots[m]) == EMPTY_SLOT + 2;
+ --m)
+ ;
+ if (m < 0)
+ break;
+
+ /* move the module */
+ GLOBAL_SIS (ModuleSlots[i]) = GLOBAL_SIS (ModuleSlots[m]);
+ GLOBAL_SIS (ModuleSlots[m]) = EMPTY_SLOT + 2;
+ }
+
+ /* XXX : this should be unhardcoded eventually */
+ /* transport to Earth itself */
+ GLOBAL (ShipStamp.origin.x) = EARTH_INNER_X - SAFE_X;
+ GLOBAL (ShipStamp.origin.y) = EARTH_INNER_Y - SAFE_Y;
+ }
+
+ /* install Chmmr-supplied modules */
+ for (i = 0; i < NUM_DRIVE_SLOTS; ++i)
+ GLOBAL_SIS (DriveSlots[i]) = FUSION_THRUSTER;
+ for (i = 0; i < NUM_JET_SLOTS; ++i)
+ GLOBAL_SIS (JetSlots[i]) = TURNING_JETS;
+ GLOBAL_SIS (ModuleSlots[0]) = BOMB_MODULE_4;
+ GLOBAL_SIS (ModuleSlots[1]) = BOMB_MODULE_5;
+ GLOBAL_SIS (ModuleSlots[2]) = BOMB_MODULE_3;
+ GLOBAL_SIS (ModuleSlots[3]) = BOMB_MODULE_1;
+ GLOBAL_SIS (ModuleSlots[4]) = BOMB_MODULE_0;
+ GLOBAL_SIS (ModuleSlots[5]) = BOMB_MODULE_1;
+ GLOBAL_SIS (ModuleSlots[6]) = BOMB_MODULE_3;
+ GLOBAL_SIS (ModuleSlots[7]) = BOMB_MODULE_4;
+ GLOBAL_SIS (ModuleSlots[8]) = BOMB_MODULE_5;
+ GLOBAL_SIS (ModuleSlots[9]) = BOMB_MODULE_2;
+ }
+}
+
+static void
+NotReady (RESPONSE_REF R)
+{
+ if (R == 0)
+ NPCPhrase (RETURN_WHEN_READY);
+ else if (PLAYER_SAID (R, further_assistance))
+ {
+ NPCPhrase (NO_FURTHER_ASSISTANCE);
+
+ DISABLE_PHRASE (further_assistance);
+ }
+ else if (PLAYER_SAID (R, tech_help))
+ {
+ NPCPhrase (USE_OUR_SHIPS_BEFORE);
+
+ SetRaceAllied (CHMMR_SHIP, TRUE);
+ }
+ else if (PLAYER_SAID (R, where_weapon))
+ {
+ NPCPhrase (PRECURSOR_WEAPON);
+
+ DISABLE_PHRASE (where_weapon);
+ }
+ else if (PLAYER_SAID (R, where_distraction))
+ {
+ NPCPhrase (PSYCHIC_WEAPONRY);
+
+ DISABLE_PHRASE (where_distraction);
+ }
+
+ if (CheckAlliance (CHMMR_SHIP) != GOOD_GUY)
+ Response (tech_help, NotReady);
+ else if (PHRASE_ENABLED (further_assistance))
+ Response (further_assistance, NotReady);
+ if (PHRASE_ENABLED (where_weapon) && !GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ Response (where_weapon, NotReady);
+ if (PHRASE_ENABLED (where_distraction) && !GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ Response (where_distraction, NotReady);
+ Response (bye, ExitConversation);
+}
+
+static void
+ImproveBomb (RESPONSE_REF R)
+{
+ if (R == 0)
+ NPCPhrase (WE_WILL_IMPROVE_BOMB);
+ else if (PLAYER_SAID (R, what_now))
+ {
+ NPCPhrase (MODIFY_VESSEL);
+
+ DISABLE_PHRASE (what_now);
+ }
+ else if (PLAYER_SAID (R, wont_hurt_my_ship))
+ {
+ NPCPhrase (WILL_DESTROY_IT);
+
+ DISABLE_PHRASE (wont_hurt_my_ship);
+ }
+ else if (PLAYER_SAID (R, bummer_about_my_ship))
+ {
+ NPCPhrase (DEAD_SILENCE);
+
+ DISABLE_PHRASE (bummer_about_my_ship);
+ }
+ else if (PLAYER_SAID (R, other_assistance))
+ {
+ NPCPhrase (USE_OUR_SHIPS_AFTER);
+
+ SetRaceAllied (CHMMR_SHIP, TRUE);
+ }
+
+ if (PHRASE_ENABLED (what_now))
+ Response (what_now, ImproveBomb);
+ else if (PHRASE_ENABLED (wont_hurt_my_ship))
+ Response (wont_hurt_my_ship, ImproveBomb);
+ else if (PHRASE_ENABLED (bummer_about_my_ship))
+ Response (bummer_about_my_ship, ImproveBomb);
+ if (CheckAlliance (CHMMR_SHIP) != GOOD_GUY)
+ Response (other_assistance, ImproveBomb);
+ Response (proceed, ExitConversation);
+}
+
+static void
+ChmmrFree (RESPONSE_REF R)
+{
+ if (R == 0
+ || PLAYER_SAID (R, i_am_captain0)
+ || PLAYER_SAID (R, i_am_savior)
+ || PLAYER_SAID (R, i_am_silly))
+ {
+ NPCPhrase (WHY_HAVE_YOU_FREED_US);
+ AlienTalkSegue ((COUNT)~0);
+ SET_GAME_STATE (CHMMR_EMERGING, 0);
+
+ Response (serious_1, ChmmrFree);
+ Response (serious_2, ChmmrFree);
+ Response (silly, ChmmrFree);
+ }
+ else
+ {
+ NPCPhrase (WILL_HELP_ANALYZE_LOGS);
+
+ if (GET_GAME_STATE (AWARE_OF_SAMATRA))
+ NPCPhrase (YOU_KNOW_SAMATRA);
+ else
+ {
+ NPCPhrase (DONT_KNOW_ABOUT_SAMATRA);
+
+ SET_GAME_STATE (AWARE_OF_SAMATRA, 1);
+ }
+
+ if (GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ NPCPhrase (HAVE_TALKING_PET);
+ else
+ NPCPhrase (NEED_DISTRACTION);
+
+ if (GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ NPCPhrase (HAVE_BOMB);
+ else
+ NPCPhrase (NEED_WEAPON);
+
+ if (!GET_GAME_STATE (TALKING_PET_ON_SHIP)
+ || !GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ NotReady ((RESPONSE_REF)0);
+ else
+ ImproveBomb ((RESPONSE_REF)0);
+ }
+}
+
+static void ChmmrShielded (RESPONSE_REF R);
+
+static void
+ChmmrAdvice (RESPONSE_REF R)
+{
+ BYTE AdviceLeft;
+
+ if (PLAYER_SAID (R, need_advice))
+ NPCPhrase (WHAT_ADVICE);
+ else if (PLAYER_SAID (R, how_defeat_urquan))
+ {
+ NPCPhrase (DEFEAT_LIKE_SO);
+
+ SET_GAME_STATE (CHMMR_BOMB_STATE, 1);
+ DISABLE_PHRASE (how_defeat_urquan);
+ }
+ else if (PLAYER_SAID (R, what_about_tpet))
+ {
+ NPCPhrase (SCARY_BUT_USEFUL);
+
+ DISABLE_PHRASE (what_about_tpet);
+ }
+ else if (PLAYER_SAID (R, what_about_bomb))
+ {
+ NPCPhrase (ABOUT_BOMB);
+
+ DISABLE_PHRASE (what_about_bomb);
+ }
+ else if (PLAYER_SAID (R, what_about_sun_device))
+ {
+ NPCPhrase (ABOUT_SUN_DEVICE);
+
+ DISABLE_PHRASE (what_about_sun_device);
+ }
+ else if (PLAYER_SAID (R, what_about_samatra))
+ {
+ NPCPhrase (ABOUT_SAMATRA);
+
+ DISABLE_PHRASE (what_about_samatra);
+ }
+
+ AdviceLeft = 0;
+ if (PHRASE_ENABLED (how_defeat_urquan))
+ {
+ Response (how_defeat_urquan, ChmmrAdvice);
+ AdviceLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_tpet) && GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ {
+ Response (what_about_tpet, ChmmrAdvice);
+ AdviceLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_bomb) && GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ {
+ Response (what_about_bomb, ChmmrAdvice);
+ AdviceLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_sun_device) && GET_GAME_STATE (SUN_DEVICE_ON_SHIP))
+ {
+ Response (what_about_sun_device, ChmmrAdvice);
+ AdviceLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_samatra) && GET_GAME_STATE (AWARE_OF_SAMATRA))
+ {
+ Response (what_about_samatra, ChmmrAdvice);
+ AdviceLeft = TRUE;
+ }
+ Response (enough_advice, ChmmrShielded);
+
+ if (!AdviceLeft)
+ DISABLE_PHRASE (need_advice);
+}
+
+static void
+ChmmrShielded (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, find_out_whats_up))
+ {
+ NPCPhrase (HYBRID_PROCESS);
+
+ DISABLE_PHRASE (find_out_whats_up);
+ }
+ else if (PLAYER_SAID (R, need_help))
+ {
+ NPCPhrase (CANT_HELP);
+
+ SET_GAME_STATE (CHMMR_STACK, 1);
+ }
+ else if (PLAYER_SAID (R, why_no_help))
+ {
+ NPCPhrase (LONG_TIME);
+
+ SET_GAME_STATE (CHMMR_STACK, 2);
+ }
+ else if (PLAYER_SAID (R, what_if_more_energy))
+ {
+ NPCPhrase (DANGER_TO_US);
+
+ SET_GAME_STATE (CHMMR_STACK, 3);
+ }
+ else if (PLAYER_SAID (R, enough_advice))
+ NPCPhrase (OK_ENOUGH_ADVICE);
+
+ switch (GET_GAME_STATE (CHMMR_STACK))
+ {
+ case 0:
+ Response (need_help, ChmmrShielded);
+ break;
+ case 1:
+ Response (why_no_help, ChmmrShielded);
+ break;
+ case 2:
+ Response (what_if_more_energy, ChmmrShielded);
+ break;
+ }
+ if (PHRASE_ENABLED (find_out_whats_up))
+ Response (find_out_whats_up, ChmmrShielded);
+ if (PHRASE_ENABLED (need_advice))
+ {
+ Response (need_advice, ChmmrAdvice);
+ }
+ Response (bye_shielded, ExitConversation);
+}
+
+static void
+AfterBomb (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_after_bomb))
+ {
+ if (GET_GAME_STATE (CHMMR_STACK))
+ NPCPhrase (GENERAL_INFO_AFTER_BOMB_2);
+ else
+ {
+ NPCPhrase (GENERAL_INFO_AFTER_BOMB_1);
+
+ SET_GAME_STATE (CHMMR_STACK, 1);
+ }
+
+ DISABLE_PHRASE (whats_up_after_bomb);
+ }
+ else if (PLAYER_SAID (R, what_do_after_bomb))
+ {
+ NPCPhrase (DO_AFTER_BOMB);
+
+ DISABLE_PHRASE (what_do_after_bomb);
+ }
+
+ if (PHRASE_ENABLED (whats_up_after_bomb))
+ Response (whats_up_after_bomb, AfterBomb);
+ if (PHRASE_ENABLED (what_do_after_bomb))
+ Response (what_do_after_bomb, AfterBomb);
+ Response (bye_after_bomb, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (GET_GAME_STATE (CHMMR_BOMB_STATE) >= 2)
+ {
+ NumVisits = GET_GAME_STATE (CHMMR_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_AFTER_BOMB_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_AFTER_BOMB_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (CHMMR_HOME_VISITS, NumVisits);
+
+ AfterBomb ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (CHMMR_UNLEASHED))
+ {
+ if (!GET_GAME_STATE (TALKING_PET_ON_SHIP)
+ || !GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ NotReady ((RESPONSE_REF)0);
+ else
+ {
+ NPCPhrase (YOU_ARE_READY);
+
+ ImproveBomb ((RESPONSE_REF)0);
+ }
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (CHMMR_HOME_VISITS);
+ if (!GET_GAME_STATE (CHMMR_EMERGING))
+ {
+ CommData.AlienColorMap = SetAbsColorMapIndex (
+ CommData.AlienColorMap, 1
+ );
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (WHY_YOU_HERE_1);
+ break;
+ case 1:
+ NPCPhrase (WHY_YOU_HERE_2);
+ break;
+ case 2:
+ NPCPhrase (WHY_YOU_HERE_3);
+ break;
+ case 3:
+ NPCPhrase (WHY_YOU_HERE_4);
+ --NumVisits;
+ break;
+ }
+
+ ChmmrShielded ((RESPONSE_REF)0);
+ }
+ else
+ {
+ SetCommIntroMode (CIM_FADE_IN_SCREEN, ONE_SECOND * 2);
+ NPCPhrase (WE_ARE_FREE);
+
+ if (NumVisits)
+ {
+ ChmmrFree ((RESPONSE_REF)0);
+ NumVisits = 0;
+ }
+ else
+ {
+ NPCPhrase (WHO_ARE_YOU);
+
+ construct_response (shared_phrase_buf,
+ i_am_captain0,
+ GLOBAL_SIS (CommanderName),
+ i_am_captain1,
+ GLOBAL_SIS (ShipName),
+ i_am_captain2,
+ (UNICODE*)NULL);
+ DoResponsePhrase (i_am_captain0, ChmmrFree, shared_phrase_buf);
+ Response (i_am_savior, ChmmrFree);
+ Response (i_am_silly, ChmmrFree);
+ }
+
+ SET_GAME_STATE (CHMMR_UNLEASHED, 1);
+ }
+ SET_GAME_STATE (CHMMR_HOME_VISITS, NumVisits);
+ }
+}
+
+static COUNT
+uninit_chmmr (void)
+{
+ return (0);
+}
+
+static void
+post_chmmr_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_chmmr_comm (void)
+{
+ LOCDATA *retval;
+
+ chmmr_desc.init_encounter_func = Intro;
+ chmmr_desc.post_encounter_func = post_chmmr_enc;
+ chmmr_desc.uninit_encounter_func = uninit_chmmr;
+
+ chmmr_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ chmmr_desc.AlienTextBaseline.y = 0;
+ chmmr_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ setSegue (Segue_peace);
+ retval = &chmmr_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/chmmr/resinst.h b/src/uqm/comm/chmmr/resinst.h
new file mode 100644
index 0000000..3365c97
--- /dev/null
+++ b/src/uqm/comm/chmmr/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define CHMMR_COLOR_MAP "comm.chmmr.colortable"
+#define CHMMR_CONVERSATION_PHRASES "comm.chmmr.dialogue"
+#define CHMMR_FONT "comm.chmmr.font"
+#define CHMMR_MUSIC "comm.chmmr.music"
+#define CHMMR_PMAP_ANIM "comm.chmmr.graphics"
diff --git a/src/uqm/comm/chmmr/strings.h b/src/uqm/comm/chmmr/strings.h
new file mode 100644
index 0000000..0952891
--- /dev/null
+++ b/src/uqm/comm/chmmr/strings.h
@@ -0,0 +1,105 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef CHMMR_STRINGS_H
+#define CHMMR_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ WHY_YOU_HERE_1,
+ WHY_YOU_HERE_2,
+ WHY_YOU_HERE_3,
+ WHY_YOU_HERE_4,
+ find_out_whats_up,
+ HYBRID_PROCESS,
+ need_help,
+ CANT_HELP,
+ why_no_help,
+ LONG_TIME,
+ what_if_more_energy,
+ DANGER_TO_US,
+ need_advice,
+ WHAT_ADVICE,
+ how_defeat_urquan,
+ DEFEAT_LIKE_SO,
+ what_about_tpet,
+ SCARY_BUT_USEFUL,
+ what_about_bomb,
+ ABOUT_BOMB,
+ what_about_sun_device,
+ ABOUT_SUN_DEVICE,
+ what_about_samatra,
+ ABOUT_SAMATRA,
+ enough_advice,
+ OK_ENOUGH_ADVICE,
+ bye_shielded,
+ GOODBYE_SHIELDED,
+ WE_ARE_FREE,
+ WHO_ARE_YOU,
+ i_am_captain0,
+ i_am_captain1,
+ i_am_captain2,
+ i_am_savior,
+ i_am_silly,
+ WHY_HAVE_YOU_FREED_US,
+ serious_1,
+ serious_2,
+ silly,
+ WILL_HELP_ANALYZE_LOGS,
+ YOU_KNOW_SAMATRA,
+ DONT_KNOW_ABOUT_SAMATRA,
+ NEED_DISTRACTION,
+ HAVE_TALKING_PET,
+ NEED_WEAPON,
+ HAVE_BOMB,
+ RETURN_WHEN_READY,
+ YOU_ARE_READY,
+ further_assistance,
+ NO_FURTHER_ASSISTANCE,
+ tech_help,
+ USE_OUR_SHIPS_BEFORE,
+ where_weapon,
+ PRECURSOR_WEAPON,
+ where_distraction,
+ PSYCHIC_WEAPONRY,
+ what_now,
+ WE_WILL_IMPROVE_BOMB,
+ MODIFY_VESSEL,
+ wont_hurt_my_ship,
+ WILL_DESTROY_IT,
+ bummer_about_my_ship,
+ DEAD_SILENCE,
+ other_assistance,
+ USE_OUR_SHIPS_AFTER,
+ proceed,
+ TAKE_2_WEEKS,
+ HELLO_AFTER_BOMB_1,
+ HELLO_AFTER_BOMB_2,
+ whats_up_after_bomb,
+ GENERAL_INFO_AFTER_BOMB_1,
+ GENERAL_INFO_AFTER_BOMB_2,
+ what_do_after_bomb,
+ DO_AFTER_BOMB,
+ bye_after_bomb,
+ GOODBYE_AFTER_BOMB,
+ bye,
+ GOODBYE,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/comandr/Makeinfo b/src/uqm/comm/comandr/Makeinfo
new file mode 100644
index 0000000..36b63ed
--- /dev/null
+++ b/src/uqm/comm/comandr/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="comandr.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/comandr/comandr.c b/src/uqm/comm/comandr/comandr.c
new file mode 100644
index 0000000..57df233
--- /dev/null
+++ b/src/uqm/comm/comandr/comandr.c
@@ -0,0 +1,694 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/setup.h"
+#include "uqm/sis.h"
+ // for DeltaSISGauges(), DrawLanders()
+#include "libs/graphics/gfx_common.h"
+
+static LOCDATA commander_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ COMMANDER_PMAP_ANIM, /* AlienFrame */
+ COMMANDER_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ COMMANDER_COLOR_MAP, /* AlienColorMap */
+ COMMANDER_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ COMMANDER_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 3, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ { /* Blink */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Running light */
+ 10, /* StartIndex */
+ 30, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ ONE_SECOND * 2, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM | COLORXFORM_ANIM,/* AnimFlags */
+ 0, ONE_SECOND / 30, /* FrameRate */
+ 0, ONE_SECOND / 15, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 4, /* StartIndex */
+ 6, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 7 / 60, ONE_SECOND / 12, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ByeBye (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, ok_i_will_get_radios))
+ NPCPhrase (THANKS_FOR_HELPING);
+ else if (PLAYER_SAID (R, well_go_get_them_now))
+ NPCPhrase (GLAD_WHEN_YOU_COME_BACK);
+ else if (PLAYER_SAID (R, we_will_take_care_of_base))
+ {
+ NPCPhrase (GOOD_LUCK_WITH_BASE);
+
+ SET_GAME_STATE (WILL_DESTROY_BASE, 1);
+ }
+ else if (PLAYER_SAID (R, take_care_of_base_again))
+ NPCPhrase (GOOD_LUCK_AGAIN);
+ else if (PLAYER_SAID (R, base_was_abandoned)
+ || PLAYER_SAID (R, i_lied_it_was_abandoned))
+ {
+ NPCPhrase (IT_WAS_ABANDONED);
+ NPCPhrase (HERE_COMES_ILWRATH);
+
+ SET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER, 1);
+ }
+ else if (PLAYER_SAID (R, oh_yes_big_fight))
+ {
+ NPCPhrase (IM_GLAD_YOU_WON);
+ NPCPhrase (HERE_COMES_ILWRATH);
+
+ SET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER, 1);
+ }
+ else if (PLAYER_SAID (R, i_cant_talk_about_it))
+ {
+ NPCPhrase (IM_SURE_IT_WAS_DIFFICULT);
+ NPCPhrase (HERE_COMES_ILWRATH);
+
+ SET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER, 1);
+ }
+ else if (PLAYER_SAID (R, cook_their_butts)
+ || PLAYER_SAID (R, overthrow_evil_aliens)
+ || PLAYER_SAID (R, annihilate_those_monsters))
+ {
+ SET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER, 0);
+
+ if (PLAYER_SAID (R, cook_their_butts))
+ NPCPhrase (COOK_BUTTS);
+ else if (PLAYER_SAID (R, overthrow_evil_aliens))
+ NPCPhrase (OVERTHROW_ALIENS);
+ else /* if (R == annihilate_those_monsters) */
+ NPCPhrase (KILL_MONSTERS);
+
+ construct_response (shared_phrase_buf,
+ name_40,
+ GLOBAL_SIS (CommanderName),
+ name_41,
+ (UNICODE*)NULL);
+
+ NPCPhrase (THIS_MAY_SEEM_SILLY);
+
+ Response (name_1, ByeBye);
+ Response (name_2, ByeBye);
+ Response (name_3, ByeBye);
+ DoResponsePhrase (name_40, ByeBye, shared_phrase_buf);
+
+ SET_GAME_STATE (STARBASE_AVAILABLE, 1);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, name_1))
+ {
+ NPCPhrase (OK_THE_NAFS);
+
+ SET_GAME_STATE (NEW_ALLIANCE_NAME, 0);
+ }
+ else if (PLAYER_SAID (R, name_2))
+ {
+ NPCPhrase (OK_THE_CAN);
+
+ SET_GAME_STATE (NEW_ALLIANCE_NAME, 1);
+ }
+ else if (PLAYER_SAID (R, name_3))
+ {
+ NPCPhrase (OK_THE_UFW);
+
+ SET_GAME_STATE (NEW_ALLIANCE_NAME, 2);
+ }
+ else /* if (PLAYER_SAID (R, name_4)) */
+ {
+ NPCPhrase (OK_THE_NAME_IS_EMPIRE0);
+ NPCPhrase (GLOBAL_PLAYER_NAME);
+ NPCPhrase (OK_THE_NAME_IS_EMPIRE1);
+
+ SET_GAME_STATE (NEW_ALLIANCE_NAME, 3);
+ }
+
+ NPCPhrase (STARBASE_WILL_BE_READY);
+ }
+}
+
+static void GiveRadios (RESPONSE_REF R);
+
+static void
+NoRadioactives (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, yes_this_is_supply_ship))
+ {
+ NPCPhrase (ABOUT_TIME);
+
+ if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE]))
+ GiveRadios (0);
+ else
+ {
+ Response (i_lied, NoRadioactives);
+ Response (plumb_out, NoRadioactives);
+ }
+ }
+ else
+ {
+ if (PLAYER_SAID (R, where_can_i_get_radios))
+ {
+ NPCPhrase (RADIOS_ON_MERCURY);
+
+ DISABLE_PHRASE (where_can_i_get_radios);
+ }
+ else if (PLAYER_SAID (R, no_but_well_help0))
+ NPCPhrase (THE_WHAT_FROM_WHERE);
+ else if (PLAYER_SAID (R, what_slave_planet)
+ || PLAYER_SAID (R, i_lied))
+ NPCPhrase (DONT_KNOW_WHO_YOU_ARE);
+ else if (PLAYER_SAID (R, plumb_out))
+ NPCPhrase (WHAT_KIND_OF_IDIOT);
+ else if (PLAYER_SAID (R, i_lost_my_lander))
+ {
+ NPCPhrase (HERE_IS_A_NEW_LANDER);
+ ++GLOBAL_SIS (NumLanders);
+ DrawLanders ();
+ DeltaSISGauges (4, 0, 0);
+
+ SET_GAME_STATE (LANDERS_LOST, 1);
+ }
+ else if (PLAYER_SAID (R, i_lost_another_lander))
+ {
+ NPCPhrase (HERE_IS_ANOTHER_LANDER);
+ ++GLOBAL_SIS (NumLanders);
+ DrawLanders ();
+ DeltaSISGauges (4, 0, 0);
+ }
+ else if (PLAYER_SAID (R, need_fuel_mercury) ||
+ PLAYER_SAID (R, need_fuel_luna))
+ {
+ NPCPhrase (GIVE_FUEL);
+ DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
+
+ SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
+ }
+ else if (PLAYER_SAID (R, need_fuel_again))
+ {
+ NPCPhrase (GIVE_FUEL_AGAIN);
+ DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
+ }
+
+ if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE]))
+ GiveRadios (0);
+ else
+ {
+ if (GLOBAL_SIS (NumLanders) == 0
+ && GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
+ {
+ if (GET_GAME_STATE (LANDERS_LOST))
+ Response (i_lost_another_lander, NoRadioactives);
+ else
+ Response (i_lost_my_lander, NoRadioactives);
+ }
+ if (GLOBAL_SIS (FuelOnBoard) < 2 * FUEL_TANK_SCALE)
+ {
+ if (GET_GAME_STATE (GIVEN_FUEL_BEFORE))
+ Response (need_fuel_again, NoRadioactives);
+ else
+ Response (need_fuel_mercury, NoRadioactives);
+ }
+
+ Response (ok_i_will_get_radios, ByeBye);
+ if (PHRASE_ENABLED (where_can_i_get_radios))
+ {
+ Response (where_can_i_get_radios, NoRadioactives);
+ }
+ }
+ }
+}
+
+static void
+AskAfterRadios (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, i_lost_my_lander))
+ {
+ NPCPhrase (HERE_IS_A_NEW_LANDER);
+ ++GLOBAL_SIS (NumLanders);
+ DrawLanders ();
+ DeltaSISGauges (4, 0, 0);
+
+ SET_GAME_STATE (LANDERS_LOST, 1);
+ }
+ else if (PLAYER_SAID (R, i_lost_another_lander))
+ {
+ NPCPhrase (HERE_IS_ANOTHER_LANDER);
+ ++GLOBAL_SIS (NumLanders);
+ DrawLanders ();
+ DeltaSISGauges (4, 0, 0);
+ }
+ else if (PLAYER_SAID (R, need_fuel_mercury) ||
+ PLAYER_SAID (R, need_fuel_luna))
+ {
+ NPCPhrase (GIVE_FUEL);
+ DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
+
+ SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
+ }
+ else if (PLAYER_SAID (R, need_fuel_again))
+ {
+ NPCPhrase (GIVE_FUEL_AGAIN);
+ DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
+ }
+ else if (PLAYER_SAID (R, where_get_radios))
+ {
+ NPCPhrase (RADIOS_ON_MERCURY);
+
+ DISABLE_PHRASE (where_get_radios);
+ }
+
+ {
+ if (GLOBAL_SIS (NumLanders) == 0
+ && GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
+ {
+ if (GET_GAME_STATE (LANDERS_LOST))
+ Response (i_lost_another_lander, AskAfterRadios);
+ else
+ Response (i_lost_my_lander, AskAfterRadios);
+ }
+ if (GLOBAL_SIS (FuelOnBoard) < 2 * FUEL_TANK_SCALE)
+ {
+ if (GET_GAME_STATE (GIVEN_FUEL_BEFORE))
+ Response (need_fuel_again, AskAfterRadios);
+ else
+ Response (need_fuel_mercury, AskAfterRadios);
+ }
+ Response (well_go_get_them_now, ByeBye);
+ if (PHRASE_ENABLED (where_get_radios))
+ {
+ Response (where_get_radios, AskAfterRadios);
+ }
+ }
+}
+
+static void
+BaseDestroyed (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, we_fought_them))
+ {
+ NPCPhrase (YOU_REALLY_FOUGHT_BASE);
+
+ Response (oh_yes_big_fight, ByeBye);
+ Response (i_lied_it_was_abandoned, ByeBye);
+ Response (i_cant_talk_about_it, ByeBye);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, we_are_here_to_help))
+ {
+ NPCPhrase (BASE_ON_MOON);
+ }
+ else
+ {
+ NPCPhrase (DEALT_WITH_BASE_YET);
+ }
+
+ Response (base_was_abandoned, ByeBye);
+ Response (we_fought_them, BaseDestroyed);
+ }
+}
+
+static void
+TellMoonBase (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ NPCPhrase (DEALT_WITH_BASE_YET);
+ }
+ else if (PLAYER_SAID (R, i_lost_my_lander))
+ {
+ NPCPhrase (HERE_IS_A_NEW_LANDER);
+ ++GLOBAL_SIS (NumLanders);
+ DrawLanders ();
+ DeltaSISGauges (4, 0, 0);
+
+ SET_GAME_STATE (LANDERS_LOST, 1);
+ }
+ else if (PLAYER_SAID (R, i_lost_another_lander))
+ {
+ NPCPhrase (HERE_IS_ANOTHER_LANDER);
+ ++GLOBAL_SIS (NumLanders);
+ DrawLanders ();
+ DeltaSISGauges (4, 0, 0);
+ }
+ else if (PLAYER_SAID (R, need_fuel_mercury) ||
+ PLAYER_SAID (R, need_fuel_luna))
+ {
+ NPCPhrase (GIVE_FUEL);
+ DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
+
+ SET_GAME_STATE (GIVEN_FUEL_BEFORE, 1);
+ }
+ else if (PLAYER_SAID (R, need_fuel_again))
+ {
+ NPCPhrase (GIVE_FUEL_AGAIN);
+ DeltaSISGauges (0, 5 * FUEL_TANK_SCALE, 0);
+ }
+ else if (PLAYER_SAID (R, we_are_here_to_help))
+ {
+ NPCPhrase (BASE_ON_MOON);
+ }
+ else if (GET_GAME_STATE (STARBASE_YACK_STACK1) == 0)
+ {
+ NPCPhrase (ABOUT_BASE);
+
+ SET_GAME_STATE (STARBASE_YACK_STACK1, 1);
+ }
+ else
+ {
+ NPCPhrase (ABOUT_BASE_AGAIN);
+ }
+
+ if (GLOBAL_SIS (NumLanders) == 0
+ && GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
+ {
+ if (GET_GAME_STATE (LANDERS_LOST))
+ Response (i_lost_another_lander, TellMoonBase);
+ else
+ Response (i_lost_my_lander, TellMoonBase);
+ }
+ if (GLOBAL_SIS (FuelOnBoard) < 2 * FUEL_TANK_SCALE)
+ {
+ if (GET_GAME_STATE (GIVEN_FUEL_BEFORE))
+ Response (need_fuel_again, TellMoonBase);
+ else
+ Response (need_fuel_luna, TellMoonBase);
+ }
+ if (GET_GAME_STATE (WILL_DESTROY_BASE) == 0)
+ Response (we_will_take_care_of_base, ByeBye);
+ else
+ Response (take_care_of_base_again, ByeBye);
+ if (GET_GAME_STATE (STARBASE_YACK_STACK1) == 0)
+ Response (tell_me_about_base, TellMoonBase);
+ else
+ Response (tell_me_again, TellMoonBase);
+}
+
+static void RevealSelf (RESPONSE_REF R);
+
+static void
+TellProbe (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ NPCPhrase (THAT_WAS_PROBE);
+ DISABLE_PHRASE (what_was_red_thing);
+
+ Response (it_went_away, RevealSelf);
+ Response (we_destroyed_it, RevealSelf);
+ Response (what_probe, RevealSelf);
+}
+
+static void
+RevealSelf (RESPONSE_REF R)
+{
+ BYTE i, stack;
+
+ stack = 0;
+ if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase (THATS_IMPOSSIBLE);
+
+ DISABLE_PHRASE (we_are_vindicator0);
+ }
+ else if (PLAYER_SAID (R, our_mission_was_secret))
+ {
+ NPCPhrase (ACKNOWLEDGE_SECRET);
+
+ DISABLE_PHRASE (our_mission_was_secret);
+ }
+ else if (PLAYER_SAID (R, first_give_info))
+ {
+ NPCPhrase (ASK_AWAY);
+
+ stack = 1;
+ DISABLE_PHRASE (first_give_info);
+ }
+ else if (PLAYER_SAID (R, whats_this_starbase))
+ {
+ NPCPhrase (STARBASE_IS);
+
+ stack = 1;
+ DISABLE_PHRASE (whats_this_starbase);
+ }
+ else if (PLAYER_SAID (R, what_about_earth))
+ {
+ NPCPhrase (HAPPENED_TO_EARTH);
+
+ stack = 1;
+ DISABLE_PHRASE (what_about_earth);
+ }
+ else if (PLAYER_SAID (R, where_are_urquan))
+ {
+ NPCPhrase (URQUAN_LEFT);
+
+ stack = 1;
+ DISABLE_PHRASE (where_are_urquan);
+ }
+ else if (PLAYER_SAID (R, it_went_away))
+ NPCPhrase (DEEP_TROUBLE);
+ else if (PLAYER_SAID (R, we_destroyed_it))
+ NPCPhrase (GOOD_NEWS);
+ else if (PLAYER_SAID (R, what_probe))
+ NPCPhrase (SURE_HOPE);
+
+ for (i = 0; i < 2; ++i, stack ^= 1)
+ {
+ if (stack == 1)
+ {
+ if (PHRASE_ENABLED (first_give_info))
+ Response (first_give_info, RevealSelf);
+ else if (PHRASE_ENABLED (whats_this_starbase))
+ Response (whats_this_starbase, RevealSelf);
+ else if (PHRASE_ENABLED (what_about_earth))
+ Response (what_about_earth, RevealSelf);
+ else if (PHRASE_ENABLED (where_are_urquan))
+ Response (where_are_urquan, RevealSelf);
+ else if (PHRASE_ENABLED (what_was_red_thing))
+ {
+ Response (what_was_red_thing, TellProbe);
+ }
+ }
+ else
+ {
+ if (PHRASE_ENABLED (we_are_vindicator0))
+ {
+ construct_response (shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_are_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ DoResponsePhrase (we_are_vindicator0, RevealSelf, shared_phrase_buf);
+ }
+ else if (PHRASE_ENABLED (our_mission_was_secret))
+ Response (our_mission_was_secret, RevealSelf);
+ else
+ {
+ if (GET_GAME_STATE (MOONBASE_DESTROYED) == 0)
+ Response (we_are_here_to_help, TellMoonBase);
+ else
+ Response (we_are_here_to_help, BaseDestroyed);
+ }
+ }
+ }
+}
+
+static void
+GiveRadios (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, we_will_transfer_now))
+ {
+ SET_GAME_STATE (RADIOACTIVES_PROVIDED, 1);
+
+ NPCPhrase (FUEL_UP0);
+ NPCPhrase (FUEL_UP1);
+ AlienTalkSegue (1);
+
+ CommData.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED;
+
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 0)
+ ), ONE_SECOND / 2);
+
+ AlienTalkSegue ((COUNT)~0);
+
+ RevealSelf (0);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, what_will_you_give_us))
+ NPCPhrase (MESSAGE_GARBLED_1);
+ else if (PLAYER_SAID (R, before_radios_we_need_info))
+ NPCPhrase (MESSAGE_GARBLED_2);
+
+ Response (we_will_transfer_now, GiveRadios);
+ Response (what_will_you_give_us, GiveRadios);
+ Response (before_radios_we_need_info, GiveRadios);
+ }
+}
+
+static void
+Intro (void)
+{
+ if (GET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER))
+ {
+ NPCPhrase (VERY_IMPRESSIVE);
+
+ Response (cook_their_butts, ByeBye);
+ Response (overthrow_evil_aliens, ByeBye);
+ Response (annihilate_those_monsters, ByeBye);
+ }
+ else if (GET_GAME_STATE (STARBASE_VISITED))
+ {
+ if (GET_GAME_STATE (RADIOACTIVES_PROVIDED))
+ {
+ if (GET_GAME_STATE (MOONBASE_DESTROYED) == 0)
+ {
+ TellMoonBase (0);
+ }
+ else
+ {
+ BaseDestroyed (0);
+ }
+ }
+ else
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+ NPCPhrase (DO_YOU_HAVE_RADIO_THIS_TIME);
+
+ if (GLOBAL_SIS (ElementAmounts[RADIOACTIVE]))
+ GiveRadios (0);
+ else
+ AskAfterRadios (0);
+ }
+ }
+ else /* first visit */
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+
+ SET_GAME_STATE (STARBASE_VISITED, 1);
+
+ NPCPhrase (ARE_YOU_SUPPLY_SHIP);
+ construct_response (
+ shared_phrase_buf,
+ no_but_well_help0,
+ GLOBAL_SIS (ShipName),
+ no_but_well_help1,
+ (UNICODE*)NULL);
+ DoResponsePhrase (no_but_well_help0, NoRadioactives, shared_phrase_buf);
+ Response (yes_this_is_supply_ship, NoRadioactives);
+ Response (what_slave_planet, NoRadioactives);
+ }
+}
+
+static COUNT
+uninit_commander (void)
+{
+ return (0);
+}
+
+static void
+post_commander_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_commander_comm ()
+{
+ LOCDATA *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))
+ {
+ commander_desc.AlienAmbientArray[2].AnimFlags |= ANIM_DISABLED;
+ // regular track -- let's make sure
+ commander_desc.AlienSongFlags &= ~LDASF_USE_ALTERNATE;
+ }
+ else
+ {
+ commander_desc.AlienAmbientArray[2].AnimFlags &= ~ANIM_DISABLED;
+ // use alternate 'low-power' track if available
+ commander_desc.AlienAltSongRes = COMMANDER_LOWPOW_MUSIC;
+ commander_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
+ }
+
+ commander_desc.AlienTextWidth = 143;
+ commander_desc.AlienTextBaseline.x = 164;
+ commander_desc.AlienTextBaseline.y = 20;
+
+ setSegue (Segue_peace);
+ retval = &commander_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/comandr/resinst.h b/src/uqm/comm/comandr/resinst.h
new file mode 100644
index 0000000..7798214
--- /dev/null
+++ b/src/uqm/comm/comandr/resinst.h
@@ -0,0 +1,12 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define COMMANDER_COLOR_MAP "comm.commander.colortable"
+#define COMMANDER_CONVERSATION_PHRASES "comm.commander.dialogue"
+#define COMMANDER_FONT "comm.commander.font"
+#define COMMANDER_LOWPOW_MUSIC "comm.commander.lowpower.music"
+#define COMMANDER_MUSIC "comm.commander.music"
+#define COMMANDER_PMAP_ANIM "comm.commander.graphics"
+#define STARBASE_ALT_MUSIC "comm.starbase.music"
+#define STARBASE_CONVERSATION_PHRASES "comm.starbase.dialogue"
diff --git a/src/uqm/comm/comandr/strings.h b/src/uqm/comm/comandr/strings.h
new file mode 100644
index 0000000..fcc330e
--- /dev/null
+++ b/src/uqm/comm/comandr/strings.h
@@ -0,0 +1,127 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef COMANDR_STRINGS_H
+#define COMANDR_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ GLAD_WHEN_YOU_COME_BACK,
+ GIVE_FUEL,
+ GIVE_FUEL_AGAIN,
+ ARE_YOU_SUPPLY_SHIP,
+ DO_YOU_HAVE_RADIO_THIS_TIME,
+ HERE_IS_ANOTHER_LANDER,
+ THE_WHAT_FROM_WHERE,
+ ABOUT_TIME,
+ MESSAGE_GARBLED_1,
+ MESSAGE_GARBLED_2,
+ HERE_IS_A_NEW_LANDER,
+ THIS_MAY_SEEM_SILLY,
+ OK_THE_NAFS,
+ OK_THE_CAN,
+ OK_THE_UFW,
+ OK_THE_NAME_IS_EMPIRE0,
+ OK_THE_NAME_IS_EMPIRE1,
+ FUEL_UP0,
+ FUEL_UP1,
+ WHAT_KIND_OF_IDIOT,
+ DONT_KNOW_WHO_YOU_ARE,
+ THATS_IMPOSSIBLE,
+ ASK_AWAY,
+ RADIOS_ON_MERCURY,
+ THANKS_FOR_HELPING,
+ STARBASE_IS,
+ HAPPENED_TO_EARTH,
+ URQUAN_LEFT,
+ BASE_ON_MOON,
+ ACKNOWLEDGE_SECRET,
+ ABOUT_BASE,
+ GOOD_LUCK_WITH_BASE,
+ DEALT_WITH_BASE_YET,
+ HERE_COMES_ILWRATH,
+ VERY_IMPRESSIVE,
+ IT_WAS_ABANDONED,
+ YOU_REALLY_FOUGHT_BASE,
+ IM_GLAD_YOU_WON,
+ IM_SURE_IT_WAS_DIFFICULT,
+ THAT_WAS_PROBE,
+ DEEP_TROUBLE,
+ GOOD_NEWS,
+ SURE_HOPE,
+ ABOUT_BASE_AGAIN,
+ COOK_BUTTS,
+ OVERTHROW_ALIENS,
+ KILL_MONSTERS,
+ GOOD_LUCK_AGAIN,
+ STARBASE_WILL_BE_READY,
+
+ overthrow_evil_aliens,
+ annihilate_those_monsters,
+ cook_their_butts,
+ where_get_radios,
+ well_go_get_them_now,
+ we_will_transfer_now,
+ what_will_you_give_us,
+ before_radios_we_need_info,
+ no_but_well_help0,
+ no_but_well_help1,
+ yes_this_is_supply_ship,
+ what_slave_planet,
+ i_lied,
+ plumb_out,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ first_give_info,
+ we_must_go_now,
+ where_can_i_get_radios,
+ ok_i_will_get_radios,
+ whats_this_starbase,
+ what_about_earth,
+ where_are_urquan,
+ our_mission_was_secret,
+ we_are_here_to_help,
+ tell_me_about_base,
+ we_will_take_care_of_base,
+ tell_me_again,
+ base_was_abandoned,
+ we_fought_them,
+ oh_yes_big_fight,
+ i_lied_it_was_abandoned,
+ i_cant_talk_about_it,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ i_lost_my_lander,
+ i_lost_another_lander,
+ need_fuel_mercury,
+ need_fuel_luna,
+ need_fuel_again,
+ what_was_red_thing,
+ it_went_away,
+ we_destroyed_it,
+ what_probe,
+ take_care_of_base_again,
+ goodbye_commander,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/commall.h b/src/uqm/comm/commall.h
new file mode 100644
index 0000000..4f8ebed
--- /dev/null
+++ b/src/uqm/comm/commall.h
@@ -0,0 +1,26 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef UQM_COMM_COMMALL_H_
+#define UQM_COMM_COMMALL_H_
+
+#include "uqm/colors.h"
+#include "uqm/comm.h"
+#include "uqm/commglue.h"
+#include "libs/reslib.h"
+
+#endif /* UQM_COMM_COMMALL_H_ */
+
diff --git a/src/uqm/comm/druuge/Makeinfo b/src/uqm/comm/druuge/Makeinfo
new file mode 100644
index 0000000..733ed6c
--- /dev/null
+++ b/src/uqm/comm/druuge/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="druugec.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/druuge/druugec.c b/src/uqm/comm/druuge/druugec.c
new file mode 100644
index 0000000..9a082c1
--- /dev/null
+++ b/src/uqm/comm/druuge/druugec.c
@@ -0,0 +1,926 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/setup.h"
+#include "uqm/sis.h"
+ // for DeltaSISGauges()
+
+
+static LOCDATA druuge_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ DRUUGE_PMAP_ANIM, /* AlienFrame */
+ DRUUGE_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ DRUUGE_COLOR_MAP, /* AlienColorMap */
+ DRUUGE_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ DRUUGE_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 11, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 5, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 9, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 19, /* StartIndex */
+ 3, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 25, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 28, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 31, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 33, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND * 7, ONE_SECOND * 3,/* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 40, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 10, 0, /* FrameRate */
+ ONE_SECOND * 3 / 10, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 44, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 5, 0, /* FrameRate */
+ ONE_SECOND / 5, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 4, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 12, ONE_SECOND / 12, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static COUNT SlaveryCount = 0;
+static BOOLEAN AttemptedSalvage = FALSE;
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, bye))
+ {
+ setSegue (Segue_peace);
+
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ if (SlaveryCount)
+ {
+ UWORD PreviousSlaves;
+
+ PreviousSlaves = MAKE_WORD (
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE0),
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE1)
+ );
+ SlaveryCount += PreviousSlaves;
+ if (SlaveryCount > 250 && PreviousSlaves <= 250)
+ {
+ if (PreviousSlaves > 100)
+ GLOBAL (CrewCost) += (22 - 7);
+ else
+ GLOBAL (CrewCost) += 22;
+ }
+ else if (SlaveryCount > 100 && PreviousSlaves <= 100)
+ GLOBAL (CrewCost) += 7;
+
+ SET_GAME_STATE (CREW_SOLD_TO_DRUUGE0, LOBYTE (SlaveryCount));
+ SET_GAME_STATE (CREW_SOLD_TO_DRUUGE1, HIBYTE (SlaveryCount));
+ }
+
+ switch (GET_GAME_STATE (DRUUGE_HOME_VISITS))
+ {
+ case 1:
+ NPCPhrase (BYE_FROM_TRADE_WORLD_1);
+ break;
+ default:
+ NPCPhrase (BYE_FROM_TRADE_WORLD_2);
+ break;
+ }
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ NPCPhrase (GOODBYE_FROM_BOMB_PLANET);
+ else
+ NPCPhrase (GOODBYE_FROM_SPACE);
+ }
+ else /* if (R == then_we_take_bomb) */
+ {
+ setSegue (Segue_hostile);
+
+ NPCPhrase (FIGHT_FOR_BOMB);
+ }
+}
+
+static void TradeWorld (RESPONSE_REF R);
+
+static void
+Buy (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, want_to_buy)
+ || PLAYER_SAID (R, im_ready_to_buy))
+ {
+ NPCPhrase (READY_TO_SELL);
+ if (!GET_GAME_STATE (ROSY_SPHERE))
+ NPCPhrase (HAVE_SPHERE);
+ if (!GET_GAME_STATE (ARTIFACT_2_ON_SHIP))
+ NPCPhrase (HAVE_ART_1);
+ if (!GET_GAME_STATE (ARTIFACT_3_ON_SHIP))
+ NPCPhrase (HAVE_ART_2);
+ NPCPhrase (SHIPS_AND_FUEL);
+
+ SET_GAME_STATE (KNOW_DRUUGE_SLAVERS, 3);
+ }
+ else if (PLAYER_SAID (R, buy_druuge_ship))
+ {
+#define SHIP_CREW_COST 100
+ if (GLOBAL_SIS (CrewEnlisted) < SHIP_CREW_COST)
+ NPCPhrase (NOT_ENOUGH_CREW);
+ else if (EscortFeasibilityStudy (DRUUGE_SHIP) == 0)
+ NPCPhrase (NOT_ENOUGH_ROOM);
+ else
+ {
+ DeltaSISGauges (-SHIP_CREW_COST, 0, 0);
+ SlaveryCount += SHIP_CREW_COST;
+ AddEscortShips (DRUUGE_SHIP, 1);
+
+ NPCPhrase (BOUGHT_SHIP);
+ }
+ }
+#define ARTIFACT_CREW_COST 100
+ else if (PLAYER_SAID (R, buy_rosy_sphere))
+ {
+ if (GLOBAL_SIS (CrewEnlisted) < ARTIFACT_CREW_COST)
+ NPCPhrase (NOT_ENOUGH_CREW);
+ else
+ {
+ DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
+ SlaveryCount += ARTIFACT_CREW_COST;
+ SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
+ SET_GAME_STATE (ROSY_SPHERE, 1);
+
+ NPCPhrase (BOUGHT_SPHERE);
+ }
+ }
+ else if (PLAYER_SAID (R, buy_art_1))
+ {
+ if (GLOBAL_SIS (CrewEnlisted) < ARTIFACT_CREW_COST)
+ NPCPhrase (NOT_ENOUGH_CREW);
+ else
+ {
+ DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
+ SlaveryCount += ARTIFACT_CREW_COST;
+ SET_GAME_STATE (ARTIFACT_2_ON_SHIP, 1);
+
+ NPCPhrase (BOUGHT_ART_1);
+ }
+ }
+ else if (PLAYER_SAID (R, buy_art_2))
+ {
+ if (GLOBAL_SIS (CrewEnlisted) < ARTIFACT_CREW_COST)
+ NPCPhrase (NOT_ENOUGH_CREW);
+ else
+ {
+ DeltaSISGauges (-ARTIFACT_CREW_COST, 0, 0);
+ SlaveryCount += ARTIFACT_CREW_COST;
+ SET_GAME_STATE (ARTIFACT_3_ON_SHIP, 1);
+
+ NPCPhrase (BOUGHT_ART_2);
+ }
+ }
+ else if (PLAYER_SAID (R, buy_fuel))
+ {
+#define FUEL_CREW_COST 10
+ if (GLOBAL_SIS (CrewEnlisted) < FUEL_CREW_COST)
+ NPCPhrase (NOT_ENOUGH_CREW);
+ else
+ {
+ DeltaSISGauges (-FUEL_CREW_COST,
+ FUEL_CREW_COST * FUEL_TANK_SCALE, 0);
+ SlaveryCount += FUEL_CREW_COST;
+
+ NPCPhrase (BOUGHT_FUEL);
+ }
+ }
+
+ Response (buy_druuge_ship, Buy);
+ if (!GET_GAME_STATE (ROSY_SPHERE))
+ Response (buy_rosy_sphere, Buy);
+ if (!GET_GAME_STATE (ARTIFACT_2_ON_SHIP))
+ Response (buy_art_1, Buy);
+ if (!GET_GAME_STATE (ARTIFACT_3_ON_SHIP))
+ Response (buy_art_2, Buy);
+ Response (buy_fuel, Buy);
+ Response (done_buying, TradeWorld);
+}
+
+static void Sell (RESPONSE_REF R);
+
+static RESPONSE_REF LastResponse = 0;
+
+static void
+Trade (RESPONSE_REF R)
+{
+ if (!PLAYER_SAID (R, whats_the_sphere_again))
+ {
+ NPCPhrase (TRADE_FOR_SPHERE);
+ LastResponse = R;
+ }
+ else
+ {
+ NPCPhrase (SPHERE_IS);
+
+ DISABLE_PHRASE (whats_the_sphere_again);
+ }
+
+ Response (no_way, Sell);
+ Response (way, Sell);
+ if (PHRASE_ENABLED (whats_the_sphere_again))
+ {
+ Response (whats_the_sphere_again, Trade);
+ }
+}
+
+static void
+DoTransaction (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, sell_maidens))
+ {
+ SET_GAME_STATE (MAIDENS_ON_SHIP, 0);
+ }
+ else if (PLAYER_SAID (R, sell_fragments))
+ {
+ BYTE num_frags;
+
+ if (GET_GAME_STATE (EGG_CASE0_ON_SHIP))
+ {
+ SET_GAME_STATE (EGG_CASE0_ON_SHIP, 0);
+ }
+ else if (GET_GAME_STATE (EGG_CASE1_ON_SHIP))
+ {
+ SET_GAME_STATE (EGG_CASE1_ON_SHIP, 0);
+ }
+ else if (GET_GAME_STATE (EGG_CASE2_ON_SHIP))
+ {
+ SET_GAME_STATE (EGG_CASE2_ON_SHIP, 0);
+ }
+
+ num_frags = GET_GAME_STATE (FRAGMENTS_BOUGHT) + 1;
+ SET_GAME_STATE (FRAGMENTS_BOUGHT, num_frags);
+ }
+ else if (PLAYER_SAID (R, sell_caster))
+ {
+ SET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP, 0);
+ }
+ else if (PLAYER_SAID (R, sell_spawner))
+ {
+ SET_GAME_STATE (PORTAL_SPAWNER_ON_SHIP, 0);
+ }
+
+ if (!GET_GAME_STATE (ROSY_SPHERE)
+ && GET_GAME_STATE (ROSY_SPHERE_ON_SHIP))
+ {
+ SET_GAME_STATE (ROSY_SPHERE, 1);
+ }
+ else
+ {
+ BYTE trade_gas;
+ BYTE ship_slots, ships_to_trade;
+
+ trade_gas = 0;
+ ships_to_trade = 0;
+ ship_slots = EscortFeasibilityStudy (DRUUGE_SHIP);
+ if (PLAYER_SAID (R, sell_maidens))
+ {
+ NPCPhrase (BOUGHT_MAIDENS);
+ ships_to_trade = 6;
+ }
+ else if (PLAYER_SAID (R, sell_fragments))
+ {
+ NPCPhrase (BOUGHT_FRAGMENTS);
+ ships_to_trade = 1;
+ }
+ else if (PLAYER_SAID (R, sell_caster))
+ {
+ NPCPhrase (BOUGHT_CASTER);
+ ships_to_trade = 0;
+ trade_gas = 1;
+ }
+ else if (PLAYER_SAID (R, sell_spawner))
+ {
+ NPCPhrase (BOUGHT_SPAWNER);
+ ships_to_trade = 3;
+ trade_gas = 1;
+ }
+
+ NPCPhrase (YOU_GET);
+ if (ships_to_trade)
+ {
+ AddEscortShips (DRUUGE_SHIP, ships_to_trade);
+
+ if (ship_slots >= ships_to_trade)
+ NPCPhrase (DEAL_FOR_STATED_SHIPS);
+ else if (ship_slots == 0)
+ NPCPhrase (DEAL_FOR_NO_SHIPS);
+ else
+ NPCPhrase (DEAL_FOR_LESS_SHIPS);
+
+ if (trade_gas)
+ NPCPhrase (YOU_ALSO_GET);
+ }
+
+ if (trade_gas)
+ {
+ BYTE slot;
+ COUNT f;
+ DWORD capacity;
+
+ capacity = FUEL_RESERVE;
+ slot = NUM_MODULE_SLOTS - 1;
+ do
+ {
+ if (GLOBAL_SIS (ModuleSlots[slot]) == FUEL_TANK
+ || GLOBAL_SIS (ModuleSlots[slot]) == HIGHEFF_FUELSYS)
+ {
+ COUNT volume;
+
+ volume = GLOBAL_SIS (ModuleSlots[slot]) == FUEL_TANK
+ ? FUEL_TANK_CAPACITY : HEFUEL_TANK_CAPACITY;
+ capacity += volume;
+ }
+ } while (slot--);
+ capacity -= GLOBAL_SIS (FuelOnBoard);
+ f = (COUNT)((capacity + (FUEL_TANK_SCALE >> 1)) / FUEL_TANK_SCALE);
+
+ while (capacity > 0x3FFFL)
+ {
+ DeltaSISGauges (0, 0x3FFF, 0);
+ capacity -= 0x3FFF;
+ }
+ DeltaSISGauges (0, (SIZE)capacity, 0);
+
+ NPCPhrase (FUEL0);
+ NPCNumber (f, NULL);
+ NPCPhrase (FUEL1);
+
+ if (f >= 250)
+ NPCPhrase (HIDEOUS_DEAL);
+ else if (f >= 100)
+ NPCPhrase (BAD_DEAL);
+ else if (f >= 50)
+ NPCPhrase (FAIR_DEAL);
+ else if (f >= 10)
+ NPCPhrase (GOOD_DEAL);
+ else
+ NPCPhrase (FINE_DEAL);
+ }
+ }
+}
+
+static void
+Sell (RESPONSE_REF R)
+{
+ RESPONSE_FUNC RespFunc;
+
+ if (PLAYER_SAID (R, want_to_sell))
+ NPCPhrase (READY_TO_BUY);
+ else if (PLAYER_SAID (R, no_way)
+ || PLAYER_SAID (R, way))
+ {
+ if (PLAYER_SAID (R, no_way))
+ NPCPhrase (OK_REGULAR_DEAL);
+ else
+ {
+ NPCPhrase (OK_HERES_SPHERE);
+
+ SET_GAME_STATE (ROSY_SPHERE_ON_SHIP, 1);
+ }
+
+ DoTransaction (LastResponse);
+ }
+ else if (PLAYER_SAID (R, sell_maidens)
+ || PLAYER_SAID (R, sell_fragments)
+ || PLAYER_SAID (R, sell_caster)
+ || PLAYER_SAID (R, sell_spawner))
+ {
+ DoTransaction (R);
+ }
+
+ if (!GET_GAME_STATE (ROSY_SPHERE))
+ RespFunc = (RESPONSE_FUNC)Trade;
+ else
+ RespFunc = (RESPONSE_FUNC)Sell;
+ if (GET_GAME_STATE (MAIDENS_ON_SHIP))
+ Response (sell_maidens, RespFunc);
+ if ((GET_GAME_STATE (EGG_CASE0_ON_SHIP)
+ || GET_GAME_STATE (EGG_CASE1_ON_SHIP)
+ || GET_GAME_STATE (EGG_CASE2_ON_SHIP))
+ && GET_GAME_STATE (FRAGMENTS_BOUGHT) < 2)
+ Response (sell_fragments, RespFunc);
+ if (GET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP))
+ Response (sell_caster, RespFunc);
+ if (GET_GAME_STATE (PORTAL_SPAWNER_ON_SHIP))
+ Response (sell_spawner, RespFunc);
+ Response (done_selling, TradeWorld);
+}
+
+static void
+ExplainSlaveTrade (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, want_to_buy))
+ NPCPhrase (WE_SELL_FOR_CREW);
+ else if (PLAYER_SAID (R, isnt_this_slave_trading))
+ {
+ NPCPhrase (NO_SLAVE_TRADE);
+
+ SET_GAME_STATE (KNOW_DRUUGE_SLAVERS, 1);
+ }
+ else if (PLAYER_SAID (R, what_do_with_crew))
+ {
+ NPCPhrase (HAVE_FUN);
+
+ SET_GAME_STATE (KNOW_DRUUGE_SLAVERS, 2);
+ }
+
+ switch (GET_GAME_STATE (KNOW_DRUUGE_SLAVERS))
+ {
+ case 0:
+ Response (isnt_this_slave_trading, ExplainSlaveTrade);
+ break;
+ case 1:
+ Response (what_do_with_crew, ExplainSlaveTrade);
+ break;
+ }
+ Response (i_will_never_trade_crew, TradeWorld);
+ Response (im_ready_to_buy, Buy);
+}
+
+static void
+TradeWorld (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_at_trade_world))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (DRUUGE_HOME_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GEN_INFO_AT_TRADE_WORLD_1);
+ break;
+ case 1:
+ NPCPhrase (GEN_INFO_AT_TRADE_WORLD_2);
+ break;
+ case 2:
+ NPCPhrase (GEN_INFO_AT_TRADE_WORLD_3);
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) < 2)
+ {
+ SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 2);
+ }
+ break;
+ case 3:
+ NPCPhrase (GEN_INFO_AT_TRADE_WORLD_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_HOME_INFO, NumVisits);
+ DISABLE_PHRASE (whats_up_at_trade_world);
+ }
+ else if (PLAYER_SAID (R, done_selling))
+ NPCPhrase (OK_DONE_SELLING);
+ else if (PLAYER_SAID (R, done_buying))
+ NPCPhrase (OK_DONE_BUYING);
+ else if (PLAYER_SAID (R, i_will_never_trade_crew))
+ NPCPhrase (YOUR_LOSS);
+
+ if (PHRASE_ENABLED (whats_up_at_trade_world))
+ {
+ Response (whats_up_at_trade_world, TradeWorld);
+ }
+ Response (want_to_sell, Sell);
+ if (GET_GAME_STATE (KNOW_DRUUGE_SLAVERS) == 3)
+ Response (want_to_buy, Buy);
+ else
+ Response (want_to_buy, ExplainSlaveTrade);
+ Response (bye, ExitConversation);
+}
+
+static void
+BombAmbush (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_at_bomb_planet))
+ {
+ NPCPhrase (GEN_INFO_AT_BOMB_PLANET);
+ SET_GAME_STATE (BOMB_VISITS, 2);
+ }
+ else if (PLAYER_SAID (R, we_get_bomb))
+ {
+ NPCPhrase (NOT_GET_BOMB);
+ SET_GAME_STATE (BOMB_VISITS, 3);
+ }
+
+ switch (GET_GAME_STATE (BOMB_VISITS))
+ {
+ case 1:
+ Response (whats_up_at_bomb_planet, BombAmbush);
+ break;
+ case 2:
+ Response (we_get_bomb, BombAmbush);
+ break;
+ default:
+ Response (then_we_take_bomb, ExitConversation);
+ break;
+ }
+ Response (bye, ExitConversation);
+}
+
+static void
+Space (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_in_space))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (DRUUGE_SPACE_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_IN_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_IN_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_IN_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_IN_SPACE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_SPACE_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_in_space);
+ }
+
+ if (PHRASE_ENABLED (whats_up_in_space))
+ {
+ Response (whats_up_in_space, Space);
+ }
+ Response (bye, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (DRUUGE_MANNER))
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (DRUUGE_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HSTL_TRADE_WORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HSTL_TRADE_WORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (DRUUGE_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_VISITS, NumVisits);
+ }
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ {
+ NumVisits = GET_GAME_STATE (DRUUGE_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INITIAL_TRADE_WORLD_HELLO);
+ break;
+ case 1:
+ NPCPhrase (SSQ_TRADE_WORLD_HELLO_1);
+ break;
+ case 2:
+ NPCPhrase (SSQ_TRADE_WORLD_HELLO_2);
+ break;
+ case 3:
+ NPCPhrase (SSQ_TRADE_WORLD_HELLO_3);
+ break;
+ case 4:
+ NPCPhrase (SSQ_TRADE_WORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_HOME_VISITS, NumVisits);
+ }
+ if (GET_GAME_STATE (ATTACKED_DRUUGE)
+ && !GET_GAME_STATE (DRUUGE_DISCLAIMER))
+ {
+ // There is no HOSTILE_TRADE voice track that we know of
+ // so this is currently disabled
+ //NPCPhrase (HOSTILE_TRADE);
+ SET_GAME_STATE (DRUUGE_DISCLAIMER, 1);
+ }
+ if (GET_GAME_STATE (MAIDENS_ON_SHIP)
+ && !GET_GAME_STATE (SCANNED_MAIDENS))
+ {
+ NPCPhrase (SCAN_MAIDENS);
+ SET_GAME_STATE (SCANNED_MAIDENS, 1);
+ }
+ if ((GET_GAME_STATE (EGG_CASE0_ON_SHIP)
+ || GET_GAME_STATE (EGG_CASE1_ON_SHIP)
+ || GET_GAME_STATE (EGG_CASE2_ON_SHIP))
+ && !GET_GAME_STATE (SCANNED_FRAGMENTS))
+ {
+ if (GET_GAME_STATE (FRAGMENTS_BOUGHT) < 2)
+ NPCPhrase (SCAN_FRAGMENTS);
+ else
+ NPCPhrase (ENOUGH_FRAGMENTS);
+ SET_GAME_STATE (SCANNED_FRAGMENTS, 1);
+ }
+ if (GET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP)
+ && !GET_GAME_STATE (SCANNED_CASTER))
+ {
+ NPCPhrase (SCAN_DRUUGE_CASTER);
+ SET_GAME_STATE (SCANNED_CASTER, 1);
+ }
+ if (GET_GAME_STATE (PORTAL_SPAWNER_ON_SHIP)
+ && !GET_GAME_STATE (SCANNED_SPAWNER))
+ {
+ NPCPhrase (SCAN_ARILOU_SPAWNER);
+ SET_GAME_STATE (SCANNED_SPAWNER, 1);
+ }
+
+ TradeWorld ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ if (GET_GAME_STATE (BOMB_VISITS))
+ NPCPhrase (SUBSEQ_BOMB_WORLD_HELLO);
+ else
+ {
+ NPCPhrase (INIT_BOMB_WORLD_HELLO);
+ SET_GAME_STATE (BOMB_VISITS, 1);
+ }
+
+ BombAmbush ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (ATTACKED_DRUUGE))
+ {
+ NumVisits = GET_GAME_STATE (DRUUGE_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ NumVisits = 0;
+ if (GetHeadLink (&GLOBAL (built_ship_q)) == 0)
+ {
+ for (NumVisits = 0; NumVisits < NUM_MODULE_SLOTS; ++NumVisits)
+ {
+ BYTE which_module;
+
+ which_module = GLOBAL_SIS (ModuleSlots[NumVisits]);
+ if (which_module >= GUN_WEAPON
+ && which_module <= CANNON_WEAPON)
+ {
+ NumVisits = 0;
+ break;
+ }
+ }
+ }
+
+ if (NumVisits)
+ {
+ NumVisits = GET_GAME_STATE (DRUUGE_SALVAGE);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (SALVAGE_YOUR_SHIP_1);
+ break;
+ case 1:
+ NPCPhrase (SALVAGE_YOUR_SHIP_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_SALVAGE, NumVisits);
+
+ setSegue (Segue_hostile);
+ AttemptedSalvage = TRUE;
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (DRUUGE_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_SPACE_HELLO);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_SPACE_HELLO);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (DRUUGE_VISITS, NumVisits);
+
+ Space ((RESPONSE_REF)0);
+ }
+ }
+}
+
+static COUNT
+uninit_druuge (void)
+{
+ return (0);
+}
+
+static void
+post_druuge_enc (void)
+{
+ if (getSegue () == Segue_hostile
+ && !AttemptedSalvage
+ && !GET_GAME_STATE (DRUUGE_MANNER))
+ {
+ if (!GET_GAME_STATE (ATTACKED_DRUUGE))
+ {
+ SET_GAME_STATE (ATTACKED_DRUUGE, 1);
+ SET_GAME_STATE (DRUUGE_VISITS, 0);
+ }
+ }
+}
+
+LOCDATA*
+init_druuge_comm (void)
+{
+ LOCDATA *retval;
+
+ SlaveryCount = 0;
+ AttemptedSalvage = FALSE;
+
+ druuge_desc.init_encounter_func = Intro;
+ druuge_desc.post_encounter_func = post_druuge_enc;
+ druuge_desc.uninit_encounter_func = uninit_druuge;
+
+ druuge_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ druuge_desc.AlienTextBaseline.y = 70;
+ druuge_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if ((GET_GAME_STATE (DRUUGE_MANNER) == 0
+ && (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7)))
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &druuge_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/druuge/resinst.h b/src/uqm/comm/druuge/resinst.h
new file mode 100644
index 0000000..ca82a22
--- /dev/null
+++ b/src/uqm/comm/druuge/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define DRUUGE_COLOR_MAP "comm.druuge.colortable"
+#define DRUUGE_CONVERSATION_PHRASES "comm.druuge.dialogue"
+#define DRUUGE_FONT "comm.druuge.font"
+#define DRUUGE_MUSIC "comm.druuge.music"
+#define DRUUGE_PMAP_ANIM "comm.druuge.graphics"
diff --git a/src/uqm/comm/druuge/strings.h b/src/uqm/comm/druuge/strings.h
new file mode 100644
index 0000000..e9dfde9
--- /dev/null
+++ b/src/uqm/comm/druuge/strings.h
@@ -0,0 +1,132 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef DRUUGE_STRINGS_H
+#define DRUUGE_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ AMBUSH_IS_FIRST_HELLO,
+ INIT_BOMB_WORLD_HELLO,
+ SUBSEQ_BOMB_WORLD_HELLO,
+ whats_up_at_bomb_planet,
+ GEN_INFO_AT_BOMB_PLANET,
+ we_get_bomb,
+ NOT_GET_BOMB,
+ then_we_take_bomb,
+ FIGHT_FOR_BOMB,
+ GOODBYE_FROM_BOMB_PLANET,
+ NOT_ENOUGH_ROOM,
+ TRADE_FOR_SPHERE,
+ no_way,
+ OK_REGULAR_DEAL,
+ way,
+ OK_HERES_SPHERE,
+ whats_the_sphere_again,
+ SPHERE_IS,
+ WE_SELL_FOR_CREW,
+ i_will_never_trade_crew,
+ YOUR_LOSS,
+ isnt_this_slave_trading,
+ NO_SLAVE_TRADE,
+ what_do_with_crew,
+ HAVE_FUN,
+ im_ready_to_buy,
+ THIS_FOR_SALE,
+ HAVE_SPHERE,
+ HAVE_ART_2,
+ HAVE_ART_1,
+ SHIPS_AND_FUEL,
+ BOUGHT_SHIP,
+ BOUGHT_FUEL,
+ BOUGHT_ART_2,
+ BOUGHT_ART_1,
+ BOUGHT_SPHERE,
+ repeat_what_to_sell,
+ INIT_SPACE_HELLO,
+ SUBSEQUENT_SPACE_HELLO,
+ whats_up_in_space,
+ GENERAL_INFO_IN_SPACE_1,
+ GENERAL_INFO_IN_SPACE_2,
+ GENERAL_INFO_IN_SPACE_3,
+ GENERAL_INFO_IN_SPACE_4,
+ GOODBYE_FROM_SPACE,
+ HSTL_TRADE_WORLD_HELLO_1,
+ HSTL_TRADE_WORLD_HELLO_2,
+ HOSTILE_SPACE_HELLO_1,
+ HOSTILE_SPACE_HELLO_2,
+ INITIAL_TRADE_WORLD_HELLO,
+ SSQ_TRADE_WORLD_HELLO_1,
+ SSQ_TRADE_WORLD_HELLO_2,
+ SSQ_TRADE_WORLD_HELLO_3,
+ SSQ_TRADE_WORLD_HELLO_4,
+ whats_up_at_trade_world,
+ GEN_INFO_AT_TRADE_WORLD_1,
+ GEN_INFO_AT_TRADE_WORLD_2,
+ GEN_INFO_AT_TRADE_WORLD_3,
+ GEN_INFO_AT_TRADE_WORLD_4,
+ SCAN_MAIDENS,
+ SCAN_FRAGMENTS,
+ SCAN_DRUUGE_CASTER,
+ SCAN_ARILOU_SPAWNER,
+ ENOUGH_FRAGMENTS,
+ READY_TO_BUY,
+ READY_TO_SELL,
+ BYE_FROM_TRADE_WORLD_1,
+ BYE_FROM_TRADE_WORLD_2,
+ NOT_ENOUGH_CREW,
+ EXCHANGE_MADE,
+ OK_DONE_BUYING,
+ OK_DONE_SELLING,
+ bye,
+ want_to_sell,
+ want_to_buy,
+ buy_druuge_ship,
+ buy_fuel,
+ buy_art_1,
+ buy_art_2,
+ buy_rosy_sphere,
+ done_buying,
+ done_selling,
+ sell_maidens,
+ sell_caster,
+ sell_fragments,
+ sell_spawner,
+ BOUGHT_MAIDENS,
+ BOUGHT_FRAGMENTS,
+ BOUGHT_CASTER,
+ YOU_GET,
+ YOU_ALSO_GET,
+ BOUGHT_SPAWNER,
+ SALVAGE_YOUR_SHIP_1,
+ SALVAGE_YOUR_SHIP_2,
+ DEAL_FOR_STATED_SHIPS,
+ DEAL_FOR_LESS_SHIPS,
+ DEAL_FOR_NO_SHIPS,
+ FUEL0,
+ FUEL1,
+ HIDEOUS_DEAL,
+ BAD_DEAL,
+ FAIR_DEAL,
+ GOOD_DEAL,
+ FINE_DEAL,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/ilwrath/Makeinfo b/src/uqm/comm/ilwrath/Makeinfo
new file mode 100644
index 0000000..3f40e79
--- /dev/null
+++ b/src/uqm/comm/ilwrath/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="ilwrathc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/ilwrath/ilwrathc.c b/src/uqm/comm/ilwrath/ilwrathc.c
new file mode 100644
index 0000000..1afd812
--- /dev/null
+++ b/src/uqm/comm/ilwrath/ilwrathc.c
@@ -0,0 +1,649 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/gameev.h"
+
+
+static LOCDATA ilwrath_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ ILWRATH_PMAP_ANIM, /* AlienFrame */
+ ILWRATH_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ ILWRATH_COLOR_MAP, /* AlienColorMap */
+ ILWRATH_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ ILWRATH_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 4, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 6, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 11, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 16, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 21, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 5, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, you_are_weak))
+ NPCPhrase (STRENGTH_NOT_ALL);
+ else if (PLAYER_SAID (R, slay_by_thousands))
+ NPCPhrase (NO_SLAY_BY_THOUSANDS);
+ else if (PLAYER_SAID (R, ease_up))
+ NPCPhrase (NO_EASE_UP);
+ else if (PLAYER_SAID (R, bye_space))
+ NPCPhrase (GOODBYE_AND_DIE_SPACE);
+ else if (PLAYER_SAID (R, bye_homeworld))
+ NPCPhrase (GOODBYE_AND_DIE_HOMEWORLD);
+ else if (PLAYER_SAID (R, want_peace))
+ NPCPhrase (NO_PEACE);
+ else if (PLAYER_SAID (R, want_alliance))
+ NPCPhrase (NO_ALLIANCE);
+ else if (PLAYER_SAID (R, but_evil_is_defined))
+ NPCPhrase (DONT_CONFUSE_US);
+ else if (PLAYER_SAID (R, bye_gods))
+ {
+ NPCPhrase (GOODBYE_GODS);
+
+ setSegue (Segue_peace);
+ }
+ if (PLAYER_SAID (R, whats_up))
+ {
+ NPCPhrase (GENERAL_INFO);
+ Response (bye, CombatIsInevitable);
+ }
+ else if (PLAYER_SAID (R, whats_up_space_1)
+ || PLAYER_SAID (R, whats_up_space_2)
+ || PLAYER_SAID (R, whats_up_space_3)
+ || PLAYER_SAID (R, whats_up_space_4)
+ || PLAYER_SAID (R, whats_up_space_5))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (ILWRATH_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_SPACE_4);
+ break;
+ case 4:
+ NPCPhrase (GENERAL_INFO_SPACE_5);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ILWRATH_INFO, NumVisits);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, bye))
+ NPCPhrase (GOODBYE_AND_DIE);
+ else if (PLAYER_SAID (R, where_you_come_from))
+ NPCPhrase (CAME_FROM);
+ if (PLAYER_SAID (R, it_will_be_a_pleasure))
+ NPCPhrase (WHO_BLASTS_WHO);
+ if (PLAYER_SAID (R, surrender))
+ NPCPhrase (NO_SURRENDER);
+ if (PLAYER_SAID (R, be_reasonable))
+ NPCPhrase (NOT_REASONABLE);
+ }
+}
+
+static void IlwrathHome (RESPONSE_REF R);
+
+static void
+IlwrathGods (RESPONSE_REF R)
+{
+ BYTE GodsLeft;
+
+ GodsLeft = FALSE;
+ if (PLAYER_SAID (R, want_info_on_gods))
+ NPCPhrase (SO_MUCH_TO_KNOW);
+ else if (PLAYER_SAID (R, when_start_worship))
+ {
+ NPCPhrase (LONG_AGO);
+
+ DISABLE_PHRASE (when_start_worship);
+ }
+ else if (PLAYER_SAID (R, any_good_gods))
+ {
+ NPCPhrase (KILLED_GOOD_GODS);
+
+ DISABLE_PHRASE (any_good_gods);
+ }
+ else if (PLAYER_SAID (R, how_talk_with_gods))
+ {
+ NPCPhrase (CHANNEL_44);
+
+ DISABLE_PHRASE (how_talk_with_gods);
+ }
+ else if (PLAYER_SAID (R, why_44))
+ {
+ NPCPhrase (BECAUSE_44);
+
+ DISABLE_PHRASE (why_44);
+ }
+
+ if (PHRASE_ENABLED (when_start_worship))
+ {
+ Response (when_start_worship, IlwrathGods);
+ GodsLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (any_good_gods))
+ {
+ Response (any_good_gods, IlwrathGods);
+ GodsLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (how_talk_with_gods))
+ {
+ Response (how_talk_with_gods, IlwrathGods);
+ GodsLeft = TRUE;
+ }
+ else if (PHRASE_ENABLED (why_44))
+ {
+ Response (why_44, IlwrathGods);
+ GodsLeft = TRUE;
+ }
+ Response (enough_gods, IlwrathHome);
+
+ if (!GodsLeft)
+ DISABLE_PHRASE (want_info_on_gods);
+}
+
+static void
+IlwrathInfo (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ InfoLeft = FALSE;
+ if (PLAYER_SAID (R, want_info_on_ilwrath))
+ NPCPhrase (WHAT_ABOUT_ILWRATH);
+ else if (PLAYER_SAID (R, what_about_physio))
+ {
+ NPCPhrase (ABOUT_PHYSIO);
+
+ DISABLE_PHRASE (what_about_physio);
+ }
+ else if (PLAYER_SAID (R, what_about_history))
+ {
+ NPCPhrase (ABOUT_HISTORY);
+
+ DISABLE_PHRASE (what_about_history);
+ }
+ else if (PLAYER_SAID (R, what_about_culture))
+ {
+ NPCPhrase (ABOUT_CULTURE);
+
+ DISABLE_PHRASE (what_about_culture);
+ }
+ else if (PLAYER_SAID (R, what_about_urquan))
+ {
+ NPCPhrase (URQUAN_TOO_NICE);
+
+ DISABLE_PHRASE (what_about_urquan);
+ }
+ else if (PLAYER_SAID (R, are_you_evil))
+ {
+ NPCPhrase (OF_COURSE_WERE_EVIL);
+
+ DISABLE_PHRASE (are_you_evil);
+ }
+
+ if (PHRASE_ENABLED (what_about_physio))
+ {
+ Response (what_about_physio, IlwrathInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_history))
+ {
+ Response (what_about_history, IlwrathInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_culture))
+ {
+ Response (what_about_culture, IlwrathInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_urquan))
+ {
+ Response (what_about_urquan, IlwrathInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (are_you_evil))
+ {
+ Response (are_you_evil, IlwrathInfo);
+ InfoLeft = TRUE;
+ }
+ else
+ {
+ Response (but_evil_is_defined, CombatIsInevitable);
+ InfoLeft = TRUE;
+ }
+ Response (enough_ilwrath, IlwrathHome);
+
+ if (!InfoLeft)
+ DISABLE_PHRASE (want_info_on_ilwrath);
+}
+
+static void
+IlwrathHome (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (ILWRATH_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_HOME_HELLO);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_HOME_HELLO);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ILWRATH_HOME_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, enough_gods))
+ NPCPhrase (OK_ENOUGH_GODS);
+ else if (PLAYER_SAID (R, enough_ilwrath))
+ NPCPhrase (OK_ENOUGH_ILWRATH);
+
+ if (PHRASE_ENABLED (want_info_on_gods))
+ {
+ Response (want_info_on_gods, IlwrathGods);
+ }
+ if (PHRASE_ENABLED (want_info_on_ilwrath))
+ {
+ Response (want_info_on_ilwrath, IlwrathInfo);
+ }
+ Response (want_peace, CombatIsInevitable);
+ Response (want_alliance, CombatIsInevitable);
+ Response (bye_homeworld, CombatIsInevitable);
+}
+
+static void GodsSpeak (RESPONSE_REF R);
+
+static void
+GodsOrder (RESPONSE_REF R)
+{
+ BYTE OrdersLeft;
+
+ OrdersLeft = FALSE;
+ if (PLAYER_SAID (R, other_divine_orders))
+ NPCPhrase (WHAT_ORDERS);
+ else if (PLAYER_SAID (R, say_warship))
+ {
+ NPCPhrase (OK_WARSHIP);
+
+ DISABLE_PHRASE (say_warship);
+ }
+ else if (PLAYER_SAID (R, say_dwe))
+ {
+ NPCPhrase (OK_DWE);
+
+ DISABLE_PHRASE (say_dwe);
+ }
+ else if (PLAYER_SAID (R, say_youboo))
+ {
+ NPCPhrase (OK_YOUBOO);
+
+ DISABLE_PHRASE (say_youboo);
+ }
+ else if (PLAYER_SAID (R, say_dillrat))
+ {
+ NPCPhrase (OK_DILRAT);
+
+ DISABLE_PHRASE (say_dillrat);
+ }
+
+ if (PHRASE_ENABLED (say_warship))
+ {
+ Response (say_warship, GodsOrder);
+ OrdersLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (say_dwe))
+ {
+ Response (say_dwe, GodsOrder);
+ OrdersLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (say_youboo))
+ {
+ Response (say_youboo, GodsOrder);
+ OrdersLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (say_dillrat))
+ {
+ Response (say_dillrat, GodsOrder);
+ OrdersLeft = TRUE;
+ }
+ Response (enough_orders, GodsSpeak);
+
+ if (!OrdersLeft)
+ DISABLE_PHRASE (other_divine_orders);
+}
+
+static void
+GodsSpeak (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (R == 0)
+ {
+ if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
+ NPCPhrase (GLORIOUS_WORSHIP);
+ else if (GET_GAME_STATE (ILWRATH_DECEIVED))
+ NPCPhrase (ON_WAY);
+ else
+ {
+ NumVisits = GET_GAME_STATE (ILWRATH_GODS_SPOKEN);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ILWRATH_BELIEVE);
+ break;
+ case 1:
+ NPCPhrase (GODS_RETURN_1);
+ break;
+ case 2:
+ NPCPhrase (GODS_RETURN_2);
+ break;
+ case 3:
+ NPCPhrase (GODS_RETURN_3);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ILWRATH_GODS_SPOKEN, NumVisits);
+ }
+ }
+ else if (PLAYER_SAID (R, go_kill_thraddash))
+ {
+ NPCPhrase (OK_KILL_THRADDASH);
+
+ SET_GAME_STATE (ILWRATH_DECEIVED, 1);
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_ILWRATH_MISSION);
+ }
+ else if (PLAYER_SAID (R, worship_us))
+ {
+ NumVisits = GET_GAME_STATE (ILWRATH_WORSHIP);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (WE_WORSHIP_1);
+ break;
+ case 1:
+ NPCPhrase (WE_WORSHIP_2);
+ break;
+ case 2:
+ NPCPhrase (WE_WORSHIP_3);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ILWRATH_WORSHIP, NumVisits);
+
+ DISABLE_PHRASE (worship_us);
+ }
+ else if (PLAYER_SAID (R, enough_orders))
+ NPCPhrase (NEVER_ENOUGH);
+
+ if (!GET_GAME_STATE (ILWRATH_DECEIVED))
+ Response (go_kill_thraddash, GodsSpeak);
+ if (PHRASE_ENABLED (worship_us))
+ Response (worship_us, GodsSpeak);
+ if (PHRASE_ENABLED (other_divine_orders))
+ {
+ Response (other_divine_orders, GodsOrder);
+ }
+ Response (bye_gods, CombatIsInevitable);
+}
+
+static void
+IlwrathSpace (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (R == 0)
+ {
+ NumVisits = GET_GAME_STATE (ILWRATH_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_HELLO_SPACE);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_HELLO_SPACE_1);
+ break;
+ case 2:
+ NPCPhrase (SUBSEQUENT_HELLO_SPACE_2);
+ break;
+ case 3:
+ NPCPhrase (SUBSEQUENT_HELLO_SPACE_3);
+ break;
+ case 4:
+ NPCPhrase (SUBSEQUENT_HELLO_SPACE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ILWRATH_VISITS, NumVisits);
+ }
+
+ NumVisits = GET_GAME_STATE (ILWRATH_INFO);
+ switch (NumVisits)
+ {
+ case 0:
+ Response (whats_up_space_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (whats_up_space_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (whats_up_space_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (whats_up_space_4, CombatIsInevitable);
+ break;
+ case 4:
+ Response (whats_up_space_5, CombatIsInevitable);
+ break;
+ }
+ Response (you_are_weak, CombatIsInevitable);
+ Response (slay_by_thousands, CombatIsInevitable);
+ Response (ease_up, CombatIsInevitable);
+ Response (bye_space, CombatIsInevitable);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (GET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER))
+ {
+ NPCPhrase (SEND_MESSAGE);
+
+ Response (where_you_come_from, CombatIsInevitable);
+ Response (it_will_be_a_pleasure, CombatIsInevitable);
+ Response (surrender, CombatIsInevitable);
+ Response (be_reasonable, CombatIsInevitable);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ IlwrathHome ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NumVisits = GET_GAME_STATE (ILWRATH_CHMMR_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_CHMMR_HELLO);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_CHMMR_HELLO);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ILWRATH_CHMMR_VISITS, NumVisits);
+
+ Response (whats_up, CombatIsInevitable);
+ Response (bye, CombatIsInevitable);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 5))
+ {
+ // Communicating with an Ilwrath ship using a HyperWave Broadcaster.
+ if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
+ NPCPhrase (BIG_FUN);
+ else if (GET_GAME_STATE (ILWRATH_DECEIVED))
+ NPCPhrase (FAST_AS_CAN);
+ else
+ NPCPhrase (JUST_GRUNTS);
+
+ setSegue (Segue_peace);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 4))
+ {
+ // Communicating with the Ilwrath homeworld using a
+ // Hyperwave Broadcaster.
+ GodsSpeak ((RESPONSE_REF)0);
+ }
+ else
+ {
+ setSegue (Segue_peace);
+
+ if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
+ NPCPhrase (HAPPY_FIGHTING_THRADDASH);
+ else if (GET_GAME_STATE (ILWRATH_DECEIVED))
+ NPCPhrase (ON_WAY_TO_THRADDASH);
+ else
+ IlwrathSpace ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_ilwrath (void)
+{
+ return (0);
+}
+
+static void
+post_ilwrath_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_ilwrath_comm (void)
+{
+ LOCDATA *retval;
+
+ ilwrath_desc.init_encounter_func = Intro;
+ ilwrath_desc.post_encounter_func = post_ilwrath_enc;
+ ilwrath_desc.uninit_encounter_func = uninit_ilwrath;
+
+ ilwrath_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ ilwrath_desc.AlienTextBaseline.y = 70;
+ ilwrath_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (PROBE_ILWRATH_ENCOUNTER)
+ || (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA)
+ & ((1 << 4) | (1 << 5)))
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &ilwrath_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/ilwrath/resinst.h b/src/uqm/comm/ilwrath/resinst.h
new file mode 100644
index 0000000..7063e39
--- /dev/null
+++ b/src/uqm/comm/ilwrath/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define ILWRATH_COLOR_MAP "comm.ilwrath.colortable"
+#define ILWRATH_CONVERSATION_PHRASES "comm.ilwrath.dialogue"
+#define ILWRATH_FONT "comm.ilwrath.font"
+#define ILWRATH_MUSIC "comm.ilwrath.music"
+#define ILWRATH_PMAP_ANIM "comm.ilwrath.graphics"
diff --git a/src/uqm/comm/ilwrath/strings.h b/src/uqm/comm/ilwrath/strings.h
new file mode 100644
index 0000000..9cd4d26
--- /dev/null
+++ b/src/uqm/comm/ilwrath/strings.h
@@ -0,0 +1,135 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ILWRATH_STRINGS_H
+#define ILWRATH_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ NEVER_ENOUGH,
+ OK_WARSHIP,
+ OK_DWE,
+ OK_YOUBOO,
+ OK_DILRAT,
+ BIG_FUN,
+ FAST_AS_CAN,
+ GLORIOUS_WORSHIP,
+ ON_WAY,
+ GODS_RETURN_1,
+ GODS_RETURN_2,
+ GODS_RETURN_3,
+ JUST_GRUNTS,
+ GRUNTS_AGAIN,
+ WHAT_ORDERS,
+ WE_WORSHIP_1,
+ WE_WORSHIP_2,
+ WE_WORSHIP_3,
+ SUBSEQUENT_CHMMR_HELLO,
+ INIT_CHMMR_HELLO,
+ OK_ENOUGH_ILWRATH,
+ OK_ENOUGH_GODS,
+ SEND_MESSAGE,
+ CAME_FROM,
+ WHO_BLASTS_WHO,
+ NO_SURRENDER,
+ NOT_REASONABLE,
+ SUBSEQUENT_HOME_HELLO,
+ GENERAL_INFO,
+ GOODBYE_AND_DIE,
+ DECEIVERS,
+ NO_PEACE,
+ NO_ALLIANCE,
+ ILWRATH_BELIEVE,
+ OK_KILL_THRADDASH,
+ GOODBYE_GODS,
+ INIT_HELLO_SPACE,
+ SUBSEQUENT_HELLO_SPACE_1,
+ SUBSEQUENT_HELLO_SPACE_2,
+ SUBSEQUENT_HELLO_SPACE_3,
+ SUBSEQUENT_HELLO_SPACE_4,
+ GENERAL_INFO_SPACE_1,
+ GENERAL_INFO_SPACE_2,
+ GENERAL_INFO_SPACE_3,
+ GENERAL_INFO_SPACE_4,
+ GENERAL_INFO_SPACE_5,
+ STRENGTH_NOT_ALL,
+ NO_SLAY_BY_THOUSANDS,
+ NO_EASE_UP,
+ GOODBYE_AND_DIE_SPACE,
+ INIT_HOME_HELLO,
+ GOODBYE_AND_DIE_HOMEWORLD,
+ SO_MUCH_TO_KNOW,
+ LONG_AGO,
+ KILLED_GOOD_GODS,
+ CHANNEL_44,
+ BECAUSE_44,
+ WHAT_ABOUT_ILWRATH,
+ ABOUT_PHYSIO,
+ ABOUT_HISTORY,
+ ABOUT_CULTURE,
+ ABOUT_URQUAN,
+ URQUAN_TOO_NICE,
+ OF_COURSE_WERE_EVIL,
+ DONT_CONFUSE_US,
+ ON_WAY_TO_THRADDASH,
+ HAPPY_FIGHTING_THRADDASH,
+
+ say_warship,
+ say_dwe,
+ say_youboo,
+ say_dillrat,
+ enough_orders,
+ other_divine_orders,
+ worship_us,
+ bye_gods,
+ enough_ilwrath,
+ enough_gods,
+ where_you_come_from,
+ it_will_be_a_pleasure,
+ be_reasonable,
+ surrender,
+ whats_up,
+ bye,
+ want_peace,
+ want_alliance,
+ go_kill_thraddash,
+ whats_up_space_1,
+ whats_up_space_2,
+ whats_up_space_3,
+ whats_up_space_4,
+ whats_up_space_5,
+ you_are_weak,
+ slay_by_thousands,
+ ease_up,
+ bye_space,
+ bye_homeworld,
+ want_info_on_gods,
+ when_start_worship,
+ any_good_gods,
+ how_talk_with_gods,
+ why_44,
+ want_info_on_ilwrath,
+ what_about_physio,
+ what_about_history,
+ what_about_culture,
+ what_about_urquan,
+ are_you_evil,
+ but_evil_is_defined,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/melnorm/Makeinfo b/src/uqm/comm/melnorm/Makeinfo
new file mode 100644
index 0000000..5e3a214
--- /dev/null
+++ b/src/uqm/comm/melnorm/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="melnorm.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/melnorm/melnorm.c b/src/uqm/comm/melnorm/melnorm.c
new file mode 100644
index 0000000..00b6a07
--- /dev/null
+++ b/src/uqm/comm/melnorm/melnorm.c
@@ -0,0 +1,1855 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/gameev.h"
+#include "uqm/shipcont.h"
+#include "libs/inplib.h"
+#include "libs/mathlib.h"
+
+#include "uqm/hyper.h"
+ // for SOL_X/SOL_Y
+#include "uqm/planets/planets.h"
+ // for xxx_DISASTER
+#include "uqm/sis.h"
+
+
+static const NUMBER_SPEECH_DESC melnorme_numbers_english;
+
+static LOCDATA melnorme_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ MELNORME_PMAP_ANIM, /* AlienFrame */
+ MELNORME_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ MELNORME_COLOR_MAP, /* AlienColorMap */
+ MELNORME_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ MELNORME_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 4, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 6, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND * 4, ONE_SECOND * 4,/* RestartRate */
+ (1 << 1), /* BlockMask */
+ },
+ {
+ 11, /* StartIndex */
+ 9, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND * 4, ONE_SECOND * 4,/* RestartRate */
+ (1 << 0), /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 5, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ &melnorme_numbers_english, /* AlienNumberSpeech - default */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static COUNT melnorme_digit_names[] =
+{
+ ENUMERATE_ZERO,
+ ENUMERATE_ONE,
+ ENUMERATE_TWO,
+ ENUMERATE_THREE,
+ ENUMERATE_FOUR,
+ ENUMERATE_FIVE,
+ ENUMERATE_SIX,
+ ENUMERATE_SEVEN,
+ ENUMERATE_EIGHT,
+ ENUMERATE_NINE
+};
+
+static COUNT melnorme_teen_names[] =
+{
+ ENUMERATE_TEN,
+ ENUMERATE_ELEVEN,
+ ENUMERATE_TWELVE,
+ ENUMERATE_THIRTEEN,
+ ENUMERATE_FOURTEEN,
+ ENUMERATE_FIFTEEN,
+ ENUMERATE_SIXTEEN,
+ ENUMERATE_SEVENTEEN,
+ ENUMERATE_EIGHTEEN,
+ ENUMERATE_NINETEEN
+};
+
+static COUNT melnorme_tens_names[] =
+{
+ 0, /* invalid */
+ 0, /* skip digit */
+ ENUMERATE_TWENTY,
+ ENUMERATE_THIRTY,
+ ENUMERATE_FOURTY,
+ ENUMERATE_FIFTY,
+ ENUMERATE_SIXTY,
+ ENUMERATE_SEVENTY,
+ ENUMERATE_EIGHTY,
+ ENUMERATE_NINETY
+};
+
+static const NUMBER_SPEECH_DESC melnorme_numbers_english =
+{
+ 5, /* NumDigits */
+ {
+ { /* 1000-999999 */
+ 1000, /* Divider */
+ 0, /* Subtrahend */
+ NULL, /* StrDigits - recurse */
+ NULL, /* Names - not used */
+ ENUMERATE_THOUSAND /* CommonIndex */
+ },
+ { /* 100-999 */
+ 100, /* Divider */
+ 0, /* Subtrahend */
+ melnorme_digit_names, /* StrDigits */
+ NULL, /* Names - not used */
+ ENUMERATE_HUNDRED /* CommonIndex */
+ },
+ { /* 20-99 */
+ 10, /* Divider */
+ 0, /* Subtrahend */
+ melnorme_tens_names, /* StrDigits */
+ NULL, /* Names - not used */
+ 0 /* CommonIndex - not used */
+ },
+ { /* 10-19 */
+ 1, /* Divider */
+ 10, /* Subtrahend */
+ melnorme_teen_names, /* StrDigits */
+ NULL, /* Names - not used */
+ 0 /* CommonIndex - not used */
+ },
+ { /* 0-9 */
+ 1, /* Divider */
+ 0, /* Subtrahend */
+ melnorme_digit_names, /* StrDigits */
+ NULL, /* Names - not used */
+ 0 /* CommonIndex - not used */
+ }
+ }
+};
+
+#define ARRAY_SIZE(array) (sizeof(array) / sizeof (*array))
+
+
+//////////////Technology System///////////////////////
+// This section deals with enabling and checking for
+// various technologies. It should probably be
+// migrated to its own file.
+
+// Identifiers for the various technologies
+typedef enum
+{
+ TECH_MODULE_BLASTER,
+ TECH_LANDER_SPEED,
+ TECH_MODULE_ANTIMISSILE,
+ TECH_LANDER_SHIELD_BIO,
+ TECH_LANDER_CARGO,
+ TECH_MODULE_BIGFUELTANK,
+ TECH_LANDER_RAPIDFIRE,
+ TECH_LANDER_SHIELD_QUAKE,
+ TECH_MODULE_TRACKING,
+ TECH_LANDER_SHIELD_LIGHTNING,
+ TECH_LANDER_SHIELD_HEAT,
+ TECH_MODULE_CANNON,
+ TECH_MODULE_FURNACE,
+} TechId_t;
+
+// Group the technologies into three subtypes
+typedef enum
+{
+ TECH_TYPE_MODULE, // Flagship modules
+ // subtype = moduleId, info = cost
+ // Cost will be scaled by MODULE_COST_SCALE.
+ TECH_TYPE_LANDER_SHIELD, // Lander shield enhancements
+ // subtype = disaster type, info = unused
+ TECH_TYPE_STATE // Other game state changes
+ // subtype = stateId, info = state value
+} TechType_t;
+
+
+// Define the information specifying a particular technology
+typedef struct
+{
+ TechId_t id; // ID of the technology
+ TechType_t type; // Type of the technology
+ int subtype; // Subtype of the technology
+ int info; // Supplemental information
+} TechData;
+
+
+// A table of the available technologies.
+// This should really be an associative map of TechIds to tech data records,
+// but implementing that would be excessive.
+static const TechData tech_data_table[] =
+{
+ // Tech ID Tech Type, Supplemental info
+ { TECH_MODULE_BLASTER, TECH_TYPE_MODULE, BLASTER_WEAPON, 4000 },
+ { TECH_LANDER_SPEED, TECH_TYPE_STATE, IMPROVED_LANDER_SPEED, 1 },
+ { TECH_MODULE_ANTIMISSILE, TECH_TYPE_MODULE, ANTIMISSILE_DEFENSE, 4000 },
+ { TECH_LANDER_SHIELD_BIO, TECH_TYPE_LANDER_SHIELD, BIOLOGICAL_DISASTER, -1 },
+ { TECH_LANDER_CARGO, TECH_TYPE_STATE, IMPROVED_LANDER_CARGO, 1 },
+ { TECH_MODULE_BIGFUELTANK, TECH_TYPE_MODULE, HIGHEFF_FUELSYS, 1000 },
+ { TECH_LANDER_RAPIDFIRE, TECH_TYPE_STATE, IMPROVED_LANDER_SHOT, 1 },
+ { TECH_LANDER_SHIELD_QUAKE, TECH_TYPE_LANDER_SHIELD, EARTHQUAKE_DISASTER, -1 },
+ { TECH_MODULE_TRACKING, TECH_TYPE_MODULE, TRACKING_SYSTEM, 5000 },
+ { TECH_LANDER_SHIELD_LIGHTNING, TECH_TYPE_LANDER_SHIELD, LIGHTNING_DISASTER, -1 },
+ { TECH_LANDER_SHIELD_HEAT, TECH_TYPE_LANDER_SHIELD, LAVASPOT_DISASTER, -1 },
+ { TECH_MODULE_CANNON, TECH_TYPE_MODULE, CANNON_WEAPON, 6000 },
+ { TECH_MODULE_FURNACE, TECH_TYPE_MODULE, SHIVA_FURNACE, 4000 },
+};
+const size_t NUM_TECHNOLOGIES = ARRAY_SIZE (tech_data_table);
+
+// Lookup function to get the data for a particular tech
+static const TechData*
+GetTechData (TechId_t techId)
+{
+ size_t i = 0;
+ for (i = 0; i < NUM_TECHNOLOGIES; ++i)
+ {
+ if (tech_data_table[i].id == techId)
+ return &tech_data_table[i];
+ }
+ return NULL;
+}
+
+
+// We have to explicitly switch on the state ID because the xxx_GAME_STATE
+// macros use preprocessor stringizing.
+static bool
+HasStateTech (int stateId)
+{
+ switch (stateId)
+ {
+ case IMPROVED_LANDER_SPEED:
+ return GET_GAME_STATE (IMPROVED_LANDER_SPEED);
+ case IMPROVED_LANDER_CARGO:
+ return GET_GAME_STATE (IMPROVED_LANDER_CARGO);
+ case IMPROVED_LANDER_SHOT:
+ return GET_GAME_STATE (IMPROVED_LANDER_SHOT);
+ }
+ return false;
+}
+
+static void
+GrantStateTech (int stateId, BYTE value)
+{
+ switch (stateId)
+ {
+ case IMPROVED_LANDER_SPEED:
+ SET_GAME_STATE (IMPROVED_LANDER_SPEED, value);
+ return;
+ case IMPROVED_LANDER_CARGO:
+ SET_GAME_STATE (IMPROVED_LANDER_CARGO, value);
+ return;
+ case IMPROVED_LANDER_SHOT:
+ SET_GAME_STATE (IMPROVED_LANDER_SHOT, value);
+ return;
+ }
+}
+
+static bool
+HasTech (TechId_t techId)
+{
+ const TechData* techData = GetTechData (techId);
+ if (!techData)
+ return false;
+
+ switch (techData->type)
+ {
+ case TECH_TYPE_MODULE:
+ return GLOBAL (ModuleCost[techData->subtype]) != 0;
+ case TECH_TYPE_LANDER_SHIELD:
+ return (GET_GAME_STATE (LANDER_SHIELDS) & (1 << techData->subtype)) != 0;
+ case TECH_TYPE_STATE:
+ return HasStateTech (techData->subtype);
+ }
+ return false;
+}
+
+static void
+GrantTech (TechId_t techId)
+{
+ const TechData* techData = GetTechData (techId);
+ if (!techData)
+ return;
+
+ switch (techData->type)
+ {
+ case TECH_TYPE_MODULE:
+ GLOBAL (ModuleCost[techData->subtype]) = techData->info / MODULE_COST_SCALE;
+ return;
+ case TECH_TYPE_LANDER_SHIELD:
+ {
+ COUNT state = GET_GAME_STATE (LANDER_SHIELDS) | (1 << techData->subtype);
+ SET_GAME_STATE (LANDER_SHIELDS, state);
+ return;
+ }
+ case TECH_TYPE_STATE:
+ GrantStateTech (techData->subtype, techData->info);
+ return;
+ }
+}
+
+
+////////////Melnorme Sales System///////////
+// This section contains code related to Melnorme sales
+
+// Many of the conversation lines in strings.h fall into groups
+// of sequential responses. These structures allow those
+// responses to be interated through.
+static const int ok_buy_event_lines[] =
+{
+ OK_BUY_EVENT_1, OK_BUY_EVENT_2, OK_BUY_EVENT_3, OK_BUY_EVENT_4,
+ OK_BUY_EVENT_5, OK_BUY_EVENT_6, OK_BUY_EVENT_7, OK_BUY_EVENT_8
+};
+const size_t NUM_EVENT_ITEMS = ARRAY_SIZE (ok_buy_event_lines);
+
+static const int ok_buy_alien_race_lines[] =
+{
+ OK_BUY_ALIEN_RACE_1, OK_BUY_ALIEN_RACE_2, OK_BUY_ALIEN_RACE_3,
+ OK_BUY_ALIEN_RACE_4, OK_BUY_ALIEN_RACE_5, OK_BUY_ALIEN_RACE_6,
+ OK_BUY_ALIEN_RACE_7, OK_BUY_ALIEN_RACE_8, OK_BUY_ALIEN_RACE_9,
+ OK_BUY_ALIEN_RACE_10, OK_BUY_ALIEN_RACE_11, OK_BUY_ALIEN_RACE_12,
+ OK_BUY_ALIEN_RACE_13, OK_BUY_ALIEN_RACE_14, OK_BUY_ALIEN_RACE_15,
+ OK_BUY_ALIEN_RACE_16
+};
+const size_t NUM_ALIEN_RACE_ITEMS = ARRAY_SIZE (ok_buy_alien_race_lines);
+
+static const int ok_buy_history_lines[] =
+{
+ OK_BUY_HISTORY_1, OK_BUY_HISTORY_2, OK_BUY_HISTORY_3,
+ OK_BUY_HISTORY_4, OK_BUY_HISTORY_5, OK_BUY_HISTORY_6,
+ OK_BUY_HISTORY_7, OK_BUY_HISTORY_8, OK_BUY_HISTORY_9
+};
+const size_t NUM_HISTORY_ITEMS = ARRAY_SIZE (ok_buy_history_lines);
+
+static const int hello_and_down_to_business_lines[] =
+{
+ HELLO_AND_DOWN_TO_BUSINESS_1, HELLO_AND_DOWN_TO_BUSINESS_2,
+ HELLO_AND_DOWN_TO_BUSINESS_3, HELLO_AND_DOWN_TO_BUSINESS_4,
+ HELLO_AND_DOWN_TO_BUSINESS_5, HELLO_AND_DOWN_TO_BUSINESS_6,
+ HELLO_AND_DOWN_TO_BUSINESS_7, HELLO_AND_DOWN_TO_BUSINESS_8,
+ HELLO_AND_DOWN_TO_BUSINESS_9, HELLO_AND_DOWN_TO_BUSINESS_10
+};
+const size_t NUM_HELLO_LINES = ARRAY_SIZE (hello_and_down_to_business_lines);
+
+static const int rescue_lines[] =
+{
+ RESCUE_EXPLANATION, RESCUE_AGAIN_1, RESCUE_AGAIN_2,
+ RESCUE_AGAIN_3, RESCUE_AGAIN_4, RESCUE_AGAIN_5
+};
+const size_t NUM_RESCUE_LINES = ARRAY_SIZE (rescue_lines);
+
+// How many lines are available in the given array?
+static size_t
+GetNumLines (const int array[])
+{
+ if (array == ok_buy_event_lines)
+ return NUM_EVENT_ITEMS;
+ else if (array == ok_buy_alien_race_lines)
+ return NUM_ALIEN_RACE_ITEMS;
+ else if (array == ok_buy_history_lines)
+ return NUM_HISTORY_ITEMS;
+ else if (array == hello_and_down_to_business_lines)
+ return NUM_HELLO_LINES;
+ else if (array == rescue_lines)
+ return NUM_RESCUE_LINES;
+ return 0;
+}
+
+// Get the line, with range checking.
+// Returns the last line if the desired one is out of range.
+static int
+GetLineSafe (const int array[], size_t linenum)
+{
+ const size_t array_size = GetNumLines (array);
+ assert (array_size > 0);
+ if (linenum >= array_size)
+ linenum = array_size - 1;
+ return array[linenum];
+}
+
+// Data structure to hold the Melnorme's info on a technology
+typedef struct
+{
+ TechId_t techId; // ID of technology
+ int price; // Melnorme's price to sell
+ int sale_line; // Sales pitch line ID
+ int sold_line; // Post-sale line ID
+} TechSaleData;
+
+// Right now, all techs have the same price.
+#define TECHPRICE (75 * BIO_CREDIT_VALUE)
+
+static const TechSaleData tech_sale_catalog[] =
+{
+ { TECH_MODULE_BLASTER, TECHPRICE, NEW_TECH_1, OK_BUY_NEW_TECH_1 },
+ { TECH_LANDER_SPEED, TECHPRICE, NEW_TECH_2, OK_BUY_NEW_TECH_2 },
+ { TECH_MODULE_ANTIMISSILE, TECHPRICE, NEW_TECH_3, OK_BUY_NEW_TECH_3 },
+ { TECH_LANDER_SHIELD_BIO, TECHPRICE, NEW_TECH_4, OK_BUY_NEW_TECH_4 },
+ { TECH_LANDER_CARGO, TECHPRICE, NEW_TECH_5, OK_BUY_NEW_TECH_5 },
+ { TECH_MODULE_BIGFUELTANK, TECHPRICE, NEW_TECH_6, OK_BUY_NEW_TECH_6 },
+ { TECH_LANDER_RAPIDFIRE, TECHPRICE, NEW_TECH_7, OK_BUY_NEW_TECH_7 },
+ { TECH_LANDER_SHIELD_QUAKE, TECHPRICE, NEW_TECH_8, OK_BUY_NEW_TECH_8 },
+ { TECH_MODULE_TRACKING, TECHPRICE, NEW_TECH_9, OK_BUY_NEW_TECH_9 },
+ { TECH_LANDER_SHIELD_LIGHTNING, TECHPRICE, NEW_TECH_10, OK_BUY_NEW_TECH_10 },
+ { TECH_LANDER_SHIELD_HEAT, TECHPRICE, NEW_TECH_11, OK_BUY_NEW_TECH_11 },
+ { TECH_MODULE_CANNON, TECHPRICE, NEW_TECH_12, OK_BUY_NEW_TECH_12 },
+ { TECH_MODULE_FURNACE, TECHPRICE, NEW_TECH_13, OK_BUY_NEW_TECH_13 },
+};
+const size_t NUM_TECH_ITEMS = ARRAY_SIZE (tech_sale_catalog);
+
+// Return the next tech for sale that the player doesn't already have.
+// Returns NULL if the player has all the techs.
+static const TechSaleData*
+GetNextTechForSale (void)
+{
+ size_t i = 0;
+ for (i = 0; i < NUM_TECH_ITEMS; ++i)
+ {
+ if (!HasTech (tech_sale_catalog[i].techId))
+ return &tech_sale_catalog[i];
+ }
+
+ return NULL;
+}
+
+///////////End Melnorme Sales Section//////////////////
+
+static StatMsgMode prevMsgMode;
+
+static void DoFirstMeeting (RESPONSE_REF R);
+
+static COUNT
+ShipWorth (void)
+{
+ BYTE i;
+ SBYTE crew_pods;
+ COUNT worth;
+
+ worth = GLOBAL_SIS (NumLanders)
+ * GLOBAL (ModuleCost[PLANET_LANDER]);
+ for (i = 0; i < NUM_DRIVE_SLOTS; ++i)
+ {
+ if (GLOBAL_SIS (DriveSlots[i]) < EMPTY_SLOT)
+ worth += GLOBAL (ModuleCost[FUSION_THRUSTER]);
+ }
+ for (i = 0; i < NUM_JET_SLOTS; ++i)
+ {
+ if (GLOBAL_SIS (JetSlots[i]) < EMPTY_SLOT)
+ worth += GLOBAL (ModuleCost[TURNING_JETS]);
+ }
+
+ crew_pods = -(SBYTE)(
+ (GLOBAL_SIS (CrewEnlisted) + CREW_POD_CAPACITY - 1)
+ / CREW_POD_CAPACITY
+ );
+ for (i = 0; i < NUM_MODULE_SLOTS; ++i)
+ {
+ BYTE which_module;
+
+ which_module = GLOBAL_SIS (ModuleSlots[i]);
+ if (which_module < BOMB_MODULE_0
+ && (which_module != CREW_POD || ++crew_pods > 0))
+ {
+ worth += GLOBAL (ModuleCost[which_module]);
+ }
+ }
+
+ return (worth);
+}
+
+static COUNT rescue_fuel;
+static SIS_STATE SIS_copy;
+
+// Extract method to return the response string index
+// for stripping a given module.
+static int
+GetStripModuleRef (int moduleID)
+{
+ switch (moduleID)
+ {
+ case PLANET_LANDER: return LANDERS;
+ case FUSION_THRUSTER: return THRUSTERS;
+ case TURNING_JETS: return JETS;
+ case CREW_POD: return PODS;
+ case STORAGE_BAY: return BAYS;
+ case DYNAMO_UNIT: return DYNAMOS;
+ case SHIVA_FURNACE: return FURNACES;
+ case GUN_WEAPON: return GUNS;
+ case BLASTER_WEAPON: return BLASTERS;
+ case CANNON_WEAPON: return CANNONS;
+ case TRACKING_SYSTEM: return TRACKERS;
+ case ANTIMISSILE_DEFENSE: return DEFENSES;
+ // If a modder has added new modules, should it really
+ // be a fatal error if the Melnorme don't know about
+ // them?
+ default:
+ assert (0 && "Unknown module");
+ }
+ return 0;
+}
+
+static DWORD
+getStripRandomSeed (void)
+{
+ DWORD x, y;
+ // We truncate the location because encounters move the ship slightly in
+ // HSpace, and throw some other relatively immutable values in the mix to
+ // vary the deal when stuck at the same general location again.
+ // It is still possible but unlikely for encounters to move the ship into
+ // another truncation sector so the player could choose from 2 deals.
+ x = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x)) / 100;
+ y = LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y)) / 100;
+ // prime numbers help randomness
+ return y * 1013 + x + GLOBAL_SIS (NumLanders)
+ + GLOBAL_SIS (ModuleSlots[1]) + GLOBAL_SIS (ModuleSlots[4])
+ + GLOBAL_SIS (ModuleSlots[7]) + GLOBAL_SIS (ModuleSlots[10]);
+}
+
+static BOOLEAN
+StripShip (COUNT fuel_required)
+{
+ BYTE i, which_module;
+ SBYTE crew_pods;
+
+ SET_GAME_STATE (MELNORME_RESCUE_REFUSED, 0);
+
+ crew_pods = -(SBYTE)(
+ (GLOBAL_SIS (CrewEnlisted) + CREW_POD_CAPACITY - 1)
+ / CREW_POD_CAPACITY
+ );
+ if (fuel_required == 0)
+ {
+ GlobData.SIS_state = SIS_copy;
+ DeltaSISGauges (UNDEFINED_DELTA, rescue_fuel, UNDEFINED_DELTA);
+ }
+ else if (fuel_required == (COUNT)~0)
+ {
+ GLOBAL_SIS (NumLanders) = 0;
+ for (i = 0; i < NUM_DRIVE_SLOTS; ++i)
+ GLOBAL_SIS (DriveSlots[i]) = EMPTY_SLOT + 0;
+ for (i = 0; i < NUM_JET_SLOTS; ++i)
+ GLOBAL_SIS (JetSlots[i]) = EMPTY_SLOT + 1;
+ if (GLOBAL_SIS (FuelOnBoard) > FUEL_RESERVE)
+ GLOBAL_SIS (FuelOnBoard) = FUEL_RESERVE;
+ GLOBAL_SIS (TotalBioMass) = 0;
+ GLOBAL_SIS (TotalElementMass) = 0;
+ for (i = 0; i < NUM_ELEMENT_CATEGORIES; ++i)
+ GLOBAL_SIS (ElementAmounts[i]) = 0;
+ for (i = 0; i < NUM_MODULE_SLOTS; ++i)
+ {
+ which_module = GLOBAL_SIS (ModuleSlots[i]);
+ if (which_module < BOMB_MODULE_0
+ && (which_module != CREW_POD
+ || ++crew_pods > 0))
+ GLOBAL_SIS (ModuleSlots[i]) = EMPTY_SLOT + 2;
+ }
+
+ DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA, UNDEFINED_DELTA);
+ }
+ else if (fuel_required)
+ {
+ SBYTE bays;
+ BYTE num_searches, beg_mod, end_mod;
+ COUNT worth, total;
+ BYTE module_count[BOMB_MODULE_0];
+ BYTE slot;
+ DWORD capacity;
+ RandomContext *rc;
+
+ // Bug #567
+ // In order to offer the same deal each time if it is refused, we seed
+ // the random number generator with our location, thus making the deal
+ // a repeatable pseudo-random function of where we got stuck and what,
+ // exactly, is on our ship.
+ rc = RandomContext_New();
+ RandomContext_SeedRandom (rc, getStripRandomSeed ());
+
+ SIS_copy = GlobData.SIS_state;
+ for (i = PLANET_LANDER; i < BOMB_MODULE_0; ++i)
+ module_count[i] = 0;
+
+ capacity = FUEL_RESERVE;
+ slot = NUM_MODULE_SLOTS - 1;
+ do
+ {
+ if (SIS_copy.ModuleSlots[slot] == FUEL_TANK
+ || SIS_copy.ModuleSlots[slot] == HIGHEFF_FUELSYS)
+ {
+ COUNT volume;
+
+ volume = SIS_copy.ModuleSlots[slot] == FUEL_TANK
+ ? FUEL_TANK_CAPACITY : HEFUEL_TANK_CAPACITY;
+ capacity += volume;
+ }
+ } while (slot--);
+ if (fuel_required > capacity)
+ fuel_required = capacity;
+
+ bays = -(SBYTE)(
+ (SIS_copy.TotalElementMass + STORAGE_BAY_CAPACITY - 1)
+ / STORAGE_BAY_CAPACITY
+ );
+ for (i = 0; i < NUM_MODULE_SLOTS; ++i)
+ {
+ which_module = SIS_copy.ModuleSlots[i];
+ if (which_module == CREW_POD)
+ ++crew_pods;
+ else if (which_module == STORAGE_BAY)
+ ++bays;
+ }
+
+ worth = fuel_required / FUEL_TANK_SCALE;
+ total = 0;
+ num_searches = 0;
+ beg_mod = end_mod = (BYTE)~0;
+ while (total < worth && ShipWorth () && ++num_searches)
+ {
+ DWORD rand_val;
+
+ rand_val = RandomContext_Random (rc);
+ switch (which_module = LOBYTE (LOWORD (rand_val)) % (CREW_POD + 1))
+ {
+ case PLANET_LANDER:
+ if (SIS_copy.NumLanders == 0)
+ continue;
+ --SIS_copy.NumLanders;
+ break;
+ case FUSION_THRUSTER:
+ for (i = 0; i < NUM_DRIVE_SLOTS; ++i)
+ {
+ if (SIS_copy.DriveSlots[i] < EMPTY_SLOT)
+ break;
+ }
+ if (i == NUM_DRIVE_SLOTS)
+ continue;
+ SIS_copy.DriveSlots[i] = EMPTY_SLOT + 0;
+ break;
+ case TURNING_JETS:
+ for (i = 0; i < NUM_JET_SLOTS; ++i)
+ {
+ if (SIS_copy.JetSlots[i] < EMPTY_SLOT)
+ break;
+ }
+ if (i == NUM_JET_SLOTS)
+ continue;
+ SIS_copy.JetSlots[i] = EMPTY_SLOT + 1;
+ break;
+ case CREW_POD:
+ i = HIBYTE (LOWORD (rand_val)) % NUM_MODULE_SLOTS;
+ which_module = SIS_copy.ModuleSlots[i];
+ if (which_module >= BOMB_MODULE_0
+ || which_module == FUEL_TANK
+ || which_module == HIGHEFF_FUELSYS
+ || (which_module == STORAGE_BAY
+ && module_count[STORAGE_BAY] >= bays)
+ || (which_module == CREW_POD
+ && module_count[CREW_POD] >= crew_pods))
+ continue;
+ SIS_copy.ModuleSlots[i] = EMPTY_SLOT + 2;
+ break;
+ }
+
+ if (beg_mod == (BYTE)~0)
+ beg_mod = end_mod = which_module;
+ else if (which_module > end_mod)
+ end_mod = which_module;
+ ++module_count[which_module];
+ total += GLOBAL (ModuleCost[which_module]);
+ }
+ RandomContext_Delete (rc);
+
+ if (total == 0)
+ {
+ NPCPhrase (CHARITY);
+ DeltaSISGauges (0, fuel_required, 0);
+ return (FALSE);
+ }
+ else
+ {
+ NPCPhrase (RESCUE_OFFER);
+ rescue_fuel = fuel_required;
+ if (rescue_fuel == capacity)
+ NPCPhrase (RESCUE_TANKS);
+ else
+ NPCPhrase (RESCUE_HOME);
+ for (i = PLANET_LANDER; i < BOMB_MODULE_0; ++i)
+ {
+ if (module_count[i])
+ {
+ if (i == end_mod && i != beg_mod)
+ NPCPhrase (END_LIST_WITH_AND);
+ NPCPhrase (ENUMERATE_ONE + (module_count[i] - 1));
+ NPCPhrase (GetStripModuleRef (i));
+ }
+ }
+ }
+ }
+
+ return (TRUE);
+}
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, no_trade_now))
+ NPCPhrase (OK_NO_TRADE_NOW_BYE);
+ else if (PLAYER_SAID (R, youre_on))
+ {
+ NPCPhrase (YOU_GIVE_US_NO_CHOICE);
+
+ SET_GAME_STATE (MELNORME_ANGER, 1);
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, so_we_can_attack))
+ {
+ NPCPhrase (DECEITFUL_HUMAN);
+
+ SET_GAME_STATE (MELNORME_ANGER, 2);
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, bye_melnorme_slightly_angry))
+ NPCPhrase (MELNORME_SLIGHTLY_ANGRY_GOODBYE);
+ else if (PLAYER_SAID (R, ok_strip_me))
+ {
+ if (ShipWorth () < 4000 / MODULE_COST_SCALE)
+ /* is ship worth stripping */
+ NPCPhrase (NOT_WORTH_STRIPPING);
+ else
+ {
+ SET_GAME_STATE (MELNORME_ANGER, 0);
+
+ StripShip ((COUNT)~0);
+ NPCPhrase (FAIR_JUSTICE);
+ }
+ }
+ else if (PLAYER_SAID (R, fight_some_more))
+ {
+ NPCPhrase (OK_FIGHT_SOME_MORE);
+
+ SET_GAME_STATE (MELNORME_ANGER, 3);
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, bye_melnorme_pissed_off))
+ NPCPhrase (MELNORME_PISSED_OFF_GOODBYE);
+ else if (PLAYER_SAID (R, well_if_thats_the_way_you_feel))
+ {
+ NPCPhrase (WE_FIGHT_AGAIN);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, you_hate_us_so_we_go_away))
+ NPCPhrase (HATE_YOU_GOODBYE);
+ else if (PLAYER_SAID (R, take_it))
+ {
+ StripShip (0);
+ NPCPhrase (HAPPY_TO_HAVE_RESCUED);
+ }
+ else if (PLAYER_SAID (R, leave_it))
+ {
+ SET_GAME_STATE (MELNORME_RESCUE_REFUSED, 1);
+ NPCPhrase (MAYBE_SEE_YOU_LATER);
+ }
+ else if (PLAYER_SAID (R, no_help))
+ {
+ SET_GAME_STATE (MELNORME_RESCUE_REFUSED, 1);
+ NPCPhrase (GOODBYE_AND_GOODLUCK);
+ }
+ else if (PLAYER_SAID (R, no_changed_mind))
+ {
+ NPCPhrase (GOODBYE_AND_GOODLUCK_AGAIN);
+ }
+ else if (PLAYER_SAID (R, be_leaving_now)
+ || PLAYER_SAID (R, goodbye))
+ {
+ NPCPhrase (FRIENDLY_GOODBYE);
+ }
+}
+
+static void
+DoRescue (RESPONSE_REF R)
+{
+ SIZE dx, dy;
+ COUNT fuel_required;
+
+ (void) R; // ignored
+ dx = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x))
+ - SOL_X;
+ dy = LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y))
+ - SOL_Y;
+ fuel_required = square_root (
+ (DWORD)((long)dx * dx + (long)dy * dy)
+ ) + (2 * FUEL_TANK_SCALE);
+
+ if (StripShip (fuel_required))
+ {
+ Response (take_it, ExitConversation);
+ Response (leave_it, ExitConversation);
+ }
+}
+
+// Extract method for getting the player's current credits.
+static COUNT
+GetAvailableCredits (void)
+{
+ return MAKE_WORD (GET_GAME_STATE (MELNORME_CREDIT0),
+ GET_GAME_STATE (MELNORME_CREDIT1));
+}
+
+// Extract method for setting the player's current credits.
+static void
+SetAvailableCredits (COUNT credits)
+{
+ SET_GAME_STATE (MELNORME_CREDIT0, LOBYTE (credits));
+ SET_GAME_STATE (MELNORME_CREDIT1, HIBYTE (credits));
+}
+
+// Now returns whether the purchase succeeded instead of the remaining
+// credit balance. Use GetAvailableCredits() to get the latter.
+static bool
+DeltaCredit (SIZE delta_credit)
+{
+ COUNT Credit = GetAvailableCredits ();
+
+ // Can they afford it?
+ if ((int)delta_credit >= 0 || ((int)(-delta_credit) <= (int)(Credit)))
+ {
+ Credit += delta_credit;
+ SetAvailableCredits (Credit);
+ DrawStatusMessage (NULL);
+ return true;
+ }
+
+ // Fail
+ NPCPhrase (NEED_MORE_CREDIT0);
+ NPCNumber (-delta_credit - Credit, NULL);
+ NPCPhrase (NEED_MORE_CREDIT1);
+
+ return false;
+}
+
+
+// Extract methods to process the giving of various bits of information to the
+// player. Ideally, we'd want to merge these three into a single parameterized
+// function, but the nature of the XXX_GAME_STATE() code makes that tricky.
+static void
+CurrentEvents (void)
+{
+ BYTE stack = GET_GAME_STATE (MELNORME_EVENTS_INFO_STACK);
+ const int phraseId = GetLineSafe (ok_buy_event_lines, stack);
+ NPCPhrase (phraseId);
+ SET_GAME_STATE (MELNORME_EVENTS_INFO_STACK, stack + 1);
+}
+
+static void
+AlienRaces (void)
+{
+ BYTE stack = GET_GAME_STATE (MELNORME_ALIEN_INFO_STACK);
+ const int phraseId = GetLineSafe (ok_buy_alien_race_lines, stack);
+ // Two pieces of alien knowledge trigger state changes.
+ switch (phraseId)
+ {
+ case OK_BUY_ALIEN_RACE_14:
+ if (!GET_GAME_STATE (FOUND_PLUTO_SPATHI))
+ {
+ SET_GAME_STATE (KNOW_SPATHI_PASSWORD, 1);
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 7);
+ }
+ break;
+ case OK_BUY_ALIEN_RACE_15:
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) < 2)
+ {
+ SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 2);
+ }
+ SET_GAME_STATE (KNOW_SYREEN_WORLD_SHATTERED, 1);
+ break;
+ }
+ NPCPhrase (phraseId);
+ SET_GAME_STATE (MELNORME_ALIEN_INFO_STACK, stack + 1);
+}
+
+static void
+History (void)
+{
+ BYTE stack = GET_GAME_STATE (MELNORME_HISTORY_INFO_STACK);
+ const int phraseId = GetLineSafe (ok_buy_history_lines, stack);
+ NPCPhrase (phraseId);
+ SET_GAME_STATE (MELNORME_HISTORY_INFO_STACK, stack + 1);
+}
+
+// extract method to tell if we have any information left to sell to the player.
+static bool AnyInfoLeftToSell (void)
+{
+ return GET_GAME_STATE (MELNORME_EVENTS_INFO_STACK) < NUM_EVENT_ITEMS
+ || GET_GAME_STATE (MELNORME_ALIEN_INFO_STACK) < NUM_ALIEN_RACE_ITEMS
+ || GET_GAME_STATE (MELNORME_HISTORY_INFO_STACK) < NUM_HISTORY_ITEMS;
+}
+
+static void NatureOfConversation (RESPONSE_REF R);
+
+static BYTE AskedToBuy;
+
+
+static void
+DoBuy (RESPONSE_REF R)
+{
+ COUNT credit;
+ SIZE needed_credit;
+ BYTE slot;
+ DWORD capacity;
+
+ credit = GetAvailableCredits ();
+
+ capacity = FUEL_RESERVE;
+ slot = NUM_MODULE_SLOTS - 1;
+ do
+ {
+ if (GLOBAL_SIS (ModuleSlots[slot]) == FUEL_TANK
+ || GLOBAL_SIS (ModuleSlots[slot]) == HIGHEFF_FUELSYS)
+ {
+ COUNT volume;
+
+ volume = GLOBAL_SIS (ModuleSlots[slot]) == FUEL_TANK
+ ? FUEL_TANK_CAPACITY : HEFUEL_TANK_CAPACITY;
+ capacity += volume;
+ }
+ } while (slot--);
+
+ // If they're out of credits, educate them on how commerce works.
+ if (credit == 0)
+ {
+ AskedToBuy = TRUE;
+ NPCPhrase (NEED_CREDIT);
+
+ NatureOfConversation (R);
+ }
+ else if (PLAYER_SAID (R, buy_fuel)
+ || PLAYER_SAID (R, buy_1_fuel)
+ || PLAYER_SAID (R, buy_5_fuel)
+ || PLAYER_SAID (R, buy_10_fuel)
+ || PLAYER_SAID (R, buy_25_fuel)
+ || PLAYER_SAID (R, fill_me_up))
+ {
+ needed_credit = 0;
+ if (PLAYER_SAID (R, buy_1_fuel))
+ needed_credit = 1;
+ else if (PLAYER_SAID (R, buy_5_fuel))
+ needed_credit = 5;
+ else if (PLAYER_SAID (R, buy_10_fuel))
+ needed_credit = 10;
+ else if (PLAYER_SAID (R, buy_25_fuel))
+ needed_credit = 25;
+ else if (PLAYER_SAID (R, fill_me_up))
+ needed_credit = (capacity - GLOBAL_SIS (FuelOnBoard)
+ + FUEL_TANK_SCALE - 1)
+ / FUEL_TANK_SCALE;
+
+ if (needed_credit == 0)
+ {
+ if (!GET_GAME_STATE (MELNORME_FUEL_PROCEDURE))
+ {
+ NPCPhrase (BUY_FUEL_INTRO);
+ SET_GAME_STATE (MELNORME_FUEL_PROCEDURE, 1);
+ }
+ }
+ else
+ {
+ if (GLOBAL_SIS (FuelOnBoard) / FUEL_TANK_SCALE
+ + needed_credit > capacity / FUEL_TANK_SCALE)
+ {
+ NPCPhrase (NO_ROOM_FOR_FUEL);
+ goto TryFuelAgain;
+ }
+
+ if ((int)(needed_credit * (BIO_CREDIT_VALUE / 2)) <= (int)credit)
+ {
+ DWORD f;
+
+ NPCPhrase (GOT_FUEL);
+
+ f = (DWORD)needed_credit * FUEL_TANK_SCALE;
+ while (f > 0x3FFFL)
+ {
+ DeltaSISGauges (0, 0x3FFF, 0);
+ f -= 0x3FFF;
+ }
+ DeltaSISGauges (0, (SIZE)f, 0);
+ }
+ needed_credit *= (BIO_CREDIT_VALUE / 2);
+ }
+ if (needed_credit)
+ {
+ DeltaCredit (-needed_credit);
+ if (GLOBAL_SIS (FuelOnBoard) >= capacity)
+ goto BuyBuyBuy;
+ }
+TryFuelAgain:
+ NPCPhrase (HOW_MUCH_FUEL);
+
+ Response (buy_1_fuel, DoBuy);
+ Response (buy_5_fuel, DoBuy);
+ Response (buy_10_fuel, DoBuy);
+ Response (buy_25_fuel, DoBuy);
+ Response (fill_me_up, DoBuy);
+ Response (done_buying_fuel, DoBuy);
+ }
+ else if (PLAYER_SAID (R, buy_technology)
+ || PLAYER_SAID (R, buy_new_tech))
+ {
+ // Note that this code no longer uses the MELNORME_TECH_STACK state
+ // buts, as they're not needed; we can tell what technologies the
+ // player has by using the technology API above. This opens the
+ // possibility of the player acquiring tech from someplace other than
+ // the Melnorme.
+ const TechSaleData* nextTech;
+
+ // If it's our first time, give an introduction.
+ if (!GET_GAME_STATE (MELNORME_TECH_PROCEDURE))
+ {
+ NPCPhrase (BUY_NEW_TECH_INTRO);
+ SET_GAME_STATE (MELNORME_TECH_PROCEDURE, 1);
+ }
+
+ // Did the player just attempt to buy a tech?
+ if (PLAYER_SAID (R, buy_new_tech))
+ {
+ nextTech = GetNextTechForSale ();
+ if (!nextTech)
+ goto BuyBuyBuy; // No tech left to buy
+
+ if (!DeltaCredit (-nextTech->price))
+ goto BuyBuyBuy; // Can't afford it
+
+ // Make the sale
+ GrantTech (nextTech->techId);
+ NPCPhrase (nextTech->sold_line);
+ }
+
+ nextTech = GetNextTechForSale ();
+ if (!nextTech)
+ {
+ NPCPhrase (NEW_TECH_ALL_GONE);
+ goto BuyBuyBuy; // No tech left to buy
+ }
+
+ NPCPhrase (nextTech->sale_line);
+
+ Response (buy_new_tech, DoBuy);
+ Response (no_buy_new_tech, DoBuy);
+ }
+ else if (PLAYER_SAID (R, buy_info)
+ || PLAYER_SAID (R, buy_current_events)
+ || PLAYER_SAID (R, buy_alien_races)
+ || PLAYER_SAID (R, buy_history))
+ {
+ if (!GET_GAME_STATE (MELNORME_INFO_PROCEDURE))
+ {
+ NPCPhrase (BUY_INFO_INTRO);
+ SET_GAME_STATE (MELNORME_INFO_PROCEDURE, 1);
+ }
+ else if (PLAYER_SAID (R, buy_info))
+ {
+ NPCPhrase (OK_BUY_INFO);
+ }
+ else
+ {
+#define INFO_COST 75
+ if (!DeltaCredit (-INFO_COST))
+ goto BuyBuyBuy;
+
+ if (PLAYER_SAID (R, buy_current_events))
+ CurrentEvents ();
+ else if (PLAYER_SAID (R, buy_alien_races))
+ AlienRaces ();
+ else if (PLAYER_SAID (R, buy_history))
+ History ();
+ }
+
+ if (!AnyInfoLeftToSell ())
+ {
+ NPCPhrase (INFO_ALL_GONE);
+ goto BuyBuyBuy;
+ }
+
+ if (GET_GAME_STATE (MELNORME_EVENTS_INFO_STACK) < NUM_EVENT_ITEMS)
+ Response (buy_current_events, DoBuy);
+ if (GET_GAME_STATE (MELNORME_ALIEN_INFO_STACK) < NUM_ALIEN_RACE_ITEMS)
+ Response (buy_alien_races, DoBuy);
+ if (GET_GAME_STATE (MELNORME_HISTORY_INFO_STACK) < NUM_HISTORY_ITEMS)
+ Response (buy_history, DoBuy);
+ Response (done_buying_info, DoBuy);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, done_buying_fuel))
+ NPCPhrase (OK_DONE_BUYING_FUEL);
+ else if (PLAYER_SAID (R, no_buy_new_tech))
+ NPCPhrase (OK_NO_BUY_NEW_TECH);
+ else if (PLAYER_SAID (R, done_buying_info))
+ NPCPhrase (OK_DONE_BUYING_INFO);
+ else
+ NPCPhrase (WHAT_TO_BUY);
+
+BuyBuyBuy:
+ if (GLOBAL_SIS (FuelOnBoard) < capacity)
+ Response (buy_fuel, DoBuy);
+ if (GetNextTechForSale ())
+ Response (buy_technology, DoBuy);
+ if (AnyInfoLeftToSell ())
+ Response (buy_info, DoBuy);
+
+ Response (done_buying, NatureOfConversation);
+ Response (be_leaving_now, ExitConversation);
+ }
+}
+
+static void
+DoSell (RESPONSE_REF R)
+{
+ BYTE num_new_rainbows;
+ UWORD rainbow_mask;
+ SIZE added_credit;
+ int what_to_sell_queued = 0;
+
+ rainbow_mask = MAKE_WORD (
+ GET_GAME_STATE (RAINBOW_WORLD0),
+ GET_GAME_STATE (RAINBOW_WORLD1)
+ );
+ num_new_rainbows = (BYTE)(-GET_GAME_STATE (MELNORME_RAINBOW_COUNT));
+ while (rainbow_mask)
+ {
+ if (rainbow_mask & 1)
+ ++num_new_rainbows;
+
+ rainbow_mask >>= 1;
+ }
+
+ if (!PLAYER_SAID (R, sell))
+ {
+ if (PLAYER_SAID (R, sell_life_data))
+ {
+ DWORD TimeIn;
+
+ added_credit = GLOBAL_SIS (TotalBioMass) * BIO_CREDIT_VALUE;
+
+ NPCPhrase (SOLD_LIFE_DATA1);
+ NPCNumber (GLOBAL_SIS (TotalBioMass), NULL);
+ NPCPhrase (SOLD_LIFE_DATA2);
+ NPCNumber (added_credit, NULL);
+ NPCPhrase (SOLD_LIFE_DATA3);
+ // queue WHAT_TO_SELL before talk-segue
+ if (num_new_rainbows)
+ {
+ NPCPhrase (WHAT_TO_SELL);
+ what_to_sell_queued = 1;
+ }
+ AlienTalkSegue (1);
+
+ DrawCargoStrings ((BYTE)~0, (BYTE)~0);
+ SleepThread (ONE_SECOND / 2);
+ TimeIn = GetTimeCounter ();
+ DrawCargoStrings (
+ (BYTE)NUM_ELEMENT_CATEGORIES,
+ (BYTE)NUM_ELEMENT_CATEGORIES
+ );
+ do
+ {
+ TimeIn = GetTimeCounter ();
+ if (AnyButtonPress (TRUE))
+ {
+ DeltaCredit (GLOBAL_SIS (TotalBioMass) * BIO_CREDIT_VALUE);
+ GLOBAL_SIS (TotalBioMass) = 0;
+ }
+ else
+ {
+ --GLOBAL_SIS (TotalBioMass);
+ DeltaCredit (BIO_CREDIT_VALUE);
+ }
+ DrawCargoStrings (
+ (BYTE)NUM_ELEMENT_CATEGORIES,
+ (BYTE)NUM_ELEMENT_CATEGORIES
+ );
+ } while (GLOBAL_SIS (TotalBioMass));
+ SleepThread (ONE_SECOND / 2);
+
+ ClearSISRect (DRAW_SIS_DISPLAY);
+ }
+ else /* if (R == sell_rainbow_locations) */
+ {
+ added_credit = num_new_rainbows * (250 * BIO_CREDIT_VALUE);
+
+ NPCPhrase (SOLD_RAINBOW_LOCATIONS1);
+ NPCNumber (num_new_rainbows, NULL);
+ NPCPhrase (SOLD_RAINBOW_LOCATIONS2);
+ NPCNumber (added_credit, NULL);
+ NPCPhrase (SOLD_RAINBOW_LOCATIONS3);
+
+ num_new_rainbows += GET_GAME_STATE (MELNORME_RAINBOW_COUNT);
+ SET_GAME_STATE (MELNORME_RAINBOW_COUNT, num_new_rainbows);
+ num_new_rainbows = 0;
+
+ DeltaCredit (added_credit);
+ }
+
+ AskedToBuy = FALSE;
+ }
+
+ if (GLOBAL_SIS (TotalBioMass) || num_new_rainbows)
+ {
+ if (!what_to_sell_queued)
+ NPCPhrase (WHAT_TO_SELL);
+
+ if (GLOBAL_SIS (TotalBioMass))
+ Response (sell_life_data, DoSell);
+ if (num_new_rainbows)
+ Response (sell_rainbow_locations, DoSell);
+ Response (done_selling, NatureOfConversation);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, sell))
+ NPCPhrase (NOTHING_TO_SELL);
+ DISABLE_PHRASE (sell);
+
+ NatureOfConversation (R);
+ }
+}
+
+
+static void
+NatureOfConversation (RESPONSE_REF R)
+{
+ BYTE num_new_rainbows;
+ UWORD rainbow_mask;
+ COUNT Credit;
+
+ if (PLAYER_SAID (R, get_on_with_business))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK2, 5);
+ R = 0;
+ }
+
+ // Draw credits display
+ DeltaCredit (0);
+ Credit = GetAvailableCredits ();
+ if (R == 0)
+ {
+ BYTE stack = GET_GAME_STATE (MELNORME_YACK_STACK2) - 5;
+ NPCPhrase (GetLineSafe (hello_and_down_to_business_lines, stack));
+ if (stack < (NUM_HELLO_LINES - 1))
+ ++stack;
+ SET_GAME_STATE (MELNORME_YACK_STACK2, stack + 5);
+ }
+
+ rainbow_mask = MAKE_WORD (
+ GET_GAME_STATE (RAINBOW_WORLD0),
+ GET_GAME_STATE (RAINBOW_WORLD1)
+ );
+ num_new_rainbows = (BYTE)(-GET_GAME_STATE (MELNORME_RAINBOW_COUNT));
+ while (rainbow_mask)
+ {
+ if (rainbow_mask & 1)
+ ++num_new_rainbows;
+
+ rainbow_mask >>= 1;
+ }
+
+ if (GLOBAL_SIS (FuelOnBoard) > 0
+ || GLOBAL_SIS (TotalBioMass)
+ || Credit
+ || num_new_rainbows)
+ {
+ if (!GET_GAME_STATE (TRADED_WITH_MELNORME))
+ {
+ SET_GAME_STATE (TRADED_WITH_MELNORME, 1);
+
+ NPCPhrase (TRADING_INFO);
+ }
+
+ if (R == 0)
+ {
+ /* Melnorme reports any news and turns purple */
+ NPCPhrase (BUY_OR_SELL);
+ AlienTalkSegue (1);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1)
+ ), ONE_SECOND / 2);
+ AlienTalkSegue ((COUNT)~0);
+ }
+ else if (PLAYER_SAID (R, why_turned_purple))
+ {
+ SET_GAME_STATE (WHY_MELNORME_PURPLE, 1);
+
+ NPCPhrase (TURNED_PURPLE_BECAUSE);
+ }
+ else if (PLAYER_SAID (R, done_selling))
+ {
+ NPCPhrase (OK_DONE_SELLING);
+ }
+ else if (PLAYER_SAID (R, done_buying))
+ {
+ NPCPhrase (OK_DONE_BUYING);
+ }
+
+ if (!GET_GAME_STATE (WHY_MELNORME_PURPLE))
+ {
+ Response (why_turned_purple, NatureOfConversation);
+ }
+ if (!AskedToBuy)
+ Response (buy, DoBuy);
+ if (PHRASE_ENABLED (sell))
+ Response (sell, DoSell);
+ Response (goodbye, ExitConversation);
+ }
+ else /* needs to be rescued */
+ {
+ if (GET_GAME_STATE (MELNORME_RESCUE_REFUSED))
+ {
+ NPCPhrase (CHANGED_MIND);
+
+ Response (yes_changed_mind, DoRescue);
+ Response (no_changed_mind, ExitConversation);
+ }
+ else
+ {
+ BYTE num_rescues = GET_GAME_STATE (MELNORME_RESCUE_COUNT);
+ NPCPhrase (GetLineSafe (rescue_lines, num_rescues));
+
+ if (num_rescues < NUM_RESCUE_LINES - 1)
+ {
+ ++num_rescues;
+ SET_GAME_STATE (MELNORME_RESCUE_COUNT, num_rescues);
+ }
+
+ NPCPhrase (SHOULD_WE_HELP_YOU);
+
+ Response (yes_help, DoRescue);
+ Response (no_help, ExitConversation);
+ }
+ }
+}
+
+static BYTE local_stack0, local_stack1;
+
+static void
+DoBluster (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, trade_is_for_the_weak))
+ {
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 2)
+ ), ONE_SECOND / 2);
+
+ SET_GAME_STATE (MELNORME_YACK_STACK2, 4);
+ NPCPhrase (WERE_NOT_AFRAID);
+ }
+ else if (PLAYER_SAID (R, why_blue_light))
+ {
+ SET_GAME_STATE (WHY_MELNORME_BLUE, 1);
+
+ NPCPhrase (BLUE_IS_MAD);
+ }
+ else if (PLAYER_SAID (R, we_strong_1))
+ {
+ local_stack0 = 1;
+ NPCPhrase (YOU_NOT_STRONG_1);
+ }
+ else if (PLAYER_SAID (R, we_strong_2))
+ {
+ local_stack0 = 2;
+ NPCPhrase (YOU_NOT_STRONG_2);
+ }
+ else if (PLAYER_SAID (R, we_strong_3))
+ {
+ local_stack0 = 3;
+ NPCPhrase (YOU_NOT_STRONG_3);
+ }
+ else if (PLAYER_SAID (R, just_testing))
+ {
+ local_stack1 = 1;
+ NPCPhrase (REALLY_TESTING);
+ }
+
+ if (!GET_GAME_STATE (WHY_MELNORME_BLUE))
+ Response (why_blue_light, DoBluster);
+ switch (local_stack0)
+ {
+ case 0:
+ Response (we_strong_1, DoBluster);
+ break;
+ case 1:
+ Response (we_strong_2, DoBluster);
+ break;
+ case 2:
+ Response (we_strong_3, DoBluster);
+ break;
+ }
+ switch (local_stack1)
+ {
+ case 0:
+ Response (just_testing, DoBluster);
+ break;
+ case 1:
+ {
+ Response (yes_really_testing, DoFirstMeeting);
+ break;
+ }
+ }
+ Response (youre_on, ExitConversation);
+}
+
+static void
+yack0_respond (void)
+{
+
+ switch (GET_GAME_STATE (MELNORME_YACK_STACK0))
+ {
+ case 0:
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ we_are_from_alliance0,
+ buf,
+ (RESPONSE_REF)-1);
+ DoResponsePhrase (we_are_from_alliance0, DoFirstMeeting, shared_phrase_buf);
+ break;
+ }
+ case 1:
+ Response (how_know, DoFirstMeeting);
+ break;
+ }
+}
+
+static void
+yack1_respond (void)
+{
+ switch (GET_GAME_STATE (MELNORME_YACK_STACK1))
+ {
+ case 0:
+ Response (what_about_yourselves, DoFirstMeeting);
+ break;
+ case 1:
+ Response (what_factors, DoFirstMeeting);
+ case 2:
+ Response (get_on_with_business, NatureOfConversation);
+ break;
+ }
+}
+
+static void
+yack2_respond (void)
+{
+ switch (GET_GAME_STATE (MELNORME_YACK_STACK2))
+ {
+ case 0:
+ Response (what_about_universe, DoFirstMeeting);
+ break;
+ case 1:
+ Response (giving_is_good_1, DoFirstMeeting);
+ break;
+ case 2:
+ Response (giving_is_good_2, DoFirstMeeting);
+ break;
+ case 3:
+ Response (trade_is_for_the_weak, DoBluster);
+ break;
+ }
+}
+
+static void
+DoFirstMeeting (RESPONSE_REF R)
+{
+ BYTE last_stack = 0;
+ PVOIDFUNC temp_func, stack_func[] =
+ {
+ yack0_respond,
+ yack1_respond,
+ yack2_respond,
+ };
+
+ if (R == 0)
+ {
+ BYTE business_count;
+
+ business_count = GET_GAME_STATE (MELNORME_BUSINESS_COUNT);
+ switch (business_count++)
+ {
+ case 0:
+ NPCPhrase (HELLO_NOW_DOWN_TO_BUSINESS_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_NOW_DOWN_TO_BUSINESS_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_NOW_DOWN_TO_BUSINESS_3);
+ --business_count;
+ break;
+ }
+ SET_GAME_STATE (MELNORME_BUSINESS_COUNT, business_count);
+ }
+ else if (PLAYER_SAID (R, we_are_from_alliance0))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK0, 1);
+ NPCPhrase (KNOW_OF_YOU);
+ }
+ else if (PLAYER_SAID (R, how_know))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK0, 2);
+ NPCPhrase (KNOW_BECAUSE);
+ }
+ else if (PLAYER_SAID (R, what_about_yourselves))
+ {
+ last_stack = 1;
+ SET_GAME_STATE (MELNORME_YACK_STACK1, 1);
+ NPCPhrase (NO_TALK_ABOUT_OURSELVES);
+ }
+ else if (PLAYER_SAID (R, what_factors))
+ {
+ last_stack = 1;
+ SET_GAME_STATE (MELNORME_YACK_STACK1, 2);
+ NPCPhrase (FACTORS_ARE);
+ }
+ else if (PLAYER_SAID (R, what_about_universe))
+ {
+ last_stack = 2;
+ SET_GAME_STATE (MELNORME_YACK_STACK2, 1);
+ NPCPhrase (NO_FREE_LUNCH);
+ }
+ else if (PLAYER_SAID (R, giving_is_good_1))
+ {
+ last_stack = 2;
+ SET_GAME_STATE (MELNORME_YACK_STACK2, 2);
+ NPCPhrase (GIVING_IS_BAD_1);
+ }
+ else if (PLAYER_SAID (R, giving_is_good_2))
+ {
+ last_stack = 2;
+ SET_GAME_STATE (MELNORME_YACK_STACK2, 3);
+ NPCPhrase (GIVING_IS_BAD_2);
+ }
+ else if (PLAYER_SAID (R, yes_really_testing))
+ {
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 0)
+ ), ONE_SECOND / 2);
+
+ NPCPhrase (TEST_RESULTS);
+ }
+ else if (PLAYER_SAID (R, we_apologize))
+ {
+ SET_GAME_STATE (MELNORME_ANGER, 0);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 0)
+ ), ONE_SECOND / 2);
+
+ NPCPhrase (APOLOGY_ACCEPTED);
+ }
+
+ temp_func = stack_func[0];
+ stack_func[0] = stack_func[last_stack];
+ stack_func[last_stack] = temp_func;
+ (*stack_func[0]) ();
+ (*stack_func[1]) ();
+ (*stack_func[2]) ();
+ Response (no_trade_now, ExitConversation);
+}
+
+static void
+DoMelnormeMiffed (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE miffed_count;
+
+ miffed_count = GET_GAME_STATE (MELNORME_MIFFED_COUNT);
+ switch (miffed_count++)
+ {
+ case 0:
+ NPCPhrase (HELLO_SLIGHTLY_ANGRY_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_SLIGHTLY_ANGRY_2);
+ break;
+ default:
+ --miffed_count;
+ NPCPhrase (HELLO_SLIGHTLY_ANGRY_3);
+ break;
+ }
+ SET_GAME_STATE (MELNORME_MIFFED_COUNT, miffed_count);
+
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 2)
+ ), ONE_SECOND / 2);
+ }
+ else if (PLAYER_SAID (R, explore_relationship))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK3, 1);
+
+ NPCPhrase (EXAMPLE_OF_RELATIONSHIP);
+ }
+ else if (PLAYER_SAID (R, excuse_1))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK3, 2);
+
+ NPCPhrase (NO_EXCUSE_1);
+ }
+ else if (PLAYER_SAID (R, excuse_2))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK3, 3);
+
+ NPCPhrase (NO_EXCUSE_2);
+ }
+ else if (PLAYER_SAID (R, excuse_3))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK3, 4);
+
+ NPCPhrase (NO_EXCUSE_3);
+ }
+
+ switch (GET_GAME_STATE (MELNORME_YACK_STACK3))
+ {
+ case 0:
+ Response (explore_relationship, DoMelnormeMiffed);
+ break;
+ case 1:
+ Response (excuse_1, DoMelnormeMiffed);
+ break;
+ case 2:
+ Response (excuse_2, DoMelnormeMiffed);
+ break;
+ case 3:
+ Response (excuse_3, DoMelnormeMiffed);
+ break;
+ }
+ Response (we_apologize, DoFirstMeeting);
+ Response (so_we_can_attack, ExitConversation);
+ Response (bye_melnorme_slightly_angry, ExitConversation);
+}
+
+static void
+DoMelnormePissed (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE pissed_count;
+
+ pissed_count = GET_GAME_STATE (MELNORME_PISSED_COUNT);
+ switch (pissed_count++)
+ {
+ case 0:
+ NPCPhrase (HELLO_PISSED_OFF_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_PISSED_OFF_2);
+ break;
+ default:
+ --pissed_count;
+ NPCPhrase (HELLO_PISSED_OFF_3);
+ break;
+ }
+ SET_GAME_STATE (MELNORME_PISSED_COUNT, pissed_count);
+
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 2)
+ ), ONE_SECOND / 2);
+ }
+ else if (PLAYER_SAID (R, beg_forgiveness))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK4, 1);
+
+ NPCPhrase (LOTS_TO_MAKE_UP_FOR);
+ }
+ else if (PLAYER_SAID (R, you_are_so_right))
+ {
+ SET_GAME_STATE (MELNORME_YACK_STACK4, 2);
+
+ NPCPhrase (ONE_LAST_CHANCE);
+ }
+
+ switch (GET_GAME_STATE (MELNORME_YACK_STACK4))
+ {
+ case 0:
+ Response (beg_forgiveness, DoMelnormePissed);
+ break;
+ case 1:
+ Response (you_are_so_right, DoMelnormePissed);
+ break;
+ case 2:
+ Response (ok_strip_me, ExitConversation);
+ break;
+ }
+ Response (fight_some_more, ExitConversation);
+ Response (bye_melnorme_pissed_off, ExitConversation);
+}
+
+static void
+DoMelnormeHate (RESPONSE_REF R)
+{
+ BYTE hate_count;
+
+ (void) R; // ignored
+ hate_count = GET_GAME_STATE (MELNORME_HATE_COUNT);
+ switch (hate_count++)
+ {
+ case 0:
+ NPCPhrase (HELLO_HATE_YOU_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_HATE_YOU_2);
+ break;
+ default:
+ --hate_count;
+ NPCPhrase (HELLO_HATE_YOU_3);
+ break;
+ }
+ SET_GAME_STATE (MELNORME_HATE_COUNT, hate_count);
+
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 2)
+ ), ONE_SECOND / 2);
+
+ Response (well_if_thats_the_way_you_feel, ExitConversation);
+ Response (you_hate_us_so_we_go_away, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ prevMsgMode = SetStatusMessageMode (SMM_CREDITS);
+
+ if (GET_GAME_STATE (MET_MELNORME) == 0)
+ {
+ SET_GAME_STATE (MET_MELNORME, 1);
+ DoFirstMeeting (0);
+ }
+ else
+ {
+ switch (GET_GAME_STATE (MELNORME_ANGER))
+ {
+ case 0:
+ if (GET_GAME_STATE (MELNORME_YACK_STACK2) <= 5)
+ DoFirstMeeting (0);
+ else
+ NatureOfConversation (0);
+ break;
+ case 1:
+ DoMelnormeMiffed (0);
+ break;
+ case 2:
+ DoMelnormePissed (0);
+ break;
+ default:
+ DoMelnormeHate (0);
+ break;
+ }
+ }
+}
+
+static COUNT
+uninit_melnorme (void)
+{
+ return 0;
+}
+
+static void
+post_melnorme_enc (void)
+{
+ if (prevMsgMode != SMM_UNDEFINED)
+ SetStatusMessageMode (prevMsgMode);
+ DrawStatusMessage (NULL);
+}
+
+LOCDATA*
+init_melnorme_comm (void)
+{
+ LOCDATA *retval;
+
+ melnorme_desc.init_encounter_func = Intro;
+ melnorme_desc.post_encounter_func = post_melnorme_enc;
+ melnorme_desc.uninit_encounter_func = uninit_melnorme;
+
+ melnorme_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ melnorme_desc.AlienTextBaseline.y = 0;
+ melnorme_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ local_stack0 = 0;
+ local_stack1 = 0;
+
+ prevMsgMode = SMM_UNDEFINED;
+
+ setSegue (Segue_peace);
+ AskedToBuy = FALSE;
+ retval = &melnorme_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/melnorm/resinst.h b/src/uqm/comm/melnorm/resinst.h
new file mode 100644
index 0000000..cda8d5a
--- /dev/null
+++ b/src/uqm/comm/melnorm/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define MELNORME_COLOR_MAP "comm.melnorme.colortable"
+#define MELNORME_CONVERSATION_PHRASES "comm.melnorme.dialogue"
+#define MELNORME_FONT "comm.melnorme.font"
+#define MELNORME_MUSIC "comm.melnorme.music"
+#define MELNORME_PMAP_ANIM "comm.melnorme.graphics"
diff --git a/src/uqm/comm/melnorm/strings.h b/src/uqm/comm/melnorm/strings.h
new file mode 100644
index 0000000..14ad322
--- /dev/null
+++ b/src/uqm/comm/melnorm/strings.h
@@ -0,0 +1,309 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MELNORME_STRINGS_H
+#define MELNORME_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HELLO_NOW_DOWN_TO_BUSINESS_1,
+ HELLO_NOW_DOWN_TO_BUSINESS_2,
+ HELLO_NOW_DOWN_TO_BUSINESS_3,
+ KNOW_OF_YOU,
+ how_know,
+ KNOW_BECAUSE,
+ what_about_yourselves,
+ NO_TALK_ABOUT_OURSELVES,
+ what_factors,
+ FACTORS_ARE,
+ what_about_universe,
+ NO_FREE_LUNCH,
+ giving_is_good_1,
+ GIVING_IS_BAD_1,
+ giving_is_good_2,
+ GIVING_IS_BAD_2,
+ get_on_with_business,
+ trade_is_for_the_weak,
+ WERE_NOT_AFRAID,
+ no_trade_now,
+ OK_NO_TRADE_NOW_BYE,
+ HELLO_AND_DOWN_TO_BUSINESS_1,
+ HELLO_AND_DOWN_TO_BUSINESS_2,
+ HELLO_AND_DOWN_TO_BUSINESS_3,
+ HELLO_AND_DOWN_TO_BUSINESS_4,
+ HELLO_AND_DOWN_TO_BUSINESS_5,
+ HELLO_AND_DOWN_TO_BUSINESS_6,
+ HELLO_AND_DOWN_TO_BUSINESS_7,
+ HELLO_AND_DOWN_TO_BUSINESS_8,
+ HELLO_AND_DOWN_TO_BUSINESS_9,
+ HELLO_AND_DOWN_TO_BUSINESS_10,
+ whats_my_credit,
+ HELLO_SLIGHTLY_ANGRY_1,
+ HELLO_SLIGHTLY_ANGRY_2,
+ HELLO_SLIGHTLY_ANGRY_3,
+ explore_relationship,
+ EXAMPLE_OF_RELATIONSHIP,
+ excuse_1,
+ NO_EXCUSE_1,
+ excuse_2,
+ NO_EXCUSE_2,
+ excuse_3,
+ NO_EXCUSE_3,
+ we_apologize,
+ APOLOGY_ACCEPTED,
+ so_we_can_attack,
+ DECEITFUL_HUMAN,
+ bye_melnorme_slightly_angry,
+ MELNORME_SLIGHTLY_ANGRY_GOODBYE,
+ HELLO_HATE_YOU_1,
+ HELLO_HATE_YOU_2,
+ HELLO_HATE_YOU_3,
+ well_if_thats_the_way_you_feel,
+ you_hate_us_so_we_go_away,
+ HATE_YOU_GOODBYE,
+ WE_FIGHT_AGAIN,
+ RESCUE_EXPLANATION,
+ RESCUE_AGAIN_1,
+ RESCUE_AGAIN_2,
+ RESCUE_AGAIN_3,
+ RESCUE_AGAIN_4,
+ RESCUE_AGAIN_5,
+ CHANGED_MIND,
+ no_changed_mind,
+ yes_changed_mind,
+ SHOULD_WE_HELP_YOU,
+ yes_help,
+ no_help,
+ RESCUE_OFFER,
+ RESCUE_TANKS,
+ RESCUE_HOME,
+ take_it,
+ leave_it,
+ HAPPY_TO_HAVE_RESCUED,
+ MAYBE_SEE_YOU_LATER,
+ GOODBYE_AND_GOODLUCK,
+ GOODBYE_AND_GOODLUCK_AGAIN,
+ HELLO_PISSED_OFF_1,
+ HELLO_PISSED_OFF_2,
+ HELLO_PISSED_OFF_3,
+ beg_forgiveness,
+ LOTS_TO_MAKE_UP_FOR,
+ you_are_so_right,
+ ONE_LAST_CHANCE,
+ ok_strip_me,
+ no_strip_now,
+ NOT_WORTH_STRIPPING,
+ FAIR_JUSTICE,
+ bye_melnorme_pissed_off,
+ MELNORME_PISSED_OFF_GOODBYE,
+ fight_some_more,
+ OK_FIGHT_SOME_MORE,
+ why_blue_light,
+ BLUE_IS_MAD,
+ we_strong_1,
+ YOU_NOT_STRONG_1,
+ we_strong_2,
+ YOU_NOT_STRONG_2,
+ we_strong_3,
+ YOU_NOT_STRONG_3,
+ just_testing,
+ REALLY_TESTING,
+ yes_really_testing,
+ TEST_RESULTS,
+ youre_on,
+ YOU_GIVE_US_NO_CHOICE,
+ TRADING_INFO,
+ BUY_OR_SELL,
+ goodbye,
+ why_turned_purple,
+ buy,
+ sell,
+ TURNED_PURPLE_BECAUSE,
+ NOTHING_TO_SELL,
+ WHAT_TO_SELL,
+ OK_DONE_SELLING,
+ sell_life_data,
+ SOLD_LIFE_DATA1,
+ SOLD_LIFE_DATA2,
+ SOLD_LIFE_DATA3,
+ sell_rainbow_locations,
+ SOLD_RAINBOW_LOCATIONS1,
+ SOLD_RAINBOW_LOCATIONS2,
+ SOLD_RAINBOW_LOCATIONS3,
+ sell_precursor_find,
+ SOLD_PRECURSOR_FIND,
+ changed_mind_no_sell,
+ done_selling,
+ NEED_CREDIT,
+ WHAT_TO_BUY,
+ WHAT_MORE_TO_BUY,
+ OK_DONE_BUYING,
+ buy_fuel,
+ done_buying,
+ be_leaving_now,
+ HOW_MUCH_FUEL,
+ buy_1_fuel,
+ GOT_FUEL,
+ buy_5_fuel,
+ buy_10_fuel,
+ buy_25_fuel,
+ done_buying_fuel,
+ FRIENDLY_GOODBYE,
+ CREDIT_IS0,
+ CREDIT_IS1,
+ NEED_MORE_CREDIT0,
+ NEED_MORE_CREDIT1,
+ BUY_FUEL_INTRO,
+ NO_ROOM_FOR_FUEL,
+ buy_info,
+ buy_technology,
+ buy_current_events,
+ buy_alien_races,
+ buy_history,
+ done_buying_info,
+ no_buy_info,
+ BUY_INFO_INTRO,
+ OK_BUY_INFO,
+ OK_NO_BUY_INFO,
+ OK_DONE_BUYING_INFO,
+ OK_BUY_EVENT_1,
+ OK_BUY_EVENT_2,
+ OK_BUY_EVENT_3,
+ OK_BUY_EVENT_4,
+ OK_BUY_EVENT_5,
+ OK_BUY_EVENT_6,
+ OK_BUY_EVENT_7,
+ OK_BUY_EVENT_8,
+ OK_BUY_ALIEN_RACE_1,
+ OK_BUY_ALIEN_RACE_2,
+ OK_BUY_ALIEN_RACE_3,
+ OK_BUY_ALIEN_RACE_4,
+ OK_BUY_ALIEN_RACE_5,
+ OK_BUY_ALIEN_RACE_6,
+ OK_BUY_ALIEN_RACE_7,
+ OK_BUY_ALIEN_RACE_8,
+ OK_BUY_ALIEN_RACE_9,
+ OK_BUY_ALIEN_RACE_10,
+ OK_BUY_ALIEN_RACE_11,
+ OK_BUY_ALIEN_RACE_12,
+ OK_BUY_ALIEN_RACE_13,
+ OK_BUY_ALIEN_RACE_14,
+ OK_BUY_ALIEN_RACE_15,
+ OK_BUY_ALIEN_RACE_16,
+ OK_BUY_HISTORY_1,
+ OK_BUY_HISTORY_2,
+ OK_BUY_HISTORY_3,
+ OK_BUY_HISTORY_4,
+ OK_BUY_HISTORY_5,
+ OK_BUY_HISTORY_6,
+ OK_BUY_HISTORY_7,
+ OK_BUY_HISTORY_8,
+ OK_BUY_HISTORY_9,
+ INFO_ALL_GONE,
+ buy_new_tech,
+ no_buy_new_tech,
+ done_buying_new_tech,
+ fill_me_up,
+ OK_FILL_YOU_UP,
+ BUY_NEW_TECH_INTRO,
+ OK_BUY_NEW_TECH,
+ OK_NO_BUY_NEW_TECH,
+ OK_DONE_BUYING_NEW_TECH,
+ OK_DONE_BUYING_FUEL,
+ NEW_TECH_1,
+ NEW_TECH_2,
+ NEW_TECH_3,
+ NEW_TECH_4,
+ NEW_TECH_5,
+ NEW_TECH_6,
+ NEW_TECH_7,
+ NEW_TECH_8,
+ NEW_TECH_9,
+ NEW_TECH_10,
+ NEW_TECH_11,
+ NEW_TECH_12,
+ NEW_TECH_13,
+ OK_BUY_NEW_TECH_1,
+ OK_BUY_NEW_TECH_2,
+ OK_BUY_NEW_TECH_3,
+ OK_BUY_NEW_TECH_4,
+ OK_BUY_NEW_TECH_5,
+ OK_BUY_NEW_TECH_6,
+ OK_BUY_NEW_TECH_7,
+ OK_BUY_NEW_TECH_8,
+ OK_BUY_NEW_TECH_9,
+ OK_BUY_NEW_TECH_10,
+ OK_BUY_NEW_TECH_11,
+ OK_BUY_NEW_TECH_12,
+ OK_BUY_NEW_TECH_13,
+ CHARITY,
+ NEW_TECH_ALL_GONE,
+ we_are_from_alliance0,
+ STRIP_HEAD,
+ LANDERS,
+ THRUSTERS,
+ JETS,
+ PODS,
+ BAYS,
+ DYNAMOS,
+ FURNACES,
+ GUNS,
+ BLASTERS,
+ CANNONS,
+ TRACKERS,
+ DEFENSES,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ ENUMERATE_ONE,
+ ENUMERATE_TWO,
+ ENUMERATE_THREE,
+ ENUMERATE_FOUR,
+ ENUMERATE_FIVE,
+ ENUMERATE_SIX,
+ ENUMERATE_SEVEN,
+ ENUMERATE_EIGHT,
+ ENUMERATE_NINE,
+ ENUMERATE_TEN,
+ ENUMERATE_ELEVEN,
+ ENUMERATE_TWELVE,
+ ENUMERATE_THIRTEEN,
+ ENUMERATE_FOURTEEN,
+ ENUMERATE_FIFTEEN,
+ ENUMERATE_SIXTEEN,
+ END_LIST_WITH_AND,
+ ENUMERATE_ZERO,
+ ENUMERATE_SEVENTEEN,
+ ENUMERATE_EIGHTEEN,
+ ENUMERATE_NINETEEN,
+ ENUMERATE_TWENTY,
+ ENUMERATE_THIRTY,
+ ENUMERATE_FOURTY,
+ ENUMERATE_FIFTY,
+ ENUMERATE_SIXTY,
+ ENUMERATE_SEVENTY,
+ ENUMERATE_EIGHTY,
+ ENUMERATE_NINETY,
+ ENUMERATE_HUNDRED,
+ ENUMERATE_THOUSAND
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/mycon/Makeinfo b/src/uqm/comm/mycon/Makeinfo
new file mode 100644
index 0000000..df0ef72
--- /dev/null
+++ b/src/uqm/comm/mycon/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="myconc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/mycon/myconc.c b/src/uqm/comm/mycon/myconc.c
new file mode 100644
index 0000000..6490904
--- /dev/null
+++ b/src/uqm/comm/mycon/myconc.c
@@ -0,0 +1,643 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/gameev.h"
+#include "libs/mathlib.h"
+
+
+static LOCDATA mycon_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ MYCON_PMAP_ANIM, /* AlienFrame */
+ MYCON_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ MYCON_COLOR_MAP, /* AlienColorMap */
+ MYCON_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ MYCON_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 5, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 12, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ (1 << 1), /* BlockMask */
+ },
+ {
+ 18, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ (1 << 0), /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 28, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 33, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND * 3 / 40, 0, /* FrameRate */
+ ONE_SECOND * 3 / 40, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 11, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static BYTE MadeChoice;
+
+static void
+DoRamble (RESPONSE_REF R)
+{
+ BYTE Counter;
+
+ Counter = GET_GAME_STATE (MYCON_RAMBLE);
+ switch (Counter++)
+ {
+ case 0:
+ NPCPhrase (RAMBLE_1);
+ break;
+ case 1:
+ NPCPhrase (RAMBLE_2);
+ break;
+ case 2:
+ NPCPhrase (RAMBLE_3);
+ break;
+ case 3:
+ NPCPhrase (RAMBLE_4);
+ break;
+ case 4:
+ NPCPhrase (RAMBLE_5);
+ break;
+ case 5:
+ NPCPhrase (RAMBLE_6);
+ break;
+ case 6:
+ NPCPhrase (RAMBLE_7);
+ break;
+ case 7:
+ NPCPhrase (RAMBLE_8);
+ break;
+ case 8:
+ NPCPhrase (RAMBLE_9);
+ break;
+ case 9:
+ NPCPhrase (RAMBLE_10);
+ break;
+ case 10:
+ NPCPhrase (RAMBLE_11);
+ break;
+ case 11:
+ NPCPhrase (RAMBLE_12);
+ break;
+ case 12:
+ NPCPhrase (RAMBLE_13);
+ break;
+ case 13:
+ NPCPhrase (RAMBLE_14);
+ break;
+ case 14:
+ NPCPhrase (RAMBLE_15);
+ break;
+ case 15:
+ NPCPhrase (RAMBLE_16);
+ break;
+ case 16:
+ NPCPhrase (RAMBLE_17);
+ break;
+ case 17:
+ NPCPhrase (RAMBLE_18);
+ break;
+ case 18:
+ NPCPhrase (RAMBLE_19);
+ break;
+ case 19:
+ NPCPhrase (RAMBLE_20);
+ break;
+ case 20:
+ NPCPhrase (RAMBLE_21);
+ break;
+ case 21:
+ NPCPhrase (RAMBLE_22);
+ break;
+ case 22:
+ NPCPhrase (RAMBLE_23);
+ break;
+ case 23:
+ NPCPhrase (RAMBLE_24);
+ break;
+ case 24:
+ NPCPhrase (RAMBLE_25);
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) < 2)
+ {
+ SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 2);
+ }
+ break;
+ case 25:
+ NPCPhrase (RAMBLE_26);
+ break;
+ case 26:
+ NPCPhrase (RAMBLE_27);
+ break;
+ case 27:
+ NPCPhrase (RAMBLE_28);
+ break;
+ case 28:
+ NPCPhrase (RAMBLE_29);
+ break;
+ case 29:
+ NPCPhrase (RAMBLE_30);
+ break;
+ case 30:
+ NPCPhrase (RAMBLE_31);
+ break;
+ case 31:
+ NPCPhrase (RAMBLE_32);
+ Counter = 0;
+ break;
+ }
+ SET_GAME_STATE (MYCON_RAMBLE, Counter);
+
+ if (!(GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7)))
+ {
+ if (!PLAYER_SAID (R, come_in_peace)
+ && !PLAYER_SAID (R, gonna_die))
+ {
+ Counter = (GET_GAME_STATE (MYCON_INSULTS) + 1) & 7;
+ SET_GAME_STATE (MYCON_INSULTS, Counter);
+ MadeChoice = 1;
+ }
+ }
+ else if (!PLAYER_SAID (R, lets_be_friends)
+ && !PLAYER_SAID (R, came_to_homeworld)
+ && !PLAYER_SAID (R, submit_to_us))
+ {
+ Counter = (GET_GAME_STATE (MYCON_INFO) + 1) & 15;
+ SET_GAME_STATE (MYCON_INFO, Counter);
+ MadeChoice = 1;
+ }
+}
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, bye_space))
+ NPCPhrase (BYE_AND_DIE_SPACE);
+ else if (PLAYER_SAID (R, bye_homeworld))
+ NPCPhrase (BYE_AND_DIE_HOMEWORLD);
+ else if (PLAYER_SAID (R, like_to_land))
+ NPCPhrase (NEVER_LET_LAND);
+ else if (PLAYER_SAID (R, bye_sun_device))
+ {
+ NPCPhrase (GOODBYE_SUN_DEVICE);
+
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ DoRamble (R);
+ if (!(GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7)))
+ NPCPhrase (BYE_AND_DIE_SPACE);
+ else
+ NPCPhrase (BYE_AND_DIE_HOMEWORLD);
+ }
+ MadeChoice = 0;
+}
+
+static void
+SunDevice (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_sun_device))
+ {
+ NPCPhrase (GENERAL_INFO_SUN_DEVICE);
+
+ DISABLE_PHRASE (whats_up_sun_device);
+ }
+ else if (PLAYER_SAID (R, how_goes_implanting))
+ {
+ NPCPhrase (UNFORSEEN_DELAYS);
+
+ DISABLE_PHRASE (how_goes_implanting);
+ }
+ else if (PLAYER_SAID (R, i_have_a_cunning_plan))
+ {
+ NPCPhrase (WONT_FALL_FOR_TRICK);
+
+ SET_GAME_STATE (NO_TRICK_AT_SUN, 1);
+ }
+
+ if (PHRASE_ENABLED (whats_up_sun_device))
+ Response (whats_up_sun_device, SunDevice);
+ if (GET_GAME_STATE (MYCON_FELL_FOR_AMBUSH))
+ {
+ if (PHRASE_ENABLED (how_goes_implanting) && GET_GAME_STATE (MYCON_FELL_FOR_AMBUSH))
+ Response (how_goes_implanting, SunDevice);
+ Response (like_to_land, CombatIsInevitable);
+ }
+ else if (GET_GAME_STATE (MYCON_AMBUSH)
+ && !GET_GAME_STATE (NO_TRICK_AT_SUN))
+ Response (i_have_a_cunning_plan, SunDevice);
+ Response (bye_sun_device, CombatIsInevitable);
+}
+
+static void
+TrickMycon (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, i_have_a_cunning_plan))
+ {
+ NPCPhrase (TELL_US_ABOUT_WORLD);
+
+ DISABLE_PHRASE (i_have_a_cunning_plan);
+ }
+ else if (PLAYER_SAID (R, clue_1))
+ {
+ NPCPhrase (RESPONSE_1);
+
+ DISABLE_PHRASE (clue_1);
+ }
+ else if (PLAYER_SAID (R, clue_2))
+ {
+ NPCPhrase (RESPONSE_2);
+
+ DISABLE_PHRASE (clue_2);
+ }
+ else if (PLAYER_SAID (R, clue_3))
+ {
+ NPCPhrase (RESPONSE_3);
+
+ DISABLE_PHRASE (clue_3);
+ }
+
+ if (PHRASE_ENABLED (clue_1) == 0
+ && PHRASE_ENABLED (clue_2) == 0
+ && PHRASE_ENABLED (clue_3) == 0)
+ {
+ NPCPhrase (WE_GO_TO_IMPLANT);
+
+ setSegue (Segue_peace);
+ SET_GAME_STATE (MYCON_FELL_FOR_AMBUSH, 1);
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_MYCON_MISSION);
+ }
+ else
+ NPCPhrase (AMBUSH_TAIL);
+
+ if (PHRASE_ENABLED (clue_1))
+ Response (clue_1, TrickMycon);
+ if (PHRASE_ENABLED (clue_2))
+ Response (clue_2, TrickMycon);
+ if (PHRASE_ENABLED (clue_3))
+ Response (clue_3, TrickMycon);
+}
+
+static void
+NormalMycon (RESPONSE_REF R)
+{
+ RESPONSE_FUNC RespFunc;
+
+ if (PLAYER_SAID (R, what_about_shattered))
+ {
+ NPCPhrase (ABOUT_SHATTERED);
+
+ SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 2);
+ }
+ else if (R)
+ {
+ DoRamble (R);
+ NPCPhrase (RAMBLE_TAIL);
+
+ DISABLE_PHRASE (R);
+ }
+
+ if ((BYTE)TFB_Random () < 256 * 30 / 100)
+ RespFunc = (RESPONSE_FUNC)CombatIsInevitable;
+ else
+ RespFunc = (RESPONSE_FUNC)NormalMycon;
+ if (!(GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7)))
+ {
+ if (PHRASE_ENABLED (come_in_peace))
+ Response (come_in_peace, RespFunc);
+ if (PHRASE_ENABLED (gonna_die))
+ Response (gonna_die, RespFunc);
+ if (!MadeChoice) switch (GET_GAME_STATE (MYCON_INSULTS))
+ {
+ case 0:
+ Response (insult_1, RespFunc);
+ break;
+ case 1:
+ Response (insult_2, RespFunc);
+ break;
+ case 2:
+ Response (insult_3, RespFunc);
+ break;
+ case 3:
+ Response (insult_4, RespFunc);
+ break;
+ case 4:
+ Response (insult_5, RespFunc);
+ break;
+ case 5:
+ Response (insult_6, RespFunc);
+ break;
+ case 6:
+ Response (insult_7, RespFunc);
+ break;
+ case 7:
+ Response (insult_8, RespFunc);
+ break;
+ }
+ Response (bye_space, CombatIsInevitable);
+ }
+ else
+ {
+ if (!MadeChoice) switch (GET_GAME_STATE (MYCON_INFO))
+ {
+ case 0:
+ Response (question_1, RespFunc);
+ break;
+ case 1:
+ Response (question_2, RespFunc);
+ break;
+ case 2:
+ Response (question_3, RespFunc);
+ break;
+ case 3:
+ Response (question_4, RespFunc);
+ break;
+ case 4:
+ Response (question_5, RespFunc);
+ break;
+ case 5:
+ Response (question_6, RespFunc);
+ break;
+ case 6:
+ Response (question_7, RespFunc);
+ break;
+ case 7:
+ Response (question_8, RespFunc);
+ break;
+ case 8:
+ Response (question_9, RespFunc);
+ break;
+ case 9:
+ Response (question_10, RespFunc);
+ break;
+ case 10:
+ Response (question_11, RespFunc);
+ break;
+ case 11:
+ Response (question_12, RespFunc);
+ break;
+ case 12:
+ Response (question_13, RespFunc);
+ break;
+ case 13:
+ Response (question_14, RespFunc);
+ break;
+ case 14:
+ Response (question_15, RespFunc);
+ break;
+ case 15:
+ Response (question_16, RespFunc);
+ break;
+ }
+ if (PHRASE_ENABLED (lets_be_friends))
+ Response (lets_be_friends, RespFunc);
+ if (PHRASE_ENABLED (came_to_homeworld))
+ Response (came_to_homeworld, RespFunc);
+ if (PHRASE_ENABLED (submit_to_us))
+ Response (submit_to_us, RespFunc);
+ if (!GET_GAME_STATE (MYCON_FELL_FOR_AMBUSH))
+ {
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) == 1)
+ Response (what_about_shattered, NormalMycon);
+ if (GET_GAME_STATE (MYCON_AMBUSH))
+ {
+ Response (i_have_a_cunning_plan, TrickMycon);
+ }
+ }
+ Response (bye_homeworld, CombatIsInevitable);
+ }
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (GET_GAME_STATE (SUN_DEVICE))
+ {
+ NumVisits = GET_GAME_STATE (MYCON_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (DIE_THIEF);
+ break;
+ case 1:
+ NPCPhrase (DIE_THIEF_AGAIN);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (MYCON_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (MYCON_KNOW_AMBUSH))
+ {
+ NPCPhrase (DIE_LIAR);
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NumVisits = GET_GAME_STATE (MYCON_SUN_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_SUN_DEVICE_WORLD_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_SUN_DEVICE_WORLD_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (MYCON_SUN_VISITS, NumVisits);
+
+ SunDevice ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (MYCON_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_HOMEWORLD_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_HOMEWORLD_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_HOMEWORLD_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_HOMEWORLD_4);
+ break;
+ case 4:
+ NPCPhrase (HELLO_HOMEWORLD_5);
+ break;
+ case 5:
+ NPCPhrase (HELLO_HOMEWORLD_6);
+ break;
+ case 6:
+ NPCPhrase (HELLO_HOMEWORLD_7);
+ break;
+ case 7:
+ NPCPhrase (HELLO_HOMEWORLD_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (MYCON_HOME_VISITS, NumVisits);
+
+ NormalMycon ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (MYCON_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_SPACE_4);
+ break;
+ case 4:
+ NPCPhrase (HELLO_SPACE_5);
+ break;
+ case 5:
+ NPCPhrase (HELLO_SPACE_6);
+ break;
+ case 6:
+ NPCPhrase (HELLO_SPACE_7);
+ break;
+ case 7:
+ NPCPhrase (HELLO_SPACE_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (MYCON_VISITS, NumVisits);
+
+ NormalMycon ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_mycon (void)
+{
+ return (0);
+}
+
+static void
+post_mycon_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_mycon_comm (void)
+{
+ LOCDATA *retval;
+
+ mycon_desc.init_encounter_func = Intro;
+ mycon_desc.post_encounter_func = post_mycon_enc;
+ mycon_desc.uninit_encounter_func = uninit_mycon;
+
+ mycon_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ mycon_desc.AlienTextBaseline.y = 0;
+ mycon_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ MadeChoice = 0;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
+ {
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ setSegue (Segue_peace);
+ }
+ retval = &mycon_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/mycon/resinst.h b/src/uqm/comm/mycon/resinst.h
new file mode 100644
index 0000000..65a6a33
--- /dev/null
+++ b/src/uqm/comm/mycon/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define MYCON_COLOR_MAP "comm.mycon.colortable"
+#define MYCON_CONVERSATION_PHRASES "comm.mycon.dialogue"
+#define MYCON_FONT "comm.mycon.font"
+#define MYCON_MUSIC "comm.mycon.music"
+#define MYCON_PMAP_ANIM "comm.mycon.graphics"
diff --git a/src/uqm/comm/mycon/strings.h b/src/uqm/comm/mycon/strings.h
new file mode 100644
index 0000000..8b71dfb
--- /dev/null
+++ b/src/uqm/comm/mycon/strings.h
@@ -0,0 +1,136 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef MYCON_STRINGS_H
+#define MYCON_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ TELL_US_ABOUT_WORLD,
+ BYE_AND_DIE_HOMEWORLD,
+ RAMBLE_1,
+ RAMBLE_2,
+ RAMBLE_3,
+ RAMBLE_4,
+ RAMBLE_5,
+ RAMBLE_6,
+ RAMBLE_7,
+ RAMBLE_8,
+ RAMBLE_9,
+ RAMBLE_10,
+ RAMBLE_11,
+ RAMBLE_12,
+ RAMBLE_13,
+ RAMBLE_14,
+ RAMBLE_15,
+ RAMBLE_16,
+ RAMBLE_17,
+ RAMBLE_18,
+ RAMBLE_19,
+ RAMBLE_20,
+ RAMBLE_21,
+ RAMBLE_22,
+ RAMBLE_23,
+ RAMBLE_24,
+ RAMBLE_25,
+ RAMBLE_26,
+ RAMBLE_27,
+ RAMBLE_28,
+ RAMBLE_29,
+ RAMBLE_30,
+ RAMBLE_31,
+ RAMBLE_32,
+ question_1,
+ question_2,
+ question_3,
+ question_4,
+ question_5,
+ question_6,
+ question_7,
+ question_8,
+ question_9,
+ question_10,
+ question_11,
+ question_12,
+ question_13,
+ question_14,
+ question_15,
+ question_16,
+ bye_space,
+ BYE_AND_DIE_SPACE,
+ gonna_die,
+ insult_1,
+ insult_2,
+ insult_3,
+ insult_4,
+ insult_5,
+ insult_6,
+ insult_7,
+ insult_8,
+ come_in_peace,
+ HELLO_HOMEWORLD_1,
+ HELLO_HOMEWORLD_2,
+ HELLO_HOMEWORLD_3,
+ HELLO_HOMEWORLD_4,
+ HELLO_HOMEWORLD_5,
+ HELLO_HOMEWORLD_6,
+ HELLO_HOMEWORLD_7,
+ HELLO_HOMEWORLD_8,
+ HELLO_SPACE_1,
+ HELLO_SPACE_2,
+ HELLO_SPACE_3,
+ HELLO_SPACE_4,
+ HELLO_SPACE_5,
+ HELLO_SPACE_6,
+ HELLO_SPACE_7,
+ HELLO_SPACE_8,
+ lets_be_friends,
+ came_to_homeworld,
+ submit_to_us,
+ bye_sun_device,
+ GOODBYE_SUN_DEVICE,
+ RESPONSE_1,
+ RESPONSE_2,
+ RESPONSE_3,
+ clue_1,
+ clue_2,
+ clue_3,
+ what_about_shattered,
+ ABOUT_SHATTERED,
+ HELLO_SUN_DEVICE_WORLD_1,
+ HELLO_SUN_DEVICE_WORLD_2,
+ whats_up_sun_device,
+ GENERAL_INFO_SUN_DEVICE,
+ like_to_land,
+ NEVER_LET_LAND,
+ bye_homeworld,
+ i_have_a_cunning_plan,
+ DIE_LIAR,
+ how_goes_implanting,
+ UNFORSEEN_DELAYS,
+ DIE_THIEF,
+ DIE_THIEF_AGAIN,
+ GOODBYE_AND_DIE,
+ AMBUSH_TAIL,
+ RAMBLE_TAIL,
+ WE_GO_TO_IMPLANT,
+ WONT_FALL_FOR_TRICK,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/orz/Makeinfo b/src/uqm/comm/orz/Makeinfo
new file mode 100644
index 0000000..b5c56d2
--- /dev/null
+++ b/src/uqm/comm/orz/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="orzc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/orz/orzc.c b/src/uqm/comm/orz/orzc.c
new file mode 100644
index 0000000..72076a6
--- /dev/null
+++ b/src/uqm/comm/orz/orzc.c
@@ -0,0 +1,898 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+
+
+static LOCDATA orz_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ ORZ_PMAP_ANIM, /* AlienFrame */
+ ORZ_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ ORZ_COLOR_MAP, /* AlienColorMap */
+ ORZ_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ ORZ_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 12 /* 13 */, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 4, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 10, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 15, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 17, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 7), /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 6), /* BlockMask */
+ },
+ {
+ 30, /* StartIndex */
+ 3, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5), /* BlockMask */
+ },
+ {
+ 33, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4), /* BlockMask */
+ },
+ {
+ 36, /* StartIndex */
+ 25, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 60, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 61, /* StartIndex */
+ 15, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 60, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 76, /* StartIndex */
+ 17, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 60, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 12), /* BlockMask */
+ },
+ {
+ 93, /* StartIndex */
+ 25, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 60, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 118, /* StartIndex */
+ 11, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 60, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 10), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 12, ONE_SECOND * 3 / 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye_ally))
+ NPCPhrase (GOODBYE_ALLY);
+ else if (PLAYER_SAID (R, bye_neutral))
+ NPCPhrase (GOODBYE_NEUTRAL);
+ else if (PLAYER_SAID (R, bye_angry))
+ NPCPhrase (GOODBYE_ANGRY);
+ else if (PLAYER_SAID (R, bye_taalo))
+ {
+ if (GET_GAME_STATE (ORZ_MANNER) == 1)
+ NPCPhrase (ANGRY_TAALO_GOODBYE);
+ else
+ NPCPhrase (FRIENDLY_TAALO_GOODBYE);
+ }
+ else if (PLAYER_SAID (R, hostile_2))
+ {
+ NPCPhrase (HOSTILITY_IS_BAD_2);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, may_we_land))
+ {
+ NPCPhrase (SURE_LAND);
+
+ SET_GAME_STATE (TAALO_UNPROTECTED, 1);
+ }
+ else if (PLAYER_SAID (R, yes_alliance)
+ || PLAYER_SAID (R, were_sorry))
+ {
+ if (PLAYER_SAID (R, yes_alliance))
+ NPCPhrase (GREAT);
+ else
+ NPCPhrase (APOLOGY_ACCEPTED);
+
+ SET_GAME_STATE (ORZ_ANDRO_STATE, 0);
+ SET_GAME_STATE (ORZ_GENERAL_INFO, 0);
+ SET_GAME_STATE (ORZ_PERSONAL_INFO, 0);
+ SET_GAME_STATE (ORZ_MANNER, 3);
+ SetRaceAllied (ORZ_SHIP, TRUE);
+ }
+ else if (PLAYER_SAID (R, demand_to_land))
+ {
+ NPCPhrase (NO_DEMAND);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, about_andro_3)
+ || PLAYER_SAID (R, must_know_about_androsyn))
+ {
+ if (PLAYER_SAID (R, about_andro_3))
+ NPCPhrase (BLEW_IT);
+ else
+ NPCPhrase (KNOW_TOO_MUCH);
+
+ SET_GAME_STATE (ORZ_VISITS, 0);
+ SET_GAME_STATE (ORZ_MANNER, 2);
+ setSegue (Segue_hostile);
+ if (PLAYER_SAID (R, about_andro_3))
+ {
+ SetRaceAllied (ORZ_SHIP, FALSE);
+ RemoveEscortShips (ORZ_SHIP);
+ }
+
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1)
+ ), ONE_SECOND / 2);
+ }
+ else /* insults */
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (ORZ_PERSONAL_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INSULTED_1);
+ break;
+ case 1:
+ NPCPhrase (INSULTED_2);
+ break;
+ case 2:
+ NPCPhrase (INSULTED_3);
+ setSegue (Segue_hostile);
+ break;
+ case 7:
+ --NumVisits;
+ default:
+ NPCPhrase (INSULTED_4);
+ setSegue (Segue_hostile);
+ break;
+ }
+ SET_GAME_STATE (ORZ_PERSONAL_INFO, NumVisits);
+ }
+}
+
+static void
+TaaloWorld (RESPONSE_REF R)
+{
+ // We can only get here when ORZ_MANNER != HOSTILE (2)
+ BYTE Manner;
+
+ Manner = GET_GAME_STATE (ORZ_MANNER);
+ if (PLAYER_SAID (R, demand_to_land))
+ {
+ NPCPhrase (ASK_NICELY);
+
+ DISABLE_PHRASE (demand_to_land);
+ }
+ else if (PLAYER_SAID (R, why_you_here))
+ {
+ if (Manner != 1)
+ NPCPhrase (FRIENDLY_EXPLANATION);
+ else
+ NPCPhrase (ANGRY_EXPLANATION);
+
+ DISABLE_PHRASE (why_you_here);
+ }
+ else if (PLAYER_SAID (R, what_is_this_place))
+ {
+ if (Manner != 1)
+ NPCPhrase (FRIENDLY_PLACE);
+ else
+ NPCPhrase (ANGRY_PLACE);
+
+ DISABLE_PHRASE (what_is_this_place);
+ }
+ else if (PLAYER_SAID (R, may_we_land))
+ {
+ NPCPhrase (ALLIES_CAN_VISIT);
+
+ DISABLE_PHRASE (may_we_land);
+ }
+ else if (PLAYER_SAID (R, make_alliance))
+ {
+ NPCPhrase (CANT_ALLY_HERE);
+
+ DISABLE_PHRASE (make_alliance);
+ }
+ else if (PLAYER_SAID (R, why_busy))
+ {
+ NPCPhrase (BUSY_BECAUSE);
+
+ DISABLE_PHRASE (why_busy);
+ }
+
+ if (PHRASE_ENABLED (may_we_land))
+ {
+ if (Manner == 3 && CheckAlliance (ORZ_SHIP) == GOOD_GUY)
+ Response (may_we_land, ExitConversation);
+ else
+ Response (may_we_land, TaaloWorld);
+ }
+ else if (PHRASE_ENABLED (make_alliance))
+ Response (make_alliance, TaaloWorld);
+ else if (PHRASE_ENABLED (why_busy))
+ Response (why_busy, TaaloWorld);
+ if (PHRASE_ENABLED (demand_to_land))
+ {
+ if (Manner == 1)
+ Response (demand_to_land, ExitConversation);
+ else
+ Response (demand_to_land, TaaloWorld);
+ }
+ if (PHRASE_ENABLED (why_you_here))
+ Response (why_you_here, TaaloWorld);
+ if (PHRASE_ENABLED (what_is_this_place))
+ Response (what_is_this_place, TaaloWorld);
+ Response (bye_taalo, ExitConversation);
+}
+
+static void
+OrzAllied (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_ally))
+ {
+ NumVisits = GET_GAME_STATE (ORZ_GENERAL_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_ALLY_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_ALLY_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_ALLY_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_ALLY_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_GENERAL_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_ally);
+ }
+ else if (PLAYER_SAID (R, more_about_you))
+ {
+ NumVisits = GET_GAME_STATE (ORZ_PERSONAL_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ABOUT_US_1);
+ break;
+ case 1:
+ NPCPhrase (ABOUT_US_2);
+ break;
+ case 2:
+ NPCPhrase (ABOUT_US_3);
+ break;
+ case 3:
+ NPCPhrase (ABOUT_US_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_PERSONAL_INFO, NumVisits);
+
+ DISABLE_PHRASE (more_about_you);
+ }
+ else if (PLAYER_SAID (R, about_andro_1))
+ {
+ NPCPhrase (FORGET_ANDRO_1);
+
+ SET_GAME_STATE (ORZ_ANDRO_STATE, 1);
+ }
+ else if (PLAYER_SAID (R, about_andro_2))
+ {
+ NPCPhrase (FORGET_ANDRO_2);
+
+ SET_GAME_STATE (ORZ_ANDRO_STATE, 2);
+ }
+
+ if (GET_GAME_STATE (ORZ_ANDRO_STATE) == 0)
+ Response (about_andro_1, OrzAllied);
+ else if (GET_GAME_STATE (ORZ_ANDRO_STATE) == 1)
+ Response (about_andro_2, OrzAllied);
+ else
+ {
+ Response (about_andro_3, ExitConversation);
+ }
+ if (PHRASE_ENABLED (whats_up_ally))
+ Response (whats_up_ally, OrzAllied);
+ if (PHRASE_ENABLED (more_about_you))
+ Response (more_about_you, OrzAllied);
+ Response (bye_ally, ExitConversation);
+}
+
+static void OrzNeutral (RESPONSE_REF R);
+
+static void
+WhereAndrosyn (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ NPCPhrase (DISEMBLE_ABOUT_ANDROSYN);
+ DISABLE_PHRASE (where_androsyn);
+
+ Response (must_know_about_androsyn, ExitConversation);
+ Response (dont_really_care, OrzNeutral);
+}
+
+static void
+OfferAlliance (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, seem_like_nice_guys))
+ NPCPhrase (ARE_NICE_WANT_ALLY);
+ else if (PLAYER_SAID (R, talk_about_alliance))
+ NPCPhrase (OK_TALK_ALLIANCE);
+ else if (PLAYER_SAID (R, why_so_trusting))
+ {
+ NPCPhrase (TRUSTING_BECAUSE);
+
+ SET_GAME_STATE (ORZ_STACK1, 1);
+ }
+
+ Response (no_alliance, OrzNeutral);
+ Response (decide_later, OrzNeutral);
+ if (GET_GAME_STATE (ORZ_STACK1) == 0)
+ {
+ Response (why_so_trusting, OfferAlliance);
+ }
+ Response (yes_alliance, ExitConversation);
+}
+
+static void
+OrzNeutral (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[3];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (PLAYER_SAID (R, hostile_1))
+ {
+ NPCPhrase (HOSTILITY_IS_BAD_1);
+
+ DISABLE_PHRASE (hostile_1);
+ LastStack = 2;
+ }
+ else if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase (NICE_TO_MEET_YOU);
+
+ SET_GAME_STATE (ORZ_STACK0, 1);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, who_you))
+ {
+ NPCPhrase (WE_ARE_ORZ);
+
+ SET_GAME_STATE (ORZ_ANDRO_STATE, 1);
+ }
+ else if (PLAYER_SAID (R, why_here))
+ {
+ NPCPhrase (HERE_BECAUSE);
+
+ SET_GAME_STATE (ORZ_ANDRO_STATE, 2);
+ }
+ else if (PLAYER_SAID (R, no_alliance))
+ {
+ NPCPhrase (MAYBE_LATER);
+
+ DISABLE_PHRASE (talk_about_alliance);
+ SET_GAME_STATE (REFUSED_ORZ_ALLIANCE, 1);
+ }
+ else if (PLAYER_SAID (R, decide_later))
+ {
+ NPCPhrase (OK_LATER);
+
+ DISABLE_PHRASE (talk_about_alliance);
+ SET_GAME_STATE (REFUSED_ORZ_ALLIANCE, 1);
+ }
+ else if (PLAYER_SAID (R, dont_really_care))
+ NPCPhrase (YOU_ARE_OUR_FRIENDS);
+ else if (PLAYER_SAID (R, where_androsyn))
+ {
+ WhereAndrosyn (R);
+ return;
+ }
+ else if (PLAYER_SAID (R, talk_about_alliance)
+ || PLAYER_SAID (R, seem_like_nice_guys))
+ {
+ OfferAlliance (R);
+ return;
+ }
+ else if (PLAYER_SAID (R, hostile_2))
+ {
+ ExitConversation (R);
+ return;
+ }
+
+ if (GET_GAME_STATE (ORZ_ANDRO_STATE) == 0)
+ pStr[0] = who_you;
+ else if (GET_GAME_STATE (ORZ_ANDRO_STATE) == 1)
+ pStr[0] = why_here;
+ else if (PHRASE_ENABLED (where_androsyn) && GET_GAME_STATE (ORZ_ANDRO_STATE) == 2)
+ pStr[0] = where_androsyn;
+ if (GET_GAME_STATE (REFUSED_ORZ_ALLIANCE))
+ {
+ if (PHRASE_ENABLED (talk_about_alliance))
+ pStr[1] = talk_about_alliance;
+ }
+ else if (GET_GAME_STATE (ORZ_STACK0) == 0)
+ {
+ construct_response (shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_are_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ pStr[1] = we_are_vindicator0;
+ }
+ else
+ pStr[1] = seem_like_nice_guys;
+ if (PHRASE_ENABLED (hostile_1))
+ pStr[2] = hostile_1;
+ else
+ pStr[2] = hostile_2;
+
+ if (pStr[LastStack])
+ {
+ if (pStr[LastStack] != we_are_vindicator0)
+ Response (pStr[LastStack], OrzNeutral);
+ else
+ DoResponsePhrase (pStr[LastStack], OrzNeutral, shared_phrase_buf);
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (pStr[i] != we_are_vindicator0)
+ Response (pStr[i], OrzNeutral);
+ else
+ DoResponsePhrase (pStr[i], OrzNeutral, shared_phrase_buf);
+ }
+ }
+ Response (bye_neutral, ExitConversation);
+}
+
+static void
+OrzAngry (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_angry))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (ORZ_GENERAL_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_ANGRY_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_ANGRY_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_GENERAL_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_angry);
+ }
+
+ if (PHRASE_ENABLED (whats_up_angry))
+ {
+ Response (whats_up_angry, OrzAngry);
+ }
+ Response (were_sorry, ExitConversation);
+ switch (GET_GAME_STATE (ORZ_PERSONAL_INFO))
+ {
+ case 0:
+ Response (insult_1, ExitConversation);
+ break;
+ case 1:
+ Response (insult_2, ExitConversation);
+ break;
+ case 2:
+ Response (insult_3, ExitConversation);
+ break;
+ case 3:
+ Response (insult_4, ExitConversation);
+ break;
+ case 4:
+ Response (insult_5, ExitConversation);
+ break;
+ case 5:
+ Response (insult_6, ExitConversation);
+ break;
+ case 6:
+ Response (insult_7, ExitConversation);
+ break;
+ case 7:
+ Response (insult_8, ExitConversation);
+ break;
+ }
+ Response (bye_angry, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits, Manner;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (!GET_GAME_STATE (MET_ORZ_BEFORE))
+ NPCPhrase (INIT_HELLO);
+
+ Manner = GET_GAME_STATE (ORZ_MANNER);
+ if (Manner == 2)
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+
+ NumVisits = GET_GAME_STATE (ORZ_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NumVisits = GET_GAME_STATE (TAALO_VISITS);
+ if (Manner != 1)
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FRIENDLY_ALLIED_TAALO_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (FRIENDLY_ALLIED_TAALO_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ANGRY_TAALO_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ANGRY_TAALO_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (TAALO_VISITS, NumVisits);
+
+ TaaloWorld ((RESPONSE_REF)0);
+ }
+ else if (Manner == 3 && CheckAlliance (ORZ_SHIP) == GOOD_GUY)
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (ORZ_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (ORZ_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ALLIED_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ALLIED_SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (ALLIED_SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (ALLIED_SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_VISITS, NumVisits);
+ }
+
+ OrzAllied ((RESPONSE_REF)0);
+ }
+ else if (Manner != 1)
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (ORZ_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (ORZ_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_VISITS, NumVisits);
+ }
+
+ OrzNeutral ((RESPONSE_REF)0);
+ }
+ else
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (ORZ_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ANGRY_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ANGRY_HOMEWORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (ORZ_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ANGRY_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ANGRY_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ORZ_VISITS, NumVisits);
+ }
+
+ OrzAngry ((RESPONSE_REF)0);
+ }
+
+ if (!GET_GAME_STATE (MET_ORZ_BEFORE))
+ {
+ SET_GAME_STATE (MET_ORZ_BEFORE, 1);
+
+ // Disable talking anim and run the computer report
+ EnableTalkingAnim (FALSE);
+ AlienTalkSegue (1);
+ // Run whatever is left with talking anim
+ EnableTalkingAnim (TRUE);
+ }
+}
+
+static COUNT
+uninit_orz (void)
+{
+ return (0);
+}
+
+static void
+post_orz_enc (void)
+{
+ BYTE Manner;
+
+ if (getSegue () == Segue_hostile
+ && (Manner = GET_GAME_STATE (ORZ_MANNER)) != 2)
+ {
+ SET_GAME_STATE (ORZ_MANNER, 1);
+ if (Manner != 1)
+ {
+ SET_GAME_STATE (ORZ_VISITS, 0);
+ SET_GAME_STATE (ORZ_HOME_VISITS, 0);
+ SET_GAME_STATE (TAALO_VISITS, 0);
+ }
+ }
+}
+
+LOCDATA*
+init_orz_comm (void)
+{
+ LOCDATA *retval;
+
+ orz_desc.init_encounter_func = Intro;
+ orz_desc.post_encounter_func = post_orz_enc;
+ orz_desc.uninit_encounter_func = uninit_orz;
+
+ orz_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ orz_desc.AlienTextBaseline.y = 0;
+ orz_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (ORZ_MANNER) == 3
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &orz_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/orz/resinst.h b/src/uqm/comm/orz/resinst.h
new file mode 100644
index 0000000..a526cef
--- /dev/null
+++ b/src/uqm/comm/orz/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define ORZ_COLOR_MAP "comm.orz.colortable"
+#define ORZ_CONVERSATION_PHRASES "comm.orz.dialogue"
+#define ORZ_FONT "comm.orz.font"
+#define ORZ_MUSIC "comm.orz.music"
+#define ORZ_PMAP_ANIM "comm.orz.graphics"
diff --git a/src/uqm/comm/orz/strings.h b/src/uqm/comm/orz/strings.h
new file mode 100644
index 0000000..7eabebe
--- /dev/null
+++ b/src/uqm/comm/orz/strings.h
@@ -0,0 +1,143 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ORZ_STRINGS_H
+#define ORZ_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ INIT_HELLO,
+ who_you,
+ WE_ARE_ORZ,
+ why_here,
+ HERE_BECAUSE,
+ ALLIED_HOMEWORLD_HELLO_1,
+ ALLIED_HOMEWORLD_HELLO_2,
+ ALLIED_HOMEWORLD_HELLO_3,
+ ALLIED_HOMEWORLD_HELLO_4,
+ ALLIED_SPACE_HELLO_1,
+ ALLIED_SPACE_HELLO_2,
+ ALLIED_SPACE_HELLO_3,
+ ALLIED_SPACE_HELLO_4,
+ whats_up_ally,
+ GENERAL_INFO_ALLY_1,
+ GENERAL_INFO_ALLY_2,
+ GENERAL_INFO_ALLY_3,
+ GENERAL_INFO_ALLY_4,
+ more_about_you,
+ ABOUT_US_1,
+ ABOUT_US_2,
+ ABOUT_US_3,
+ ABOUT_US_4,
+ where_androsyn,
+ DISEMBLE_ABOUT_ANDROSYN,
+ must_know_about_androsyn,
+ KNOW_TOO_MUCH,
+ dont_really_care,
+ YOU_ARE_OUR_FRIENDS,
+ about_andro_1,
+ FORGET_ANDRO_1,
+ about_andro_2,
+ FORGET_ANDRO_2,
+ about_andro_3,
+ BLEW_IT,
+ NEUTRAL_HOMEWORLD_HELLO_1,
+ NEUTRAL_HOMEWORLD_HELLO_2,
+ NEUTRAL_HOMEWORLD_HELLO_3,
+ NEUTRAL_HOMEWORLD_HELLO_4,
+ NEUTRAL_SPACE_HELLO_1,
+ NEUTRAL_SPACE_HELLO_2,
+ NEUTRAL_SPACE_HELLO_3,
+ NEUTRAL_SPACE_HELLO_4,
+ hostile_1,
+ HOSTILITY_IS_BAD_1,
+ hostile_2,
+ HOSTILITY_IS_BAD_2,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ NICE_TO_MEET_YOU,
+ seem_like_nice_guys,
+ ARE_NICE_WANT_ALLY,
+ talk_about_alliance,
+ OK_TALK_ALLIANCE,
+ yes_alliance,
+ GREAT,
+ no_alliance,
+ MAYBE_LATER,
+ decide_later,
+ OK_LATER,
+ why_so_trusting,
+ TRUSTING_BECAUSE,
+ bye_neutral,
+ GOODBYE_NEUTRAL,
+ ANGRY_SPACE_HELLO_1,
+ ANGRY_SPACE_HELLO_2,
+ ANGRY_HOMEWORLD_HELLO_1,
+ ANGRY_HOMEWORLD_HELLO_2,
+ whats_up_angry,
+ GENERAL_INFO_ANGRY_1,
+ GENERAL_INFO_ANGRY_2,
+ were_sorry,
+ APOLOGY_ACCEPTED,
+ insult_1,
+ insult_2,
+ insult_3,
+ insult_4,
+ insult_5,
+ insult_6,
+ insult_7,
+ insult_8,
+ INSULTED_1,
+ INSULTED_2,
+ INSULTED_3,
+ INSULTED_4,
+ bye_angry,
+ GOODBYE_ANGRY,
+ ANGRY_TAALO_HELLO_1,
+ ANGRY_TAALO_HELLO_2,
+ FRIENDLY_ALLIED_TAALO_HELLO_1,
+ FRIENDLY_ALLIED_TAALO_HELLO_2,
+ demand_to_land,
+ NO_DEMAND,
+ ASK_NICELY,
+ why_you_here,
+ ANGRY_EXPLANATION,
+ FRIENDLY_EXPLANATION,
+ what_is_this_place,
+ FRIENDLY_PLACE,
+ ANGRY_PLACE,
+ may_we_land,
+ SURE_LAND,
+ ALLIES_CAN_VISIT,
+ make_alliance,
+ CANT_ALLY_HERE,
+ why_busy,
+ BUSY_BECAUSE,
+ bye_taalo,
+ bye_ally,
+ GOODBYE_ALLY,
+ FRIENDLY_TAALO_GOODBYE,
+ ANGRY_TAALO_GOODBYE,
+ HOSTILE_HELLO_1,
+ HOSTILE_HELLO_2,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/pkunk/Makeinfo b/src/uqm/comm/pkunk/Makeinfo
new file mode 100644
index 0000000..67dc511
--- /dev/null
+++ b/src/uqm/comm/pkunk/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="pkunkc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/pkunk/pkunkc.c b/src/uqm/comm/pkunk/pkunkc.c
new file mode 100644
index 0000000..5db575d
--- /dev/null
+++ b/src/uqm/comm/pkunk/pkunkc.c
@@ -0,0 +1,1148 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/gameev.h"
+
+
+static LOCDATA pkunk_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ PKUNK_PMAP_ANIM, /* AlienFrame */
+ PKUNK_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ PKUNK_COLOR_MAP, /* AlienColorMap */
+ PKUNK_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ PKUNK_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 3, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 3, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 7, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2), /* BlockMask */
+ },
+ {
+ 11, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 1), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 2, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 6, /* FrameRate */
+ ONE_SECOND / 12, ONE_SECOND / 2, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static BOOLEAN
+ShipsReady (void)
+{
+ SIZE i;
+
+ return (GET_GAME_STATE (PKUNK_MANNER) == 3
+ && !((i = (GLOBAL (GameClock.year_index) - START_YEAR) - GET_GAME_STATE (PKUNK_SHIP_YEAR)) < 0
+ || ((i == 0 && (i = GLOBAL (GameClock.month_index) - GET_GAME_STATE (PKUNK_SHIP_MONTH)) < 0)
+ || (i == 0 && GLOBAL (GameClock.day_index) < GET_GAME_STATE (PKUNK_SHIP_DAY)))));
+}
+
+static void
+PrepareShip (void)
+{
+#define MAX_PKUNK_SHIPS 4
+ if (AddEscortShips (PKUNK_SHIP, MAX_PKUNK_SHIPS))
+ {
+ BYTE mi, di, yi;
+
+ mi = GLOBAL (GameClock.month_index);
+ SET_GAME_STATE (PKUNK_SHIP_MONTH, mi);
+ if ((di = GLOBAL (GameClock.day_index)) > 28)
+ di = 28;
+ SET_GAME_STATE (PKUNK_SHIP_DAY, di);
+ yi = (BYTE)(GLOBAL (GameClock.year_index) - START_YEAR) + 1;
+ SET_GAME_STATE (PKUNK_SHIP_YEAR, yi);
+ }
+}
+
+#define GOOD_REASON_1 (1 << 0)
+#define GOOD_REASON_2 (1 << 1)
+#define BAD_REASON_1 (1 << 2)
+#define BAD_REASON_2 (1 << 3)
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, friendly_bye_space))
+ NPCPhrase (FRIENDLY_GOODBYE_SPACE);
+ else if (PLAYER_SAID (R, neutral_bye_space))
+ NPCPhrase (NEUTRAL_GOODBYE_SPACE);
+ else if (PLAYER_SAID (R, bye_angry))
+ NPCPhrase (GOODBYE_ANGRY);
+ else if (PLAYER_SAID (R, bye_friendly))
+ NPCPhrase (GOODBYE_FRIENDLY);
+ else if (PLAYER_SAID (R, we_here_to_help)
+ || PLAYER_SAID (R, we_need_help))
+ {
+ if (PLAYER_SAID (R, we_here_to_help))
+ NPCPhrase (NEED_HELP);
+ else
+ NPCPhrase (GIVE_HELP);
+ NPCPhrase (ALMOST_ALLIANCE);
+
+ SET_GAME_STATE (PKUNK_MANNER, 3);
+ SET_GAME_STATE (PKUNK_VISITS, 0);
+ SET_GAME_STATE (PKUNK_HOME_VISITS, 0);
+ SET_GAME_STATE (PKUNK_INFO, 0);
+
+ AddEvent (RELATIVE_EVENT, 6, 0, 0, ADVANCE_PKUNK_MISSION);
+ if (EscortFeasibilityStudy (PKUNK_SHIP) == 0)
+ NPCPhrase (INIT_NO_ROOM);
+ else
+ {
+ NPCPhrase (INIT_SHIP_GIFT);
+ AlienTalkSegue ((COUNT)~0);
+ PrepareShip ();
+ }
+ }
+ else if (PLAYER_SAID (R, try_to_be_nicer))
+ {
+ NPCPhrase (CANT_ASK_FOR_MORE);
+ NPCPhrase (VISIT_OUR_HOMEWORLD);
+
+ SET_GAME_STATE (PKUNK_MANNER, 3);
+ SET_GAME_STATE (PKUNK_VISITS, 0);
+ SET_GAME_STATE (PKUNK_HOME_VISITS, 0);
+ SET_GAME_STATE (PKUNK_INFO, 0);
+ }
+ else if (PLAYER_SAID (R, must_conquer)
+ || PLAYER_SAID (R, obey))
+ {
+ if (PLAYER_SAID (R, obey))
+ NPCPhrase (NO_OBEY);
+ else
+ {
+ NPCPhrase (BAD_IDEA);
+
+ SET_GAME_STATE (PKUNK_MANNER, 2);
+ }
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, die_idiot_fools))
+ {
+ NPCPhrase (VERY_WELL);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, suit_yourself))
+ NPCPhrase (GOODBYE_MIGRATION);
+ else
+ {
+ BYTE ReasonMask;
+
+ ReasonMask = GET_GAME_STATE (PKUNK_REASONS);
+ if (PLAYER_SAID (R, good_reason_1))
+ {
+ NPCPhrase (WE_GO_HOME_1);
+ ReasonMask |= GOOD_REASON_1;
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_PKUNK_MISSION);
+ }
+ else if (PLAYER_SAID (R, good_reason_2))
+ {
+ NPCPhrase (WE_GO_HOME_2);
+ ReasonMask |= GOOD_REASON_2;
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_PKUNK_MISSION);
+ }
+ else if (PLAYER_SAID (R, bad_reason_1))
+ {
+ NPCPhrase (NO_GO_HOME_1);
+ ReasonMask |= BAD_REASON_1;
+ }
+ else if (PLAYER_SAID (R, bad_reason_2))
+ {
+ NPCPhrase (NO_GO_HOME_2);
+ ReasonMask |= BAD_REASON_2;
+ }
+ SET_GAME_STATE (PKUNK_REASONS, ReasonMask);
+ }
+}
+
+static void PkunkHome (RESPONSE_REF R);
+
+static void
+PkunkAngry (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, why_insults))
+ {
+ NPCPhrase (RELEASE_TENSION);
+
+ DISABLE_PHRASE (why_insults);
+ }
+ else if (PLAYER_SAID (R, what_about_you))
+ {
+ NPCPhrase (ABOUT_US);
+
+ DISABLE_PHRASE (what_about_you);
+ }
+ else if (PLAYER_SAID (R, should_be_friends))
+ {
+ NPCPhrase (YES_FRIENDS);
+
+ DISABLE_PHRASE (should_be_friends);
+ }
+
+ if (PHRASE_ENABLED (should_be_friends))
+ {
+ Response (should_be_friends, PkunkAngry);
+ }
+ else
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ Response (try_to_be_nicer, PkunkHome);
+ else
+ Response (try_to_be_nicer, ExitConversation);
+ }
+ Response (die_idiot_fools, ExitConversation);
+ if (PHRASE_ENABLED (why_insults))
+ Response (why_insults, PkunkAngry);
+ if (PHRASE_ENABLED (what_about_you))
+ Response (what_about_you, PkunkAngry);
+ Response (bye_angry, ExitConversation);
+}
+
+static void
+DiscussConquer (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, we_conquer))
+ {
+ NPCPhrase (WHY_CONQUER);
+
+ DISABLE_PHRASE (we_conquer);
+ }
+ else if (PLAYER_SAID (R, conquer_because_1))
+ {
+#if 0
+ NPCPhrase (NOT_CONQUER_10);
+ NPCPhrase (GLOBAL_ALLIANCE_NAME + name_1);
+ NPCPhrase (NOT_CONQUER_11);
+ NPCPhrase (GLOBAL_ALLIANCE_NAME + name_1);
+ NPCPhrase (NOT_CONQUER_12);
+#endif
+ NPCPhrase (NOT_CONQUER_1);
+
+ DISABLE_PHRASE (conquer_because_1);
+ }
+ else if (PLAYER_SAID (R, conquer_because_2))
+ {
+ NPCPhrase (NOT_CONQUER_2);
+
+ DISABLE_PHRASE (conquer_because_2);
+ }
+
+ if (PHRASE_ENABLED (conquer_because_1))
+ {
+#if 0
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ conquer_because_1,
+ buf,
+ (RESPONSE_REF)-1);
+ DoResponsePhrase (conquer_because_1, DiscussConquer, shared_phrase_buf);
+#endif
+ Response(conquer_because_1, DiscussConquer);
+ }
+ if (PHRASE_ENABLED (conquer_because_2))
+ Response (conquer_because_2, DiscussConquer);
+ Response (must_conquer, ExitConversation);
+ Response (no_conquest, PkunkHome);
+}
+
+static void
+OfferAlliance (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, we_are_vindicator0))
+ NPCPhrase (WHY_YOU_HERE);
+ else if (PLAYER_SAID (R, exploring_universe))
+ {
+ NPCPhrase (SENSE_DEEPER_CONFLICT);
+
+ DISABLE_PHRASE (exploring_universe);
+ }
+ else if (PLAYER_SAID (R, fun_cruise))
+ {
+ NPCPhrase (REPRESS);
+
+ DISABLE_PHRASE (fun_cruise);
+ }
+
+ Response (we_here_to_help, ExitConversation);
+ Response (we_need_help, ExitConversation);
+ if (PHRASE_ENABLED (exploring_universe))
+ Response (exploring_universe, OfferAlliance);
+ if (PHRASE_ENABLED (fun_cruise))
+ Response (fun_cruise, OfferAlliance);
+}
+
+static void
+AboutPkunk (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ InfoLeft = FALSE;
+ if (PLAYER_SAID (R, what_about_you))
+ NPCPhrase (ABOUT_US);
+ else if (PLAYER_SAID (R, what_about_history))
+ {
+ NPCPhrase (ABOUT_HISTORY);
+
+ DISABLE_PHRASE (what_about_history);
+ }
+ else if (PLAYER_SAID (R, what_about_yehat))
+ {
+ NPCPhrase (ABOUT_YEHAT);
+
+ DISABLE_PHRASE (what_about_yehat);
+ }
+ else if (PLAYER_SAID (R, what_about_culture))
+ {
+ NPCPhrase (ABOUT_CULTURE);
+
+ DISABLE_PHRASE (what_about_culture);
+ }
+ else if (PLAYER_SAID (R, elaborate_culture))
+ {
+ NPCPhrase (OK_ELABORATE_CULTURE);
+
+ DISABLE_PHRASE (elaborate_culture);
+ }
+ else if (PLAYER_SAID (R, what_about_future))
+ {
+ NPCPhrase (ABOUT_FUTURE);
+
+ DISABLE_PHRASE (what_about_future);
+ }
+
+ if (PHRASE_ENABLED (what_about_history))
+ {
+ Response (what_about_history, AboutPkunk);
+ InfoLeft = TRUE;
+ }
+ else if (PHRASE_ENABLED (what_about_yehat))
+ {
+ Response (what_about_yehat, AboutPkunk);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_culture))
+ {
+ Response (what_about_culture, AboutPkunk);
+ InfoLeft = TRUE;
+ }
+ else if (PHRASE_ENABLED (elaborate_culture))
+ {
+ Response (elaborate_culture, AboutPkunk);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_future))
+ {
+ Response (what_about_future, AboutPkunk);
+ InfoLeft = TRUE;
+ }
+ Response (enough_about_you, PkunkHome);
+
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (what_about_you);
+ }
+}
+
+static void
+AboutIlwrath (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ InfoLeft = FALSE;
+ if (PLAYER_SAID (R, what_about_ilwrath))
+ NPCPhrase (ABOUT_ILWRATH);
+ else if (PLAYER_SAID (R, why_ilwrath_fight))
+ {
+ NPCPhrase (ILWRATH_FIGHT_BECAUSE);
+
+ DISABLE_PHRASE (why_ilwrath_fight);
+ }
+ else if (PLAYER_SAID (R, when_fight_start))
+ {
+ NPCPhrase (FIGHT_START_WHEN);
+
+ DISABLE_PHRASE (when_fight_start);
+ }
+ else if (PLAYER_SAID (R, how_goes_fight))
+ {
+ NPCPhrase (FIGHT_GOES);
+
+ DISABLE_PHRASE (how_goes_fight);
+ }
+ else if (PLAYER_SAID (R, how_stop_fight))
+ {
+ NPCPhrase (STOP_FIGHT_LIKE_SO);
+
+ DISABLE_PHRASE (how_stop_fight);
+ }
+
+ if (PHRASE_ENABLED (why_ilwrath_fight))
+ {
+ Response (why_ilwrath_fight, AboutIlwrath);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (when_fight_start))
+ {
+ Response (when_fight_start, AboutIlwrath);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (how_goes_fight))
+ {
+ Response (how_goes_fight, AboutIlwrath);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (how_stop_fight))
+ {
+ Response (how_stop_fight, AboutIlwrath);
+ InfoLeft = TRUE;
+ }
+ Response (enough_ilwrath, PkunkHome);
+
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (what_about_ilwrath);
+ }
+}
+
+static void
+PkunkHome (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, no_conquest))
+ NPCPhrase (GOOD_IDEA);
+ else if (PLAYER_SAID (R, enough_ilwrath))
+ NPCPhrase (OK_ENOUGH_ILWRATH);
+ else if (PLAYER_SAID (R, enough_about_you))
+ NPCPhrase (OK_ENOUGH_ABOUT_US);
+ else if (PLAYER_SAID (R, where_fleet_1)
+ || PLAYER_SAID (R, where_fleet_2)
+ || PLAYER_SAID (R, where_fleet_3))
+ {
+ SET_GAME_STATE (PKUNK_SWITCH, 1);
+ if (!(GET_GAME_STATE (PKUNK_MISSION) & 1))
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_RETURN);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (RETURNING_FROM_YEHAT_1);
+ break;
+ case 1:
+ NPCPhrase (RETURNING_FROM_YEHAT_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_RETURN, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_MIGRATE);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (MIGRATING_HOMEWORLD_1);
+ break;
+ case 1:
+ NPCPhrase (MIGRATING_HOMEWORLD_2);
+ break;
+ case 2:
+ NPCPhrase (MIGRATING_HOMEWORLD_3);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_MIGRATE, NumVisits);
+ }
+
+ NumVisits = GET_GAME_STATE (PKUNK_FLEET) + 1;
+ SET_GAME_STATE (PKUNK_FLEET, NumVisits);
+
+ DISABLE_PHRASE (where_fleet_1);
+ }
+ else if (PLAYER_SAID (R, am_worried_1)
+ || PLAYER_SAID (R, am_worried_2)
+ || PLAYER_SAID (R, am_worried_3))
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_WORRY);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (DONT_WORRY_1);
+ break;
+ case 1:
+ NPCPhrase (DONT_WORRY_2);
+ break;
+ case 2:
+ NPCPhrase (DONT_WORRY_3);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_WORRY, NumVisits);
+
+ DISABLE_PHRASE (am_worried_1);
+ }
+ else if (PLAYER_SAID (R, try_to_be_nicer))
+ {
+ NPCPhrase (CANT_ASK_FOR_MORE);
+ if (!GET_GAME_STATE (CLEAR_SPINDLE))
+ {
+ NPCPhrase (GIVE_SPINDLE);
+
+ SET_GAME_STATE (CLEAR_SPINDLE, 1);
+ SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1);
+ }
+ NPCPhrase (CAN_BE_FRIENDS);
+
+ SET_GAME_STATE (PKUNK_MANNER, 3);
+ SET_GAME_STATE (PKUNK_VISITS, 0);
+ SET_GAME_STATE (PKUNK_HOME_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, what_about_ilwrath))
+ {
+ NPCPhrase (ABOUT_ILWRATH /* ILWRATH_GONE */);
+
+ DISABLE_PHRASE (what_about_ilwrath);
+ }
+
+ if (PHRASE_ENABLED (we_conquer) && GET_GAME_STATE (PKUNK_MANNER) == 0)
+ {
+ Response (we_conquer, DiscussConquer);
+ }
+ if (GET_GAME_STATE (PKUNK_ON_THE_MOVE))
+ {
+ if (PHRASE_ENABLED (where_fleet_1) && !GET_GAME_STATE (PKUNK_SWITCH))
+ {
+ switch (GET_GAME_STATE (PKUNK_FLEET))
+ {
+ case 0:
+ Response (where_fleet_1, PkunkHome);
+ break;
+ case 1:
+ Response (where_fleet_2, PkunkHome);
+ break;
+ case 2:
+ Response (where_fleet_3, PkunkHome);
+ break;
+ }
+ }
+ else if (!PHRASE_ENABLED (where_fleet_1)
+ && PHRASE_ENABLED (am_worried_1)
+ && (GET_GAME_STATE (PKUNK_MISSION) & 1))
+ {
+ switch (GET_GAME_STATE (PKUNK_WORRY))
+ {
+ case 0:
+ Response (am_worried_1, PkunkHome);
+ break;
+ case 1:
+ Response (am_worried_2, PkunkHome);
+ break;
+ case 2:
+ Response (am_worried_3, PkunkHome);
+ break;
+ }
+ }
+ }
+ if (!GET_GAME_STATE (PKUNK_SHIP_MONTH))
+ {
+ construct_response (shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_are_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ DoResponsePhrase (we_are_vindicator0, OfferAlliance, shared_phrase_buf);
+ }
+ if (PHRASE_ENABLED (what_about_you))
+ {
+ Response (what_about_you, AboutPkunk);
+ }
+ if (PHRASE_ENABLED (what_about_ilwrath))
+ {
+ if (!GET_GAME_STATE (ILWRATH_DECEIVED))
+ {
+ Response (what_about_ilwrath, AboutIlwrath);
+ }
+ else
+ {
+ Response (what_about_ilwrath, PkunkHome);
+ }
+ }
+ Response (bye_friendly, ExitConversation);
+}
+
+static void
+PkunkFriendlySpace (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_space))
+ {
+ if (ShipsReady ())
+ NPCPhrase (SHIPS_AT_HOME);
+ else
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_SPACE_4);
+ break;
+ case 4:
+ NPCPhrase (GENERAL_INFO_SPACE_5);
+ break;
+ case 5:
+ NPCPhrase (GENERAL_INFO_SPACE_6);
+ break;
+ case 6:
+ NPCPhrase (GENERAL_INFO_SPACE_7);
+ break;
+ case 7:
+ NPCPhrase (GENERAL_INFO_SPACE_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_INFO, NumVisits);
+ }
+
+ DISABLE_PHRASE (whats_up_space);
+ }
+ else if (PLAYER_SAID (R, how_goes_war))
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_WAR);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (WAR_GOES_1);
+ SET_GAME_STATE (KNOW_URQUAN_STORY, 1);
+ SET_GAME_STATE (KNOW_KOHR_AH_STORY, 1);
+ break;
+ case 1:
+ NPCPhrase (WAR_GOES_2);
+ break;
+ case 2:
+ NPCPhrase (WAR_GOES_3);
+ break;
+ case 3:
+ NPCPhrase (WAR_GOES_4);
+ SET_GAME_STATE (PKUNK_DONE_WAR, 1);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_WAR, NumVisits);
+
+ DISABLE_PHRASE (how_goes_war);
+ }
+ else if (PLAYER_SAID (R, tell_my_fortune))
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_FORTUNE);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FORTUNE_IS_1);
+ break;
+ case 1:
+ NPCPhrase (FORTUNE_IS_2);
+ break;
+ case 2:
+ NPCPhrase (FORTUNE_IS_3);
+ break;
+ case 3:
+ NPCPhrase (FORTUNE_IS_4);
+ break;
+ case 4:
+ NPCPhrase (FORTUNE_IS_5);
+ break;
+ case 5:
+ NPCPhrase (FORTUNE_IS_6);
+ break;
+ case 6:
+ NPCPhrase (FORTUNE_IS_7);
+ break;
+ case 7:
+ NPCPhrase (FORTUNE_IS_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_FORTUNE, NumVisits);
+
+ DISABLE_PHRASE (tell_my_fortune);
+ }
+
+ if (PHRASE_ENABLED (whats_up_space))
+ Response (whats_up_space, PkunkFriendlySpace);
+ if (!GET_GAME_STATE (PKUNK_DONE_WAR) && PHRASE_ENABLED (how_goes_war))
+ Response (how_goes_war, PkunkFriendlySpace);
+ if (PHRASE_ENABLED (tell_my_fortune))
+ Response (tell_my_fortune, PkunkFriendlySpace);
+ Response (friendly_bye_space, ExitConversation);
+}
+
+static void
+PkunkNeutralSpace (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, form_alliance))
+ {
+ NPCPhrase (GO_TO_HOMEWORLD);
+
+ DISABLE_PHRASE (form_alliance);
+ }
+ else if (PLAYER_SAID (R, can_you_help))
+ {
+ NPCPhrase (GO_TO_HOMEWORLD_AGAIN);
+
+ DISABLE_PHRASE (can_you_help);
+ }
+ else if (PLAYER_SAID (R, hostile_greeting))
+ {
+ NPCPhrase (DONT_BE_HOSTILE);
+
+ DISABLE_PHRASE (hostile_greeting);
+ }
+ else if (PLAYER_SAID (R, whats_up_neutral))
+ {
+ NumVisits = GET_GAME_STATE (PKUNK_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_SPACE_6 /* was 3 */);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_SPACE_7 /* was 4 */);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_neutral);
+ }
+
+ if (PHRASE_ENABLED (form_alliance))
+ Response (form_alliance, PkunkNeutralSpace);
+ else if (PHRASE_ENABLED (can_you_help))
+ Response (can_you_help, PkunkNeutralSpace);
+ if (PHRASE_ENABLED (hostile_greeting))
+ Response (hostile_greeting, PkunkNeutralSpace);
+ else
+ {
+ Response (obey, ExitConversation);
+ }
+ if (PHRASE_ENABLED (whats_up_neutral))
+ Response (whats_up_neutral, PkunkNeutralSpace);
+ Response (neutral_bye_space, ExitConversation);
+}
+
+static void
+PkunkMigrate (RESPONSE_REF R)
+{
+ BYTE ReasonMask;
+ (void) R; // ignored
+
+ ReasonMask = GET_GAME_STATE (PKUNK_REASONS);
+ if (!(ReasonMask & GOOD_REASON_1))
+ Response (good_reason_1, ExitConversation);
+ if (!(ReasonMask & BAD_REASON_1))
+ Response (bad_reason_1, ExitConversation);
+ if (!(ReasonMask & GOOD_REASON_2))
+ Response (good_reason_2, ExitConversation);
+ if (!(ReasonMask & BAD_REASON_2))
+ Response (bad_reason_2, ExitConversation);
+ Response (suit_yourself, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits, Manner;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ Manner = GET_GAME_STATE (PKUNK_MANNER);
+ if (Manner == 2)
+ {
+ // Irreparably Pissed off the Pkunk.
+ NumVisits = GET_GAME_STATE (PKUNK_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HATE_YOU_FOREVER_1);
+ break;
+ case 1:
+ NPCPhrase (HATE_YOU_FOREVER_2);
+ break;
+ case 2:
+ NPCPhrase (HATE_YOU_FOREVER_3);
+ break;
+ case 3:
+ NPCPhrase (HATE_YOU_FOREVER_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else if (Manner == 1)
+ {
+ // Bad relations with the Pkunk, but not irreparably.
+ NumVisits = GET_GAME_STATE (PKUNK_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (SPIRITUAL_PROBLEMS_1);
+ break;
+ case 1:
+ NPCPhrase (SPIRITUAL_PROBLEMS_2);
+ break;
+ case 2:
+ NPCPhrase (SPIRITUAL_PROBLEMS_3);
+ break;
+ case 3:
+ NPCPhrase (SPIRITUAL_PROBLEMS_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_VISITS, NumVisits);
+
+ PkunkAngry ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ // Encountering the Pkunk at their home world.
+ if (!GET_GAME_STATE (CLEAR_SPINDLE))
+ {
+ NPCPhrase (GIVE_SPINDLE);
+
+ SET_GAME_STATE (CLEAR_SPINDLE, 1);
+ SET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP, 1);
+ }
+ else if (!GET_GAME_STATE (PKUNK_SENSE_VICTOR)
+ && GLOBAL (GameClock.year_index) > START_YEAR
+ && !GET_GAME_STATE (KOHR_AH_FRENZY))
+ {
+ NPCPhrase (SENSE_KOHRAH_VICTORY);
+
+ SET_GAME_STATE (PKUNK_SENSE_VICTOR, 1);
+ }
+
+ NumVisits = GET_GAME_STATE (PKUNK_HOME_VISITS);
+ if (Manner == 0)
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ }
+ else
+ {
+ if (NumVisits && ShipsReady ())
+ {
+ if (EscortFeasibilityStudy (PKUNK_SHIP) == 0)
+ NPCPhrase (NO_ROOM);
+ else
+ {
+ NPCPhrase (SHIP_GIFT);
+ PrepareShip ();
+ }
+ }
+ else switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_4);
+ break;
+ case 4:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_5);
+ break;
+ case 5:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_6);
+ break;
+ case 6:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_7);
+ break;
+ case 7:
+ NPCPhrase (FRIENDLY_HOMEWORLD_HELLO_8);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (PKUNK_HOME_VISITS, NumVisits);
+
+ PkunkHome ((RESPONSE_REF)0);
+ }
+ else if ((NumVisits = GET_GAME_STATE (PKUNK_MISSION)) == 0
+ || !(NumVisits & 1))
+ {
+ // Encountering a Pkunk ship in space, while they are not
+ // migrating.
+ NumVisits = GET_GAME_STATE (PKUNK_VISITS);
+ if (Manner == 3)
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_4);
+ break;
+ case 4:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_5);
+ break;
+ case 5:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_6);
+ break;
+ case 6:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_7);
+ break;
+ case 7:
+ NPCPhrase (FRIENDLY_SPACE_HELLO_8);
+ --NumVisits;
+ break;
+ }
+
+ PkunkFriendlySpace ((RESPONSE_REF)0);
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+
+ PkunkNeutralSpace ((RESPONSE_REF)0);
+ }
+ SET_GAME_STATE (PKUNK_VISITS, NumVisits);
+
+ }
+ else
+ {
+ // Encountering a Pkunk ship in space, while they are
+ // migrating.
+ NumVisits = GET_GAME_STATE (PKUNK_MIGRATE_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (MIGRATING_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (MIGRATING_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (MIGRATING_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (MIGRATING_SPACE_4);
+ break;
+ case 4:
+ NPCPhrase (MIGRATING_SPACE_5);
+ break;
+ case 5:
+ NPCPhrase (MIGRATING_SPACE_6);
+ break;
+ case 6:
+ NPCPhrase (MIGRATING_SPACE_7);
+ break;
+ case 7:
+ NPCPhrase (MIGRATING_SPACE_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (PKUNK_MIGRATE_VISITS, NumVisits);
+
+ PkunkMigrate ((RESPONSE_REF)0);
+ }
+}
+
+// Called after combat or communications
+static COUNT
+uninit_pkunk (void)
+{
+ return (0);
+}
+
+static void
+post_pkunk_enc (void)
+{
+ BYTE Manner;
+
+ if (getSegue () == Segue_hostile
+ && (Manner = GET_GAME_STATE (PKUNK_MANNER)) != 2)
+ {
+ SET_GAME_STATE (PKUNK_MANNER, 1);
+ if (Manner != 1)
+ {
+ SET_GAME_STATE (PKUNK_VISITS, 0);
+ SET_GAME_STATE (PKUNK_HOME_VISITS, 0);
+ }
+ }
+}
+
+LOCDATA*
+init_pkunk_comm (void)
+{
+ LOCDATA *retval;
+
+ pkunk_desc.init_encounter_func = Intro;
+ pkunk_desc.post_encounter_func = post_pkunk_enc;
+ pkunk_desc.uninit_encounter_func = uninit_pkunk;
+
+ pkunk_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ pkunk_desc.AlienTextBaseline.y = 0;
+ pkunk_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (PKUNK_MANNER) == 3
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ // Enter communications immediately.
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ // Ask the player whether to attack or talk.
+ setSegue (Segue_hostile);
+ }
+ retval = &pkunk_desc;
+
+ return (retval);
+}
+
+
diff --git a/src/uqm/comm/pkunk/resinst.h b/src/uqm/comm/pkunk/resinst.h
new file mode 100644
index 0000000..8f9ab7a
--- /dev/null
+++ b/src/uqm/comm/pkunk/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define PKUNK_COLOR_MAP "comm.pkunk.colortable"
+#define PKUNK_CONVERSATION_PHRASES "comm.pkunk.dialogue"
+#define PKUNK_FONT "comm.pkunk.font"
+#define PKUNK_MUSIC "comm.pkunk.music"
+#define PKUNK_PMAP_ANIM "comm.pkunk.graphics"
diff --git a/src/uqm/comm/pkunk/strings.h b/src/uqm/comm/pkunk/strings.h
new file mode 100644
index 0000000..beb8b86
--- /dev/null
+++ b/src/uqm/comm/pkunk/strings.h
@@ -0,0 +1,214 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef PKUNK_STRINGS_H
+#define PKUNK_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ GIVE_SPINDLE,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ NEUTRAL_SPACE_HELLO_1,
+ NEUTRAL_SPACE_HELLO_3,
+ NEUTRAL_SPACE_HELLO_2,
+ NEUTRAL_SPACE_HELLO_4,
+ FRIENDLY_SPACE_HELLO_1,
+ FRIENDLY_SPACE_HELLO_2,
+ FRIENDLY_SPACE_HELLO_3,
+ FRIENDLY_SPACE_HELLO_4,
+ FRIENDLY_SPACE_HELLO_5,
+ FRIENDLY_SPACE_HELLO_6,
+ FRIENDLY_SPACE_HELLO_7,
+ FRIENDLY_SPACE_HELLO_8,
+ NEUTRAL_HOMEWORLD_HELLO_1,
+ NEUTRAL_HOMEWORLD_HELLO_2,
+ NEUTRAL_HOMEWORLD_HELLO_3,
+ NEUTRAL_HOMEWORLD_HELLO_4,
+ FRIENDLY_HOMEWORLD_HELLO_1,
+ FRIENDLY_HOMEWORLD_HELLO_2,
+ FRIENDLY_HOMEWORLD_HELLO_3,
+ FRIENDLY_HOMEWORLD_HELLO_4,
+ FRIENDLY_HOMEWORLD_HELLO_5,
+ FRIENDLY_HOMEWORLD_HELLO_6,
+ FRIENDLY_HOMEWORLD_HELLO_7,
+ FRIENDLY_HOMEWORLD_HELLO_8,
+ whats_up_neutral,
+ GENERAL_INFO_NEUTRAL_1,
+ GENERAL_INFO_NEUTRAL_2,
+ GENERAL_INFO_NEUTRAL_3,
+ GENERAL_INFO_NEUTRAL_4,
+ good_reason_1,
+ WE_GO_HOME_1,
+ good_reason_2,
+ WE_GO_HOME_2,
+ bad_reason_1,
+ NO_GO_HOME_1,
+ bad_reason_2,
+ NO_GO_HOME_2,
+ SENSE_KOHRAH_VICTORY,
+ SPIRITUAL_PROBLEMS_1,
+ SPIRITUAL_PROBLEMS_2,
+ SPIRITUAL_PROBLEMS_3,
+ SPIRITUAL_PROBLEMS_4,
+ HATE_YOU_FOREVER_1,
+ HATE_YOU_FOREVER_2,
+ HATE_YOU_FOREVER_3,
+ HATE_YOU_FOREVER_4,
+ MIGRATING_SPACE_1,
+ MIGRATING_SPACE_2,
+ MIGRATING_SPACE_3,
+ MIGRATING_SPACE_4,
+ MIGRATING_SPACE_5,
+ MIGRATING_SPACE_6,
+ MIGRATING_SPACE_7,
+ MIGRATING_SPACE_8,
+ die_idiot_fools,
+ VERY_WELL,
+ why_insults,
+ RELEASE_TENSION,
+ what_about_you_angry,
+ ABOUT_US_ANGRY,
+ what_about_you,
+ should_be_friends,
+ YES_FRIENDS,
+ try_to_be_nicer,
+ CANT_ASK_FOR_MORE,
+ VISIT_OUR_HOMEWORLD,
+ CAN_BE_FRIENDS,
+ bye_angry,
+ GOODBYE_ANGRY,
+ we_conquer,
+ WHY_CONQUER,
+ conquer_because_1,
+#if 0
+ NOT_CONQUER_10,
+ NOT_CONQUER_11,
+ NOT_CONQUER_12,
+#endif
+ NOT_CONQUER_1,
+ conquer_because_2,
+ NOT_CONQUER_2,
+ must_conquer,
+ BAD_IDEA,
+ no_conquest,
+ GOOD_IDEA,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ WHY_YOU_HERE,
+ we_here_to_help,
+ NEED_HELP,
+ we_need_help,
+ GIVE_HELP,
+ exploring_universe,
+ SENSE_DEEPER_CONFLICT,
+ fun_cruise,
+ REPRESS,
+ why_ilwrath_fight,
+ ILWRATH_FIGHT_BECAUSE,
+ when_fight_start,
+ FIGHT_START_WHEN,
+ how_goes_fight,
+ FIGHT_GOES,
+ how_goes_war,
+ WAR_GOES_1,
+ WAR_GOES_2,
+ WAR_GOES_3,
+ WAR_GOES_4,
+ how_stop_fight,
+ STOP_FIGHT_LIKE_SO,
+ enough_ilwrath,
+ OK_ENOUGH_ILWRATH,
+ what_about_history,
+ ABOUT_HISTORY,
+ what_about_yehat,
+ ABOUT_YEHAT,
+ what_about_culture,
+ ABOUT_CULTURE,
+ elaborate_culture,
+ OK_ELABORATE_CULTURE,
+ what_about_future,
+ ABOUT_FUTURE,
+ enough_about_you,
+ OK_ENOUGH_ABOUT_US,
+ ABOUT_US,
+ where_fleet_1,
+ where_fleet_2,
+ where_fleet_3,
+ MIGRATING_HOMEWORLD_1,
+ MIGRATING_HOMEWORLD_2,
+ MIGRATING_HOMEWORLD_3,
+ RETURNING_FROM_YEHAT_1,
+ RETURNING_FROM_YEHAT_2,
+ am_worried_1,
+ am_worried_2,
+ am_worried_3,
+ DONT_WORRY_1,
+ DONT_WORRY_2,
+ DONT_WORRY_3,
+ form_alliance,
+ GO_TO_HOMEWORLD,
+ can_you_help,
+ GO_TO_HOMEWORLD_AGAIN,
+ hostile_greeting,
+ DONT_BE_HOSTILE,
+ obey,
+ NO_OBEY,
+ neutral_bye_space,
+ NEUTRAL_GOODBYE_SPACE,
+ SHIP_GIFT,
+ NO_ROOM,
+ friendly_bye_space,
+ FRIENDLY_GOODBYE_SPACE,
+ bye_friendly,
+ GOODBYE_FRIENDLY,
+ ALMOST_ALLIANCE,
+ INIT_NO_ROOM,
+ INIT_SHIP_GIFT,
+ suit_yourself,
+ GOODBYE_MIGRATION,
+ what_about_ilwrath,
+ ABOUT_ILWRATH,
+ whats_up_space,
+ SHIPS_AT_HOME,
+ GENERAL_INFO_SPACE_1,
+ GENERAL_INFO_SPACE_2,
+ GENERAL_INFO_SPACE_3,
+ GENERAL_INFO_SPACE_4,
+ GENERAL_INFO_SPACE_5,
+ GENERAL_INFO_SPACE_6,
+ GENERAL_INFO_SPACE_7,
+ GENERAL_INFO_SPACE_8,
+ tell_my_fortune,
+ FORTUNE_IS_1,
+ FORTUNE_IS_2,
+ FORTUNE_IS_3,
+ FORTUNE_IS_4,
+ FORTUNE_IS_5,
+ FORTUNE_IS_6,
+ FORTUNE_IS_7,
+ FORTUNE_IS_8,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/rebel/Makeinfo b/src/uqm/comm/rebel/Makeinfo
new file mode 100644
index 0000000..4a17467
--- /dev/null
+++ b/src/uqm/comm/rebel/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="rebel.c"
+uqm_HFILES="strings.h"
diff --git a/src/uqm/comm/rebel/rebel.c b/src/uqm/comm/rebel/rebel.c
new file mode 100644
index 0000000..6366f20
--- /dev/null
+++ b/src/uqm/comm/rebel/rebel.c
@@ -0,0 +1,449 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "../yehat/resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+
+
+static LOCDATA yehat_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ YEHAT_PMAP_ANIM, /* AlienFrame */
+ YEHAT_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* (SIS_TEXT_WIDTH - 16) * 2 / 3, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ YEHAT_COLOR_MAP, /* AlienColorMap */
+ YEHAT_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ REBEL_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 15, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ { /* right hand-wing tapping keyboard; front guy */
+ 4, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 6) | (1 << 7),
+ },
+ { /* left hand-wing tapping keyboard; front guy */
+ 7, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 6) | (1 << 7),
+ },
+ {
+ 10, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4) | (1 << 14),
+ },
+ {
+ 13, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5),
+ },
+ {
+ 16, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3,/* RestartRate */
+ (1 << 2) | (1 << 14),
+ },
+ {
+ 21, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3,/* RestartRate */
+ (1 << 3),
+ },
+ { /* right arm-wing rising; front guy */
+ 26, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3,/* RestartRate */
+ (1 << 0) | (1 << 1),
+ },
+ { /* left arm-wing rising; front guy */
+ 28, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3,/* RestartRate */
+ (1 << 0) | (1 << 1),
+ },
+ {
+ 30, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 33, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 36, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 39, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 42, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 45, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 48, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2) | (1 << 4),
+ },
+ },
+ { /* AlienTransitionDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+PrepareShip (void)
+{
+ BYTE mi, di, yi;
+
+ mi = (GLOBAL (GameClock.month_index) % 12) + 1;
+ SET_GAME_STATE (YEHAT_SHIP_MONTH, mi);
+ if ((di = GLOBAL (GameClock.day_index)) > 28)
+ di = 28;
+ SET_GAME_STATE (YEHAT_SHIP_DAY, di);
+ yi = (BYTE)(GLOBAL (GameClock.year_index) - START_YEAR);
+ if (mi == 1)
+ ++yi;
+ SET_GAME_STATE (YEHAT_SHIP_YEAR, yi);
+}
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, bye_rebel))
+ NPCPhrase (GOODBYE_REBEL);
+}
+
+static void Rebels (RESPONSE_REF R);
+
+static void
+RebelInfo (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ InfoLeft = FALSE;
+ if (PLAYER_SAID (R, give_info_rebels))
+ NPCPhrase (WHAT_INFO);
+ else if (PLAYER_SAID (R, what_about_urquan))
+ {
+ NPCPhrase (ABOUT_URQUAN);
+
+ DISABLE_PHRASE (what_about_urquan);
+ }
+ else if (PLAYER_SAID (R, what_about_royalty))
+ {
+ NPCPhrase (ABOUT_ROYALTY);
+
+ DISABLE_PHRASE (what_about_royalty);
+ }
+ else if (PLAYER_SAID (R, what_about_war))
+ {
+ NPCPhrase (ABOUT_WAR);
+
+ DISABLE_PHRASE (what_about_war);
+ }
+ else if (PLAYER_SAID (R, what_about_vux))
+ {
+ NPCPhrase (ABOUT_VUX);
+
+ DISABLE_PHRASE (what_about_vux);
+ }
+ else if (PLAYER_SAID (R, what_about_clue))
+ {
+ NPCPhrase (ABOUT_CLUE);
+
+ DISABLE_PHRASE (what_about_clue);
+ }
+
+ if (PHRASE_ENABLED (what_about_urquan))
+ {
+ Response (what_about_urquan, RebelInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_royalty))
+ {
+ Response (what_about_royalty, RebelInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_war))
+ {
+ Response (what_about_war, RebelInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_vux))
+ {
+ Response (what_about_vux, RebelInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_clue))
+ {
+ Response (what_about_clue, RebelInfo);
+ InfoLeft = TRUE;
+ }
+ Response (enough_info, Rebels);
+
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (give_info_rebels);
+ }
+}
+
+static void
+Rebels (RESPONSE_REF R)
+{
+ SBYTE NumVisits;
+
+ if (PLAYER_SAID (R, how_goes_revolution))
+ {
+ NumVisits = GET_GAME_STATE (YEHAT_REBEL_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (REBEL_REVOLUTION_1);
+ break;
+ case 1:
+ NPCPhrase (REBEL_REVOLUTION_2);
+ break;
+ case 2:
+ NPCPhrase (REBEL_REVOLUTION_3);
+ break;
+ case 3:
+ NPCPhrase (REBEL_REVOLUTION_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_REBEL_INFO, NumVisits);
+
+ DISABLE_PHRASE (how_goes_revolution);
+ }
+ else if (PLAYER_SAID (R, any_ships))
+ {
+ if (GET_GAME_STATE (YEHAT_SHIP_MONTH)
+ && ((NumVisits = (GLOBAL (GameClock.year_index) - START_YEAR) - GET_GAME_STATE (YEHAT_SHIP_YEAR)) < 0
+ || ((NumVisits == 0 && (NumVisits = GLOBAL (GameClock.month_index) - GET_GAME_STATE (YEHAT_SHIP_MONTH)) < 0)
+ || (NumVisits == 0 && GLOBAL (GameClock.day_index) < GET_GAME_STATE (YEHAT_SHIP_DAY)))))
+ NPCPhrase (NO_SHIPS_YET);
+ else if ((NumVisits = EscortFeasibilityStudy (YEHAT_SHIP)) == 0)
+ NPCPhrase (NO_ROOM);
+ else
+ {
+#define NUM_YEHAT_SHIPS 4
+ if (NumVisits < NUM_YEHAT_SHIPS)
+ NPCPhrase (HAVE_FEW_SHIPS);
+ else
+ {
+ NumVisits = NUM_YEHAT_SHIPS;
+ NPCPhrase (HAVE_ALL_SHIPS);
+ }
+
+ AlienTalkSegue ((COUNT)~0);
+ AddEscortShips (YEHAT_SHIP, NumVisits);
+ PrepareShip ();
+ }
+
+ DISABLE_PHRASE (any_ships);
+ }
+ else if (PLAYER_SAID (R, what_about_pkunk_rebel))
+ {
+ if (GET_GAME_STATE (YEHAT_ABSORBED_PKUNK))
+ NPCPhrase (PKUNK_ABSORBED_REBEL);
+ else
+ NPCPhrase (HATE_PKUNK_REBEL);
+
+ SET_GAME_STATE (YEHAT_REBEL_TOLD_PKUNK, 1);
+ }
+ else if (PLAYER_SAID (R, enough_info))
+ NPCPhrase (OK_ENOUGH_INFO);
+
+ if (PHRASE_ENABLED (how_goes_revolution))
+ Response (how_goes_revolution, Rebels);
+ if (!GET_GAME_STATE (YEHAT_REBEL_TOLD_PKUNK)
+ && GET_GAME_STATE (PKUNK_VISITS)
+ && GET_GAME_STATE (PKUNK_HOME_VISITS))
+ Response (what_about_pkunk_rebel, Rebels);
+ if (PHRASE_ENABLED (any_ships))
+ Response (any_ships, Rebels);
+ if (PHRASE_ENABLED (give_info_rebels))
+ {
+ Response (give_info_rebels, RebelInfo);
+ }
+ Response (bye_rebel, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ setSegue (Segue_peace);
+ if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
+ {
+ NPCPhrase (YEHAT_CAVALRY);
+ AlienTalkSegue ((COUNT)~0);
+
+ NumVisits = (BYTE) EscortFeasibilityStudy (YEHAT_REBEL_SHIP);
+ if (NumVisits > 8)
+ NumVisits = 8;
+ AddEscortShips (YEHAT_REBEL_SHIP, NumVisits - (NumVisits >> 1));
+ AddEscortShips (PKUNK_SHIP, NumVisits >> 1);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (YEHAT_REBEL_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (REBEL_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (REBEL_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (REBEL_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (REBEL_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_REBEL_VISITS, NumVisits);
+
+ Rebels ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_yehat (void)
+{
+ return (0);
+}
+
+static void
+post_yehat_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_rebel_yehat_comm (void)
+{
+ LOCDATA *retval;
+
+ yehat_desc.init_encounter_func = Intro;
+ yehat_desc.post_encounter_func = post_yehat_enc;
+ yehat_desc.uninit_encounter_func = uninit_yehat;
+
+ yehat_desc.AlienTextBaseline.x = SIS_SCREEN_WIDTH * 2 / 3;
+ yehat_desc.AlienTextBaseline.y = 60;
+ yehat_desc.AlienTextWidth = (SIS_TEXT_WIDTH - 16) * 2 / 3;
+
+ // use alternate "Rebels" track if available
+ yehat_desc.AlienAltSongRes = REBEL_MUSIC;
+ yehat_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
+
+ setSegue (Segue_peace);
+ retval = &yehat_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/rebel/strings.h b/src/uqm/comm/rebel/strings.h
new file mode 100644
index 0000000..c7e0b4f
--- /dev/null
+++ b/src/uqm/comm/rebel/strings.h
@@ -0,0 +1,61 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef REBEL_STRINGS_H
+#define REBEL_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ REBEL_HELLO_1,
+ REBEL_HELLO_2,
+ REBEL_HELLO_3,
+ REBEL_HELLO_4,
+ how_goes_revolution,
+ REBEL_REVOLUTION_1,
+ REBEL_REVOLUTION_2,
+ REBEL_REVOLUTION_3,
+ REBEL_REVOLUTION_4,
+ any_ships,
+ NO_ROOM,
+ HAVE_ALL_SHIPS,
+ HAVE_FEW_SHIPS,
+ NO_SHIPS_YET,
+ give_info_rebels,
+ WHAT_INFO,
+ what_about_royalty,
+ ABOUT_ROYALTY,
+ what_about_war,
+ ABOUT_WAR,
+ what_about_urquan,
+ ABOUT_URQUAN,
+ what_about_vux,
+ ABOUT_VUX,
+ what_about_clue,
+ ABOUT_CLUE,
+ enough_info,
+ OK_ENOUGH_INFO,
+ bye_rebel,
+ GOODBYE_REBEL,
+ YEHAT_CAVALRY,
+ what_about_pkunk_rebel,
+ PKUNK_ABSORBED_REBEL,
+ HATE_PKUNK_REBEL,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/shofixt/Makeinfo b/src/uqm/comm/shofixt/Makeinfo
new file mode 100644
index 0000000..3cad2ac
--- /dev/null
+++ b/src/uqm/comm/shofixt/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="shofixt.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/shofixt/resinst.h b/src/uqm/comm/shofixt/resinst.h
new file mode 100644
index 0000000..8fe9a87
--- /dev/null
+++ b/src/uqm/comm/shofixt/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define SHOFIXTI_COLOR_MAP "comm.shofixti.colortable"
+#define SHOFIXTI_CONVERSATION_PHRASES "comm.shofixti.dialogue"
+#define SHOFIXTI_FONT "comm.shofixti.font"
+#define SHOFIXTI_MUSIC "comm.shofixti.music"
+#define SHOFIXTI_PMAP_ANIM "comm.shofixti.graphics"
diff --git a/src/uqm/comm/shofixt/shofixt.c b/src/uqm/comm/shofixt/shofixt.c
new file mode 100644
index 0000000..e76d8d0
--- /dev/null
+++ b/src/uqm/comm/shofixt/shofixt.c
@@ -0,0 +1,652 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/gameev.h"
+
+
+static LOCDATA shofixti_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SHOFIXTI_PMAP_ANIM, /* AlienFrame */
+ SHOFIXTI_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SHOFIXTI_COLOR_MAP, /* AlienColorMap */
+ SHOFIXTI_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SHOFIXTI_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 11, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 5, /* StartIndex */
+ 15, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND / 30, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ (ONE_SECOND >> 1), (ONE_SECOND >> 1) * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 23, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ (ONE_SECOND >> 1), (ONE_SECOND >> 1) * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 26, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 29, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+
+ {
+ 33, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 39, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* RestartRate */
+ (1 << 7), /* BlockMask */
+ },
+ {
+ 46, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* RestartRate */
+ (1 << 6), /* BlockMask */
+ },
+ {
+ 52, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 56, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* RestartRate */
+ (1 << 10), /* BlockMask */
+ },
+ {
+ 63, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 20, ONE_SECOND / 30, /* RestartRate */
+ (1 << 9), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 4, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND / 15, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static RESPONSE_REF shofixti_name;
+
+static void
+GetShofixtiName (void)
+{
+ if (GET_GAME_STATE (SHOFIXTI_KIA))
+ shofixti_name = katana;
+ else
+ shofixti_name = tanaka;
+}
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, bye0))
+ {
+ NPCPhrase (GOODBYE);
+
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, go_ahead))
+ {
+ NPCPhrase (ON_SECOND_THOUGHT);
+
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, need_you_for_duty))
+ {
+ NPCPhrase (OK_WILL_BE_SENTRY);
+
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, females)
+ || PLAYER_SAID (R, nubiles)
+ || PLAYER_SAID (R, rat_babes))
+ {
+ NPCPhrase (LEAPING_HAPPINESS);
+
+ SET_GAME_STATE (SHOFIXTI_RECRUITED, 1);
+ SET_GAME_STATE (MAIDENS_ON_SHIP, 0);
+ setSegue (Segue_peace);
+
+ AddEvent (RELATIVE_EVENT, 2, 0, 0, SHOFIXTI_RETURN_EVENT);
+ }
+ else if (PLAYER_SAID (R, dont_attack))
+ {
+ NPCPhrase (TYPICAL_PLOY);
+
+ SET_GAME_STATE (SHOFIXTI_STACK1, 1);
+ }
+ else if (PLAYER_SAID (R, hey_stop))
+ {
+ NPCPhrase (ONLY_STOP);
+
+ SET_GAME_STATE (SHOFIXTI_STACK1, 2);
+ }
+ else if (PLAYER_SAID (R, look_you_are))
+ {
+ NPCPhrase (TOO_BAD);
+
+ SET_GAME_STATE (SHOFIXTI_STACK1, 3);
+ }
+ else if (PLAYER_SAID (R, no_one_insults))
+ {
+ NPCPhrase (YOU_LIMP);
+
+ SET_GAME_STATE (SHOFIXTI_STACK2, 1);
+ }
+ else if (PLAYER_SAID (R, mighty_words))
+ {
+ NPCPhrase (HANG_YOUR);
+
+ SET_GAME_STATE (SHOFIXTI_STACK2, 2);
+ }
+ else if (PLAYER_SAID (R, dont_know))
+ {
+ NPCPhrase (NEVER);
+
+ SET_GAME_STATE (SHOFIXTI_STACK3, 1);
+ }
+ else if (PLAYER_SAID (R, look0))
+ {
+ NPCPhrase (FOR_YOU);
+
+ SET_GAME_STATE (SHOFIXTI_STACK3, 2);
+ }
+ else if (PLAYER_SAID (R, no_bloodshed))
+ {
+ NPCPhrase (YES_BLOODSHED);
+
+ SET_GAME_STATE (SHOFIXTI_STACK3, 3);
+ }
+ else if (PLAYER_SAID (R, dont_want_to_fight))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SHOFIXTI_STACK4);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (MUST_FIGHT_YOU_URQUAN_1);
+ break;
+ case 1:
+ NPCPhrase (MUST_FIGHT_YOU_URQUAN_2);
+ break;
+ case 2:
+ NPCPhrase (MUST_FIGHT_YOU_URQUAN_3);
+ break;
+ case 3:
+ NPCPhrase (MUST_FIGHT_YOU_URQUAN_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SHOFIXTI_STACK4, NumVisits);
+ }
+}
+
+static void
+GiveMaidens (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, important_duty))
+ {
+ NPCPhrase (WHAT_DUTY);
+
+ Response (procreating_wildly, GiveMaidens);
+ Response (replenishing_your_species, GiveMaidens);
+ Response (hope_you_have, GiveMaidens);
+ }
+ else
+ {
+ NPCPhrase (SOUNDS_GREAT_BUT_HOW);
+
+ Response (females, ExitConversation);
+ Response (nubiles, ExitConversation);
+ Response (rat_babes, ExitConversation);
+ }
+}
+
+static void
+ConsoleShofixti (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, dont_do_it))
+ {
+ NPCPhrase (YES_I_DO_IT);
+ DISABLE_PHRASE (dont_do_it);
+ }
+ else
+ NPCPhrase (VERY_SAD_KILL_SELF);
+
+ if (GET_GAME_STATE (MAIDENS_ON_SHIP))
+ {
+ Response (important_duty, GiveMaidens);
+ }
+ if (PHRASE_ENABLED (dont_do_it))
+ {
+ Response (dont_do_it, ConsoleShofixti);
+ }
+ Response (need_you_for_duty, ExitConversation);
+ Response (go_ahead, ExitConversation);
+}
+
+static void
+ExplainDefeat (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, i_am_nice))
+ NPCPhrase (MUST_UNDERSTAND);
+ else if (PLAYER_SAID (R, i_am_guy))
+ NPCPhrase (NICE_BUT_WHAT_IS_DONKEY);
+ else /* if (PLAYER_SAID (R, i_am_captain0)) */
+ NPCPhrase (SO_SORRY);
+ NPCPhrase (IS_DEFEAT_TRUE);
+
+ Response (yes_and_no, ConsoleShofixti);
+ Response (clobbered, ConsoleShofixti);
+ Response (butt_blasted, ConsoleShofixti);
+}
+
+static void
+RealizeMistake (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ NPCPhrase (DGRUNTI);
+ SET_GAME_STATE (SHOFIXTI_STACK1, 0);
+ SET_GAME_STATE (SHOFIXTI_STACK3, 0);
+ SET_GAME_STATE (SHOFIXTI_STACK2, 3);
+
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ i_am_captain0,
+ GLOBAL_SIS (CommanderName),
+ i_am_captain1,
+ buf,
+ i_am_captain2,
+ GLOBAL_SIS (ShipName),
+ i_am_captain3,
+ (UNICODE*)NULL);
+ }
+ DoResponsePhrase (i_am_captain0, ExplainDefeat, shared_phrase_buf);
+ Response (i_am_nice, ExplainDefeat);
+ Response (i_am_guy, ExplainDefeat);
+}
+
+static void
+Hostile (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ switch (GET_GAME_STATE (SHOFIXTI_STACK1))
+ {
+ case 0:
+ Response (dont_attack, ExitConversation);
+ break;
+ case 1:
+ Response (hey_stop, ExitConversation);
+ break;
+ case 2:
+ Response (look_you_are, ExitConversation);
+ break;
+ }
+ switch (GET_GAME_STATE (SHOFIXTI_STACK2))
+ {
+ case 0:
+ Response (no_one_insults, ExitConversation);
+ break;
+ case 1:
+ Response (mighty_words, ExitConversation);
+ break;
+ case 2:
+ Response (donkey_breath, RealizeMistake);
+ break;
+ }
+ switch (GET_GAME_STATE (SHOFIXTI_STACK3))
+ {
+ case 0:
+ Response (dont_know, ExitConversation);
+ break;
+ case 1:
+ {
+ construct_response (
+ shared_phrase_buf,
+ look0,
+ "",
+ shofixti_name,
+ "",
+ look1,
+ (UNICODE*)NULL);
+ DoResponsePhrase (look0, ExitConversation, shared_phrase_buf);
+ break;
+ }
+ case 2:
+ Response (look_you_are, ExitConversation);
+ break;
+ }
+ Response (dont_want_to_fight, ExitConversation);
+}
+
+static void
+Friendly (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ struct
+ {
+ RESPONSE_REF pStr;
+ UNICODE *c_buf;
+ } Resp[3];
+ static UNICODE buf0[80], buf1[80];
+
+ LastStack = 0;
+ memset (Resp, 0, sizeof (Resp));
+ if (PLAYER_SAID (R, report0))
+ {
+ NPCPhrase (NOTHING_NEW);
+
+ DISABLE_PHRASE (report0);
+ }
+ else if (PLAYER_SAID (R, why_here0))
+ {
+ NPCPhrase (I_GUARD);
+
+ LastStack = 1;
+ SET_GAME_STATE (SHOFIXTI_STACK1, 1);
+ }
+ else if (PLAYER_SAID (R, what_happened))
+ {
+ NPCPhrase (MET_VUX);
+
+ LastStack = 1;
+ SET_GAME_STATE (SHOFIXTI_STACK1, 2);
+ }
+ else if (PLAYER_SAID (R, glory_device))
+ {
+ NPCPhrase (SWITCH_BROKE);
+
+ SET_GAME_STATE (SHOFIXTI_STACK1, 3);
+ }
+ else if (PLAYER_SAID (R, where_world))
+ {
+ NPCPhrase (BLEW_IT_UP);
+
+ LastStack = 2;
+ SET_GAME_STATE (SHOFIXTI_STACK3, 1);
+ }
+ else if (PLAYER_SAID (R, how_survive))
+ {
+ NPCPhrase (NOT_HERE);
+
+ SET_GAME_STATE (SHOFIXTI_STACK3, 2);
+ }
+
+ if (PHRASE_ENABLED (report0))
+ {
+ construct_response (
+ buf0,
+ report0,
+ "",
+ shofixti_name,
+ "",
+ report1,
+ (UNICODE*)NULL);
+ Resp[0].pStr = report0;
+ Resp[0].c_buf = buf0;
+ }
+
+ switch (GET_GAME_STATE (SHOFIXTI_STACK1))
+ {
+ case 0:
+ construct_response (
+ buf1,
+ why_here0,
+ "",
+ shofixti_name,
+ "",
+ why_here1,
+ (UNICODE*)NULL);
+ Resp[1].pStr = why_here0;
+ Resp[1].c_buf = buf1;
+ break;
+ case 1:
+ Resp[1].pStr = what_happened;
+ break;
+ case 2:
+ Resp[1].pStr = glory_device;
+ break;
+ }
+
+ switch (GET_GAME_STATE (SHOFIXTI_STACK3))
+ {
+ case 0:
+ Resp[2].pStr = where_world;
+ break;
+ case 1:
+ Resp[2].pStr = how_survive;
+ break;
+ }
+
+ if (Resp[LastStack].pStr)
+ DoResponsePhrase (Resp[LastStack].pStr, Friendly, Resp[LastStack].c_buf);
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && Resp[i].pStr)
+ DoResponsePhrase (Resp[i].pStr, Friendly, Resp[i].c_buf);
+ }
+ if (GET_GAME_STATE (MAIDENS_ON_SHIP))
+ {
+ Response (important_duty, GiveMaidens);
+ }
+
+ construct_response (
+ shared_phrase_buf,
+ bye0,
+ "",
+ shofixti_name,
+ "",
+ bye1,
+ (UNICODE*)NULL);
+ DoResponsePhrase (bye0, ExitConversation, shared_phrase_buf);
+}
+
+static void
+Intro (void)
+{
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ GetShofixtiName ();
+
+ if (GET_GAME_STATE (SHOFIXTI_STACK2) > 2)
+ {
+ NPCPhrase (FRIENDLY_HELLO);
+
+ Friendly ((RESPONSE_REF)0);
+ }
+ else
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SHOFIXTI_VISITS);
+ if (GET_GAME_STATE (SHOFIXTI_KIA))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_KATANA_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_KATANA_2);
+ break;
+ case 2:
+ NPCPhrase (HOSTILE_KATANA_3);
+ break;
+ case 3:
+ NPCPhrase (HOSTILE_KATANA_4);
+ --NumVisits;
+ break;
+ }
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_TANAKA_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_TANAKA_2);
+ break;
+ case 2:
+ NPCPhrase (HOSTILE_TANAKA_3);
+ break;
+ case 3:
+ NPCPhrase (HOSTILE_TANAKA_4);
+ break;
+ case 4:
+ NPCPhrase (HOSTILE_TANAKA_5);
+ break;
+ case 5:
+ NPCPhrase (HOSTILE_TANAKA_6);
+ break;
+ case 6:
+ NPCPhrase (HOSTILE_TANAKA_7);
+ break;
+ case 7:
+ NPCPhrase (HOSTILE_TANAKA_8);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (SHOFIXTI_VISITS, NumVisits);
+
+ Hostile ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_shofixti (void)
+{
+ return(0);
+}
+
+static void
+post_shofixti_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_shofixti_comm (void)
+{
+ LOCDATA *retval;
+
+ shofixti_desc.init_encounter_func = Intro;
+ shofixti_desc.post_encounter_func = post_shofixti_enc;
+ shofixti_desc.uninit_encounter_func = uninit_shofixti;
+
+ shofixti_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ shofixti_desc.AlienTextBaseline.y = 0;
+ shofixti_desc.AlienTextWidth = SIS_TEXT_WIDTH;
+
+ setSegue (Segue_peace);
+
+ retval = &shofixti_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/shofixt/strings.h b/src/uqm/comm/shofixt/strings.h
new file mode 100644
index 0000000..b4f165b
--- /dev/null
+++ b/src/uqm/comm/shofixt/strings.h
@@ -0,0 +1,122 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SHOFIXT_STRINGS_H
+#define SHOFIXT_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ tanaka,
+ katana,
+ HOSTILE_KATANA_1,
+ HOSTILE_KATANA_2,
+ HOSTILE_KATANA_3,
+ HOSTILE_KATANA_4,
+ HOSTILE_TANAKA_1,
+ HOSTILE_TANAKA_2,
+ HOSTILE_TANAKA_3,
+ HOSTILE_TANAKA_4,
+ HOSTILE_TANAKA_5,
+ HOSTILE_TANAKA_6,
+ HOSTILE_TANAKA_7,
+ HOSTILE_TANAKA_8,
+ dont_attack,
+ TYPICAL_PLOY,
+ hey_stop,
+ ONLY_STOP,
+ look_you_are,
+ TOO_BAD,
+ dont_know,
+ NEVER,
+ look0,
+ look1,
+ FOR_YOU,
+ no_bloodshed,
+ YES_BLOODSHED,
+ dont_want_to_fight,
+ MUST_FIGHT_YOU_URQUAN_1,
+ MUST_FIGHT_YOU_URQUAN_2,
+ MUST_FIGHT_YOU_URQUAN_3,
+ MUST_FIGHT_YOU_URQUAN_4,
+ no_one_insults,
+ YOU_LIMP,
+ mighty_words,
+ HANG_YOUR,
+ donkey_breath,
+ DGRUNTI,
+ i_am_captain0,
+ i_am_captain1,
+ i_am_captain2,
+ i_am_captain3,
+ i_am_nice,
+ i_am_guy,
+ SO_SORRY,
+ MUST_UNDERSTAND,
+ NICE_BUT_WHAT_IS_DONKEY,
+ IS_DEFEAT_TRUE,
+ yes_and_no,
+ butt_blasted,
+ clobbered,
+ VERY_SAD_KILL_SELF,
+ important_duty,
+ WHAT_DUTY,
+ need_you_for_duty,
+ OK_WILL_BE_SENTRY,
+ dont_do_it,
+ YES_I_DO_IT,
+ go_ahead,
+ ON_SECOND_THOUGHT,
+ procreating_wildly,
+ replenishing_your_species,
+ hope_you_have,
+ SOUNDS_GREAT_BUT_HOW,
+ females,
+ nubiles,
+ rat_babes,
+ LEAPING_HAPPINESS,
+ bye0,
+ bye1,
+ GOODBYE0,
+ GOODBYE1,
+ why_here0,
+ why_here1,
+ I_GUARD,
+ where_world,
+ BLEW_IT_UP,
+ how_survive,
+ NOT_HERE,
+ what_happened,
+ MET_VUX,
+ glory_device,
+ SWITCH_BROKE,
+ bye,
+ GOODBYE,
+ FRIENDLY_HELLO,
+ report0,
+ report1,
+ NOTHING_NEW,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/slyhome/Makeinfo b/src/uqm/comm/slyhome/Makeinfo
new file mode 100644
index 0000000..a09471e
--- /dev/null
+++ b/src/uqm/comm/slyhome/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="slyhome.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/slyhome/resinst.h b/src/uqm/comm/slyhome/resinst.h
new file mode 100644
index 0000000..1bbf162
--- /dev/null
+++ b/src/uqm/comm/slyhome/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define SLYLANDRO_COLOR_MAP "comm.slylandro.colortable"
+#define SLYLANDRO_CONVERSATION_PHRASES "comm.slylandro.dialogue"
+#define SLYLANDRO_FONT "comm.slylandro.font"
+#define SLYLANDRO_MUSIC "comm.slylandro.music"
+#define SLYLANDRO_PMAP_ANIM "comm.slylandro.graphics"
diff --git a/src/uqm/comm/slyhome/slyhome.c b/src/uqm/comm/slyhome/slyhome.c
new file mode 100644
index 0000000..80cb839
--- /dev/null
+++ b/src/uqm/comm/slyhome/slyhome.c
@@ -0,0 +1,921 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/gameev.h"
+
+
+static LOCDATA slylandro_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SLYLANDRO_PMAP_ANIM, /* AlienFrame */
+ SLYLANDRO_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SLYLANDRO_COLOR_MAP, /* AlienColorMap */
+ SLYLANDRO_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SLYLANDRO_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 13, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 0, /* StartIndex */
+ 5, /* NumFrames */
+ RANDOM_ANIM | COLORXFORM_ANIM, /* AnimFlags */
+ ONE_SECOND / 8, ONE_SECOND * 5 / 8, /* FrameRate */
+ ONE_SECOND / 8, ONE_SECOND * 5 / 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 1, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 6, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 11, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 16, /* StartIndex */
+ 6, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 15, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 30, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 8) | (1 << 9), /* BlockMask */
+ },
+ {
+ 39, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 43, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 6), /* BlockMask */
+ },
+ {
+ 48, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 6), /* BlockMask */
+ },
+ {
+ 54, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 12), /* BlockMask */
+ },
+ {
+ 60, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 12), /* BlockMask */
+ },
+ {
+ 67, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 10) | (1 << 11), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ setSegue (Segue_peace);
+
+ switch (GET_GAME_STATE (SLYLANDRO_HOME_VISITS))
+ {
+ case 1:
+ NPCPhrase (GOODBYE_1);
+ break;
+ default:
+ NPCPhrase (GOODBYE_2);
+ break;
+ }
+}
+
+static void HomeWorld (RESPONSE_REF R);
+
+static void
+HumanInfo (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ if (PLAYER_SAID (R, happy_to_tell_more))
+ {
+ NPCPhrase (TELL_MORE);
+
+ SET_GAME_STATE (SLYLANDRO_STACK4, 1);
+ }
+ else if (PLAYER_SAID (R, would_you_like_to_know_more))
+ {
+ NPCPhrase (YES_TELL_MORE);
+ }
+ else if (PLAYER_SAID (R, we_come_from_earth))
+ {
+ NPCPhrase (OK_EARTH);
+
+ SET_GAME_STATE (SLYLANDRO_KNOW_EARTH, 1);
+ }
+ else if (PLAYER_SAID (R, we_explore))
+ {
+ NPCPhrase (OK_EXPLORE);
+
+ SET_GAME_STATE (SLYLANDRO_KNOW_EXPLORE, 1);
+ }
+ else if (PLAYER_SAID (R, we_fight_urquan))
+ {
+ NPCPhrase (URQUAN_NICE_GUYS);
+
+ SET_GAME_STATE (SLYLANDRO_KNOW_URQUAN, 1);
+ }
+ else if (PLAYER_SAID (R, not_same_urquan))
+ {
+ NPCPhrase (PERSONALITY_CHANGE);
+
+ SET_GAME_STATE (SLYLANDRO_KNOW_URQUAN, 2);
+ }
+ else if (PLAYER_SAID (R, we_gather))
+ {
+ NPCPhrase (MAYBE_INTERESTED);
+
+ SET_GAME_STATE (SLYLANDRO_KNOW_GATHER, 1);
+ }
+
+ InfoLeft = FALSE;
+ if (GET_GAME_STATE (SLYLANDRO_KNOW_URQUAN) == 1)
+ {
+ InfoLeft = TRUE;
+ Response (not_same_urquan, HumanInfo);
+ }
+ if (!GET_GAME_STATE (SLYLANDRO_KNOW_EARTH))
+ {
+ InfoLeft = TRUE;
+ Response (we_come_from_earth, HumanInfo);
+ }
+ if (!GET_GAME_STATE (SLYLANDRO_KNOW_EXPLORE))
+ {
+ InfoLeft = TRUE;
+ Response (we_explore, HumanInfo);
+ }
+ if (!GET_GAME_STATE (SLYLANDRO_KNOW_URQUAN))
+ {
+ InfoLeft = TRUE;
+ Response (we_fight_urquan, HumanInfo);
+ }
+ if (!GET_GAME_STATE (SLYLANDRO_KNOW_GATHER))
+ {
+ InfoLeft = TRUE;
+ Response (we_gather, HumanInfo);
+ }
+
+ Response (enough_about_me, HomeWorld);
+ if (!InfoLeft)
+ {
+ SET_GAME_STATE (SLYLANDRO_STACK4, 2);
+ }
+}
+
+static void
+SlylandroInfo (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ if (PLAYER_SAID (R, like_more_about_you))
+ {
+ NPCPhrase (SURE_KNOW_WHAT);
+ }
+ else if (PLAYER_SAID (R, what_about_home))
+ {
+ NPCPhrase (ABOUT_HOME);
+
+ DISABLE_PHRASE (what_about_home);
+ }
+ else if (PLAYER_SAID (R, what_about_culture))
+ {
+ NPCPhrase (ABOUT_CULTURE);
+
+ DISABLE_PHRASE (what_about_culture);
+ }
+ else if (PLAYER_SAID (R, what_about_history))
+ {
+ NPCPhrase (ABOUT_HISTORY);
+
+ DISABLE_PHRASE (what_about_history);
+ }
+ else if (PLAYER_SAID (R, what_about_biology))
+ {
+ NPCPhrase (ABOUT_BIOLOGY);
+
+ DISABLE_PHRASE (what_about_biology);
+ }
+
+ InfoLeft = FALSE;
+ if (PHRASE_ENABLED (what_about_home))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_home, SlylandroInfo);
+ }
+ if (PHRASE_ENABLED (what_about_culture))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_culture, SlylandroInfo);
+ }
+ if (PHRASE_ENABLED (what_about_history))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_history, SlylandroInfo);
+ }
+ if (PHRASE_ENABLED (what_about_biology))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_biology, SlylandroInfo);
+ }
+
+ Response (enough_info, HomeWorld);
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (like_more_about_you);
+ }
+}
+
+static void
+FixBug (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, think_about_rep_priorities))
+ NPCPhrase (UH_OH);
+ else if (PLAYER_SAID (R, hunt_them_down))
+ {
+ NPCPhrase (GROW_TOO_FAST);
+
+ DISABLE_PHRASE (hunt_them_down);
+ }
+ else if (PLAYER_SAID (R, sue_melnorme))
+ {
+ NPCPhrase (SIGNED_WAIVER);
+
+ DISABLE_PHRASE (sue_melnorme);
+ }
+ else if (PLAYER_SAID (R, recall_signal))
+ {
+ NPCPhrase (NOT_THIS_MODEL);
+
+ DISABLE_PHRASE (recall_signal);
+ }
+
+ if (PHRASE_ENABLED (hunt_them_down))
+ Response (hunt_them_down, FixBug);
+ if (PHRASE_ENABLED (sue_melnorme))
+ Response (sue_melnorme, FixBug);
+ if (PHRASE_ENABLED (recall_signal))
+ Response (recall_signal, FixBug);
+ Response (mega_self_destruct, HomeWorld);
+}
+
+static void
+ProbeBug (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, probe_has_bug))
+ NPCPhrase (NO_IT_DOESNT);
+ else if (PLAYER_SAID (R, tell_me_about_rep_2))
+ {
+ NPCPhrase (REP_NO_PROBLEM);
+
+ DISABLE_PHRASE (tell_me_about_rep_2);
+ }
+ else if (PLAYER_SAID (R, what_about_rep_priorities))
+ {
+ NPCPhrase (MAXIMUM_SO_WHAT);
+
+ DISABLE_PHRASE (what_about_rep_priorities);
+ }
+ else if (PLAYER_SAID (R, tell_me_about_attack))
+ {
+ NPCPhrase (ATTACK_NO_PROBLEM);
+
+ DISABLE_PHRASE (tell_me_about_attack);
+ }
+
+ if (PHRASE_ENABLED (tell_me_about_rep_2))
+ Response (tell_me_about_rep_2, ProbeBug);
+ else if (PHRASE_ENABLED (what_about_rep_priorities))
+ Response (what_about_rep_priorities, ProbeBug);
+ else
+ {
+ Response (think_about_rep_priorities, FixBug);
+ }
+ if (PHRASE_ENABLED (tell_me_about_attack))
+ Response (tell_me_about_attack, ProbeBug);
+}
+
+static void ProbeInfo (RESPONSE_REF R);
+
+static void
+ProbeFunction (RESPONSE_REF R)
+{
+ BYTE LastStack;
+ RESPONSE_REF pStr[2];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = 0;
+ if (PLAYER_SAID (R, talk_more_probe_attack))
+ {
+ NPCPhrase (NO_PROBLEM_BUT_SURE);
+ }
+ else if (PLAYER_SAID (R, tell_me_about_basics))
+ {
+ NPCPhrase (BASIC_COMMANDS);
+
+ SET_GAME_STATE (PLAYER_KNOWS_PROGRAM, 1);
+ DISABLE_PHRASE (tell_basics_again);
+ }
+ else if (PLAYER_SAID (R, tell_basics_again))
+ {
+ NPCPhrase (OK_BASICS_AGAIN);
+
+ DISABLE_PHRASE (tell_basics_again);
+ }
+ else if (PLAYER_SAID (R, what_effect))
+ {
+ NPCPhrase (AFFECTS_BEHAVIOR);
+
+ SET_GAME_STATE (PLAYER_KNOWS_EFFECTS, 1);
+ DISABLE_PHRASE (what_effect);
+ }
+ else if (PLAYER_SAID (R, tell_me_about_rep_1))
+ {
+ NPCPhrase (ABOUT_REP);
+
+ LastStack = 2;
+ SET_GAME_STATE (SLYLANDRO_STACK8, 3);
+ }
+ else if (PLAYER_SAID (R, what_set_priority))
+ {
+ NPCPhrase (MAXIMUM);
+
+ SET_GAME_STATE (PLAYER_KNOWS_PRIORITY, 1);
+ DISABLE_PHRASE (what_set_priority);
+ }
+ else if (PLAYER_SAID (R, how_does_probe_defend))
+ {
+ NPCPhrase (ONLY_SELF_DEFENSE);
+
+ LastStack = 1;
+ SET_GAME_STATE (SLYLANDRO_STACK9, 1);
+ }
+ else if (PLAYER_SAID (R, combat_behavior))
+ {
+ NPCPhrase (MISSILE_BATTERIES);
+
+ LastStack = 1;
+ SET_GAME_STATE (SLYLANDRO_STACK9, 2);
+ }
+ else if (PLAYER_SAID (R, what_missile_batteries))
+ {
+ NPCPhrase (LIGHTNING_ONLY_FOR_HARVESTING);
+
+ SET_GAME_STATE (SLYLANDRO_STACK9, 3);
+ }
+
+ switch (GET_GAME_STATE (SLYLANDRO_STACK9))
+ {
+ case 0:
+ pStr[0] = how_does_probe_defend;
+ break;
+ case 1:
+ pStr[0] = combat_behavior;
+ break;
+ case 2:
+ pStr[0] = what_missile_batteries;
+ break;
+ }
+ switch (GET_GAME_STATE (SLYLANDRO_STACK8))
+ {
+ case 2:
+ pStr[1] = tell_me_about_rep_1;
+ break;
+ case 3:
+ if (PHRASE_ENABLED (what_set_priority))
+ pStr[1] = what_set_priority;
+ break;
+ }
+
+ if (LastStack && pStr[LastStack - 1])
+ Response (pStr[LastStack - 1], ProbeFunction);
+ if (!GET_GAME_STATE (PLAYER_KNOWS_PROGRAM))
+ Response (tell_me_about_basics, ProbeFunction);
+ else
+ {
+ if (GET_GAME_STATE (PLAYER_KNOWS_PRIORITY))
+ {
+ if (GET_GAME_STATE (PLAYER_KNOWS_EFFECTS))
+ {
+ Response (probe_has_bug, ProbeBug);
+ }
+ if (PHRASE_ENABLED (what_effect))
+ Response (what_effect, ProbeFunction);
+ }
+ if (PHRASE_ENABLED (tell_basics_again))
+ Response (tell_basics_again, ProbeFunction);
+ }
+ if (LastStack == 0)
+ {
+ do
+ {
+ if (pStr[LastStack])
+ Response (pStr[LastStack], ProbeFunction);
+ } while (++LastStack < 2);
+ }
+ else
+ {
+ LastStack = (LastStack - 1) ^ 1;
+ if (pStr[LastStack])
+ Response (pStr[LastStack], ProbeFunction);
+ }
+
+ Response (enough_problem, ProbeInfo);
+}
+
+static void
+ProbeInfo (RESPONSE_REF R)
+{
+ BYTE i, LastStack, InfoLeft;
+ RESPONSE_REF pStr[3];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (PLAYER_SAID (R, what_are_probes))
+ {
+ NPCPhrase (PROBES_ARE);
+
+ SET_GAME_STATE (SLYLANDRO_STACK5, 1);
+ }
+ else if (PLAYER_SAID (R, know_more_probe))
+ NPCPhrase (OK_WHAT_MORE_PROBE);
+ else if (PLAYER_SAID (R, why_probe_always_attack))
+ {
+ NPCPhrase (ONLY_DEFEND);
+
+ SET_GAME_STATE (SLYLANDRO_STACK6, 1);
+ }
+ else if (PLAYER_SAID (R, talk_more_probe_attack))
+ {
+ ProbeFunction (R);
+ return;
+ }
+ else if (PLAYER_SAID (R, where_probes_from))
+ {
+ NPCPhrase (PROBES_FROM_MELNORME);
+
+ LastStack = 1;
+ SET_GAME_STATE (SLYLANDRO_STACK7, 1);
+ }
+ else if (PLAYER_SAID (R, why_sell))
+ {
+ NPCPhrase (SELL_FOR_INFO);
+
+ LastStack = 1;
+ SET_GAME_STATE (SLYLANDRO_STACK7, 2);
+ }
+ else if (PLAYER_SAID (R, how_long_ago))
+ {
+ NPCPhrase (FIFTY_THOUSAND_ROTATIONS);
+
+ SET_GAME_STATE (SLYLANDRO_STACK7, 3);
+ }
+ else if (PLAYER_SAID (R, whats_probes_mission))
+ {
+ NPCPhrase (SEEK_OUT_NEW_LIFE);
+
+ LastStack = 2;
+ SET_GAME_STATE (SLYLANDRO_STACK8, 1);
+ }
+ else if (PLAYER_SAID (R, if_only_one))
+ {
+ NPCPhrase (THEY_REPLICATE);
+
+ SET_GAME_STATE (SLYLANDRO_STACK8, 2);
+ }
+ else if (PLAYER_SAID (R, enough_problem))
+ NPCPhrase (OK_ENOUGH_PROBLEM);
+
+ if (!GET_GAME_STATE (SLYLANDRO_KNOW_BROKEN)
+ && GET_GAME_STATE (PROBE_EXHIBITED_BUG))
+ {
+ switch (GET_GAME_STATE (SLYLANDRO_STACK6))
+ {
+ case 0:
+ pStr[0] = why_probe_always_attack;
+ break;
+ case 1:
+ pStr[0] = talk_more_probe_attack;
+ break;
+ }
+ }
+ switch (GET_GAME_STATE (SLYLANDRO_STACK7))
+ {
+ case 0:
+ pStr[1] = where_probes_from;
+ break;
+ case 1:
+ pStr[1] = why_sell;
+ break;
+ case 2:
+ pStr[1] = how_long_ago;
+ break;
+ }
+ switch (GET_GAME_STATE (SLYLANDRO_STACK8))
+ {
+ case 0:
+ pStr[2] = whats_probes_mission;
+ break;
+ case 1:
+ pStr[2] = if_only_one;
+ break;
+ }
+
+ InfoLeft = FALSE;
+ if (pStr[LastStack])
+ {
+ InfoLeft = TRUE;
+ Response (pStr[LastStack], ProbeInfo);
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ InfoLeft = TRUE;
+ Response (pStr[i], ProbeInfo);
+ }
+ }
+
+ Response (enough_probe, HomeWorld);
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (know_more_probe);
+ }
+}
+
+static void
+HomeWorld (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[3];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (PLAYER_SAID (R, we_are_us0))
+ {
+ NPCPhrase (TERRIBLY_EXCITING);
+
+ SET_GAME_STATE (SLYLANDRO_STACK1, 1);
+ DISABLE_PHRASE (we_are_us0);
+ }
+ else if (PLAYER_SAID (R, what_other_visitors))
+ {
+ NPCPhrase (VISITORS);
+
+ SET_GAME_STATE (PLAYER_KNOWS_PROBE, 1);
+ SET_GAME_STATE (SLYLANDRO_STACK1, 2);
+ }
+ else if (PLAYER_SAID (R, any_other_visitors))
+ {
+ NPCPhrase (LONG_AGO);
+
+ SET_GAME_STATE (SLYLANDRO_STACK1, 3);
+ }
+ else if (PLAYER_SAID (R, what_about_sentient_milieu))
+ {
+ NPCPhrase (MET_TAALO_THEY_ARE_FROM);
+
+ SET_GAME_STATE (SLYLANDRO_STACK1, 4);
+ }
+ else if (PLAYER_SAID (R, who_else))
+ {
+ NPCPhrase (PRECURSORS);
+
+ SET_GAME_STATE (SLYLANDRO_STACK1, 5);
+ }
+ else if (PLAYER_SAID (R, precursors_yow))
+ {
+ NPCPhrase (ABOUT_PRECURSORS);
+
+ SET_GAME_STATE (SLYLANDRO_STACK1, 6);
+ }
+ else if (PLAYER_SAID (R, must_know_more))
+ {
+ NPCPhrase (ALL_WE_KNOW);
+
+ SET_GAME_STATE (SLYLANDRO_STACK1, 7);
+ }
+ else if (PLAYER_SAID (R, who_are_you))
+ {
+ NPCPhrase (WE_ARE_SLY);
+
+ LastStack = 1;
+ SET_GAME_STATE (SLYLANDRO_STACK2, 1);
+ }
+ else if (PLAYER_SAID (R, where_are_you))
+ {
+ NPCPhrase (DOWN_HERE);
+
+ LastStack = 2;
+ SET_GAME_STATE (SLYLANDRO_STACK3, 1);
+ }
+ else if (PLAYER_SAID (R, thats_impossible_1))
+ {
+ NPCPhrase (NO_ITS_NOT_1);
+
+ LastStack = 2;
+ SET_GAME_STATE (SLYLANDRO_STACK3, 2);
+ }
+ else if (PLAYER_SAID (R, thats_impossible_2))
+ {
+ NPCPhrase (NO_ITS_NOT_2);
+
+ LastStack = 2;
+ SET_GAME_STATE (SLYLANDRO_STACK3, 3);
+ }
+ else if (PLAYER_SAID (R, like_more_about_you))
+ {
+ SlylandroInfo (R);
+ return;
+ }
+ else if (PLAYER_SAID (R, enough_about_me))
+ NPCPhrase (OK_ENOUGH_YOU);
+ else if (PLAYER_SAID (R, enough_info))
+ NPCPhrase (OK_ENOUGH_INFO);
+ else if (PLAYER_SAID (R, enough_probe))
+ NPCPhrase (OK_ENOUGH_PROBE);
+ else if (PLAYER_SAID (R, mega_self_destruct))
+ {
+ NPCPhrase (WHY_YES_THERE_IS);
+
+ SET_GAME_STATE (SLYLANDRO_KNOW_BROKEN, 1);
+ SET_GAME_STATE (DESTRUCT_CODE_ON_SHIP, 1);
+ i = GET_GAME_STATE (SLYLANDRO_MULTIPLIER) + 1;
+ SET_GAME_STATE (SLYLANDRO_MULTIPLIER, i);
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, SLYLANDRO_RAMP_DOWN);
+ }
+
+ switch (GET_GAME_STATE (SLYLANDRO_STACK1))
+ {
+ case 0:
+ construct_response (shared_phrase_buf,
+ we_are_us0,
+ GLOBAL_SIS (CommanderName),
+ we_are_us1,
+ GLOBAL_SIS (ShipName),
+ we_are_us2,
+ (UNICODE*)NULL);
+ pStr[0] = we_are_us0;
+ break;
+ case 1:
+ pStr[0] = what_other_visitors;
+ break;
+ case 2:
+ pStr[0] = any_other_visitors;
+ break;
+ case 3:
+ pStr[0] = what_about_sentient_milieu;
+ break;
+ case 4:
+ pStr[0] = who_else;
+ break;
+ case 5:
+ pStr[0] = precursors_yow;
+ break;
+ case 6:
+ pStr[0] = must_know_more;
+ break;
+ }
+ switch (GET_GAME_STATE (SLYLANDRO_STACK2))
+ {
+ case 0:
+ pStr[1] = who_are_you;
+ break;
+ case 1:
+ if (PHRASE_ENABLED (like_more_about_you))
+ pStr[1] = like_more_about_you;
+ break;
+ }
+ switch (GET_GAME_STATE (SLYLANDRO_STACK3))
+ {
+ case 0:
+ pStr[2] = where_are_you;
+ break;
+ case 1:
+ pStr[2] = thats_impossible_1;
+ break;
+ case 2:
+ pStr[2] = thats_impossible_2;
+ break;
+ }
+
+ if (pStr[LastStack])
+ {
+ if (pStr[LastStack] != we_are_us0)
+ Response (pStr[LastStack], HomeWorld);
+ else
+ DoResponsePhrase (pStr[LastStack], HomeWorld, shared_phrase_buf);
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (pStr[i] != we_are_us0)
+ Response (pStr[i], HomeWorld);
+ else
+ DoResponsePhrase (pStr[i], HomeWorld, shared_phrase_buf);
+ }
+ }
+ if (GET_GAME_STATE (SLYLANDRO_STACK1))
+ {
+ switch (GET_GAME_STATE (SLYLANDRO_STACK4))
+ {
+ case 0:
+ Response (happy_to_tell_more, HumanInfo);
+ break;
+ case 1:
+ Response (would_you_like_to_know_more, HumanInfo);
+ break;
+ }
+ }
+ if (GET_GAME_STATE (PLAYER_KNOWS_PROBE)
+ && !GET_GAME_STATE (SLYLANDRO_KNOW_BROKEN))
+ {
+ switch (GET_GAME_STATE (SLYLANDRO_STACK5))
+ {
+ case 0:
+ Response (what_are_probes, ProbeInfo);
+ break;
+ case 1:
+ if (PHRASE_ENABLED (know_more_probe))
+ Response (know_more_probe, ProbeInfo);
+ break;
+ }
+ }
+ Response (bye, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (GET_GAME_STATE (SLYLANDRO_KNOW_BROKEN)
+ && (NumVisits = GET_GAME_STATE (RECALL_VISITS)) == 0)
+ {
+ NPCPhrase (RECALL_PROGRAM_1);
+ ++NumVisits;
+ SET_GAME_STATE (RECALL_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (SLYLANDRO_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SLYLANDRO_HOME_VISITS, NumVisits);
+ }
+
+ HomeWorld ((RESPONSE_REF)0);
+}
+
+static COUNT
+uninit_slylandro (void)
+{
+ return (0);
+}
+
+static void
+post_slylandro_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_slylandro_comm (void)
+{
+ LOCDATA *retval;
+
+ slylandro_desc.init_encounter_func = Intro;
+ slylandro_desc.post_encounter_func = post_slylandro_enc;
+ slylandro_desc.uninit_encounter_func = uninit_slylandro;
+
+ slylandro_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ slylandro_desc.AlienTextBaseline.y = 0;
+ slylandro_desc.AlienTextWidth = SIS_TEXT_WIDTH;
+
+ setSegue (Segue_peace);
+ retval = &slylandro_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/slyhome/strings.h b/src/uqm/comm/slyhome/strings.h
new file mode 100644
index 0000000..bedac27
--- /dev/null
+++ b/src/uqm/comm/slyhome/strings.h
@@ -0,0 +1,143 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SLYHOME_STRINGS_H
+#define SLYHOME_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HELLO_1,
+ HELLO_2,
+ HELLO_3,
+ HELLO_4,
+ RECALL_PROGRAM_1,
+ we_are_us0,
+ we_are_us1,
+ we_are_us2,
+ TERRIBLY_EXCITING,
+ happy_to_tell_more,
+ TELL_MORE,
+ would_you_like_to_know_more,
+ YES_TELL_MORE,
+ we_come_from_earth,
+ OK_EARTH,
+ we_explore,
+ OK_EXPLORE,
+ we_fight_urquan,
+ URQUAN_NICE_GUYS,
+ not_same_urquan,
+ PERSONALITY_CHANGE,
+ we_gather,
+ MAYBE_INTERESTED,
+ enough_about_me,
+ OK_ENOUGH_YOU,
+ what_other_visitors,
+ VISITORS,
+ any_other_visitors,
+ LONG_AGO,
+ what_about_sentient_milieu,
+ MET_TAALO_THEY_ARE_FROM,
+ who_else,
+ PRECURSORS,
+ precursors_yow,
+ ABOUT_PRECURSORS,
+ must_know_more,
+ ALL_WE_KNOW,
+ who_are_you,
+ WE_ARE_SLY,
+ like_more_about_you,
+ SURE_KNOW_WHAT,
+ what_about_home,
+ ABOUT_HOME,
+ what_about_culture,
+ ABOUT_CULTURE,
+ what_about_history,
+ ABOUT_HISTORY,
+ what_about_biology,
+ ABOUT_BIOLOGY,
+ enough_info,
+ OK_ENOUGH_INFO,
+ where_are_you,
+ DOWN_HERE,
+ thats_impossible_1,
+ NO_ITS_NOT_1,
+ thats_impossible_2,
+ NO_ITS_NOT_2,
+ bye,
+ GOODBYE_1,
+ GOODBYE_2,
+ what_are_probes,
+ PROBES_ARE,
+ know_more_probe,
+ OK_WHAT_MORE_PROBE,
+ where_probes_from,
+ PROBES_FROM_MELNORME,
+ why_sell,
+ SELL_FOR_INFO,
+ how_long_ago,
+ FIFTY_THOUSAND_ROTATIONS,
+ whats_probes_mission,
+ SEEK_OUT_NEW_LIFE,
+ if_only_one,
+ THEY_REPLICATE,
+ enough_probe,
+ OK_ENOUGH_PROBE,
+ why_probe_always_attack,
+ ONLY_DEFEND,
+ talk_more_probe_attack,
+ NO_PROBLEM_BUT_SURE,
+ tell_me_about_basics,
+ BASIC_COMMANDS,
+ tell_basics_again,
+ OK_BASICS_AGAIN,
+ what_effect,
+ AFFECTS_BEHAVIOR,
+ how_does_probe_defend,
+ ONLY_SELF_DEFENSE,
+ combat_behavior,
+ MISSILE_BATTERIES,
+ what_missile_batteries,
+ LIGHTNING_ONLY_FOR_HARVESTING,
+ tell_me_about_rep_1,
+ ABOUT_REP,
+ what_set_priority,
+ MAXIMUM,
+ enough_problem,
+ OK_ENOUGH_PROBLEM,
+ probe_has_bug,
+ NO_IT_DOESNT,
+ tell_me_about_attack,
+ ATTACK_NO_PROBLEM,
+ tell_me_about_rep_2,
+ REP_NO_PROBLEM,
+ what_about_rep_priorities,
+ MAXIMUM_SO_WHAT,
+ think_about_rep_priorities,
+ UH_OH,
+ hunt_them_down,
+ GROW_TOO_FAST,
+ sue_melnorme,
+ SIGNED_WAIVER,
+ recall_signal,
+ NOT_THIS_MODEL,
+ mega_self_destruct,
+ WHY_YES_THERE_IS,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/slyland/Makeinfo b/src/uqm/comm/slyland/Makeinfo
new file mode 100644
index 0000000..10d3a53
--- /dev/null
+++ b/src/uqm/comm/slyland/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="slyland.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/slyland/resinst.h b/src/uqm/comm/slyland/resinst.h
new file mode 100644
index 0000000..d0b9a36
--- /dev/null
+++ b/src/uqm/comm/slyland/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define SLYLAND_COLOR_MAP "comm.probe.colortable"
+#define SLYLAND_CONVERSATION_PHRASES "comm.probe.dialogue"
+#define SLYLAND_FONT "comm.probe.font"
+#define SLYLAND_MUSIC "comm.probe.music"
+#define SLYLAND_PMAP_ANIM "comm.probe.graphics"
diff --git a/src/uqm/comm/slyland/slyland.c b/src/uqm/comm/slyland/slyland.c
new file mode 100644
index 0000000..ae7cb44
--- /dev/null
+++ b/src/uqm/comm/slyland/slyland.c
@@ -0,0 +1,518 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include <stdlib.h>
+#include "resinst.h"
+#include "strings.h"
+
+#include "options.h"
+#include "uqm/battle.h"
+#include "uqm/setup.h"
+
+
+static const NUMBER_SPEECH_DESC probe_numbers_english;
+
+static LOCDATA slylandro_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SLYLAND_PMAP_ANIM, /* AlienFrame */
+ SLYLAND_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SLYLAND_COLOR_MAP, /* AlienColorMap */
+ SLYLAND_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SLYLAND_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 6, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 1, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 3, /* RestartRate */
+ (1 << 3) /* BlockMask */
+ },
+ {
+ 10, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4) /* BlockMask */
+ },
+ {
+ 18, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5) /* BlockMask */
+ },
+ {
+ 26, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 3, /* RestartRate */
+ (1 << 0) /* BlockMask */
+ },
+ {
+ 34, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 3, /* RestartRate */
+ (1 << 1) /* BlockMask */
+ },
+ {
+ 42, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2) /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ &probe_numbers_english, /* AlienNumberSpeech - default */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static COUNT probe_digit_names[] =
+{
+ ENUMERATE_ZERO,
+ ENUMERATE_ONE,
+ ENUMERATE_TWO,
+ ENUMERATE_THREE,
+ ENUMERATE_FOUR,
+ ENUMERATE_FIVE,
+ ENUMERATE_SIX,
+ ENUMERATE_SEVEN,
+ ENUMERATE_EIGHT,
+ ENUMERATE_NINE,
+};
+
+static COUNT probe_teen_names[] =
+{
+ ENUMERATE_TEN,
+ ENUMERATE_ELEVEN,
+ ENUMERATE_TWELVE,
+ ENUMERATE_THIRTEEN,
+ ENUMERATE_FOURTEEN,
+ ENUMERATE_FIFTEEN,
+ ENUMERATE_SIXTEEN,
+ ENUMERATE_SEVENTEEN,
+ ENUMERATE_EIGHTEEN,
+ ENUMERATE_NINETEEN,
+};
+
+static COUNT probe_tens_names[] =
+{
+ 0, /* invalid */
+ 0, /* skip digit */
+ ENUMERATE_TWENTY,
+ ENUMERATE_THIRTY,
+ ENUMERATE_FOURTY,
+ ENUMERATE_FIFTY,
+ ENUMERATE_SIXTY,
+ ENUMERATE_SEVENTY,
+ ENUMERATE_EIGHTY,
+ ENUMERATE_NINETY,
+};
+
+static const NUMBER_SPEECH_DESC probe_numbers_english =
+{
+ 5, /* NumDigits */
+ {
+ { /* 1000-999999 */
+ 1000, /* Divider */
+ 0, /* Subtrahend */
+ NULL, /* StrDigits - recurse */
+ NULL, /* Names - not used */
+ ENUMERATE_THOUSAND /* CommonIndex */
+ },
+ { /* 100-999 */
+ 100, /* Divider */
+ 0, /* Subtrahend */
+ probe_digit_names, /* StrDigits */
+ NULL, /* Names - not used */
+ ENUMERATE_HUNDRED /* CommonIndex */
+ },
+ { /* 20-99 */
+ 10, /* Divider */
+ 0, /* Subtrahend */
+ probe_tens_names, /* StrDigits */
+ NULL, /* Names - not used */
+ 0 /* CommonIndex - not used */
+ },
+ { /* 10-19 */
+ 1, /* Divider */
+ 10, /* Subtrahend */
+ probe_teen_names, /* StrDigits */
+ NULL, /* Names - not used */
+ 0 /* CommonIndex - not used */
+ },
+ { /* 0-9 */
+ 1, /* Divider */
+ 0, /* Subtrahend */
+ probe_digit_names, /* StrDigits */
+ NULL, /* Names - not used */
+ 0 /* CommonIndex - not used */
+ }
+ }
+};
+
+static RESPONSE_REF threat,
+ something_wrong,
+ we_are_us,
+ why_attack,
+ bye;
+
+static void
+sayCoord (int coord)
+{
+ int ac;
+
+ ac = abs (coord);
+
+ NPCPhrase_splice (coord < 0 ? COORD_MINUS : COORD_PLUS);
+ NPCNumber (ac / 10, "%03d");
+ NPCPhrase_splice (COORD_POINT);
+ NPCNumber (ac % 10, NULL);
+}
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ if (GET_GAME_STATE (DESTRUCT_CODE_ON_SHIP))
+ Response (destruct_code, CombatIsInevitable);
+ switch (GET_GAME_STATE (SLYLANDRO_PROBE_THREAT))
+ {
+ case 0:
+ threat = threat_1;
+ break;
+ case 1:
+ threat = threat_2;
+ break;
+ case 2:
+ threat = threat_3;
+ break;
+ default:
+ threat = threat_4;
+ break;
+ }
+ Response (threat, CombatIsInevitable);
+ switch (GET_GAME_STATE (SLYLANDRO_PROBE_WRONG))
+ {
+ case 0:
+ something_wrong = something_wrong_1;
+ break;
+ case 1:
+ something_wrong = something_wrong_2;
+ break;
+ case 2:
+ something_wrong = something_wrong_3;
+ break;
+ default:
+ something_wrong = something_wrong_4;
+ break;
+ }
+ Response (something_wrong, CombatIsInevitable);
+ switch (GET_GAME_STATE (SLYLANDRO_PROBE_ID))
+ {
+ case 0:
+ we_are_us = we_are_us_1;
+ break;
+ case 1:
+ we_are_us = we_are_us_2;
+ break;
+ case 2:
+ we_are_us = we_are_us_3;
+ break;
+ default:
+ we_are_us = we_are_us_4;
+ break;
+ }
+ Response (we_are_us, CombatIsInevitable);
+ switch (GET_GAME_STATE (SLYLANDRO_PROBE_INFO))
+ {
+ case 0:
+ why_attack = why_attack_1;
+ break;
+ case 1:
+ why_attack = why_attack_2;
+ break;
+ case 2:
+ why_attack = why_attack_3;
+ break;
+ default:
+ why_attack = why_attack_4;
+ break;
+ }
+ Response (why_attack, CombatIsInevitable);
+ switch (GET_GAME_STATE (SLYLANDRO_PROBE_EXIT))
+ {
+ case 0:
+ bye = bye_1;
+ break;
+ case 1:
+ bye = bye_2;
+ break;
+ case 2:
+ bye = bye_3;
+ break;
+ default:
+ bye = bye_4;
+ break;
+ }
+ Response (bye, CombatIsInevitable);
+ }
+ else if (PLAYER_SAID (R, destruct_code))
+ {
+ NPCPhrase (DESTRUCT_SEQUENCE);
+ setSegue (Segue_victory);
+ }
+ else
+ {
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, threat))
+ {
+ NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_THREAT);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (PROGRAMMED_TO_DEFEND_1);
+ break;
+ case 1:
+ NPCPhrase (PROGRAMMED_TO_DEFEND_2);
+ break;
+ case 2:
+ NPCPhrase (PROGRAMMED_TO_DEFEND_3);
+ break;
+ case 3:
+ NPCPhrase (PROGRAMMED_TO_DEFEND_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SLYLANDRO_PROBE_THREAT, NumVisits);
+ }
+ else if (PLAYER_SAID (R, something_wrong))
+ {
+ NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_WRONG);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NOMINAL_FUNCTION_1);
+ break;
+ case 1:
+ NPCPhrase (NOMINAL_FUNCTION_2);
+ break;
+ case 2:
+ NPCPhrase (NOMINAL_FUNCTION_3);
+ break;
+ case 3:
+ NPCPhrase (NOMINAL_FUNCTION_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SLYLANDRO_PROBE_WRONG, NumVisits);
+ }
+ else if (PLAYER_SAID (R, we_are_us))
+ {
+ NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_ID);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (THIS_IS_PROBE_1);
+ break;
+ case 1:
+ NPCPhrase (THIS_IS_PROBE_2);
+ break;
+ case 2:
+ NPCPhrase (THIS_IS_PROBE_3);
+ break;
+ case 3:
+ {
+ SIZE dx, dy;
+
+ // Probe's coordinate system is {-Y,X} relative to B Corvi
+ dx = LOGX_TO_UNIVERSE (GLOBAL_SIS (log_x)) - 333;
+ dy = 9812 - LOGY_TO_UNIVERSE (GLOBAL_SIS (log_y));
+
+ NPCPhrase (THIS_IS_PROBE_40);
+ sayCoord (dy);
+ NPCPhrase_splice (THIS_IS_PROBE_41);
+ sayCoord (dx);
+ NPCPhrase (THIS_IS_PROBE_42);
+
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (SLYLANDRO_PROBE_ID, NumVisits);
+ }
+ else if (PLAYER_SAID (R, why_attack))
+ {
+ NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (PEACEFUL_MISSION_1);
+ break;
+ case 1:
+ NPCPhrase (PEACEFUL_MISSION_2);
+ break;
+ case 2:
+ NPCPhrase (PEACEFUL_MISSION_3);
+ break;
+ case 3:
+ NPCPhrase (PEACEFUL_MISSION_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SLYLANDRO_PROBE_INFO, NumVisits);
+ }
+ else if (PLAYER_SAID (R, bye))
+ {
+ NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_EXIT);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GOODBYE_1);
+ break;
+ case 1:
+ NPCPhrase (GOODBYE_2);
+ break;
+ case 2:
+ NPCPhrase (GOODBYE_3);
+ break;
+ case 3:
+ NPCPhrase (GOODBYE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SLYLANDRO_PROBE_EXIT, NumVisits);
+ }
+
+ NPCPhrase (HOSTILE);
+
+ SET_GAME_STATE (PROBE_EXHIBITED_BUG, 1);
+ setSegue (Segue_hostile);
+ }
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SLYLANDRO_PROBE_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (WE_COME_IN_PEACE_1);
+ break;
+ case 1:
+ NPCPhrase (WE_COME_IN_PEACE_2);
+ break;
+ case 2:
+ NPCPhrase (WE_COME_IN_PEACE_3);
+ break;
+ case 3:
+ NPCPhrase (WE_COME_IN_PEACE_4);
+ break;
+ case 4:
+ NPCPhrase (WE_COME_IN_PEACE_5);
+ break;
+ case 5:
+ NPCPhrase (WE_COME_IN_PEACE_6);
+ break;
+ case 6:
+ NPCPhrase (WE_COME_IN_PEACE_7);
+ break;
+ case 7:
+ NPCPhrase (WE_COME_IN_PEACE_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SLYLANDRO_PROBE_VISITS, NumVisits);
+
+ CombatIsInevitable ((RESPONSE_REF)0);
+}
+
+static COUNT
+uninit_slyland (void)
+{
+ return (0);
+}
+
+static void
+post_slyland_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_slyland_comm (void)
+{
+ LOCDATA *retval;
+
+ slylandro_desc.init_encounter_func = Intro;
+ slylandro_desc.post_encounter_func = post_slyland_enc;
+ slylandro_desc.uninit_encounter_func = uninit_slyland;
+
+ slylandro_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ slylandro_desc.AlienTextBaseline.y = 0;
+ slylandro_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ setSegue (Segue_hostile);
+ retval = &slylandro_desc;
+
+ return (retval);
+}
+
diff --git a/src/uqm/comm/slyland/strings.h b/src/uqm/comm/slyland/strings.h
new file mode 100644
index 0000000..4a1ef17
--- /dev/null
+++ b/src/uqm/comm/slyland/strings.h
@@ -0,0 +1,113 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SLYLAND_STRINGS_H
+#define SLYLAND_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ WE_COME_IN_PEACE_1,
+ WE_COME_IN_PEACE_2,
+ WE_COME_IN_PEACE_3,
+ WE_COME_IN_PEACE_4,
+ WE_COME_IN_PEACE_5,
+ WE_COME_IN_PEACE_6,
+ WE_COME_IN_PEACE_7,
+ WE_COME_IN_PEACE_8,
+ threat_1,
+ threat_2,
+ threat_3,
+ threat_4,
+ PROGRAMMED_TO_DEFEND_1,
+ PROGRAMMED_TO_DEFEND_2,
+ PROGRAMMED_TO_DEFEND_3,
+ PROGRAMMED_TO_DEFEND_4,
+ something_wrong_1,
+ something_wrong_2,
+ something_wrong_3,
+ something_wrong_4,
+ NOMINAL_FUNCTION_1,
+ NOMINAL_FUNCTION_2,
+ NOMINAL_FUNCTION_3,
+ NOMINAL_FUNCTION_4,
+ we_are_us_1,
+ we_are_us_2,
+ we_are_us_3,
+ we_are_us_4,
+ THIS_IS_PROBE_1,
+ THIS_IS_PROBE_2,
+ THIS_IS_PROBE_3,
+ THIS_IS_PROBE_40,
+ THIS_IS_PROBE_41,
+ THIS_IS_PROBE_42,
+ why_attack_1,
+ why_attack_2,
+ why_attack_3,
+ why_attack_4,
+ PEACEFUL_MISSION_1,
+ PEACEFUL_MISSION_2,
+ PEACEFUL_MISSION_3,
+ PEACEFUL_MISSION_4,
+ bye_1,
+ bye_2,
+ bye_3,
+ bye_4,
+ GOODBYE_1,
+ GOODBYE_2,
+ GOODBYE_3,
+ GOODBYE_4,
+ HOSTILE,
+ DESTRUCT_SEQUENCE,
+ destruct_code,
+ COORD_PLUS,
+ COORD_MINUS,
+ COORD_POINT,
+ ENUMERATE_HUNDRED,
+ ENUMERATE_THOUSAND,
+ ENUMERATE_ZERO,
+ ENUMERATE_ONE,
+ ENUMERATE_TWO,
+ ENUMERATE_THREE,
+ ENUMERATE_FOUR,
+ ENUMERATE_FIVE,
+ ENUMERATE_SIX,
+ ENUMERATE_SEVEN,
+ ENUMERATE_EIGHT,
+ ENUMERATE_NINE,
+ ENUMERATE_TEN,
+ ENUMERATE_ELEVEN,
+ ENUMERATE_TWELVE,
+ ENUMERATE_THIRTEEN,
+ ENUMERATE_FOURTEEN,
+ ENUMERATE_FIFTEEN,
+ ENUMERATE_SIXTEEN,
+ ENUMERATE_SEVENTEEN,
+ ENUMERATE_EIGHTEEN,
+ ENUMERATE_NINETEEN,
+ ENUMERATE_TWENTY,
+ ENUMERATE_THIRTY,
+ ENUMERATE_FOURTY,
+ ENUMERATE_FIFTY,
+ ENUMERATE_SIXTY,
+ ENUMERATE_SEVENTY,
+ ENUMERATE_EIGHTY,
+ ENUMERATE_NINETY,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/spahome/Makeinfo b/src/uqm/comm/spahome/Makeinfo
new file mode 100644
index 0000000..6972013
--- /dev/null
+++ b/src/uqm/comm/spahome/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="spahome.c"
+uqm_HFILES="strings.h"
diff --git a/src/uqm/comm/spahome/spahome.c b/src/uqm/comm/spahome/spahome.c
new file mode 100644
index 0000000..190e3bb
--- /dev/null
+++ b/src/uqm/comm/spahome/spahome.c
@@ -0,0 +1,1018 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "../spathi/resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/gameev.h"
+
+
+static LOCDATA spahome_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SPATHI_HOME_PMAP_ANIM, /* AlienFrame */
+ SPATHI_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SPATHI_HOME_COLOR_MAP, /* AlienColorMap */
+ SPATHI_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SPATHI_HOME_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 14, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 4, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 9, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 10) | (1 << 11), /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND / 20, 0, /* RestartRate */
+ (1 << 4) | (1 << 5) /* BlockMask */
+ },
+ {
+ 19, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 3) | (1 << 5), /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* RestartRate */
+ (1 << 3) | (1 << 4)
+ | (1 << 10), /* BlockMask */
+ },
+ {
+ 26, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 10), /* BlockMask */
+ },
+ {
+ 29, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 32, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND / 20, 0, /* RestartRate */
+ (1 << 9) | (1 << 10), /* BlockMask */
+ },
+ {
+ 39, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 8) | (1 << 10), /* BlockMask */
+ },
+ {
+ 42, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, 0, /* RestartRate */
+ (1 << 8) | (1 << 9)
+ | (1 << 6) | (1 << 2)
+ | (1 << 11) | (1 << 5), /* BlockMask */
+ },
+ {
+ 46, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* RestartRate */
+ (1 << 2) | (1 << 10), /* BlockMask */
+ },
+ {
+ 50, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND / 20, 0, /* RestartRate */
+ (1 << 13), /* BlockMask */
+ },
+ {
+ 56, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 12), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+ if (PLAYER_SAID (R, we_attack_again))
+ {
+ NPCPhrase (WE_FIGHT_AGAIN);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, surrender_or_die))
+ {
+ NPCPhrase (DEFEND_OURSELVES);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase (NO_PASSWORD);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, gort_merenga)
+ || PLAYER_SAID (R, guph_florp)
+ || PLAYER_SAID (R, wagngl_fthagn)
+ || PLAYER_SAID (R, pleeese))
+ {
+ NPCPhrase (WRONG_PASSWORD);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, screw_password))
+ {
+ NPCPhrase (NO_PASSWORD);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, bye_no_ally_offer))
+ NPCPhrase (GOODBYE_NO_ALLY_OFFER);
+ else if (PLAYER_SAID (R, bye_angry_spathi))
+ NPCPhrase (GOODBYE_ANGRY_SPATHI);
+ else if (PLAYER_SAID (R, bye_ally))
+ NPCPhrase (GOODBYE_ALLY);
+ else if (PLAYER_SAID (R, already_got_them))
+ {
+ NPCPhrase (EARLY_BIRD_CHECK);
+
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ SET_GAME_STATE (SPATHI_PARTY, 1);
+ SET_GAME_STATE (SPATHI_MANNER, 3);
+ }
+ else if (PLAYER_SAID (R, too_dangerous))
+ NPCPhrase (WE_AGREE);
+ else if (PLAYER_SAID (R, think_more))
+ NPCPhrase (COWARD);
+ else if (PLAYER_SAID (R, i_accept))
+ {
+ NPCPhrase (AWAIT_RETURN);
+
+ SET_GAME_STATE (SPATHI_QUEST, 1);
+ SET_GAME_STATE (SPATHI_MANNER, 3);
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, do_as_we_say))
+ {
+ NPCPhrase (DEPART_FOR_EARTH);
+
+ SetRaceAllied (SPATHI_SHIP, TRUE);
+ AddEvent (RELATIVE_EVENT, 6, 0, 0, SPATHI_SHIELD_EVENT);
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, killed_them_all_1))
+ {
+ NPCPhrase (WILL_CHECK_1);
+
+ if (!GET_GAME_STATE (SPATHI_CREATURES_ELIMINATED))
+ {
+ SET_GAME_STATE (LIED_ABOUT_CREATURES, 1);
+ }
+ else
+ {
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ SET_GAME_STATE (SPATHI_PARTY, 1);
+ SET_GAME_STATE (SPATHI_MANNER, 3);
+ }
+ }
+ else if (PLAYER_SAID (R, killed_them_all_2))
+ {
+ NPCPhrase (WILL_CHECK_2);
+
+ if (!GET_GAME_STATE (SPATHI_CREATURES_ELIMINATED))
+ {
+ SET_GAME_STATE (LIED_ABOUT_CREATURES, 2);
+ }
+ else
+ {
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ SET_GAME_STATE (SPATHI_PARTY, 1);
+ SET_GAME_STATE (SPATHI_MANNER, 3);
+ }
+ }
+ else if (PLAYER_SAID (R, bye_before_party))
+ {
+ NPCPhrase (GOODBYE_BEFORE_PARTY);
+ }
+ else if (PLAYER_SAID (R, bye_from_party_1)
+ || PLAYER_SAID (R, bye_from_party_2)
+ || PLAYER_SAID (R, bye_from_party_3))
+ {
+ NPCPhrase (GOODBYE_FROM_PARTY);
+ }
+}
+
+static void SpathiAllies (RESPONSE_REF R);
+
+static void
+SpathiInfo (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ InfoLeft = FALSE;
+ if (PLAYER_SAID (R, like_some_info))
+ NPCPhrase (WHAT_ABOUT);
+ else if (PLAYER_SAID (R, what_about_hierarchy))
+ {
+ NPCPhrase (ABOUT_HIERARCHY);
+
+ DISABLE_PHRASE (what_about_hierarchy);
+ }
+ else if (PLAYER_SAID (R, what_about_history))
+ {
+ NPCPhrase (ABOUT_HISTORY);
+
+ DISABLE_PHRASE (what_about_history);
+ }
+ else if (PLAYER_SAID (R, what_about_alliance))
+ {
+ NPCPhrase (ABOUT_ALLIANCE);
+
+ DISABLE_PHRASE (what_about_alliance);
+ }
+ else if (PLAYER_SAID (R, what_about_other))
+ {
+ NPCPhrase (ABOUT_OTHER);
+
+ DISABLE_PHRASE (what_about_other);
+ }
+ else if (PLAYER_SAID (R, what_about_precursors))
+ {
+ NPCPhrase (ABOUT_PRECURSORS);
+
+ DISABLE_PHRASE (what_about_precursors);
+ }
+
+ if (PHRASE_ENABLED (what_about_hierarchy))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_hierarchy, SpathiInfo);
+ }
+ if (PHRASE_ENABLED (what_about_history))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_history, SpathiInfo);
+ }
+ if (PHRASE_ENABLED (what_about_alliance))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_alliance, SpathiInfo);
+ }
+ if (PHRASE_ENABLED (what_about_other))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_other, SpathiInfo);
+ }
+ if (PHRASE_ENABLED (what_about_precursors))
+ {
+ InfoLeft = TRUE;
+ Response (what_about_precursors, SpathiInfo);
+ }
+ Response (enough_info, SpathiAllies);
+
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (like_some_info);
+ }
+}
+
+static void
+SpathiAllies (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (R == 0)
+ {
+ NumVisits = GET_GAME_STATE (SPATHI_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_ALLIES_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_ALLIES_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_ALLIES_3);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_HOME_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, whats_up))
+ {
+ NumVisits = GET_GAME_STATE (SPATHI_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_3);
+ SET_GAME_STATE (KNOW_URQUAN_STORY, 1);
+ SET_GAME_STATE (KNOW_KOHR_AH_STORY, 1);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_4);
+ break;
+ case 4:
+ NPCPhrase (GENERAL_INFO_5);
+ --NumVisits;
+ break;
+ case 5:
+ NPCPhrase (GENERAL_INFO_5);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up);
+ }
+ else if (PLAYER_SAID (R, resources_please))
+ {
+ NPCPhrase (SORRY_NO_RESOURCES);
+
+ DISABLE_PHRASE (resources_please);
+ }
+ else if (PLAYER_SAID (R, something_fishy))
+ {
+ NPCPhrase (NOTHING_FISHY);
+
+ SET_GAME_STATE (SPATHI_INFO, 5);
+ }
+ else if (PLAYER_SAID (R, enough_info))
+ NPCPhrase (OK_ENOUGH_INFO);
+
+ if (GET_GAME_STATE (SPATHI_INFO) == 4)
+ Response (something_fishy, SpathiAllies);
+ if (PHRASE_ENABLED (whats_up))
+ Response (whats_up, SpathiAllies);
+ if (PHRASE_ENABLED (resources_please))
+ Response (resources_please, SpathiAllies);
+ if (PHRASE_ENABLED (like_some_info))
+ Response (like_some_info, SpathiInfo);
+ Response (bye_ally, ExitConversation);
+}
+
+static void
+SpathiQuest (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ if (!GET_GAME_STATE (LIED_ABOUT_CREATURES))
+ NPCPhrase (HOW_GO_EFFORTS);
+ else
+ NPCPhrase (YOU_LIED_1);
+ }
+ else if (PLAYER_SAID (R, little_mistake))
+ {
+ NPCPhrase (BIG_MISTAKE);
+
+ DISABLE_PHRASE (little_mistake);
+ }
+ else if (PLAYER_SAID (R, talk_test))
+ {
+ NPCPhrase (TEST_AGAIN);
+
+ DISABLE_PHRASE (talk_test);
+ }
+ else if (PLAYER_SAID (R, zapped_a_few))
+ {
+ NPCPhrase (YOU_FORTUNATE);
+
+ DISABLE_PHRASE (zapped_a_few);
+ }
+
+ if (!GET_GAME_STATE (LIED_ABOUT_CREATURES))
+ Response (killed_them_all_1, ExitConversation);
+ else
+ {
+ if (PHRASE_ENABLED (little_mistake))
+ {
+ Response (little_mistake, SpathiQuest);
+ }
+ Response (killed_them_all_2, ExitConversation);
+ }
+ if (!GET_GAME_STATE (SPATHI_CREATURES_ELIMINATED))
+ {
+ if (PHRASE_ENABLED (talk_test))
+ {
+ Response (talk_test, SpathiQuest);
+ }
+ if (PHRASE_ENABLED (zapped_a_few)
+ && GET_GAME_STATE (SPATHI_CREATURES_EXAMINED))
+ {
+ Response (zapped_a_few, SpathiQuest);
+ }
+ Response (bye_before_party, ExitConversation);
+ }
+}
+
+static void
+LearnQuest (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ NPCPhrase (QUEST_AGAIN);
+
+ DISABLE_PHRASE (what_test);
+ if (GET_GAME_STATE (KNOW_SPATHI_EVIL))
+ {
+ DISABLE_PHRASE (tell_evil);
+ }
+ }
+ else if (PLAYER_SAID (R, how_prove))
+ NPCPhrase (BETTER_IDEA);
+ else if (PLAYER_SAID (R, what_test))
+ {
+ NPCPhrase (WIPE_EVIL);
+
+ SET_GAME_STATE (KNOW_SPATHI_QUEST, 1);
+ DISABLE_PHRASE (what_test);
+ }
+ else if (PLAYER_SAID (R, tell_evil))
+ {
+ NPCPhrase (BEFORE_ACCEPT);
+
+ SET_GAME_STATE (KNOW_SPATHI_EVIL, 1);
+ DISABLE_PHRASE (tell_evil);
+ DISABLE_PHRASE (prove_strength);
+ }
+ else if (PLAYER_SAID (R, prove_strength))
+ {
+ NPCPhrase (YOUR_BEHAVIOR);
+
+ DISABLE_PHRASE (prove_strength);
+ }
+ else if (PLAYER_SAID (R, why_dont_you_do_it))
+ {
+ NPCPhrase (WE_WONT_BECAUSE);
+
+ DISABLE_PHRASE (why_dont_you_do_it);
+ }
+
+ if (PHRASE_ENABLED (what_test))
+ Response (what_test, LearnQuest);
+ else if (GET_GAME_STATE (SPATHI_CREATURES_ELIMINATED))
+ {
+ Response (already_got_them, ExitConversation);
+ }
+ else if (PHRASE_ENABLED (tell_evil))
+ {
+ Response (too_dangerous, ExitConversation);
+ Response (tell_evil, LearnQuest);
+ }
+ else
+ {
+ Response (too_dangerous, ExitConversation);
+ Response (think_more, ExitConversation);
+ Response (i_accept, ExitConversation);
+ }
+ if (PHRASE_ENABLED (prove_strength) && !GET_GAME_STATE (KNOW_SPATHI_QUEST))
+ Response (prove_strength, LearnQuest);
+ if (PHRASE_ENABLED (why_dont_you_do_it))
+ Response (why_dont_you_do_it, LearnQuest);
+}
+
+static void
+AllianceOffer (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, misunderstanding))
+ {
+ NPCPhrase (JUST_MISUNDERSTANDING);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1)
+ ), ONE_SECOND / 4);
+
+ SET_GAME_STATE (SPATHI_MANNER, 3);
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, we_come_in_peace))
+ NPCPhrase (OF_COURSE);
+ else if (PLAYER_SAID (R, hand_in_friendship))
+ {
+ NPCPhrase (TOO_AFRAID);
+
+ DISABLE_PHRASE (hand_in_friendship);
+ }
+ else if (PLAYER_SAID (R, stronger))
+ {
+ NPCPhrase (YOURE_NOT);
+
+ DISABLE_PHRASE (stronger);
+ }
+ else if (PLAYER_SAID (R, yes_we_are))
+ {
+ NPCPhrase (NO_YOURE_NOT);
+
+ DISABLE_PHRASE (yes_we_are);
+ }
+ else if (PLAYER_SAID (R, share_info))
+ {
+ NPCPhrase (NO_INFO);
+
+ DISABLE_PHRASE (share_info);
+ }
+ else if (PLAYER_SAID (R, give_us_resources))
+ {
+ NPCPhrase (NO_RESOURCES);
+
+ DISABLE_PHRASE (give_us_resources);
+ }
+
+ if (PHRASE_ENABLED (hand_in_friendship))
+ Response (hand_in_friendship, AllianceOffer);
+ else if (PHRASE_ENABLED (stronger))
+ Response (stronger, AllianceOffer);
+ else if (PHRASE_ENABLED (yes_we_are))
+ Response (yes_we_are, AllianceOffer);
+ else
+ {
+ Response (how_prove, LearnQuest);
+ }
+ if (PHRASE_ENABLED (share_info))
+ Response (share_info, AllianceOffer);
+ if (PHRASE_ENABLED (give_us_resources))
+ Response (give_us_resources, AllianceOffer);
+}
+
+static void
+SpathiAngry (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ NPCPhrase (MEAN_GUYS_RETURN);
+
+ Response (we_apologize, SpathiAngry);
+ }
+ else /* if (R == we_apologize) */
+ {
+ NPCPhrase (DONT_BELIEVE);
+
+ Response (misunderstanding, AllianceOffer);
+ }
+
+ Response (we_attack_again, ExitConversation);
+ Response (bye_angry_spathi, ExitConversation);
+}
+
+static void
+SpathiParty (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SPATHI_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (MUST_PARTY_1);
+ break;
+ case 1:
+ NPCPhrase (MUST_PARTY_2);
+ break;
+ case 2:
+ NPCPhrase (MUST_PARTY_3);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_HOME_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, deals_a_deal))
+ {
+ NPCPhrase (WAIT_A_WHILE);
+
+ DISABLE_PHRASE (deals_a_deal);
+ }
+ else if (PLAYER_SAID (R, how_long))
+ {
+ NPCPhrase (TEN_YEARS);
+
+ DISABLE_PHRASE (how_long);
+ }
+ else if (PLAYER_SAID (R, reneging))
+ {
+ NPCPhrase (ADULT_VIEW);
+
+ DISABLE_PHRASE (reneging);
+ }
+ else if (PLAYER_SAID (R, return_beasts))
+ {
+ NPCPhrase (WHAT_RELATIONSHIP);
+
+ DISABLE_PHRASE (return_beasts);
+ }
+ else if (PLAYER_SAID (R, minds_and_might))
+ {
+ NPCPhrase (HUH);
+
+ DISABLE_PHRASE (minds_and_might);
+ }
+ else if (PLAYER_SAID (R, fellowship))
+ {
+ NPCPhrase (WHAT);
+
+ DISABLE_PHRASE (fellowship);
+ }
+
+ if (PHRASE_ENABLED (deals_a_deal))
+ Response (deals_a_deal, SpathiParty);
+ else if (PHRASE_ENABLED (how_long))
+ Response (how_long, SpathiParty);
+ else if (PHRASE_ENABLED (reneging))
+ Response (reneging, SpathiParty);
+ else if (PHRASE_ENABLED (return_beasts))
+ Response (return_beasts, SpathiParty);
+ else
+ {
+ if (PHRASE_ENABLED (minds_and_might))
+ Response (minds_and_might, SpathiParty);
+ if (PHRASE_ENABLED (fellowship))
+ Response (fellowship, SpathiParty);
+ Response (do_as_we_say, ExitConversation);
+
+ return;
+ }
+ switch (GET_GAME_STATE (SPATHI_HOME_VISITS) - 1)
+ {
+ case 0:
+ Response (bye_from_party_1, ExitConversation);
+ break;
+ case 1:
+ Response (bye_from_party_2, ExitConversation);
+ break;
+ default:
+ Response (bye_from_party_3, ExitConversation);
+ break;
+ }
+}
+
+static void
+SpathiCouncil (RESPONSE_REF R)
+{
+ if (R == 0)
+ NPCPhrase (HELLO_AGAIN);
+ else if (PLAYER_SAID (R, good_password))
+ {
+ NPCPhrase (YES_GOOD_PASSWORD);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1)
+ ), ONE_SECOND / 4);
+
+ SET_GAME_STATE (KNOW_SPATHI_PASSWORD, 1);
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, we_come_in_peace))
+ {
+ NPCPhrase (KILLED_SPATHI);
+
+ DISABLE_PHRASE (we_come_in_peace);
+ }
+ else if (PLAYER_SAID (R, spathi_on_pluto))
+ {
+ NPCPhrase (WHERE_SPATHI);
+
+ DISABLE_PHRASE (spathi_on_pluto);
+ }
+ else if (PLAYER_SAID (R, hostage))
+ {
+ NPCPhrase (GUN_TO_HEAD);
+
+ SET_GAME_STATE (FOUND_PLUTO_SPATHI, 3);
+ DISABLE_PHRASE (hostage);
+ }
+ else if (PLAYER_SAID (R, killed_fwiffo))
+ {
+ NPCPhrase (POOR_FWIFFO);
+
+ SET_GAME_STATE (FOUND_PLUTO_SPATHI, 3);
+ DISABLE_PHRASE (killed_fwiffo);
+ }
+ else if (PLAYER_SAID (R, fwiffo_fine))
+ {
+ NPCPhrase (NOT_LIKELY);
+
+ R = killed_fwiffo;
+ DISABLE_PHRASE (fwiffo_fine);
+ }
+ else if (PLAYER_SAID (R, surrender))
+ {
+ NPCPhrase (NO_SURRENDER);
+
+ DISABLE_PHRASE (surrender);
+ }
+
+ if (GET_GAME_STATE (SPATHI_MANNER) == 0)
+ {
+ Response (we_come_in_peace, AllianceOffer);
+ }
+ else if (PHRASE_ENABLED (we_come_in_peace))
+ {
+ Response (we_come_in_peace, SpathiCouncil);
+ }
+ else
+ {
+ Response (misunderstanding, AllianceOffer);
+ }
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI)
+ && GET_GAME_STATE (FOUND_PLUTO_SPATHI) < 3)
+ {
+ if (PHRASE_ENABLED (spathi_on_pluto))
+ Response (spathi_on_pluto, SpathiCouncil);
+ else if (HaveEscortShip (SPATHI_SHIP))
+ {
+ if (PHRASE_ENABLED (hostage))
+ Response (hostage, SpathiCouncil);
+ }
+ else if (PHRASE_ENABLED (killed_fwiffo))
+ {
+ Response (killed_fwiffo, SpathiCouncil);
+ if (PHRASE_ENABLED (fwiffo_fine))
+ Response (fwiffo_fine, SpathiCouncil);
+ }
+ }
+ if (PHRASE_ENABLED (surrender))
+ Response (surrender, SpathiCouncil);
+ else
+ {
+ Response (surrender_or_die, ExitConversation);
+ }
+ Response (bye_no_ally_offer, ExitConversation);
+}
+
+static void
+SpathiPassword (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SPATHI_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ default:
+ NPCPhrase (WHAT_IS_PASSWORD);
+ NumVisits = 1;
+ break;
+ case 1:
+ NPCPhrase (WHAT_IS_PASSWORD_AGAIN);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_HOME_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, what_do_i_get))
+ {
+ NPCPhrase (YOU_GET_TO_LIVE);
+
+ DISABLE_PHRASE (what_do_i_get);
+ }
+
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI)
+ || GET_GAME_STATE (KNOW_SPATHI_PASSWORD))
+ {
+ Response (good_password, SpathiCouncil);
+ if (PHRASE_ENABLED (what_do_i_get))
+ {
+ Response (what_do_i_get, SpathiPassword);
+ }
+ }
+ else
+ {
+ construct_response (shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_are_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ DoResponsePhrase (we_are_vindicator0, ExitConversation, shared_phrase_buf);
+ Response (gort_merenga, ExitConversation);
+ Response (guph_florp, ExitConversation);
+ Response (wagngl_fthagn, ExitConversation);
+ Response (pleeese, ExitConversation);
+ Response (screw_password, ExitConversation);
+ }
+}
+
+static void
+Intro (void)
+{
+ BYTE Manner;
+
+ Manner = GET_GAME_STATE (SPATHI_MANNER);
+ if (Manner == 2)
+ {
+ NPCPhrase (HATE_YOU_FOREVER);
+ setSegue (Segue_hostile);
+ }
+ else if (Manner == 1
+ && GET_GAME_STATE (KNOW_SPATHI_PASSWORD)
+ && (GET_GAME_STATE (FOUND_PLUTO_SPATHI)
+ || GET_GAME_STATE (SPATHI_HOME_VISITS) != 7))
+ {
+ SpathiAngry ((RESPONSE_REF)0);
+ }
+ else if (CheckAlliance (SPATHI_SHIP) == GOOD_GUY)
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+ SpathiAllies ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (SPATHI_PARTY))
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+ SpathiParty ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (SPATHI_QUEST))
+ {
+ if (GET_GAME_STATE (LIED_ABOUT_CREATURES) < 2)
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+ SpathiQuest ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NPCPhrase (YOU_LIED_2);
+
+ SET_GAME_STATE (SPATHI_MANNER, 2);
+ setSegue (Segue_hostile);
+ }
+ }
+ else if (GET_GAME_STATE (KNOW_SPATHI_QUEST))
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+ LearnQuest ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (KNOW_SPATHI_PASSWORD)
+ && (GET_GAME_STATE (FOUND_PLUTO_SPATHI)
+ || GET_GAME_STATE (SPATHI_HOME_VISITS) != 7))
+ {
+ CommData.AlienColorMap =
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1);
+ SpathiCouncil ((RESPONSE_REF)0);
+ }
+ else
+ {
+ SpathiPassword ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_spahome (void)
+{
+ return (0);
+}
+
+static void
+post_spahome_enc (void)
+{
+ BYTE Manner;
+
+ if (getSegue () == Segue_hostile
+ && (Manner = GET_GAME_STATE (SPATHI_MANNER)) != 2)
+ {
+ SET_GAME_STATE (SPATHI_MANNER, 1);
+ if (Manner != 1)
+ {
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ }
+ }
+}
+
+LOCDATA*
+init_spahome_comm ()
+{
+ LOCDATA *retval;
+
+ spahome_desc.init_encounter_func = Intro;
+ spahome_desc.post_encounter_func = post_spahome_enc;
+ spahome_desc.uninit_encounter_func = uninit_spahome;
+
+ spahome_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ spahome_desc.AlienTextBaseline.y = 0;
+ spahome_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ // use alternate "Safe Ones" track if available
+ spahome_desc.AlienAltSongRes = SPAHOME_MUSIC;
+ spahome_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
+
+ if (GET_GAME_STATE (SPATHI_MANNER) == 3)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+
+ retval = &spahome_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/spahome/strings.h b/src/uqm/comm/spahome/strings.h
new file mode 100644
index 0000000..6df9560
--- /dev/null
+++ b/src/uqm/comm/spahome/strings.h
@@ -0,0 +1,174 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPAHOME_STRINGS_H
+#define SPAHOME_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ killed_fwiffo,
+ POOR_FWIFFO,
+ fwiffo_fine,
+ NOT_LIKELY,
+ we_attack_again,
+ WE_FIGHT_AGAIN,
+ bye_no_ally_offer,
+ GOODBYE_NO_ALLY_OFFER,
+ bye_angry_spathi,
+ GOODBYE_ANGRY_SPATHI,
+ why_dont_you_do_it,
+ WE_WONT_BECAUSE,
+ MEAN_GUYS_RETURN,
+ we_apologize,
+ DONT_BELIEVE,
+ HELLO_AGAIN,
+ HATE_YOU_FOREVER,
+ WHAT_IS_PASSWORD,
+ WHAT_IS_PASSWORD_AGAIN,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ gort_merenga,
+ guph_florp,
+ pleeese,
+ wagngl_fthagn,
+ screw_password,
+ good_password,
+ WRONG_PASSWORD,
+ NO_PASSWORD,
+ what_do_i_get,
+ YOU_GET_TO_LIVE,
+ YES_GOOD_PASSWORD,
+ spathi_on_pluto,
+ WHERE_SPATHI,
+ hostage,
+ GUN_TO_HEAD,
+ we_come_in_peace,
+ OF_COURSE,
+ KILLED_SPATHI,
+ misunderstanding,
+ JUST_MISUNDERSTANDING,
+// JUST_MISUNDERSTANDING0,
+// JUST_MISUNDERSTANDING1,
+ give_us_resources,
+ NO_RESOURCES,
+ resources_please,
+ SORRY_NO_RESOURCES,
+ bye_ally,
+ GOODBYE_ALLY,
+ what_about_hierarchy,
+ what_about_history,
+ what_about_alliance,
+ what_about_other,
+ what_about_precursors,
+ enough_info,
+ OK_ENOUGH_INFO,
+ ABOUT_HIERARCHY,
+ ABOUT_HISTORY,
+ ABOUT_ALLIANCE,
+ ABOUT_OTHER,
+ ABOUT_PRECURSORS,
+ little_mistake,
+ BIG_MISTAKE,
+ bye_before_party,
+ QUEST_AGAIN,
+ GOODBYE_BEFORE_PARTY,
+ GOOD_START,
+ something_fishy,
+ NOTHING_FISHY,
+ surrender,
+ NO_SURRENDER,
+ surrender_or_die,
+ DEFEND_OURSELVES,
+ hand_in_friendship,
+ TOO_AFRAID,
+ stronger,
+ YOURE_NOT,
+ yes_we_are,
+ NO_YOURE_NOT,
+ how_prove,
+ BETTER_IDEA,
+ share_info,
+ NO_INFO,
+ WE_UNDERSTAND,
+ prove_strength,
+ YOUR_BEHAVIOR,
+ what_test,
+ BEFORE_ACCEPT,
+ WIPE_EVIL,
+ think_more,
+ COWARD,
+ tell_evil,
+ i_accept,
+ AWAIT_RETURN,
+ talk_test,
+ already_got_them,
+ EARLY_BIRD_CHECK,
+ NOT_SURPRISED,
+ TEST_AGAIN,
+ too_dangerous,
+ WE_AGREE,
+ HOW_GO_EFFORTS,
+ killed_them_all_1,
+ killed_them_all_2,
+ WILL_CHECK_1,
+ WILL_CHECK_2,
+ zapped_a_few,
+ RETURN_COMPLETE,
+ MUST_DESTROY_ALL,
+ no_landing,
+ saw_creatures,
+ YOU_FORTUNATE,
+ YOU_LIED_1,
+ YOU_LIED_2,
+ bye_from_party_1,
+ bye_from_party_2,
+ bye_from_party_3,
+ GOODBYE_FROM_PARTY,
+ MUST_PARTY_1,
+ MUST_PARTY_2,
+ MUST_PARTY_3,
+ deals_a_deal,
+ WAIT_A_WHILE,
+ how_long,
+ TEN_YEARS,
+ reneging,
+ ADULT_VIEW,
+ return_beasts,
+ WHAT_RELATIONSHIP,
+ minds_and_might,
+ HUH,
+ fellowship,
+ WHAT,
+ do_as_we_say,
+ DEPART_FOR_EARTH,
+ HELLO_ALLIES_1,
+ HELLO_ALLIES_2,
+ HELLO_ALLIES_3,
+ whats_up,
+ GENERAL_INFO_1,
+ GENERAL_INFO_2,
+ GENERAL_INFO_3,
+ GENERAL_INFO_4,
+ GENERAL_INFO_5,
+ like_some_info,
+ WHAT_ABOUT
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/spathi/Makeinfo b/src/uqm/comm/spathi/Makeinfo
new file mode 100644
index 0000000..09e8874
--- /dev/null
+++ b/src/uqm/comm/spathi/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="spathic.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/spathi/resinst.h b/src/uqm/comm/spathi/resinst.h
new file mode 100644
index 0000000..f83962b
--- /dev/null
+++ b/src/uqm/comm/spathi/resinst.h
@@ -0,0 +1,14 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define FWIFFO_MUSIC "comm.fwiffo.music"
+#define SPAHOME_MUSIC "comm.safeones.music"
+#define SPATHI_COLOR_MAP "comm.spathi.colortable"
+#define SPATHI_CONVERSATION_PHRASES "comm.spathi.dialogue"
+#define SPATHI_FONT "comm.spathi.font"
+#define SPATHI_HOME_COLOR_MAP "comm.safeones.colortable"
+#define SPATHI_HOME_CONVERSATION_PHRASES "comm.safeones.dialogue"
+#define SPATHI_HOME_PMAP_ANIM "comm.safeones.graphics"
+#define SPATHI_MUSIC "comm.spathi.music"
+#define SPATHI_PMAP_ANIM "comm.spathi.graphics"
diff --git a/src/uqm/comm/spathi/spathic.c b/src/uqm/comm/spathi/spathic.c
new file mode 100644
index 0000000..29288dc
--- /dev/null
+++ b/src/uqm/comm/spathi/spathic.c
@@ -0,0 +1,834 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+
+
+static LOCDATA spathi_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SPATHI_PMAP_ANIM, /* AlienFrame */
+ SPATHI_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SPATHI_COLOR_MAP, /* AlienColorMap */
+ SPATHI_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SPATHI_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 8, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 1, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ 0, ONE_SECOND, /* RestartRate */
+ (1 << 1), /* BlockMask */
+ },
+ {
+ 7, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND / 20, 0, /* RestartRate */
+ (1 << 0), /* BlockMask */
+ },
+ {
+ 16, /* StartIndex */
+ 4, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* RestartRate */
+ (1 << 4), /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ (1 << 5)
+ },
+ {
+ 24, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2), /* BlockMask */
+ },
+
+
+ {
+ 34, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 3), /* BlockMask */
+ },
+ {
+ 38, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 41, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+#ifdef NEVER
+ { /* AlienTalkDesc */
+ 29, /* StartIndex */
+ 5, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+#else
+ { /* AlienTalkDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+#endif /* NEVER */
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF Response)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (Response, bye_ally_space))
+ NPCPhrase (GOODBYE_ALLY_SPACE);
+ else if (PLAYER_SAID (Response, bye_friendly_space))
+ NPCPhrase (GOODBYE_FRIENDLY_SPACE);
+ else if (PLAYER_SAID (Response, part_in_peace))
+ NPCPhrase (KEEP_IT_SECRET);
+ else if (PLAYER_SAID (Response, we_sorry_space))
+ NPCPhrase (APOLOGIZE_AT_HOMEWORLD);
+ else if (PLAYER_SAID (Response, give_info_space))
+ NPCPhrase (HERES_SOME_INFO);
+ else if (PLAYER_SAID (Response, bye_angry_space))
+ NPCPhrase (GOODBYE_ANGRY_SPACE);
+ else if (PLAYER_SAID (Response, attack_you_now))
+ {
+ NPCPhrase (YIPES);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (Response, we_fight_again_space))
+ {
+ NPCPhrase (OK_FIGHT_AGAIN_SPACE);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (Response, die_slugboy)
+ || PLAYER_SAID (Response, we_fight_1)
+ || PLAYER_SAID (Response, we_fight_2)
+ || PLAYER_SAID (Response, pay_for_crimes)
+ || PLAYER_SAID (Response, tell_me_coordinates)
+ || PLAYER_SAID (Response, changed_mind))
+ {
+ if (PLAYER_SAID (Response, tell_me_coordinates))
+ NPCPhrase (FAKE_COORDINATES);
+ NPCPhrase (OK_WE_FIGHT_AT_PLUTO);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (Response, join_us))
+ {
+ if (EscortFeasibilityStudy (SPATHI_SHIP) == 0)
+ NPCPhrase (TOO_SCARY);
+ else
+ {
+ NPCPhrase (WILL_JOIN);
+
+ AlienTalkSegue ((COUNT)~0);
+ AddEscortShips (SPATHI_SHIP, 1);
+ /* Make the Eluder escort captained by Fwiffo alone */
+ SetEscortCrewComplement (SPATHI_SHIP, 1,
+ NAME_OFFSET + NUM_CAPTAINS_NAMES);
+ }
+ }
+}
+
+static BYTE join_us_refusals;
+
+static void
+SpathiOnPluto (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, hi_there))
+ NPCPhrase (ARE_YOU_SURE);
+ else if (PLAYER_SAID (R, dont_kill))
+ NPCPhrase (OK_WONT);
+ else if (PLAYER_SAID (R, youre_forgiven))
+ NPCPhrase (THANKS_FOR_FORGIVENESS);
+ else if (PLAYER_SAID (R, you_wont_die_yet))
+ NPCPhrase (ETERNAL_GRATITUDE);
+ else if (PLAYER_SAID (R, you_may_live))
+ NPCPhrase (GEE_THANKS);
+ else if (PLAYER_SAID (R, youve_got_me_all_wrong))
+ NPCPhrase (SORRY_NO_COORDS);
+ else if (PLAYER_SAID (R, what_doing_on_pluto_1))
+ {
+ NPCPhrase (ABOUT_20_YEARS_AGO);
+
+ DISABLE_PHRASE (what_doing_on_pluto_1);
+ }
+ else if (PLAYER_SAID (R, what_doing_on_pluto_2))
+ {
+ NPCPhrase (WHEN_URQUAN_ARRIVED);
+
+ DISABLE_PHRASE (what_doing_on_pluto_2);
+ }
+ else if (PLAYER_SAID (R, what_doing_on_pluto_3))
+ {
+ NPCPhrase (STATIONED_ON_EARTH_MOON);
+
+ DISABLE_PHRASE (what_doing_on_pluto_3);
+ }
+ else if (PLAYER_SAID (R, what_about_ilwrath))
+ {
+ NPCPhrase (ABOUT_ILWRATH);
+
+ DISABLE_PHRASE (what_about_ilwrath);
+ }
+ else if (PLAYER_SAID (R, when_ilwrath))
+ {
+ NPCPhrase (THEN_ILWRATH);
+
+ DISABLE_PHRASE (when_ilwrath);
+ }
+ else if (PLAYER_SAID (R, what_about_moonbase))
+ {
+ NPCPhrase (SET_UP_BASE);
+
+ DISABLE_PHRASE (what_about_moonbase);
+ }
+ else if (PLAYER_SAID (R, what_about_other_spathi))
+ {
+ NPCPhrase (SPATHI_ARE);
+
+ DISABLE_PHRASE (what_about_other_spathi);
+ }
+ else if (PLAYER_SAID (R, what_about_other_spathi))
+ {
+ NPCPhrase (THEN_ILWRATH);
+
+ DISABLE_PHRASE (what_about_other_spathi);
+ }
+ else if (PLAYER_SAID (R, how_many_crew))
+ {
+ NPCPhrase (THOUSANDS);
+
+ DISABLE_PHRASE (how_many_crew);
+ }
+ else if (PLAYER_SAID (R, really_thousands))
+ {
+ NPCPhrase (JUST_ME);
+
+ DISABLE_PHRASE (really_thousands);
+ }
+ else if (PLAYER_SAID (R, full_of_monsters))
+ {
+ NPCPhrase (HOW_TRUE);
+
+ DISABLE_PHRASE (full_of_monsters);
+ }
+ else if (PLAYER_SAID (R, what_enemy))
+ {
+ NPCPhrase (ENEMY_IS);
+
+ DISABLE_PHRASE (what_enemy);
+ }
+ else if (PLAYER_SAID (R, why_you_here))
+ {
+ NPCPhrase (DREW_SHORT_STRAW);
+
+ DISABLE_PHRASE (why_you_here);
+ }
+ else if (PLAYER_SAID (R, where_are_urquan))
+ {
+ NPCPhrase (URQUAN_LEFT);
+
+ DISABLE_PHRASE (where_are_urquan);
+ }
+ else if (PLAYER_SAID (R, what_about_other_races))
+ {
+ NPCPhrase (ABOUT_OTHER_RACES);
+
+ DISABLE_PHRASE (what_about_other_races);
+ }
+ else if (PLAYER_SAID (R, what_blaze_of_glory))
+ {
+ NPCPhrase (BLAZE_IS);
+
+ DISABLE_PHRASE (what_blaze_of_glory);
+ }
+ else if (PLAYER_SAID (R, what_about_yourself))
+ {
+ NPCPhrase (ABOUT_MYSELF);
+
+ DISABLE_PHRASE (what_about_yourself);
+ }
+ else if (PLAYER_SAID (R, join_us))
+ {
+ if (join_us_refusals == 0)
+ {
+ NPCPhrase (WONT_JOIN_1);
+ ++join_us_refusals;
+ }
+ else if (join_us_refusals == 1)
+ {
+ NPCPhrase (WONT_JOIN_2);
+ ++join_us_refusals;
+ }
+ else
+ NPCPhrase (WONT_JOIN_3);
+ }
+
+ if (PHRASE_ENABLED (what_doing_on_pluto_1))
+ Response (what_doing_on_pluto_1, SpathiOnPluto);
+ else if (PHRASE_ENABLED (what_doing_on_pluto_2))
+ Response (what_doing_on_pluto_2, SpathiOnPluto);
+ else if (PHRASE_ENABLED (what_doing_on_pluto_3))
+ Response (what_doing_on_pluto_3, SpathiOnPluto);
+ else
+ {
+ if (PHRASE_ENABLED (what_about_ilwrath))
+ Response (what_about_ilwrath, SpathiOnPluto);
+ else if (PHRASE_ENABLED (when_ilwrath))
+ Response (when_ilwrath, SpathiOnPluto);
+
+ if (PHRASE_ENABLED (what_about_moonbase))
+ Response (what_about_moonbase, SpathiOnPluto);
+ else if (PHRASE_ENABLED (what_about_other_spathi))
+ Response (what_about_other_spathi, SpathiOnPluto);
+ else
+ {
+ if (PHRASE_ENABLED (how_many_crew))
+ Response (how_many_crew, SpathiOnPluto);
+ else if (PHRASE_ENABLED (really_thousands))
+ Response (really_thousands, SpathiOnPluto);
+ else if (PHRASE_ENABLED (full_of_monsters))
+ Response (full_of_monsters, SpathiOnPluto);
+
+ if (PHRASE_ENABLED (what_enemy))
+ Response (what_enemy, SpathiOnPluto);
+ else if (PHRASE_ENABLED (why_you_here))
+ Response (why_you_here, SpathiOnPluto);
+ }
+ }
+ if (PHRASE_ENABLED (where_are_urquan))
+ Response (where_are_urquan, SpathiOnPluto);
+ else if (PHRASE_ENABLED (what_about_other_races))
+ Response (what_about_other_races, SpathiOnPluto);
+ else if (PHRASE_ENABLED (what_blaze_of_glory))
+ Response (what_blaze_of_glory, SpathiOnPluto);
+ else if (PHRASE_ENABLED (what_about_yourself))
+ Response (what_about_yourself, SpathiOnPluto);
+
+ if (!PHRASE_ENABLED (full_of_monsters))
+ Response (join_us, ExitConversation);
+ else
+ Response (join_us, SpathiOnPluto);
+ Response (changed_mind, ExitConversation);
+}
+
+static void
+SpathiMustGrovel (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, identify))
+ {
+ NPCPhrase (I_FWIFFO);
+
+ Response (do_cultural, SpathiMustGrovel);
+ Response (youre_forgiven, SpathiOnPluto);
+ Response (die_slugboy, ExitConversation);
+ }
+ else if (PLAYER_SAID (R, do_cultural))
+ {
+ NPCPhrase (WEZZY_WEZZAH);
+
+ Response (begin_ritual, SpathiMustGrovel);
+ Response (you_wont_die_yet, SpathiOnPluto);
+ Response (we_fight_2, ExitConversation);
+ }
+ else if (PLAYER_SAID (R, begin_ritual))
+ {
+ NPCPhrase (MUST_DO_RITUAL_AT_HOME);
+
+ Response (you_may_live, SpathiOnPluto);
+ Response (pay_for_crimes, ExitConversation);
+ Response (what_are_coordinates, SpathiMustGrovel);
+ }
+ else /* if (R == what_are_coordinates) */
+ {
+ NPCPhrase (COORDINATES_ARE);
+
+ Response (youve_got_me_all_wrong, SpathiOnPluto);
+ Response (tell_me_coordinates, ExitConversation);
+ }
+}
+
+static void
+SpathiAllies (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SPATHI_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_ALLIED_HELLO_SPACE);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_ALLIED_HELLO_SPACE);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, whats_up_space_2))
+ {
+ NPCPhrase (GENERAL_INFO_SPACE_2);
+
+ DISABLE_PHRASE (whats_up_space_2);
+ }
+ else if (PLAYER_SAID (R, give_us_info_from_space))
+ {
+ NPCPhrase (GET_INFO_FROM_SPATHIWA);
+
+ DISABLE_PHRASE (give_us_info_from_space);
+ }
+ else if (PLAYER_SAID (R, give_us_resources_space))
+ {
+ NPCPhrase (GET_RESOURCES_FROM_SPATHIWA);
+
+ DISABLE_PHRASE (give_us_resources_space);
+ }
+ else if (PLAYER_SAID (R, what_do_for_fun))
+ {
+ NPCPhrase (DO_THIS_FOR_FUN);
+
+ DISABLE_PHRASE (what_do_for_fun);
+ }
+
+ if (PHRASE_ENABLED (whats_up_space_2))
+ Response (whats_up_space_2, SpathiAllies);
+ if (PHRASE_ENABLED (give_us_info_from_space))
+ Response (give_us_info_from_space, SpathiAllies);
+ if (PHRASE_ENABLED (give_us_resources_space))
+ Response (give_us_resources_space, SpathiAllies);
+ if (PHRASE_ENABLED (what_do_for_fun))
+ Response (what_do_for_fun, SpathiAllies);
+ Response (bye_ally_space, ExitConversation);
+}
+
+static void
+SpathiFriendly (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SPATHI_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_FRIENDLY_HELLO_SPACE);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_FRIENDLY_HELLO_SPACE);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, since_friendly_give_stuff))
+ {
+ NPCPhrase (GIVE_ADVICE);
+
+ DISABLE_PHRASE (since_friendly_give_stuff);
+ }
+ else if (PLAYER_SAID (R, whats_up_space_1))
+ {
+ NPCPhrase (GENERAL_INFO_SPACE_1);
+
+ DISABLE_PHRASE (whats_up_space_1);
+ }
+
+ if (PHRASE_ENABLED (whats_up_space_1))
+ Response (whats_up_space_1, SpathiFriendly);
+ if (PHRASE_ENABLED (since_friendly_give_stuff))
+ Response (since_friendly_give_stuff, SpathiFriendly);
+ Response (bye_friendly_space, ExitConversation);
+}
+
+static void SpathiNeutral (RESPONSE_REF R);
+
+static void
+SpathiBefriend (RESPONSE_REF R)
+{
+ BYTE InfoLeft, LastStack;
+ RESPONSE_REF pStr[2];
+
+ InfoLeft = FALSE;
+ LastStack = 0;
+ pStr[0] = pStr[1] = 0;
+ if (PLAYER_SAID (R, come_in_peace))
+ NPCPhrase (AGAINST_NATURE);
+ else if (PLAYER_SAID (R, looking_for_a_few_good_squids))
+ {
+ NPCPhrase (URQUAN_SLAVES);
+
+ DISABLE_PHRASE (looking_for_a_few_good_squids);
+ }
+ else if (PLAYER_SAID (R, why_slaves))
+ {
+ NPCPhrase (UMGAH_TRICK);
+
+ DISABLE_PHRASE (why_slaves);
+ }
+ else if (PLAYER_SAID (R, tell_us_about_you))
+ {
+ NPCPhrase (ABOUT_US);
+
+ DISABLE_PHRASE (tell_us_about_you);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, what_you_really_want))
+ {
+ NPCPhrase (WANT_THIS);
+
+ DISABLE_PHRASE (what_you_really_want);
+ }
+ else if (PLAYER_SAID (R, how_about_alliance))
+ {
+ NPCPhrase (SURE);
+
+ DISABLE_PHRASE (how_about_alliance);
+ }
+
+ if (PHRASE_ENABLED (looking_for_a_few_good_squids))
+ pStr[0] = looking_for_a_few_good_squids;
+ else if (PHRASE_ENABLED (why_slaves))
+ pStr[0] = why_slaves;
+ if (PHRASE_ENABLED (tell_us_about_you))
+ pStr[1] = tell_us_about_you;
+ else if (PHRASE_ENABLED (what_you_really_want))
+ pStr[1] = what_you_really_want;
+ if (pStr[LastStack])
+ {
+ InfoLeft = TRUE;
+ Response (pStr[LastStack], SpathiBefriend);
+ }
+ LastStack ^= 1;
+ if (pStr[LastStack])
+ {
+ InfoLeft = TRUE;
+ Response (pStr[LastStack], SpathiBefriend);
+ }
+ if (PHRASE_ENABLED (how_about_alliance))
+ {
+ InfoLeft = TRUE;
+ Response (how_about_alliance, SpathiBefriend);
+ }
+
+ if (!InfoLeft)
+ {
+ SET_GAME_STATE (SPATHI_STACK1, 1);
+ SpathiNeutral (R);
+ }
+}
+
+static void
+SpathiAntagonize (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, prepare_to_die))
+ {
+ NPCPhrase (ALWAYS_PREPARED);
+
+ SET_GAME_STATE (SPATHI_STACK2, 1);
+ }
+ else if (PLAYER_SAID (R, heard_youre_cowards))
+ {
+ NPCPhrase (DARN_TOOTIN);
+
+ DISABLE_PHRASE (heard_youre_cowards);
+ }
+ else if (PLAYER_SAID (R, wanna_fight))
+ {
+ NPCPhrase (YES_WE_DO);
+
+ DISABLE_PHRASE (wanna_fight);
+ }
+ else if (PLAYER_SAID (R, so_lets_fight))
+ {
+ NPCPhrase (OK_LETS_FIGHT);
+
+ DISABLE_PHRASE (so_lets_fight);
+ }
+ else if (PLAYER_SAID (R, so_lets_fight_already))
+ {
+ NPCPhrase (DONT_REALLY_WANT_TO_FIGHT);
+
+ DISABLE_PHRASE (so_lets_fight_already);
+ }
+
+ if (PHRASE_ENABLED (wanna_fight))
+ Response (wanna_fight, SpathiAntagonize);
+ else if (PHRASE_ENABLED (so_lets_fight))
+ Response (so_lets_fight, SpathiAntagonize);
+ else if (PHRASE_ENABLED (so_lets_fight_already))
+ Response (so_lets_fight_already, SpathiAntagonize);
+ if (PHRASE_ENABLED (heard_youre_cowards))
+ Response (heard_youre_cowards, SpathiAntagonize);
+ Response (attack_you_now, ExitConversation);
+}
+
+static void
+SpathiNeutral (RESPONSE_REF R)
+{
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SPATHI_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_NEUTRAL_HELLO_SPACE);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_NEUTRAL_HELLO_SPACE);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, look_weird))
+ {
+ NPCPhrase (YOU_LOOK_WEIRD);
+
+ SET_GAME_STATE (SPATHI_STACK0, 1);
+ }
+ else if (PLAYER_SAID (R, no_look_really_weird))
+ {
+ NPCPhrase (NO_YOU_LOOK_REALLY_WEIRD);
+
+ SET_GAME_STATE (SPATHI_STACK0, 2);
+ }
+
+ switch (GET_GAME_STATE (SPATHI_STACK0))
+ {
+ case 0:
+ Response (look_weird, SpathiNeutral);
+ break;
+ case 1:
+ Response (no_look_really_weird, SpathiNeutral);
+ break;
+ }
+ if (GET_GAME_STATE (SPATHI_STACK1) == 0)
+ {
+ Response (come_in_peace, SpathiBefriend);
+ }
+ if (GET_GAME_STATE (SPATHI_STACK2) == 0)
+ {
+ Response (prepare_to_die, SpathiAntagonize);
+ }
+ else
+ {
+ Response (attack_you_now, ExitConversation);
+ }
+ Response (part_in_peace, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE Manner;
+
+ Manner = GET_GAME_STATE (SPATHI_MANNER);
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1)
+ {
+ join_us_refusals = 0;
+
+ NPCPhrase (SORRY_ABOUT_THAT);
+
+ /* if already know password from Melnorme,
+ * but haven't visited Spathiwa yet . . .
+ */
+ if (GET_GAME_STATE (SPATHI_HOME_VISITS) == 7)
+ {
+ SET_GAME_STATE (KNOW_SPATHI_PASSWORD, 0);
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ }
+
+ Response (identify, SpathiMustGrovel);
+ Response (hi_there, SpathiOnPluto);
+ Response (dont_kill, SpathiOnPluto);
+ Response (we_fight_1, ExitConversation);
+ }
+ else if (Manner == 2)
+ {
+ NPCPhrase (HATE_YOU_FOREVER_SPACE);
+ setSegue (Segue_hostile);
+ }
+ else if (Manner == 1)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SPATHI_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_ANGRY_HELLO_SPACE);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_ANGRY_HELLO_SPACE);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SPATHI_VISITS, NumVisits);
+
+ Response (give_info_space, ExitConversation);
+ Response (we_sorry_space,ExitConversation);
+ Response (we_fight_again_space, ExitConversation);
+ Response (bye_angry_space, ExitConversation);
+ }
+ else if (CheckAlliance (SPATHI_SHIP) == GOOD_GUY)
+ {
+ SpathiAllies ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (SPATHI_QUEST))
+ {
+ SpathiFriendly ((RESPONSE_REF)0);
+ }
+ else
+ {
+ SpathiNeutral ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_spathi (void)
+{
+ return (0);
+}
+
+static void
+post_spathi_enc (void)
+{
+ BYTE Manner;
+
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1)
+ {
+ SET_GAME_STATE (FOUND_PLUTO_SPATHI, 2);
+ }
+ else if (getSegue () == Segue_hostile
+ && (Manner = GET_GAME_STATE (SPATHI_MANNER)) != 2)
+ {
+ SET_GAME_STATE (SPATHI_MANNER, 1);
+ if (Manner != 1)
+ {
+ SET_GAME_STATE (SPATHI_VISITS, 0);
+ /* if don't know about Spathi via Melnorme . . . */
+ if (GET_GAME_STATE (SPATHI_HOME_VISITS) != 7)
+ {
+ SET_GAME_STATE (SPATHI_HOME_VISITS, 0);
+ }
+ }
+ }
+}
+
+LOCDATA*
+init_spathi_comm (void)
+{
+ LOCDATA *retval;
+
+ spathi_desc.init_encounter_func = Intro;
+ spathi_desc.post_encounter_func = post_spathi_enc;
+ spathi_desc.uninit_encounter_func = uninit_spathi;
+
+ spathi_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ spathi_desc.AlienTextBaseline.y = 0;
+ spathi_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1)
+ { // use alternate Fwiffo track if available
+ spathi_desc.AlienAltSongRes = FWIFFO_MUSIC;
+ spathi_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
+ }
+ else
+ { // regular track -- let's make sure
+ spathi_desc.AlienSongFlags &= ~LDASF_USE_ALTERNATE;
+ }
+
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI) == 1
+ || GET_GAME_STATE (SPATHI_MANNER) == 3
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &spathi_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/spathi/strings.h b/src/uqm/comm/spathi/strings.h
new file mode 100644
index 0000000..a09ea87
--- /dev/null
+++ b/src/uqm/comm/spathi/strings.h
@@ -0,0 +1,160 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPATHI_STRINGS_H
+#define SPATHI_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ SORRY_ABOUT_THAT,
+ identify,
+ I_FWIFFO,
+ hi_there,
+ ARE_YOU_SURE,
+ dont_kill,
+ we_fight_1,
+ we_fight_2,
+ OK_WONT,
+ do_cultural,
+ WEZZY_WEZZAH,
+ die_slugboy,
+ begin_ritual,
+ MUST_DO_RITUAL_AT_HOME,
+ you_wont_die_yet,
+ ETERNAL_GRATITUDE,
+ we_fight,
+ pay_for_crimes,
+ CLUTCH_MAVEN,
+ you_may_live,
+ HONEST_AND_FRIENDLY,
+ what_are_coordinates,
+ COORDINATES_ARE,
+ tell_me_coordinates,
+ FAKE_COORDINATES,
+ TOO_SCARY,
+ youve_got_me_all_wrong,
+ SORRY_NO_COORDS,
+ what_doing_on_pluto_1,
+ ABOUT_20_YEARS_AGO,
+ what_doing_on_pluto_2,
+ WHEN_URQUAN_ARRIVED,
+ where_are_urquan,
+ URQUAN_LEFT,
+ what_about_other_races,
+ ABOUT_OTHER_RACES,
+ what_doing_on_pluto_3,
+ what_about_yourself,
+ ABOUT_MYSELF,
+ STATIONED_ON_EARTH_MOON,
+ what_blaze_of_glory,
+ BLAZE_IS,
+ what_about_moonbase,
+ SET_UP_BASE,
+ what_about_ilwrath,
+ ABOUT_ILWRATH,
+ what_about_other_spathi,
+ really_thousands,
+ SPATHI_ARE,
+ what_enemy,
+ ENEMY_IS,
+ when_ilwrath,
+ THEN_ILWRATH,
+ why_you_here,
+ DREW_SHORT_STRAW,
+ how_many_crew,
+ JUST_ME,
+ THOUSANDS,
+ full_of_monsters,
+ HOW_TRUE,
+ join_us,
+ WILL_JOIN,
+ WONT_JOIN_1,
+ give_ship_or_die,
+ WONT_JOIN_2,
+ WONT_JOIN_3,
+ GEE_THANKS,
+ changed_mind,
+ youre_forgiven,
+ THANKS_FOR_FORGIVENESS,
+ HATE_YOU_FOREVER_SPACE,
+ INIT_ANGRY_HELLO_SPACE,
+ SUBSEQUENT_ANGRY_HELLO_SPACE,
+ INIT_NEUTRAL_HELLO_SPACE,
+ SUBSEQUENT_NEUTRAL_HELLO_SPACE,
+ INIT_FRIENDLY_HELLO_SPACE,
+ SUBSEQUENT_FRIENDLY_HELLO_SPACE,
+ INIT_ALLIED_HELLO_SPACE,
+ SUBSEQUENT_ALLIED_HELLO_SPACE,
+ give_info_space,
+ HERES_SOME_INFO,
+ we_sorry_space,
+ APOLOGIZE_AT_HOMEWORLD,
+ we_fight_again_space,
+ OK_FIGHT_AGAIN_SPACE,
+ bye_angry_space,
+ GOODBYE_ANGRY_SPACE,
+ look_weird,
+ YOU_LOOK_WEIRD,
+ no_look_really_weird,
+ NO_YOU_LOOK_REALLY_WEIRD,
+ come_in_peace,
+ AGAINST_NATURE,
+ prepare_to_die,
+ ALWAYS_PREPARED,
+ since_friendly_give_stuff,
+ GIVE_ADVICE,
+ whats_up_space_1,
+ GENERAL_INFO_SPACE_1,
+ bye_friendly_space,
+ GOODBYE_FRIENDLY_SPACE,
+ looking_for_a_few_good_squids,
+ URQUAN_SLAVES,
+ why_slaves,
+ UMGAH_TRICK,
+ tell_us_about_you,
+ ABOUT_US,
+ what_you_really_want,
+ WANT_THIS,
+ how_about_alliance,
+ SURE,
+ part_in_peace,
+ KEEP_IT_SECRET,
+ heard_youre_cowards,
+ DARN_TOOTIN,
+ wanna_fight,
+ YES_WE_DO,
+ so_lets_fight,
+ OK_LETS_FIGHT,
+ so_lets_fight_already,
+ DONT_REALLY_WANT_TO_FIGHT,
+ attack_you_now,
+ YIPES,
+ whats_up_space_2,
+ GENERAL_INFO_SPACE_2,
+ give_us_info_from_space,
+ GET_INFO_FROM_SPATHIWA,
+ give_us_resources_space,
+ GET_RESOURCES_FROM_SPATHIWA,
+ what_do_for_fun,
+ DO_THIS_FOR_FUN,
+ bye_ally_space,
+ GOODBYE_ALLY_SPACE,
+ OK_WE_FIGHT_AT_PLUTO,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/starbas/Makeinfo b/src/uqm/comm/starbas/Makeinfo
new file mode 100644
index 0000000..7f1eab8
--- /dev/null
+++ b/src/uqm/comm/starbas/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="starbas.c"
+uqm_HFILES="strings.h"
diff --git a/src/uqm/comm/starbas/starbas.c b/src/uqm/comm/starbas/starbas.c
new file mode 100644
index 0000000..5f25a2d
--- /dev/null
+++ b/src/uqm/comm/starbas/starbas.c
@@ -0,0 +1,1961 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "../comandr/resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/setup.h"
+#include "uqm/shipcont.h"
+#include "uqm/sis.h"
+ // for DeltaSISGauges()
+#include "libs/graphics/gfx_common.h"
+#include "libs/mathlib.h"
+#include "libs/inplib.h"
+
+
+static void TellMission (RESPONSE_REF R);
+static void SellMinerals (RESPONSE_REF R);
+
+
+static LOCDATA commander_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ COMMANDER_PMAP_ANIM, /* AlienFrame */
+ COMMANDER_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ COMMANDER_COLOR_MAP, /* AlienColorMap */
+ COMMANDER_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ STARBASE_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 10, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ { /* Blink */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Running light */
+ 10, /* StartIndex */
+ 30, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ ONE_SECOND * 2, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 0 */
+ 40, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 1 */
+ 47, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 2 */
+ 55, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 3 */
+ 61, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 4 */
+ 67, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 5 */
+ 74, /* StartIndex */
+ 11, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Arc welder 6 */
+ 85, /* StartIndex */
+ 10, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 40, 0, /* FrameRate */
+ 0, ONE_SECOND * 8, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Flagship picture */
+ 95, /* StartIndex */
+ 1, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 4, /* StartIndex */
+ 6, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 7 / 60, ONE_SECOND / 12, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static DWORD CurBulletinMask;
+
+static void
+ByeBye (RESPONSE_REF R)
+{
+ (void) R; // ignored
+
+ CurBulletinMask |= GET_GAME_STATE_32 (STARBASE_BULLETS0);
+ SET_GAME_STATE_32 (STARBASE_BULLETS0, CurBulletinMask);
+
+ /* if (R == goodbye_starbase_commander) */
+ if (GET_GAME_STATE (CHMMR_BOMB_STATE) >= 2)
+ NPCPhrase (GOOD_LUCK_AGAIN);
+ else
+ {
+ RESPONSE_REF pStr0 = 0;
+ RESPONSE_REF pStr1 = 0;
+
+ switch ((BYTE)TFB_Random () & 7)
+ {
+ case 0:
+ pStr0 = NORMAL_GOODBYE_A0;
+ pStr1 = NORMAL_GOODBYE_A1;
+ break;
+ case 1:
+ pStr0 = NORMAL_GOODBYE_B0;
+ pStr1 = NORMAL_GOODBYE_B1;
+ break;
+ case 2:
+ pStr0 = NORMAL_GOODBYE_C0;
+ pStr1 = NORMAL_GOODBYE_C1;
+ break;
+ case 3:
+ pStr0 = NORMAL_GOODBYE_D0;
+ pStr1 = NORMAL_GOODBYE_D1;
+ break;
+ case 4:
+ pStr0 = NORMAL_GOODBYE_E0;
+ pStr1 = NORMAL_GOODBYE_E1;
+ break;
+ case 5:
+ pStr0 = NORMAL_GOODBYE_F0;
+ pStr1 = NORMAL_GOODBYE_F1;
+ break;
+ case 6:
+ pStr0 = NORMAL_GOODBYE_G0;
+ pStr1 = NORMAL_GOODBYE_G1;
+ break;
+ case 7:
+ pStr0 = NORMAL_GOODBYE_H0;
+ pStr1 = NORMAL_GOODBYE_H1;
+ break;
+ }
+
+ NPCPhrase (pStr0);
+ if (!usingSpeech)
+ {
+ NPCPhrase (SPACE);
+ NPCPhrase (GLOBAL_PLAYER_NAME);
+ }
+ NPCPhrase (pStr1);
+ }
+}
+
+static void NeedInfo (RESPONSE_REF R);
+static void TellHistory (RESPONSE_REF R);
+static void AlienRaces (RESPONSE_REF R);
+
+static BYTE stack0;
+static BYTE stack1;
+static BYTE stack2;
+static BYTE stack3;
+
+static void
+AllianceInfo (RESPONSE_REF R)
+{
+#define ALLIANCE_SHOFIXTI (1 << 0)
+#define ALLIANCE_YEHAT (1 << 1)
+#define ALLIANCE_ARILOU (1 << 2)
+#define ALLIANCE_CHENJESU (1 << 3)
+#define ALLIANCE_MMRNMHRM (1 << 4)
+#define ALLIANCE_SYREEN (1 << 5)
+ static BYTE AllianceMask = 0;
+
+ if (PLAYER_SAID (R, what_about_alliance))
+ {
+ NPCPhrase (WHICH_ALLIANCE);
+ AllianceMask = 0;
+ }
+ else if (PLAYER_SAID (R, shofixti))
+ {
+ NPCPhrase (ABOUT_SHOFIXTI);
+ AllianceMask |= ALLIANCE_SHOFIXTI;
+ }
+ else if (PLAYER_SAID (R, yehat))
+ {
+ NPCPhrase (ABOUT_YEHAT);
+ AllianceMask |= ALLIANCE_YEHAT;
+ }
+ else if (PLAYER_SAID (R, arilou))
+ {
+ NPCPhrase (ABOUT_ARILOU);
+ AllianceMask |= ALLIANCE_ARILOU;
+ }
+ else if (PLAYER_SAID (R, chenjesu))
+ {
+ NPCPhrase (ABOUT_CHENJESU);
+ AllianceMask |= ALLIANCE_CHENJESU;
+ }
+ else if (PLAYER_SAID (R, mmrnmhrm))
+ {
+ NPCPhrase (ABOUT_MMRNMHRM);
+ AllianceMask |= ALLIANCE_MMRNMHRM;
+ }
+ else if (PLAYER_SAID (R, syreen))
+ {
+ NPCPhrase (ABOUT_SYREEN);
+ AllianceMask |= ALLIANCE_SYREEN;
+ }
+
+ if (!(AllianceMask & ALLIANCE_SHOFIXTI))
+ Response (shofixti, AllianceInfo);
+ if (!(AllianceMask & ALLIANCE_YEHAT))
+ Response (yehat, AllianceInfo);
+ if (!(AllianceMask & ALLIANCE_ARILOU))
+ Response (arilou, AllianceInfo);
+ if (!(AllianceMask & ALLIANCE_CHENJESU))
+ Response (chenjesu, AllianceInfo);
+ if (!(AllianceMask & ALLIANCE_MMRNMHRM))
+ Response (mmrnmhrm, AllianceInfo);
+ if (!(AllianceMask & ALLIANCE_SYREEN))
+ Response (syreen, AllianceInfo);
+ Response (enough_alliance, AlienRaces);
+}
+
+static void
+HierarchyInfo (RESPONSE_REF R)
+{
+#define HIERARCHY_MYCON (1 << 0)
+#define HIERARCHY_SPATHI (1 << 1)
+#define HIERARCHY_UMGAH (1 << 2)
+#define HIERARCHY_ANDROSYNTH (1 << 3)
+#define HIERARCHY_ILWRATH (1 << 4)
+#define HIERARCHY_VUX (1 << 5)
+#define HIERARCHY_URQUAN (1 << 6)
+ static BYTE HierarchyMask = 0;
+
+ if (PLAYER_SAID (R, what_about_hierarchy))
+ {
+ NPCPhrase (WHICH_HIERARCHY);
+ HierarchyMask = 0;
+ }
+ else if (PLAYER_SAID (R, urquan))
+ {
+ NPCPhrase (ABOUT_URQUAN);
+ HierarchyMask |= HIERARCHY_URQUAN;
+ }
+ else if (PLAYER_SAID (R, mycon))
+ {
+ NPCPhrase (ABOUT_MYCON);
+ HierarchyMask |= HIERARCHY_MYCON;
+ }
+ else if (PLAYER_SAID (R, spathi))
+ {
+ NPCPhrase (ABOUT_SPATHI);
+ HierarchyMask |= HIERARCHY_SPATHI;
+ }
+ else if (PLAYER_SAID (R, umgah))
+ {
+ NPCPhrase (ABOUT_UMGAH);
+ HierarchyMask |= HIERARCHY_UMGAH;
+ }
+ else if (PLAYER_SAID (R, androsynth))
+ {
+ NPCPhrase (ABOUT_ANDROSYNTH);
+ HierarchyMask |= HIERARCHY_ANDROSYNTH;
+ }
+ else if (PLAYER_SAID (R, ilwrath))
+ {
+ NPCPhrase (ABOUT_ILWRATH);
+ HierarchyMask |= HIERARCHY_ILWRATH;
+ }
+ else if (PLAYER_SAID (R, vux))
+ {
+ NPCPhrase (ABOUT_VUX);
+ HierarchyMask |= HIERARCHY_VUX;
+ }
+
+ if (!(HierarchyMask & HIERARCHY_URQUAN))
+ Response (urquan, HierarchyInfo);
+ if (!(HierarchyMask & HIERARCHY_MYCON))
+ Response (mycon, HierarchyInfo);
+ if (!(HierarchyMask & HIERARCHY_SPATHI))
+ Response (spathi, HierarchyInfo);
+ if (!(HierarchyMask & HIERARCHY_UMGAH))
+ Response (umgah, HierarchyInfo);
+ if (!(HierarchyMask & HIERARCHY_ANDROSYNTH))
+ Response (androsynth, HierarchyInfo);
+ if (!(HierarchyMask & HIERARCHY_ILWRATH))
+ Response (ilwrath, HierarchyInfo);
+ if (!(HierarchyMask & HIERARCHY_VUX))
+ Response (vux, HierarchyInfo);
+ Response (enough_hierarchy, AlienRaces);
+}
+
+static void
+AlienRaces (RESPONSE_REF R)
+{
+#define RACES_ALLIANCE (1 << 0)
+#define RACES_HIERARCHY (1 << 1)
+#define RACES_OTHER (1 << 2)
+ static BYTE RacesMask = 0;
+
+ if (PLAYER_SAID (R, alien_races))
+ {
+ NPCPhrase (WHICH_ALIEN);
+ RacesMask = 0;
+ }
+ else if (PLAYER_SAID (R, enough_alliance))
+ {
+ NPCPhrase (OK_ENOUGH_ALLIANCE);
+ RacesMask |= RACES_ALLIANCE;
+ }
+ else if (PLAYER_SAID (R, enough_hierarchy))
+ {
+ NPCPhrase (OK_ENOUGH_HIERARCHY);
+ RacesMask |= RACES_HIERARCHY;
+ }
+ else if (PLAYER_SAID (R, what_about_other))
+ {
+ NPCPhrase (ABOUT_OTHER);
+ RacesMask |= RACES_OTHER;
+ }
+
+ if (!(RacesMask & RACES_ALLIANCE))
+ {
+ Response (what_about_alliance, AllianceInfo);
+ }
+ if (!(RacesMask & RACES_HIERARCHY))
+ {
+ Response (what_about_hierarchy, HierarchyInfo);
+ }
+ if (!(RacesMask & RACES_OTHER))
+ {
+ Response (what_about_other, AlienRaces);
+ }
+ Response (enough_aliens, TellHistory);
+}
+
+static void
+WarInfo (RESPONSE_REF R)
+{
+#define WAR_STARTED (1 << 0)
+#define WAR_WAS_LIKE (1 << 1)
+#define WAR_LOST (1 << 2)
+#define WAR_AFTERMATH (1 << 3)
+ static BYTE WarMask = 0;
+
+ if (PLAYER_SAID (R, the_war))
+ {
+ NPCPhrase (WHICH_WAR);
+ WarMask = 0;
+ }
+ else if (PLAYER_SAID (R, what_started_war))
+ {
+ NPCPhrase (URQUAN_STARTED_WAR);
+ WarMask |= WAR_STARTED;
+ }
+ else if (PLAYER_SAID (R, what_was_war_like))
+ {
+ NPCPhrase (WAR_WAS_LIKE_SO);
+ WarMask |= WAR_WAS_LIKE;
+ }
+ else if (PLAYER_SAID (R, why_lose_war))
+ {
+ NPCPhrase (LOST_WAR_BECAUSE);
+ WarMask |= WAR_LOST;
+ }
+ else if (PLAYER_SAID (R, what_after_war))
+ {
+ NPCPhrase (AFTER_WAR);
+ WarMask |= WAR_AFTERMATH;
+ }
+
+ if (!(WarMask & WAR_STARTED))
+ Response (what_started_war, WarInfo);
+ if (!(WarMask & WAR_WAS_LIKE))
+ Response (what_was_war_like, WarInfo);
+ if (!(WarMask & WAR_LOST))
+ Response (why_lose_war, WarInfo);
+ if (!(WarMask & WAR_AFTERMATH))
+ Response (what_after_war, WarInfo);
+ Response (enough_war, TellHistory);
+}
+
+static void
+AncientHistory (RESPONSE_REF R)
+{
+#define ANCIENT_PRECURSORS (1 << 0)
+#define ANCIENT_RACES (1 << 1)
+#define ANCIENT_EARTH (1 << 2)
+ static BYTE AncientMask = 0;
+
+ if (PLAYER_SAID (R, ancient_history))
+ {
+ NPCPhrase (WHICH_ANCIENT);
+ AncientMask = 0;
+ }
+ else if (PLAYER_SAID (R, precursors))
+ {
+ NPCPhrase (ABOUT_PRECURSORS);
+ AncientMask |= ANCIENT_PRECURSORS;
+ }
+ else if (PLAYER_SAID (R, old_races))
+ {
+ NPCPhrase (ABOUT_OLD_RACES);
+ AncientMask |= ANCIENT_RACES;
+ }
+ else if (PLAYER_SAID (R, aliens_on_earth))
+ {
+ NPCPhrase (ABOUT_ALIENS_ON_EARTH);
+ AncientMask |= ANCIENT_EARTH;
+ }
+
+ if (!(AncientMask & ANCIENT_PRECURSORS))
+ Response (precursors, AncientHistory);
+ if (!(AncientMask & ANCIENT_RACES))
+ Response (old_races, AncientHistory);
+ if (!(AncientMask & ANCIENT_EARTH))
+ Response (aliens_on_earth, AncientHistory);
+ Response (enough_ancient, TellHistory);
+}
+
+static void
+TellHistory (RESPONSE_REF R)
+{
+ RESPONSE_REF pstack[3];
+
+ if (PLAYER_SAID (R, history))
+ {
+ NPCPhrase (WHICH_HISTORY);
+ stack0 = 0;
+ stack1 = 0;
+ stack2 = 0;
+ }
+ else if (PLAYER_SAID (R, enough_aliens))
+ {
+ NPCPhrase (OK_ENOUGH_ALIENS);
+
+ stack0 = 1;
+ }
+ else if (PLAYER_SAID (R, enough_war))
+ {
+ NPCPhrase (OK_ENOUGH_WAR);
+
+ stack1 = 1;
+ }
+ else if (PLAYER_SAID (R, enough_ancient))
+ {
+ NPCPhrase (OK_ENOUGH_ANCIENT);
+
+ stack2 = 1;
+ }
+
+ switch (stack0)
+ {
+ case 0:
+ pstack[0] = alien_races;
+ break;
+ default:
+ pstack[0] = 0;
+ break;
+ }
+ switch (stack1)
+ {
+ case 0:
+ pstack[1] = the_war;
+ break;
+ default:
+ pstack[1] = 0;
+ break;
+ }
+ switch (stack2)
+ {
+ case 0:
+ pstack[2] = ancient_history;
+ break;
+ default:
+ pstack[2] = 0;
+ break;
+ }
+
+ if (pstack[0])
+ {
+ Response (pstack[0], AlienRaces);
+ }
+ if (pstack[1])
+ {
+ Response (pstack[1], WarInfo);
+ }
+ if (pstack[2])
+ {
+ Response (pstack[2], AncientHistory);
+ }
+ Response (enough_history, NeedInfo);
+}
+
+static void
+DefeatUrquan (RESPONSE_REF R)
+{
+#define HOW_FIND_URQUAN (1 << 0)
+#define HOW_FIGHT_URQUAN (1 << 1)
+#define HOW_ALLY_AGAINST_URQUAN (1 << 2)
+#define HOW_STRONG_AGAINST_URQUAN (1 << 3)
+ static BYTE DefeatMask = 0;
+
+ if (PLAYER_SAID (R, how_defeat))
+ {
+ NPCPhrase (DEFEAT_LIKE_SO);
+ DefeatMask = 0;
+ }
+ else if (PLAYER_SAID (R, how_find_urquan))
+ {
+ NPCPhrase (FIND_URQUAN);
+ DefeatMask |= HOW_FIND_URQUAN;
+ }
+ else if (PLAYER_SAID (R, how_fight_urquan))
+ {
+ NPCPhrase (FIGHT_URQUAN);
+ DefeatMask |= HOW_FIGHT_URQUAN;
+ }
+ else if (PLAYER_SAID (R, how_ally))
+ {
+ NPCPhrase (ALLY_LIKE_SO);
+ DefeatMask |= HOW_ALLY_AGAINST_URQUAN;
+ }
+ else if (PLAYER_SAID (R, how_get_strong))
+ {
+ NPCPhrase (STRONG_LIKE_SO);
+ DefeatMask |= HOW_STRONG_AGAINST_URQUAN;
+ }
+
+ if (!(DefeatMask & HOW_FIND_URQUAN))
+ Response (how_find_urquan, DefeatUrquan);
+ if (!(DefeatMask & HOW_FIGHT_URQUAN))
+ Response (how_fight_urquan, DefeatUrquan);
+ if (!(DefeatMask & HOW_ALLY_AGAINST_URQUAN))
+ Response (how_ally, DefeatUrquan);
+ if (!(DefeatMask & HOW_STRONG_AGAINST_URQUAN))
+ Response (how_get_strong, DefeatUrquan);
+ Response (enough_defeat, TellMission);
+}
+
+static void
+AnalyzeCondition (void)
+{
+ BYTE i;
+ BYTE num_thrusters = 0,
+ num_jets = 0,
+ num_guns = 0,
+ num_bays = 0,
+ num_batts = 0,
+ num_track = 0,
+ num_defense = 0;
+ BOOLEAN HasMinimum;
+
+ for (i = 0; i < NUM_DRIVE_SLOTS; ++i)
+ {
+ if (GLOBAL_SIS (DriveSlots[i]) < EMPTY_SLOT)
+ ++num_thrusters;
+ }
+ for (i = 0; i < NUM_JET_SLOTS; ++i)
+ {
+ if (GLOBAL_SIS (JetSlots[i]) < EMPTY_SLOT)
+ ++num_jets;
+ }
+ for (i = 0; i < NUM_MODULE_SLOTS; ++i)
+ {
+ BYTE which_piece;
+
+ switch (which_piece = GLOBAL_SIS (ModuleSlots[i]))
+ {
+ case STORAGE_BAY:
+ ++num_bays;
+ break;
+ case DYNAMO_UNIT:
+ case SHIVA_FURNACE:
+ num_batts += 1 + (which_piece - DYNAMO_UNIT);
+ break;
+ case GUN_WEAPON:
+ case BLASTER_WEAPON:
+ case CANNON_WEAPON:
+ num_guns += 1 + (which_piece - GUN_WEAPON);
+ break;
+ case TRACKING_SYSTEM:
+ ++num_track;
+ break;
+ case ANTIMISSILE_DEFENSE:
+ ++num_defense;
+ break;
+ }
+ }
+ if (num_track && num_guns)
+ num_guns += 2;
+
+ HasMinimum = (num_thrusters >= 7 && num_jets >= 5
+ && GLOBAL_SIS (CrewEnlisted) >= CREW_POD_CAPACITY
+ && GLOBAL_SIS (FuelOnBoard) >= FUEL_TANK_CAPACITY
+ && num_bays >= 1 && GLOBAL_SIS (NumLanders)
+ && num_batts >= 1 && num_guns >= 2);
+ NPCPhrase (LETS_SEE);
+ if (!HasMinimum && GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
+ {
+ NPCPhrase (IMPROVE_1);
+ if (num_thrusters < 7)
+ NPCPhrase (NEED_THRUSTERS_1);
+ if (num_jets < 5)
+ NPCPhrase (NEED_TURN_1);
+ if (num_guns < 2)
+ NPCPhrase (NEED_GUNS_1);
+ if (GLOBAL_SIS (CrewEnlisted) < CREW_POD_CAPACITY)
+ NPCPhrase (NEED_CREW_1);
+ if (GLOBAL_SIS (FuelOnBoard) < FUEL_TANK_CAPACITY)
+ NPCPhrase (NEED_FUEL_1);
+ if (num_bays < 1)
+ NPCPhrase (NEED_STORAGE_1);
+ if (GLOBAL_SIS (NumLanders) == 0)
+ NPCPhrase (NEED_LANDERS_2);
+ if (num_batts < 1)
+ NPCPhrase (NEED_DYNAMOS_1);
+
+ if (GLOBAL_SIS (ResUnits) >= 3000)
+ NPCPhrase (IMPROVE_FLAGSHIP_WITH_RU);
+ else
+ NPCPhrase (GO_GET_MINERALS);
+ }
+ else
+ {
+ BYTE num_aliens = 0;
+ COUNT FleetStrength;
+ BOOLEAN HasMaximum;
+
+ FleetStrength = CalculateEscortsWorth ();
+ for (i = 0; i < NUM_AVAILABLE_RACES; ++i)
+ {
+ if (i != HUMAN_SHIP && CheckAlliance (i) == GOOD_GUY)
+ ++num_aliens;
+ }
+
+ HasMaximum = (num_thrusters == NUM_DRIVE_SLOTS
+ && num_jets == NUM_JET_SLOTS
+ && GLOBAL_SIS (CrewEnlisted) >= CREW_POD_CAPACITY * 3
+ && GLOBAL_SIS (FuelOnBoard) >= FUEL_TANK_CAPACITY * 3
+ && GLOBAL_SIS (NumLanders) >= 3
+ && num_batts >= 4 && num_guns >= 7 && num_defense >= 2);
+ if (!HasMaximum && GET_GAME_STATE (CHMMR_BOMB_STATE) < 2)
+ NPCPhrase (GOT_OK_FLAGSHIP);
+ else
+ NPCPhrase (GOT_AWESOME_FLAGSHIP);
+
+ if (GET_GAME_STATE (CHMMR_BOMB_STATE) >= 2)
+ {
+ NPCPhrase (CHMMR_IMPROVED_BOMB);
+ if (FleetStrength < 20000)
+ NPCPhrase (MUST_ACQUIRE_AWESOME_FLEET);
+ else
+ {
+ NPCPhrase (GOT_AWESOME_FLEET);
+ if (!GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ NPCPhrase (MUST_ELIMINATE_URQUAN_GUARDS);
+ else
+ NPCPhrase (GO_DESTROY_SAMATRA);
+ }
+ }
+ else if (num_aliens < 2)
+ NPCPhrase (GO_ALLY_WITH_ALIENS);
+ else
+ {
+ NPCPhrase (MADE_SOME_ALLIES);
+ if (FleetStrength < 6000)
+ {
+ if (GLOBAL_SIS (ResUnits) >= 3000)
+ NPCPhrase (BUY_COMBAT_SHIPS);
+ else
+ NPCPhrase (GET_SHIPS_BY_MINING_OR_ALLIANCE);
+ }
+ else
+ {
+ NPCPhrase (GOT_OK_FLEET);
+ if (!HasMaximum)
+ {
+ NPCPhrase (IMPROVE_2);
+ if (num_thrusters < NUM_DRIVE_SLOTS)
+ NPCPhrase (NEED_THRUSTERS_2);
+ if (num_jets < NUM_JET_SLOTS)
+ NPCPhrase (NEED_TURN_2);
+ if (num_guns < 7)
+ NPCPhrase (NEED_GUNS_2);
+ if (GLOBAL_SIS (CrewEnlisted) < CREW_POD_CAPACITY * 3)
+ NPCPhrase (NEED_CREW_2);
+ if (GLOBAL_SIS (FuelOnBoard) < FUEL_TANK_CAPACITY * 3)
+ NPCPhrase (NEED_FUEL_2);
+ if (GLOBAL_SIS (NumLanders) < 3)
+ NPCPhrase (NEED_LANDERS_1);
+ if (num_batts < 4)
+ NPCPhrase (NEED_DYNAMOS_2);
+ if (num_defense < 2)
+ NPCPhrase (NEED_POINT);
+ }
+ else if (!GET_GAME_STATE (AWARE_OF_SAMATRA))
+ NPCPhrase (GO_LEARN_ABOUT_URQUAN);
+ else
+ {
+ NPCPhrase (KNOW_ABOUT_SAMATRA);
+ if (!GET_GAME_STATE (UTWIG_BOMB))
+ NPCPhrase (FIND_WAY_TO_DESTROY_SAMATRA);
+ else if (GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ NPCPhrase (MUST_INCREASE_BOMB_STRENGTH);
+ }
+ }
+ }
+ }
+}
+
+static void
+TellMission (RESPONSE_REF R)
+{
+ RESPONSE_REF pstack[4];
+
+ if (PLAYER_SAID (R, our_mission))
+ {
+ NPCPhrase (WHICH_MISSION);
+ stack0 = 0;
+ stack1 = 0;
+ stack2 = 0;
+ stack3 = 0;
+ }
+ else if (PLAYER_SAID (R, where_get_minerals))
+ {
+ NPCPhrase (GET_MINERALS);
+
+ stack0 = 1;
+ }
+ else if (PLAYER_SAID (R, what_about_aliens))
+ {
+ NPCPhrase (ABOUT_ALIENS);
+
+ stack1 = 1;
+ }
+ else if (PLAYER_SAID (R, what_do_now))
+ {
+ AnalyzeCondition ();
+
+ stack2 = 1;
+ }
+ else if (PLAYER_SAID (R, what_about_urquan))
+ {
+ NPCPhrase (MUST_DEFEAT);
+
+ stack3 = 1;
+ }
+ else if (PLAYER_SAID (R, enough_defeat))
+ {
+ NPCPhrase (OK_ENOUGH_DEFEAT);
+
+ stack3 = 2;
+ }
+
+ switch (stack0)
+ {
+ case 0:
+ pstack[0] = where_get_minerals;
+ break;
+ default:
+ pstack[0] = 0;
+ break;
+ }
+ switch (stack1)
+ {
+ case 0:
+ pstack[1] = what_about_aliens;
+ break;
+ default:
+ pstack[1] = 0;
+ break;
+ }
+ switch (stack2)
+ {
+ case 0:
+ pstack[2] = what_do_now;
+ break;
+ default:
+ pstack[2] = 0;
+ break;
+ }
+ switch (stack3)
+ {
+ case 0:
+ pstack[3] = what_about_urquan;
+ break;
+ case 1:
+ pstack[3] = how_defeat;
+ break;
+ default:
+ pstack[3] = 0;
+ break;
+ }
+
+ if (pstack[0])
+ Response (pstack[0], TellMission);
+ if (pstack[1])
+ Response (pstack[1], TellMission);
+ if (pstack[2])
+ Response (pstack[2], TellMission);
+ if (pstack[3])
+ {
+ if (stack3 == 1)
+ Response (pstack[3], DefeatUrquan);
+ else
+ Response (pstack[3], TellMission);
+ }
+
+ Response (enough_mission, NeedInfo);
+}
+
+static void
+TellStarBase (RESPONSE_REF R)
+{
+ RESPONSE_REF pstack[4];
+ static UNICODE buf0[80];
+
+ if (PLAYER_SAID (R, starbase_functions))
+ {
+ NPCPhrase (WHICH_FUNCTION);
+ stack0 = 0;
+ stack1 = 0;
+ stack2 = 0;
+ stack3 = 0;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_fuel0))
+ {
+ NPCPhrase (ABOUT_FUEL);
+
+ stack1 = 1;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_crew))
+ {
+ NPCPhrase (ABOUT_CREW0);
+ if (usingSpeech)
+ NPCPhrase (YOUR_FLAGSHIP_3DO2);
+ else {
+ NPCPhrase (YOUR_FLAGSHIP_PC);
+ NPCPhrase (GLOBAL_SHIP_NAME);
+ }
+ NPCPhrase (ABOUT_CREW1);
+
+ stack2 = 2;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_modules0))
+ {
+ NPCPhrase (ABOUT_MODULES);
+
+ stack0 = 1;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_ships))
+ {
+ NPCPhrase (ABOUT_SHIPS);
+
+ stack2 = 1;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_ru))
+ {
+ NPCPhrase (ABOUT_RU);
+
+ stack3 = 1;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_minerals))
+ {
+ NPCPhrase (ABOUT_MINERALS);
+
+ stack3 = 2;
+ }
+ else if (PLAYER_SAID (R, tell_me_about_life))
+ {
+ NPCPhrase (ABOUT_LIFE);
+
+ stack3 = 3;
+ }
+
+ switch (stack0)
+ {
+ case 0:
+ construct_response (
+ buf0,
+ tell_me_about_modules0,
+ GLOBAL_SIS (ShipName),
+ tell_me_about_modules1,
+ (UNICODE*)NULL);
+ pstack[0] = tell_me_about_modules0;
+ break;
+ default:
+ pstack[0] = 0;
+ break;
+ }
+ switch (stack1)
+ {
+ case 0:
+ construct_response (
+ shared_phrase_buf,
+ tell_me_about_fuel0,
+ GLOBAL_SIS (ShipName),
+ tell_me_about_fuel1,
+ (UNICODE*)NULL);
+ pstack[1] = tell_me_about_fuel0;
+ break;
+ default:
+ pstack[1] = 0;
+ break;
+ }
+ switch (stack2)
+ {
+ case 0:
+ pstack[2] = tell_me_about_ships;
+ break;
+ case 1:
+ pstack[2] = tell_me_about_crew;
+ break;
+ default:
+ pstack[2] = 0;
+ break;
+ }
+ switch (stack3)
+ {
+ case 0:
+ pstack[3] = tell_me_about_ru;
+ break;
+ case 1:
+ pstack[3] = tell_me_about_minerals;
+ break;
+ case 2:
+ pstack[3] = tell_me_about_life;
+ break;
+ default:
+ pstack[3] = 0;
+ break;
+ }
+
+ if (pstack[0])
+ DoResponsePhrase (pstack[0], TellStarBase, buf0);
+ if (pstack[1])
+ DoResponsePhrase (pstack[1], TellStarBase, shared_phrase_buf);
+ if (pstack[2])
+ Response (pstack[2], TellStarBase);
+ if (pstack[3])
+ Response (pstack[3], TellStarBase);
+
+ Response (enough_starbase, NeedInfo);
+}
+
+static void NormalStarbase (RESPONSE_REF R);
+
+static void
+NeedInfo (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, need_info))
+ NPCPhrase (WHAT_KIND_OF_INFO);
+ else if (PLAYER_SAID (R, enough_starbase))
+ NPCPhrase (OK_ENOUGH_STARBASE);
+ else if (PLAYER_SAID (R, enough_history))
+ NPCPhrase (OK_ENOUGH_HISTORY);
+ else if (PLAYER_SAID (R, enough_mission))
+ NPCPhrase (OK_ENOUGH_MISSION);
+
+ Response (starbase_functions, TellStarBase);
+ Response (history, TellHistory);
+ Response (our_mission, TellMission);
+ Response (no_need_info, NormalStarbase);
+}
+
+static BOOLEAN
+DiscussDevices (BOOLEAN TalkAbout)
+{
+ COUNT i, VuxBeastIndex, PhraseIndex;
+ BOOLEAN Undiscussed;
+
+ if (TalkAbout)
+ NPCPhrase (DEVICE_HEAD);
+ PhraseIndex = 2;
+
+ VuxBeastIndex = 0;
+ Undiscussed = FALSE;
+ for (i = 0; i < NUM_DEVICES; ++i)
+ {
+ RESPONSE_REF pStr;
+
+ pStr = 0;
+ switch (i)
+ {
+ case ROSY_SPHERE_DEVICE:
+ if (GET_GAME_STATE (ROSY_SPHERE_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_ROSY_SPHERE))
+ {
+ pStr = ABOUT_SPHERE;
+ SET_GAME_STATE (DISCUSSED_ROSY_SPHERE, TalkAbout);
+ }
+ break;
+ case ARTIFACT_2_DEVICE:
+ if (GET_GAME_STATE (ARTIFACT_2_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_ARTIFACT_2))
+ {
+ pStr = ABOUT_ARTIFACT_2;
+ SET_GAME_STATE (DISCUSSED_ARTIFACT_2, TalkAbout);
+ }
+ break;
+ case ARTIFACT_3_DEVICE:
+ if (GET_GAME_STATE (ARTIFACT_3_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_ARTIFACT_3))
+ {
+ pStr = ABOUT_ARTIFACT_3;
+ SET_GAME_STATE (DISCUSSED_ARTIFACT_3, TalkAbout);
+ }
+ break;
+ case SUN_EFFICIENCY_DEVICE:
+ if (GET_GAME_STATE (SUN_DEVICE_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_SUN_EFFICIENCY))
+ {
+ pStr = ABOUT_SUN;
+ SET_GAME_STATE (DISCUSSED_SUN_EFFICIENCY, TalkAbout);
+ }
+ break;
+ case UTWIG_BOMB_DEVICE:
+ if (GET_GAME_STATE (UTWIG_BOMB_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_UTWIG_BOMB))
+ {
+ pStr = ABOUT_BOMB;
+ SET_GAME_STATE (DISCUSSED_UTWIG_BOMB, TalkAbout);
+ }
+ break;
+ case ULTRON_0_DEVICE:
+ if (GET_GAME_STATE (ULTRON_CONDITION) == 1
+ && !GET_GAME_STATE (DISCUSSED_ULTRON))
+ {
+ pStr = ABOUT_ULTRON_0;
+ SET_GAME_STATE (DISCUSSED_ULTRON, TalkAbout);
+ }
+ break;
+ case ULTRON_1_DEVICE:
+ if (GET_GAME_STATE (ULTRON_CONDITION) == 2
+ && !GET_GAME_STATE (DISCUSSED_ULTRON))
+ {
+ pStr = ABOUT_ULTRON_1;
+ SET_GAME_STATE (DISCUSSED_ULTRON, TalkAbout);
+ }
+ break;
+ case ULTRON_2_DEVICE:
+ if (GET_GAME_STATE (ULTRON_CONDITION) == 3
+ && !GET_GAME_STATE (DISCUSSED_ULTRON))
+ {
+ pStr = ABOUT_ULTRON_2;
+ SET_GAME_STATE (DISCUSSED_ULTRON, TalkAbout);
+ }
+ break;
+ case ULTRON_3_DEVICE:
+ if (GET_GAME_STATE (ULTRON_CONDITION) == 4
+ && !GET_GAME_STATE (DISCUSSED_ULTRON))
+ {
+ pStr = ABOUT_ULTRON_3;
+ SET_GAME_STATE (DISCUSSED_ULTRON, TalkAbout);
+ }
+ break;
+ case MAIDENS_DEVICE:
+ if (GET_GAME_STATE (MAIDENS_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_MAIDENS))
+ {
+ pStr = ABOUT_MAIDENS;
+ SET_GAME_STATE (DISCUSSED_MAIDENS, TalkAbout);
+ }
+ break;
+ case TALKING_PET_DEVICE:
+ if (GET_GAME_STATE (TALKING_PET_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_TALKING_PET))
+ {
+ pStr = ABOUT_TALKPET;
+ SET_GAME_STATE (DISCUSSED_TALKING_PET, TalkAbout);
+ }
+ break;
+ case AQUA_HELIX_DEVICE:
+ if (GET_GAME_STATE (AQUA_HELIX_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_AQUA_HELIX))
+ {
+ pStr = ABOUT_HELIX;
+ SET_GAME_STATE (DISCUSSED_AQUA_HELIX, TalkAbout);
+ }
+ break;
+ case CLEAR_SPINDLE_DEVICE:
+ if (GET_GAME_STATE (CLEAR_SPINDLE_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_CLEAR_SPINDLE))
+ {
+ pStr = ABOUT_SPINDLE;
+ SET_GAME_STATE (DISCUSSED_CLEAR_SPINDLE, TalkAbout);
+ }
+ break;
+ case UMGAH_HYPERWAVE_DEVICE:
+ if (GET_GAME_STATE (UMGAH_BROADCASTERS_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_UMGAH_HYPERWAVE))
+ {
+ pStr = ABOUT_UCASTER;
+ SET_GAME_STATE (DISCUSSED_UMGAH_HYPERWAVE, TalkAbout);
+ }
+ break;
+#ifdef NEVER
+ case DATA_PLATE_1_DEVICE:
+ if (GET_GAME_STATE (DATA_PLATE_1_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_DATA_PLATE_1))
+ {
+ pStr = ABOUT_DATAPLATE_1;
+ SET_GAME_STATE (DISCUSSED_DATA_PLATE_1, TalkAbout);
+ }
+ break;
+ case DATA_PLATE_2_DEVICE:
+ if (GET_GAME_STATE (DATA_PLATE_2_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_DATA_PLATE_2))
+ {
+ pStr = ABOUT_DATAPLATE_2;
+ SET_GAME_STATE (DISCUSSED_DATA_PLATE_2, TalkAbout);
+ }
+ break;
+ case DATA_PLATE_3_DEVICE:
+ if (GET_GAME_STATE (DATA_PLATE_3_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_DATA_PLATE_3))
+ {
+ pStr = ABOUT_DATAPLATE_3;
+ SET_GAME_STATE (DISCUSSED_DATA_PLATE_3, TalkAbout);
+ }
+ break;
+#endif /* NEVER */
+ case TAALO_PROTECTOR_DEVICE:
+ if (GET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_TAALO_PROTECTOR))
+ {
+ pStr = ABOUT_SHIELD;
+ SET_GAME_STATE (DISCUSSED_TAALO_PROTECTOR, TalkAbout);
+ }
+ break;
+ case EGG_CASING0_DEVICE:
+ if (GET_GAME_STATE (EGG_CASE0_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_EGG_CASING0))
+ {
+ pStr = ABOUT_EGGCASE_0;
+ SET_GAME_STATE (DISCUSSED_EGG_CASING0, TalkAbout);
+ SET_GAME_STATE (DISCUSSED_EGG_CASING1, TalkAbout);
+ SET_GAME_STATE (DISCUSSED_EGG_CASING2, TalkAbout);
+ }
+ break;
+ case EGG_CASING1_DEVICE:
+ if (GET_GAME_STATE (EGG_CASE1_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_EGG_CASING1))
+ {
+ pStr = ABOUT_EGGCASE_0;
+ SET_GAME_STATE (DISCUSSED_EGG_CASING0, TalkAbout);
+ SET_GAME_STATE (DISCUSSED_EGG_CASING1, TalkAbout);
+ SET_GAME_STATE (DISCUSSED_EGG_CASING2, TalkAbout);
+ }
+ break;
+ case EGG_CASING2_DEVICE:
+ if (GET_GAME_STATE (EGG_CASE2_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_EGG_CASING2))
+ {
+ pStr = ABOUT_EGGCASE_0;
+ SET_GAME_STATE (DISCUSSED_EGG_CASING0, TalkAbout);
+ SET_GAME_STATE (DISCUSSED_EGG_CASING1, TalkAbout);
+ SET_GAME_STATE (DISCUSSED_EGG_CASING2, TalkAbout);
+ }
+ break;
+ case SYREEN_SHUTTLE_DEVICE:
+ if (GET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_SYREEN_SHUTTLE))
+ {
+ pStr = ABOUT_SHUTTLE;
+ SET_GAME_STATE (DISCUSSED_SYREEN_SHUTTLE, TalkAbout);
+ }
+ break;
+ case VUX_BEAST_DEVICE:
+ if (GET_GAME_STATE (VUX_BEAST_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_VUX_BEAST))
+ {
+ pStr = ABOUT_VUXBEAST0;
+ SET_GAME_STATE (DISCUSSED_VUX_BEAST, TalkAbout);
+ }
+ break;
+ case DESTRUCT_CODE_DEVICE:
+ if (GET_GAME_STATE (DESTRUCT_CODE_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_DESTRUCT_CODE))
+ {
+ pStr = ABOUT_DESTRUCT;
+ SET_GAME_STATE (DISCUSSED_DESTRUCT_CODE, TalkAbout);
+ }
+ break;
+ case PORTAL_SPAWNER_DEVICE:
+ if (GET_GAME_STATE (PORTAL_SPAWNER_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_PORTAL_SPAWNER))
+ {
+ pStr = ABOUT_PORTAL;
+ SET_GAME_STATE (DISCUSSED_PORTAL_SPAWNER, TalkAbout);
+ }
+ break;
+ case URQUAN_WARP_DEVICE:
+ if (GET_GAME_STATE (PORTAL_KEY_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_URQUAN_WARP))
+ {
+ pStr = ABOUT_WARPPOD;
+ SET_GAME_STATE (DISCUSSED_URQUAN_WARP, TalkAbout);
+ }
+ break;
+ case BURVIX_HYPERWAVE_DEVICE:
+ if (GET_GAME_STATE (BURV_BROADCASTERS_ON_SHIP)
+ && !GET_GAME_STATE (DISCUSSED_BURVIX_HYPERWAVE))
+ {
+ pStr = ABOUT_BCASTER;
+ SET_GAME_STATE (DISCUSSED_BURVIX_HYPERWAVE, TalkAbout);
+ }
+ break;
+ }
+
+ if (pStr)
+ {
+ if (TalkAbout)
+ {
+ if (PhraseIndex > 2)
+ NPCPhrase (BETWEEN_DEVICES);
+ NPCPhrase (pStr);
+ if (pStr == ABOUT_VUXBEAST0)
+ {
+ VuxBeastIndex = ++PhraseIndex;
+ NPCPhrase (ABOUT_VUXBEAST1);
+ }
+ }
+ PhraseIndex += 2;
+ }
+ }
+
+ if (TalkAbout)
+ {
+ NPCPhrase (DEVICE_TAIL);
+
+ if (VuxBeastIndex)
+ {
+ // Run all tracks upto the Vux Beast scientist's report
+ AlienTalkSegue (VuxBeastIndex - 1);
+ // Disable Commander's speech animation and run the report
+ EnableTalkingAnim (FALSE);
+ AlienTalkSegue (VuxBeastIndex);
+ // Enable Commander's speech animation and run the rest
+ EnableTalkingAnim (TRUE);
+ AlienTalkSegue ((COUNT)~0);
+ }
+ }
+
+ return (PhraseIndex > 2);
+}
+
+static BOOLEAN
+CheckTiming (COUNT month_index, COUNT day_index)
+{
+ COUNT mi, year_index;
+ BYTE days_in_month[12] =
+ {
+ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
+ };
+
+ mi = GET_GAME_STATE (STARBASE_MONTH);
+ year_index = START_YEAR;
+
+ day_index += GET_GAME_STATE (STARBASE_DAY);
+ while (day_index > days_in_month[mi - 1])
+ {
+ day_index -= days_in_month[mi - 1];
+ if (++mi > 12)
+ {
+ mi = 1;
+ ++year_index;
+ }
+ }
+
+ month_index += mi;
+ year_index += (month_index - 1) / 12;
+ month_index = ((month_index - 1) % 12) + 1;
+
+ return (year_index < GLOBAL (GameClock.year_index)
+ || (year_index == GLOBAL (GameClock.year_index)
+ && (month_index < GLOBAL (GameClock.month_index)
+ || (month_index == GLOBAL (GameClock.month_index)
+ && day_index < GLOBAL (GameClock.day_index)))));
+}
+
+static void
+CheckBulletins (BOOLEAN Repeat)
+{
+ RESPONSE_REF pIntro;
+ BYTE b0;
+ DWORD BulletinMask;
+
+ if (Repeat)
+ BulletinMask = CurBulletinMask ^ 0xFFFFFFFFL;
+ else
+ BulletinMask = GET_GAME_STATE_32 (STARBASE_BULLETS0);
+
+ pIntro = 0;
+ for (b0 = 0; b0 < 32; ++b0)
+ {
+ if (!(BulletinMask & (1L << b0)))
+ {
+ RESPONSE_REF pStr;
+
+ pStr = 0;
+ switch (b0)
+ {
+ case 0:
+ if (CheckAlliance (SPATHI_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_1;
+ }
+ break;
+ case 1:
+ if (CheckAlliance (ZOQFOTPIK_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_2;
+ }
+ break;
+ case 2:
+ if (CheckAlliance (SUPOX_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_3;
+ }
+ break;
+ case 3:
+ if (CheckAlliance (UTWIG_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_4;
+ }
+ break;
+ case 4:
+ if (CheckAlliance (ORZ_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_5;
+ }
+ break;
+ case 5:
+ if (GET_GAME_STATE (ARILOU_MANNER) == 2)
+ BulletinMask |= 1L << b0;
+ else if (GET_GAME_STATE (PORTAL_SPAWNER)
+ && (Repeat || EscortFeasibilityStudy (
+ ARILOU_SHIP)))
+ {
+#define NUM_GIFT_ARILOUS 3
+ pStr = STARBASE_BULLETIN_6;
+ if (!Repeat)
+ AddEscortShips (ARILOU_SHIP, NUM_GIFT_ARILOUS);
+ }
+ break;
+ case 6:
+ if (GET_GAME_STATE (ZOQFOT_DISTRESS) == 1)
+ {
+ pStr = STARBASE_BULLETIN_7;
+ }
+ break;
+ case 7:
+ if (GET_GAME_STATE (MET_MELNORME))
+ BulletinMask |= 1L << b0;
+ else if (CheckTiming (3, 0))
+ {
+ pStr = STARBASE_BULLETIN_8;
+ }
+ break;
+ case 8:
+ if (GET_GAME_STATE (MET_MELNORME))
+ BulletinMask |= 1L << b0;
+ else if (CheckTiming (6, 0))
+ {
+ pStr = STARBASE_BULLETIN_9;
+ }
+ break;
+ case 9:
+ if (GET_GAME_STATE (FOUND_PLUTO_SPATHI))
+ BulletinMask |= 1L << b0;
+ else if (CheckTiming (0, 7))
+ {
+ pStr = STARBASE_BULLETIN_10;
+ }
+ break;
+ case 10:
+ if (GET_GAME_STATE (SPATHI_SHIELDED_SELVES))
+ {
+ pStr = STARBASE_BULLETIN_11;
+ }
+ break;
+ case 11:
+ if (GET_GAME_STATE (ZOQFOT_HOME_VISITS)
+ || GET_GAME_STATE_32 (ZOQFOT_GRPOFFS0))
+ BulletinMask |= 1L << b0;
+ else if (CheckTiming (0, 42))
+ {
+ pStr = STARBASE_BULLETIN_12;
+ }
+ break;
+ case 12:
+ if (CheckAlliance (CHMMR_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_13;
+ }
+ break;
+ case 13:
+ if (CheckAlliance (SHOFIXTI_SHIP) == GOOD_GUY)
+ {
+ pStr = STARBASE_BULLETIN_14;
+ }
+ break;
+ case 14:
+ if (GET_GAME_STATE (PKUNK_MISSION))
+ {
+ pStr = STARBASE_BULLETIN_15;
+ }
+ break;
+ case 15:
+ if (GET_GAME_STATE (DESTRUCT_CODE_ON_SHIP))
+ BulletinMask |= 1L << b0;
+ else if (CheckTiming (7, 0))
+ {
+ pStr = STARBASE_BULLETIN_16;
+ }
+ break;
+ case 16:
+ break;
+ case 17:
+ if (GET_GAME_STATE (YEHAT_ABSORBED_PKUNK))
+ {
+ pStr = STARBASE_BULLETIN_18;
+ }
+ break;
+ case 18:
+ if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 2)
+ {
+ pStr = STARBASE_BULLETIN_19;
+ }
+ break;
+ case 19:
+ break;
+ case 20:
+ break;
+ case 21:
+ if (GET_GAME_STATE (ZOQFOT_DISTRESS) == 2)
+ {
+ pStr = STARBASE_BULLETIN_22;
+ }
+ break;
+ case 22:
+ break;
+ case 23:
+ break;
+ case 24:
+ break;
+ case 25:
+ break;
+ case 26:
+ {
+ COUNT crew_sold;
+
+ crew_sold = MAKE_WORD (
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE0),
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE1)
+ );
+ if (crew_sold > 100)
+ BulletinMask |= 1L << b0;
+ else if (crew_sold)
+ {
+ pStr = STARBASE_BULLETIN_27;
+ }
+ break;
+ }
+ case 27:
+ {
+ COUNT crew_sold;
+
+ crew_sold = MAKE_WORD (
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE0),
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE1)
+ );
+ if (crew_sold > 250)
+ BulletinMask |= 1L << b0;
+ else if (crew_sold > 100)
+ {
+ pStr = STARBASE_BULLETIN_28;
+ }
+ break;
+ }
+ case 28:
+ {
+ COUNT crew_bought;
+
+ crew_bought = MAKE_WORD (
+ GET_GAME_STATE (CREW_PURCHASED0),
+ GET_GAME_STATE (CREW_PURCHASED1)
+ );
+ if (crew_bought >= CREW_EXPENSE_THRESHOLD)
+ {
+ pStr = STARBASE_BULLETIN_29;
+ }
+ break;
+ }
+ case 29:
+ if (MAKE_WORD (
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE0),
+ GET_GAME_STATE (CREW_SOLD_TO_DRUUGE1)
+ ) > 250)
+ {
+ pStr = STARBASE_BULLETIN_30;
+ }
+ break;
+ case 30:
+ break;
+ case 31:
+ break;
+ }
+
+ if (pStr)
+ {
+ if (pIntro)
+ NPCPhrase (BETWEEN_BULLETINS);
+ else if (Repeat)
+ pIntro = BEFORE_WE_GO_ON_1;
+ else
+ {
+ switch ((BYTE)TFB_Random () % 7)
+ {
+ case 0:
+ pIntro = BEFORE_WE_GO_ON_1;
+ break;
+ case 1:
+ pIntro = BEFORE_WE_GO_ON_2;
+ break;
+ case 2:
+ pIntro = BEFORE_WE_GO_ON_3;
+ break;
+ case 3:
+ pIntro = BEFORE_WE_GO_ON_4;
+ break;
+ case 4:
+ pIntro = BEFORE_WE_GO_ON_5;
+ break;
+ case 5:
+ pIntro = BEFORE_WE_GO_ON_6;
+ break;
+ default:
+ pIntro = BEFORE_WE_GO_ON_7;
+ break;
+ }
+
+ NPCPhrase (pIntro);
+ }
+
+ NPCPhrase (pStr);
+ CurBulletinMask |= 1L << b0;
+ }
+ }
+ }
+
+ if (pIntro == 0 && GET_GAME_STATE (STARBASE_VISITED))
+ NPCPhrase (RETURN_HELLO);
+ else if (!Repeat)
+ SET_GAME_STATE_32 (STARBASE_BULLETS0, BulletinMask);
+}
+
+static void
+NormalStarbase (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, no_need_info))
+ NPCPhrase (OK_NO_NEED_INFO);
+ else if (PLAYER_SAID (R, new_devices))
+ DiscussDevices (TRUE);
+ else if (PLAYER_SAID (R, repeat_bulletins))
+ CheckBulletins (TRUE);
+ else if (R == 0)
+ {
+ if (GET_GAME_STATE (MOONBASE_ON_SHIP))
+ {
+ NPCPhrase (STARBASE_IS_READY_A);
+ if (usingSpeech)
+ NPCPhrase (YOUR_FLAGSHIP_3DO1);
+ else {
+ NPCPhrase (YOUR_FLAGSHIP_PC);
+ NPCPhrase (GLOBAL_SHIP_NAME);
+ }
+ NPCPhrase (STARBASE_IS_READY_B);
+ if (usingSpeech)
+ NPCPhrase (YOUR_FLAGSHIP_3DO0);
+ else
+ NPCPhrase (GLOBAL_SHIP_NAME);
+ NPCPhrase (STARBASE_IS_READY_C);
+ DeltaSISGauges (0, 0, 2500);
+ SET_GAME_STATE (STARBASE_MONTH,
+ GLOBAL (GameClock.month_index));
+ SET_GAME_STATE (STARBASE_DAY,
+ GLOBAL (GameClock.day_index));
+ }
+ else if (GET_GAME_STATE (STARBASE_VISITED))
+ {
+ CheckBulletins (FALSE);
+ }
+ else
+ {
+ RESPONSE_REF pStr0 = 0;
+ RESPONSE_REF pStr1 = 0;
+
+ switch ((BYTE)TFB_Random () & 7)
+ {
+ case 0:
+ pStr0 = NORMAL_HELLO_A0;
+ pStr1 = NORMAL_HELLO_A1;
+ break;
+ case 1:
+ pStr0 = NORMAL_HELLO_B0;
+ pStr1 = NORMAL_HELLO_B1;
+ break;
+ case 2:
+ pStr0 = NORMAL_HELLO_C0;
+ pStr1 = NORMAL_HELLO_C1;
+ break;
+ case 3:
+ pStr0 = NORMAL_HELLO_D0;
+ pStr1 = NORMAL_HELLO_D1;
+ break;
+ case 4:
+ pStr0 = NORMAL_HELLO_E0;
+ pStr1 = NORMAL_HELLO_E1;
+ break;
+ case 5:
+ pStr0 = NORMAL_HELLO_F0;
+ pStr1 = NORMAL_HELLO_F1;
+ break;
+ case 6:
+ pStr0 = NORMAL_HELLO_G0;
+ pStr1 = NORMAL_HELLO_G1;
+ break;
+ case 7:
+ pStr0 = NORMAL_HELLO_H0;
+ pStr1 = NORMAL_HELLO_H1;
+ break;
+ }
+ NPCPhrase (pStr0);
+ if (!usingSpeech)
+ {
+ NPCPhrase (SPACE);
+ NPCPhrase (GLOBAL_PLAYER_NAME);
+ }
+ NPCPhrase (pStr1);
+ CheckBulletins (FALSE);
+ }
+
+ SET_GAME_STATE (STARBASE_VISITED, 1);
+ }
+
+ if (GLOBAL_SIS (TotalElementMass))
+ Response (have_minerals, SellMinerals);
+ if (DiscussDevices (FALSE))
+ Response (new_devices, NormalStarbase);
+ if (CurBulletinMask)
+ Response (repeat_bulletins, NormalStarbase);
+ Response (need_info, NeedInfo);
+ Response (goodbye_commander, ByeBye);
+}
+
+static void
+SellMinerals (RESPONSE_REF R)
+{
+ COUNT i, total;
+ BOOLEAN Sleepy;
+ RESPONSE_REF pStr1 = 0;
+ RESPONSE_REF pStr2 = 0;
+
+ total = 0;
+ Sleepy = TRUE;
+ for (i = 0; i < NUM_ELEMENT_CATEGORIES; ++i)
+ {
+ COUNT amount;
+ DWORD TimeIn = 0;
+
+ if (i == 0)
+ {
+ DrawCargoStrings ((BYTE)~0, (BYTE)~0);
+ SleepThread (ONE_SECOND / 2);
+ TimeIn = GetTimeCounter ();
+ DrawCargoStrings ((BYTE)0, (BYTE)0);
+ }
+ else if (Sleepy)
+ {
+ DrawCargoStrings ((BYTE)(i - 1), (BYTE)i);
+ TimeIn = GetTimeCounter ();
+ }
+
+ if ((amount = GLOBAL_SIS (ElementAmounts[i])) != 0)
+ {
+ total += amount * GLOBAL (ElementWorth[i]);
+ do
+ {
+ if (!Sleepy || AnyButtonPress (TRUE) ||
+ (GLOBAL (CurrentActivity) & CHECK_ABORT))
+ {
+ Sleepy = FALSE;
+ GLOBAL_SIS (ElementAmounts[i]) = 0;
+ GLOBAL_SIS (TotalElementMass) -= amount;
+ DeltaSISGauges (0, 0, amount * GLOBAL (ElementWorth[i]));
+ break;
+ }
+
+ --GLOBAL_SIS (ElementAmounts[i]);
+ --GLOBAL_SIS (TotalElementMass);
+ TaskSwitch ();
+ TimeIn = GetTimeCounter ();
+ DrawCargoStrings ((BYTE)i, (BYTE)i);
+ ShowRemainingCapacity ();
+ DeltaSISGauges (0, 0, GLOBAL (ElementWorth[i]));
+ } while (--amount);
+ }
+ if (Sleepy) {
+ SleepThreadUntil (TimeIn + (ONE_SECOND / 4));
+ TimeIn = GetTimeCounter ();
+ }
+ }
+ SleepThread (ONE_SECOND / 2);
+
+ ClearSISRect (DRAW_SIS_DISPLAY);
+// DrawStorageBays (FALSE);
+
+ if (total < 1000)
+ {
+ total = GET_GAME_STATE (LIGHT_MINERAL_LOAD);
+ switch (total++)
+ {
+ case 0:
+ pStr1 = LIGHT_LOAD_A0;
+ pStr2 = LIGHT_LOAD_A1;
+ break;
+ case 1:
+ pStr1 = LIGHT_LOAD_B0;
+ pStr2 = LIGHT_LOAD_B1;
+ break;
+ case 2:
+ pStr1 = LIGHT_LOAD_C0;
+ pStr2 = LIGHT_LOAD_C1;
+ break;
+ case 3:
+ pStr1 = LIGHT_LOAD_D0;
+ pStr2 = LIGHT_LOAD_D1;
+ break;
+ case 4:
+ pStr1 = LIGHT_LOAD_E0;
+ pStr2 = LIGHT_LOAD_E1;
+ break;
+ case 5:
+ pStr1 = LIGHT_LOAD_F0;
+ pStr2 = LIGHT_LOAD_F1;
+ break;
+ case 6:
+ --total;
+ pStr1 = LIGHT_LOAD_G0;
+ pStr2 = LIGHT_LOAD_G1;
+ break;
+ }
+ SET_GAME_STATE (LIGHT_MINERAL_LOAD, total);
+ }
+ else if (total < 2500)
+ {
+ total = GET_GAME_STATE (MEDIUM_MINERAL_LOAD);
+ switch (total++)
+ {
+ case 0:
+ pStr1 = MEDIUM_LOAD_A0;
+ pStr2 = MEDIUM_LOAD_A1;
+ break;
+ case 1:
+ pStr1 = MEDIUM_LOAD_B0;
+ pStr2 = MEDIUM_LOAD_B1;
+ break;
+ case 2:
+ pStr1 = MEDIUM_LOAD_C0;
+ pStr2 = MEDIUM_LOAD_C1;
+ break;
+ case 3:
+ pStr1 = MEDIUM_LOAD_D0;
+ pStr2 = MEDIUM_LOAD_D1;
+ break;
+ case 4:
+ pStr1 = MEDIUM_LOAD_E0;
+ pStr2 = MEDIUM_LOAD_E1;
+ break;
+ case 5:
+ pStr1 = MEDIUM_LOAD_F0;
+ pStr2 = MEDIUM_LOAD_F1;
+ break;
+ case 6:
+ --total;
+ pStr1 = MEDIUM_LOAD_G0;
+ pStr2 = MEDIUM_LOAD_G1;
+ break;
+ }
+ SET_GAME_STATE (MEDIUM_MINERAL_LOAD, total);
+ }
+ else
+ {
+ total = GET_GAME_STATE (HEAVY_MINERAL_LOAD);
+ switch (total++)
+ {
+ case 0:
+ pStr1 = HEAVY_LOAD_A0;
+ pStr2 = HEAVY_LOAD_A1;
+ break;
+ case 1:
+ pStr1 = HEAVY_LOAD_B0;
+ pStr2 = HEAVY_LOAD_B1;
+ break;
+ case 2:
+ pStr1 = HEAVY_LOAD_C0;
+ pStr2 = HEAVY_LOAD_C1;
+ break;
+ case 3:
+ pStr1 = HEAVY_LOAD_D0;
+ pStr2 = HEAVY_LOAD_D1;
+ break;
+ case 4:
+ pStr1 = HEAVY_LOAD_E0;
+ pStr2 = HEAVY_LOAD_E1;
+ break;
+ case 5:
+ pStr1 = HEAVY_LOAD_F0;
+ pStr2 = HEAVY_LOAD_F1;
+ break;
+ case 6:
+ --total;
+ pStr1 = HEAVY_LOAD_G0;
+ pStr2 = HEAVY_LOAD_G1;
+ break;
+ }
+ SET_GAME_STATE (HEAVY_MINERAL_LOAD, total);
+ }
+
+ NPCPhrase (pStr1);
+ if (!usingSpeech)
+ {
+ NPCPhrase (SPACE);
+ NPCPhrase (GLOBAL_PLAYER_NAME);
+ }
+ NPCPhrase (pStr2);
+
+ NormalStarbase (R);
+}
+
+static void
+Intro (void)
+{
+ NormalStarbase (0);
+}
+
+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);
+ }
+}
+
+LOCDATA*
+init_starbase_comm ()
+{
+ LOCDATA *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;
+ commander_desc.AlienTextBaseline.x = 164;
+ commander_desc.AlienTextBaseline.y = 20;
+
+ // use alternate Starbase track if available
+ commander_desc.AlienAltSongRes = STARBASE_ALT_MUSIC;
+ commander_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
+
+ CurBulletinMask = 0;
+ setSegue (Segue_peace);
+ retval = &commander_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/starbas/strings.h b/src/uqm/comm/starbas/strings.h
new file mode 100644
index 0000000..df123f3
--- /dev/null
+++ b/src/uqm/comm/starbas/strings.h
@@ -0,0 +1,327 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef STARBAS_STRINGS_H
+#define STARBAS_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ BEFORE_WE_GO_ON_1,
+ BEFORE_WE_GO_ON_2,
+ BEFORE_WE_GO_ON_3,
+ BEFORE_WE_GO_ON_4,
+ BEFORE_WE_GO_ON_5,
+ BEFORE_WE_GO_ON_6,
+ BEFORE_WE_GO_ON_7,
+ NORMAL_HELLO_A0,
+ NORMAL_HELLO_A1,
+ NORMAL_HELLO_B0,
+ NORMAL_HELLO_B1,
+ NORMAL_HELLO_C0,
+ NORMAL_HELLO_C1,
+ NORMAL_HELLO_D0,
+ NORMAL_HELLO_D1,
+ NORMAL_HELLO_E0,
+ NORMAL_HELLO_E1,
+ NORMAL_HELLO_F0,
+ NORMAL_HELLO_F1,
+ NORMAL_HELLO_G0,
+ NORMAL_HELLO_G1,
+ NORMAL_HELLO_H0,
+ NORMAL_HELLO_H1,
+ RETURN_HELLO,
+ NORMAL_HELLO_TAIL,
+ NORMAL_GOODBYE_A0,
+ NORMAL_GOODBYE_A1,
+ NORMAL_GOODBYE_B0,
+ NORMAL_GOODBYE_B1,
+ NORMAL_GOODBYE_C0,
+ NORMAL_GOODBYE_C1,
+ NORMAL_GOODBYE_D0,
+ NORMAL_GOODBYE_D1,
+ NORMAL_GOODBYE_E0,
+ NORMAL_GOODBYE_E1,
+ NORMAL_GOODBYE_F0,
+ NORMAL_GOODBYE_F1,
+ NORMAL_GOODBYE_G0,
+ NORMAL_GOODBYE_G1,
+ NORMAL_GOODBYE_H0,
+ NORMAL_GOODBYE_H1,
+ LIGHT_LOAD_A0,
+ LIGHT_LOAD_A1,
+ LIGHT_LOAD_B0,
+ LIGHT_LOAD_B1,
+ LIGHT_LOAD_C0,
+ LIGHT_LOAD_C1,
+ LIGHT_LOAD_D0,
+ LIGHT_LOAD_D1,
+ LIGHT_LOAD_E0,
+ LIGHT_LOAD_E1,
+ LIGHT_LOAD_F0,
+ LIGHT_LOAD_F1,
+ LIGHT_LOAD_G0,
+ LIGHT_LOAD_G1,
+ MEDIUM_LOAD_A0,
+ MEDIUM_LOAD_A1,
+ MEDIUM_LOAD_B0,
+ MEDIUM_LOAD_B1,
+ MEDIUM_LOAD_C0,
+ MEDIUM_LOAD_C1,
+ MEDIUM_LOAD_D0,
+ MEDIUM_LOAD_D1,
+ MEDIUM_LOAD_E0,
+ MEDIUM_LOAD_E1,
+ MEDIUM_LOAD_F0,
+ MEDIUM_LOAD_F1,
+ MEDIUM_LOAD_G0,
+ MEDIUM_LOAD_G1,
+ HEAVY_LOAD_A0,
+ HEAVY_LOAD_A1,
+ HEAVY_LOAD_B0,
+ HEAVY_LOAD_B1,
+ HEAVY_LOAD_C0,
+ HEAVY_LOAD_C1,
+ HEAVY_LOAD_D0,
+ HEAVY_LOAD_D1,
+ HEAVY_LOAD_E0,
+ HEAVY_LOAD_E1,
+ HEAVY_LOAD_F0,
+ HEAVY_LOAD_F1,
+ HEAVY_LOAD_G0 ,
+ HEAVY_LOAD_G1,
+ STARBASE_IS_READY_A,
+ STARBASE_IS_READY_B,
+ STARBASE_IS_READY_C,
+ WHAT_KIND_OF_INFO,
+ WHICH_FUNCTION,
+ WHICH_HISTORY,
+ WHICH_MISSION,
+ OK_NO_NEED_INFO,
+ ABOUT_FUEL,
+ ABOUT_MODULES,
+ ABOUT_CREW0,
+ ABOUT_CREW1,
+ ABOUT_SHIPS,
+ ABOUT_RU,
+ ABOUT_MINERALS,
+ ABOUT_LIFE,
+ OK_ENOUGH_STARBASE,
+ OK_ENOUGH_MISSION,
+ GET_MINERALS,
+ ABOUT_ALIENS,
+ MUST_DEFEAT,
+ DEFEAT_LIKE_SO,
+ FIND_URQUAN,
+ FIGHT_URQUAN,
+ ALLY_LIKE_SO,
+ STRONG_LIKE_SO,
+ OK_ENOUGH_DEFEAT,
+ WHICH_ALIEN,
+ WHICH_WAR,
+ WHICH_ANCIENT,
+ OK_ENOUGH_HISTORY,
+ WHICH_ALLIANCE,
+ WHICH_HIERARCHY,
+ ABOUT_OTHER,
+ OK_ENOUGH_ALIENS,
+ ABOUT_SHOFIXTI,
+ ABOUT_YEHAT,
+ ABOUT_ARILOU,
+ ABOUT_CHENJESU,
+ ABOUT_MMRNMHRM,
+ ABOUT_SYREEN,
+ OK_ENOUGH_ALLIANCE,
+ ABOUT_URQUAN,
+ ABOUT_MYCON,
+ ABOUT_SPATHI,
+ ABOUT_UMGAH,
+ ABOUT_ANDROSYNTH,
+ ABOUT_VUX,
+ ABOUT_ILWRATH,
+ OK_ENOUGH_HIERARCHY,
+ ABOUT_PRECURSORS,
+ ABOUT_OLD_RACES,
+ ABOUT_ALIENS_ON_EARTH,
+ OK_ENOUGH_ANCIENT,
+ URQUAN_STARTED_WAR,
+ WAR_WAS_LIKE_SO,
+ LOST_WAR_BECAUSE,
+ AFTER_WAR,
+ OK_ENOUGH_WAR,
+ STARBASE_BULLETIN_TAIL,
+ BETWEEN_BULLETINS,
+ STARBASE_BULLETIN_1,
+ STARBASE_BULLETIN_2,
+ STARBASE_BULLETIN_3,
+ STARBASE_BULLETIN_4,
+ STARBASE_BULLETIN_5,
+ STARBASE_BULLETIN_6,
+ STARBASE_BULLETIN_7,
+ STARBASE_BULLETIN_8,
+ STARBASE_BULLETIN_9,
+ STARBASE_BULLETIN_10,
+ STARBASE_BULLETIN_11,
+ STARBASE_BULLETIN_12,
+ STARBASE_BULLETIN_13,
+ STARBASE_BULLETIN_14,
+ STARBASE_BULLETIN_15,
+ STARBASE_BULLETIN_16,
+ STARBASE_BULLETIN_18,
+ STARBASE_BULLETIN_19,
+ STARBASE_BULLETIN_22,
+ STARBASE_BULLETIN_27,
+ STARBASE_BULLETIN_28,
+ STARBASE_BULLETIN_29,
+ STARBASE_BULLETIN_30,
+ DEVICE_HEAD,
+ BETWEEN_DEVICES,
+ DEVICE_TAIL,
+ ABOUT_PORTAL,
+ ABOUT_TALKPET,
+ ABOUT_BOMB,
+ ABOUT_SUN,
+ ABOUT_MAIDENS,
+ ABOUT_SPHERE,
+ ABOUT_HELIX,
+ ABOUT_SPINDLE,
+ ABOUT_ULTRON_0,
+ ABOUT_ULTRON_1,
+ ABOUT_ULTRON_2,
+ ABOUT_ULTRON_3,
+ ABOUT_UCASTER,
+ ABOUT_BCASTER,
+ ABOUT_SHIELD,
+ ABOUT_EGGCASE_0,
+ ABOUT_SHUTTLE,
+ ABOUT_VUXBEAST0,
+ ABOUT_VUXBEAST1,
+ ABOUT_DESTRUCT,
+ ABOUT_WARPPOD,
+ ABOUT_ARTIFACT_2,
+ ABOUT_ARTIFACT_3,
+ LETS_SEE,
+ GO_GET_MINERALS,
+ IMPROVE_FLAGSHIP_WITH_RU,
+ GOT_OK_FLAGSHIP,
+ GO_ALLY_WITH_ALIENS,
+ MADE_SOME_ALLIES,
+ GET_SHIPS_BY_MINING_OR_ALLIANCE,
+ GOT_OK_FLEET,
+ BUY_COMBAT_SHIPS,
+ GO_LEARN_ABOUT_URQUAN,
+ MAKE_FLAGSHIP_AWESOME,
+ KNOW_ABOUT_SAMATRA,
+ GOT_AWESOME_FLAGSHIP,
+ GOT_BOMB,
+ FIND_WAY_TO_DESTROY_SAMATRA,
+ MUST_INCREASE_BOMB_STRENGTH,
+ MUST_ACQUIRE_AWESOME_FLEET,
+ MUST_ELIMINATE_URQUAN_GUARDS,
+ CHMMR_IMPROVED_BOMB,
+ GOT_AWESOME_FLEET,
+ GO_DESTROY_SAMATRA,
+ GOOD_LUCK_AGAIN,
+ IMPROVE_1,
+ IMPROVE_2,
+ NEED_THRUSTERS_1,
+ NEED_THRUSTERS_2,
+ NEED_TURN_1,
+ NEED_TURN_2,
+ NEED_GUNS_1,
+ NEED_GUNS_2,
+ NEED_CREW_1,
+ NEED_CREW_2,
+ NEED_FUEL_1,
+ NEED_FUEL_2,
+ NEED_STORAGE_1,
+ NEED_LANDERS_2,
+ NEED_LANDERS_1,
+ NEED_DYNAMOS_1,
+ NEED_DYNAMOS_2,
+ NEED_POINT,
+
+ have_minerals,
+ goodbye_commander,
+ repeat_bulletins,
+ need_info,
+ starbase_functions,
+ history,
+ our_mission,
+ no_need_info,
+ enough_starbase,
+ enough_mission,
+ tell_me_about_fuel0,
+ tell_me_about_fuel1,
+ tell_me_about_modules0,
+ tell_me_about_modules1,
+ tell_me_about_crew,
+ tell_me_about_ships,
+ tell_me_about_ru,
+ tell_me_about_minerals,
+ tell_me_about_life,
+ where_get_minerals,
+ what_about_aliens,
+ what_about_urquan,
+ how_defeat,
+ how_find_urquan,
+ how_fight_urquan,
+ how_ally,
+ enough_defeat,
+ alien_races,
+ the_war,
+ ancient_history,
+ enough_history,
+ what_about_alliance,
+ what_about_hierarchy,
+ what_about_other,
+ enough_aliens,
+ shofixti,
+ yehat,
+ arilou,
+ chenjesu,
+ mmrnmhrm,
+ syreen,
+ enough_alliance,
+ urquan,
+ mycon,
+ spathi,
+ umgah,
+ androsynth,
+ vux,
+ ilwrath,
+ enough_hierarchy,
+ precursors,
+ old_races,
+ aliens_on_earth,
+ enough_ancient,
+ what_started_war,
+ what_was_war_like,
+ why_lose_war,
+ what_after_war,
+ enough_war,
+ new_devices,
+ how_get_strong,
+ what_do_now,
+ YOUR_FLAGSHIP_PC,
+ YOUR_FLAGSHIP_3DO0,
+ YOUR_FLAGSHIP_3DO1,
+ YOUR_FLAGSHIP_3DO2,
+ SPACE,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/supox/Makeinfo b/src/uqm/comm/supox/Makeinfo
new file mode 100644
index 0000000..8745013
--- /dev/null
+++ b/src/uqm/comm/supox/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="supoxc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/supox/resinst.h b/src/uqm/comm/supox/resinst.h
new file mode 100644
index 0000000..03459ea
--- /dev/null
+++ b/src/uqm/comm/supox/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define SUPOX_COLOR_MAP "comm.supox.colortable"
+#define SUPOX_CONVERSATION_PHRASES "comm.supox.dialogue"
+#define SUPOX_FONT "comm.supox.font"
+#define SUPOX_MUSIC "comm.supox.music"
+#define SUPOX_PMAP_ANIM "comm.supox.graphics"
diff --git a/src/uqm/comm/supox/strings.h b/src/uqm/comm/supox/strings.h
new file mode 100644
index 0000000..b3312f7
--- /dev/null
+++ b/src/uqm/comm/supox/strings.h
@@ -0,0 +1,124 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SUPOX_STRINGS_H
+#define SUPOX_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ NEUTRAL_SPACE_HELLO_1,
+ NEUTRAL_SPACE_HELLO_2,
+ NEUTRAL_HOMEWORLD_HELLO_1,
+ NEUTRAL_HOMEWORLD_HELLO_2,
+ HOSTILE_SPACE_HELLO_1,
+ HOSTILE_SPACE_HELLO_2,
+ ALLIED_HOMEWORLD_HELLO_1,
+ ALLIED_HOMEWORLD_HELLO_2,
+ ALLIED_HOMEWORLD_HELLO_3,
+ ALLIED_HOMEWORLD_HELLO_4,
+ i_am0,
+ i_am1,
+ WE_ARE_SUPOX,
+ my_ship0,
+ my_ship1,
+ OUR_SHIP,
+ from_alliance0,
+ from_alliance1,
+ FROM_SUPOX,
+ are_you_copying,
+ YEAH_SORRY,
+ why_copy,
+ SYMBIOTS,
+ tell_us_of_your_species,
+ OUR_SPECIES,
+ plants_arent_intelligent,
+ PROVES_WERE_SPECIAL,
+ anyone_around_here,
+ UTWIG_NEARBY,
+ what_relation_to_utwig,
+ UTWIG_ALLIES,
+ whats_wrong_with_utwig,
+ BROKE_ULTRON,
+ whats_ultron,
+ TAKE_ULTRON,
+ what_do_i_do_now,
+ FIX_IT,
+ thanks_now_we_eat_you,
+ HIDEOUS_MONSTERS,
+ got_fixed_ultron,
+ GOOD_GIVE_TO_UTWIG,
+ look_i_repaired_lots,
+ ALMOST_THERE,
+ look_i_slightly_repaired,
+ GREAT_DO_MORE,
+ where_get_repairs,
+ ANCIENT_RHYME,
+ bye_neutral,
+ GOODBYE_NEUTRAL,
+ ABOUT_BATTLE,
+ HELLO_BEFORE_KOHRAH_SPACE_1,
+ HELLO_BEFORE_KOHRAH_SPACE_2,
+ HELLO_DURING_KOHRAH_SPACE_1,
+ HELLO_DURING_KOHRAH_SPACE_2,
+ HELLO_AFTER_KOHRAH_SPACE_1,
+ HELLO_AFTER_KOHRAH_SPACE_2,
+ whats_up_after_space,
+ GENERAL_INFO_AFTER_SPACE_1,
+ GENERAL_INFO_AFTER_SPACE_2,
+ what_now_after_space,
+ DO_THIS_AFTER_SPACE,
+ bye_after_space,
+ GOODBYE_AFTER_SPACE,
+ whats_up_before_space,
+ GENERAL_INFO_BEFORE_SPACE_1,
+ GENERAL_INFO_BEFORE_SPACE_2,
+ what_now_before_space,
+ DO_THIS_BEFORE_SPACE,
+ bye_before_space,
+ GOODBYE_BEFORE_SPACE,
+ how_went_war,
+ how_goes_war,
+ BATTLE_HAPPENS_1,
+ BATTLE_HAPPENS_2,
+ FLEET_ON_WAY,
+ learn_new_info,
+ NO_NEW_INFO,
+ SAMATRA,
+ what_now_homeworld,
+ HOPE_KILL_EACH_OTHER,
+ UP_TO_YOU,
+ can_you_help,
+ HOW_HELP,
+ DONT_NEED,
+ HAVE_4_SHIPS,
+ give_info,
+ GOOD_HINTS,
+ how_is_ultron,
+ ULTRON_IS_GREAT,
+ bye_allied_homeworld,
+ GOODBYE_ALLIED_HOMEWORLD,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/supox/supoxc.c b/src/uqm/comm/supox/supoxc.c
new file mode 100644
index 0000000..e169cba
--- /dev/null
+++ b/src/uqm/comm/supox/supoxc.c
@@ -0,0 +1,708 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+
+
+static LOCDATA supox_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SUPOX_PMAP_ANIM, /* AlienFrame */
+ SUPOX_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SUPOX_COLOR_MAP, /* AlienColorMap */
+ SUPOX_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SUPOX_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 4, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 4, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 9, /* StartIndex */
+ 10, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 19, /* StartIndex */
+ 10, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 29, /* StartIndex */
+ 13, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye_neutral))
+ NPCPhrase (GOODBYE_NEUTRAL);
+ else if (PLAYER_SAID (R, what_do_i_do_now))
+ NPCPhrase (FIX_IT);
+ else if (PLAYER_SAID (R, thanks_now_we_eat_you))
+ {
+ NPCPhrase (HIDEOUS_MONSTERS);
+
+ SET_GAME_STATE (SUPOX_HOSTILE, 1);
+ SET_GAME_STATE (SUPOX_HOME_VISITS, 0);
+ SET_GAME_STATE (SUPOX_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, bye_after_space))
+ NPCPhrase (GOODBYE_AFTER_SPACE);
+ else if (PLAYER_SAID (R, bye_before_space))
+ NPCPhrase (GOODBYE_BEFORE_SPACE);
+ else if (PLAYER_SAID (R, bye_allied_homeworld))
+ NPCPhrase (GOODBYE_ALLIED_HOMEWORLD);
+ else if (PLAYER_SAID (R, can_you_help))
+ {
+ NPCPhrase (HOW_HELP);
+ if (EscortFeasibilityStudy (SUPOX_SHIP) == 0)
+ NPCPhrase (DONT_NEED);
+ else
+ {
+ NPCPhrase (HAVE_4_SHIPS);
+
+ AlienTalkSegue ((COUNT)~0);
+ AddEscortShips (SUPOX_SHIP, 4);
+ }
+ }
+}
+
+static void AlliedHome (RESPONSE_REF R);
+
+static void
+AlliedHome (RESPONSE_REF R)
+{
+ BYTE NumVisits, News;
+
+ News = GET_GAME_STATE (SUPOX_WAR_NEWS);
+ NumVisits = GET_GAME_STATE (UTWIG_SUPOX_MISSION);
+ if (PLAYER_SAID (R, how_went_war))
+ {
+ NPCPhrase (ABOUT_BATTLE);
+
+ News |= (1 << 0);
+ }
+ else if (PLAYER_SAID (R, how_goes_war))
+ {
+ if (NumVisits == 1)
+ {
+ NPCPhrase (FLEET_ON_WAY);
+
+ SET_GAME_STATE (SUPOX_WAR_NEWS, 1);
+ }
+ else switch (GET_GAME_STATE (SUPOX_WAR_NEWS))
+ {
+ case 0:
+ NPCPhrase (BATTLE_HAPPENS_1);
+ News = 1;
+ break;
+ case 1:
+ NPCPhrase (BATTLE_HAPPENS_2);
+ News = 2;
+ break;
+ }
+
+ DISABLE_PHRASE (how_goes_war);
+ }
+ else if (PLAYER_SAID (R, learn_new_info))
+ {
+ if (NumVisits < 5)
+ NPCPhrase (NO_NEW_INFO);
+ else
+ {
+ NPCPhrase (SAMATRA);
+
+ News |= (1 << 1);
+ }
+
+ DISABLE_PHRASE (learn_new_info);
+ }
+ else if (PLAYER_SAID (R, what_now_homeworld))
+ {
+ if (NumVisits < 5)
+ NPCPhrase (UP_TO_YOU);
+ else
+ NPCPhrase (HOPE_KILL_EACH_OTHER);
+
+ DISABLE_PHRASE (what_now_homeworld);
+ }
+ else if (PLAYER_SAID (R, how_is_ultron))
+ {
+ NPCPhrase (ULTRON_IS_GREAT);
+
+ DISABLE_PHRASE (how_is_ultron);
+ }
+ SET_GAME_STATE (SUPOX_WAR_NEWS, News);
+
+ if (NumVisits >= 5)
+ {
+ if (!(News & (1 << 0)))
+ Response (how_went_war, AlliedHome);
+ }
+ else if (PHRASE_ENABLED (how_goes_war)
+ && ((NumVisits == 1 && News == 0)
+ || (NumVisits && News < 2)))
+ Response (how_goes_war, AlliedHome);
+ if (PHRASE_ENABLED (learn_new_info))
+ Response (learn_new_info, AlliedHome);
+ if (PHRASE_ENABLED (what_now_homeworld))
+ Response (what_now_homeworld, AlliedHome);
+ if (PHRASE_ENABLED (how_is_ultron))
+ Response (how_is_ultron, AlliedHome);
+ if (NumVisits == 0)
+ Response (can_you_help, ExitConversation);
+ Response (bye_allied_homeworld, ExitConversation);
+}
+
+static void
+BeforeKohrAh (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_before_space))
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_BEFORE_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_BEFORE_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_before_space);
+ }
+ else if (PLAYER_SAID (R, what_now_before_space))
+ {
+ NPCPhrase (DO_THIS_BEFORE_SPACE);
+
+ DISABLE_PHRASE (what_now_before_space);
+ }
+
+ if (PHRASE_ENABLED (whats_up_before_space))
+ Response (whats_up_before_space, BeforeKohrAh);
+ if (PHRASE_ENABLED (what_now_before_space))
+ Response (what_now_before_space, BeforeKohrAh);
+ Response (bye_before_space, ExitConversation);
+}
+
+static void
+AfterKohrAh (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_after_space))
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_AFTER_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_AFTER_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_after_space);
+ }
+ else if (PLAYER_SAID (R, what_now_after_space))
+ {
+ NPCPhrase (DO_THIS_AFTER_SPACE);
+
+ DISABLE_PHRASE (what_now_after_space);
+ }
+
+ if (PHRASE_ENABLED (whats_up_after_space))
+ Response (whats_up_after_space, AfterKohrAh);
+ if (PHRASE_ENABLED (what_now_after_space))
+ Response (what_now_after_space, AfterKohrAh);
+ Response (bye_after_space, ExitConversation);
+}
+
+static void
+NeutralSupox (RESPONSE_REF R)
+{
+ BYTE i, LastStack, NumVisits;
+ RESPONSE_REF pStr[3];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (PLAYER_SAID (R, i_am0))
+ {
+ NPCPhrase (WE_ARE_SUPOX);
+
+ SET_GAME_STATE (SUPOX_STACK1, 1);
+ DISABLE_PHRASE (i_am0);
+ }
+ else if (PLAYER_SAID (R, my_ship0))
+ {
+ NPCPhrase (OUR_SHIP);
+
+ SET_GAME_STATE (SUPOX_STACK1, 2);
+ DISABLE_PHRASE (my_ship0);
+ }
+ else if (PLAYER_SAID (R, from_alliance0))
+ {
+ NPCPhrase (FROM_SUPOX);
+
+ SET_GAME_STATE (SUPOX_STACK1, 3);
+ DISABLE_PHRASE (from_alliance0);
+ }
+ else if (PLAYER_SAID (R, are_you_copying))
+ {
+ NPCPhrase (YEAH_SORRY);
+
+ SET_GAME_STATE (SUPOX_STACK1, 4);
+ }
+ else if (PLAYER_SAID (R, why_copy))
+ {
+ NPCPhrase (SYMBIOTS);
+
+ SET_GAME_STATE (SUPOX_STACK1, 5);
+ }
+ else if (PLAYER_SAID (R, tell_us_of_your_species))
+ {
+ NPCPhrase (OUR_SPECIES);
+
+ LastStack = 1;
+ SET_GAME_STATE (SUPOX_STACK2, 1);
+ }
+ else if (PLAYER_SAID (R, plants_arent_intelligent))
+ {
+ NPCPhrase (PROVES_WERE_SPECIAL);
+
+ SET_GAME_STATE (SUPOX_STACK2, 2);
+ }
+ else if (PLAYER_SAID (R, anyone_around_here))
+ {
+ NPCPhrase (UTWIG_NEARBY);
+
+ LastStack = 2;
+ SET_GAME_STATE (SUPOX_WAR_NEWS, 1);
+ StartSphereTracking (UTWIG_SHIP);
+ }
+ else if (PLAYER_SAID (R, what_relation_to_utwig))
+ {
+ NPCPhrase (UTWIG_ALLIES);
+
+ LastStack = 2;
+ SET_GAME_STATE (SUPOX_WAR_NEWS, 1);
+ }
+ else if (PLAYER_SAID (R, whats_wrong_with_utwig))
+ {
+ NPCPhrase (BROKE_ULTRON);
+
+ LastStack = 2;
+ SET_GAME_STATE (SUPOX_WAR_NEWS, 2);
+ }
+ else if (PLAYER_SAID (R, whats_ultron))
+ {
+ NPCPhrase (TAKE_ULTRON);
+
+ SET_GAME_STATE (SUPOX_WAR_NEWS, 0);
+ SET_GAME_STATE (ULTRON_CONDITION, 1);
+
+ Response (what_do_i_do_now, ExitConversation);
+ Response (thanks_now_we_eat_you, ExitConversation);
+
+ return;
+ }
+ else if (PLAYER_SAID (R, got_fixed_ultron))
+ {
+ NPCPhrase (GOOD_GIVE_TO_UTWIG);
+
+ SET_GAME_STATE (SUPOX_ULTRON_HELP, 1);
+ }
+ else if (PLAYER_SAID (R, look_i_repaired_lots))
+ {
+ NPCPhrase (ALMOST_THERE);
+
+ SET_GAME_STATE (SUPOX_ULTRON_HELP, 1);
+ }
+ else if (PLAYER_SAID (R, look_i_slightly_repaired))
+ {
+ NPCPhrase (GREAT_DO_MORE);
+
+ SET_GAME_STATE (SUPOX_ULTRON_HELP, 1);
+ }
+ else if (PLAYER_SAID (R, where_get_repairs))
+ {
+ NPCPhrase (ANCIENT_RHYME);
+
+ SET_GAME_STATE (SUPOX_ULTRON_HELP, 1);
+ }
+
+ switch (GET_GAME_STATE (SUPOX_STACK2))
+ {
+ case 0:
+ pStr[1] = tell_us_of_your_species;
+ break;
+ case 1:
+ pStr[1] = plants_arent_intelligent;
+ break;
+ }
+ switch (GET_GAME_STATE (SUPOX_STACK1))
+ {
+ case 0:
+ construct_response (shared_phrase_buf,
+ i_am0,
+ GLOBAL_SIS (CommanderName),
+ i_am1,
+ (UNICODE*)NULL);
+ pStr[0] = i_am0;
+ pStr[1] = 0;
+ break;
+ case 1:
+ construct_response (shared_phrase_buf,
+ my_ship0,
+ GLOBAL_SIS (ShipName),
+ my_ship1,
+ (UNICODE*)NULL);
+ pStr[0] = my_ship0;
+ pStr[1] = 0;
+ break;
+ case 2:
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ from_alliance0,
+ buf,
+ from_alliance1,
+ (UNICODE*)NULL);
+ }
+ pStr[0] = from_alliance0;
+ pStr[1] = 0;
+ break;
+ case 3:
+ pStr[0] = are_you_copying;
+ pStr[1] = 0;
+ break;
+ case 4:
+ pStr[0] = why_copy;
+ pStr[1] = 0;
+ break;
+ }
+ NumVisits = GET_GAME_STATE (ULTRON_CONDITION);
+ if (NumVisits == 0)
+ {
+ switch (GET_GAME_STATE (SUPOX_WAR_NEWS))
+ {
+ case 0:
+ if (GET_GAME_STATE (UTWIG_VISITS)
+ || GET_GAME_STATE (UTWIG_HOME_VISITS)
+ || GET_GAME_STATE (BOMB_VISITS))
+ pStr[2] = what_relation_to_utwig;
+ else
+ pStr[2] = anyone_around_here;
+ break;
+ case 1:
+ pStr[2] = whats_wrong_with_utwig;
+ break;
+ case 2:
+ pStr[2] = whats_ultron;
+ break;
+ }
+ }
+ if (pStr[LastStack])
+ {
+ if (LastStack != 0 || GET_GAME_STATE (SUPOX_STACK1) > 2)
+ Response (pStr[LastStack], NeutralSupox);
+ else
+ DoResponsePhrase (pStr[LastStack], NeutralSupox, shared_phrase_buf);
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (i != 0 || GET_GAME_STATE (SUPOX_STACK1) > 2)
+ Response (pStr[i], NeutralSupox);
+ else
+ DoResponsePhrase (pStr[i], NeutralSupox, shared_phrase_buf);
+ }
+ }
+ if (!GET_GAME_STATE (SUPOX_ULTRON_HELP))
+ {
+ switch (NumVisits)
+ {
+ case 1:
+ Response (where_get_repairs, NeutralSupox);
+ break;
+ case 2:
+ Response (look_i_slightly_repaired, NeutralSupox);
+ break;
+ case 3:
+ Response (look_i_repaired_lots, NeutralSupox);
+ break;
+ case 4:
+ Response (got_fixed_ultron, NeutralSupox);
+ break;
+ }
+ }
+ Response (bye_neutral, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (SUPOX_HOSTILE))
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_VISITS, NumVisits);
+
+ setSegue (Segue_peace);
+ }
+ else if (CheckAlliance (SUPOX_SHIP) == GOOD_GUY)
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_HOME_VISITS, NumVisits);
+
+ AlliedHome ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_SUPOX_MISSION);
+ if (NumVisits == 1)
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_BEFORE_KOHRAH_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_BEFORE_KOHRAH_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_VISITS, NumVisits);
+
+ BeforeKohrAh ((RESPONSE_REF)0);
+ }
+ else if (NumVisits < 5)
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_DURING_KOHRAH_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_DURING_KOHRAH_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_AFTER_KOHRAH_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_AFTER_KOHRAH_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_VISITS, NumVisits);
+
+ AfterKohrAh ((RESPONSE_REF)0);
+ }
+ }
+ }
+ else
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (SUPOX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SUPOX_VISITS, NumVisits);
+ }
+
+ NeutralSupox ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_supox (void)
+{
+ return (0);
+}
+
+static void
+post_supox_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_supox_comm (void)
+{
+ LOCDATA *retval;
+
+ supox_desc.init_encounter_func = Intro;
+ supox_desc.post_encounter_func = post_supox_enc;
+ supox_desc.uninit_encounter_func = uninit_supox;
+
+ supox_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ supox_desc.AlienTextBaseline.y = 0;
+ supox_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (!GET_GAME_STATE (SUPOX_HOSTILE)
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &supox_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/syreen/Makeinfo b/src/uqm/comm/syreen/Makeinfo
new file mode 100644
index 0000000..e2a265e
--- /dev/null
+++ b/src/uqm/comm/syreen/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="syreenc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/syreen/resinst.h b/src/uqm/comm/syreen/resinst.h
new file mode 100644
index 0000000..16f7b0b
--- /dev/null
+++ b/src/uqm/comm/syreen/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define SYREEN_COLOR_MAP "comm.syreen.colortable"
+#define SYREEN_CONVERSATION_PHRASES "comm.syreen.dialogue"
+#define SYREEN_FONT "comm.syreen.font"
+#define SYREEN_MUSIC "comm.syreen.music"
+#define SYREEN_PMAP_ANIM "comm.syreen.graphics"
diff --git a/src/uqm/comm/syreen/strings.h b/src/uqm/comm/syreen/strings.h
new file mode 100644
index 0000000..b796e3d
--- /dev/null
+++ b/src/uqm/comm/syreen/strings.h
@@ -0,0 +1,158 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SYREEN_STRINGS_H
+#define SYREEN_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HELLO_BEFORE_AMBUSH_1,
+ HELLO_BEFORE_AMBUSH_2,
+ HELLO_BEFORE_AMBUSH_3,
+ HELLO_BEFORE_AMBUSH_4,
+ we_are_vice_squad,
+ OK_VICE,
+ we_are_the_one_for_you_baby,
+ MAYBE_CAPTAIN,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ WELCOME_VINDICATOR0,
+ WELCOME_VINDICATOR1,
+ WELCOME_VINDICATOR2,
+ we_are_impressed,
+ SO_AM_I_CAPTAIN,
+ HOW_CAN_YOU_BE_HERE,
+ we_here_to_help,
+ NO_NEED_HELP,
+ we_need_help,
+ CANT_GIVE_HELP,
+ i_need_you,
+ OK_NEED,
+ i_need_touch_o_vision,
+ TOUCH_O_VISION,
+ know_about_deep_children,
+ WHAT_ABOUT_DEEP_CHILDREN,
+ mycons_involved,
+ WHAT_PROOF,
+ have_no_proof,
+ NEED_PROOF,
+ have_proof,
+ SEE_PROOF,
+ look_at_egg_sacks,
+ HORRIBLE_TRUTH,
+ what_doing_here,
+ OUR_NEW_WORLD,
+ what_about_war,
+ ABOUT_WAR,
+ help_us,
+ WONT_HELP,
+ what_about_history,
+ BEFORE_WAR,
+ what_about_homeworld,
+ ABOUT_HOMEWORLD,
+ what_happened,
+ DONT_KNOW_HOW,
+ what_about_outfit,
+ HOPE_YOU_LIKE_IT,
+ where_mates,
+ MATES_KILLED,
+ get_lonely,
+ MAKE_OUT_ALL_RIGHT,
+ bye,
+ GOODBYE,
+ MUST_ACT,
+ whats_next_step,
+ OPEN_VAULT,
+ where_is_it,
+ DONT_KNOW_WHERE,
+ been_there,
+ GREAT,
+ GIVE_SHUTTLE,
+ im_on_my_way,
+ doing_this_for_you,
+ if_i_die,
+ GOOD_LUCK,
+ OK_FOUND_VAULT,
+ what_now,
+ HERES_THE_PLAN,
+ whats_my_reward,
+ HERES_REWARD,
+ bye_after_vault,
+ GOODBYE_AFTER_VAULT,
+ HELLO_AFTER_AMBUSH_1,
+ HELLO_AFTER_AMBUSH_2,
+ HELLO_AFTER_AMBUSH_3,
+ HELLO_AFTER_AMBUSH_4,
+ what_now_after_ambush,
+ DO_THIS_AFTER_AMBUSH,
+ what_about_you,
+ ABOUT_ME,
+ whats_up_after_ambush,
+ GENERAL_INFO_AFTER_AMBUSH_1,
+ GENERAL_INFO_AFTER_AMBUSH_2,
+ GENERAL_INFO_AFTER_AMBUSH_3,
+ GENERAL_INFO_AFTER_AMBUSH_4,
+ bye_after_ambush,
+ GOODBYE_AFTER_AMBUSH,
+ FOUND_VAULT_YET_1,
+ FOUND_VAULT_YET_2,
+ vault_hint,
+ OK_HINT,
+ found_vault,
+ bye_before_vault,
+ GOODBYE_BEFORE_VAULT,
+ what_do_i_get_for_this,
+ GRATITUDE,
+ not_sure,
+ PLEASE,
+ READY_FOR_AMBUSH,
+ repeat_plan,
+ OK_REPEAT_PLAN,
+ bye_before_ambush,
+ GOODBYE_BEFORE_AMBUSH,
+ what_about_us,
+ ABOUT_US,
+ MORE_COMFORTABLE,
+ in_the_spirit,
+ OK_SPIRIT,
+ what_in_mind,
+ SOMETHING_LIKE_THIS,
+ hands_off,
+ OK_WONT_USE_HANDS,
+ why_lights_off,
+ LIGHTS_OFF_BECAUSE,
+ evil_monster,
+ NOT_EVIL_MONSTER,
+ disease,
+ JUST_RELAX,
+ what_happens_if_i_touch_this,
+ THIS_HAPPENS,
+ are_you_sure_this_is_ok,
+ YES_SURE,
+ boy_they_never_taught,
+ THEN_LET_ME_TEACH,
+ not_much_more_to_say,
+ THEN_STOP_TALKING,
+ LATER,
+ SEX_GOODBYE,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/syreen/syreenc.c b/src/uqm/comm/syreen/syreenc.c
new file mode 100644
index 0000000..8884ad6
--- /dev/null
+++ b/src/uqm/comm/syreen/syreenc.c
@@ -0,0 +1,878 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/setup.h"
+
+
+static LOCDATA syreen_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ SYREEN_PMAP_ANIM, /* AlienFrame */
+ SYREEN_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ SYREEN_COLOR_MAP, /* AlienColorMap */
+ SYREEN_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ SYREEN_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 15, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 5, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 7, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 9, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 11, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 15, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 12), /* BlockMask */
+ },
+ {
+ 17, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 19, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 13),
+ },
+ {
+ 21, /* StartIndex */
+ 6, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 27, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 14), /* BlockMask */
+ },
+ {
+ 31, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 37, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 41, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5), /* BlockMask */
+ },
+ {
+ 44, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 6, 0, /* FrameRate */
+ ONE_SECOND * 3, ONE_SECOND, /* RestartRate */
+ (1 << 7) | (1 << 14), /* BlockMask */
+ },
+ {
+ 48, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND,/* RestartRate */
+ (1 << 9) | (1 << 13), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 4, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+FriendlyExit (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye))
+ NPCPhrase (GOODBYE);
+ else if (PLAYER_SAID (R, im_on_my_way)
+ || PLAYER_SAID (R, doing_this_for_you)
+ || PLAYER_SAID (R, if_i_die))
+ NPCPhrase (GOOD_LUCK);
+ else if (PLAYER_SAID (R, bye_before_vault))
+ NPCPhrase (GOODBYE_BEFORE_VAULT);
+ else if (PLAYER_SAID (R, bye_after_vault))
+ NPCPhrase (GOODBYE_AFTER_VAULT);
+ else if (PLAYER_SAID (R, bye_before_ambush))
+ NPCPhrase (GOODBYE_BEFORE_AMBUSH);
+ else if (PLAYER_SAID (R, bye_after_ambush))
+ NPCPhrase (GOODBYE_AFTER_AMBUSH);
+ else
+ {
+ if (PLAYER_SAID (R, hands_off))
+ NPCPhrase (OK_WONT_USE_HANDS);
+ else if (PLAYER_SAID (R, not_much_more_to_say))
+ NPCPhrase (THEN_STOP_TALKING);
+ NPCPhrase (LATER);
+ NPCPhrase (SEX_GOODBYE);
+
+ AlienTalkSegue (2);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 0)
+ ), ONE_SECOND / 2);
+ AlienTalkSegue ((COUNT)~0);
+
+ SET_GAME_STATE (PLAYER_HAD_SEX, 1);
+ SET_GAME_STATE (PLAYER_HAVING_SEX, 0);
+ }
+}
+
+static void
+Sex (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, in_the_spirit))
+ NPCPhrase (OK_SPIRIT);
+ else if (PLAYER_SAID (R, what_in_mind))
+ NPCPhrase (SOMETHING_LIKE_THIS);
+ else if (PLAYER_SAID (R, disease))
+ NPCPhrase (JUST_RELAX);
+ else if (PLAYER_SAID (R, what_happens_if_i_touch_this))
+ {
+ NPCPhrase (THIS_HAPPENS);
+
+ DISABLE_PHRASE (what_happens_if_i_touch_this);
+ }
+ else if (PLAYER_SAID (R, are_you_sure_this_is_ok))
+ {
+ NPCPhrase (YES_SURE);
+
+ DISABLE_PHRASE (are_you_sure_this_is_ok);
+ }
+ else if (PLAYER_SAID (R, boy_they_never_taught))
+ {
+ NPCPhrase (THEN_LET_ME_TEACH);
+
+ DISABLE_PHRASE (boy_they_never_taught);
+ }
+
+ if (!PHRASE_ENABLED (what_happens_if_i_touch_this)
+ && !PHRASE_ENABLED (are_you_sure_this_is_ok)
+ && !PHRASE_ENABLED (boy_they_never_taught))
+ Response (not_much_more_to_say, FriendlyExit);
+ else
+ {
+ if (PHRASE_ENABLED (what_happens_if_i_touch_this))
+ Response (what_happens_if_i_touch_this, Sex);
+ if (PHRASE_ENABLED (are_you_sure_this_is_ok))
+ Response (are_you_sure_this_is_ok, Sex);
+ if (PHRASE_ENABLED (boy_they_never_taught))
+ Response (boy_they_never_taught, Sex);
+ }
+}
+
+static void
+Foreplay (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_my_reward)
+ || PLAYER_SAID (R, what_about_us))
+ {
+ if (PLAYER_SAID (R, whats_my_reward))
+ NPCPhrase (HERES_REWARD);
+ else
+ NPCPhrase (ABOUT_US);
+ NPCPhrase (MORE_COMFORTABLE);
+ AlienTalkSegue (1);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1)
+ ), ONE_SECOND);
+ AlienTalkSegue ((COUNT)~0);
+
+ SET_GAME_STATE (PLAYER_HAVING_SEX, 1);
+ }
+ else if (PLAYER_SAID (R, why_lights_off))
+ {
+ NPCPhrase (LIGHTS_OFF_BECAUSE);
+
+ DISABLE_PHRASE (why_lights_off);
+ }
+ else if (PLAYER_SAID (R, evil_monster))
+ {
+ NPCPhrase (NOT_EVIL_MONSTER);
+
+ DISABLE_PHRASE (evil_monster);
+ }
+
+ if (PHRASE_ENABLED (why_lights_off))
+ Response (why_lights_off, Foreplay);
+ else if (PHRASE_ENABLED (evil_monster))
+ Response (evil_monster, Foreplay);
+ else
+ Response (disease, Sex);
+ Response (in_the_spirit, Sex);
+ Response (what_in_mind, Sex);
+ Response (hands_off, FriendlyExit);
+}
+
+static void
+AfterAmbush (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, what_now_after_ambush))
+ {
+ NPCPhrase (DO_THIS_AFTER_AMBUSH);
+
+ DISABLE_PHRASE (what_now_after_ambush);
+ }
+ else if (PLAYER_SAID (R, what_about_you))
+ {
+ NPCPhrase (ABOUT_ME);
+
+ DISABLE_PHRASE (what_about_you);
+ }
+ else if (PLAYER_SAID (R, whats_up_after_ambush))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (SYREEN_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_AFTER_AMBUSH_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_AFTER_AMBUSH_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_AFTER_AMBUSH_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_AFTER_AMBUSH_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (SYREEN_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_after_ambush);
+ }
+
+ if (PHRASE_ENABLED (what_about_you))
+ Response (what_about_you, AfterAmbush);
+ else if (!GET_GAME_STATE (PLAYER_HAD_SEX))
+ {
+ Response (what_about_us, Foreplay);
+ }
+ if (PHRASE_ENABLED (what_now_after_ambush))
+ Response (what_now_after_ambush, AfterAmbush);
+ if (PHRASE_ENABLED (whats_up_after_ambush))
+ Response (whats_up_after_ambush, AfterAmbush);
+ Response (bye_after_ambush, FriendlyExit);
+}
+
+static void
+AmbushReady (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, repeat_plan))
+ {
+ NPCPhrase (OK_REPEAT_PLAN);
+
+ DISABLE_PHRASE (repeat_plan);
+ }
+
+ if (PHRASE_ENABLED (repeat_plan))
+ Response (repeat_plan, AmbushReady);
+ Response (bye_before_ambush, FriendlyExit);
+}
+
+static void
+SyreenShuttle (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_next_step))
+ {
+ NPCPhrase (OPEN_VAULT);
+
+ DISABLE_PHRASE (whats_next_step);
+ }
+ else if (PLAYER_SAID (R, what_do_i_get_for_this))
+ {
+ NPCPhrase (GRATITUDE);
+
+ DISABLE_PHRASE (what_do_i_get_for_this);
+ }
+ else if (PLAYER_SAID (R, not_sure))
+ {
+ NPCPhrase (PLEASE);
+
+ DISABLE_PHRASE (not_sure);
+ }
+ else if (PLAYER_SAID (R, where_is_it))
+ {
+ NPCPhrase (DONT_KNOW_WHERE);
+ NPCPhrase (GIVE_SHUTTLE);
+
+ SET_GAME_STATE (SYREEN_SHUTTLE, 1);
+ SET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP, 1);
+
+ DISABLE_PHRASE (where_is_it);
+ }
+ else if (PLAYER_SAID (R, been_there))
+ {
+ NPCPhrase (GREAT);
+ NPCPhrase (GIVE_SHUTTLE);
+
+ SET_GAME_STATE (SYREEN_SHUTTLE, 1);
+ SET_GAME_STATE (SYREEN_SHUTTLE_ON_SHIP, 1);
+
+ DISABLE_PHRASE (been_there);
+ }
+
+ if (PHRASE_ENABLED (whats_next_step))
+ Response (whats_next_step, SyreenShuttle);
+ else
+ {
+ if (!GET_GAME_STATE (KNOW_SYREEN_VAULT))
+ {
+ if (PHRASE_ENABLED (where_is_it))
+ Response (where_is_it, SyreenShuttle);
+ }
+ else
+ {
+ if (PHRASE_ENABLED (been_there))
+ Response (been_there, SyreenShuttle);
+ }
+ if (!PHRASE_ENABLED (where_is_it)
+ || !PHRASE_ENABLED (been_there))
+ {
+ Response (im_on_my_way, FriendlyExit);
+ Response (doing_this_for_you, FriendlyExit);
+ Response (if_i_die, FriendlyExit);
+ }
+ }
+ if (PHRASE_ENABLED (what_do_i_get_for_this))
+ Response (what_do_i_get_for_this, SyreenShuttle);
+ if (PHRASE_ENABLED (not_sure))
+ Response (not_sure, SyreenShuttle);
+}
+
+static void
+NormalSyreen (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[4];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = pStr[3] = 0;
+ if (PLAYER_SAID (R, we_here_to_help))
+ NPCPhrase (NO_NEED_HELP);
+ else if (PLAYER_SAID (R, we_need_help))
+ NPCPhrase (CANT_GIVE_HELP);
+ else if (PLAYER_SAID (R, know_about_deep_children))
+ {
+ NPCPhrase (WHAT_ABOUT_DEEP_CHILDREN);
+
+ DISABLE_PHRASE (know_about_deep_children);
+ }
+ else if (PLAYER_SAID (R, mycons_involved))
+ {
+ NPCPhrase (WHAT_PROOF);
+
+ SET_GAME_STATE (KNOW_ABOUT_SHATTERED, 3);
+ }
+ else if (PLAYER_SAID (R, have_no_proof))
+ {
+ NPCPhrase (NEED_PROOF);
+
+ SET_GAME_STATE (SYREEN_WANT_PROOF, 1);
+ }
+ else if (PLAYER_SAID (R, have_proof))
+ {
+ NPCPhrase (SEE_PROOF);
+
+ DISABLE_PHRASE (have_proof);
+ }
+ else if (PLAYER_SAID (R, what_doing_here))
+ {
+ NPCPhrase (OUR_NEW_WORLD);
+
+ SET_GAME_STATE (SYREEN_STACK0, 1);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, what_about_war))
+ {
+ NPCPhrase (ABOUT_WAR);
+
+ SET_GAME_STATE (SYREEN_STACK0, 2);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, help_us))
+ {
+ NPCPhrase (WONT_HELP);
+
+ SET_GAME_STATE (SYREEN_STACK0, 3);
+ }
+ else if (PLAYER_SAID (R, what_about_history))
+ {
+ NPCPhrase (BEFORE_WAR);
+
+ SET_GAME_STATE (SYREEN_STACK1, 1);
+ LastStack = 2;
+ }
+ else if (PLAYER_SAID (R, what_about_homeworld))
+ {
+ NPCPhrase (ABOUT_HOMEWORLD);
+
+ SET_GAME_STATE (SYREEN_STACK1, 2);
+ LastStack = 2;
+ }
+ else if (PLAYER_SAID (R, what_happened))
+ {
+ NPCPhrase (DONT_KNOW_HOW);
+
+ SET_GAME_STATE (KNOW_SYREEN_WORLD_SHATTERED, 1);
+ SET_GAME_STATE (SYREEN_STACK1, 3);
+ }
+ else if (PLAYER_SAID (R, what_about_outfit))
+ {
+ NPCPhrase (HOPE_YOU_LIKE_IT);
+
+ SET_GAME_STATE (SYREEN_STACK2, 1);
+ LastStack = 3;
+ }
+ else if (PLAYER_SAID (R, where_mates))
+ {
+ NPCPhrase (MATES_KILLED);
+
+ SET_GAME_STATE (SYREEN_STACK2, 2);
+ LastStack = 3;
+ }
+ else if (PLAYER_SAID (R, get_lonely))
+ {
+ NPCPhrase (MAKE_OUT_ALL_RIGHT);
+
+ SET_GAME_STATE (SYREEN_STACK2, 3);
+ }
+ else if (PLAYER_SAID (R, look_at_egg_sacks))
+ {
+ NPCPhrase (HORRIBLE_TRUTH);
+
+ setSegue (Segue_peace);
+ SET_GAME_STATE (SYREEN_HOME_VISITS, 0);
+ SET_GAME_STATE (SYREEN_KNOW_ABOUT_MYCON, 1);
+
+ SyreenShuttle ((RESPONSE_REF)0);
+ return;
+ }
+
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) < 3)
+ {
+ if (GET_GAME_STATE (KNOW_ABOUT_SHATTERED) == 2
+ && GET_GAME_STATE (KNOW_SYREEN_WORLD_SHATTERED))
+ {
+ if (PHRASE_ENABLED (know_about_deep_children))
+ pStr[0] = know_about_deep_children;
+ else
+ pStr[0] = mycons_involved;
+ }
+ }
+ else
+ {
+ if (GET_GAME_STATE (EGG_CASE0_ON_SHIP)
+ || GET_GAME_STATE (EGG_CASE1_ON_SHIP)
+ || GET_GAME_STATE (EGG_CASE2_ON_SHIP))
+ {
+ if (PHRASE_ENABLED (have_proof))
+ pStr[0] = have_proof;
+ else
+ pStr[0] = look_at_egg_sacks;
+ }
+ else if (!GET_GAME_STATE (SYREEN_WANT_PROOF))
+ {
+ pStr[0] = have_no_proof;
+ }
+ }
+ switch (GET_GAME_STATE (SYREEN_STACK0))
+ {
+ case 0:
+ pStr[1] = what_doing_here;
+ break;
+ case 1:
+ pStr[1] = what_about_war;
+ break;
+ case 2:
+ pStr[1] = help_us;
+ break;
+ }
+ switch (GET_GAME_STATE (SYREEN_STACK1))
+ {
+ case 0:
+ pStr[2] = what_about_history;
+ break;
+ case 1:
+ pStr[2] = what_about_homeworld;
+ break;
+ case 2:
+ pStr[2] = what_happened;
+ break;
+ }
+ switch (GET_GAME_STATE (SYREEN_STACK2))
+ {
+ case 0:
+ pStr[3] = what_about_outfit;
+ break;
+ case 1:
+ pStr[3] = where_mates;
+ break;
+ case 2:
+ pStr[3] = get_lonely;
+ break;
+ }
+ if (pStr[LastStack])
+ Response (pStr[LastStack], NormalSyreen);
+ for (i = 0; i < 4; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ Response (pStr[i], NormalSyreen);
+ }
+ Response (bye, FriendlyExit);
+}
+
+static void
+InitialSyreen (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, we_are_vice_squad))
+ {
+ NPCPhrase (OK_VICE);
+ NPCPhrase (HOW_CAN_YOU_BE_HERE);
+ }
+ else if (PLAYER_SAID (R, we_are_the_one_for_you_baby))
+ {
+ NPCPhrase (MAYBE_CAPTAIN);
+ NPCPhrase (HOW_CAN_YOU_BE_HERE);
+ }
+ else if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase (WELCOME_VINDICATOR0);
+ if (!usingSpeech)
+ {
+ NPCPhrase (GLOBAL_PLAYER_NAME);
+ NPCPhrase (WELCOME_VINDICATOR1);
+ NPCPhrase (GLOBAL_SHIP_NAME);
+ NPCPhrase (WELCOME_VINDICATOR2);
+ }
+ NPCPhrase (HOW_CAN_YOU_BE_HERE);
+ }
+ else if (PLAYER_SAID (R, we_are_impressed))
+ {
+ NPCPhrase (SO_AM_I_CAPTAIN);
+ NPCPhrase (HOW_CAN_YOU_BE_HERE);
+ }
+ else if (PLAYER_SAID (R, i_need_you))
+ {
+ NPCPhrase (OK_NEED);
+
+ DISABLE_PHRASE (i_need_you);
+ DISABLE_PHRASE (i_need_touch_o_vision);
+ }
+ else if (PLAYER_SAID (R, i_need_touch_o_vision))
+ {
+ NPCPhrase (TOUCH_O_VISION);
+
+ DISABLE_PHRASE (i_need_you);
+ DISABLE_PHRASE (i_need_touch_o_vision);
+ }
+
+ Response (we_here_to_help, NormalSyreen);
+ Response (we_need_help, NormalSyreen);
+ if (PHRASE_ENABLED (i_need_you))
+ Response (i_need_you, InitialSyreen);
+ if (PHRASE_ENABLED (i_need_touch_o_vision))
+ Response (i_need_touch_o_vision, InitialSyreen);
+}
+
+static void
+PlanAmbush (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ NPCPhrase (OK_FOUND_VAULT);
+
+ SET_GAME_STATE (MYCON_AMBUSH, 1);
+ // This is redundant but left here for clarity
+ SET_GAME_STATE (SYREEN_HOME_VISITS, 0);
+
+ Response (whats_my_reward, Foreplay);
+ Response (bye_after_vault, FriendlyExit);
+}
+
+static void
+SyreenVault (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, vault_hint))
+ {
+ NPCPhrase (OK_HINT);
+
+ DISABLE_PHRASE (vault_hint);
+ }
+
+ if (PHRASE_ENABLED (vault_hint))
+ {
+ Response (vault_hint, SyreenVault);
+ }
+ Response (bye_before_vault, FriendlyExit);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ NumVisits = GET_GAME_STATE (SYREEN_HOME_VISITS);
+ if (GET_GAME_STATE (MYCON_KNOW_AMBUSH))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_AFTER_AMBUSH_1);
+ SetRaceAllied (SYREEN_SHIP, TRUE);
+ break;
+ case 1:
+ NPCPhrase (HELLO_AFTER_AMBUSH_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_AFTER_AMBUSH_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_AFTER_AMBUSH_3);
+ --NumVisits;
+ break;
+ }
+
+ AfterAmbush ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (MYCON_AMBUSH))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (READY_FOR_AMBUSH);
+ --NumVisits;
+ break;
+ }
+
+ AmbushReady ((RESPONSE_REF)0);
+ }
+ else if (!GET_GAME_STATE (SYREEN_KNOW_ABOUT_MYCON))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_BEFORE_AMBUSH_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_BEFORE_AMBUSH_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_BEFORE_AMBUSH_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_BEFORE_AMBUSH_4);
+ --NumVisits;
+ break;
+ }
+
+ if (NumVisits > 1)
+ NormalSyreen ((RESPONSE_REF)0);
+ else
+ {
+ construct_response (shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_are_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ Response (we_are_vice_squad, InitialSyreen);
+ Response (we_are_the_one_for_you_baby, InitialSyreen);
+ DoResponsePhrase (we_are_vindicator0, InitialSyreen, shared_phrase_buf);
+ Response (we_are_impressed, InitialSyreen);
+ }
+ }
+#ifdef NEVER
+ else if (!GET_GAME_STATE (SYREEN_SHUTTLE))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (MUST_ACT);
+ --NumVisits;
+ break;
+ }
+
+ SyreenShuttle ((RESPONSE_REF)0);
+ }
+#endif /* NEVER */
+ else if (GET_GAME_STATE (SHIP_VAULT_UNLOCKED))
+ {
+ PlanAmbush ((RESPONSE_REF)0);
+ // XXX: PlanAmbush() sets SYREEN_HOME_VISITS=0, but then this value
+ // is immediately reset to NumVisits just below. The intent was to
+ // reset the HELLO stack so that is what we will do here as well.
+ // Note that it is completely redundant because genvault.c resets
+ // SYREEN_HOME_VISITS when it sets SHIP_VAULT_UNLOCKED=1.
+ NumVisits = 0;
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FOUND_VAULT_YET_1);
+ break;
+ case 1:
+ NPCPhrase (FOUND_VAULT_YET_2);
+ --NumVisits;
+ break;
+ }
+
+ SyreenVault ((RESPONSE_REF)0);
+ }
+ SET_GAME_STATE (SYREEN_HOME_VISITS, NumVisits);
+}
+
+static COUNT
+uninit_syreen (void)
+{
+ return (0);
+}
+
+static void
+post_syreen_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_syreen_comm (void)
+{
+ LOCDATA *retval;
+
+ syreen_desc.init_encounter_func = Intro;
+ syreen_desc.post_encounter_func = post_syreen_enc;
+ syreen_desc.uninit_encounter_func = uninit_syreen;
+
+ syreen_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ syreen_desc.AlienTextBaseline.y = 0;
+ syreen_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ setSegue (Segue_peace);
+ retval = &syreen_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/talkpet/Makeinfo b/src/uqm/comm/talkpet/Makeinfo
new file mode 100644
index 0000000..59f7d27
--- /dev/null
+++ b/src/uqm/comm/talkpet/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="talkpet.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/talkpet/resinst.h b/src/uqm/comm/talkpet/resinst.h
new file mode 100644
index 0000000..20398f9
--- /dev/null
+++ b/src/uqm/comm/talkpet/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define TALKING_PET_COLOR_MAP "comm.talkingpet.colortable"
+#define TALKING_PET_CONVERSATION_PHRASES "comm.talkingpet.dialogue"
+#define TALKING_PET_FONT "comm.talkingpet.font"
+#define TALKING_PET_MUSIC "comm.talkingpet.music"
+#define TALKING_PET_PMAP_ANIM "comm.talkingpet.graphics"
diff --git a/src/uqm/comm/talkpet/strings.h b/src/uqm/comm/talkpet/strings.h
new file mode 100644
index 0000000..01b959a
--- /dev/null
+++ b/src/uqm/comm/talkpet/strings.h
@@ -0,0 +1,140 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef TALKPET_STRINGS_H
+#define TALKPET_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HELLO_AT_UMGAH,
+ what_are_you,
+ JUST_TALKING_PET,
+ talking_pets_dumb,
+ OH_NO_YOU_DONT,
+ what_do_to_umgah,
+ DID_NOTHING,
+ umgah_zombies,
+ WORKS_LIKE_THIS,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ GOOD_FOR_YOU,
+ must_explain_presence,
+ EXPLAIN_NOTHING_MONKEY_BOY,
+ bye_at_umgah,
+ GOODBYE_AT_UMGAH,
+ HYPNOTIZE_AGAIN_1,
+ HYPNOTIZE_AGAIN_2,
+ HYPNOTIZE_AGAIN_3,
+ HYPNOTIZE_AGAIN_4,
+ HYPNO_TAIL,
+ CANT_COMPEL,
+ LETS_MAKE_A_DEAL,
+ what_kind_of_deal,
+ HELP_DEFEAT_URQUAN,
+ ok_lets_do_it,
+ COMING_ABOARD,
+ how_trust,
+ TRUST,
+ boneless_dweeb,
+ YOUR_BONELESS_DWEEB,
+ what_are_you_really,
+ POOR_DNYARRI,
+ hard_to_believe,
+ ITS_TRUE,
+ bullshit,
+ WORTH_A_TRY,
+ kill_you,
+ PLEASE_DONT,
+ must_kill,
+ DONT_KILL,
+ want_kill_1,
+ want_kill_2,
+ want_kill_3,
+ GLAD_YOU_WONT_KILL,
+ whats_up_onboard,
+ GENERAL_INFO_ONBOARD_1,
+ GENERAL_INFO_ONBOARD_2,
+ GENERAL_INFO_ONBOARD_3,
+ GENERAL_INFO_ONBOARD_4,
+ GENERAL_INFO_ONBOARD_5,
+ GENERAL_INFO_ONBOARD_6,
+ GENERAL_INFO_ONBOARD_7,
+ GENERAL_INFO_ONBOARD_8,
+ HELLO_AS_DEVICE_1,
+ HELLO_AS_DEVICE_2,
+ HELLO_AS_DEVICE_3,
+ HELLO_AS_DEVICE_4,
+ HELLO_AS_DEVICE_5,
+ HELLO_AS_DEVICE_6,
+ HELLO_AS_DEVICE_7,
+ HELLO_AS_DEVICE_8,
+ CYBORG_PEP_TALK,
+ HUMAN_PEP_TALK,
+ I_SENSE_MY_SLAVES,
+ HAVENT_GOT_EVERYTHING,
+ NEED_BOMB,
+ SOUP_UP_BOMB,
+ SOUP_UP_FLEET,
+ SOUP_UP_FLAGSHIP,
+ COMEBACK_WHEN_READY,
+ what_now,
+ DO_THIS,
+ compel_urquan,
+ HERE_WE_GO,
+ im_scared,
+ STUPID_FOP,
+ compel_that_ship,
+ SAVING_MY_POWER,
+ any_suggestions,
+ SUGGESTION_1,
+ SUGGESTION_2,
+ SUGGESTION_3,
+ SUGGESTION_4,
+ SUGGESTION_5,
+ SUGGESTION_6,
+ SUGGESTION_7,
+ SUGGESTION_8,
+ about_your_race,
+ WHAT_ABOUT_RACE,
+ you_lied,
+ SO_WHAT,
+ bye_onboard,
+ GOODBYE_ONBOARD,
+ what_about_physiology,
+ NO_TALK_ABOUT_SELF,
+ what_about_powers,
+ NOT_POWERS_BUT_FLOWERS,
+ yes_flowers,
+ GOOD_HUMAN,
+ wish_to_go_now,
+ EXCELLENT_IDEA,
+ what_about_your_history,
+ ABOUT_HISTORY,
+ sentient_milieu,
+ ABOUT_SENTIENT_MILIEU,
+ what_about_war,
+ ABOUT_WAR,
+ enough_info,
+ OK_ENOUGH_INFO,
+ UMGAH_ALL_GONE,
+ HELLO_AFTER_COMPEL_URQUAN,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/talkpet/talkpet.c b/src/uqm/comm/talkpet/talkpet.c
new file mode 100644
index 0000000..ce59011
--- /dev/null
+++ b/src/uqm/comm/talkpet/talkpet.c
@@ -0,0 +1,841 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+
+#define STROBE_RATE 10
+#define STROBE_LENGTH (ONE_SECOND * 3 / 2)
+#define NUM_STROBES (STROBE_LENGTH * STROBE_RATE / ONE_SECOND)
+
+static LOCDATA talkpet_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ TALKING_PET_PMAP_ANIM, /* AlienFrame */
+ TALKING_PET_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ TALKING_PET_COLOR_MAP, /* AlienColorMap */
+ TALKING_PET_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ TALKING_PET_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 17, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 7, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 10, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 16, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Blink right eye */
+ 18, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 13) /* BlockMask */
+ },
+ { /* Blink left eye */
+ 21, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 12) | (1 << 14), /* BlockMask */
+ },
+ {
+ 24, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 26, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 28, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 32, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 35, /* StartIndex */
+ 5, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 40, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 42, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5), /* BlockMask */
+ },
+ { /* Right eyebrow */
+ 48, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4), /* BlockMask */
+ },
+ { /* Left eyebrow */
+ 50, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5), /* BlockMask */
+ },
+ {
+ 52, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Mind control strobe (on-demand) */
+ 1, /* StartIndex */
+ NUM_STROBES * 2, /* NumFrames */
+ CIRCULAR_ANIM | COLORXFORM_ANIM | ONE_SHOT_ANIM
+ | ANIM_DISABLED, /* AnimFlags */
+ ONE_SECOND / (STROBE_RATE * 2), 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 6, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+ SET_GAME_STATE (SHIP_TO_COMPEL, 0);
+
+ if (PLAYER_SAID (R, compel_urquan))
+ {
+ NPCPhrase (HERE_WE_GO);
+
+ SET_GAME_STATE (URQUAN_MESSED_UP, 1);
+ }
+ else if (PLAYER_SAID (R, wish_to_go_now))
+ NPCPhrase (EXCELLENT_IDEA);
+ else if (PLAYER_SAID (R, bye_onboard))
+ NPCPhrase (GOODBYE_ONBOARD);
+ else if (PLAYER_SAID (R, compel_that_ship))
+ NPCPhrase (SAVING_MY_POWER);
+ else if (PLAYER_SAID (R, ok_lets_do_it)
+ || PLAYER_SAID (R, want_kill_1)
+ || PLAYER_SAID (R, want_kill_2)
+ || PLAYER_SAID (R, want_kill_3))
+ {
+ if (PLAYER_SAID (R, ok_lets_do_it))
+ NPCPhrase (COMING_ABOARD);
+ else
+ NPCPhrase (GLAD_YOU_WONT_KILL);
+
+ SET_GAME_STATE (TALKING_PET, 1);
+ SET_GAME_STATE (TALKING_PET_ON_SHIP, 1);
+ SET_GAME_STATE (UMGAH_ZOMBIE_BLOBBIES, 0);
+ SET_GAME_STATE (UMGAH_VISITS, 0);
+ SET_GAME_STATE (UMGAH_HOME_VISITS, 0);
+ SET_GAME_STATE (ARILOU_STACK_2, 0);
+ }
+}
+
+static void
+MindFuckUrquan (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, what_now))
+ {
+ NPCPhrase (DO_THIS);
+
+ DISABLE_PHRASE (what_now);
+ }
+ else if (PLAYER_SAID (R, im_scared))
+ {
+ NPCPhrase (STUPID_FOP);
+
+ DISABLE_PHRASE (im_scared);
+ }
+
+ if (PHRASE_ENABLED (what_now))
+ Response (what_now, MindFuckUrquan);
+ if (PHRASE_ENABLED (im_scared))
+ Response (im_scared, MindFuckUrquan);
+ Response (compel_urquan, ExitConversation);
+}
+
+static void PetDevice (RESPONSE_REF R);
+
+static void
+MindControlStrobe (void)
+{
+ // Enable the one-shot strobe animation
+ CommData.AlienAmbientArray[16].AnimFlags &= ~ANIM_DISABLED;
+}
+
+static void
+MindControl (RESPONSE_REF R)
+{
+ RESPONSE_FUNC RespFunc;
+
+ if (PLAYER_SAID (R, what_about_powers))
+ {
+ NPCPhrase (NOT_POWERS_BUT_FLOWERS);
+
+ RespFunc = (RESPONSE_FUNC)MindControl;
+ R = yes_flowers;
+ }
+ else /* if (R == yes_flowers) */
+ {
+ NPCPhrase (GOOD_HUMAN);
+
+ RespFunc = (RESPONSE_FUNC)ExitConversation;
+ R = wish_to_go_now;
+ }
+
+ AlienTalkSegue ((COUNT)~0);
+ MindControlStrobe ();
+
+ Response (R, RespFunc);
+}
+
+static void
+PetInfo (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, about_your_race))
+ NPCPhrase (WHAT_ABOUT_RACE);
+ else if (PLAYER_SAID (R, what_about_physiology))
+ {
+ NPCPhrase (NO_TALK_ABOUT_SELF);
+
+ DISABLE_PHRASE (what_about_physiology);
+ }
+ else if (PLAYER_SAID (R, what_about_your_history))
+ {
+ NPCPhrase (ABOUT_HISTORY);
+
+ DISABLE_PHRASE (what_about_your_history);
+ }
+ else if (PLAYER_SAID (R, sentient_milieu))
+ {
+ NPCPhrase (ABOUT_SENTIENT_MILIEU);
+
+ DISABLE_PHRASE (sentient_milieu);
+ }
+ else if (PLAYER_SAID (R, what_about_war))
+ {
+ NPCPhrase (ABOUT_WAR);
+
+ DISABLE_PHRASE (what_about_war);
+ }
+
+ if (PHRASE_ENABLED (what_about_physiology))
+ {
+ Response (what_about_physiology, PetInfo);
+ }
+ else
+ {
+ Response (what_about_powers, MindControl);
+ }
+ if (PHRASE_ENABLED (what_about_your_history))
+ Response (what_about_your_history, PetInfo);
+ else if (PHRASE_ENABLED (sentient_milieu))
+ Response (sentient_milieu, PetInfo);
+ else if (PHRASE_ENABLED (what_about_war))
+ Response (what_about_war, PetInfo);
+ Response (enough_info, PetDevice);
+}
+
+static void
+PetDevice (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_onboard))
+ {
+ NumVisits = GET_GAME_STATE (TALKING_PET_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_ONBOARD_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_ONBOARD_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_ONBOARD_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_ONBOARD_4);
+ break;
+ case 4:
+ NPCPhrase (GENERAL_INFO_ONBOARD_5);
+ break;
+ case 5:
+ NPCPhrase (GENERAL_INFO_ONBOARD_6);
+ break;
+ case 6:
+ NPCPhrase (GENERAL_INFO_ONBOARD_7);
+ break;
+ case 7:
+ NPCPhrase (GENERAL_INFO_ONBOARD_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (TALKING_PET_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_onboard);
+ }
+ else if (PLAYER_SAID (R, any_suggestions))
+ {
+ NumVisits = GET_GAME_STATE (TALKING_PET_SUGGESTIONS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (SUGGESTION_1);
+ break;
+ case 1:
+ NPCPhrase (SUGGESTION_2);
+ break;
+ case 2:
+ NPCPhrase (SUGGESTION_3);
+ break;
+ case 3:
+ NPCPhrase (SUGGESTION_4);
+ break;
+ case 4:
+ NPCPhrase (SUGGESTION_5);
+ break;
+ case 5:
+ NPCPhrase (SUGGESTION_6);
+ break;
+ case 6:
+ NPCPhrase (SUGGESTION_7);
+ break;
+ case 7:
+ NPCPhrase (SUGGESTION_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (TALKING_PET_SUGGESTIONS, NumVisits);
+
+ DISABLE_PHRASE (any_suggestions);
+ }
+ else if (PLAYER_SAID (R, enough_info))
+ NPCPhrase (OK_ENOUGH_INFO);
+ else if (PLAYER_SAID (R, you_lied))
+ {
+ NPCPhrase (SO_WHAT);
+
+ SET_GAME_STATE (DNYARRI_LIED, 0);
+ }
+
+ if (GET_GAME_STATE (SHIP_TO_COMPEL))
+ {
+ Response (compel_that_ship, ExitConversation);
+ }
+ if (PHRASE_ENABLED (whats_up_onboard))
+ Response (whats_up_onboard, PetDevice);
+ if (PHRASE_ENABLED (any_suggestions))
+ Response (any_suggestions, PetDevice);
+ Response (about_your_race, PetInfo);
+ if (GET_GAME_STATE (DNYARRI_LIED) && GET_GAME_STATE (LEARNED_TALKING_PET))
+ Response (you_lied, PetDevice);
+ Response (bye_onboard, ExitConversation);
+}
+
+static void
+CompelPlayer (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[3];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (PLAYER_SAID (R, what_are_you))
+ {
+ NPCPhrase (JUST_TALKING_PET);
+
+ DISABLE_PHRASE (what_are_you);
+ }
+ else if (PLAYER_SAID (R, what_do_to_umgah))
+ {
+ NPCPhrase (DID_NOTHING);
+
+ DISABLE_PHRASE (what_do_to_umgah);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase (GOOD_FOR_YOU);
+
+ DISABLE_PHRASE (we_are_vindicator0);
+ LastStack = 2;
+ }
+ else if (R != 0)
+ {
+ if (PLAYER_SAID (R, bye_at_umgah))
+ NPCPhrase (GOODBYE_AT_UMGAH);
+ else if (PLAYER_SAID (R, must_explain_presence))
+ NPCPhrase (EXPLAIN_NOTHING_MONKEY_BOY);
+ else if (PLAYER_SAID (R, umgah_zombies))
+ NPCPhrase (WORKS_LIKE_THIS);
+ else if (PLAYER_SAID (R, talking_pets_dumb))
+ NPCPhrase (OH_NO_YOU_DONT);
+
+ SET_GAME_STATE (KNOW_UMGAH_ZOMBIES, 1);
+ if (!GET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP))
+ {
+ SET_GAME_STATE (PLAYER_HYPNOTIZED, 1);
+ }
+ else
+ {
+ NPCPhrase (CANT_COMPEL);
+
+ setSegue (Segue_hostile);
+ }
+
+ return;
+ }
+
+ if (PHRASE_ENABLED (what_are_you))
+ pStr[0] = what_are_you;
+ else
+ pStr[0] = talking_pets_dumb;
+ if (GET_GAME_STATE (KNOW_UMGAH_ZOMBIES))
+ {
+ if (PHRASE_ENABLED (what_do_to_umgah))
+ pStr[1] = what_do_to_umgah;
+ else
+ pStr[1] = umgah_zombies;
+ }
+ if (PHRASE_ENABLED (we_are_vindicator0))
+ {
+ construct_response (
+ shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator1,
+ (UNICODE*)NULL);
+ pStr[2] = we_are_vindicator0;
+ }
+ else
+ pStr[2] = must_explain_presence;
+
+ if (pStr[LastStack])
+ {
+ if (pStr[LastStack] != we_are_vindicator0)
+ Response (pStr[LastStack], CompelPlayer);
+ else
+ DoResponsePhrase (pStr[LastStack], CompelPlayer, shared_phrase_buf);
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (pStr[i] != we_are_vindicator0)
+ Response (pStr[i], CompelPlayer);
+ else
+ DoResponsePhrase (pStr[i], CompelPlayer, shared_phrase_buf);
+ }
+ }
+ Response (bye_at_umgah, CompelPlayer);
+}
+
+static void PetDeal (RESPONSE_REF R);
+
+static void
+KillPet (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, must_kill))
+ {
+ NPCPhrase (DONT_KILL);
+ AlienTalkSegue ((COUNT)~0);
+
+ MindControlStrobe ();
+ }
+
+ Response (want_kill_1, ExitConversation);
+ Response (want_kill_2, ExitConversation);
+ Response (want_kill_3, ExitConversation);
+}
+
+static void
+PetDeal (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, what_kind_of_deal))
+ {
+ NPCPhrase (HELP_DEFEAT_URQUAN);
+
+ DISABLE_PHRASE (what_kind_of_deal);
+ }
+ else if (PLAYER_SAID (R, how_trust))
+ {
+ NPCPhrase (TRUST);
+
+ DISABLE_PHRASE (how_trust);
+ }
+ else if (PLAYER_SAID (R, boneless_dweeb))
+ {
+ NPCPhrase (YOUR_BONELESS_DWEEB);
+
+ DISABLE_PHRASE (boneless_dweeb);
+ }
+ else if (PLAYER_SAID (R, what_are_you_really))
+ {
+ NPCPhrase (POOR_DNYARRI);
+
+ DISABLE_PHRASE (what_are_you_really);
+ }
+ else if (PLAYER_SAID (R, hard_to_believe))
+ {
+ NPCPhrase (ITS_TRUE);
+
+ SET_GAME_STATE (DNYARRI_LIED, 1);
+ DISABLE_PHRASE (hard_to_believe);
+ }
+ else if (PLAYER_SAID (R, bullshit))
+ {
+ NPCPhrase (WORTH_A_TRY);
+
+ DISABLE_PHRASE (bullshit);
+ }
+ else if (PLAYER_SAID (R, kill_you))
+ {
+ NPCPhrase (PLEASE_DONT);
+
+ DISABLE_PHRASE (kill_you);
+ }
+
+ if (PHRASE_ENABLED (what_kind_of_deal))
+ Response (what_kind_of_deal, PetDeal);
+ else
+ {
+ if (PHRASE_ENABLED (how_trust))
+ Response (how_trust, PetDeal);
+ else if (PHRASE_ENABLED (boneless_dweeb))
+ Response (boneless_dweeb, PetDeal);
+ Response (ok_lets_do_it, ExitConversation);
+ }
+ if (PHRASE_ENABLED (what_are_you_really))
+ Response (what_are_you_really, PetDeal);
+ else
+ {
+ if (PHRASE_ENABLED (hard_to_believe) && !GET_GAME_STATE (LEARNED_TALKING_PET))
+ Response (hard_to_believe, PetDeal);
+ else if (PHRASE_ENABLED (bullshit) && GET_GAME_STATE (LEARNED_TALKING_PET))
+ Response (bullshit, PetDeal);
+ }
+ if (PHRASE_ENABLED (kill_you))
+ Response (kill_you, PetDeal);
+ else if (PHRASE_ENABLED (must_kill))
+ {
+ Response (must_kill, KillPet);
+ }
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
+ {
+ SET_GAME_STATE (SHIP_TO_COMPEL, 0);
+ setSegue (Segue_hostile);
+ if (!(GLOBAL (glob_flags) & CYBORG_ENABLED))
+ {
+ NPCPhrase (HUMAN_PEP_TALK);
+ }
+ else
+ {
+ NPCPhrase (CYBORG_PEP_TALK);
+ }
+ }
+ else if (GET_GAME_STATE (READY_TO_CONFUSE_URQUAN))
+ {
+ SET_GAME_STATE (SHIP_TO_COMPEL, 0);
+ SET_GAME_STATE (READY_TO_CONFUSE_URQUAN, 0);
+ SET_GAME_STATE (AWARE_OF_SAMATRA, 1);
+ if (GET_GAME_STATE (CHMMR_BOMB_STATE) != 3)
+ {
+ NPCPhrase (HAVENT_GOT_EVERYTHING);
+ if (!GET_GAME_STATE (UTWIG_BOMB_ON_SHIP))
+ NPCPhrase (NEED_BOMB);
+ else
+ NPCPhrase (SOUP_UP_BOMB);
+
+ setSegue (Segue_peace);
+ }
+ else if (GET_GAME_STATE (URQUAN_MESSED_UP))
+ {
+ NPCPhrase (HELLO_AFTER_COMPEL_URQUAN);
+
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ NPCPhrase (I_SENSE_MY_SLAVES);
+
+ MindFuckUrquan ((RESPONSE_REF)0);
+ }
+ }
+ else if (GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ {
+ NumVisits = GET_GAME_STATE (TALKING_PET_VISITS);
+
+ // You can acquire the Talking Pet without having Taalo Shield after
+ // the Kohr-Ah wipe out the Umgah. In that case, the Pet will join
+ // you willingly, but his complaints about the Taalo shield as in
+ // HELLO_AS_DEVICE_1 do not make any sense.
+ if (!GET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP) && NumVisits == 0)
+ ++NumVisits; // skip HELLO_AS_DEVICE_1
+
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_AS_DEVICE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_AS_DEVICE_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_AS_DEVICE_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_AS_DEVICE_4);
+ break;
+ case 4:
+ NPCPhrase (HELLO_AS_DEVICE_5);
+ break;
+ case 5:
+ NPCPhrase (HELLO_AS_DEVICE_6);
+ break;
+ case 6:
+ NPCPhrase (HELLO_AS_DEVICE_7);
+ break;
+ case 7:
+ NPCPhrase (HELLO_AS_DEVICE_8);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (TALKING_PET_VISITS, NumVisits);
+
+ PetDevice ((RESPONSE_REF)0);
+ }
+ else if (GetHeadLink (&GLOBAL (npc_built_ship_q)))
+ {
+ NumVisits = GET_GAME_STATE (TALKING_PET_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ SET_GAME_STATE (UMGAH_VISITS, 0);
+ NPCPhrase (HELLO_AT_UMGAH);
+ break;
+ case 1:
+ NPCPhrase (HYPNOTIZE_AGAIN_1);
+ break;
+ case 2:
+ NPCPhrase (HYPNOTIZE_AGAIN_2);
+ break;
+ case 3:
+ NPCPhrase (HYPNOTIZE_AGAIN_3);
+ break;
+ case 4:
+ NPCPhrase (HYPNOTIZE_AGAIN_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (TALKING_PET_HOME_VISITS, NumVisits);
+
+ if (NumVisits == 1)
+ {
+ CompelPlayer ((RESPONSE_REF)0);
+ }
+ else if (!GET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP))
+ {
+ SET_GAME_STATE (PLAYER_HYPNOTIZED, 1);
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ NPCPhrase (CANT_COMPEL);
+
+ setSegue (Segue_hostile);
+ }
+ }
+ else
+ {
+ if (StartSphereTracking (UMGAH_SHIP))
+ {
+ NPCPhrase (LETS_MAKE_A_DEAL);
+ }
+ else
+ {
+ NPCPhrase (UMGAH_ALL_GONE);
+
+ if (GET_GAME_STATE (TALKING_PET_HOME_VISITS) == 0
+ || !GET_GAME_STATE (TAALO_PROTECTOR_ON_SHIP))
+ { // The how_trust-TRUST exchange only makes sense when the
+ // player visited the Talking Pet before so he tried to
+ // kill the player *and* the player has the Taalo shield.
+ DISABLE_PHRASE (how_trust);
+ }
+ }
+
+ PetDeal ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_talkpet (void)
+{
+ return (0);
+}
+
+static void
+post_talkpet_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_talkpet_comm (void)
+{
+ LOCDATA *retval;
+
+ talkpet_desc.init_encounter_func = Intro;
+ talkpet_desc.post_encounter_func = post_talkpet_enc;
+ talkpet_desc.uninit_encounter_func = uninit_talkpet;
+
+ talkpet_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ talkpet_desc.AlienTextBaseline.y = 0;
+ talkpet_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) != IN_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+
+ retval = &talkpet_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/thradd/Makeinfo b/src/uqm/comm/thradd/Makeinfo
new file mode 100644
index 0000000..d492800
--- /dev/null
+++ b/src/uqm/comm/thradd/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="thraddc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/thradd/resinst.h b/src/uqm/comm/thradd/resinst.h
new file mode 100644
index 0000000..977f175
--- /dev/null
+++ b/src/uqm/comm/thradd/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define THRADD_COLOR_MAP "comm.thraddash.colortable"
+#define THRADD_CONVERSATION_PHRASES "comm.thraddash.dialogue"
+#define THRADD_FONT "comm.thraddash.font"
+#define THRADD_MUSIC "comm.thraddash.music"
+#define THRADD_PMAP_ANIM "comm.thraddash.graphics"
diff --git a/src/uqm/comm/thradd/strings.h b/src/uqm/comm/thradd/strings.h
new file mode 100644
index 0000000..20e4701
--- /dev/null
+++ b/src/uqm/comm/thradd/strings.h
@@ -0,0 +1,181 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef THRADD_STRINGS_H
+#define THRADD_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HOSTILE_SPACE_HELLO_1,
+ HOSTILE_SPACE_HELLO_2,
+ HOSTILE_SPACE_HELLO_3,
+ HOSTILE_SPACE_HELLO_4,
+ HOSTILE_HOMEWORLD_HELLO_1,
+ HOSTILE_HOMEWORLD_HELLO_2,
+ HOSTILE_HOMEWORLD_HELLO_3,
+ HOSTILE_HOMEWORLD_HELLO_4,
+ whats_up_hostile_1,
+ whats_up_hostile_2,
+ GENERAL_INFO_HOSTILE_1,
+ GENERAL_INFO_HOSTILE_2,
+ GENERAL_INFO_HOSTILE_3,
+ GENERAL_INFO_HOSTILE_4,
+ what_about_you_1,
+ ABOUT_US_1,
+ what_about_you_2,
+ ABOUT_US_2,
+ what_about_urquan_1,
+ ABOUT_URQUAN_1,
+ what_about_urquan_2,
+ ABOUT_URQUAN_2,
+ got_idea,
+ GOOD_IDEA,
+ WE_GO_TO_IMPRESS_URQUAN_1,
+ WE_GO_TO_IMPRESS_URQUAN_2,
+ WE_IMPRESSING_URQUAN_1,
+ WE_IMPRESSING_URQUAN_2,
+ WE_IMPRESSED_URQUAN_1,
+ WE_IMPRESSED_URQUAN_2,
+ HOSTILE_HELIX_HELLO_1,
+ HOSTILE_HELIX_HELLO_2,
+ submit_1,
+ NO_SUBMIT_1,
+ submit_2,
+ NO_SUBMIT_2,
+ be_friends_1,
+ NO_FRIENDS_1,
+ be_friends_2,
+ NO_FRIENDS_2,
+ how_impressed_urquan_1,
+ IMPRESSED_LIKE_SO_1,
+ how_impressed_urquan_2,
+ IMPRESSED_LIKE_SO_2,
+ bye_hostile_1,
+ GOODBYE_HOSTILE_1,
+ bye_hostile_2,
+ GOODBYE_HOSTILE_2,
+ why_you_here_hostile,
+ NONE_OF_YOUR_CONCERN,
+ demand_to_land,
+ NO_DEMAND,
+ what_about_this_world,
+ BLUE_HELIX,
+ whats_helix_hostile,
+ HELIX_IS_HOSTILE,
+ i_need_to_land_lie,
+ CAUGHT_LIE,
+ bye_hostile_helix,
+ GOODBYE_HOSTILE_HELIX,
+ DIE_THIEF_1,
+ DIE_THIEF_2,
+ AMAZING_PERFORMANCE,
+ IMPRESSIVE_PERFORMANCE,
+ ADEQUATE_PERFORMANCE,
+ HELLO_POLITE_1,
+ HELLO_POLITE_2,
+ HELLO_POLITE_3,
+ HELLO_POLITE_4,
+ HELLO_RHYME_1,
+ HELLO_RHYME_2,
+ HELLO_RHYME_3,
+ HELLO_RHYME_4,
+ HELLO_PIG_LATIN_1,
+ HELLO_PIG_LATIN_2,
+ HELLO_PIG_LATIN_3,
+ HELLO_PIG_LATIN_4,
+ HELLO_LIKE_YOU_1,
+ HELLO_LIKE_YOU_2,
+ HELLO_LIKE_YOU_3,
+ HELLO_LIKE_YOU_4,
+ WELCOME_SPACE0,
+ WELCOME_SPACE1,
+ WELCOME_HOMEWORLD0,
+ WELCOME_HOMEWORLD1,
+ WELCOME_HELIX0,
+ WELCOME_HELIX1,
+ why_you_here_ally,
+ GUARDING_HELIX_ALLY,
+ whats_helix_ally,
+ HELIX_IS_ALLY,
+ may_i_land,
+ SURE_LAND,
+ whats_up_ally,
+ GENERAL_INFO_ALLY_1,
+ GENERAL_INFO_ALLY_2,
+ GENERAL_INFO_ALLY_3,
+ GENERAL_INFO_ALLY_4,
+ HOW_SHOULD_WE_ACT,
+ friendly,
+ OK_FRIENDLY,
+ wacky,
+ OK_WACKY,
+ just_like_us,
+ OK_JUST_LIKE_YOU,
+ WORK_TO_DO,
+ contemplative,
+ OK_CONTEMPLATIVE,
+ how_goes_culture,
+ CONTEMP_GOES_1,
+ CONTEMP_GOES_2,
+ FRIENDLY_GOES_1,
+ FRIENDLY_GOES_2,
+ WACKY_GOES_1,
+ WACKY_GOES_2,
+ LIKE_YOU_GOES_1,
+ LIKE_YOU_GOES_2,
+ bye_ally,
+ GOODBYE_ALLY_1,
+ GOODBYE_ALLY_2,
+ GOODBYE_ALLY_3,
+ GOODBYE_ALLY_4,
+ be_polite,
+ OK_POLITE,
+ speak_pig_latin,
+ OK_PIG_LATIN,
+ use_rhymes,
+ OK_RHYMES,
+ just_the_way_we_do,
+ OK_WAY_YOU_DO,
+ WHAT_NAME_FOR_CULTURE,
+ alliance_name,
+ OK_ALLIANCE_NAME,
+ NAME_TAIL,
+ you_decide,
+ OK_CULTURE_20,
+ fat,
+ OK_FAT,
+ the_slave_empire0,
+ the_slave_empire1,
+ OK_SLAVE,
+ FAT_JERKS,
+ CULTURE,
+ SLAVE_EMPIRE,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ HAVING_FUN_WITH_ILWRATH_1,
+ HAVING_FUN_WITH_ILWRATH_2,
+ GO_AWAY_FIGHTING_ILWRATH_1,
+ GO_AWAY_FIGHTING_ILWRATH_2,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/thradd/thraddc.c b/src/uqm/comm/thradd/thraddc.c
new file mode 100644
index 0000000..1be8a1e
--- /dev/null
+++ b/src/uqm/comm/thradd/thraddc.c
@@ -0,0 +1,954 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/gameev.h"
+
+
+static LOCDATA thradd_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ THRADD_PMAP_ANIM, /* AlienFrame */
+ THRADD_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ THRADD_COLOR_MAP, /* AlienColorMap */
+ THRADD_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ THRADD_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 8, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 8, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* RestartRate */
+ (1 << 4), /* BlockMask */
+ },
+ {
+ 12, /* StartIndex */
+ 9, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 21, /* StartIndex */
+ 6, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 27, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4), /* BlockMask */
+ },
+ {
+ 30, /* StartIndex */
+ 12, /* NumFrames */
+ CIRCULAR_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND, /* RestartRate */
+ (1 << 0) | (1 << 3) | (1 << 5),
+ },
+ {
+ 42, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4) | (1 << 6), /* BlockMask */
+ },
+ {
+ 47, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5), /* BlockMask */
+ },
+ {
+ 52, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND / 20, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 7, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static int
+GetCultureName (void)
+{
+ int culture = 0;
+
+ switch (GET_GAME_STATE (THRADD_CULTURE))
+ {
+ case 1:
+ culture = CULTURE;
+ break;
+ case 2:
+ culture = FAT_JERKS;
+ break;
+ case 3:
+ culture = SLAVE_EMPIRE;
+ break;
+ default:
+ assert (0 && "Unknown culture");
+ }
+
+ return (culture);
+}
+
+static void
+PolitePhrase (BYTE which_phrase)
+{
+ switch (which_phrase)
+ {
+ case 0:
+ NPCPhrase (HELLO_POLITE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_POLITE_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_POLITE_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_POLITE_4);
+ break;
+ }
+}
+
+static void
+RhymePhrase (BYTE which_phrase)
+{
+ switch (which_phrase)
+ {
+ case 0:
+ NPCPhrase (HELLO_RHYME_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_RHYME_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_RHYME_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_RHYME_4);
+ break;
+ }
+}
+
+static void
+PigLatinPhrase (BYTE which_phrase)
+{
+ switch (which_phrase)
+ {
+ case 0:
+ NPCPhrase (HELLO_PIG_LATIN_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_PIG_LATIN_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_PIG_LATIN_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_PIG_LATIN_4);
+ break;
+ }
+}
+
+static void
+LikeYouPhrase (BYTE which_phrase)
+{
+ switch (which_phrase)
+ {
+ case 0:
+ NPCPhrase (HELLO_LIKE_YOU_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_LIKE_YOU_2);
+ break;
+ case 2:
+ NPCPhrase (HELLO_LIKE_YOU_3);
+ break;
+ case 3:
+ NPCPhrase (HELLO_LIKE_YOU_4);
+ break;
+ }
+}
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, bye_hostile_2))
+ NPCPhrase (GOODBYE_HOSTILE_2);
+ else if (PLAYER_SAID (R, bye_hostile_1))
+ {
+ NPCPhrase (GOODBYE_HOSTILE_1);
+
+ SET_GAME_STATE (THRADD_HOSTILE_STACK_5, 1);
+ }
+ else if (PLAYER_SAID (R, submit_1))
+ {
+ NPCPhrase (NO_SUBMIT_1);
+
+ SET_GAME_STATE (THRADD_HOSTILE_STACK_2, 1);
+ }
+ else if (PLAYER_SAID (R, submit_2))
+ NPCPhrase (NO_SUBMIT_2);
+ else if (PLAYER_SAID (R, got_idea))
+ {
+ NPCPhrase (GOOD_IDEA);
+
+ setSegue (Segue_peace);
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_THRADD_MISSION);
+ SET_GAME_STATE (THRADD_STACK_1, 5);
+ }
+ else if (PLAYER_SAID (R, bye_hostile_helix))
+ NPCPhrase (GOODBYE_HOSTILE_HELIX);
+ else if (PLAYER_SAID (R, bye_ally))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (THRADD_STACK_1);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GOODBYE_ALLY_1);
+ break;
+ case 1:
+ NPCPhrase (GOODBYE_ALLY_2);
+ break;
+ case 2:
+ NPCPhrase (GOODBYE_ALLY_3);
+ break;
+ case 3:
+ NPCPhrase (GOODBYE_ALLY_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (THRADD_STACK_1, NumVisits);
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, may_i_land))
+ {
+ NPCPhrase (SURE_LAND);
+
+ SET_GAME_STATE (HELIX_UNPROTECTED, 1);
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, demand_to_land))
+ NPCPhrase (NO_DEMAND);
+ else if (PLAYER_SAID (R, i_need_to_land_lie))
+ NPCPhrase (CAUGHT_LIE);
+ else
+ {
+ if (PLAYER_SAID (R, contemplative))
+ {
+ NPCPhrase (OK_CONTEMPLATIVE);
+
+ SET_GAME_STATE (THRADD_DEMEANOR, 0);
+ }
+ else if (PLAYER_SAID (R, friendly))
+ {
+ NPCPhrase (OK_FRIENDLY);
+
+ SET_GAME_STATE (THRADD_DEMEANOR, 1);
+ }
+ else if (PLAYER_SAID (R, wacky))
+ {
+ NPCPhrase (OK_WACKY);
+
+ SET_GAME_STATE (THRADD_DEMEANOR, 2);
+ }
+ else if (PLAYER_SAID (R, just_like_us))
+ {
+ NPCPhrase (OK_JUST_LIKE_YOU);
+
+ SET_GAME_STATE (THRADD_DEMEANOR, 3);
+ }
+ NPCPhrase (WORK_TO_DO);
+
+ setSegue (Segue_peace);
+ }
+}
+
+static void
+ThraddAllies (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, why_you_here_ally))
+ {
+ NPCPhrase (GUARDING_HELIX_ALLY);
+
+ DISABLE_PHRASE (why_you_here_ally);
+ }
+ else if (PLAYER_SAID (R, whats_helix_ally))
+ {
+ NPCPhrase (HELIX_IS_ALLY);
+
+ DISABLE_PHRASE (whats_helix_ally);
+ }
+ else if (PLAYER_SAID (R, whats_up_ally))
+ {
+ NumVisits = GET_GAME_STATE (THRADD_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_ALLY_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_ALLY_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_ALLY_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_ALLY_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (THRADD_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_ally);
+ }
+ else if (PLAYER_SAID (R, how_goes_culture))
+ {
+ NumVisits = GET_GAME_STATE (THRADD_DEMEANOR);
+ switch (NumVisits & ((1 << 2) - 1))
+ {
+ case 0:
+ if (!(NumVisits & ~((1 << 2) - 1)))
+ NPCPhrase (CONTEMP_GOES_1);
+ else
+ NPCPhrase (CONTEMP_GOES_2);
+ break;
+ case 1:
+ if (!(NumVisits & ~((1 << 2) - 1)))
+ NPCPhrase (FRIENDLY_GOES_1);
+ else
+ NPCPhrase (FRIENDLY_GOES_2);
+ break;
+ case 2:
+ if (!(NumVisits & ~((1 << 2) - 1)))
+ NPCPhrase (WACKY_GOES_1);
+ else
+ NPCPhrase (WACKY_GOES_2);
+ break;
+ case 3:
+ if (!(NumVisits & ~((1 << 2) - 1)))
+ NPCPhrase (LIKE_YOU_GOES_1);
+ else
+ NPCPhrase (LIKE_YOU_GOES_2);
+ break;
+ }
+ NumVisits |= 1 << 2;
+ SET_GAME_STATE (THRADD_DEMEANOR, NumVisits);
+
+ DISABLE_PHRASE (how_goes_culture);
+ }
+
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ if (PHRASE_ENABLED (why_you_here_ally))
+ Response (why_you_here_ally, ThraddAllies);
+ else
+ {
+ if (PHRASE_ENABLED (whats_helix_ally))
+ Response (whats_helix_ally, ThraddAllies);
+ Response (may_i_land, ExitConversation);
+ }
+ }
+ if (PHRASE_ENABLED (whats_up_ally))
+ Response (whats_up_ally, ThraddAllies);
+ if (PHRASE_ENABLED (how_goes_culture))
+ Response (how_goes_culture, ThraddAllies);
+ Response (bye_ally, ExitConversation);
+}
+
+static void
+ThraddDemeanor (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, you_decide))
+ {
+ NPCPhrase (OK_CULTURE_20);
+
+ SET_GAME_STATE (THRADD_CULTURE, 1);
+ }
+ else if (PLAYER_SAID (R, fat))
+ {
+ NPCPhrase (OK_FAT);
+
+ SET_GAME_STATE (THRADD_CULTURE, 2);
+ }
+ else if (PLAYER_SAID (R, the_slave_empire0))
+ {
+ SET_GAME_STATE (THRADD_CULTURE, 3);
+
+ NPCPhrase (OK_SLAVE);
+ }
+
+ NPCPhrase (HOW_SHOULD_WE_ACT);
+ Response (contemplative, ExitConversation);
+ Response (friendly, ExitConversation);
+ Response (wacky, ExitConversation);
+ Response (just_like_us, ExitConversation);
+}
+
+static void
+ThraddCulture (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, be_polite))
+ {
+ NPCPhrase (OK_POLITE);
+
+ SET_GAME_STATE (THRADD_INTRO, 0);
+ }
+ else if (PLAYER_SAID (R, use_rhymes))
+ {
+ NPCPhrase (OK_RHYMES);
+
+ SET_GAME_STATE (THRADD_INTRO, 1);
+ }
+ else if (PLAYER_SAID (R, speak_pig_latin))
+ {
+ NPCPhrase (OK_PIG_LATIN);
+
+ SET_GAME_STATE (THRADD_INTRO, 2);
+ }
+ else if (PLAYER_SAID (R, just_the_way_we_do))
+ {
+ NPCPhrase (OK_WAY_YOU_DO);
+
+ SET_GAME_STATE (THRADD_INTRO, 3);
+ }
+ NPCPhrase (WHAT_NAME_FOR_CULTURE);
+
+ construct_response (
+ shared_phrase_buf,
+ the_slave_empire0,
+ GLOBAL_SIS (CommanderName),
+ the_slave_empire1,
+ (UNICODE*)NULL);
+
+ Response (you_decide, ThraddDemeanor);
+ Response (fat, ThraddDemeanor);
+ DoResponsePhrase (the_slave_empire0, ThraddDemeanor, shared_phrase_buf);
+}
+
+static void
+ThraddWorship (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ SET_GAME_STATE (THRADD_VISITS, 0);
+ SET_GAME_STATE (THRADD_MANNER, 1);
+ SET_GAME_STATE (THRADD_STACK_1, 0);
+ SetRaceAllied (THRADDASH_SHIP, TRUE);
+
+ Response (be_polite, ThraddCulture);
+ Response (speak_pig_latin, ThraddCulture);
+ Response (use_rhymes, ThraddCulture);
+ Response (just_the_way_we_do, ThraddCulture);
+}
+
+static void
+HelixWorld (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, why_you_here_hostile))
+ {
+ NPCPhrase (NONE_OF_YOUR_CONCERN);
+
+ SET_GAME_STATE (THRADD_CULTURE, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_this_world))
+ {
+ NPCPhrase (BLUE_HELIX);
+
+ SET_GAME_STATE (THRADD_INTRO, 1);
+ }
+ else if (PLAYER_SAID (R, whats_helix_hostile))
+ {
+ NPCPhrase (HELIX_IS_HOSTILE);
+
+ SET_GAME_STATE (THRADD_INTRO, 2);
+ }
+ else if (PLAYER_SAID (R, i_need_to_land_lie))
+ {
+ NPCPhrase (CAUGHT_LIE);
+
+ SET_GAME_STATE (THRADD_DEMEANOR, 1);
+ }
+
+ if (!GET_GAME_STATE (THRADD_CULTURE))
+ Response (why_you_here_hostile, HelixWorld);
+ else
+ {
+ Response (demand_to_land, ExitConversation);
+ }
+ switch (GET_GAME_STATE (THRADD_INTRO))
+ {
+ case 0:
+ Response (what_about_this_world, HelixWorld);
+ break;
+ case 1:
+ Response (whats_helix_hostile, HelixWorld);
+ break;
+ }
+ if (!GET_GAME_STATE (THRADD_DEMEANOR))
+ {
+ Response (i_need_to_land_lie, ExitConversation);
+ }
+ Response (bye_hostile_helix, ExitConversation);
+}
+
+static void
+ThraddHostile (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_hostile_1))
+ {
+ NPCPhrase (GENERAL_INFO_HOSTILE_1);
+
+ SET_GAME_STATE (THRADD_INFO, 1);
+ DISABLE_PHRASE (whats_up_hostile_2);
+ }
+ else if (PLAYER_SAID (R, whats_up_hostile_2))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (THRADD_INFO);
+ switch (NumVisits++)
+ {
+ case 1:
+ NPCPhrase (GENERAL_INFO_HOSTILE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_HOSTILE_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_HOSTILE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (THRADD_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_hostile_2);
+ }
+ else if (PLAYER_SAID (R, what_about_you_1))
+ {
+ NPCPhrase (ABOUT_US_1);
+
+ SET_GAME_STATE (THRADD_STACK_1, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_you_2))
+ {
+ NPCPhrase (ABOUT_US_2);
+
+ SET_GAME_STATE (THRADD_STACK_1, 2);
+ }
+ else if (PLAYER_SAID (R, what_about_urquan_1))
+ {
+ NPCPhrase (ABOUT_URQUAN_1);
+
+ SET_GAME_STATE (THRADD_STACK_1, 3);
+ }
+ else if (PLAYER_SAID (R, what_about_urquan_2))
+ {
+ NPCPhrase (ABOUT_URQUAN_2);
+
+ SET_GAME_STATE (THRADD_STACK_1, 4);
+ }
+ else if (PLAYER_SAID (R, be_friends_1))
+ {
+ NPCPhrase (NO_FRIENDS_1);
+
+ SET_GAME_STATE (THRADD_HOSTILE_STACK_3, 1);
+ }
+ else if (PLAYER_SAID (R, be_friends_2))
+ {
+ NPCPhrase (NO_FRIENDS_2);
+ DISABLE_PHRASE (be_friends_2);
+ }
+ else if (PLAYER_SAID (R, how_impressed_urquan_1))
+ {
+ NPCPhrase (IMPRESSED_LIKE_SO_1);
+
+ SET_GAME_STATE (THRADD_HOSTILE_STACK_4, 1);
+ }
+ else if (PLAYER_SAID (R, how_impressed_urquan_2))
+ {
+ NPCPhrase (IMPRESSED_LIKE_SO_2);
+
+ SET_GAME_STATE (THRADD_MISSION, 5);
+ }
+
+ if (GET_GAME_STATE (THRADD_INFO) == 0)
+ Response (whats_up_hostile_1, ThraddHostile);
+ else if (PHRASE_ENABLED (whats_up_hostile_2))
+ Response (whats_up_hostile_2, ThraddHostile);
+ switch (GET_GAME_STATE (THRADD_STACK_1))
+ {
+ case 0:
+ Response (what_about_you_1, ThraddHostile);
+ break;
+ case 1:
+ Response (what_about_you_2, ThraddHostile);
+ break;
+ case 2:
+ Response (what_about_urquan_1, ThraddHostile);
+ break;
+ case 3:
+ Response (what_about_urquan_2, ThraddHostile);
+ break;
+ case 4:
+ if (!GET_GAME_STATE (KOHR_AH_FRENZY))
+ Response (got_idea, ExitConversation);
+ else
+ {
+ SET_GAME_STATE (THRADD_STACK_1, 5);
+ }
+ break;
+ }
+ if (GET_GAME_STATE (THRADD_HOSTILE_STACK_2) == 0)
+ Response (submit_1, ExitConversation);
+ else
+ Response (submit_2, ExitConversation);
+ if (GET_GAME_STATE (THRADD_HOSTILE_STACK_3) == 0)
+ Response (be_friends_1, ThraddHostile);
+ else if (PHRASE_ENABLED (be_friends_2))
+ Response (be_friends_2, ThraddHostile);
+ if (GET_GAME_STATE (THRADD_MISSION) == 4)
+ {
+ if (GET_GAME_STATE (THRADD_HOSTILE_STACK_4) == 0)
+ Response (how_impressed_urquan_1, ThraddHostile);
+ else
+ Response (how_impressed_urquan_2, ThraddHostile);
+ }
+ if (GET_GAME_STATE (THRADD_HOSTILE_STACK_5) == 0)
+ Response (bye_hostile_1, ExitConversation);
+ else
+ Response (bye_hostile_2, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (AQUA_HELIX))
+ {
+ NumVisits = GET_GAME_STATE (HELIX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (DIE_THIEF_1);
+ break;
+ case 1:
+ NPCPhrase (DIE_THIEF_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (HELIX_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (ILWRATH_FIGHT_THRADDASH))
+ {
+ NumVisits = GET_GAME_STATE (THRADD_VISITS);
+ if (GET_GAME_STATE (THRADD_MANNER))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HAVING_FUN_WITH_ILWRATH_1);
+ break;
+ case 1:
+ NPCPhrase (HAVING_FUN_WITH_ILWRATH_2);
+ --NumVisits;
+ break;
+ }
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GO_AWAY_FIGHTING_ILWRATH_1);
+ break;
+ case 1:
+ NPCPhrase (GO_AWAY_FIGHTING_ILWRATH_2);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (THRADD_VISITS, NumVisits);
+
+ setSegue (Segue_peace);
+ }
+ else if (GET_GAME_STATE (THRADD_MANNER))
+ {
+ RESPONSE_REF pStr0, pStr1;
+
+ NumVisits = GET_GAME_STATE (THRADD_VISITS);
+ switch (GET_GAME_STATE (THRADD_INTRO))
+ {
+ case 0:
+ PolitePhrase (NumVisits);
+ break;
+ case 1:
+ RhymePhrase (NumVisits);
+ break;
+ case 2:
+ PigLatinPhrase (NumVisits);
+ break;
+ case 3:
+ LikeYouPhrase (NumVisits);
+ break;
+ }
+ if (++NumVisits < 4)
+ {
+ SET_GAME_STATE (THRADD_VISITS, NumVisits);
+ }
+
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ pStr0 = WELCOME_HELIX0;
+ pStr1 = WELCOME_HELIX1;
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ pStr0 = WELCOME_HOMEWORLD0;
+ pStr1 = WELCOME_HOMEWORLD1;
+ }
+ else
+ {
+ pStr0 = WELCOME_SPACE0;
+ pStr1 = WELCOME_SPACE1;
+ }
+ NPCPhrase (pStr0);
+ NPCPhrase (GetCultureName ());
+ NPCPhrase (pStr1);
+
+ ThraddAllies ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NumVisits = GET_GAME_STATE (HELIX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_HELIX_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_HELIX_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (HELIX_VISITS, NumVisits);
+
+ HelixWorld ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (THRADDASH_BODY_COUNT) >= THRADDASH_BODY_THRESHOLD)
+ {
+ NPCPhrase (AMAZING_PERFORMANCE);
+
+ ThraddWorship ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (THRADDASH_BODY_COUNT);
+ if (NumVisits >= 16
+ && GET_GAME_STATE (THRADD_BODY_LEVEL) == 1)
+ {
+ SET_GAME_STATE (THRADD_BODY_LEVEL, 2);
+ NPCPhrase (IMPRESSIVE_PERFORMANCE);
+ }
+ else if (NumVisits >= 8
+ && GET_GAME_STATE (THRADD_BODY_LEVEL) == 0)
+ {
+ SET_GAME_STATE (THRADD_BODY_LEVEL, 1);
+ NPCPhrase (ADEQUATE_PERFORMANCE);
+ }
+
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (THRADD_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (HOSTILE_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (HOSTILE_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (THRADD_HOME_VISITS, NumVisits);
+ }
+ else if ((NumVisits = GET_GAME_STATE (THRADD_MISSION)) == 0
+ || NumVisits > 3)
+ {
+ NumVisits = GET_GAME_STATE (THRADD_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (HOSTILE_SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (HOSTILE_SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (THRADD_VISITS, NumVisits);
+ }
+ else
+ {
+ switch (NumVisits)
+ {
+ case 1:
+ if (GET_GAME_STATE (THRADD_MISSION_VISITS) == 0)
+ NPCPhrase (WE_GO_TO_IMPRESS_URQUAN_1);
+ else
+ NPCPhrase (WE_GO_TO_IMPRESS_URQUAN_2);
+ break;
+ case 2:
+ if (GET_GAME_STATE (THRADD_MISSION_VISITS) == 0)
+ NPCPhrase (WE_IMPRESSING_URQUAN_1);
+ else
+ NPCPhrase (WE_IMPRESSING_URQUAN_2);
+ break;
+ case 3:
+ if (GET_GAME_STATE (THRADD_MISSION_VISITS) == 0)
+ NPCPhrase (WE_IMPRESSED_URQUAN_1);
+ else
+ NPCPhrase (WE_IMPRESSED_URQUAN_2);
+ break;
+ }
+ SET_GAME_STATE (THRADD_MISSION_VISITS, 1);
+ }
+
+ ThraddHostile ((RESPONSE_REF)0);
+ }
+ }
+}
+
+static COUNT
+uninit_thradd (void)
+{
+ return (0);
+}
+
+static void
+post_thradd_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_thradd_comm (void)
+{
+ LOCDATA *retval;
+
+ thradd_desc.init_encounter_func = Intro;
+ thradd_desc.post_encounter_func = post_thradd_enc;
+ thradd_desc.uninit_encounter_func = uninit_thradd;
+
+ thradd_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ thradd_desc.AlienTextBaseline.y = 0;
+ thradd_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (THRADD_MANNER)
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &thradd_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/umgah/Makeinfo b/src/uqm/comm/umgah/Makeinfo
new file mode 100644
index 0000000..9cad008
--- /dev/null
+++ b/src/uqm/comm/umgah/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="umgahc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/umgah/resinst.h b/src/uqm/comm/umgah/resinst.h
new file mode 100644
index 0000000..7b7479d
--- /dev/null
+++ b/src/uqm/comm/umgah/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define UMGAH_COLOR_MAP "comm.umgah.colortable"
+#define UMGAH_CONVERSATION_PHRASES "comm.umgah.dialogue"
+#define UMGAH_FONT "comm.umgah.font"
+#define UMGAH_MUSIC "comm.umgah.music"
+#define UMGAH_PMAP_ANIM "comm.umgah.graphics"
diff --git a/src/uqm/comm/umgah/strings.h b/src/uqm/comm/umgah/strings.h
new file mode 100644
index 0000000..f7dcfed
--- /dev/null
+++ b/src/uqm/comm/umgah/strings.h
@@ -0,0 +1,114 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef UMGAH_STRINGS_H
+#define UMGAH_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HWLD_PRE_ZOMBIE_HELLO_1,
+ HWLD_PRE_ZOMBIE_HELLO_2,
+ HWLD_PRE_ZOMBIE_HELLO_3,
+ HWLD_PRE_ZOMBIE_HELLO_4,
+ SPACE_PRE_ZOMBIE_HELLO_1,
+ SPACE_PRE_ZOMBIE_HELLO_2,
+ SPACE_PRE_ZOMBIE_HELLO_3,
+ SPACE_PRE_ZOMBIE_HELLO_4,
+ UNKNOWN_ZOMBIE_HELLO_1,
+ UNKNOWN_ZOMBIE_HELLO_2,
+ UNKNOWN_ZOMBIE_HELLO_3,
+ UNKNOWN_ZOMBIE_HELLO_4,
+ DESTROY_INTERFERER_1,
+ DESTROY_INTERFERER_2,
+ DESTROY_INTERFERER_3,
+ DESTROY_INTERFERER_4,
+ REVEALED_ZOMBIE_HELLO_1,
+ REVEALED_ZOMBIE_HELLO_2,
+ REVEALED_ZOMBIE_HELLO_3,
+ REVEALED_ZOMBIE_HELLO_4,
+ HOSTILE_HELLO_1,
+ HOSTILE_HELLO_2,
+ HOSTILE_HELLO_3,
+ HOSTILE_HELLO_4,
+ REWARD_AT_HOMEWORLD_1,
+ REWARD_AT_HOMEWORLD_2,
+ POST_ZOMBIE_HWLD_HELLO,
+ owe_me_big_time,
+ our_largesse,
+ GIVE_LIFEDATA,
+ THANKS,
+ what_do_with_tpet,
+ TRICK_URQUAN,
+ any_jokes,
+ SURE,
+ what_before_tpet,
+ TRKD_SPATHI_AND_ILWRATH,
+ where_caster,
+ SPATHI_TOOK_THEM,
+ so_what_for_now,
+ DO_THIS_NOW,
+ bye_post_zombie,
+ FUNNY_IDEA,
+ whats_up_pre_zombie,
+ GENERAL_INFO_PRE_ZOMBIE,
+ evil_blobbies_give_up,
+ NOT_EVIL_BLOBBIES,
+ evil_blobbies_must_die,
+ OH_NO_WE_WONT,
+ can_we_be_friends,
+ SURE_FRIENDS,
+ want_to_defeat_urquan,
+ FINE_BY_US,
+ bye_pre_zombie,
+ GOODBYE_PRE_ZOMBIE,
+ threat,
+ NO_THREAT,
+ whats_up_zombies,
+ GENERAL_INFO_ZOMBIE,
+ how_goes_tpet,
+ WHAT_TPET,
+ you_told_us,
+ SADLY_IT_DIED,
+ dont_believe,
+ THEN_DIE,
+ bye_unknown,
+ GOODBYE_UNKNOWN,
+ evil_blobbies,
+ YES_VERY_EVIL,
+ give_up_or_die,
+ NOT_GIVE_UP,
+ we_vindicator0,
+ we_vindicator1,
+ we_vindicator2,
+ GOOD_FOR_YOU_1,
+ come_in_peace,
+ GOOD_FOR_YOU_2,
+ know_any_jokes,
+ JOKE_1,
+ better_joke,
+ JOKE_2,
+ not_very_funny,
+ YES_WE_ARE,
+ what_about_tpet,
+ arilou_told_us,
+ bye_zombie,
+ GOODBYE_ZOMBIE,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/umgah/umgahc.c b/src/uqm/comm/umgah/umgahc.c
new file mode 100644
index 0000000..d9debd5
--- /dev/null
+++ b/src/uqm/comm/umgah/umgahc.c
@@ -0,0 +1,729 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+
+
+static LOCDATA umgah_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ UMGAH_PMAP_ANIM, /* AlienFrame */
+ UMGAH_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ UMGAH_COLOR_MAP, /* AlienColorMap */
+ UMGAH_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ UMGAH_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 16, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 5, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5),
+ },
+ {
+ 8, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 6),
+ },
+ {
+ 11, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 7),
+ },
+ {
+ 13, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 8),
+ },
+ {
+ 15, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 9),
+ },
+ {
+ 17, /* StartIndex */
+ 3, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 7 / 60, 0, /* FrameRate */
+ ONE_SECOND * 3, ONE_SECOND * 3, /* RestartRate */
+ (1 << 0),
+ },
+ {
+ 20, /* StartIndex */
+ 3, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 7 / 60, 0, /* FrameRate */
+ ONE_SECOND * 3, ONE_SECOND * 3, /* RestartRate */
+ (1 << 1),
+ },
+ {
+ 23, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 7 / 60, 0, /* FrameRate */
+ ONE_SECOND * 3, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2),
+ },
+ {
+ 25, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 7 / 60, 0, /* FrameRate */
+ ONE_SECOND * 3, ONE_SECOND * 3, /* RestartRate */
+ (1 << 3),
+ },
+ {
+ 27, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 7 / 60, 0, /* FrameRate */
+ ONE_SECOND * 3, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4),
+ },
+ {
+ 29, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 32, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 35, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 40, /* StartIndex */
+ 6, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 46, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 5, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 15), /* BlockMask */
+ },
+ {
+ 48, /* StartIndex */
+ 2, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 5, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 14), /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 4, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, bye_zombie))
+ {
+ NPCPhrase (GOODBYE_ZOMBIE);
+
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, bye_pre_zombie))
+ NPCPhrase (GOODBYE_PRE_ZOMBIE);
+ else if (PLAYER_SAID (R, can_we_be_friends))
+ {
+ NPCPhrase (SURE_FRIENDS);
+
+ SET_GAME_STATE (UMGAH_MENTIONED_TRICKS, 1);
+ }
+ else if (PLAYER_SAID (R, evil_blobbies_give_up))
+ {
+ NPCPhrase (NOT_EVIL_BLOBBIES);
+
+ SET_GAME_STATE (UMGAH_EVIL_BLOBBIES, 1);
+ }
+ else if (PLAYER_SAID (R, evil_blobbies_must_die))
+ NPCPhrase (OH_NO_WE_WONT);
+ else if (PLAYER_SAID (R, threat))
+ NPCPhrase (NO_THREAT);
+ else if (PLAYER_SAID (R, dont_believe))
+ {
+ NPCPhrase (THEN_DIE);
+
+ SET_GAME_STATE (KNOW_UMGAH_ZOMBIES, 1);
+ SET_GAME_STATE (UMGAH_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, bye_unknown))
+ {
+ NPCPhrase (GOODBYE_UNKNOWN);
+
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, bye_post_zombie))
+ {
+ NPCPhrase (FUNNY_IDEA);
+
+ AlienTalkSegue ((COUNT)~0);
+ AddEscortShips (UMGAH_SHIP, 4);
+ SET_GAME_STATE (UMGAH_HOSTILE, 1);
+ }
+}
+
+static void
+Zombies (RESPONSE_REF R)
+{
+ if (GET_GAME_STATE (MET_NORMAL_UMGAH))
+ {
+ if (PLAYER_SAID (R, whats_up_zombies))
+ {
+ NPCPhrase (GENERAL_INFO_ZOMBIE);
+
+ DISABLE_PHRASE (whats_up_zombies);
+ }
+ else if (PLAYER_SAID (R, how_goes_tpet))
+ {
+ NPCPhrase (WHAT_TPET);
+
+ DISABLE_PHRASE (how_goes_tpet);
+ }
+ else if (PLAYER_SAID (R, you_told_us))
+ {
+ NPCPhrase (SADLY_IT_DIED);
+
+ DISABLE_PHRASE (you_told_us);
+ }
+
+ if (PHRASE_ENABLED (whats_up_zombies) && PHRASE_ENABLED (how_goes_tpet))
+ Response (whats_up_zombies, Zombies);
+ if (PHRASE_ENABLED (how_goes_tpet))
+ Response (how_goes_tpet, Zombies);
+ else if (PHRASE_ENABLED (you_told_us))
+ Response (you_told_us, Zombies);
+ else
+ {
+ Response (dont_believe, CombatIsInevitable);
+ }
+ if (PHRASE_ENABLED (whats_up_zombies) && !PHRASE_ENABLED (how_goes_tpet))
+ Response (whats_up_zombies, Zombies);
+ Response (threat, CombatIsInevitable);
+ Response (bye_unknown, CombatIsInevitable);
+ }
+ else
+ {
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[4];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = pStr[3] = 0;
+ if (PLAYER_SAID (R, evil_blobbies))
+ {
+ NPCPhrase (YES_VERY_EVIL);
+
+ DISABLE_PHRASE (evil_blobbies);
+ LastStack = 0;
+ }
+ else if (PLAYER_SAID (R, we_vindicator0))
+ {
+ NPCPhrase (GOOD_FOR_YOU_1);
+
+ DISABLE_PHRASE (we_vindicator0);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, come_in_peace))
+ {
+ NPCPhrase (GOOD_FOR_YOU_2);
+
+ DISABLE_PHRASE (come_in_peace);
+ LastStack = 1;
+ }
+ else if (PLAYER_SAID (R, know_any_jokes))
+ {
+ NPCPhrase (JOKE_1);
+
+ DISABLE_PHRASE (know_any_jokes);
+ LastStack = 2;
+ }
+ else if (PLAYER_SAID (R, better_joke))
+ {
+ NPCPhrase (JOKE_2);
+
+ DISABLE_PHRASE (better_joke);
+ LastStack = 2;
+ }
+ else if (PLAYER_SAID (R, not_very_funny))
+ {
+ NPCPhrase (YES_WE_ARE);
+
+ DISABLE_PHRASE (not_very_funny);
+ LastStack = 2;
+ }
+ else if (PLAYER_SAID (R, what_about_tpet))
+ {
+ NPCPhrase (WHAT_TPET);
+
+ DISABLE_PHRASE (what_about_tpet);
+ LastStack = 3;
+ }
+ else if (PLAYER_SAID (R, give_up_or_die))
+ {
+ NPCPhrase (NOT_GIVE_UP);
+
+ setSegue (Segue_hostile);
+ return;
+ }
+ else if (PLAYER_SAID (R, arilou_told_us))
+ {
+ NPCPhrase (THEN_DIE);
+
+ setSegue (Segue_hostile);
+ SET_GAME_STATE (KNOW_UMGAH_ZOMBIES, 1);
+ SET_GAME_STATE (UMGAH_VISITS, 0);
+ return;
+ }
+
+ if (PHRASE_ENABLED (evil_blobbies))
+ pStr[0] = evil_blobbies;
+ else
+ pStr[0] = give_up_or_die;
+
+ if (PHRASE_ENABLED (we_vindicator0))
+ {
+ construct_response (shared_phrase_buf,
+ we_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_vindicator2,
+ (UNICODE*)NULL);
+ pStr[1] = we_vindicator0;
+ }
+ else if (PHRASE_ENABLED (come_in_peace))
+ pStr[1] = come_in_peace;
+
+ if (PHRASE_ENABLED (know_any_jokes))
+ pStr[2] = know_any_jokes;
+ else if (PHRASE_ENABLED (better_joke))
+ pStr[2] = better_joke;
+ else if (PHRASE_ENABLED (not_very_funny))
+ pStr[2] = not_very_funny;
+
+ if (PHRASE_ENABLED (what_about_tpet))
+ pStr[3] = what_about_tpet;
+ else
+ pStr[3] = arilou_told_us;
+
+ if (pStr[LastStack])
+ {
+ if (pStr[LastStack] != we_vindicator0)
+ Response (pStr[LastStack], Zombies);
+ else
+ DoResponsePhrase (pStr[LastStack], Zombies, shared_phrase_buf);
+ }
+ for (i = 0; i < 4; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (pStr[i] != we_vindicator0)
+ Response (pStr[i], Zombies);
+ else
+ DoResponsePhrase (pStr[i], Zombies, shared_phrase_buf);
+ }
+ }
+ Response (bye_zombie, CombatIsInevitable);
+ }
+}
+
+static void
+NormalUmgah (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, whats_up_pre_zombie))
+ {
+ NPCPhrase (GENERAL_INFO_PRE_ZOMBIE);
+
+ DISABLE_PHRASE (whats_up_pre_zombie);
+ }
+ else if (PLAYER_SAID (R, want_to_defeat_urquan))
+ {
+ NPCPhrase (FINE_BY_US);
+
+ DISABLE_PHRASE (want_to_defeat_urquan);
+ }
+
+ if (!GET_GAME_STATE (UMGAH_EVIL_BLOBBIES))
+ Response (evil_blobbies_give_up, CombatIsInevitable);
+ else
+ Response (evil_blobbies_must_die, CombatIsInevitable);
+ if (PHRASE_ENABLED (whats_up_pre_zombie))
+ Response (whats_up_pre_zombie, NormalUmgah);
+ if (PHRASE_ENABLED (want_to_defeat_urquan))
+ Response (want_to_defeat_urquan, NormalUmgah);
+ switch (GET_GAME_STATE (UMGAH_MENTIONED_TRICKS))
+ {
+ case 0:
+ Response (can_we_be_friends, CombatIsInevitable);
+ break;
+ }
+ Response (bye_pre_zombie, CombatIsInevitable);
+}
+
+static void
+UmgahReward (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, what_before_tpet))
+ {
+ NPCPhrase (TRKD_SPATHI_AND_ILWRATH);
+
+ DISABLE_PHRASE (what_before_tpet);
+ }
+ else if (PLAYER_SAID (R, where_caster))
+ {
+ NPCPhrase (SPATHI_TOOK_THEM);
+
+ DISABLE_PHRASE (where_caster);
+ }
+ else if (PLAYER_SAID (R, owe_me_big_time))
+ {
+ NPCPhrase (THANKS);
+
+ GLOBAL_SIS (TotalBioMass) += 1000 / BIO_CREDIT_VALUE;
+ DISABLE_PHRASE (owe_me_big_time);
+ DISABLE_PHRASE (our_largesse);
+ }
+ else if (PLAYER_SAID (R, our_largesse))
+ {
+ NPCPhrase (GIVE_LIFEDATA);
+
+ GLOBAL_SIS (TotalBioMass) += 1000 / BIO_CREDIT_VALUE;
+ DISABLE_PHRASE (our_largesse);
+ DISABLE_PHRASE (owe_me_big_time);
+ }
+ else if (PLAYER_SAID (R, what_do_with_tpet))
+ {
+ NPCPhrase (TRICK_URQUAN);
+
+ DISABLE_PHRASE (what_do_with_tpet);
+ }
+ else if (PLAYER_SAID (R, any_jokes))
+ {
+ NPCPhrase (SURE);
+
+ DISABLE_PHRASE (any_jokes);
+ }
+ else if (PLAYER_SAID (R, so_what_for_now))
+ {
+ NPCPhrase (DO_THIS_NOW);
+
+ DISABLE_PHRASE (so_what_for_now);
+ }
+
+ if (!GET_GAME_STATE (MET_NORMAL_UMGAH))
+ {
+ if (PHRASE_ENABLED (what_before_tpet))
+ Response (what_before_tpet, UmgahReward);
+ else if (PHRASE_ENABLED (where_caster))
+ Response (where_caster, UmgahReward);
+ }
+ if (PHRASE_ENABLED (owe_me_big_time))
+ {
+ Response (owe_me_big_time, UmgahReward);
+ Response (our_largesse, UmgahReward);
+ }
+ if (PHRASE_ENABLED (what_do_with_tpet))
+ Response (what_do_with_tpet, UmgahReward);
+ else if (PHRASE_ENABLED (any_jokes) && GET_GAME_STATE (UMGAH_MENTIONED_TRICKS) < 2)
+ Response (any_jokes, UmgahReward);
+ if (PHRASE_ENABLED (so_what_for_now))
+ Response (so_what_for_now, UmgahReward);
+ Response (bye_post_zombie, CombatIsInevitable);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (GET_GAME_STATE (UMGAH_HOSTILE))
+ {
+ NumVisits = GET_GAME_STATE (UMGAH_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (HOSTILE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (HOSTILE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UMGAH_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (UMGAH_ZOMBIE_BLOBBIES))
+ {
+ NumVisits = GET_GAME_STATE (UMGAH_VISITS);
+ if (GET_GAME_STATE (TALKING_PET_VISITS))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (DESTROY_INTERFERER_1);
+ break;
+ case 1:
+ NPCPhrase (DESTROY_INTERFERER_2);
+ break;
+ case 2:
+ NPCPhrase (DESTROY_INTERFERER_3);
+ break;
+ case 3:
+ NPCPhrase (DESTROY_INTERFERER_4);
+ --NumVisits;
+ break;
+ }
+
+ setSegue (Segue_hostile);
+ }
+ else if (GET_GAME_STATE (KNOW_UMGAH_ZOMBIES))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (REVEALED_ZOMBIE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (REVEALED_ZOMBIE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (REVEALED_ZOMBIE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (REVEALED_ZOMBIE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (UNKNOWN_ZOMBIE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (UNKNOWN_ZOMBIE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (UNKNOWN_ZOMBIE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (UNKNOWN_ZOMBIE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+
+ Zombies ((RESPONSE_REF)0);
+ }
+ SET_GAME_STATE (UMGAH_VISITS, NumVisits);
+ }
+ else if (!GET_GAME_STATE (TALKING_PET))
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (UMGAH_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HWLD_PRE_ZOMBIE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HWLD_PRE_ZOMBIE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (HWLD_PRE_ZOMBIE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (HWLD_PRE_ZOMBIE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UMGAH_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UMGAH_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (SPACE_PRE_ZOMBIE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (SPACE_PRE_ZOMBIE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (SPACE_PRE_ZOMBIE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (SPACE_PRE_ZOMBIE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UMGAH_VISITS, NumVisits);
+ }
+
+ NormalUmgah ((RESPONSE_REF)0);
+ }
+ else
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NPCPhrase (POST_ZOMBIE_HWLD_HELLO);
+
+ UmgahReward ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UMGAH_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (REWARD_AT_HOMEWORLD_1);
+ break;
+ case 1:
+ NPCPhrase (REWARD_AT_HOMEWORLD_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UMGAH_VISITS, NumVisits);
+
+ setSegue (Segue_peace);
+ }
+ }
+}
+
+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);
+ }
+}
+
+LOCDATA*
+init_umgah_comm (void)
+{
+ LOCDATA *retval;
+
+ umgah_desc.init_encounter_func = Intro;
+ umgah_desc.post_encounter_func = post_umgah_enc;
+ umgah_desc.uninit_encounter_func = uninit_umgah;
+
+ umgah_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ umgah_desc.AlienTextBaseline.y = 0;
+ umgah_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if ((GET_GAME_STATE (TALKING_PET) && !GET_GAME_STATE (UMGAH_HOSTILE))
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &umgah_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/urquan/Makeinfo b/src/uqm/comm/urquan/Makeinfo
new file mode 100644
index 0000000..7b756fa
--- /dev/null
+++ b/src/uqm/comm/urquan/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="urquanc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/urquan/resinst.h b/src/uqm/comm/urquan/resinst.h
new file mode 100644
index 0000000..5b69860
--- /dev/null
+++ b/src/uqm/comm/urquan/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define URQUAN_COLOR_MAP "comm.urquan.colortable"
+#define URQUAN_CONVERSATION_PHRASES "comm.urquan.dialogue"
+#define URQUAN_FONT "comm.urquan.font"
+#define URQUAN_MUSIC "comm.urquan.music"
+#define URQUAN_PMAP_ANIM "comm.urquan.graphics"
diff --git a/src/uqm/comm/urquan/strings.h b/src/uqm/comm/urquan/strings.h
new file mode 100644
index 0000000..18ca86c
--- /dev/null
+++ b/src/uqm/comm/urquan/strings.h
@@ -0,0 +1,101 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef URQUAN_STRINGS_H
+#define URQUAN_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HELLO_SAMATRA,
+ SENSE_EVIL,
+ INIT_URQUAN_WAKE_UP,
+ where_am_i,
+ YOU_ARE_HERE,
+ why_does_my_head_hurt,
+ HURTS_BECAUSE,
+ what_about_2_weeks,
+ ABOUT_2_WEEKS,
+ compulsion,
+ WHAT_COMPULSION,
+ wascally_little_guy,
+ WHAT_IT_LOOK_LIKE,
+ terran_amphibian,
+ talking_pet_on_steroids,
+ BAD_NEWS,
+ turd_and_toad,
+ WHAT_IS_TURD_AND_TOAD,
+ alien_mind_control,
+ WHAT_FELT_LIKE,
+ possessed_by_devil,
+ STUPID_DEVIL,
+ falling_asleep,
+ someone_else_controlled,
+ SOUNDS_FAMILIAR,
+ before_coffee,
+ EXPLAIN,
+ why_explain,
+ MUST_EXPLAIN,
+ bye_init_hypno,
+ GOODBYE_AND_DIE_INIT_HYPNO,
+ SUBSEQUENT_URQUAN_WAKE_UP,
+ uh_oh,
+ NO_UH_OH,
+ stop_meeting,
+ NO_STOP_MEETING,
+ bye_sub_hypno,
+ GOODBYE_AND_DIE_SUB_HYPNO,
+ CAUGHT_YA,
+ INIT_FLEE_HUMAN,
+ SUBSEQUENT_FLEE_HUMAN,
+ why_flee,
+ FLEE_BECAUSE,
+ what_happens_now,
+ HAPPENS_NOW,
+ what_about_you,
+ ABOUT_US,
+ bye_wars_over,
+ GOODBYE_WARS_OVER,
+ SEND_MESSAGE,
+ INIT_HELLO,
+ SUBSEQUENT_HELLO_1,
+ SUBSEQUENT_HELLO_2,
+ SUBSEQUENT_HELLO_3,
+ SUBSEQUENT_HELLO_4,
+ you_must_surrender,
+ NOPE,
+ i_surrender,
+ DISOBEDIENCE_PUNISHED,
+ i_wont_surrender,
+ BAD_CHOICE,
+ i_will_surrender,
+ GOOD_CHOICE,
+ key_phrase,
+ URQUAN_STORY,
+ like_to_leave,
+ INDEPENDENCE_IS_BAD,
+ whats_up_1,
+ GENERAL_INFO_1,
+ whats_up_2,
+ GENERAL_INFO_2,
+ whats_up_3,
+ GENERAL_INFO_3,
+ whats_up_4,
+ GENERAL_INFO_4,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/urquan/urquanc.c b/src/uqm/comm/urquan/urquanc.c
new file mode 100644
index 0000000..efdf710
--- /dev/null
+++ b/src/uqm/comm/urquan/urquanc.c
@@ -0,0 +1,555 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+static LOCDATA urquan_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ URQUAN_PMAP_ANIM, /* AlienFrame */
+ URQUAN_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ URQUAN_COLOR_MAP, /* AlienColorMap */
+ URQUAN_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ URQUAN_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 7, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 7, /* StartIndex */
+ 6, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 10, 0, /* FrameRate */
+ ONE_SECOND / 10, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 16, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 19, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 29, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 36, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 1, /* StartIndex */
+ 2, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 6, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 2, /* StartIndex */
+ 5, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, you_must_surrender))
+ NPCPhrase (NOPE);
+ else if (PLAYER_SAID (R, whats_up_1)
+ || PLAYER_SAID (R, whats_up_2)
+ || PLAYER_SAID (R, whats_up_3)
+ || PLAYER_SAID (R, whats_up_4))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (URQUAN_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (URQUAN_INFO, NumVisits);
+ }
+ else if (PLAYER_SAID (R, i_wont_surrender))
+ NPCPhrase (BAD_CHOICE);
+ else if (PLAYER_SAID (R, i_will_surrender))
+ {
+ NPCPhrase (GOOD_CHOICE);
+
+ setSegue (Segue_defeat);
+ }
+ else if (PLAYER_SAID (R, like_to_leave))
+ NPCPhrase (INDEPENDENCE_IS_BAD);
+ else if (PLAYER_SAID (R, bye_wars_over))
+ {
+ NPCPhrase (GOODBYE_WARS_OVER);
+
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, bye_sub_hypno))
+ NPCPhrase (GOODBYE_AND_DIE_SUB_HYPNO);
+ else if (PLAYER_SAID (R, bye_init_hypno))
+ {
+ NPCPhrase (GOODBYE_AND_DIE_INIT_HYPNO);
+
+ SET_GAME_STATE (URQUAN_HYPNO_VISITS, 1);
+ }
+ else if (PLAYER_SAID (R, terran_amphibian)
+ || PLAYER_SAID (R, talking_pet_on_steroids))
+ {
+ NPCPhrase (BAD_NEWS);
+
+ setSegue (Segue_peace);
+ SET_GAME_STATE (URQUAN_HYPNO_VISITS, 1);
+ }
+ else if (PLAYER_SAID (R, falling_asleep)
+ || PLAYER_SAID (R, someone_else_controlled))
+ {
+ NPCPhrase (SOUNDS_FAMILIAR);
+
+ setSegue (Segue_peace);
+ SET_GAME_STATE (URQUAN_HYPNO_VISITS, 1);
+ }
+}
+
+static void
+DescribePet (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, wascally_little_guy))
+ NPCPhrase (WHAT_IT_LOOK_LIKE);
+ else if (PLAYER_SAID (R, turd_and_toad))
+ {
+ NPCPhrase (WHAT_IS_TURD_AND_TOAD);
+
+ DISABLE_PHRASE (turd_and_toad);
+ }
+
+ Response (terran_amphibian, CombatIsInevitable);
+ Response (talking_pet_on_steroids, CombatIsInevitable);
+ if (PHRASE_ENABLED (turd_and_toad))
+ {
+ Response (turd_and_toad, DescribePet);
+ }
+}
+
+static void
+DescribeCompulsion (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, alien_mind_control))
+ NPCPhrase (WHAT_FELT_LIKE);
+ else if (PLAYER_SAID (R, before_coffee))
+ {
+ NPCPhrase (EXPLAIN);
+
+ DISABLE_PHRASE (before_coffee);
+ }
+
+ Response (falling_asleep, CombatIsInevitable);
+ Response (someone_else_controlled, CombatIsInevitable);
+ if (PHRASE_ENABLED (before_coffee))
+ {
+ Response (before_coffee, DescribeCompulsion);
+ }
+}
+
+static void
+MentionCompulsion (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, compulsion))
+ {
+ NPCPhrase (WHAT_COMPULSION);
+
+ SET_GAME_STATE (MENTIONED_PET_COMPULSION, 1);
+ }
+ else if (PLAYER_SAID (R, possessed_by_devil))
+ {
+ NPCPhrase (STUPID_DEVIL);
+
+ DISABLE_PHRASE (possessed_by_devil);
+ }
+ else if (PLAYER_SAID (R, why_explain))
+ {
+ NPCPhrase (MUST_EXPLAIN);
+
+ DISABLE_PHRASE (why_explain);
+ }
+
+ Response (wascally_little_guy, DescribePet);
+ Response (alien_mind_control, DescribeCompulsion);
+ if (PHRASE_ENABLED (possessed_by_devil))
+ Response (possessed_by_devil, MentionCompulsion);
+ if (PHRASE_ENABLED (why_explain))
+ Response (why_explain, MentionCompulsion);
+}
+
+static void
+UrquanHypno (RESPONSE_REF R)
+{
+ if (GET_GAME_STATE (URQUAN_HYPNO_VISITS) == 0)
+ {
+ if (R == 0)
+ NPCPhrase (INIT_URQUAN_WAKE_UP);
+ else if (PLAYER_SAID (R, where_am_i))
+ {
+ NPCPhrase (YOU_ARE_HERE);
+
+ DISABLE_PHRASE (where_am_i);
+ }
+ else if (PLAYER_SAID (R, why_does_my_head_hurt))
+ {
+ NPCPhrase (HURTS_BECAUSE);
+
+ DISABLE_PHRASE (why_does_my_head_hurt);
+ }
+ else if (PLAYER_SAID (R, what_about_2_weeks))
+ {
+ NPCPhrase (ABOUT_2_WEEKS);
+
+ DISABLE_PHRASE (what_about_2_weeks);
+ }
+
+ if (PHRASE_ENABLED (where_am_i))
+ Response (where_am_i, UrquanHypno);
+ if (PHRASE_ENABLED (why_does_my_head_hurt))
+ Response (why_does_my_head_hurt, UrquanHypno);
+ if (PHRASE_ENABLED (what_about_2_weeks))
+ Response (what_about_2_weeks, UrquanHypno);
+ Response (compulsion, MentionCompulsion);
+ Response (bye_init_hypno, CombatIsInevitable);
+ }
+ else
+ {
+ if (R == 0)
+ NPCPhrase (SUBSEQUENT_URQUAN_WAKE_UP);
+ else if (PLAYER_SAID (R, uh_oh))
+ {
+ NPCPhrase (NO_UH_OH);
+
+ DISABLE_PHRASE (uh_oh);
+ }
+ else if (PLAYER_SAID (R, stop_meeting))
+ {
+ NPCPhrase (NO_STOP_MEETING);
+
+ DISABLE_PHRASE (stop_meeting);
+ }
+
+ if (PHRASE_ENABLED (uh_oh))
+ Response (uh_oh, UrquanHypno);
+ if (PHRASE_ENABLED (stop_meeting))
+ Response (stop_meeting, UrquanHypno);
+ if (!GET_GAME_STATE (MENTIONED_PET_COMPULSION))
+ {
+ Response (compulsion, MentionCompulsion);
+ }
+ Response (bye_sub_hypno, CombatIsInevitable);
+ }
+}
+
+static void
+NormalUrquan (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, i_surrender))
+ {
+ NPCPhrase (DISOBEDIENCE_PUNISHED);
+
+ Response (i_wont_surrender, CombatIsInevitable);
+ Response (i_will_surrender, CombatIsInevitable);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, key_phrase))
+ {
+ NPCPhrase (URQUAN_STORY);
+
+ SET_GAME_STATE (KNOW_URQUAN_STORY, 2);
+ }
+
+ Response (you_must_surrender, CombatIsInevitable);
+ if (GET_GAME_STATE (KNOW_URQUAN_STORY) == 1)
+ {
+ Response (key_phrase, NormalUrquan);
+ }
+ switch (GET_GAME_STATE (URQUAN_INFO))
+ {
+ case 0:
+ Response (whats_up_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (whats_up_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (whats_up_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (whats_up_4, CombatIsInevitable);
+ break;
+ }
+ Response (i_surrender, NormalUrquan);
+ Response (like_to_leave, CombatIsInevitable);
+ }
+}
+
+static void
+LoserUrquan (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, why_flee))
+ {
+ NPCPhrase (FLEE_BECAUSE);
+
+ DISABLE_PHRASE (why_flee);
+ }
+ else if (PLAYER_SAID (R, what_happens_now))
+ {
+ NPCPhrase (HAPPENS_NOW);
+
+ DISABLE_PHRASE (what_happens_now);
+ }
+ else if (PLAYER_SAID (R, what_about_you))
+ {
+ NPCPhrase (ABOUT_US);
+
+ DISABLE_PHRASE (what_about_you);
+ }
+
+ if (PHRASE_ENABLED (why_flee))
+ Response (why_flee, LoserUrquan);
+ if (PHRASE_ENABLED (what_happens_now))
+ Response (what_happens_now, LoserUrquan);
+ if (PHRASE_ENABLED (what_about_you))
+ Response (what_about_you, LoserUrquan);
+ Response (bye_wars_over, CombatIsInevitable);
+}
+
+static void
+Intro (void)
+{
+ DWORD GrpOffs;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ GrpOffs = GET_GAME_STATE_32 (URQUAN_PROBE_GRPOFFS0);
+ if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
+ && GLOBAL (BattleGroupRef)
+ && GLOBAL (BattleGroupRef) == GrpOffs)
+ {
+ NPCPhrase (SEND_MESSAGE);
+ SET_GAME_STATE (PROBE_MESSAGE_DELIVERED, 1);
+ }
+ else if (GET_GAME_STATE (PLAYER_HYPNOTIZED))
+ {
+ SetCommIntroMode (CIM_FADE_IN_SCREEN, ONE_SECOND * 5);
+ UrquanHypno ((RESPONSE_REF)0);
+ }
+ else
+ {
+ BYTE NumVisits;
+
+ if (!GET_GAME_STATE (URQUAN_SENSES_EVIL)
+ && GET_GAME_STATE (TALKING_PET_ON_SHIP))
+ {
+ NPCPhrase (SENSE_EVIL);
+ SET_GAME_STATE (URQUAN_SENSES_EVIL, 1);
+ }
+
+ GrpOffs = GET_GAME_STATE_32 (COLONY_GRPOFFS0);
+ if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
+ && GLOBAL (BattleGroupRef)
+ && GLOBAL (BattleGroupRef) == GrpOffs)
+ {
+ NPCPhrase (CAUGHT_YA);
+
+ setSegue (Segue_hostile);
+ return;
+ }
+
+ GrpOffs = GET_GAME_STATE_32 (SAMATRA_GRPOFFS0);
+ if (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
+ && GLOBAL (BattleGroupRef)
+ && GLOBAL (BattleGroupRef) == GrpOffs)
+ {
+ NPCPhrase (HELLO_SAMATRA);
+
+ SET_GAME_STATE (AWARE_OF_SAMATRA, 1);
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (URQUAN_VISITS);
+ if (!GET_GAME_STATE (KOHR_AH_FRENZY))
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_HELLO);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_HELLO_1);
+ break;
+ case 2:
+ NPCPhrase (SUBSEQUENT_HELLO_2);
+ break;
+ case 3:
+ NPCPhrase (SUBSEQUENT_HELLO_3);
+ break;
+ case 4:
+ NPCPhrase (SUBSEQUENT_HELLO_4);
+ --NumVisits;
+ break;
+ }
+
+ NormalUrquan ((RESPONSE_REF)0);
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (INIT_FLEE_HUMAN);
+ LoserUrquan ((RESPONSE_REF)0);
+ break;
+ case 1:
+ NPCPhrase (SUBSEQUENT_FLEE_HUMAN);
+ setSegue (Segue_peace);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (URQUAN_VISITS, NumVisits);
+ }
+ }
+}
+
+static COUNT
+uninit_urquan (void)
+{
+ return (0);
+}
+
+static void
+post_urquan_enc (void)
+{
+ SET_GAME_STATE (PLAYER_HYPNOTIZED, 0);
+}
+
+LOCDATA*
+init_urquan_comm (void)
+{
+ LOCDATA *retval;
+
+ DWORD GrpOffs;
+
+ urquan_desc.init_encounter_func = Intro;
+ urquan_desc.post_encounter_func = post_urquan_enc;
+ urquan_desc.uninit_encounter_func = uninit_urquan;
+
+ urquan_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ urquan_desc.AlienTextBaseline.y = 0;
+ urquan_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ GrpOffs = GET_GAME_STATE_32 (URQUAN_PROBE_GRPOFFS0);
+ if (GET_GAME_STATE (PLAYER_HYPNOTIZED)
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE
+ || (LOBYTE (GLOBAL (CurrentActivity)) == IN_INTERPLANETARY
+ && GLOBAL (BattleGroupRef)
+ && GLOBAL (BattleGroupRef) == GrpOffs))
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &urquan_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/utwig/Makeinfo b/src/uqm/comm/utwig/Makeinfo
new file mode 100644
index 0000000..432250e
--- /dev/null
+++ b/src/uqm/comm/utwig/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="utwigc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/utwig/resinst.h b/src/uqm/comm/utwig/resinst.h
new file mode 100644
index 0000000..5176ecb
--- /dev/null
+++ b/src/uqm/comm/utwig/resinst.h
@@ -0,0 +1,10 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define UTWIG_COLOR_MAP "comm.utwig.colortable"
+#define UTWIG_CONVERSATION_PHRASES "comm.utwig.dialogue"
+#define UTWIG_FONT "comm.utwig.font"
+#define UTWIG_MUSIC "comm.utwig.music"
+#define UTWIG_PMAP_ANIM "comm.utwig.graphics"
+#define UTWIG_ULTRON_MUSIC "comm.utwig.ultron.music"
diff --git a/src/uqm/comm/utwig/strings.h b/src/uqm/comm/utwig/strings.h
new file mode 100644
index 0000000..bb6f693
--- /dev/null
+++ b/src/uqm/comm/utwig/strings.h
@@ -0,0 +1,144 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef UTWIG_STRINGS_H
+#define UTWIG_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ NEUTRAL_SPACE_HELLO_1,
+ NEUTRAL_SPACE_HELLO_2,
+ HOSTILE_SPACE_HELLO_1,
+ HOSTILE_SPACE_HELLO_2,
+ BOMB_WORLD_HELLO_1,
+ BOMB_WORLD_HELLO_2,
+ HOSTILE_BOMB_HELLO_1,
+ HOSTILE_BOMB_HELLO_2,
+ NEUTRAL_HOMEWORLD_HELLO_1,
+ NEUTRAL_HOMEWORLD_HELLO_2,
+ NEUTRAL_HOMEWORLD_HELLO_3,
+ NEUTRAL_HOMEWORLD_HELLO_4,
+ HOSTILE_HOMEWORLD_HELLO_1,
+ HOSTILE_HOMEWORLD_HELLO_2,
+ why_you_here,
+ WE_GUARD_BOMB,
+ what_about_bomb,
+ ABOUT_BOMB,
+ give_us_bomb_or_die,
+ GUARDS_WARN,
+ demand_bomb,
+ GUARDS_FIGHT,
+ may_we_have_bomb,
+ NO_BOMB,
+ please,
+ SORRY_NO_BOMB,
+ whats_up_bomb,
+ GENERAL_INFO_BOMB_1,
+ GENERAL_INFO_BOMB_2,
+ bye_bomb,
+ GOODBYE_BOMB,
+ hey_wait_got_ultron,
+ TAUNT_US_BUT_WE_LOOK,
+ TRICKED_US_1,
+ TRICKED_US_2,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ WOULD_BE_HAPPY_BUT,
+ why_sad,
+ ULTRON_BROKE,
+ what_ultron,
+ GLORIOUS_ULTRON,
+ dont_be_babies,
+ MOCK_OUR_PAIN,
+ real_sorry_about_ultron,
+ APPRECIATE_SYMPATHY,
+ what_about_you_1,
+ ABOUT_US_1,
+ what_about_you_2,
+ ABOUT_US_2,
+ what_about_you_3,
+ ABOUT_US_3,
+ what_about_urquan_1,
+ ABOUT_URQUAN_1,
+ what_about_urquan_2,
+ ABOUT_URQUAN_2,
+ got_ultron,
+ DONT_WANT_TO_LOOK,
+ SICK_TRICK_1,
+ SICK_TRICK_2,
+ bye_neutral,
+ GOODBYE_NEUTRAL,
+ TOO_LATE,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ HAPPY_DAYS,
+ OK_ATTACK_KOHRAH,
+ whats_up_after_space,
+ GENERAL_INFO_AFTER_SPACE_1,
+ GENERAL_INFO_AFTER_SPACE_2,
+ what_now_after_space,
+ DO_THIS_AFTER_SPACE,
+ bye_after_space,
+ GOODBYE_AFTER_SPACE,
+ whats_up_before_space,
+ GENERAL_INFO_BEFORE_SPACE_1,
+ GENERAL_INFO_BEFORE_SPACE_2,
+ what_now_before_space,
+ DO_THIS_BEFORE_SPACE,
+ bye_before_space,
+ GOODBYE_BEFORE_SPACE,
+ how_went_war,
+ ABOUT_BATTLE,
+ how_goes_war,
+ BATTLE_HAPPENS_1,
+ BATTLE_HAPPENS_2,
+ FLEET_ON_WAY,
+ learn_new_info,
+ NO_NEW_INFO,
+ SAMATRA,
+ what_now_homeworld,
+ HOPE_KILL_EACH_OTHER,
+ how_is_ultron,
+ ULTRON_IS_GREAT,
+ bye_allied_homeworld,
+ GOODBYE_ALLIED_HOMEWORLD,
+ ALLIED_HOMEWORLD_HELLO_1,
+ ALLIED_HOMEWORLD_HELLO_2,
+ ALLIED_HOMEWORLD_HELLO_3,
+ ALLIED_HOMEWORLD_HELLO_4,
+ HELLO_BEFORE_KOHRAH_SPACE_1,
+ HELLO_BEFORE_KOHRAH_SPACE_2,
+ HELLO_DURING_KOHRAH_SPACE_1,
+ HELLO_DURING_KOHRAH_SPACE_2,
+ HELLO_AFTER_KOHRAH_SPACE_1,
+ HELLO_AFTER_KOHRAH_SPACE_2,
+ UP_TO_YOU,
+ can_you_help,
+ HOW_HELP,
+ DONT_NEED,
+ HAVE_4_SHIPS,
+ NO_ULTRON_AT_BOMB,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/utwig/utwigc.c b/src/uqm/comm/utwig/utwigc.c
new file mode 100644
index 0000000..53bacbb
--- /dev/null
+++ b/src/uqm/comm/utwig/utwigc.c
@@ -0,0 +1,996 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/gameev.h"
+
+
+static LOCDATA utwig_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ UTWIG_PMAP_ANIM, /* AlienFrame */
+ UTWIG_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* SIS_TEXT_WIDTH - 16, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ UTWIG_COLOR_MAP, /* AlienColorMap */
+ UTWIG_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ UTWIG_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 16, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 4, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 7, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2), /* BlockMask */
+ },
+ {
+ 11, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ (1 << 1), /* BlockMask */
+ },
+ {
+ 13, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 12, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 18, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 22, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 25, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 27, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 30, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 32, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 34, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 36, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 38, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 40, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 42, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND * 2 / 15, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND * 10, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 20, ONE_SECOND / 20, /* FrameRate */
+ ONE_SECOND * 7 / 60, ONE_SECOND / 2, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye_neutral))
+ NPCPhrase (GOODBYE_NEUTRAL);
+ else if (PLAYER_SAID (R, bye_after_space))
+ NPCPhrase (GOODBYE_AFTER_SPACE);
+ else if (PLAYER_SAID (R, bye_before_space))
+ NPCPhrase (GOODBYE_BEFORE_SPACE);
+ else if (PLAYER_SAID (R, bye_allied_homeworld))
+ NPCPhrase (GOODBYE_ALLIED_HOMEWORLD);
+ else if (PLAYER_SAID (R, bye_bomb))
+ NPCPhrase (GOODBYE_BOMB);
+ else if (PLAYER_SAID (R, demand_bomb))
+ {
+ NPCPhrase (GUARDS_FIGHT);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, got_ultron)
+ || PLAYER_SAID (R, hey_wait_got_ultron))
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NPCPhrase (NO_ULTRON_AT_BOMB);
+
+ SET_GAME_STATE (REFUSED_ULTRON_AT_BOMB, 1);
+ }
+ else
+ {
+ if (PLAYER_SAID (R, got_ultron))
+ NPCPhrase (DONT_WANT_TO_LOOK);
+ else
+ NPCPhrase (TAUNT_US_BUT_WE_LOOK);
+ if (GET_GAME_STATE (ULTRON_CONDITION) < 4)
+ {
+ switch (GET_GAME_STATE (UTWIG_INFO))
+ {
+ case 0:
+ if (PLAYER_SAID (R, got_ultron))
+ NPCPhrase (SICK_TRICK_1);
+ else
+ {
+ NPCPhrase (TRICKED_US_1);
+
+ setSegue (Segue_hostile);
+ }
+ break;
+ case 1:
+ if (PLAYER_SAID (R, got_ultron))
+ NPCPhrase (SICK_TRICK_2);
+ else
+ {
+ NPCPhrase (TRICKED_US_2);
+
+ setSegue (Segue_hostile);
+ }
+ break;
+ }
+ SET_GAME_STATE (UTWIG_INFO, 1);
+ }
+ else
+ {
+ NPCPhrase (HAPPY_DAYS);
+ if (GET_GAME_STATE (KOHR_AH_FRENZY))
+ NPCPhrase (TOO_LATE);
+ else
+ {
+ NPCPhrase (OK_ATTACK_KOHRAH);
+
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, ADVANCE_UTWIG_SUPOX_MISSION);
+ }
+
+ SET_GAME_STATE (UTWIG_HAVE_ULTRON, 1);
+ SET_GAME_STATE (ULTRON_CONDITION, 5);
+
+ SET_GAME_STATE (UTWIG_VISITS, 0);
+ SET_GAME_STATE (SUPOX_VISITS, 0);
+ SET_GAME_STATE (UTWIG_HOME_VISITS, 0);
+ SET_GAME_STATE (SUPOX_HOME_VISITS, 0);
+ SET_GAME_STATE (BOMB_VISITS, 0);
+
+ SET_GAME_STATE (SUPOX_INFO, 0);
+ SET_GAME_STATE (UTWIG_INFO, 0);
+ SET_GAME_STATE (SUPOX_WAR_NEWS, 0);
+ SET_GAME_STATE (UTWIG_WAR_NEWS, 0);
+ SET_GAME_STATE (SUPOX_HOSTILE, 0);
+ SET_GAME_STATE (UTWIG_HOSTILE, 0);
+
+ SetRaceAllied (UTWIG_SHIP, TRUE);
+ SetRaceAllied (SUPOX_SHIP, TRUE);
+ }
+ }
+ }
+ else if (PLAYER_SAID (R, can_you_help))
+ {
+ NPCPhrase (HOW_HELP);
+ if (EscortFeasibilityStudy (UTWIG_SHIP) == 0)
+ NPCPhrase (DONT_NEED);
+ else
+ {
+ NPCPhrase (HAVE_4_SHIPS);
+
+ AlienTalkSegue ((COUNT)~0);
+ AddEscortShips (UTWIG_SHIP, 4);
+ }
+ }
+}
+
+static void AlliedHome (RESPONSE_REF R);
+
+static void
+AlliedHome (RESPONSE_REF R)
+{
+ BYTE NumVisits, News;
+
+ News = GET_GAME_STATE (UTWIG_WAR_NEWS);
+ NumVisits = GET_GAME_STATE (UTWIG_SUPOX_MISSION);
+ if (PLAYER_SAID (R, how_went_war))
+ {
+ NPCPhrase (ABOUT_BATTLE);
+
+ News |= (1 << 0);
+ }
+ else if (PLAYER_SAID (R, how_goes_war))
+ {
+ if (NumVisits == 1)
+ {
+ NPCPhrase (FLEET_ON_WAY);
+
+ SET_GAME_STATE (UTWIG_WAR_NEWS, 1);
+ }
+ else switch (GET_GAME_STATE (UTWIG_WAR_NEWS))
+ {
+ case 0:
+ NPCPhrase (BATTLE_HAPPENS_1);
+ News = 1;
+ break;
+ case 1:
+ NPCPhrase (BATTLE_HAPPENS_2);
+ News = 2;
+ break;
+ }
+
+ DISABLE_PHRASE (how_goes_war);
+ }
+ else if (PLAYER_SAID (R, learn_new_info))
+ {
+ if (NumVisits < 5)
+ NPCPhrase (NO_NEW_INFO);
+ else
+ {
+ NPCPhrase (SAMATRA);
+
+ News |= (1 << 1);
+ }
+
+ DISABLE_PHRASE (learn_new_info);
+ }
+ else if (PLAYER_SAID (R, what_now_homeworld))
+ {
+ if (NumVisits < 5)
+ NPCPhrase (UP_TO_YOU);
+ else
+ NPCPhrase (HOPE_KILL_EACH_OTHER);
+
+ DISABLE_PHRASE (what_now_homeworld);
+ }
+ else if (PLAYER_SAID (R, how_is_ultron))
+ {
+ NPCPhrase (ULTRON_IS_GREAT);
+
+ DISABLE_PHRASE (how_is_ultron);
+ }
+ SET_GAME_STATE (UTWIG_WAR_NEWS, News);
+
+ if (NumVisits >= 5)
+ {
+ if (!(News & (1 << 0)))
+ Response (how_went_war, AlliedHome);
+ }
+ else if (PHRASE_ENABLED (how_goes_war)
+ && ((NumVisits == 1 && News == 0)
+ || (NumVisits && News < 2)))
+ Response (how_goes_war, AlliedHome);
+ if (PHRASE_ENABLED (learn_new_info))
+ Response (learn_new_info, AlliedHome);
+ if (PHRASE_ENABLED (what_now_homeworld))
+ Response (what_now_homeworld, AlliedHome);
+ if (PHRASE_ENABLED (how_is_ultron))
+ Response (how_is_ultron, AlliedHome);
+ if (NumVisits == 0 && EscortFeasibilityStudy (UTWIG_SHIP) != 0)
+ Response (can_you_help, ExitConversation);
+ Response (bye_allied_homeworld, ExitConversation);
+}
+
+static void
+BeforeKohrAh (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_before_space))
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_BEFORE_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_BEFORE_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_before_space);
+ }
+ else if (PLAYER_SAID (R, what_now_before_space))
+ {
+ NPCPhrase (DO_THIS_BEFORE_SPACE);
+
+ DISABLE_PHRASE (what_now_before_space);
+ }
+
+ if (PHRASE_ENABLED (whats_up_before_space))
+ Response (whats_up_before_space, BeforeKohrAh);
+ if (PHRASE_ENABLED (what_now_before_space))
+ Response (what_now_before_space, BeforeKohrAh);
+ Response (bye_before_space, ExitConversation);
+}
+
+static void
+AfterKohrAh (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_after_space))
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_AFTER_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_AFTER_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_after_space);
+ }
+ else if (PLAYER_SAID (R, what_now_after_space))
+ {
+ NPCPhrase (DO_THIS_AFTER_SPACE);
+
+ DISABLE_PHRASE (what_now_after_space);
+ }
+
+ if (PHRASE_ENABLED (whats_up_after_space))
+ Response (whats_up_after_space, AfterKohrAh);
+ if (PHRASE_ENABLED (what_now_after_space))
+ Response (what_now_after_space, AfterKohrAh);
+ Response (bye_after_space, ExitConversation);
+}
+
+static void
+NeutralUtwig (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[4];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = pStr[3] = 0;
+ if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase (WOULD_BE_HAPPY_BUT);
+
+ SET_GAME_STATE (UTWIG_STACK1, 1);
+ }
+ else if (PLAYER_SAID (R, why_sad))
+ {
+ NPCPhrase (ULTRON_BROKE);
+
+ SET_GAME_STATE (UTWIG_STACK1, 2);
+ }
+ else if (PLAYER_SAID (R, what_ultron))
+ {
+ NPCPhrase (GLORIOUS_ULTRON);
+
+ SET_GAME_STATE (UTWIG_STACK1, 3);
+ }
+ else if (PLAYER_SAID (R, dont_be_babies))
+ {
+ NPCPhrase (MOCK_OUR_PAIN);
+
+ setSegue (Segue_hostile);
+ SET_GAME_STATE (UTWIG_STACK1, 4);
+ SET_GAME_STATE (UTWIG_HOSTILE, 1);
+ SET_GAME_STATE (UTWIG_INFO, 0);
+ SET_GAME_STATE (UTWIG_HOME_VISITS, 0);
+ SET_GAME_STATE (UTWIG_VISITS, 0);
+ SET_GAME_STATE (BOMB_VISITS, 0);
+ return;
+ }
+ else if (PLAYER_SAID (R, real_sorry_about_ultron))
+ {
+ NPCPhrase (APPRECIATE_SYMPATHY);
+
+ SET_GAME_STATE (UTWIG_STACK1, 4);
+ return;
+ }
+ else if (PLAYER_SAID (R, what_about_you_1))
+ {
+ NPCPhrase (ABOUT_US_1);
+
+ LastStack = 2;
+ SET_GAME_STATE (UTWIG_WAR_NEWS, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_you_2))
+ {
+ NPCPhrase (ABOUT_US_2);
+
+ LastStack = 2;
+ StartSphereTracking (SUPOX_SHIP);
+ SET_GAME_STATE (UTWIG_WAR_NEWS, 2);
+ }
+ else if (PLAYER_SAID (R, what_about_you_3))
+ {
+ NPCPhrase (ABOUT_US_3);
+
+ SET_GAME_STATE (UTWIG_WAR_NEWS, 3);
+ }
+ else if (PLAYER_SAID (R, what_about_urquan_1))
+ {
+ NPCPhrase (ABOUT_URQUAN_1);
+
+ LastStack = 3;
+ SET_GAME_STATE (UTWIG_STACK2, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_urquan_2))
+ {
+ NPCPhrase (ABOUT_URQUAN_2);
+
+ SET_GAME_STATE (UTWIG_STACK2, 2);
+ }
+
+ switch (GET_GAME_STATE (UTWIG_STACK1))
+ {
+ case 0:
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ we_are_vindicator0,
+ GLOBAL_SIS (CommanderName),
+ we_are_vindicator1,
+ buf,
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ }
+ pStr[0] = we_are_vindicator0;
+ break;
+ case 1:
+ pStr[0] = why_sad;
+ break;
+ case 2:
+ pStr[0] = what_ultron;
+ break;
+ case 3:
+ pStr[0] = dont_be_babies;
+ pStr[1] = real_sorry_about_ultron;
+ break;
+ }
+ switch (GET_GAME_STATE (UTWIG_WAR_NEWS))
+ {
+ case 0:
+ pStr[2] = what_about_you_1;
+ break;
+ case 1:
+ pStr[2] = what_about_you_2;
+ break;
+ case 2:
+ pStr[2] = what_about_you_3;
+ break;
+ }
+ switch (GET_GAME_STATE (UTWIG_STACK2))
+ {
+ case 0:
+ pStr[2] = what_about_urquan_1;
+ break;
+ case 1:
+ pStr[2] = what_about_urquan_2;
+ break;
+ }
+
+ if (pStr[LastStack])
+ {
+ if (pStr[LastStack] != we_are_vindicator0)
+ Response (pStr[LastStack], NeutralUtwig);
+ else
+ DoResponsePhrase (pStr[LastStack], NeutralUtwig, shared_phrase_buf);
+ }
+ for (i = 0; i < 4; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (pStr[i] != we_are_vindicator0)
+ Response (pStr[i], NeutralUtwig);
+ else
+ DoResponsePhrase (pStr[i], NeutralUtwig, shared_phrase_buf);
+ }
+ }
+ if (GET_GAME_STATE (ULTRON_CONDITION))
+ Response (got_ultron, ExitConversation);
+ Response (bye_neutral, ExitConversation);
+}
+
+static void
+BombWorld (RESPONSE_REF R)
+{
+ BYTE LastStack;
+ RESPONSE_REF pStr[2];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = 0;
+ if (PLAYER_SAID (R, why_you_here))
+ {
+ NPCPhrase (WE_GUARD_BOMB);
+
+ SET_GAME_STATE (BOMB_STACK1, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_bomb))
+ {
+ NPCPhrase (ABOUT_BOMB);
+
+ SET_GAME_STATE (BOMB_STACK1, 2);
+ }
+ else if (PLAYER_SAID (R, give_us_bomb_or_die))
+ {
+ NPCPhrase (GUARDS_WARN);
+
+ SET_GAME_STATE (BOMB_STACK1, 3);
+ }
+ else if (PLAYER_SAID (R, demand_bomb))
+ {
+ NPCPhrase (GUARDS_FIGHT);
+
+ setSegue (Segue_hostile);
+ SET_GAME_STATE (UTWIG_HOSTILE, 1);
+ SET_GAME_STATE (UTWIG_INFO, 0);
+ SET_GAME_STATE (UTWIG_HOME_VISITS, 0);
+ SET_GAME_STATE (UTWIG_VISITS, 0);
+ SET_GAME_STATE (BOMB_VISITS, 0);
+ return;
+ }
+ else if (PLAYER_SAID (R, may_we_have_bomb))
+ {
+ NPCPhrase (NO_BOMB);
+
+ LastStack = 1;
+ SET_GAME_STATE (BOMB_STACK2, 1);
+ }
+ else if (PLAYER_SAID (R, please))
+ {
+ NPCPhrase (SORRY_NO_BOMB);
+
+ SET_GAME_STATE (BOMB_STACK2, 2);
+ }
+ else if (PLAYER_SAID (R, whats_up_bomb))
+ {
+ if (GET_GAME_STATE (BOMB_INFO))
+ NPCPhrase (GENERAL_INFO_BOMB_2);
+ else
+ {
+ NPCPhrase (GENERAL_INFO_BOMB_1);
+
+ SET_GAME_STATE (BOMB_INFO, 1);
+ }
+
+ DISABLE_PHRASE (whats_up_bomb);
+ }
+
+ switch (GET_GAME_STATE (BOMB_STACK2))
+ {
+ case 0:
+ pStr[1] = may_we_have_bomb;
+ break;
+ case 1:
+ pStr[1] = please;
+ break;
+ }
+ switch (GET_GAME_STATE (BOMB_STACK1))
+ {
+ case 0:
+ pStr[0] = why_you_here;
+ pStr[1] = 0;
+ break;
+ case 1:
+ pStr[0] = what_about_bomb;
+ pStr[1] = 0;
+ break;
+ case 2:
+ pStr[0] = give_us_bomb_or_die;
+ break;
+ case 3:
+ pStr[0] = demand_bomb;
+ break;
+ }
+
+ if (pStr[LastStack])
+ Response (pStr[LastStack], BombWorld);
+ LastStack ^= 1;
+ if (pStr[LastStack])
+ Response (pStr[LastStack], BombWorld);
+
+ if (PHRASE_ENABLED (whats_up_bomb) && (GET_GAME_STATE (BOMB_STACK1) > 1))
+ Response (whats_up_bomb, BombWorld);
+
+ if (GET_GAME_STATE (ULTRON_CONDITION)
+ && !GET_GAME_STATE (REFUSED_ULTRON_AT_BOMB))
+ Response (got_ultron, ExitConversation);
+
+ if (GET_GAME_STATE (BOMB_INFO))
+ {
+ Response (bye_bomb, ExitConversation);
+ }
+ else
+ {
+ Response (bye_neutral, ExitConversation);
+ }
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (UTWIG_HOSTILE))
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NumVisits = GET_GAME_STATE (BOMB_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_BOMB_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_BOMB_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (BOMB_VISITS, NumVisits);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_HOMEWORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOSTILE_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOSTILE_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_VISITS, NumVisits);
+ }
+
+ if (!GET_GAME_STATE (ULTRON_CONDITION)
+ || (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6)))
+ {
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ Response (hey_wait_got_ultron, ExitConversation);
+ }
+ }
+ else if (CheckAlliance (UTWIG_SHIP) == GOOD_GUY)
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (ALLIED_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_HOME_VISITS, NumVisits);
+
+ AlliedHome ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_SUPOX_MISSION);
+ if (NumVisits == 1)
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_BEFORE_KOHRAH_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_BEFORE_KOHRAH_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_VISITS, NumVisits);
+
+ BeforeKohrAh ((RESPONSE_REF)0);
+ }
+ else if (NumVisits < 5)
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_DURING_KOHRAH_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_DURING_KOHRAH_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HELLO_AFTER_KOHRAH_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (HELLO_AFTER_KOHRAH_SPACE_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_VISITS, NumVisits);
+
+ AfterKohrAh ((RESPONSE_REF)0);
+ }
+ }
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ NumVisits = GET_GAME_STATE (BOMB_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (BOMB_WORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (BOMB_WORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (BOMB_VISITS, NumVisits);
+
+ BombWorld ((RESPONSE_REF)0);
+ }
+ else
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (NEUTRAL_HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (UTWIG_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (NEUTRAL_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (UTWIG_VISITS, NumVisits);
+ }
+
+ NeutralUtwig ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_utwig (void)
+{
+ return (0);
+}
+
+static void
+post_utwig_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_utwig_comm (void)
+{
+ LOCDATA *retval;
+
+ utwig_desc.init_encounter_func = Intro;
+ utwig_desc.post_encounter_func = post_utwig_enc;
+ utwig_desc.uninit_encounter_func = uninit_utwig;
+
+ utwig_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1);
+ utwig_desc.AlienTextBaseline.y = 70;
+ utwig_desc.AlienTextWidth = SIS_TEXT_WIDTH - 16;
+
+ if (GET_GAME_STATE (UTWIG_HAVE_ULTRON))
+ { // use alternate 'Happy Utwig!' track
+ utwig_desc.AlienAltSongRes = UTWIG_ULTRON_MUSIC;
+ utwig_desc.AlienSongFlags |= LDASF_USE_ALTERNATE;
+ }
+ else
+ { // regular track -- let's make sure
+ utwig_desc.AlienSongFlags &= ~LDASF_USE_ALTERNATE;
+ }
+
+ if (GET_GAME_STATE (UTWIG_HAVE_ULTRON)
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &utwig_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/vux/Makeinfo b/src/uqm/comm/vux/Makeinfo
new file mode 100644
index 0000000..da9446f
--- /dev/null
+++ b/src/uqm/comm/vux/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="vuxc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/vux/resinst.h b/src/uqm/comm/vux/resinst.h
new file mode 100644
index 0000000..5004523
--- /dev/null
+++ b/src/uqm/comm/vux/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define VUX_COLOR_MAP "comm.vux.colortable"
+#define VUX_CONVERSATION_PHRASES "comm.vux.dialogue"
+#define VUX_FONT "comm.vux.font"
+#define VUX_MUSIC "comm.vux.music"
+#define VUX_PMAP_ANIM "comm.vux.graphics"
diff --git a/src/uqm/comm/vux/strings.h b/src/uqm/comm/vux/strings.h
new file mode 100644
index 0000000..5bf58b7
--- /dev/null
+++ b/src/uqm/comm/vux/strings.h
@@ -0,0 +1,129 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef VUX_STRINGS_H
+#define VUX_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ ZEX_HELLO_1,
+ ZEX_HELLO_2,
+ ZEX_HELLO_3,
+ ZEX_HELLO_4,
+ FIGHT_OR_TRADE_1,
+ FIGHT_OR_TRADE_2,
+ what_you_do_here,
+ MY_MENAGERIE,
+ what_about_menagerie,
+ NEED_NEW_CREATURE,
+ what_about_creature,
+ ABOUT_CREATURE,
+ about_creature_again,
+ CREATURE_AGAIN,
+ i_have_beast,
+ GIVE_BEAST,
+ ok_take_beast,
+ FOOL_AIEE0,
+ FOOL_AIEE1,
+ why_trust_1,
+ TRUST_1,
+ why_trust_2,
+ TRUST_2,
+ why_trust_3,
+ TRUST_3,
+ why_dont_you_attack,
+ LIKE_YOU,
+ why_like_me,
+ LIKE_BECAUSE,
+ are_you_a_pervert,
+ CALL_ME_WHAT_YOU_WISH,
+ take_by_force,
+ PRECURSOR_DEVICE,
+ regardless,
+ THEN_FIGHT,
+ you_lied,
+ YUP_LIED,
+ kill_you,
+ FIGHT_AGAIN,
+ bye_zex,
+ GOODBYE_ZEX,
+ HOMEWORLD_HELLO_1,
+ HOMEWORLD_HELLO_2,
+ HOMEWORLD_HELLO_3,
+ HOMEWORLD_HELLO_4,
+ SPACE_HELLO_1,
+ SPACE_HELLO_2,
+ SPACE_HELLO_3,
+ SPACE_HELLO_4,
+ kill_you_squids_1,
+ kill_you_squids_2,
+ kill_you_squids_3,
+ kill_you_squids_4,
+ WE_FIGHT,
+ why_so_mean,
+ URQUAN_SLAVES,
+ deeper_reason,
+ OLD_INSULT,
+ if_we_apologize,
+ PROBABLY_NOT,
+ try_any_way,
+ NOPE,
+ APOLOGIZE_IN_SPACE,
+ apology_1,
+ NOT_ACCEPTED_1,
+ apology_2,
+ NOT_ACCEPTED_2,
+ apology_3,
+ NOT_ACCEPTED_3,
+ apology_4,
+ NOT_ACCEPTED_4,
+ apology_5,
+ NOT_ACCEPTED_5,
+ apology_6,
+ NOT_ACCEPTED_6,
+ apology_7,
+ NOT_ACCEPTED_7,
+ apology_8,
+ NOT_ACCEPTED_8,
+ apology_9,
+ NOT_ACCEPTED_9,
+ apology_10,
+ TRUTH,
+ whats_up_hostile,
+ GENERAL_INFO_HOSTILE_1,
+ GENERAL_INFO_HOSTILE_2,
+ GENERAL_INFO_HOSTILE_3,
+ GENERAL_INFO_HOSTILE_4,
+ cant_we_be_friends_1,
+ NEVER_UGLY_HUMANS_1,
+ cant_we_be_friends_2,
+ NEVER_UGLY_HUMANS_2,
+ cant_we_be_friends_3,
+ NEVER_UGLY_HUMANS_3,
+ cant_we_be_friends_4,
+ NEVER_UGLY_HUMANS_4,
+ bye_hostile_space,
+ GOODBYE_AND_DIE_HOSTILE_SPACE_1,
+ GOODBYE_AND_DIE_HOSTILE_SPACE_2,
+ GOODBYE_AND_DIE_HOSTILE_SPACE_3,
+ GOODBYE_AND_DIE_HOSTILE_SPACE_4,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/vux/vuxc.c b/src/uqm/comm/vux/vuxc.c
new file mode 100644
index 0000000..7f7419c
--- /dev/null
+++ b/src/uqm/comm/vux/vuxc.c
@@ -0,0 +1,796 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+static LOCDATA vux_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ VUX_PMAP_ANIM, /* AlienFrame */
+ VUX_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* (SIS_TEXT_WIDTH - 16) >> 1, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_TOP, /* AlienTextValign */
+ VUX_COLOR_MAP, /* AlienColorMap */
+ VUX_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ VUX_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 17, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ {
+ 12, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 15, /* StartIndex */
+ 5, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 20, /* StartIndex */
+ 14, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND / 30, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 34, /* StartIndex */
+ 7, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 41, /* StartIndex */
+ 6, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 47, /* StartIndex */
+ 11, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 58, /* StartIndex */
+ 3, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 61, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 65, /* StartIndex */
+ 4, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 69, /* StartIndex */
+ 2, /* NumFrames */
+ RANDOM_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 71, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 74, /* StartIndex */
+ 6, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 80, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* RestartRate */
+ (1 << 14), /* BlockMask */
+ },
+ {
+ 85, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 90, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* RestartRate */
+ (1 << 12), /* BlockMask */
+ },
+ {
+ 95, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 5, ONE_SECOND * 5,/* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 99, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 5, ONE_SECOND * 5,/* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 11, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+CombatIsInevitable (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, ok_take_beast))
+ {
+ NPCPhrase (FOOL_AIEE0);
+ NPCPhrase (FOOL_AIEE1);
+
+ AlienTalkSegue (1);
+ XFormColorMap (GetColorMapAddress (
+ SetAbsColorMapIndex (CommData.AlienColorMap, 1)
+ ), ONE_SECOND / 4);
+ AlienTalkSegue ((COUNT)~0);
+
+ SET_GAME_STATE (VUX_BEAST_ON_SHIP, 0);
+ SET_GAME_STATE (ZEX_IS_DEAD, 1);
+ setSegue (Segue_peace);
+ }
+ else if (PLAYER_SAID (R, try_any_way))
+ {
+ NPCPhrase (NOPE);
+
+ SET_GAME_STATE (VUX_STACK_1, 4);
+ }
+ else if (PLAYER_SAID (R, kill_you_squids_1)
+ || PLAYER_SAID (R, kill_you_squids_2)
+ || PLAYER_SAID (R, kill_you_squids_3)
+ || PLAYER_SAID (R, kill_you_squids_4))
+ {
+ NPCPhrase (WE_FIGHT);
+
+ NumVisits = GET_GAME_STATE (VUX_STACK_2) + 1;
+ if (NumVisits <= 3)
+ {
+ SET_GAME_STATE (VUX_STACK_2, NumVisits);
+ }
+ }
+ else if (PLAYER_SAID (R, cant_we_be_friends_1)
+ || PLAYER_SAID (R, cant_we_be_friends_2)
+ || PLAYER_SAID (R, cant_we_be_friends_3)
+ || PLAYER_SAID (R, cant_we_be_friends_4))
+ {
+ NumVisits = GET_GAME_STATE (VUX_STACK_3);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (NEVER_UGLY_HUMANS_1);
+ break;
+ case 1:
+ NPCPhrase (NEVER_UGLY_HUMANS_2);
+ break;
+ case 2:
+ NPCPhrase (NEVER_UGLY_HUMANS_3);
+ break;
+ case 3:
+ NPCPhrase (NEVER_UGLY_HUMANS_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (VUX_STACK_3, NumVisits);
+ }
+ else if (PLAYER_SAID (R, bye_hostile_space))
+ {
+ NumVisits = GET_GAME_STATE (VUX_STACK_4);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GOODBYE_AND_DIE_HOSTILE_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GOODBYE_AND_DIE_HOSTILE_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (GOODBYE_AND_DIE_HOSTILE_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (GOODBYE_AND_DIE_HOSTILE_SPACE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (VUX_STACK_4, NumVisits);
+ }
+ else if (PLAYER_SAID (R, bye_zex))
+ {
+ NPCPhrase (GOODBYE_ZEX);
+
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (VUX_STACK_1);
+ switch (NumVisits++)
+ {
+ case 4:
+ NPCPhrase (NOT_ACCEPTED_1);
+ break;
+ case 5:
+ NPCPhrase (NOT_ACCEPTED_2);
+ break;
+ case 6:
+ NPCPhrase (NOT_ACCEPTED_3);
+ break;
+ case 7:
+ NPCPhrase (NOT_ACCEPTED_4);
+ break;
+ case 8:
+ NPCPhrase (NOT_ACCEPTED_5);
+ break;
+ case 9:
+ NPCPhrase (NOT_ACCEPTED_6);
+ break;
+ case 10:
+ NPCPhrase (NOT_ACCEPTED_7);
+ break;
+ case 11:
+ NPCPhrase (NOT_ACCEPTED_8);
+ break;
+ case 12:
+ NPCPhrase (NOT_ACCEPTED_9);
+ break;
+ case 13:
+ NPCPhrase (TRUTH);
+ break;
+ }
+ SET_GAME_STATE (VUX_STACK_1, NumVisits);
+ }
+}
+
+static void
+Menagerie (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[3];
+
+ if (PLAYER_SAID (R, i_have_beast)
+ || PLAYER_SAID (R, why_trust_1)
+ || PLAYER_SAID (R, why_trust_2)
+ || PLAYER_SAID (R, why_trust_3))
+ {
+ if (PLAYER_SAID (R, i_have_beast))
+ NPCPhrase (GIVE_BEAST);
+ else if (PLAYER_SAID (R, why_trust_1))
+ {
+ NPCPhrase (TRUST_1);
+
+ DISABLE_PHRASE (why_trust_1);
+ }
+ else if (PLAYER_SAID (R, why_trust_2))
+ {
+ NPCPhrase (TRUST_2);
+
+ DISABLE_PHRASE (why_trust_2);
+ }
+ else if (PLAYER_SAID (R, why_trust_3))
+ {
+ NPCPhrase (TRUST_3);
+
+ DISABLE_PHRASE (why_trust_3);
+ }
+
+ if (PHRASE_ENABLED (why_trust_1))
+ Response (why_trust_1, Menagerie);
+ else if (PHRASE_ENABLED (why_trust_2))
+ Response (why_trust_2, Menagerie);
+ else if (PHRASE_ENABLED (why_trust_3))
+ Response (why_trust_3, Menagerie);
+ Response (ok_take_beast, CombatIsInevitable);
+ }
+ else if (PLAYER_SAID (R, kill_you))
+ {
+ NPCPhrase (FIGHT_AGAIN);
+
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, regardless))
+ {
+ NPCPhrase (THEN_FIGHT);
+
+ setSegue (Segue_hostile);
+ SET_GAME_STATE (ZEX_STACK_3, 2);
+ SET_GAME_STATE (ZEX_VISITS, 0);
+ }
+ else
+ {
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (R == 0)
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (ZEX_VISITS);
+ if (GET_GAME_STATE (ZEX_STACK_3) >= 2)
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (FIGHT_OR_TRADE_1);
+ break;
+ case 1:
+ NPCPhrase (FIGHT_OR_TRADE_2);
+ --NumVisits;
+ break;
+ }
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ZEX_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ZEX_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (ZEX_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (ZEX_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (ZEX_VISITS, NumVisits);
+ }
+ else if (PLAYER_SAID (R, what_you_do_here))
+ {
+ NPCPhrase (MY_MENAGERIE);
+
+ SET_GAME_STATE (ZEX_STACK_1, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_menagerie))
+ {
+ NPCPhrase (NEED_NEW_CREATURE);
+
+ SET_GAME_STATE (ZEX_STACK_1, 2);
+ }
+ else if (PLAYER_SAID (R, what_about_creature))
+ {
+ NPCPhrase (ABOUT_CREATURE);
+
+ SET_GAME_STATE (KNOW_ZEX_WANTS_MONSTER, 1);
+ SET_GAME_STATE (ZEX_STACK_1, 3);
+
+ R = about_creature_again;
+ DISABLE_PHRASE (what_about_creature);
+ }
+ else if (PLAYER_SAID (R, about_creature_again))
+ {
+ NPCPhrase (CREATURE_AGAIN);
+
+ DISABLE_PHRASE (about_creature_again);
+ }
+ else if (PLAYER_SAID (R, why_dont_you_attack))
+ {
+ NPCPhrase (LIKE_YOU);
+
+ LastStack = 1;
+ SET_GAME_STATE (ZEX_STACK_2, 1);
+ }
+ else if (PLAYER_SAID (R, why_like_me))
+ {
+ NPCPhrase (LIKE_BECAUSE);
+
+ LastStack = 1;
+ SET_GAME_STATE (ZEX_STACK_2, 2);
+ }
+ else if (PLAYER_SAID (R, are_you_a_pervert))
+ {
+ NPCPhrase (CALL_ME_WHAT_YOU_WISH);
+
+ SET_GAME_STATE (ZEX_STACK_2, 3);
+ }
+ else if (PLAYER_SAID (R, take_by_force))
+ {
+ NPCPhrase (PRECURSOR_DEVICE);
+
+ LastStack = 2;
+ SET_GAME_STATE (ZEX_STACK_3, 1);
+ }
+ else if (PLAYER_SAID (R, you_lied))
+ {
+ NPCPhrase (YUP_LIED);
+
+ LastStack = 2;
+ SET_GAME_STATE (ZEX_STACK_3, 3);
+ }
+
+ if (GET_GAME_STATE (KNOW_ZEX_WANTS_MONSTER)
+ && GET_GAME_STATE (VUX_BEAST_ON_SHIP))
+ pStr[0] = i_have_beast;
+ else
+ {
+ switch (GET_GAME_STATE (ZEX_STACK_1))
+ {
+ case 0:
+ pStr[0] = what_you_do_here;
+ break;
+ case 1:
+ pStr[0] = what_about_menagerie;
+ break;
+ case 2:
+ pStr[0] = what_about_creature;
+ break;
+ case 3:
+ if (PHRASE_ENABLED (about_creature_again))
+ pStr[0] = about_creature_again;
+ break;
+ }
+ }
+ switch (GET_GAME_STATE (ZEX_STACK_2))
+ {
+ case 0:
+ pStr[1] = why_dont_you_attack;
+ break;
+ case 1:
+ pStr[1] = why_like_me;
+ break;
+ case 2:
+ pStr[1] = are_you_a_pervert;
+ break;
+ }
+ switch (GET_GAME_STATE (ZEX_STACK_3))
+ {
+ case 0:
+ pStr[2] = take_by_force;
+ break;
+ case 1:
+ pStr[2] = regardless;
+ break;
+ case 2:
+ pStr[2] = you_lied;
+ break;
+ case 3:
+ pStr[2] = kill_you;
+ break;
+ }
+
+ if (pStr[LastStack])
+ Response (pStr[LastStack], Menagerie);
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ Response (pStr[i], Menagerie);
+ }
+ Response (bye_zex, CombatIsInevitable);
+ }
+}
+
+static void
+NormalVux (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, why_so_mean))
+ {
+ NPCPhrase (URQUAN_SLAVES);
+
+ SET_GAME_STATE (VUX_STACK_1, 1);
+ }
+ else if (PLAYER_SAID (R, deeper_reason))
+ {
+ NPCPhrase (OLD_INSULT);
+
+ SET_GAME_STATE (VUX_STACK_1, 2);
+ }
+ else if (PLAYER_SAID (R, if_we_apologize))
+ {
+ NPCPhrase (PROBABLY_NOT);
+
+ SET_GAME_STATE (VUX_STACK_1, 3);
+ }
+ else if (PLAYER_SAID (R, whats_up_hostile))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (VUX_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_HOSTILE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_HOSTILE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_HOSTILE_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_HOSTILE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (VUX_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_hostile);
+ }
+
+ switch (GET_GAME_STATE (VUX_STACK_1))
+ {
+ case 0:
+ Response (why_so_mean, NormalVux);
+ break;
+ case 1:
+ Response (deeper_reason, NormalVux);
+ break;
+ case 2:
+ Response (if_we_apologize, NormalVux);
+ break;
+ case 3:
+ Response (try_any_way, CombatIsInevitable);
+ break;
+ case 4:
+ Response (apology_1, CombatIsInevitable);
+ break;
+ case 5:
+ Response (apology_2, CombatIsInevitable);
+ break;
+ case 6:
+ Response (apology_3, CombatIsInevitable);
+ break;
+ case 7:
+ Response (apology_4, CombatIsInevitable);
+ break;
+ case 8:
+ Response (apology_5, CombatIsInevitable);
+ break;
+ case 9:
+ Response (apology_6, CombatIsInevitable);
+ break;
+ case 10:
+ Response (apology_7, CombatIsInevitable);
+ break;
+ case 11:
+ Response (apology_8, CombatIsInevitable);
+ break;
+ case 12:
+ Response (apology_9, CombatIsInevitable);
+ break;
+ case 13:
+ Response (apology_10, CombatIsInevitable);
+ break;
+ }
+
+ switch (GET_GAME_STATE (VUX_STACK_2))
+ {
+ case 0:
+ Response (kill_you_squids_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (kill_you_squids_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (kill_you_squids_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (kill_you_squids_4, CombatIsInevitable);
+ break;
+ }
+
+ if (PHRASE_ENABLED (whats_up_hostile))
+ {
+ Response (whats_up_hostile, NormalVux);
+ }
+
+ if (GET_GAME_STATE (VUX_STACK_1) > 13)
+ {
+ switch (GET_GAME_STATE (VUX_STACK_3))
+ {
+ case 0:
+ Response (cant_we_be_friends_1, CombatIsInevitable);
+ break;
+ case 1:
+ Response (cant_we_be_friends_2, CombatIsInevitable);
+ break;
+ case 2:
+ Response (cant_we_be_friends_3, CombatIsInevitable);
+ break;
+ case 3:
+ Response (cant_we_be_friends_4, CombatIsInevitable);
+ break;
+ }
+ }
+
+ Response (bye_hostile_space, CombatIsInevitable);
+}
+
+static void
+Intro (void)
+{
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ {
+ Menagerie ((RESPONSE_REF)0);
+ }
+ else
+ {
+ BYTE NumVisits;
+
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (VUX_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOMEWORLD_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (HOMEWORLD_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (HOMEWORLD_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (VUX_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (VUX_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (VUX_VISITS, NumVisits);
+ }
+
+ NormalVux ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_vux (void)
+{
+ return (0);
+}
+
+static void
+post_vux_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_vux_comm (void)
+{
+ LOCDATA *retval;
+
+ vux_desc.init_encounter_func = Intro;
+ vux_desc.post_encounter_func = post_vux_enc;
+ vux_desc.uninit_encounter_func = uninit_vux;
+
+ vux_desc.AlienTextBaseline.x = TEXT_X_OFFS + (SIS_TEXT_WIDTH >> 1)
+ + (SIS_TEXT_WIDTH >> 2);
+ vux_desc.AlienTextBaseline.y = 0;
+ vux_desc.AlienTextWidth = (SIS_TEXT_WIDTH - 16) >> 1;
+
+ if ((GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 6))
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+ retval = &vux_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/yehat/Makeinfo b/src/uqm/comm/yehat/Makeinfo
new file mode 100644
index 0000000..f38674b
--- /dev/null
+++ b/src/uqm/comm/yehat/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="yehatc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/yehat/resinst.h b/src/uqm/comm/yehat/resinst.h
new file mode 100644
index 0000000..3b0b203
--- /dev/null
+++ b/src/uqm/comm/yehat/resinst.h
@@ -0,0 +1,11 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define REBEL_CONVERSATION_PHRASES "comm.yehat.rebel.dialogue"
+#define REBEL_MUSIC "comm.yehat.rebel.music"
+#define YEHAT_COLOR_MAP "comm.yehat.colortable"
+#define YEHAT_CONVERSATION_PHRASES "comm.yehat.dialogue"
+#define YEHAT_FONT "comm.yehat.font"
+#define YEHAT_MUSIC "comm.yehat.music"
+#define YEHAT_PMAP_ANIM "comm.yehat.graphics"
diff --git a/src/uqm/comm/yehat/strings.h b/src/uqm/comm/yehat/strings.h
new file mode 100644
index 0000000..9bea2e0
--- /dev/null
+++ b/src/uqm/comm/yehat/strings.h
@@ -0,0 +1,102 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef YEHAT_STRINGS_H
+#define YEHAT_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ HOMEWORLD_HELLO_1,
+ HOMEWORLD_HELLO_2,
+ whats_up_homeworld,
+ GENERAL_INFO_HOMEWORLD_1,
+ GENERAL_INFO_HOMEWORLD_2,
+ i_demand_you_ally_homeworld0,
+ i_demand_you_ally_homeworld1,
+ i_demand_you_ally_homeworld2,
+ i_demand_you_ally_homeworld3,
+ ENEMY_MUST_DIE,
+ at_least_help_us_homeworld,
+ NO_HELP_ENEMY,
+ give_info,
+ NO_INFO_FOR_ENEMY,
+ what_about_pkunk_royalist,
+ PKUNK_ABSORBED_ROYALIST,
+ HATE_PKUNK_ROYALIST,
+ bye_homeworld,
+ GOODBYE_AND_DIE_HOMEWORLD,
+ SPACE_HELLO_1,
+ SPACE_HELLO_2,
+ SPACE_HELLO_3,
+ SPACE_HELLO_4,
+ whats_up_space_1,
+ GENERAL_INFO_SPACE_1,
+ whats_up_space_2,
+ GENERAL_INFO_SPACE_2,
+ whats_up_space_3,
+ GENERAL_INFO_SPACE_3,
+ whats_up_space_4,
+ GENERAL_INFO_SPACE_4,
+ i_demand_you_ally_space0,
+ i_demand_you_ally_space1,
+ i_demand_you_ally_space2,
+ i_demand_you_ally_space3,
+ WE_CANNOT_1,
+ obligation,
+ WE_CANNOT_2,
+ at_least_help_us_space,
+ SORRY_CANNOT,
+ dishonor,
+ HERES_A_HINT,
+ what_about_pkunk_space,
+ PKUNK_ABSORBED_SPACE,
+ HATE_PKUNK_SPACE,
+ bye_space,
+ GO_IN_PEACE,
+ GOODBYE_AND_DIE_SPACE,
+ shofixti_alive_1,
+ shofixti_alive_2,
+ SEND_HIM_OVER_1,
+ SEND_HIM_OVER_2,
+ not_here,
+ not_send,
+ JUST_A_TRICK_1,
+ JUST_A_TRICK_2,
+ ok_send,
+ WE_REVOLT,
+ ROYALIST_SPACE_HELLO_1,
+ ROYALIST_SPACE_HELLO_2,
+ ROYALIST_HOMEWORLD_HELLO_1,
+ ROYALIST_HOMEWORLD_HELLO_2,
+ how_is_rebellion,
+ ROYALIST_REBELLION_1,
+ ROYALIST_REBELLION_2,
+ sorry_about_revolution,
+ ALL_YOUR_FAULT,
+ bye_royalist,
+ GOODBYE_AND_DIE_ROYALIST,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ OUT_TAKES,
+};
+
+#endif /* _STRINGS_H */
diff --git a/src/uqm/comm/yehat/yehatc.c b/src/uqm/comm/yehat/yehatc.c
new file mode 100644
index 0000000..c1860bf
--- /dev/null
+++ b/src/uqm/comm/yehat/yehatc.c
@@ -0,0 +1,685 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/gameev.h"
+#include "libs/mathlib.h"
+
+
+static LOCDATA yehat_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ YEHAT_PMAP_ANIM, /* AlienFrame */
+ YEHAT_FONT, /* AlienFont */
+ WHITE_COLOR_INIT, /* AlienTextFColor */
+ BLACK_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* (SIS_TEXT_WIDTH - 16) * 2 / 3, */ /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ YEHAT_COLOR_MAP, /* AlienColorMap */
+ YEHAT_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ YEHAT_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 15, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ { /* right hand-wing tapping keyboard; front guy */
+ 4, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND / 4, ONE_SECOND / 2,/* RestartRate */
+ (1 << 6) | (1 << 7),
+ },
+ { /* left hand-wing tapping keyboard; front guy */
+ 7, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM
+ | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 10, ONE_SECOND / 10, /* FrameRate */
+ ONE_SECOND / 4, ONE_SECOND / 2,/* RestartRate */
+ (1 << 6) | (1 << 7),
+ },
+ {
+ 10, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 4) | (1 << 14),
+ },
+ {
+ 13, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 20, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 5),
+ },
+ {
+ 16, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 6, ONE_SECOND * 3,/* RestartRate */
+ (1 << 2) | (1 << 14),
+ },
+ {
+ 21, /* StartIndex */
+ 5, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 6, ONE_SECOND * 3,/* RestartRate */
+ (1 << 3),
+ },
+ { /* right arm-wing rising; front guy */
+ 26, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 6, ONE_SECOND * 3,/* RestartRate */
+ (1 << 0) | (1 << 1),
+ },
+ { /* left arm-wing rising; front guy */
+ 28, /* StartIndex */
+ 2, /* NumFrames */
+ YOYO_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 15, ONE_SECOND / 15, /* FrameRate */
+ ONE_SECOND * 6, ONE_SECOND * 3,/* RestartRate */
+ (1 << 0) | (1 << 1),
+ },
+ {
+ 30, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 33, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 36, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 39, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 42, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 45, /* StartIndex */
+ 3, /* NumFrames */
+ YOYO_ANIM, /* AnimFlags */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* FrameRate */
+ ONE_SECOND / 30, ONE_SECOND / 30, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ {
+ 48, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM | WAIT_TALKING, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ ONE_SECOND, ONE_SECOND * 3, /* RestartRate */
+ (1 << 2) | (1 << 4),
+ },
+ },
+ { /* AlienTransitionDesc - empty */
+ 0, /* StartIndex */
+ 0, /* NumFrames */
+ 0, /* AnimFlags */
+ 0, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ 1, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_hostile);
+
+ if (PLAYER_SAID (R, bye_homeworld))
+ NPCPhrase (GOODBYE_AND_DIE_HOMEWORLD);
+ else if (PLAYER_SAID (R, bye_royalist))
+ NPCPhrase (GOODBYE_AND_DIE_ROYALIST);
+ else if (PLAYER_SAID (R, i_demand_you_ally_homeworld0))
+ {
+ NPCPhrase (ENEMY_MUST_DIE);
+
+ SET_GAME_STATE (NO_YEHAT_ALLY_HOME, 1);
+ }
+ else if (PLAYER_SAID (R, bye_space))
+ {
+ if ((BYTE)TFB_Random () & 1)
+ NPCPhrase (GOODBYE_AND_DIE_SPACE);
+ else
+ {
+ NPCPhrase (GO_IN_PEACE);
+
+ setSegue (Segue_peace);
+ }
+ }
+ else if (PLAYER_SAID (R, not_here)
+ || PLAYER_SAID (R, not_send))
+ {
+ switch (GET_GAME_STATE (YEHAT_REBEL_VISITS))
+ {
+ case 0:
+ NPCPhrase (JUST_A_TRICK_1);
+ break;
+ case 1:
+ NPCPhrase (JUST_A_TRICK_2);
+ break;
+ }
+ SET_GAME_STATE (YEHAT_REBEL_VISITS, 1);
+ }
+ else if (PLAYER_SAID (R, ok_send))
+ {
+ NPCPhrase (WE_REVOLT);
+
+ setSegue (Segue_peace);
+ SET_GAME_STATE (YEHAT_CIVIL_WAR, 1);
+ SET_GAME_STATE (YEHAT_VISITS, 0);
+ SET_GAME_STATE (YEHAT_HOME_VISITS, 0);
+ SET_GAME_STATE (YEHAT_REBEL_VISITS, 0);
+ SET_GAME_STATE (YEHAT_REBEL_INFO, 0);
+ SET_GAME_STATE (YEHAT_REBEL_TOLD_PKUNK, 0);
+ SET_GAME_STATE (NO_YEHAT_INFO, 0);
+
+ AddEvent (RELATIVE_EVENT, 0, 0, 0, YEHAT_REBEL_EVENT);
+ }
+}
+
+static void
+Royalists (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, how_is_rebellion))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (YEHAT_ROYALIST_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ROYALIST_REBELLION_1);
+ break;
+ case 1:
+ NPCPhrase (ROYALIST_REBELLION_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_ROYALIST_INFO, NumVisits);
+
+ DISABLE_PHRASE (how_is_rebellion);
+ }
+ else if (PLAYER_SAID (R, what_about_pkunk_royalist))
+ {
+ if (GET_GAME_STATE (YEHAT_ABSORBED_PKUNK))
+ NPCPhrase (PKUNK_ABSORBED_ROYALIST);
+ else
+ NPCPhrase (HATE_PKUNK_ROYALIST);
+
+ SET_GAME_STATE (YEHAT_ROYALIST_TOLD_PKUNK, 1);
+ }
+ else if (PLAYER_SAID (R, sorry_about_revolution))
+ {
+ NPCPhrase (ALL_YOUR_FAULT);
+
+ SET_GAME_STATE (NO_YEHAT_INFO, 1);
+ }
+
+ if (PHRASE_ENABLED (how_is_rebellion))
+ Response (how_is_rebellion, Royalists);
+ if (!GET_GAME_STATE (YEHAT_ROYALIST_TOLD_PKUNK)
+ && GET_GAME_STATE (PKUNK_VISITS)
+ && GET_GAME_STATE (PKUNK_HOME_VISITS))
+ Response (what_about_pkunk_royalist, Royalists);
+ if (!GET_GAME_STATE (NO_YEHAT_INFO))
+ Response (sorry_about_revolution, Royalists);
+ Response (bye_royalist, ExitConversation);
+}
+
+static void
+StartRevolt (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, shofixti_alive_1))
+ {
+ NPCPhrase (SEND_HIM_OVER_1);
+
+ SET_GAME_STATE (YEHAT_REBEL_TOLD_PKUNK, 1);
+ }
+ else if (PLAYER_SAID (R, shofixti_alive_2))
+ NPCPhrase (SEND_HIM_OVER_2);
+
+ if (HaveEscortShip (SHOFIXTI_SHIP))
+ Response (ok_send, ExitConversation);
+ else
+ Response (not_here, ExitConversation);
+ Response (not_send, ExitConversation);
+}
+
+static void
+YehatHome (RESPONSE_REF R)
+{
+
+ if (PLAYER_SAID (R, whats_up_homeworld))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (YEHAT_ROYALIST_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_HOMEWORLD_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_HOMEWORLD_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_ROYALIST_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_homeworld);
+ }
+ else if (PLAYER_SAID (R, at_least_help_us_homeworld))
+ {
+ NPCPhrase (NO_HELP_ENEMY);
+
+ SET_GAME_STATE (NO_YEHAT_HELP_HOME, 1);
+ }
+ else if (PLAYER_SAID (R, give_info))
+ {
+ NPCPhrase (NO_INFO_FOR_ENEMY);
+
+ SET_GAME_STATE (NO_YEHAT_INFO, 1);
+ }
+ else if (PLAYER_SAID (R, what_about_pkunk_royalist))
+ {
+ if (GET_GAME_STATE (YEHAT_ABSORBED_PKUNK))
+ NPCPhrase (PKUNK_ABSORBED_ROYALIST);
+ else
+ NPCPhrase (HATE_PKUNK_ROYALIST);
+
+ SET_GAME_STATE (YEHAT_ROYALIST_TOLD_PKUNK, 1);
+ }
+
+ if (PHRASE_ENABLED (whats_up_homeworld))
+ Response (whats_up_homeworld, YehatHome);
+ if (!GET_GAME_STATE (YEHAT_ROYALIST_TOLD_PKUNK)
+ && GET_GAME_STATE (PKUNK_VISITS)
+ && GET_GAME_STATE (PKUNK_HOME_VISITS))
+ Response (what_about_pkunk_royalist, YehatHome);
+ if (!GET_GAME_STATE (NO_YEHAT_HELP_HOME))
+ Response (at_least_help_us_homeworld, YehatHome);
+ if (!GET_GAME_STATE (NO_YEHAT_INFO))
+ Response (give_info, YehatHome);
+ if (!GET_GAME_STATE (NO_YEHAT_ALLY_HOME))
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ i_demand_you_ally_homeworld0,
+ GLOBAL_SIS (CommanderName),
+ i_demand_you_ally_homeworld1,
+ buf,
+ i_demand_you_ally_homeworld2,
+ GLOBAL_SIS (ShipName),
+ i_demand_you_ally_homeworld3,
+ (UNICODE*)NULL);
+ DoResponsePhrase (i_demand_you_ally_homeworld0,
+ ExitConversation, shared_phrase_buf);
+ }
+ Response (bye_homeworld, ExitConversation);
+}
+
+static void
+YehatSpace (RESPONSE_REF R)
+{
+ BYTE i, LastStack;
+ RESPONSE_REF pStr[3];
+
+ LastStack = 0;
+ pStr[0] = pStr[1] = pStr[2] = 0;
+ if (PLAYER_SAID (R, whats_up_space_1)
+ || PLAYER_SAID (R, whats_up_space_2)
+ || PLAYER_SAID (R, whats_up_space_3)
+ || PLAYER_SAID (R, whats_up_space_4))
+ {
+ BYTE NumVisits;
+
+ NumVisits = GET_GAME_STATE (YEHAT_REBEL_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (GENERAL_INFO_SPACE_1);
+ break;
+ case 1:
+ NPCPhrase (GENERAL_INFO_SPACE_2);
+ break;
+ case 2:
+ NPCPhrase (GENERAL_INFO_SPACE_3);
+ break;
+ case 3:
+ NPCPhrase (GENERAL_INFO_SPACE_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_REBEL_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_space_1);
+ }
+ else if (PLAYER_SAID (R, i_demand_you_ally_space0))
+ {
+ NPCPhrase (WE_CANNOT_1);
+
+ LastStack = 2;
+ SET_GAME_STATE (NO_YEHAT_ALLY_SPACE, 1);
+ }
+ else if (PLAYER_SAID (R, obligation))
+ {
+ NPCPhrase (WE_CANNOT_2);
+
+ setSegue (Segue_peace);
+ SET_GAME_STATE (NO_YEHAT_ALLY_SPACE, 2);
+
+ return;
+ }
+ else if (PLAYER_SAID (R, at_least_help_us_space))
+ {
+ NPCPhrase (SORRY_CANNOT);
+
+ LastStack = 1;
+ SET_GAME_STATE (NO_YEHAT_HELP_SPACE, 1);
+ }
+ else if (PLAYER_SAID (R, dishonor))
+ {
+ NPCPhrase (HERES_A_HINT);
+
+ SET_GAME_STATE (NO_YEHAT_HELP_SPACE, 2);
+ }
+ else if (PLAYER_SAID (R, what_about_pkunk_royalist))
+ {
+ if (GET_GAME_STATE (YEHAT_ABSORBED_PKUNK))
+ NPCPhrase (PKUNK_ABSORBED_ROYALIST);
+ else
+ NPCPhrase (HATE_PKUNK_ROYALIST);
+
+ SET_GAME_STATE (YEHAT_ROYALIST_TOLD_PKUNK, 1);
+ }
+
+// SET_FUNCPTR (&PtrDesc, YehatSpace);
+ if (PHRASE_ENABLED (whats_up_space_1))
+ {
+ switch (GET_GAME_STATE (YEHAT_REBEL_INFO))
+ {
+ case 0:
+ pStr[0] = whats_up_space_1;
+ break;
+ case 1:
+ pStr[0] = whats_up_space_2;
+ break;
+ case 2:
+ pStr[0] = whats_up_space_3;
+ break;
+ case 3:
+ pStr[0] = whats_up_space_4;
+ break;
+ }
+ }
+ switch (GET_GAME_STATE (NO_YEHAT_HELP_SPACE))
+ {
+ case 0:
+ pStr[1] = at_least_help_us_space;
+ break;
+ case 1:
+ pStr[1] = dishonor;
+ break;
+ }
+ switch (GET_GAME_STATE (NO_YEHAT_ALLY_SPACE))
+ {
+ case 0:
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ i_demand_you_ally_space0,
+ GLOBAL_SIS (CommanderName),
+ i_demand_you_ally_space1,
+ GLOBAL_SIS (ShipName),
+ i_demand_you_ally_space2,
+ buf,
+ i_demand_you_ally_space3,
+ (UNICODE*)NULL);
+ pStr[2] = i_demand_you_ally_space0;
+ break;
+ }
+ case 1:
+ pStr[2] = obligation;
+ break;
+ }
+
+ if (pStr[LastStack])
+ {
+ if (pStr[LastStack] != i_demand_you_ally_space0)
+ Response (pStr[LastStack], YehatSpace);
+ else
+ DoResponsePhrase (pStr[LastStack], YehatSpace, shared_phrase_buf);
+ }
+ for (i = 0; i < 3; ++i)
+ {
+ if (i != LastStack && pStr[i])
+ {
+ if (pStr[i] != i_demand_you_ally_space0)
+ Response (pStr[i], YehatSpace);
+ else
+ DoResponsePhrase (pStr[i], YehatSpace, shared_phrase_buf);
+ }
+ }
+ if (!GET_GAME_STATE (YEHAT_ROYALIST_TOLD_PKUNK)
+ && GET_GAME_STATE (PKUNK_VISITS)
+ && GET_GAME_STATE (PKUNK_HOME_VISITS))
+ Response (what_about_pkunk_royalist, YehatSpace);
+ if (GET_GAME_STATE (SHOFIXTI_VISITS))
+ {
+ switch (GET_GAME_STATE (YEHAT_REBEL_TOLD_PKUNK))
+ {
+ case 0:
+ Response (shofixti_alive_1, StartRevolt);
+ break;
+ case 1:
+ Response (shofixti_alive_2, StartRevolt);
+ break;
+ }
+ }
+ Response (bye_space, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase (OUT_TAKES);
+
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (YEHAT_CIVIL_WAR))
+ {
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (YEHAT_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ROYALIST_HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ROYALIST_HOMEWORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_HOME_VISITS, NumVisits);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (YEHAT_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (ROYALIST_SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (ROYALIST_SPACE_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_VISITS, NumVisits);
+ }
+
+ Royalists ((RESPONSE_REF)0);
+ }
+ else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NumVisits = GET_GAME_STATE (YEHAT_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (HOMEWORLD_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (HOMEWORLD_HELLO_2);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_HOME_VISITS, NumVisits);
+
+ YehatHome ((RESPONSE_REF)0);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (YEHAT_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase (SPACE_HELLO_1);
+ break;
+ case 1:
+ NPCPhrase (SPACE_HELLO_2);
+ break;
+ case 2:
+ NPCPhrase (SPACE_HELLO_3);
+ break;
+ case 3:
+ NPCPhrase (SPACE_HELLO_4);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (YEHAT_VISITS, NumVisits);
+
+ YehatSpace ((RESPONSE_REF)0);
+ }
+}
+
+static COUNT
+uninit_yehat (void)
+{
+ return (0);
+}
+
+static void
+post_yehat_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_yehat_comm (void)
+{
+ LOCDATA *retval;
+
+ yehat_desc.init_encounter_func = Intro;
+ yehat_desc.post_encounter_func = post_yehat_enc;
+ yehat_desc.uninit_encounter_func = uninit_yehat;
+
+ yehat_desc.AlienTextBaseline.x = SIS_SCREEN_WIDTH * 2 / 3;
+ yehat_desc.AlienTextBaseline.y = 60;
+ yehat_desc.AlienTextWidth = (SIS_TEXT_WIDTH - 16) * 2 / 3;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) != WON_LAST_BATTLE)
+ {
+ setSegue (Segue_hostile);
+ }
+ else
+ {
+ setSegue (Segue_peace);
+ }
+ retval = &yehat_desc;
+
+ return (retval);
+}
diff --git a/src/uqm/comm/zoqfot/Makeinfo b/src/uqm/comm/zoqfot/Makeinfo
new file mode 100644
index 0000000..6e1a268
--- /dev/null
+++ b/src/uqm/comm/zoqfot/Makeinfo
@@ -0,0 +1,2 @@
+uqm_CFILES="zoqfotc.c"
+uqm_HFILES="resinst.h strings.h"
diff --git a/src/uqm/comm/zoqfot/resinst.h b/src/uqm/comm/zoqfot/resinst.h
new file mode 100644
index 0000000..a9430d9
--- /dev/null
+++ b/src/uqm/comm/zoqfot/resinst.h
@@ -0,0 +1,9 @@
+/* This file was auto-generated by the gen_resfiles utility and
+ should not be edited directly. Modify the master resource list
+ instead and regenerate. */
+
+#define ZOQFOTPIK_COLOR_MAP "comm.zoqfotpik.colortable"
+#define ZOQFOTPIK_CONVERSATION_PHRASES "comm.zoqfotpik.dialogue"
+#define ZOQFOTPIK_FONT "comm.zoqfotpik.font"
+#define ZOQFOTPIK_MUSIC "comm.zoqfotpik.music"
+#define ZOQFOTPIK_PMAP_ANIM "comm.zoqfotpik.graphics"
diff --git a/src/uqm/comm/zoqfot/strings.h b/src/uqm/comm/zoqfot/strings.h
new file mode 100644
index 0000000..3278082
--- /dev/null
+++ b/src/uqm/comm/zoqfot/strings.h
@@ -0,0 +1,365 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef ZOQFOT_STRINGS_H
+#define ZOQFOT_STRINGS_H
+
+enum
+{
+ NULL_PHRASE,
+ WE_ARE0,
+ WE_ARE1,
+ WE_ARE2,
+ WE_ARE3,
+ WE_ARE4,
+ WE_ARE5,
+ WE_ARE6,
+ WE_ARE7,
+ SCOUT_HELLO0,
+ SCOUT_HELLO1,
+ SCOUT_HELLO2,
+ SCOUT_HELLO3,
+ INIT_HOME_HELLO0,
+ INIT_HOME_HELLO1,
+ INIT_HOME_HELLO2,
+ INIT_HOME_HELLO3,
+ which_fot,
+ HE_IS0,
+ HE_IS1,
+ HE_IS2,
+ HE_IS3,
+ HE_IS4,
+ HE_IS5,
+ HE_IS6,
+ HE_IS7,
+ we_are_vindicator0,
+ we_are_vindicator1,
+ we_are_vindicator2,
+ WE_GLAD0,
+ WE_GLAD1,
+ WE_GLAD2,
+ WE_GLAD3,
+ WE_GLAD4,
+ WE_GLAD5,
+ quiet_toadies,
+ TOLD_YOU0,
+ TOLD_YOU1,
+ TOLD_YOU2,
+ TOLD_YOU3,
+ TOLD_YOU4,
+ TOLD_YOU5,
+ TOLD_YOU6,
+ TOLD_YOU7,
+ your_race,
+ YEARS_AGO0,
+ YEARS_AGO1,
+ YEARS_AGO2,
+ YEARS_AGO3,
+ YEARS_AGO4,
+ YEARS_AGO5,
+ YEARS_AGO6,
+ YEARS_AGO7,
+ YEARS_AGO8,
+ YEARS_AGO9,
+ YEARS_AGO10,
+ YEARS_AGO11,
+ YEARS_AGO12,
+ YEARS_AGO13,
+ where_from,
+ TRAVELED_FAR0,
+ TRAVELED_FAR1,
+ TRAVELED_FAR2,
+ TRAVELED_FAR3,
+ TRAVELED_FAR4,
+ TRAVELED_FAR5,
+ what_emergency,
+ UNDER_ATTACK0,
+ UNDER_ATTACK1,
+ UNDER_ATTACK2,
+ UNDER_ATTACK3,
+ UNDER_ATTACK4,
+ UNDER_ATTACK5,
+ UNDER_ATTACK6,
+ UNDER_ATTACK7,
+ UNDER_ATTACK8,
+ UNDER_ATTACK9,
+ UNDER_ATTACK10,
+ UNDER_ATTACK11,
+ tough_luck,
+ NOT_HELPFUL0,
+ NOT_HELPFUL1,
+ NOT_HELPFUL2,
+ NOT_HELPFUL3,
+ NOT_HELPFUL4,
+ NOT_HELPFUL5,
+ what_look_like,
+ LOOK_LIKE0,
+ LOOK_LIKE1,
+ LOOK_LIKE2,
+ LOOK_LIKE3,
+ valuable_info,
+ GOODBYE0,
+ GOODBYE1,
+ GOODBYE2,
+ GOODBYE3,
+ all_very_interesting,
+ SEE_TOLD_YOU0,
+ SEE_TOLD_YOU1,
+ SEE_TOLD_YOU2,
+ SEE_TOLD_YOU3,
+ how_can_i_help,
+ ALLY_WITH_US0,
+ ALLY_WITH_US1,
+ ALLY_WITH_US2,
+ ALLY_WITH_US3,
+ ALLY_WITH_US4,
+ ALLY_WITH_US5,
+ decide_later,
+ PLEASE_HURRY0,
+ PLEASE_HURRY1,
+ EMMISSARIES0,
+ EMMISSARIES1,
+ EMMISSARIES2,
+ EMMISSARIES3,
+ EMMISSARIES4,
+ EMMISSARIES5,
+ EMMISSARIES6,
+ EMMISSARIES7,
+ sure,
+ WE_ALLY0,
+ WE_ALLY1,
+ WE_ALLY2,
+ WE_ALLY3,
+ WE_ALLY4,
+ WE_ALLY5,
+ never,
+ WE_ENEMIES0,
+ WE_ENEMIES1,
+ HOSTILE_HELLO_10,
+ HOSTILE_HELLO_11,
+ HOSTILE_HELLO_20,
+ HOSTILE_HELLO_21,
+ HOSTILE_HELLO_22,
+ HOSTILE_HELLO_23,
+ HOSTILE_HELLO_24,
+ HOSTILE_HELLO_25,
+ HOSTILE_HELLO_30,
+ HOSTILE_HELLO_31,
+ HOSTILE_HELLO_40,
+ HOSTILE_HELLO_41,
+ NEUTRAL_HOME_HELLO_10,
+ NEUTRAL_HOME_HELLO_11,
+ NEUTRAL_HOME_HELLO_12,
+ NEUTRAL_HOME_HELLO_13,
+ NEUTRAL_HOME_HELLO_20,
+ NEUTRAL_HOME_HELLO_21,
+ NEUTRAL_HOME_HELLO_22,
+ NEUTRAL_HOME_HELLO_23,
+ ALLIED_HOME_HELLO_10,
+ ALLIED_HOME_HELLO_11,
+ ALLIED_HOME_HELLO_12,
+ ALLIED_HOME_HELLO_13,
+ ALLIED_HOME_HELLO_20,
+ ALLIED_HOME_HELLO_21,
+ ALLIED_HOME_HELLO_22,
+ ALLIED_HOME_HELLO_23,
+ ALLIED_HOME_HELLO_24,
+ ALLIED_HOME_HELLO_25,
+ ALLIED_HOME_HELLO_26,
+ ALLIED_HOME_HELLO_27,
+ ALLIED_HOME_HELLO_30,
+ ALLIED_HOME_HELLO_31,
+ ALLIED_HOME_HELLO_40,
+ ALLIED_HOME_HELLO_41,
+ THANKS_FOR_RESCUE0,
+ THANKS_FOR_RESCUE1,
+ THANKS_FOR_RESCUE2,
+ THANKS_FOR_RESCUE3,
+ THANKS_FOR_RESCUE4,
+ THANKS_FOR_RESCUE5,
+ THANKS_FOR_RESCUE6,
+ THANKS_FOR_RESCUE7,
+ THANKS_FOR_RESCUE8,
+ THANKS_FOR_RESCUE9,
+ THANKS_FOR_RESCUE10,
+ THANKS_FOR_RESCUE11,
+ bye_homeworld,
+ GOODBYE_HOME0,
+ GOODBYE_HOME1,
+ whats_up_homeworld,
+ GENERAL_INFO_10,
+ GENERAL_INFO_11,
+ GENERAL_INFO_12,
+ GENERAL_INFO_13,
+ GENERAL_INFO_20,
+ GENERAL_INFO_21,
+ GENERAL_INFO_22,
+ GENERAL_INFO_23,
+ GENERAL_INFO_24,
+ GENERAL_INFO_25,
+ GENERAL_INFO_26,
+ GENERAL_INFO_27,
+ GENERAL_INFO_30,
+ GENERAL_INFO_31,
+ GENERAL_INFO_32,
+ GENERAL_INFO_33,
+ GENERAL_INFO_34,
+ GENERAL_INFO_35,
+ GENERAL_INFO_40,
+ GENERAL_INFO_41,
+ GENERAL_INFO_42,
+ GENERAL_INFO_43,
+ GENERAL_INFO_44,
+ GENERAL_INFO_45,
+ GENERAL_INFO_46,
+ GENERAL_INFO_47,
+ GENERAL_INFO_48,
+ GENERAL_INFO_49,
+ GENERAL_INFO_410,
+ GENERAL_INFO_411,
+ any_war_news,
+ UTWIG_DELAY0,
+ UTWIG_DELAY1,
+ UTWIG_DELAY2,
+ UTWIG_DELAY3,
+ UTWIG_DELAY4,
+ UTWIG_DELAY5,
+ UTWIG_DELAY6,
+ UTWIG_DELAY7,
+ UTWIG_DELAY8,
+ UTWIG_DELAY9,
+ UTWIG_DELAY10,
+ UTWIG_DELAY11,
+ UTWIG_DELAY12,
+ UTWIG_DELAY13,
+ KOHRAH_WINNING0,
+ KOHRAH_WINNING1,
+ KOHRAH_WINNING2,
+ KOHRAH_WINNING3,
+ KOHRAH_WINNING4,
+ KOHRAH_WINNING5,
+ KOHRAH_WINNING6,
+ KOHRAH_WINNING7,
+ KOHRAH_WINNING8,
+ KOHRAH_WINNING9,
+ URQUAN_NEARLY_GONE0,
+ URQUAN_NEARLY_GONE1,
+ URQUAN_NEARLY_GONE2,
+ URQUAN_NEARLY_GONE3,
+ URQUAN_NEARLY_GONE4,
+ URQUAN_NEARLY_GONE5,
+ KOHRAH_FRENZY0,
+ KOHRAH_FRENZY1,
+ KOHRAH_FRENZY2,
+ KOHRAH_FRENZY3,
+ KOHRAH_FRENZY4,
+ KOHRAH_FRENZY5,
+ KOHRAH_FRENZY6,
+ KOHRAH_FRENZY7,
+ KOHRAH_FRENZY8,
+ KOHRAH_FRENZY9,
+ KOHRAH_FRENZY10,
+ KOHRAH_FRENZY11,
+ NO_WAR_NEWS0,
+ NO_WAR_NEWS1,
+ i_want_alliance,
+ GOOD0,
+ GOOD1,
+ GOOD2,
+ GOOD3,
+ GOOD4,
+ GOOD5,
+ GOOD6,
+ GOOD7,
+ GOOD8,
+ GOOD9,
+ want_specific_info,
+ WHAT_SPECIFIC_INFO0,
+ WHAT_SPECIFIC_INFO1,
+ enough_info,
+ OK_ENOUGH_INFO,
+ what_about_others,
+ ABOUT_OTHERS0,
+ ABOUT_OTHERS1,
+ ABOUT_OTHERS2,
+ ABOUT_OTHERS3,
+ ABOUT_OTHERS4,
+ ABOUT_OTHERS5,
+ ABOUT_OTHERS6,
+ ABOUT_OTHERS7,
+ ABOUT_OTHERS8,
+ ABOUT_OTHERS9,
+ ABOUT_OTHERS10,
+ ABOUT_OTHERS11,
+ ABOUT_OTHERS12,
+ ABOUT_OTHERS13,
+ what_about_zebranky,
+ ABOUT_ZEBRANKY0,
+ ABOUT_ZEBRANKY1,
+ ABOUT_ZEBRANKY2,
+ ABOUT_ZEBRANKY3,
+ ABOUT_ZEBRANKY4,
+ ABOUT_ZEBRANKY5,
+ ABOUT_ZEBRANKY6,
+ ABOUT_ZEBRANKY7,
+ what_about_past,
+ ABOUT_PAST0,
+ ABOUT_PAST1,
+ ABOUT_PAST2,
+ ABOUT_PAST3,
+ ABOUT_PAST4,
+ ABOUT_PAST5,
+ ABOUT_PAST6,
+ ABOUT_PAST7,
+ ABOUT_PAST8,
+ ABOUT_PAST9,
+ ABOUT_PAST10,
+ ABOUT_PAST11,
+ what_about_stinger,
+ ABOUT_STINGER0,
+ ABOUT_STINGER1,
+ ABOUT_STINGER2,
+ ABOUT_STINGER3,
+ ABOUT_STINGER4,
+ ABOUT_STINGER5,
+ what_about_guy_in_back,
+ ABOUT_GUY0,
+ ABOUT_GUY1,
+ name_1,
+ name_2,
+ name_3,
+ name_40,
+ name_41,
+ OUT_TAKES0,
+ OUT_TAKES1,
+ OUT_TAKES2,
+ OUT_TAKES3,
+ OUT_TAKES4,
+ OUT_TAKES5,
+ OUT_TAKES6,
+ OUT_TAKES7,
+ OUT_TAKES8,
+ OUT_TAKES9,
+ OUT_TAKES10,
+ OUT_TAKES11,
+ OUT_TAKES12,
+ OUT_TAKES13,
+};
+
+#endif /* _STRINGS_H */
+
diff --git a/src/uqm/comm/zoqfot/zoqfotc.c b/src/uqm/comm/zoqfot/zoqfotc.c
new file mode 100644
index 0000000..d09a7f7
--- /dev/null
+++ b/src/uqm/comm/zoqfot/zoqfotc.c
@@ -0,0 +1,975 @@
+//Copyright Paul Reiche, Fred Ford. 1992-2002
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "../commall.h"
+#include "resinst.h"
+#include "strings.h"
+
+#include "uqm/build.h"
+#include "uqm/gameev.h"
+
+
+#define ZOQ_FG_COLOR WHITE_COLOR
+#define ZOQ_BG_COLOR BLACK_COLOR
+#define ZOQ_BASE_X (TEXT_X_OFFS + ((SIS_TEXT_WIDTH >> 1) >> 1))
+#define ZOQ_BASE_Y 24
+#define ZOQ_TALK_INDEX 18
+#define ZOQ_TALK_FRAMES 5
+#define FOT_TO_ZOQ 23
+
+#define PIK_FG_COLOR WHITE_COLOR
+#define PIK_BG_COLOR BLACK_COLOR
+#define PIK_BASE_X (SIS_SCREEN_WIDTH - (TEXT_X_OFFS + ((SIS_TEXT_WIDTH >> 1) >> 1)))
+#define PIK_BASE_Y 24
+#define PIK_TALK_INDEX 29
+#define PIK_TALK_FRAMES 2
+#define FOT_TO_PIK 26
+
+static LOCDATA zoqfot_desc =
+{
+ NULL, /* init_encounter_func */
+ NULL, /* post_encounter_func */
+ NULL, /* uninit_encounter_func */
+ ZOQFOTPIK_PMAP_ANIM, /* AlienFrame */
+ ZOQFOTPIK_FONT, /* AlienFont */
+ UNDEFINED_COLOR_INIT, /* AlienTextFColor */
+ UNDEFINED_COLOR_INIT, /* AlienTextBColor */
+ {0, 0}, /* AlienTextBaseline */
+ 0, /* AlienTextWidth */
+ ALIGN_CENTER, /* AlienTextAlign */
+ VALIGN_MIDDLE, /* AlienTextValign */
+ ZOQFOTPIK_COLOR_MAP, /* AlienColorMap */
+ ZOQFOTPIK_MUSIC, /* AlienSong */
+ NULL_RESOURCE, /* AlienAltSong */
+ 0, /* AlienSongFlags */
+ ZOQFOTPIK_CONVERSATION_PHRASES, /* PlayerPhrases */
+ 3, /* NumAnimations */
+ { /* AlienAmbientArray (ambient animations) */
+ { /* Eye blink */
+ 1, /* StartIndex */
+ 4, /* NumFrames */
+ YOYO_ANIM /* AnimFlags */
+ | WAIT_TALKING,
+ ONE_SECOND / 24, 0, /* FrameRate */
+ 0, ONE_SECOND * 10, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Blow smoke */
+ 5, /* StartIndex */
+ 5, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND * 7 / 120, 0, /* FrameRate */
+ ONE_SECOND * 2, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* Gulp */
+ 10, /* StartIndex */
+ 8, /* NumFrames */
+ CIRCULAR_ANIM, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ 0, ONE_SECOND * 10, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ },
+ { /* AlienTransitionDesc - Move Eye */
+ FOT_TO_ZOQ, /* StartIndex */
+ 3, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 30, 0, /* FrameRate */
+ 0, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ { /* AlienTalkDesc */
+ ZOQ_TALK_INDEX, /* StartIndex */
+ ZOQ_TALK_FRAMES, /* NumFrames */
+ 0, /* AnimFlags */
+ ONE_SECOND / 15, 0, /* FrameRate */
+ ONE_SECOND / 12, 0, /* RestartRate */
+ 0, /* BlockMask */
+ },
+ NULL, /* AlienNumberSpeech - none */
+ /* Filler for loaded resources */
+ NULL, NULL, NULL,
+ NULL,
+ NULL,
+};
+
+enum
+{
+ ZOQ_ALIEN,
+ FOT_ALIEN,
+ PIK_ALIEN
+};
+
+static int LastAlien;
+
+// Queued and executes synchronously on the Starcon2Main thread
+static void
+SelectAlienZOQ (CallbackArg arg)
+{
+ if (LastAlien != ZOQ_ALIEN)
+ {
+ // Transition to neutral state first if Pik was talking
+ if (LastAlien != FOT_ALIEN)
+ CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
+ LastAlien = ZOQ_ALIEN;
+ CommData.AlienTransitionDesc.AnimFlags |= TALK_INTRO;
+ CommData.AlienTransitionDesc.StartIndex = FOT_TO_ZOQ;
+ CommData.AlienTalkDesc.StartIndex = ZOQ_TALK_INDEX;
+ CommData.AlienTalkDesc.NumFrames = ZOQ_TALK_FRAMES;
+ CommData.AlienAmbientArray[1].AnimFlags &= ~WAIT_TALKING;
+
+ CommData.AlienTextBaseline.x = (SWORD)ZOQ_BASE_X;
+ CommData.AlienTextBaseline.y = ZOQ_BASE_Y;
+ CommData.AlienTextFColor = ZOQ_FG_COLOR;
+ CommData.AlienTextBColor = ZOQ_BG_COLOR;
+ }
+
+ (void)arg; // ignored
+}
+
+// Queued and executes synchronously on the Starcon2Main thread
+static void
+SelectAlienPIK (CallbackArg arg)
+{
+ if (LastAlien != PIK_ALIEN)
+ {
+ // Transition to neutral state first if Zoq was talking
+ if (LastAlien != FOT_ALIEN)
+ CommData.AlienTransitionDesc.AnimFlags |= TALK_DONE;
+ LastAlien = PIK_ALIEN;
+ CommData.AlienTransitionDesc.AnimFlags |= TALK_INTRO;
+ CommData.AlienTransitionDesc.StartIndex = FOT_TO_PIK;
+ CommData.AlienTalkDesc.StartIndex = PIK_TALK_INDEX;
+ CommData.AlienTalkDesc.NumFrames = PIK_TALK_FRAMES;
+ CommData.AlienAmbientArray[1].AnimFlags |= WAIT_TALKING;
+
+ CommData.AlienTextBaseline.x = (SWORD)PIK_BASE_X;
+ CommData.AlienTextBaseline.y = PIK_BASE_Y;
+ CommData.AlienTextFColor = PIK_FG_COLOR;
+ CommData.AlienTextBColor = PIK_BG_COLOR;
+ }
+
+ (void)arg; // ignored
+}
+
+static void
+ZFPTalkSegue (COUNT wait_track)
+{
+ LastAlien = FOT_ALIEN;
+ SelectAlienZOQ (0);
+ AlienTalkSegue (wait_track);
+}
+
+static void
+ExitConversation (RESPONSE_REF R)
+{
+ setSegue (Segue_peace);
+
+ if (PLAYER_SAID (R, bye_homeworld))
+ {
+ NPCPhrase_cb (GOODBYE_HOME0, &SelectAlienZOQ);
+ NPCPhrase_cb (GOODBYE_HOME1, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ else if (PLAYER_SAID (R, decide_later))
+ {
+ NPCPhrase_cb (PLEASE_HURRY0, &SelectAlienZOQ);
+ NPCPhrase_cb (PLEASE_HURRY1, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ else if (PLAYER_SAID (R, valuable_info))
+ {
+ NPCPhrase_cb (GOODBYE0, &SelectAlienZOQ);
+ NPCPhrase_cb (GOODBYE1, &SelectAlienPIK);
+ NPCPhrase_cb (GOODBYE2, &SelectAlienZOQ);
+ NPCPhrase_cb (GOODBYE3, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ else if (PLAYER_SAID (R, how_can_i_help))
+ {
+ NPCPhrase_cb (EMMISSARIES0, &SelectAlienZOQ);
+ NPCPhrase_cb (EMMISSARIES1, &SelectAlienPIK);
+ NPCPhrase_cb (EMMISSARIES2, &SelectAlienZOQ);
+ NPCPhrase_cb (EMMISSARIES3, &SelectAlienPIK);
+ NPCPhrase_cb (EMMISSARIES4, &SelectAlienZOQ);
+ NPCPhrase_cb (EMMISSARIES5, &SelectAlienPIK);
+ NPCPhrase_cb (EMMISSARIES6, &SelectAlienZOQ);
+ NPCPhrase_cb (EMMISSARIES7, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ else if (PLAYER_SAID (R, sure))
+ {
+ NPCPhrase_cb (WE_ALLY0, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ALLY1, &SelectAlienPIK);
+ NPCPhrase_cb (WE_ALLY2, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ALLY3, &SelectAlienPIK);
+ NPCPhrase_cb (WE_ALLY4, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ALLY5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ SetRaceAllied (ZOQFOTPIK_SHIP, TRUE);
+ AddEvent (RELATIVE_EVENT, 3, 0, 0, ZOQFOT_DISTRESS_EVENT);
+ SET_GAME_STATE (ZOQFOT_HOME_VISITS, 0);
+ }
+ else if (PLAYER_SAID (R, all_very_interesting))
+ {
+ NPCPhrase_cb (SEE_TOLD_YOU0, &SelectAlienZOQ);
+ NPCPhrase_cb (SEE_TOLD_YOU1, &SelectAlienPIK);
+ NPCPhrase_cb (SEE_TOLD_YOU2, &SelectAlienZOQ);
+ NPCPhrase_cb (SEE_TOLD_YOU3, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ SET_GAME_STATE (ZOQFOT_HOSTILE, 1);
+ SET_GAME_STATE (ZOQFOT_HOME_VISITS, 0);
+ setSegue (Segue_hostile);
+ }
+ else if (PLAYER_SAID (R, never))
+ {
+ NPCPhrase_cb (WE_ENEMIES0, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ENEMIES1, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ SET_GAME_STATE (ZOQFOT_HOME_VISITS, 0);
+ SET_GAME_STATE (ZOQFOT_HOSTILE, 1);
+ setSegue (Segue_hostile);
+ }
+}
+
+static void
+FormAlliance (RESPONSE_REF R)
+{
+ (void) R; // ignored
+ NPCPhrase_cb (ALLY_WITH_US0, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLY_WITH_US1, &SelectAlienPIK);
+ NPCPhrase_cb (ALLY_WITH_US2, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLY_WITH_US3, &SelectAlienPIK);
+ NPCPhrase_cb (ALLY_WITH_US4, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLY_WITH_US5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ Response (sure, ExitConversation);
+ Response (never, ExitConversation);
+ Response (decide_later, ExitConversation);
+}
+
+static void
+ZoqFotIntro (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, we_are_vindicator0))
+ {
+ NPCPhrase_cb (WE_GLAD0, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_GLAD1, &SelectAlienPIK);
+ NPCPhrase_cb (WE_GLAD2, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_GLAD3, &SelectAlienPIK);
+ NPCPhrase_cb (WE_GLAD4, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_GLAD5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (we_are_vindicator0);
+ }
+ else if (PLAYER_SAID (R, your_race))
+ {
+ NPCPhrase_cb (YEARS_AGO0, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO1, &SelectAlienPIK);
+ NPCPhrase_cb (YEARS_AGO2, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO3, &SelectAlienPIK);
+ NPCPhrase_cb (YEARS_AGO4, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO5, &SelectAlienPIK);
+ NPCPhrase_cb (YEARS_AGO6, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO7, &SelectAlienPIK);
+ NPCPhrase_cb (YEARS_AGO8, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO9, &SelectAlienPIK);
+ NPCPhrase_cb (YEARS_AGO10, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO11, &SelectAlienPIK);
+ NPCPhrase_cb (YEARS_AGO12, &SelectAlienZOQ);
+ NPCPhrase_cb (YEARS_AGO13, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (your_race);
+ }
+ else if (PLAYER_SAID (R, where_from))
+ {
+ NPCPhrase_cb (TRAVELED_FAR0, &SelectAlienZOQ);
+ NPCPhrase_cb (TRAVELED_FAR1, &SelectAlienPIK);
+ NPCPhrase_cb (TRAVELED_FAR2, &SelectAlienZOQ);
+ NPCPhrase_cb (TRAVELED_FAR3, &SelectAlienPIK);
+ NPCPhrase_cb (TRAVELED_FAR4, &SelectAlienZOQ);
+ NPCPhrase_cb (TRAVELED_FAR5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (where_from);
+ }
+ else if (PLAYER_SAID (R, what_emergency))
+ {
+ NPCPhrase_cb (UNDER_ATTACK0, &SelectAlienZOQ);
+ NPCPhrase_cb (UNDER_ATTACK1, &SelectAlienPIK);
+ NPCPhrase_cb (UNDER_ATTACK2, &SelectAlienZOQ);
+ NPCPhrase_cb (UNDER_ATTACK3, &SelectAlienPIK);
+ NPCPhrase_cb (UNDER_ATTACK4, &SelectAlienZOQ);
+ NPCPhrase_cb (UNDER_ATTACK5, &SelectAlienPIK);
+ NPCPhrase_cb (UNDER_ATTACK6, &SelectAlienZOQ);
+ NPCPhrase_cb (UNDER_ATTACK7, &SelectAlienPIK);
+ NPCPhrase_cb (UNDER_ATTACK8, &SelectAlienZOQ);
+ NPCPhrase_cb (UNDER_ATTACK9, &SelectAlienPIK);
+ NPCPhrase_cb (UNDER_ATTACK10, &SelectAlienZOQ);
+ NPCPhrase_cb (UNDER_ATTACK11, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_emergency);
+ }
+ else if (PLAYER_SAID (R, tough_luck))
+ {
+ NPCPhrase_cb (NOT_HELPFUL0, &SelectAlienZOQ);
+ NPCPhrase_cb (NOT_HELPFUL1, &SelectAlienPIK);
+ NPCPhrase_cb (NOT_HELPFUL2, &SelectAlienZOQ);
+ NPCPhrase_cb (NOT_HELPFUL3, &SelectAlienPIK);
+ NPCPhrase_cb (NOT_HELPFUL4, &SelectAlienZOQ);
+ NPCPhrase_cb (NOT_HELPFUL5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (tough_luck);
+ }
+ else if (PLAYER_SAID (R, what_look_like))
+ {
+ NPCPhrase_cb (LOOK_LIKE0, &SelectAlienZOQ);
+ NPCPhrase_cb (LOOK_LIKE1, &SelectAlienPIK);
+ NPCPhrase_cb (LOOK_LIKE2, &SelectAlienZOQ);
+ NPCPhrase_cb (LOOK_LIKE3, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_look_like);
+ }
+
+ if (PHRASE_ENABLED (your_race)
+ || PHRASE_ENABLED (where_from)
+ || PHRASE_ENABLED (what_emergency))
+ {
+ if (PHRASE_ENABLED (your_race))
+ Response (your_race, ZoqFotIntro);
+ if (PHRASE_ENABLED (where_from))
+ Response (where_from, ZoqFotIntro);
+ if (PHRASE_ENABLED (what_emergency))
+ Response (what_emergency, ZoqFotIntro);
+ }
+ else
+ {
+ if (PHRASE_ENABLED (tough_luck))
+ Response (tough_luck, ZoqFotIntro);
+ if (PHRASE_ENABLED (what_look_like))
+ Response (what_look_like, ZoqFotIntro);
+ Response (all_very_interesting, ExitConversation);
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ Response (how_can_i_help, FormAlliance);
+ }
+ else
+ {
+ Response (how_can_i_help, ExitConversation);
+ }
+ Response (valuable_info, ExitConversation);
+ }
+}
+
+static void
+AquaintZoqFot (RESPONSE_REF R)
+{
+ if (PLAYER_SAID (R, which_fot))
+ {
+ NPCPhrase_cb (HE_IS0, &SelectAlienZOQ);
+ NPCPhrase_cb (HE_IS1, &SelectAlienPIK);
+ NPCPhrase_cb (HE_IS2, &SelectAlienZOQ);
+ NPCPhrase_cb (HE_IS3, &SelectAlienPIK);
+ NPCPhrase_cb (HE_IS4, &SelectAlienZOQ);
+ NPCPhrase_cb (HE_IS5, &SelectAlienPIK);
+ NPCPhrase_cb (HE_IS6, &SelectAlienZOQ);
+ NPCPhrase_cb (HE_IS7, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (which_fot);
+ }
+ else if (PLAYER_SAID (R, quiet_toadies))
+ {
+ NPCPhrase_cb (TOLD_YOU0, &SelectAlienZOQ);
+ NPCPhrase_cb (TOLD_YOU1, &SelectAlienPIK);
+ NPCPhrase_cb (TOLD_YOU2, &SelectAlienZOQ);
+ NPCPhrase_cb (TOLD_YOU3, &SelectAlienPIK);
+ NPCPhrase_cb (TOLD_YOU4, &SelectAlienZOQ);
+ NPCPhrase_cb (TOLD_YOU5, &SelectAlienPIK);
+ NPCPhrase_cb (TOLD_YOU6, &SelectAlienZOQ);
+ NPCPhrase_cb (TOLD_YOU7, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (quiet_toadies);
+ }
+
+ if (PHRASE_ENABLED (we_are_vindicator0))
+ {
+ UNICODE buf[ALLIANCE_NAME_BUFSIZE];
+
+ GetAllianceName (buf, name_1);
+ construct_response (
+ shared_phrase_buf,
+ we_are_vindicator0,
+ buf,
+ we_are_vindicator1,
+ GLOBAL_SIS (ShipName),
+ we_are_vindicator2,
+ (UNICODE*)NULL);
+ }
+
+ if (PHRASE_ENABLED (which_fot))
+ Response (which_fot, AquaintZoqFot);
+ if (PHRASE_ENABLED (we_are_vindicator0))
+ DoResponsePhrase (we_are_vindicator0, ZoqFotIntro, shared_phrase_buf);
+ if (PHRASE_ENABLED (quiet_toadies))
+ Response (quiet_toadies, AquaintZoqFot);
+ Response (all_very_interesting, ExitConversation);
+ Response (valuable_info, ExitConversation);
+}
+
+static void ZoqFotHome (RESPONSE_REF R);
+
+static void
+ZoqFotInfo (RESPONSE_REF R)
+{
+ BYTE InfoLeft;
+
+ if (PLAYER_SAID (R, want_specific_info))
+ {
+ NPCPhrase_cb (WHAT_SPECIFIC_INFO0, &SelectAlienZOQ);
+ NPCPhrase_cb (WHAT_SPECIFIC_INFO1, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ else if (PLAYER_SAID (R, what_about_others))
+ {
+ NPCPhrase_cb (ABOUT_OTHERS0, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS1, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_OTHERS2, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS3, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_OTHERS4, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS5, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_OTHERS6, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS7, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_OTHERS8, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS9, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_OTHERS10, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS11, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_OTHERS12, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_OTHERS13, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_about_others);
+ }
+ else if (PLAYER_SAID (R, what_about_zebranky))
+ {
+ NPCPhrase_cb (ABOUT_ZEBRANKY0, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_ZEBRANKY1, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_ZEBRANKY2, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_ZEBRANKY3, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_ZEBRANKY4, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_ZEBRANKY5, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_ZEBRANKY6, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_ZEBRANKY7, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_about_zebranky);
+ }
+ else if (PLAYER_SAID (R, what_about_stinger))
+ {
+ NPCPhrase_cb (ABOUT_STINGER0, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_STINGER1, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_STINGER2, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_STINGER3, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_STINGER4, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_STINGER5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_about_stinger);
+ }
+ else if (PLAYER_SAID (R, what_about_guy_in_back))
+ {
+ NPCPhrase_cb (ABOUT_GUY0, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_GUY1, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_about_guy_in_back);
+ }
+ else if (PLAYER_SAID (R, what_about_past))
+ {
+ NPCPhrase_cb (ABOUT_PAST0, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_PAST1, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_PAST2, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_PAST3, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_PAST4, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_PAST5, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_PAST6, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_PAST7, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_PAST8, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_PAST9, &SelectAlienPIK);
+ NPCPhrase_cb (ABOUT_PAST10, &SelectAlienZOQ);
+ NPCPhrase_cb (ABOUT_PAST11, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ DISABLE_PHRASE (what_about_past);
+ }
+
+ InfoLeft = FALSE;
+ if (PHRASE_ENABLED (what_about_others))
+ {
+ Response (what_about_others, ZoqFotInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_zebranky))
+ {
+ Response (what_about_zebranky, ZoqFotInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_stinger))
+ {
+ Response (what_about_stinger, ZoqFotInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_guy_in_back))
+ {
+ Response (what_about_guy_in_back, ZoqFotInfo);
+ InfoLeft = TRUE;
+ }
+ if (PHRASE_ENABLED (what_about_past))
+ {
+ Response (what_about_past, ZoqFotInfo);
+ InfoLeft = TRUE;
+ }
+ Response (enough_info, ZoqFotHome);
+
+ if (!InfoLeft)
+ {
+ DISABLE_PHRASE (want_specific_info);
+ }
+}
+
+static void
+ZoqFotHome (RESPONSE_REF R)
+{
+ BYTE NumVisits;
+
+ if (PLAYER_SAID (R, whats_up_homeworld))
+ {
+ NumVisits = GET_GAME_STATE (ZOQFOT_INFO);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase_cb (GENERAL_INFO_10, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_11, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_12, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_13, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 1:
+ NPCPhrase_cb (GENERAL_INFO_20, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_21, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_22, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_23, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_24, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_25, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_26, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_27, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 2:
+ NPCPhrase_cb (GENERAL_INFO_30, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_31, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_32, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_33, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_34, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_35, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 3:
+ NPCPhrase_cb (GENERAL_INFO_40, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_41, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_42, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_43, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_44, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_45, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_46, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_47, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_48, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_49, &SelectAlienPIK);
+ NPCPhrase_cb (GENERAL_INFO_410, &SelectAlienZOQ);
+ NPCPhrase_cb (GENERAL_INFO_411, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ZOQFOT_INFO, NumVisits);
+
+ DISABLE_PHRASE (whats_up_homeworld);
+ }
+ else if (PLAYER_SAID (R, any_war_news))
+ {
+#define UTWIG_BUY_TIME (1 << 0)
+#define KOHR_AH_WIN (1 << 1)
+#define URQUAN_LOSE (1 << 2)
+#define KOHR_AH_KILL (1 << 3)
+#define KNOW_ALL (UTWIG_BUY_TIME | KOHR_AH_WIN | URQUAN_LOSE | KOHR_AH_KILL)
+ BYTE KnowMask;
+
+ NumVisits = GET_GAME_STATE (UTWIG_SUPOX_MISSION);
+ KnowMask = GET_GAME_STATE (ZOQFOT_KNOW_MASK);
+ if (!(KnowMask & KOHR_AH_KILL) && GET_GAME_STATE (KOHR_AH_FRENZY))
+ {
+ NPCPhrase_cb (KOHRAH_FRENZY0, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_FRENZY1, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_FRENZY2, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_FRENZY3, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_FRENZY4, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_FRENZY5, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_FRENZY6, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_FRENZY7, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_FRENZY8, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_FRENZY9, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_FRENZY10, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_FRENZY11, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ KnowMask = KNOW_ALL;
+ }
+ else if (!(KnowMask & UTWIG_BUY_TIME)
+ && NumVisits > 0 && NumVisits < 5)
+ {
+ NPCPhrase_cb (UTWIG_DELAY0, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY1, &SelectAlienPIK);
+ NPCPhrase_cb (UTWIG_DELAY2, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY3, &SelectAlienPIK);
+ NPCPhrase_cb (UTWIG_DELAY4, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY5, &SelectAlienPIK);
+ NPCPhrase_cb (UTWIG_DELAY6, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY7, &SelectAlienPIK);
+ NPCPhrase_cb (UTWIG_DELAY8, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY9, &SelectAlienPIK);
+ NPCPhrase_cb (UTWIG_DELAY10, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY11, &SelectAlienPIK);
+ NPCPhrase_cb (UTWIG_DELAY12, &SelectAlienZOQ);
+ NPCPhrase_cb (UTWIG_DELAY13, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ KnowMask |= UTWIG_BUY_TIME;
+ }
+ else
+ {
+ SIZE i;
+
+ i = START_YEAR + YEARS_TO_KOHRAH_VICTORY;
+ if (NumVisits)
+ ++i;
+ if ((i -= GLOBAL (GameClock.year_index)) == 1
+ && GLOBAL (GameClock.month_index) > 2)
+ i = 0;
+ if (!(KnowMask & URQUAN_LOSE) && i <= 0)
+ {
+ NPCPhrase_cb (URQUAN_NEARLY_GONE0, &SelectAlienZOQ);
+ NPCPhrase_cb (URQUAN_NEARLY_GONE1, &SelectAlienPIK);
+ NPCPhrase_cb (URQUAN_NEARLY_GONE2, &SelectAlienZOQ);
+ NPCPhrase_cb (URQUAN_NEARLY_GONE3, &SelectAlienPIK);
+ NPCPhrase_cb (URQUAN_NEARLY_GONE4, &SelectAlienZOQ);
+ NPCPhrase_cb (URQUAN_NEARLY_GONE5, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ KnowMask |= KOHR_AH_WIN | URQUAN_LOSE;
+ }
+ else if (!(KnowMask & KOHR_AH_WIN) && i == 1)
+ {
+ NPCPhrase_cb (KOHRAH_WINNING0, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_WINNING1, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_WINNING2, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_WINNING3, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_WINNING4, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_WINNING5, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_WINNING6, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_WINNING7, &SelectAlienPIK);
+ NPCPhrase_cb (KOHRAH_WINNING8, &SelectAlienZOQ);
+ NPCPhrase_cb (KOHRAH_WINNING9, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ KnowMask |= KOHR_AH_WIN;
+ }
+ else
+ {
+ NPCPhrase_cb (NO_WAR_NEWS0, &SelectAlienZOQ);
+ NPCPhrase_cb (NO_WAR_NEWS1, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ }
+ SET_GAME_STATE (ZOQFOT_KNOW_MASK, KnowMask);
+
+ DISABLE_PHRASE (any_war_news);
+ }
+ else if (PLAYER_SAID (R, i_want_alliance))
+ {
+ NPCPhrase_cb (GOOD0, &SelectAlienZOQ);
+ NPCPhrase_cb (GOOD1, &SelectAlienPIK);
+ NPCPhrase_cb (GOOD2, &SelectAlienZOQ);
+ NPCPhrase_cb (GOOD3, &SelectAlienPIK);
+ NPCPhrase_cb (GOOD4, &SelectAlienZOQ);
+ NPCPhrase_cb (GOOD5, &SelectAlienPIK);
+ NPCPhrase_cb (GOOD6, &SelectAlienZOQ);
+ NPCPhrase_cb (GOOD7, &SelectAlienPIK);
+ NPCPhrase_cb (GOOD8, &SelectAlienZOQ);
+ NPCPhrase_cb (GOOD9, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ SetRaceAllied (ZOQFOTPIK_SHIP, TRUE);
+ AddEvent (RELATIVE_EVENT, 3, 0, 0, ZOQFOT_DISTRESS_EVENT);
+ }
+ else if (PLAYER_SAID (R, enough_info))
+ {
+ NPCPhrase_cb (OK_ENOUGH_INFO, &SelectAlienZOQ);
+ ZFPTalkSegue ((COUNT)~0);
+ }
+
+ if (PHRASE_ENABLED (whats_up_homeworld))
+ Response (whats_up_homeworld, ZoqFotHome);
+ if (PHRASE_ENABLED (any_war_news))
+ Response (any_war_news, ZoqFotHome);
+ if (CheckAlliance (ZOQFOTPIK_SHIP) != GOOD_GUY)
+ Response (i_want_alliance, ZoqFotHome);
+ else if (PHRASE_ENABLED (want_specific_info))
+ {
+ Response (want_specific_info, ZoqFotInfo);
+ }
+ Response (bye_homeworld, ExitConversation);
+}
+
+static void
+Intro (void)
+{
+ BYTE NumVisits;
+
+ if (LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ NPCPhrase_cb (OUT_TAKES0, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES1, &SelectAlienPIK);
+ NPCPhrase_cb (OUT_TAKES2, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES3, &SelectAlienPIK);
+ NPCPhrase_cb (OUT_TAKES4, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES5, &SelectAlienPIK);
+ NPCPhrase_cb (OUT_TAKES6, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES7, &SelectAlienPIK);
+ NPCPhrase_cb (OUT_TAKES8, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES9, &SelectAlienPIK);
+ NPCPhrase_cb (OUT_TAKES10, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES11, &SelectAlienPIK);
+ NPCPhrase_cb (OUT_TAKES12, &SelectAlienZOQ);
+ NPCPhrase_cb (OUT_TAKES13, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ setSegue (Segue_peace);
+ return;
+ }
+
+ if (GET_GAME_STATE (ZOQFOT_HOSTILE))
+ {
+ NumVisits = GET_GAME_STATE (ZOQFOT_HOME_VISITS);
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase_cb (HOSTILE_HELLO_10, &SelectAlienZOQ);
+ NPCPhrase_cb (HOSTILE_HELLO_11, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 1:
+ NPCPhrase_cb (HOSTILE_HELLO_20, &SelectAlienZOQ);
+ NPCPhrase_cb (HOSTILE_HELLO_21, &SelectAlienPIK);
+ NPCPhrase_cb (HOSTILE_HELLO_22, &SelectAlienZOQ);
+ NPCPhrase_cb (HOSTILE_HELLO_23, &SelectAlienPIK);
+ NPCPhrase_cb (HOSTILE_HELLO_24, &SelectAlienZOQ);
+ NPCPhrase_cb (HOSTILE_HELLO_25, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 2:
+ NPCPhrase_cb (HOSTILE_HELLO_30, &SelectAlienZOQ);
+ NPCPhrase_cb (HOSTILE_HELLO_31, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 3:
+ NPCPhrase_cb (HOSTILE_HELLO_40, &SelectAlienZOQ);
+ NPCPhrase_cb (HOSTILE_HELLO_41, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ --NumVisits;
+ break;
+ }
+ SET_GAME_STATE (ZOQFOT_HOME_VISITS, NumVisits);
+
+ setSegue (Segue_hostile);
+ }
+ else if (!GET_GAME_STATE (MET_ZOQFOT))
+ {
+ SET_GAME_STATE (MET_ZOQFOT, 1);
+
+ NPCPhrase_cb (WE_ARE0, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ARE1, &SelectAlienPIK);
+ NPCPhrase_cb (WE_ARE2, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ARE3, &SelectAlienPIK);
+ NPCPhrase_cb (WE_ARE4, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ARE5, &SelectAlienPIK);
+ NPCPhrase_cb (WE_ARE6, &SelectAlienZOQ);
+ NPCPhrase_cb (WE_ARE7, &SelectAlienPIK);
+
+ if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & (1 << 7))
+ {
+ NPCPhrase_cb (INIT_HOME_HELLO0, &SelectAlienZOQ);
+ NPCPhrase_cb (INIT_HOME_HELLO1, &SelectAlienPIK);
+ NPCPhrase_cb (INIT_HOME_HELLO2, &SelectAlienZOQ);
+ NPCPhrase_cb (INIT_HOME_HELLO3, &SelectAlienPIK);
+ }
+ else
+ {
+ NPCPhrase_cb (SCOUT_HELLO0, &SelectAlienZOQ);
+ NPCPhrase_cb (SCOUT_HELLO1, &SelectAlienPIK);
+ NPCPhrase_cb (SCOUT_HELLO2, &SelectAlienZOQ);
+ NPCPhrase_cb (SCOUT_HELLO3, &SelectAlienPIK);
+ }
+
+ ZFPTalkSegue ((COUNT)~0);
+
+ AquaintZoqFot (0);
+ }
+ else
+ {
+ if (GET_GAME_STATE (ZOQFOT_DISTRESS))
+ {
+#define MAX_ZFP_SHIPS 4
+ NPCPhrase_cb (THANKS_FOR_RESCUE0, &SelectAlienZOQ);
+ NPCPhrase_cb (THANKS_FOR_RESCUE1, &SelectAlienPIK);
+ NPCPhrase_cb (THANKS_FOR_RESCUE2, &SelectAlienZOQ);
+ NPCPhrase_cb (THANKS_FOR_RESCUE3, &SelectAlienPIK);
+ NPCPhrase_cb (THANKS_FOR_RESCUE4, &SelectAlienZOQ);
+ NPCPhrase_cb (THANKS_FOR_RESCUE5, &SelectAlienPIK);
+ NPCPhrase_cb (THANKS_FOR_RESCUE6, &SelectAlienZOQ);
+ NPCPhrase_cb (THANKS_FOR_RESCUE7, &SelectAlienPIK);
+ NPCPhrase_cb (THANKS_FOR_RESCUE8, &SelectAlienZOQ);
+ NPCPhrase_cb (THANKS_FOR_RESCUE9, &SelectAlienPIK);
+ NPCPhrase_cb (THANKS_FOR_RESCUE10, &SelectAlienZOQ);
+ NPCPhrase_cb (THANKS_FOR_RESCUE11, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+
+ SET_GAME_STATE (ZOQFOT_DISTRESS, 0);
+ AddEscortShips (ZOQFOTPIK_SHIP, MAX_ZFP_SHIPS);
+ }
+ else
+ {
+ NumVisits = GET_GAME_STATE (ZOQFOT_HOME_VISITS);
+ if (CheckAlliance (ZOQFOTPIK_SHIP) != GOOD_GUY)
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_10, &SelectAlienZOQ);
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_11, &SelectAlienPIK);
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_12, &SelectAlienZOQ);
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_13, &SelectAlienPIK);
+ break;
+ case 1:
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_20, &SelectAlienZOQ);
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_21, &SelectAlienPIK);
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_22, &SelectAlienZOQ);
+ NPCPhrase_cb (NEUTRAL_HOME_HELLO_23, &SelectAlienPIK);
+ --NumVisits;
+ break;
+ }
+ ZFPTalkSegue ((COUNT)~0);
+ }
+ else
+ {
+ switch (NumVisits++)
+ {
+ case 0:
+ NPCPhrase_cb (ALLIED_HOME_HELLO_10, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_11, &SelectAlienPIK);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_12, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_13, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 1:
+ NPCPhrase_cb (ALLIED_HOME_HELLO_20, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_21, &SelectAlienPIK);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_22, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_23, &SelectAlienPIK);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_24, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_25, &SelectAlienPIK);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_26, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_27, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 2:
+ NPCPhrase_cb (ALLIED_HOME_HELLO_30, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_31, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ break;
+ case 3:
+ NPCPhrase_cb (ALLIED_HOME_HELLO_40, &SelectAlienZOQ);
+ NPCPhrase_cb (ALLIED_HOME_HELLO_41, &SelectAlienPIK);
+ ZFPTalkSegue ((COUNT)~0);
+ --NumVisits;
+ break;
+ }
+ }
+ SET_GAME_STATE (ZOQFOT_HOME_VISITS, NumVisits);
+ }
+
+ ZoqFotHome (0);
+ }
+}
+
+static COUNT
+uninit_zoqfot (void)
+{
+ return (0);
+}
+
+static void
+post_zoqfot_enc (void)
+{
+ // nothing defined so far
+}
+
+LOCDATA*
+init_zoqfot_comm (void)
+{
+ LOCDATA *retval;
+
+ zoqfot_desc.init_encounter_func = Intro;
+ zoqfot_desc.post_encounter_func = post_zoqfot_enc;
+ zoqfot_desc.uninit_encounter_func = uninit_zoqfot;
+
+ zoqfot_desc.AlienTextWidth = (SIS_TEXT_WIDTH >> 1) - TEXT_X_OFFS;
+
+ if (CheckAlliance (ZOQFOTPIK_SHIP) == GOOD_GUY
+ || LOBYTE (GLOBAL (CurrentActivity)) == WON_LAST_BATTLE)
+ {
+ setSegue (Segue_peace);
+ }
+ else
+ {
+ setSegue (Segue_hostile);
+ }
+
+ retval = &zoqfot_desc;
+
+ return (retval);
+}
+