diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 2ad9000bf..661fc27d2 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -87,6 +87,7 @@ static struct { uint32_t keyw; uint32_t date; } g_keywdate[] = { CON_INCLUDEDEFAULT, 20110615 }, { CON_SETACTORSOUNDPITCH, 20111102 }, { CON_ECHO, 20120304 }, + { CON_SHOWVIEWUNBIASED, 20120331 }, }; char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling @@ -565,6 +566,7 @@ const char *keyw[] = "includedefault", // 360 "setactorsoundpitch", // 361 "echo", // 362 + "showviewunbiased", // 363 "" }; @@ -4220,6 +4222,7 @@ static int32_t C_ParseCommand(int32_t loop) continue; case CON_SHOWVIEW: + case CON_SHOWVIEWUNBIASED: if (g_parsingEventPtr == NULL && g_processingState == 0) { C_ReportError(ERROR_EVENTONLY); diff --git a/polymer/eduke32/source/gamedef.h b/polymer/eduke32/source/gamedef.h index 43685e369..5aafb875e 100644 --- a/polymer/eduke32/source/gamedef.h +++ b/polymer/eduke32/source/gamedef.h @@ -941,6 +941,7 @@ enum ScriptKeywords_t CON_INCLUDEDEFAULT, // 360 CON_SETACTORSOUNDPITCH, // 361 CON_ECHO, // 362 + CON_SHOWVIEWUNBIASED, // 363 CON_END }; #endif diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index 686a03b34..5a58696e4 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2310,6 +2310,7 @@ nullquote: } case CON_SHOWVIEW: + case CON_SHOWVIEWUNBIASED: insptr++; { int32_t x=Gv_GetVarX(*insptr++); @@ -2318,10 +2319,10 @@ nullquote: int32_t a=Gv_GetVarX(*insptr++); int32_t horiz=Gv_GetVarX(*insptr++); int32_t sect=Gv_GetVarX(*insptr++); - int32_t x1=scale(Gv_GetVarX(*insptr++),xdim,320); - int32_t y1=scale(Gv_GetVarX(*insptr++),ydim,200); - int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320); - int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200); + int32_t x1=Gv_GetVarX(*insptr++); + int32_t y1=Gv_GetVarX(*insptr++); + int32_t x2=Gv_GetVarX(*insptr++); + int32_t y2=Gv_GetVarX(*insptr++); int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536); #ifdef USE_OPENGL int32_t oprojhacks; @@ -2332,6 +2333,26 @@ nullquote: if (x1 > x2) swaplong(&x1,&x2); if (y1 > y2) swaplong(&y1,&y2); + if (tw == CON_SHOWVIEW) + { + // The showview command has a rounding bias towards zero, + // e.g. floor((319*1680)/320) == 1674 + x1 = scale(x1,xdim,320); + y1 = scale(y1,ydim,200); + x2 = scale(x2,xdim,320); + y2 = scale(y2,ydim,200); + } + else + { + // This will map the maximum 320-based coordinate to the + // maximum real screen coordinate: + // floor((319*1679)/319) == 1679 + x1 = scale(x1,xdim-1,319); + y1 = scale(y1,ydim-1,199); + x2 = scale(x2,xdim-1,319); + y2 = scale(y2,ydim-1,199); + } + if ((x1 < 0 || y1 < 0 || x2 > xdim-1 || y2 > ydim-1 || x2-x1 < 2 || y2-y1 < 2)) { OSD_Printf(CON_ERROR "incorrect coordinates\n",g_errorLineNum,keyw[g_tw]);