diff --git a/Platform/Apple/virtual/src/plasma/gameloop.pla b/Platform/Apple/virtual/src/plasma/gameloop.pla index e3809ccf..69c1b140 100644 --- a/Platform/Apple/virtual/src/plasma/gameloop.pla +++ b/Platform/Apple/virtual/src/plasma/gameloop.pla @@ -105,6 +105,7 @@ byte q_mapNum = 0 word q_x word q_y byte q_dir +word mapNameHash = 0 /////////////////////////////////////////////////////////////////////////////////////////////////// // Definitions used by assembly code @@ -328,6 +329,40 @@ asm getXReg rts end +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Calculate 16-bit hash of a string +asm hashString + +asmPlasm 1 + sta pTmp + sty pTmp+1 + ldy #0 + sty tmp+1 + lda (pTmp),y + tax + iny +- clc + adc (pTmp),y + bcc + + inc tmp+1 ++ asl + rol tmp+1 + bcc + + ora #1 ++ asl + rol tmp+1 + bcc + + ora #1 ++ asl + rol tmp+1 + bcc + + ora #1 ++ iny + dex + bne - + ldy tmp+1 + rts +end + /////////////////////////////////////////////////////////////////////////////////////////////////// // Print a string asm puts @@ -956,6 +991,7 @@ def setMap(is3D, num, x, y, dir) setWindow1(); clearWindow() displayChar('Y'-$40) // center mode displayStr("Traveling...") + mapNameHash = 0 // because we replaced the title text displayChar('N'-$40) // normal mode setMapWindow(); clearWindow() setWindow2(); clearWindow() @@ -969,6 +1005,7 @@ end /////////////////////////////////////////////////////////////////////////////////////////////////// def kbdTeleport() + byte d3, num word x, y byte dir @@ -979,9 +1016,10 @@ def kbdTeleport() printf3("\nCurrent: X=%d Y=%d Facing=%d\n", x, y, getDir()) puts("3D : ") - mapIs3D = parseDec(readStr()) + d3 = parseDec(readStr()) + if d3 > 1; d3 = 1; fin puts("Map: ") - mapNum = parseDec(readStr()) + num = parseDec(readStr()) puts("X : ") x = parseDec(readStr()) puts("Y : ") @@ -991,7 +1029,7 @@ def kbdTeleport() ^$c052 - setMap(mapIs3D, mapNum, x, y, dir) + setMap(d3, num, x, y, dir) end /////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1060,6 +1098,7 @@ end // Set initial info for the scripts on this map: the trigger table and the name of the map. This // is called by the init function for the scripts. def setScriptInfo(mapName, trigTbl) + word newNameHash // Grab the trigger table origins (used so the table can be more compact) triggerOriginX = trigTbl=>0 @@ -1069,12 +1108,16 @@ def setScriptInfo(mapName, trigTbl) triggerTbl = trigTbl + 4 // Display map name - setWindow1() - clearWindow() - displayChar('Y'-$40) // center mode - displayStr(mapName) - displayChar('N'-$40) // normal mode - if mapIs3D; copyWindow(); fin + newNameHash = hashString(mapName) + if newNameHash <> mapNameHash + setWindow1() + clearWindow() + displayChar('Y'-$40) // center mode + displayStr(mapName) + displayChar('N'-$40) // normal mode + if mapIs3D; copyWindow(); fin + mapNameHash = newNameHash + fin // Back to the main text window. setWindow2() diff --git a/Platform/Apple/virtual/src/raycast/render.s b/Platform/Apple/virtual/src/raycast/render.s index 9032b00d..b9cd72ff 100644 --- a/Platform/Apple/virtual/src/raycast/render.s +++ b/Platform/Apple/virtual/src/raycast/render.s @@ -62,7 +62,6 @@ mapRayOrigin: !word 0 mapNum: !byte 1 nMapSprites: !byte 0 ; number of sprite entries on map to fix up nextLink: !byte 0 ; next link to allocate -tablesInitted: !byte 0 ; 1 after init plasmaStk: !byte 0 skyColorEven: !byte $20 @@ -2027,16 +2026,12 @@ pl_initMap: !zone ; Proceed with loading jsr loadTextures jsr copyScreen - lda tablesInitted - bne + ; Build all the unrolls and tables !if DEBUG { +prStr : !text "Making tables.",0 } jsr makeBlit jsr makeClrBlit jsr makeDecodeTbls jsr makeLines -+ lda #1 - sta tablesInitted jsr setExpansionCaller jsr graphInit jmp renderFrame