shithub: cstory

Download patch

ref: 1e748f94069d98418eae911b0d003e67e57eecce
parent: 767c2972ae09642c63528c2efbe4adf77f9a6e11
author: cuckydev <cuckydev@users.noreply.github.com>
date: Sat Feb 9 18:07:23 EST 2019

fix

--- a/src/Game.cpp
+++ b/src/Game.cpp
@@ -50,7 +50,7 @@
 
 int Random(int min, int max)
 {
-	return min + rand() % (max - min + 1);
+	return min + rep_rand() % (max - min + 1);
 }
 
 void PutNumber4(int x, int y, int value, bool bZero)
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -47,13 +47,13 @@
 //A replication of MSVC's rand algorithm
 static unsigned long int next = 1;
 
-int _rand()
+int rep_rand()
 {
 	next = ((next) * 214013 + 2531011);
     return ((next) >> 16) & 0x7FFF;
 }
 
-void _srand(unsigned int seed)
+void rep_srand(unsigned int seed)
 {
     next = seed;
 }
--- a/src/PixTone.cpp
+++ b/src/PixTone.cpp
@@ -46,9 +46,9 @@
 		gWaveModelTable[4][i] = -0x40;
 
 	/* White noise wave */
-	srand(0);
+	rep_srand(0);
 	for (int i = 0; i < 0x100; i++)
-		gWaveModelTable[5][i] = (int8_t)rand() / 2;
+		gWaveModelTable[5][i] = (int8_t)rep_rand() / 2;
 }
 
 //Loading .pxt files
--- a/src/ValueView.cpp
+++ b/src/ValueView.cpp
@@ -43,7 +43,7 @@
 	
 	//Get if negative or not
 	bool minus;
-	if ( value >= 0 )
+	if (value >= 0)
 	{
 		minus = false;
 	}
@@ -85,6 +85,28 @@
 	gVV[index].rect.right = 40;
 	gVV[index].rect.bottom = 8 * (index + 1);
 	
+	RECT rect[20];
+	rect[0] = {0, 56, 8, 64};
+	rect[1] = {8, 56, 16, 64};
+	rect[2] = {16, 56, 24, 64};
+	rect[3] = {24, 56, 32, 64};
+	rect[4] = {32, 56, 40, 64};
+	rect[5] = {40, 56, 48, 64};
+	rect[6] = {48, 56, 56, 64};
+	rect[7] = {56, 56, 64, 64};
+	rect[8] = {64, 56, 72, 64};
+	rect[9] = {72, 56, 80, 64};
+	rect[10] = {0, 64, 8, 72};
+	rect[11] = {8, 64, 16, 72};
+	rect[12] = {16, 64, 24, 72};
+	rect[13] = {24, 64, 32, 72};
+	rect[14] = {32, 64, 40, 72};
+	rect[15] = {40, 64, 48, 72};
+	rect[16] = {48, 64, 56, 72};
+	rect[17] = {56, 64, 64, 72};
+	rect[18] = {64, 64, 72, 72};
+	rect[19] = {72, 64, 80, 72};
+	
 	//Get digits
 	int dig[4];
 	dig[0] = 1;
@@ -103,7 +125,7 @@
 		}
 	}
 	
-	int sw = 0;
+	bool sw = false;
 	
 	RECT rcPlus = {32, 48, 40, 56};
 	RECT rcMinus = {40, 48, 48, 56};
@@ -120,15 +142,12 @@
 	{
 		if (sw || !i || fig[i])
 		{
-			sw = 1;
+			sw = true;
 			
-			RECT rect;
 			if (minus)
-				rect = {fig[i] << 3, 64, (fig[i] + 1) << 3, 72};
-			else
-				rect = {fig[i] << 3, 56, (fig[i] + 1) << 3, 64};
+				fig[i] += 10;
 			
-			Surface2Surface(8 * (4 - i), gVV[index].rect.top, &rect, 29, 26);
+			Surface2Surface(8 * (4 - i), gVV[index].rect.top, &rect[fig[i]], 29, 26);
 		}
 	}
 }
--- a/src/WindowsWrapper.h
+++ b/src/WindowsWrapper.h
@@ -1,9 +1,6 @@
 #pragma once
-
-#define rand _rand
-#define srand _srand
-int _rand();
-void _srand(unsigned int seed);
+int rep_rand();
+void rep_srand(unsigned int seed);
 
 typedef int BOOL;