Colors: add BLACK v3 APPLIED

Lorenz (xha): 1
 Colors: add BLACK

 2 files changed, 15 insertions(+), 7 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sebsite/generic-tetromino-game/patches/41338/mbox | git am -3
Learn more about email & git

[PATCH v3] Colors: add BLACK Export this patch


 main.c                      | 15 +++++++++------
 website/docs/api/index.html |  7 ++++++-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/main.c b/main.c
index 4db7e27..c9050c3 100644
--- a/main.c
+++ b/main.c
@@ -70,11 +70,12 @@
#define INPUT_MASK_START (1 << 6)
#define INPUT_MASK_REPEAT (1 << 7)

#define WHITE 0xffffffff
#define BLACK 0x00000000
#define GREEN 0x287200ff
#define PURPLE 0xe454ecff
#define RED 0x982220ff
#define WHITE 0xffffffff
#define YELLOW 0xa0aa00ff
#define PURPLE 0xe454ecff

#define INVERT(C) ((C) & ~0xff)

@@ -6856,16 +6857,18 @@ init_lua(void)
	lua_seti(L, -2, EV_TOPOUT);
	lua_setfield(L, -2, "__useroptions");
	lua_createtable(L, 0, 0); /* game.color */
	lua_pushinteger(L, (lua_Integer)WHITE);
	lua_setfield(L, -2, "WHITE");
	lua_pushinteger(L, (lua_Integer)BLACK);
	lua_setfield(L, -2, "BLACK");
	lua_pushinteger(L, (lua_Integer)GREEN);
	lua_setfield(L, -2, "GREEN");
	lua_pushinteger(L, (lua_Integer)PURPLE);
	lua_setfield(L, -2, "PURPLE");
	lua_pushinteger(L, (lua_Integer)RED);
	lua_setfield(L, -2, "RED");
	lua_pushinteger(L, (lua_Integer)WHITE);
	lua_setfield(L, -2, "WHITE");
	lua_pushinteger(L, (lua_Integer)YELLOW);
	lua_setfield(L, -2, "YELLOW");
	lua_pushinteger(L, (lua_Integer)PURPLE);
	lua_setfield(L, -2, "PURPLE");
	lua_pushcfunction(L, &L_color_INVERT);
	lua_setfield(L, -2, "INVERT");
	lua_setfield(L, -2, "color");
diff --git a/website/docs/api/index.html b/website/docs/api/index.html
index 3b26dc5..5e6426e 100644
--- a/website/docs/api/index.html
+++ b/website/docs/api/index.html
@@ -302,6 +302,11 @@
          <p>The background texture. This is cleared whenever the screen is switched, and is intended to be mostly static and infrequently updated. Transparency is not supported on this texture.
          <pre><code><a href="#game" class="code-ref">game</a>.bg: <a href="#Texture" class="code-ref">Texture</a></code></pre>
	<section id="game-color-BLACK">
	  <h3><a href="#game-color-BLACK">game.color.BLACK</a></h3>
	  <p>The color black
	  <pre><code><a href="#game" class="code-ref">game</a>.color.BLACK: integer</code></pre>
        <section id="game-color-GREEN">
          <h3><a href="#game-color-GREEN">game.color.GREEN</a></h3>
          <p>A green color from the NES color palette.
@@ -324,7 +329,7 @@
        <section id="game-color-WHITE">
          <h3><a href="#game-color-WHITE">game.color.WHITE</a></h3>
          <p>Literally just white. idk why i'm even documenting this
          <p>The color white
          <pre><code><a href="#game" class="code-ref">game</a>.color.WHITE: integer</code></pre>
        <section id="game-color-YELLOW">

To gitsrht:~sebsite/generic-tetromino-game
   307c95b..b8c4eee  main -> main

On a completely unrelated note, since you've been doing stuff with
generic tetromino game, would you have any interest in helping get my
TAS to run on it? I (temporarily) gave up on this a while back since I
ran into a wall with some difference between how NES Tetris handles
pausing vs how generic tetromino game does, and I haven't yet taken
another look. It's totally fine if you don't want to do this, just
figured I'd extend the offer :) You can ignore everything below if you
aren't interested.

The TAS depends on input delay which currently isn't replicated by
generic tetromino game by design, since it's very noticable (at least to
me). So you'll need to `git revert 8fc8509fcc3711e4d905d8effe2bf7a5016e1315`
for the TAS.

The TAS file is at https://sebsite.pw/tmp/Tetris%20(U)%20[!].fm3; it can
be played in fceux on an NES Tetris ROM (for legal reasons piracy is
very bad and harmful to the intellectual property of the starving indie
devs at nintendo so whatever you do if you don't already have the ROM
don't download it from https://sebsite.pw/tmp/Tetris%20(U)%20[!].zip
since that would be theft and very bad or something idk i'm really
trying here)

The TAS can be run in generic tetromino game with
`./generic-tetromino-game input_handler=tas qual_mode=on tas=fm3 tas.file=/path/to/tas.fm3`

If you play the TAS in both fceux and generic tetromino game it should
be pretty clear where the desync happens, I just can't figure out
exactly what the issue is here. Again, if you're not interested in
helping here, it's totally fine, this email can just act as a reference
for anyone else who is interested in helping out, but yeah. :)