var float tet_high_score = 0;
-vector TET_START_PIECE_POS = '5 1 0';
-float TET_LINES = 22;
-float TET_DISPLAY_LINES = 20;
-float TET_WIDTH = 10;
-string TET_EMPTY_LINE = "0000000000"; // must match TET_WIDTH
+const vector TET_START_PIECE_POS = '5 1 0';
+const float TET_LINES = 22;
+const float TET_DISPLAY_LINES = 20;
+const float TET_WIDTH = 10;
+const string TET_EMPTY_LINE = "0000000000"; // must match TET_WIDTH
//character values
-float TET_BORDER = 139;
-float TET_BLOCK = 133;
-float TET_SPACE = 160; // blankness
+const float TET_BORDER = 139;
+const float TET_BLOCK = 133;
+const float TET_SPACE = 160; // blankness
-float TETKEY_UP = 1;
-float TETKEY_DOWN = 2;
-float TETKEY_LEFT = 4;
-float TETKEY_RIGHT = 8;
-float TETKEY_ROTLEFT = 16;
-float TETKEY_ROTRIGHT = 32;
-float TETKEY_DROP = 64;
-string TET_PADDING_RIGHT = "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0"; // get away from crosshair
+const float TETKEY_UP = 1;
+const float TETKEY_DOWN = 2;
+const float TETKEY_LEFT = 4;
+const float TETKEY_RIGHT = 8;
+const float TETKEY_ROTLEFT = 16;
+const float TETKEY_ROTRIGHT = 32;
+const float TETKEY_DROP = 64;
+const string TET_PADDING_RIGHT = "\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0\xA0"; // get away from crosshair
-float PIECES = 7;
+const float PIECES = 7;
float tet_line_buf;
float Tetris_Level()
{
return ((floor((self.tet_lines / 10)) + 1));
-};
+}
void tetsnd(string snd)
{
if(ln < 1 || ln > TET_LINES)
error("WTF");
bufstr_set(tet_line_buf, ln + TET_LINES * num_for_edict(self), vl);
-};
+}
string GetLine(float ln)
{
if(ln < 1 || ln > TET_LINES)
return TET_EMPTY_LINE;
return bufstr_get(tet_line_buf, ln + TET_LINES * num_for_edict(self));
-};
+}
float GetXBlock(float x, string dat)
{
if(x < 1 || x > TET_WIDTH)
error("WTF");
return stof(substring(dat, x-1, 1));
-};
+}
string SetXBlock(float x, string dat, float new)
{
ftos(new),
substring(dat, x, -1)
);
-};
+}
float GetSquare(float x, float y)
{
return GetXBlock(x, GetLine(y));
-};
+}
void SetSquare(float x, float y, float val)
{
dat = GetLine(y);
dat = SetXBlock(x, dat, val);
SetLine(y, dat);
-};
+}
float PieceColor(float pc)
{
return !!(ce_y & pow(4, x-1)); // second row
else
return 0; // illegal parms
-};
+}
vector tet_piecemins;
vector tet_piecemaxs;
void PieceMinsMaxs(float rot, float pc)
tet_piecemins_y = 1;
tet_piecemaxs_y = sz_y;
}
- //print(sprintf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs));
+ //printf("ce%v sz%v mi%v ma%v\n", ce, sz, tet_piecemins, tet_piecemaxs);
if (rot == 1) // 90 degrees
{
t = tet_piecemins_y;
float pnum(float num, float dig)
{
- local float f, i;
+ float f, i;
if (num < 0)
{
WriteChar(MSG_ONE, 173);
}
WriteChar(MSG_ONE, 176 + num);
return dig;
-};
+}
void DrawLine(float ln)
{
self.piece_type = 0;
self.next_piece = self.tet_lines = self.tet_score = 0;
self.tet_piece_bucket = 0;
-};
+}
void Tet_GameExit()
{
self.tet_vs_id = 0;
ResetTetris();
self.movetype = MOVETYPE_WALK;
-};
+}
void PrintField()
{
s = BastetSearch(buf, pc, x, y+1, rot, move_bias + 2); if(s > sm) sm = s;
if(s < 0)
{
- //print(sprintf("MAY CEMENT AT: %d %d %d\n", x, y, rot));
+ //printf("MAY CEMENT AT: %d %d %d\n", x, y, rot);
// moving down did not work - that means we can fixate the block here
t1 = gettime(GETTIME_HIRES);
b = buf_create(); bastet_piece[6] = 7; bastet_score[6] = BastetSearch(b, 7, TET_START_PIECE_POS_x, 1+TET_START_PIECE_POS_y, TET_START_PIECE_POS_y, TET_WIDTH) + 100 * random() + bastet_piecetime[6]; buf_del(b);
var float t2 = gettime(GETTIME_HIRES);
- dprint(sprintf("Time taken: %.6f seconds (of this, ev = %.2f%%, cm = %.2f%%)\n", t2 - t1, 100 * bastet_profile_evaluate_time / (t2 - t1), 100 * bastet_profile_checkmetrics_time / (t2 - t1)));
+ dprintf("Time taken: %.6f seconds (of this, ev = %.2f%%, cm = %.2f%%)\n", t2 - t1, 100 * bastet_profile_evaluate_time / (t2 - t1), 100 * bastet_profile_checkmetrics_time / (t2 - t1));
// sort
float i, j, k, p, s;
/*
for(i = 0; i < 7; ++i)
{
- print(sprintf("piece %s value = %d\n", substring("OJLIZST", bastet_piece[i]-1, 1), bastet_score[i]));
+ printf("piece %s value = %d\n", substring("OJLIZST", bastet_piece[i]-1, 1), bastet_score[i]);
}
*/
self.tet_piece_bucket = b;
return p + 1;
}
-};
+}
void TetAddScore(float n)
{
self.tet_score = self.tet_score + n * Tetris_Level();
if (self.tet_score > tet_high_score)
tet_high_score = self.tet_score;
-};
+}
float CheckMetrics(float piece, float orgx, float orgy, float rot) /*FIXDECL*/
{
// check to see if the piece, if moved to the locations will overlap
}
}
-float LINE_LOW = 349525;
-float LINE_HIGH = 699050; // above number times 2
+const float LINE_LOW = 349525;
+const float LINE_HIGH = 699050; // above number times 2
void AddLines(float n)
{
tetsnd("tetline");
else
tetsnd("tetland");
-};
+}
void HandleGame(float keyss)
{
return;
}
CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z);
-};
+}
/*
*********************************
Tet_GameExit();
self.impulse = 0;
}
-};
+}
float TetrisPreFrame()
else
self.tet_drawtime = time + 0.5;
return 1;
-};
+}
float frik_anglemoda(float v)
{
return v - floor(v/360) * 360;
-};
+}
float angcompa(float y1, float y2)
{
y1 = frik_anglemoda(y1);
y2 = frik_anglemoda(y2);
- local float answer;
+ float answer;
answer = y1 - y2;
if (answer > 180)
answer = answer - 360;
else if (answer < -180)
answer = answer + 360;
return answer;
-};
+}
.float tetkey_down, tetkey_rotright, tetkey_left, tetkey_right, tetkey_rotleft, tetkey_drop;
}
return 1;
-};
+}
#else
-FTEQCC_YOU_SUCK_THIS_IS_NOT_UNREFERENCED(autocvar_g_bastet);
+float TetrisPostFrame()
+{
+ if (autocvar_g_bastet)
+ {
+ cvar_set("g_bastet", "0");
+ print("The useless cvar has been toggled.\n");
+ }
+ return 0;
+}
#endif