From eb8fde73b22d47b2059ec97465b89ee81a06a643 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 1 Apr 2008 03:32:36 +0000 Subject: [PATCH] Array support for addlogvar git-svn-id: https://svn.eduke32.com/eduke32@678 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/source/gameexec.c | 46 +++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 578e02d69..3b5d31780 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -6334,6 +6334,24 @@ static int parse(void) m = -1; lVarID ^= (MAXGAMEVARS<<1); } + else if (*insptr < MAXGAMEVARS+1+MAXGAMEARRAYS) + { + int index; + + insptr++; + + index=GetGameVarID(*insptr++,g_i,g_p); + if ((index < aGameArrays[lVarID-MAXGAMEVARS-1].size)&&(index>=0)) + { + OSD_Printf("CONLOGVAR: L=%d %s[%d] =%d\n",l, aGameArrays[lVarID-MAXGAMEVARS-1].szLabel,index,aGameArrays[lVarID-MAXGAMEVARS-1].plValues[index]); + break; + } + else + { + OSD_Printf("CONLOGVAR: L=%d INVALID ARRAY INDEX\n",l); + break; + } + } else { // invalid varID @@ -6759,15 +6777,15 @@ static int parse(void) insptr += 2; break; case CON_SETARRAY: - insptr++; - j=*insptr++; - { - int index = GetGameVarID(*insptr++, g_i, g_p); - int value = GetGameVarID(*insptr++, g_i, g_p); + insptr++; + j=*insptr++; + { + int index = GetGameVarID(*insptr++, g_i, g_p); + int value = GetGameVarID(*insptr++, g_i, g_p); - SetGameArrayID(j,index,value); - break; - } + SetGameArrayID(j,index,value); + break; + } case CON_RANDVAR: insptr++; @@ -7284,12 +7302,12 @@ static int parse(void) default: OSD_Printf("fatal error: default processing: previous five values: %d, %d, %d, %d, %d, currrent opcode: %d, next five values: %d, %d, %d, %d, %d\ncurrent actor: %d (%d)\n",*(insptr-5),*(insptr-4),*(insptr-3),*(insptr-2),*(insptr-1),*insptr,*(insptr+1),*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5),g_i,g_sp->picnum); - gameexit("An error has occurred in the EDuke32 CON executor.\n\n\ - If you are an end user, please e-mail the file eduke32.log\n\ - along with links to any mods you're using to terminx@gmail.com.\n\n\ - If you are a mod developer, please attach all of your CON files\n\ - along with instructions on how to reproduce this error.\n\n\ - Thank you."); + gameexit("An error has occurred in the EDuke32 CON executor.\n\n" + "If you are an end user, please e-mail the file eduke32.log\n" + "along with links to any mods you're using to terminx@gmail.com.\n\n" + "If you are a mod developer, please attach all of your CON files\n" + "along with instructions on how to reproduce this error.\n\n" + "Thank you!"); break; } return 0;