From 691f1b3acbe3e9f847b7ded5aac98425fea054f0 Mon Sep 17 00:00:00 2001 From: Samuel Villareal Date: Wed, 8 Sep 2010 05:24:40 +0000 Subject: + Converting needamountx and needitemx to arrays in choice struct + Dialog drawer updated to draw choices Subversion-branch: /branches/strife-branch Subversion-revision: 2041 --- src/strife/p_dialog.c | 46 ++++++++++++++++++++++++++++++++-------------- src/strife/p_dialog.h | 20 ++++++++------------ 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/strife/p_dialog.c b/src/strife/p_dialog.c index 51903f4e..a7e71a8c 100644 --- a/src/strife/p_dialog.c +++ b/src/strife/p_dialog.c @@ -411,18 +411,18 @@ static void P_ParseDialogLump(byte *lump, mapdialog_t **dialogs, for(j = 0; j < 5; j++) { mapdlgchoice_t *curchoice = &(curdialog->choices[j]); - DIALOG_INT(curchoice->giveitem, rover); - DIALOG_INT(curchoice->needitem1, rover); - DIALOG_INT(curchoice->needitem2, rover); - DIALOG_INT(curchoice->needitem3, rover); - DIALOG_INT(curchoice->needamount1, rover); - DIALOG_INT(curchoice->needamount2, rover); - DIALOG_INT(curchoice->needamount3, rover); - DIALOG_STR(curchoice->text, rover, MDLG_CHOICELEN); - DIALOG_STR(curchoice->textok, rover, MDLG_MSGLEN); - DIALOG_INT(curchoice->next, rover); - DIALOG_INT(curchoice->objective, rover); - DIALOG_STR(curchoice->textno, rover, MDLG_MSGLEN); + DIALOG_INT(curchoice->giveitem, rover); + DIALOG_INT(curchoice->needitems[0], rover); + DIALOG_INT(curchoice->needitems[1], rover); + DIALOG_INT(curchoice->needitems[2], rover); + DIALOG_INT(curchoice->needamounts[0], rover); + DIALOG_INT(curchoice->needamounts[1], rover); + DIALOG_INT(curchoice->needamounts[2], rover); + DIALOG_STR(curchoice->text, rover, MDLG_CHOICELEN); + DIALOG_STR(curchoice->textok, rover, MDLG_MSGLEN); + DIALOG_INT(curchoice->next, rover); + DIALOG_INT(curchoice->objective, rover); + DIALOG_STR(curchoice->textno, rover, MDLG_MSGLEN); } } } @@ -695,8 +695,10 @@ static void P_DialogDrawer(void) { angle_t angle; int y; + int i; int height; int finaly; + char choicetext[64]; // Run down bonuscount faster than usual so that flashes from being given // items are less obvious. @@ -715,7 +717,7 @@ static void P_DialogDrawer(void) // Dismiss the dialog if the player is out of alignment, or the thing he was // talking to is now engaged in battle. - if(angle > 0x20000000 && angle < 0xE0000000 || dialogtalker->flags & MF_INCOMBAT) + if(angle > ANG45 && angle < (ANG270+ANG45) || dialogtalker->flags & MF_INCOMBAT) P_DialogDoChoice(dialogmenu.numitems - 1); dialogtalker->reactiontime = 2; @@ -748,8 +750,24 @@ static void P_DialogDrawer(void) M_WriteText(42, finaly - 6, "______________________________"); /* - dialogmenu + dialogmenu // villsa [STRIFE] added 09/08/10 */ + + dialogmenu.y = finaly + 6; + y = 0; + + for(i = 0; i < dialogmenu.numitems - 1; i++) + { + sprintf(choicetext, "%d) %s", i + 1, currentdialog->choices[i].text); + if(currentdialog->choices[i].needamounts[0] > 0) + sprintf(choicetext, "%s for %d", choicetext, currentdialog->choices[i].needamounts[0]); + + M_WriteText(dialogmenu.x, dialogmenu.y + 3 + y, choicetext); + y += 19; + } + + M_WriteText(dialogmenu.x, 19 * i + dialogmenu.y + 3, dialoglastmsgbuffer); + } } diff --git a/src/strife/p_dialog.h b/src/strife/p_dialog.h index e544d19c..638d79e6 100644 --- a/src/strife/p_dialog.h +++ b/src/strife/p_dialog.h @@ -41,18 +41,14 @@ 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 needitems[MDLG_MAXITEMS]; // item needed for success + int needamounts[MDLG_MAXITEMS]; // amount of items 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 -- cgit v1.2.3