diff exporters.pde @ 179:934934bb1fbb

Rename global variable s/machine/g_machine/g
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 23 Aug 2018 13:11:47 +0300
parents 3ddf4d799fe6
children 5c08f024e542
line wrap: on
line diff
--- a/exporters.pde	Thu Aug 23 13:08:34 2018 +0300
+++ b/exporters.pde	Thu Aug 23 13:11:47 2018 +0300
@@ -196,7 +196,7 @@
 
     head = 0;
 
-    if (machine == SPECTRUM) //SCR=SCREEN$
+    if (g_machine == SPECTRUM) //SCR=SCREEN$
     {
         // 32*24*8 bytes of bitmap
         // 32*24 bytes of attributes
@@ -234,7 +234,7 @@
         }
     }
     else
-    if (machine == C64) {
+    if (g_machine == C64) {
         //0x0002->bitmap
         //0x1f42->colormap
         //0x232a=border (take the lower nybble)
@@ -259,7 +259,7 @@
         }
     }
     else
-    if (machine == PLUS4) { // Botticelli
+    if (g_machine == PLUS4) { // Botticelli
         //g.hires.prg = botticelli
         //2 - luminance 40*25
         //1026 - colors 40*25
@@ -286,7 +286,7 @@
         }
     }
     else
-    if (machine == PLUS4M) { // Multi Botticelli
+    if (g_machine == PLUS4M) { // Multi Botticelli
         //m.multi.prg = multi botticelli
         //2- lumins 40*25
         //1024 - bäkki1
@@ -323,7 +323,7 @@
         g_map[2] = byte(convertluminance(l1, p1));
     }
     else
-    if (machine == C64M) { //advanced art studio
+    if (g_machine == C64M) { //advanced art studio
         //adv. art studio (=multicolor) 10018 bytes
         //0x0002 bitmap (40*25*8)
         //0x1f42 colors1 (40*25)
@@ -353,7 +353,7 @@
         g_map[1] = byte(fdata[0x232b] & 0x0f); //baku
     }
     else
-    if (machine == MSX) { // sc2
+    if (g_machine == MSX) { // sc2
         // 7=bitmap 32*24*8
         // 7+(32*24*8)=colormap 32*24
         if (fdata.length < 14343) {
@@ -379,7 +379,7 @@
         }
     }
     else
-    if (machine == CPC) { // a studio?
+    if (g_machine == CPC) { // a studio?
         return false;
     }
 
@@ -395,7 +395,7 @@
     int val1, val2, val3;
     int y, y2, yy, x, yp, xp, ad, valu, valu2, bri;
 
-    if (machine == PLUS4) { // botticelli hires
+    if (g_machine == PLUS4) { // botticelli hires
         ctx.loadTemplate("g.hires.prg");
 
         ctx.setOffs(0x02);
@@ -408,7 +408,7 @@
         mpExportBitmapData(ctx, 40, 25);
     }
     else
-    if (machine == PLUS4M) { // multi botticelli multicolor
+    if (g_machine == PLUS4M) { // multi botticelli multicolor
         ctx.loadTemplate("m.multi.prg");
 
         val2 = getpluscolor(int(g_map[1]));
@@ -431,7 +431,7 @@
         mpExportBitmapData(ctx, 40, 25);
     }
     else
-    if (machine == C64) {
+    if (g_machine == C64) {
         ctx.loadTemplate("hires.art");
 
         ctx.setOffs(2);
@@ -443,7 +443,7 @@
         ctx.writeByteAt(0x232a, g_map[0]);
     }
     else
-    if (machine == C64M) {
+    if (g_machine == C64M) {
         if (subformat == 0)
         {
             // Advanced Art Studio
@@ -479,7 +479,7 @@
         }
     }
     else
-    if (machine == MSX) {
+    if (g_machine == MSX) {
         ctx.loadTemplate("msx-screen2.sc2");
 
         ctx.setOffs(7);
@@ -489,7 +489,7 @@
         mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style
     }
     else
-    if (machine == SPECTRUM) {
+    if (g_machine == SPECTRUM) {
         ctx.loadTemplate("zx-screen.scr");
 
         ctx.setOffs(0);
@@ -544,9 +544,9 @@
 boolean mpExportMachinePRG(MPWriteCtx ctx)
 {
     // any common text headers
-    ctx.addComment("machine=" + str(machine) + " (" + g_name + ")");
+    ctx.addComment("g_machine=" + str(g_machine) + " (" + g_name + ")");
 
-    if (machine == C64) { //C64 HIRES
+    if (g_machine == C64) { //C64 HIRES
         ctx.loadTemplate("c64show.prg");
 
         ctx.setOffs(0x0227);
@@ -567,7 +567,7 @@
         //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg)
     }
     else
-    if (machine == C64M) { //C64 MULTICOLOR
+    if (g_machine == C64M) { //C64 MULTICOLOR
         ctx.loadTemplate("c64mshow.prg");
 
         ctx.setOffs(0x0239);
@@ -596,7 +596,7 @@
         //0x2563->värikartta 2 (40x25 bytee, nyppeli 3-väri nepan osoitteessa $d800-)
     }
     else
-    if (machine == PLUS4M) { //PLUS4 MULTICOLOR
+    if (g_machine == PLUS4M) { //PLUS4 MULTICOLOR
         ctx.loadTemplate("showpfourm.prg");
 
         ctx.addLine(".global @@_bitmap");
@@ -648,7 +648,7 @@
         //0x2469 luminance (40 x 25)
     }
     else
-    if (machine == PLUS4) { // Plus 4 hires
+    if (g_machine == PLUS4) { // Plus 4 hires
         ctx.loadTemplate("showpfour.prg");
 
         ctx.addLine(".global @@_bitmap");
@@ -680,7 +680,7 @@
         //0x2460   luminance (40 x 25)
     }
     else
-    if (machine == MSX) { // MSX
+    if (g_machine == MSX) { // MSX
         ctx.loadTemplate("msxshow.com");
 
         ctx.addLine(".globl @@_bitmap,@@_nimi2");
@@ -703,7 +703,7 @@
         //0x18fa colors (32*24 bytes)
     }
     else
-    if (machine == SPECTRUM) { // ZX Spectrum
+    if (g_machine == SPECTRUM) { // ZX Spectrum
 
         //would need some cleaning up
 
@@ -776,7 +776,7 @@
         ctx.writeByteAt(0x1d3e, int(checksum), "_checksum");
     }
     else
-    if (machine == CPC) {
+    if (g_machine == CPC) {
         int val1, val2, val3, valu;
         ctx.loadTemplate("cpc-mode0.bin");
 
@@ -963,7 +963,7 @@
     else
         xmult = width;
 
-    if (machine == MSX) {
+    if (g_machine == MSX) {
         myrpsi = 7;
     }
 
@@ -1282,7 +1282,7 @@
             f = easygetcolor(xx, yy);
 //            f = getabsa(xx, yy, 0);
 
-        if (machine == MSX && f == 0)
+        if (g_machine == MSX && f == 0)
             f = g_map[1];
 
         color c = color(g_r[f], g_g[f], g_b[f]);
@@ -1634,7 +1634,7 @@
 
 void mpSetupMachine(int m)
 {
-    machine = m;
+    g_machine = m;
 
     g_name = "ERROR";
     g_exportext = "none";
@@ -1646,8 +1646,8 @@
 
     g_aspect = AR_SQUARE;
 
-    g_map[3] = byte(machine);
-    g_map[13] = byte(machine);
+    g_map[3] = byte(g_machine);
+    g_map[13] = byte(g_machine);
     g_palsteps = 0;
     g_farge = 1;
     g_backg = 0;
@@ -1659,7 +1659,7 @@
     X = 320;
     Y = 200;
 
-    if (machine == C64)
+    if (g_machine == C64)
     {
         //c64 hires
         g_name = "c64";
@@ -1674,7 +1674,7 @@
         make_c64_palette();
     }
     else
-    if (machine == CPC)
+    if (g_machine == CPC)
     {
         //Amstrad CPC mode 0
         g_name = "cpc";
@@ -1708,7 +1708,7 @@
         makecolor(15, 0xFF, 0xFF, 0xFF);
     }
     else
-    if (machine == MSX)
+    if (g_machine == MSX)
     {
         // MSX
         g_name = "msx";
@@ -1749,7 +1749,7 @@
         make_msx_palette();
     }
     else
-    if (machine == SPECTRUM)
+    if (g_machine == SPECTRUM)
     {
         // ZX Spectrum
         g_name = "spec";
@@ -1769,7 +1769,7 @@
         make_spectrum_palette();
     }
     else
-    if (machine == TIMEX)
+    if (g_machine == TIMEX)
     {
         // timex sinclair
         g_name = "tmx";
@@ -1784,7 +1784,7 @@
         make_spectrum_palette();
     }
     else
-    if (machine == JR200)
+    if (g_machine == JR200)
     {
         // Panasonic JR200
         g_name = "jr200";
@@ -1799,7 +1799,7 @@
         make_spectrum_palette(); //cheating
     }
     else
-    if (machine == PLUS4M || machine == PLUS4)
+    if (g_machine == PLUS4M || g_machine == PLUS4)
     {
         // Commodore plus/4
         g_name = "plus4m";
@@ -1818,7 +1818,7 @@
         g_map[2] = 61;
         g_farge = 61;
 
-        if (machine == PLUS4)
+        if (g_machine == PLUS4)
         {
             // plus/4 hires
             g_name = "plus4";
@@ -1833,7 +1833,7 @@
         make_plus4_palette();
     }
     else
-    if (machine == C64M)
+    if (g_machine == C64M)
     {
         //c64 multicolor
         g_name = "c64m";
@@ -1851,7 +1851,7 @@
         make_c64_palette();
     }
     else
-    if (machine == QLLOW)
+    if (g_machine == QLLOW)
     {
         // Sinclair QL low
         g_backmode = 0;
@@ -1866,7 +1866,7 @@
         make_ql_palette();
     }
     else
-    if (machine == BK0010)
+    if (g_machine == BK0010)
     {
         // BK0010 patch
         g_backmode = 0;
@@ -1881,7 +1881,7 @@
         make_bk_palette();
     }
     else
-    if (machine == AMIGA)
+    if (g_machine == AMIGA)
     {
         g_name = "amiga";
         g_exportext = "";
@@ -1905,7 +1905,7 @@
         }
     }
     else
-    if (machine == ATARIST)
+    if (g_machine == ATARIST)
     {
         //ATARI ST 512 color
         g_name = "st";
@@ -1928,7 +1928,7 @@
         }
     }
     else
-    if (machine == C64FLI)
+    if (g_machine == C64FLI)
     {
         //c64 hires FLI = AFLI
         g_name = "afli";
@@ -1943,7 +1943,7 @@
         make_c64_palette();
     }
     else
-    if (machine == C64FLIM)
+    if (g_machine == C64FLIM)
     {
         //C64 FLI multicolor
         g_name = "fli";
@@ -1961,7 +1961,7 @@
         make_c64_palette();
     }
     else
-    if (machine == C64NOLIMIT)
+    if (g_machine == C64NOLIMIT)
     {
         g_name = "c64hino";
         g_exportext = "";
@@ -1978,7 +1978,7 @@
         make_c64_palette();
     }
     else
-    if (machine == PICO8)
+    if (g_machine == PICO8)
     {
         // Pico-8 fantasy console
         g_name = "pico8";
@@ -2011,7 +2011,7 @@
         makecolor(15, 255, 214, 197);
     }
     else
-    if (machine == COCO3)
+    if (g_machine == COCO3)
     {
         //6-bit RGB, 16 out of 64 possible
         g_name = "coco";
@@ -2029,7 +2029,7 @@
         make_coco_palette();
     }
     else
-    if (machine == UNIA)
+    if (g_machine == UNIA)
     {
         // Unia digital palette
         g_name = "unia";