Skip to content

Instantly share code, notes, and snippets.

@vi

vi/0000-README.md

Last active Aug 29, 2015
Embed
What would you like to do?
rRootage red-blue recolouring patch

Intro

Playing STG requires to consider two objects: projectiles and player. This patch changes colours of objects in rRootage: player is red, projectiles are blue. This way, using anaglyph glasses, each eye sees only one of two requires thigs, which adds a bit of difficulty.

Inspired by idea of Lazy Eye Tetris.

Usage

  1. Ensure you can build and run usual rRootage (for example, using apt-get source rrootage on Debian);
  2. Apply this patch and re-build.

Pre-build x86 version for Debian/Ubuntu with usual rrootage installed: http://vi-server.org/pub/rrootage_redblue

From 796e598bb2d9c874d95e839f059ff96e9c48fa76 Mon Sep 17 00:00:00 2001
From: Vitaly _Vi Shukela <vi0oss@gmail.com>
Date: Thu, 20 Nov 2014 05:27:00 +0300
Subject: [PATCH] Make player red and all bullets blue
---
src/attractmanager.c | 2 +-
src/screen.c | 60 +++++++++++++++++++++++++++++-----------------------
2 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/src/attractmanager.c b/src/attractmanager.c
index 1d2aa8e..daad653 100644
--- a/src/attractmanager.c
+++ b/src/attractmanager.c
@@ -50,7 +50,7 @@ static void initHiScore() {
}
static float bgColor[MODE_NUM][3] = {
- {0.0f, 0.0f, 0.0f}, {0.1f, 0.1f, 0.3f}, {0.3f, 0.1f, 0.3f}, {0.1f, 0.3f, 0.1f},
+ {0.0f, 0.2f, 0.3f}, {0.1f, 0.1f, 0.3f}, {0.3f, 0.1f, 0.3f}, {0.1f, 0.3f, 0.1f},
};
static void setMode(int m) {
diff --git a/src/screen.c b/src/screen.c
index 1c83309..5bfb6fb 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -354,30 +354,30 @@ void drawLaser(GLfloat x, GLfloat y, GLfloat width, GLfloat height,
float gx, gy;
glBegin(GL_TRIANGLE_FAN);
if ( type != 0 ) {
- glColor4ub(cc1, cc1, cc1, LASER_ALPHA);
+ glColor4ub(cc1, 0, 0, LASER_ALPHA);
glVertex3f(x-width, y, 0);
}
- glColor4ub(cc2, 255, cc2, LASER_ALPHA);
+ glColor4ub(cc2, 0, 0, LASER_ALPHA);
glVertex3f(x, y, 0);
- glColor4ub(cc4, 255, cc4, LASER_ALPHA);
+ glColor4ub(cc4, 0, 0, LASER_ALPHA);
glVertex3f(x, y+height, 0);
- glColor4ub(cc3, cc3, cc3, LASER_ALPHA);
+ glColor4ub(cc3, 0, 0, LASER_ALPHA);
glVertex3f(x-width, y+height, 0);
glEnd();
glBegin(GL_TRIANGLE_FAN);
if ( type != 0 ) {
- glColor4ub(cc1, cc1, cc1, LASER_ALPHA);
+ glColor4ub(cc1, 0, 0, LASER_ALPHA);
glVertex3f(x+width, y, 0);
}
- glColor4ub(cc2, 255, cc2, LASER_ALPHA);
+ glColor4ub(cc2, 0, 0, LASER_ALPHA);
glVertex3f(x, y, 0);
- glColor4ub(cc4, 255, cc4, LASER_ALPHA);
+ glColor4ub(cc4, 0, 0, LASER_ALPHA);
glVertex3f(x, y+height, 0);
- glColor4ub(cc3, cc3, cc3, LASER_ALPHA);
+ glColor4ub(cc3, 0, 0, LASER_ALPHA);
glVertex3f(x+width, y+height, 0);
glEnd();
if ( type == 2 ) return;
- glColor4ub(80, 240, 80, LASER_LINE_ALPHA);
+ glColor4ub(80, 0, 0, LASER_LINE_ALPHA);
glBegin(GL_LINES);
d = (cnt*LASER_LINE_ROLL_SPEED)&(512/4-1);
for ( i=0 ; i<4 ; i++, d+=(512/4) ) {
@@ -403,8 +403,8 @@ void drawLaser(GLfloat x, GLfloat y, GLfloat width, GLfloat height,
}
#define SHAPE_POINT_SIZE 0.05f
-#define SHAPE_BASE_COLOR_R 250
-#define SHAPE_BASE_COLOR_G 240
+#define SHAPE_BASE_COLOR_R 0
+#define SHAPE_BASE_COLOR_G 0
#define SHAPE_BASE_COLOR_B 180
#define CORE_HEIGHT 0.2f
@@ -462,7 +462,7 @@ void drawShipShape(GLfloat x, GLfloat y, float d, int inv) {
int i;
glPushMatrix();
glTranslatef(x, y, 0);
- glColor4ub(255, 100, 100, 255);
+ glColor4ub(255, 0, 0, 190);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-SHAPE_POINT_SIZE_L, -SHAPE_POINT_SIZE_L, 0);
glVertex3f( SHAPE_POINT_SIZE_L, -SHAPE_POINT_SIZE_L, 0);
@@ -474,7 +474,7 @@ void drawShipShape(GLfloat x, GLfloat y, float d, int inv) {
return;
}
glRotatef(d, 0, 1, 0);
- glColor4ub(120, 220, 100, 150);
+ glColor4ub(120, 0, 0, 150);
/*if ( mode == IKA_MODE ) {
glColor4ub(180, 200, 160, 150);
} else {
@@ -537,9 +537,12 @@ void drawCircle(GLfloat x, GLfloat y, GLfloat width, int cnt,
void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
int r, int g, int b) {
+ r=0;
+ g=0;//g/4;
GLfloat sz, sz2;
glPushMatrix();
glTranslatef(x, y, 0);
+
glColor4ub(r, g, b, 255);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-SHAPE_POINT_SIZE, -SHAPE_POINT_SIZE, 0);
@@ -547,17 +550,20 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
glVertex3f( SHAPE_POINT_SIZE, SHAPE_POINT_SIZE, 0);
glVertex3f(-SHAPE_POINT_SIZE, SHAPE_POINT_SIZE, 0);
glEnd();
+
switch ( type ) {
case 0:
sz = size/2;
glRotatef((float)d*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_LOOP);
glVertex3f(-sz, -sz, 0);
glVertex3f( sz, -sz, 0);
glVertex3f( 0, size, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
+
glColor4ub(r, g, b, 150);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-sz, -sz, 0);
@@ -569,14 +575,14 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
case 1:
sz = size/2;
glRotatef((float)((cnt*23)&1023)*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_LOOP);
glVertex3f( 0, -size, 0);
glVertex3f( sz, 0, 0);
glVertex3f( 0, size, 0);
glVertex3f(-sz, 0, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
glColor4ub(r, g, b, 180);
glBegin(GL_TRIANGLE_FAN);
glVertex3f( 0, -size, 0);
@@ -589,14 +595,14 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
case 2:
sz = size/4; sz2 = size/3*2;
glRotatef((float)d*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_LOOP);
glVertex3f(-sz, -sz2, 0);
glVertex3f( sz, -sz2, 0);
glVertex3f( sz, sz2, 0);
glVertex3f(-sz, sz2, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
glColor4ub(r, g, b, 120);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-sz, -sz2, 0);
@@ -609,14 +615,14 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
case 3:
sz = size/2;
glRotatef((float)((cnt*37)&1023)*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_LOOP);
glVertex3f(-sz, -sz, 0);
glVertex3f( sz, -sz, 0);
glVertex3f( sz, sz, 0);
glVertex3f(-sz, sz, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
glColor4ub(r, g, b, 180);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-sz, -sz, 0);
@@ -629,7 +635,7 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
case 4:
sz = size/2;
glRotatef((float)((cnt*53)&1023)*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_LOOP);
glVertex3f(-sz/2, -sz, 0);
glVertex3f( sz/2, -sz, 0);
@@ -640,7 +646,7 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
glVertex3f(-sz, sz/2, 0);
glVertex3f(-sz, -sz/2, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
glColor4ub(r, g, b, 220);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-sz/2, -sz, 0);
@@ -657,13 +663,13 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
case 5:
sz = size*2/3; sz2 = size/5;
glRotatef((float)d*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_STRIP);
glVertex3f(-sz, -sz+sz2, 0);
glVertex3f( 0, sz+sz2, 0);
glVertex3f( sz, -sz+sz2, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
glColor4ub(r, g, b, 150);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-sz, -sz+sz2, 0);
@@ -675,7 +681,7 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
case 6:
sz = size/2;
glRotatef((float)((cnt*13)&1023)*360/1024, 0, 0, 1);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
glBegin(GL_LINE_LOOP);
glVertex3f(-sz, -sz, 0);
glVertex3f( 0, -sz, 0);
@@ -684,7 +690,7 @@ void drawShape(GLfloat x, GLfloat y, GLfloat size, int d, int cnt, int type,
glVertex3f( 0, sz, 0);
glVertex3f(-sz, 0, 0);
glEnd();
- glEnable(GL_BLEND);
+ //glEnable(GL_BLEND);
glColor4ub(r, g, b, 210);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-sz, -sz, 0);
--
1.9.3.2.g88d1de7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.