Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This is a comment
- // uncomment the line below if you want to write a filterscript
- //#define FILTERSCRIPT
- #pragma dynamic 16680064
- #include <a_samp>
- #include <YSI\y_colours>
- new
- gAlphabet[10][26 + 1 + 10 + 1] =
- {
- // A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 ~
- {0x30, 0xFC, 0x3C, 0xF8, 0xFE, 0xFE, 0x3C, 0xCC, 0x78, 0x1E, 0xE6, 0xF0, 0xC6, 0xC6, 0x38, 0xFC, 0x38, 0xFC, 0x78, 0xFC, 0xCC, 0xCC, 0xC6, 0xCC, 0xCC, 0xFE, 0x00, 0x7C, 0x10, 0x78, 0x78, 0x0C, 0xFC, 0x38, 0xFE, 0x78, 0x78, 0x73},
- {0x78, 0x66, 0x66, 0x6C, 0x62, 0x66, 0x66, 0xCC, 0x30, 0x0C, 0x66, 0x60, 0xEE, 0xC6, 0x6C, 0x66, 0x6C, 0x66, 0xCC, 0xB4, 0xCC, 0xCC, 0xC6, 0xCC, 0xCC, 0xCE, 0x00, 0xC6, 0x30, 0xCC, 0xCC, 0x1C, 0xC0, 0x60, 0xC6, 0xCC, 0xCC, 0xDA},
- {0xCC, 0x66, 0xC6, 0x66, 0x60, 0x62, 0xC6, 0xCC, 0x30, 0x0C, 0x6C, 0x60, 0xFE, 0xE6, 0xC6, 0x66, 0xC6, 0x66, 0xCC, 0x30, 0xCC, 0xCC, 0xC6, 0xCC, 0xCC, 0x98, 0x00, 0xCE, 0xF0, 0xCC, 0x0C, 0x3C, 0xC0, 0xC0, 0xC6, 0xCC, 0xCC, 0xCE},
- {0xCC, 0x66, 0xC0, 0x66, 0x64, 0x64, 0xC0, 0xCC, 0x30, 0x0C, 0x6C, 0x60, 0xFE, 0xF6, 0xC6, 0x66, 0xC6, 0x66, 0xC0, 0x30, 0xCC, 0xCC, 0xC6, 0x78, 0xCC, 0x18, 0x00, 0xDE, 0x30, 0x0C, 0x0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6C, 0xCC, 0x78, 0xFE, 0x00, 0x7C, 0xFC, 0xFC, 0x78, 0x1E, 0x78, 0x78, 0x30, 0x78, 0x70, 0x00},
- {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}
- };
- AddLetter(colour, letter, data[][], &x, &y)
- {
- if ('a' <= letter <= 'z') letter -= 'a';
- else if ('A' <= letter <= 'Z') letter -= 'A';
- else if ('0' <= letter <= '9') letter = letter - '0' + 27;
- else if (letter == '~') letter = 26 + 1 + 10;
- else letter = 26;
- for (new j = 0; j != 10; ++j)
- {
- for (new i = 0, k = 0x80; i != 8; ++i, k >>= 1)
- {
- if (gAlphabet[j][letter] & k) data[y + j][x + i] = colour;
- }
- }
- x += 8;
- }
- AddBlock(colour, data[][], &x, &y, width)
- {
- for (new j = 0; j != 50; ++j)
- {
- for (new i = 0; i != 200; ++i)
- {
- data[y + j][x + i] = colour;
- }
- }
- x += 202;
- if (x == width)
- {
- x = 2;
- y += 52;
- }
- }
- AddString(colour, str[], data[][], &x, &y)
- {
- for (new i = 0, ch; (ch = str[i]); ++i)
- {
- AddLetter(colour, ch, data, x, y);
- }
- }
- AddColour(colour, name[], data[][], &x, &y)
- {
- new
- ox = x + 10,
- oy = y + 20;
- colour >>>= 8;
- printf("%08x", colour);
- AddBlock(colour, data, x, y, 202 * 5 + 2);
- if (colour >> 16 & 0xFF < 32 && colour >> 8 & 0xFF < 32 && colour & 0xFF < 32)
- {
- // White (on dark).
- AddString(0xFFFFFF, name, data, ox, oy);
- }
- else
- {
- // Black (on most).
- AddString(0x000000, name, data, ox, oy);
- }
- }
- #define DO_X11(X11_%0) AddColour(X11_%0, #%0, gGridData, x, y)
- #define DO_GT(%0,%1) AddColour(SAMP_GAME_TEXT%0, #%1, gGridData, x, y)
- main()
- {
- print("\n----------------------------------");
- print(" Blank Gamemode by your name here");
- print("----------------------------------\n");
- new
- gGridData[1400 / 5 * 52 + 2][202 * 5 + 2]; // = {0xFF0000, ...};
- new
- x = 2,
- y = 2;
- // AddString(-1, "Hello There", gGridData, x, y);
- #include "x11.pwn"
- WriteBMP(gGridData, sizeof (gGridData), sizeof (gGridData[]));
- }
- MKLE32(dest[], num)
- {
- dest[0] = num & 0xFF;
- dest[1] = num >>> 8 & 0xFF;
- dest[2] = num >>> 16 & 0xFF;
- dest[3] = num >>> 24 & 0xFF;
- }
- /*Inv(dest[], idx)
- {
- dest[idx] = (dest[idx] >>> 24) | (dest[idx] & 0xFF0000 >> 8) | (dest[idx] & 0xFF00 << 8) | (dest[idx] & 0xFF << 24);
- }
- MK24(dest[], num, &idx)
- {
- dest{idx++} = num >>> 16 & 0xFF;
- if (idx & 0x07 == 0x04) Inv(dest, idx >> 2);
- dest{idx++} = num >>> 8 & 0xFF;
- if (idx & 0x07 == 0x04) Inv(dest, idx >> 2);
- dest{idx++} = num & 0xFF;
- if (idx & 0x07 == 0x04) Inv(dest, idx >> 2);
- }
- Pad(dest[], &idx)
- {
- while (idx & 0x03)
- {
- dest{idx++} = 0;
- }
- if (idx & 0x07 == 0x04) Inv(dest, idx >> 2);
- }*/
- MK24(dest[], num, &idx)
- {
- dest[idx++] = num & 0xFF;
- dest[idx++] = num >>> 8 & 0xFF;
- dest[idx++] = num >>> 16 & 0xFF;
- }
- Pad(dest[], &idx)
- {
- while (idx & 0x03)
- {
- dest[idx++] = 0;
- }
- }
- WriteBMP(data[][], y, x)
- {
- new
- File:bmp = fopen("x11_colours.bmp", io_write);
- if (!bmp)
- {
- printf("File Error");
- return;
- }
- printf("header");
- // Sizes are little endian.
- static
- sFileHeader[] =
- {
- 'B', 'M', // bfType
- 1, 1, 1, 1, // bfSize
- 0, 0, // bfReserved1
- 0, 0, // bfReserved2
- 2, 2, 2, 2 // bfOffBits
- },
- sInfoHeader[] =
- {
- 40, 0, 0, 0, // biSize
- 4, 4, 4, 4, // biWidth
- 5, 5, 5, 5, // biHeight
- 0, 0, // biPlanes
- 24, 0, // biBitCount
- 0, 0, 0, 0, // biCompression
- 0, 0, 0, 0, // biSizeImage
- 0, 0, 0, 0, // biXPelsPerMeter
- 0, 0, 0, 0, // biYPelsPerMeter
- 0, 0, 0, 0, // biClrUsed
- 0, 0, 0, 0 // biClrImportant
- };
- MKLE32(sInfoHeader[4], x);
- MKLE32(sInfoHeader[8], y);
- MKLE32(sFileHeader[2], x * y * 3 + sizeof (sFileHeader) + sizeof (sInfoHeader));
- MKLE32(sFileHeader[10], sizeof (sFileHeader) + sizeof (sInfoHeader));
- printf("write");
- for (new j = 0; j != sizeof (sFileHeader); ++j)
- {
- fputchar(bmp, sFileHeader[j], false);
- }
- for (new j = 0; j != sizeof (sInfoHeader); ++j)
- {
- fputchar(bmp, sInfoHeader[j], false);
- }
- //fblockwrite(bmp, sFileHeader, sizeof (sFileHeader));
- //fblockwrite(bmp, sInfoHeader, sizeof (sInfoHeader));
- printf("body");
- static
- sRow[(202 * 5 + 2) * 3];
- for (new i = y; i-- > 0; )
- {
- //printf("row %d", i);
- // Go through the array backwards (bottom to top).
- new
- idx;
- for (new j = 0; j != x; ++j)
- {
- MK24(sRow, data[i][j], idx);
- }
- Pad(sRow, idx);
- //printf("%04x%04x %04x%04x %04x%04x", sRow[0] >>> 16, sRow[0] & 0xFFFF, sRow[1] >>> 16, sRow[1] & 0xFFFF, sRow[2] >>> 16, sRow[2] & 0xFFFF);
- //strpack(sRow, sRow, idx);
- //fblockwrite(bmp, sRow, idx >> 2);
- for (new j = 0; j != idx; ++j) //j += 4)
- {
- /*sChar{0} = sRow[j + 0];
- sChar{1} = sRow[j + 1];
- sChar{2} = sRow[j + 2];
- sChar{3} = sRow[j + 3];
- fblockwrite(bmp, sChar, 1);*/
- fputchar(bmp, sRow[j], false);
- //fseek(bmp, -3, seek_current);
- }
- }
- printf("done");
- fclose(bmp);
- }
Advertisement
Add Comment
Please, Sign In to add comment