From 994d69c7fb2c91017d4e0f10fd3cf4ea9e532565 Mon Sep 17 00:00:00 2001 From: Samuel Villareal Date: Wed, 8 Sep 2010 04:04:50 +0000 Subject: + Update to mapdialog struct + P_StartDialog updated Subversion-branch: /branches/strife-branch Subversion-revision: 2038 --- src/strife/p_dialog.c | 35 +++++++++++++++----------------- src/strife/p_dialog.h | 55 +++++++++++++++++++++++++-------------------------- 2 files changed, 43 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/strife/p_dialog.c b/src/strife/p_dialog.c index 53f15174..e2460f0d 100644 --- a/src/strife/p_dialog.c +++ b/src/strife/p_dialog.c @@ -59,9 +59,6 @@ memcpy(field, ptr, len); \ ptr += len; -#define MAXITEMREQUIREMENTS 3 -#define MAXCHOICES 5 - // // Globals // @@ -399,16 +396,16 @@ static void P_ParseDialogLump(byte *lump, mapdialog_t **dialogs, int j; mapdialog_t *curdialog = &((*dialogs)[i]); - DIALOG_INT(curdialog->speakerid, rover); - DIALOG_INT(curdialog->dropitem, rover); - DIALOG_INT(curdialog->checkitem1, rover); - DIALOG_INT(curdialog->checkitem2, rover); - DIALOG_INT(curdialog->checkitem3, rover); - DIALOG_INT(curdialog->jumptoconv, rover); - DIALOG_STR(curdialog->name, rover, MDLG_NAMELEN); - DIALOG_STR(curdialog->voice, rover, MDLG_LUMPLEN); - DIALOG_STR(curdialog->backpic, rover, MDLG_LUMPLEN); - DIALOG_STR(curdialog->text, rover, MDLG_TEXTLEN); + DIALOG_INT(curdialog->speakerid, rover); + DIALOG_INT(curdialog->dropitem, rover); + DIALOG_INT(curdialog->checkitem[0], rover); + DIALOG_INT(curdialog->checkitem[1], rover); + DIALOG_INT(curdialog->checkitem[2], rover); + DIALOG_INT(curdialog->jumptoconv, rover); + DIALOG_STR(curdialog->name, rover, MDLG_NAMELEN); + DIALOG_STR(curdialog->voice, rover, MDLG_LUMPLEN); + DIALOG_STR(curdialog->backpic, rover, MDLG_LUMPLEN); + DIALOG_STR(curdialog->text, rover, MDLG_TEXTLEN); // copy choices for(j = 0; j < 5; j++) @@ -820,19 +817,19 @@ void P_DialogStart(player_t *player) return; // check item requirements - for(i = 0; i < MAXITEMREQUIREMENTS; i++) + for(i = 0; i < MDLG_MAXITEMS; i++) { currentdialog = P_DialogFind(linetarget->type); // dialog's jumptoconv equal to 0? - if(currentdialog[0].jumptoconv == 0) + if(currentdialog[i].jumptoconv == 0) break; - for(j = 0; j < MAXITEMREQUIREMENTS; j++) + for(j = 0; j < MDLG_MAXITEMS; j++) { dialog = ¤tdialog[j]; - if(dialog->checkitem1 != 0 && - P_PlayerHasItem(dialogtalker, dialog->checkitem1) < 1) + if(dialog->checkitem[j] != 0 && + P_PlayerHasItem(dialogtalker, dialog->checkitem[j]) < 1) { currentdialog = dialog; break; @@ -860,7 +857,7 @@ void P_DialogStart(player_t *player) } // setup number of choices to choose from - for(i = 0; i < MAXCHOICES; i++) + for(i = 0; i < MDLG_MAXCHOICES; i++) { if(!currentdialog->choices[i].giveitem) break; diff --git a/src/strife/p_dialog.h b/src/strife/p_dialog.h index 531e3028..e544d19c 100644 --- a/src/strife/p_dialog.h +++ b/src/strife/p_dialog.h @@ -31,41 +31,40 @@ #ifndef P_DIALOG_H__ #define P_DIALOG_H__ -#define MDLG_CHOICELEN 32 -#define MDLG_MSGLEN 80 -#define MDLG_NAMELEN 16 -#define MDLG_LUMPLEN 8 -#define MDLG_TEXTLEN 320 -#define MDLG_MAXCHOICES 5 +#define MDLG_CHOICELEN 32 +#define MDLG_MSGLEN 80 +#define MDLG_NAMELEN 16 +#define MDLG_LUMPLEN 8 +#define MDLG_TEXTLEN 320 +#define MDLG_MAXCHOICES 5 +#define MDLG_MAXITEMS 3 typedef struct mapdlgchoice_s { - int giveitem; // item given when successful - int needitem1; // first item needed for success - int needitem2; // second item needed for success, if any - int needitem3; // third item needed for success, if any - int needamount1; // amount of first item needed - int needamount2; // amount of second item needed - int needamount3; // amount of third item needed - char text[MDLG_CHOICELEN]; // normal text - char textok[MDLG_MSGLEN]; // message given on success - int next; // next dialog? - int objective; // ??? - char textno[MDLG_MSGLEN]; // message given on failure + int giveitem; // item given when successful + int needitem1; // first item needed for success + int needitem2; // second item needed for success, if any + int needitem3; // third item needed for success, if any + int needamount1; // amount of first item needed + int needamount2; // amount of second item needed + int needamount3; // amount of third item needed + char text[MDLG_CHOICELEN]; // normal text + char textok[MDLG_MSGLEN]; // message given on success + int next; // next dialog? + int objective; // ??? + char textno[MDLG_MSGLEN]; // message given on failure } mapdlgchoice_t; typedef struct mapdialog_s { - int speakerid; // script ID# for mobjtype that will use this dialog - int dropitem; // item to drop if that thingtype is killed - int checkitem1; // first item needed to see this dialog - int checkitem2; // second item needed to see this dialog, if any - int checkitem3; // third item needed to see this dialog, if any - int jumptoconv; // conversation to jump to when... ? - char name[MDLG_NAMELEN]; // name of speaker - char voice[MDLG_LUMPLEN]; // voice file to play - char backpic[MDLG_LUMPLEN]; // backdrop pic for character, if any - char text[MDLG_TEXTLEN]; // main message text + int speakerid; // script ID# for mobjtype that will use this dialog + int dropitem; // item to drop if that thingtype is killed + int checkitem[MDLG_MAXITEMS]; // item(s) needed to see this dialog + int jumptoconv; // conversation to jump to when... ? + char name[MDLG_NAMELEN]; // name of speaker + char voice[MDLG_LUMPLEN]; // voice file to play + char backpic[MDLG_LUMPLEN]; // backdrop pic for character, if any + char text[MDLG_TEXTLEN]; // main message text // options that this dialog gives the player mapdlgchoice_t choices[MDLG_MAXCHOICES]; -- cgit v1.2.3