提交 d8fe6235 编写于 作者: 饶先宏's avatar 饶先宏

202107160641

上级 ec34ab25
......@@ -26,11 +26,7 @@ typedef struct tagTerrisBlock
}TerrisBlock;
#define MAXSPPED 2000
static int gameScore = 0;
static int currentspeed = MAXSPPED;
static int gameLevel = 0;
static int currenttick = 0;
static TerrisBlock currentblock, nextblock;
static int terrisGenNewBlock(TerrisBlock * pBlock);
......
......@@ -33,6 +33,7 @@
* teris_ctrl.c
修改记录:
202106201016: rxh, initial version
202107160614: rxh, macro version
*/
#include "stdlib.h"
#include "stdio.h"
......@@ -42,7 +43,6 @@
#include "bignumber.h"
#include "hdl4secell.h"
#include "terris.h"
#include "terrisengine1.h"
/*
0: input wClk,
......@@ -53,14 +53,373 @@
5: output[31:0] bScore,
6: output[31:0] bSpeed,
7: output[31:0] bLevel,
8: output [63:0] bNextBlock,
8: output [63:0] bNextblock,
9: output [63:0] bCurBlock;
10: output [15:0] bCurBlockPos;
11: input [31:0] bResult
11: input [63:0] bNewNextBlock
11: input [63:0] bNewNextblock
*/
enum TERRIS_KEY {
TK_LEFT,
TK_DOWN,
TK_RIGHT,
TK_TURNLEFT,
TK_TURNRIGHT
};
#define PANELWIDTH XCOUNT
#define PANELHEIGHT YCOUNT
#define PANELGAP 0
#define BLOCKSIZE 4
typedef struct tagTerrisBlock
{
int posx, posy;
unsigned long subblock[BLOCKSIZE][BLOCKSIZE];
}TerrisBlock;
#define MAXSPPED 2000
static void terrisBlockRotate(TerrisBlock* pBlock, int dir)
{
/*dir 0:顺时针,否则,逆时针*/
int i, j;
unsigned long paneltemp[BLOCKSIZE][BLOCKSIZE];
for (i = 0; i < BLOCKSIZE; i++)
for (j = 0; j < BLOCKSIZE; j++)
{
if (dir == 0)
paneltemp[i][j] = pBlock->subblock[BLOCKSIZE - 1 - j][i];
else
paneltemp[i][j] = pBlock->subblock[j][BLOCKSIZE - 1 - i];
}
memcpy(pBlock->subblock, paneltemp, sizeof(paneltemp));
}
#if 1
#include "hdl4se_macros.h"
#define M_ID(id) terrisctrl1##id
#define terrisctrl1_MODULE_VERSION_STRING "0.4.0-20210716.0614 Terris Controller V1 module macro version"
#define terrisctrl1_MODULE_CLSID CLSID_TERRISCTRL1
HDL4SE_IDLIST
VID(wClk),
VID(nwReset),
VID(bKeyData),
VID(wStateComplete),
VID(bState),
VID(bScore),
VID(bSpeed),
VID(bLevel),
VID(bNextBlock),
VID(bCurBlock),
VID(bCurBlockPos),
VID(bResult),
VID(bNewNextBlock)
END_HDL4SE_IDLIST
MODULE_DECLARE(terrisctrl1)
int testx, testy, testparam, testid;
int startline;
int checklinecount;
int gameScore;
int currentspeed;
int gameLevel;
int currenttick;
int key;
int lastkey;
int state;
int state_reg;
TerrisBlock currentblock, nextblock;
END_MODULE_DECLARE(terrisctrl1)
DEFINE_FUNC(terrisctrl1Setup)
pobj->state_reg = pobj->state;
pobj->lastkey = pobj->key;
END_DEFINE_FUNC
static void terrisctrl1_hdl4se_unit_PressKeyPro(MODULE_DATA_TYPE* pobj, int result)
{
switch (pobj->testparam)//blockCanSetToContext.param)
{
case TK_LEFT:/*left*/
if (result)
pobj->currentblock.posx--;
break;
case TK_DOWN:/*down*/
break;
case TK_RIGHT:/*right*/
if (result)
pobj->currentblock.posx++;
break;
case TK_TURNLEFT:/*逆时针1*/
if (result == 0)
terrisBlockRotate(&pobj->currentblock, 0);
break;
case TK_TURNRIGHT:/*顺时针0*/
if (result == 0)
terrisBlockRotate(&pobj->currentblock, 1);
break;
}
pobj->state = ST_FLUSHTODISP;
}
static void terrisctrl1_hdl4se_unit_AfterCheckLine(MODULE_DATA_TYPE* pobj, int result)
{
if (result == 0) {
pobj->state = ST_INIT;
}
else {
pobj->state = ST_GENBLOCK;
}
}
static void terrisctrl1_hdl4se_unit_MoveDownPro(MODULE_DATA_TYPE* pobj, int result)
{
if (result)
{
pobj->currentblock.posy++;
pobj->state = ST_FLUSHTODISP;
}
else {
pobj->state = ST_BLOCKWRITE;
}
return;
}
static int terrisctrl1_hdl4se_unit_MoveDown(MODULE_DATA_TYPE* pobj)
{
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy + 1;
pobj->testparam = 0;
pobj->testid = 0;
pobj->state = ST_CHECKBLOCKCANSETTO;
return 0;
}
static int terrisctrl1_hdl4se_unit_Tick(MODULE_DATA_TYPE* pobj)
{
pobj->currenttick++;
if ((pobj->currenttick % pobj->currentspeed) == 0)
{
terrisctrl1_hdl4se_unit_MoveDown(pobj);
return 1;
}
return 0;
}
static void terrisctrl1_hdl4se_unit_PressKeyStart(MODULE_DATA_TYPE* pobj, int key)
{
pobj->currenttick = 0;
if (pobj->gameScore == 0 && (key == TK_LEFT || key == TK_RIGHT || key == TK_TURNLEFT || key == TK_TURNRIGHT)) {
pobj->state = ST_INIT;
}
else {
pobj->state = ST_CHECKBLOCKCANSETTO;
switch (key)
{
case TK_LEFT:/*left*/
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
pobj->testx = pobj->currentblock.posx - 1;
pobj->testy = pobj->currentblock.posy;
break;
case TK_DOWN:/*down*/
pobj->gameScore += 2;
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy + 1;
pobj->testparam = key;
pobj->testid = 0;
terrisctrl1_hdl4se_unit_MoveDown(pobj);
break;
case TK_RIGHT:/*right*/
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
pobj->testx = pobj->currentblock.posx + 1;
pobj->testy = pobj->currentblock.posy;
break;
case TK_TURNLEFT:/*逆时针1*/
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
terrisBlockRotate(&pobj->currentblock, 1);
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy;
break;
case TK_TURNRIGHT:/*顺时针0*/
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
terrisBlockRotate(&pobj->currentblock, 0);
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy;
break;
}
}
}
DEFINE_FUNC(terrisctrl1ClkTick) {
unsigned int statecomplete;
statecomplete = VREAD_U32(wStateComplete);
if (pobj->state == ST_INIT) {
pobj->currentspeed = MAXSPPED;
pobj->currenttick = 0;
pobj->gameScore = 200;
pobj->gameLevel = 0;
if (statecomplete != 0)
pobj->state = ST_GENBLOCK;
}
else if (pobj->state == ST_GENBLOCK) {
if (statecomplete != 0) {
unsigned long long data;
int i, j;
data = VREAD_U64(bNewNextBlock);
for (i = 0; i < BLOCKSIZE; i++) {
for (j = 0; j < BLOCKSIZE; j++) {
pobj->nextblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE - 1 - j] = data & 0xf;
data >>= 4;
}
}
pobj->state = ST_FLUSHTODISP;
}
}
else if (pobj->state == ST_FLUSHTODISP) {
int curblockinvalid = 1;
int i, j;
for (i = 0; i < BLOCKSIZE; i++) {
for (j = 0; j < BLOCKSIZE; j++) {
if (pobj->currentblock.subblock[i][j] != 0)
curblockinvalid = 0;
}
}
if (curblockinvalid) {
memcpy(pobj->currentblock.subblock, pobj->nextblock.subblock, sizeof(pobj->currentblock.subblock));
pobj->currentblock.posx = PANELWIDTH / 2;
pobj->currentblock.posy = 0;
pobj->state = ST_GENBLOCK;
}
else {
if (statecomplete != 0)
pobj->state = ST_CHECKKEY;
}
}
else if (pobj->state == ST_CHECKKEY) {
pobj->key = VREAD_U32(bKeyData);
if (pobj->key != pobj->lastkey)
{
pobj->lastkey = pobj->key;
if (pobj->key & 1)
terrisctrl1_hdl4se_unit_PressKeyStart(pobj, TK_RIGHT);
if (pobj->key & 2)
terrisctrl1_hdl4se_unit_PressKeyStart(pobj, TK_LEFT);
if (pobj->key & 4)
terrisctrl1_hdl4se_unit_PressKeyStart(pobj, TK_DOWN);
if (pobj->key & 8)
terrisctrl1_hdl4se_unit_PressKeyStart(pobj, TK_TURNLEFT);
}
else if (pobj->key == 0) {
terrisctrl1_hdl4se_unit_Tick(pobj);
}
}
else if (pobj->state == ST_CHECKBLOCKCANSETTO) {
if (statecomplete) {
int result = VREAD_U32(bResult);
if (pobj->testid == 0) {
terrisctrl1_hdl4se_unit_MoveDownPro(pobj, result);
}
else if (pobj->testid == 1) {
terrisctrl1_hdl4se_unit_PressKeyPro(pobj, result);
}
else {
terrisctrl1_hdl4se_unit_AfterCheckLine(pobj, result);
}
}
}
else if (pobj->state == ST_BLOCKWRITE) {
if (statecomplete != 0) {
pobj->state = ST_CHECKLINE;
pobj->checklinecount = 0;
}
}
else if (pobj->state == ST_CHECKLINE) {
if (statecomplete != 0) {
pobj->startline = VREAD_U32(bResult);
if (pobj->startline < YCOUNT) {
pobj->state = ST_COPYLINES;
pobj->checklinecount++;
}
else {
pobj->gameLevel += pobj->checklinecount;
if (pobj->checklinecount == 1)
pobj->gameScore += 10;
if (pobj->checklinecount == 2)
pobj->gameScore += 40;
if (pobj->checklinecount == 3)
pobj->gameScore += 160;
if (pobj->checklinecount == 4)
pobj->gameScore += 640;
pobj->currentspeed = MAXSPPED - pobj->gameScore / 3;
if (pobj->currentspeed < 1)
pobj->currentspeed = 1;
memcpy(&pobj->currentblock, &pobj->nextblock, sizeof(pobj->currentblock));
pobj->currentblock.posx = PANELWIDTH / 2;
pobj->currentblock.posy = 0;
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy;
pobj->testid = 2;
pobj->state = ST_CHECKBLOCKCANSETTO;
}
}
}
else if (pobj->state == ST_COPYLINES) {
if (statecomplete != 0) {
pobj->state = ST_CHECKLINE;
}
}
else {
pobj->state = ST_INIT;
}
} END_DEFINE_FUNC
MODULE_INIT(terrisctrl1)
PORT_IN(wClk, 1);
PORT_IN(nwReset, 1);
PORT_IN(bKeyData, 32);
PORT_IN(wStateComplete, 1);
PORT_OUT(bState, 4);
PORT_OUT(bScore, 32);
PORT_OUT(bSpeed, 32);
PORT_OUT(bLevel, 32);
PORT_OUT(bNextBlock, 64);
PORT_OUT(bCurBlock, 64);
PORT_OUT(bCurBlockPos, 16);
PORT_IN(bResult, 32);
PORT_IN(bNewNextBlock, 64);
pobj->state = ST_INIT;
memset(&pobj->currentblock, 0, sizeof(TerrisBlock));
memset(&pobj->nextblock, 0, sizeof(TerrisBlock));
SETUP_FUNC(terrisctrl1Setup);
CLKTICK_FUNC(terrisctrl1ClkTick);
END_MODULE_INIT(terrisctrl1)
MODULE_DEINIT(terrisctrl1)
END_MODULE_DEINIT(terrisctrl1)
#else
#define INPUTPORTCOUNT 5
struct _sTerrisCtrl1;
......@@ -82,6 +441,12 @@ struct _sTerrisCtrl1 {
int startline;
int checklinecount;
int gameScore;
int currentspeed;
int gameLevel;
int currenttick;
TerrisBlock currentblock, nextblock;
int key;
int lastkey;
......@@ -113,6 +478,7 @@ static int terrisctrl1Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
pobj = (sTerrisCtrl1*)malloc(sizeof(sTerrisCtrl1));
if (pobj == NULL)
return -1;
memset(pobj, 0, sizeof(sTerrisCtrl1));
*pObject = 0;
HDL4SEUNIT_VARINIT(pobj, CLSID_TERRISCTRL1);
INTERFACE_INIT(IHDL4SEUnit, pobj, terrisctrl1, hdl4se_unit);
......@@ -134,7 +500,7 @@ static int terrisctrl1Create(const PARAMITEM* pParams, int paramcount, HOBJECT*
pobj->name = strdup(pParams[i].pvalue);
}
else if (pParams[i].name == PARAMID_HDL4SE_UNIT_PARENT) {
pobj->parent = (IHDL4SEModule **)pParams[i].pvalue;
pobj->parent = (IHDL4SEModuleVar *)pParams[i].pvalue;
}
}
pobj->state = ST_INIT;
......@@ -192,27 +558,26 @@ static int terrisctrl1_hdl4se_unit_ConnectInput(HOBJECT object, int index, HOBJE
CONNECTPORT(2, 1); /* bKeyData */
CONNECTPORT(3, 2); /* wStateComplete */
CONNECTPORT(11, 3); /* bResult */
CONNECTPORT(12, 4); /* bNewNextBlock */
CONNECTPORT(12, 4); /* bNewpobj->nextblock */
return 0;
}
static int terrisctrl1_hdl4se_unit_GetValue(HOBJECT object, int index, int width, IBigNumber ** value)
{
int i;
sTerrisCtrl1* pobj;
pobj = (sTerrisCtrl1*)objectThis(object);
if (index == 4) {
objectCall1(value, AssignUint32, pobj->state_reg);
}
else if (index == 5) {
objectCall1(value, AssignUint32, gameScore);
objectCall1(value, AssignUint32, pobj->gameScore);
}
else if (index == 6) {
objectCall1(value, AssignUint32, MAXSPPED - currentspeed);
objectCall1(value, AssignUint32, MAXSPPED - pobj->currentspeed);
}
else if (index == 7) {
objectCall1(value, AssignUint32, gameLevel);
objectCall1(value, AssignUint32, pobj->gameLevel);
}
else if (index == 8) {
unsigned long long data;
......@@ -221,7 +586,7 @@ static int terrisctrl1_hdl4se_unit_GetValue(HOBJECT object, int index, int width
for (i = 0; i < BLOCKSIZE; i++) {
for (j = 0; j < BLOCKSIZE; j++) {
data <<= 4;
data |= nextblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE-1-j] & 0xf;
data |= pobj->nextblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE-1-j] & 0xf;
}
}
objectCall1(value, AssignUint64, data);
......@@ -233,7 +598,7 @@ static int terrisctrl1_hdl4se_unit_GetValue(HOBJECT object, int index, int width
for (i = 0; i < BLOCKSIZE; i++) {
for (j = 0; j < BLOCKSIZE; j++) {
data <<= 4;
data |= currentblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE - 1 - j] & 0xf;
data |= pobj->currentblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE - 1 - j] & 0xf;
}
}
objectCall1(value, AssignUint64, data);
......@@ -246,7 +611,7 @@ static int terrisctrl1_hdl4se_unit_GetValue(HOBJECT object, int index, int width
objectCall1(value, AssignUint32, pobj->startline);
}
else {
objectCall1(value, AssignUint32, ((currentblock.posx + 1) & 0xff) | (((YCOUNT + 1 - currentblock.posy) & 0xff) << 8));
objectCall1(value, AssignUint32, ((pobj->currentblock.posx + 1) & 0xff) | (((YCOUNT + 1 - pobj->currentblock.posy) & 0xff) << 8));
}
}
return 0;
......@@ -258,21 +623,21 @@ static void terrisctrl1_hdl4se_unit_PressKeyPro(sTerrisCtrl1* pobj, int result)
{
case TK_LEFT:/*left*/
if (result)
currentblock.posx--;
pobj->currentblock.posx--;
break;
case TK_DOWN:/*down*/
break;
case TK_RIGHT:/*right*/
if (result)
currentblock.posx++;
pobj->currentblock.posx++;
break;
case TK_TURNLEFT:/*逆时针1*/
if (result == 0)
terrisBlockRotate(&currentblock, 0);
terrisBlockRotate(&pobj->currentblock, 0);
break;
case TK_TURNRIGHT:/*顺时针0*/
if (result == 0)
terrisBlockRotate(&currentblock, 1);
terrisBlockRotate(&pobj->currentblock, 1);
break;
}
pobj->state = ST_FLUSHTODISP;
......@@ -292,7 +657,7 @@ static void terrisctrl1_hdl4se_unit_MoveDownPro(sTerrisCtrl1* pobj, int result)
{
if (result)
{
currentblock.posy++;
pobj->currentblock.posy++;
pobj->state = ST_FLUSHTODISP;
}
else {
......@@ -303,8 +668,8 @@ static void terrisctrl1_hdl4se_unit_MoveDownPro(sTerrisCtrl1* pobj, int result)
static int terrisctrl1_hdl4se_unit_MoveDown(sTerrisCtrl1* pobj)
{
pobj->testx = currentblock.posx;
pobj->testy = currentblock.posy + 1;
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy + 1;
pobj->testparam = 0;
pobj->testid = 0;
pobj->state = ST_CHECKBLOCKCANSETTO;
......@@ -313,8 +678,8 @@ static int terrisctrl1_hdl4se_unit_MoveDown(sTerrisCtrl1* pobj)
static int terrisctrl1_hdl4se_unit_Tick(sTerrisCtrl1* pobj)
{
currenttick++;
if ((currenttick % currentspeed) == 0)
pobj->currenttick++;
if ((pobj->currenttick % pobj->currentspeed) == 0)
{
terrisctrl1_hdl4se_unit_MoveDown(pobj);
return 1;
......@@ -325,8 +690,8 @@ static int terrisctrl1_hdl4se_unit_Tick(sTerrisCtrl1* pobj)
static void terrisctrl1_hdl4se_unit_PressKeyStart(sTerrisCtrl1* pobj, int key)
{
currenttick = 0;
if (gameScore == 0 && (key == TK_LEFT || key == TK_RIGHT || key == TK_TURNLEFT || key == TK_TURNRIGHT)) {
pobj->currenttick = 0;
if (pobj->gameScore == 0 && (key == TK_LEFT || key == TK_RIGHT || key == TK_TURNLEFT || key == TK_TURNRIGHT)) {
pobj->state = ST_INIT;
}
else {
......@@ -334,42 +699,42 @@ static void terrisctrl1_hdl4se_unit_PressKeyStart(sTerrisCtrl1* pobj, int key)
switch (key)
{
case TK_LEFT:/*left*/
gameScore--;
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
pobj->testx = currentblock.posx - 1;
pobj->testy = currentblock.posy;
pobj->testx = pobj->currentblock.posx - 1;
pobj->testy = pobj->currentblock.posy;
break;
case TK_DOWN:/*down*/
gameScore += 2;
pobj->testx = currentblock.posx;
pobj->testy = currentblock.posy + 1;
pobj->gameScore += 2;
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy + 1;
pobj->testparam = key;
pobj->testid = 0;
terrisctrl1_hdl4se_unit_MoveDown(pobj);
break;
case TK_RIGHT:/*right*/
gameScore--;
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
pobj->testx = currentblock.posx + 1;
pobj->testy = currentblock.posy;
pobj->testx = pobj->currentblock.posx + 1;
pobj->testy = pobj->currentblock.posy;
break;
case TK_TURNLEFT:/*逆时针1*/
gameScore--;
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
terrisBlockRotate(&currentblock, 1);
pobj->testx = currentblock.posx;
pobj->testy = currentblock.posy;
terrisBlockRotate(&pobj->currentblock, 1);
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy;
break;
case TK_TURNRIGHT:/*顺时针0*/
gameScore--;
pobj->gameScore--;
pobj->testparam = key;
pobj->testid = 1;
terrisBlockRotate(&currentblock, 0);
pobj->testx = currentblock.posx;
pobj->testy = currentblock.posy;
terrisBlockRotate(&pobj->currentblock, 0);
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy;
break;
}
}
......@@ -386,10 +751,10 @@ static int terrisctrl1_hdl4se_unit_ClkTick(HOBJECT object)
if (pobj->state == ST_INIT) {
objectCall3(pobj->input_unit[2], GetValue, pobj->input_index[2], 32, pobj->inputdata);
objectCall1(pobj->inputdata, GetUint32, &statecomplete);
currentspeed = MAXSPPED;
currenttick = 0;
gameScore = 200;
gameLevel = 0;
pobj->currentspeed = MAXSPPED;
pobj->currenttick = 0;
pobj->gameScore = 200;
pobj->gameLevel = 0;
if (statecomplete != 0)
pobj->state = ST_GENBLOCK;
}
......@@ -403,7 +768,7 @@ static int terrisctrl1_hdl4se_unit_ClkTick(HOBJECT object)
objectCall1(pobj->inputdata, GetUint64, &data);
for (i = 0; i < BLOCKSIZE; i++) {
for (j = 0; j < BLOCKSIZE; j++) {
nextblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE - 1 - j] = data & 0xf;
pobj->nextblock.subblock[BLOCKSIZE - 1 - i][BLOCKSIZE - 1 - j] = data & 0xf;
data >>= 4;
}
}
......@@ -415,14 +780,14 @@ static int terrisctrl1_hdl4se_unit_ClkTick(HOBJECT object)
int i, j;
for (i = 0; i < BLOCKSIZE; i++) {
for (j = 0; j < BLOCKSIZE; j++) {
if (currentblock.subblock[i][j] != 0)
if (pobj->currentblock.subblock[i][j] != 0)
curblockinvalid = 0;
}
}
if (curblockinvalid) {
memcpy(currentblock.subblock, nextblock.subblock, sizeof(currentblock.subblock));
currentblock.posx = PANELWIDTH / 2;
currentblock.posy = 0;
memcpy(pobj->currentblock.subblock, pobj->nextblock.subblock, sizeof(pobj->currentblock.subblock));
pobj->currentblock.posx = PANELWIDTH / 2;
pobj->currentblock.posy = 0;
pobj->state = ST_GENBLOCK;
}
else {
......@@ -487,24 +852,24 @@ static int terrisctrl1_hdl4se_unit_ClkTick(HOBJECT object)
pobj->state = ST_COPYLINES;
pobj->checklinecount++;
} else {
gameLevel += pobj->checklinecount;
pobj->gameLevel += pobj->checklinecount;
if (pobj->checklinecount == 1)
gameScore += 10;
pobj->gameScore += 10;
if (pobj->checklinecount == 2)
gameScore += 40;
pobj->gameScore += 40;
if (pobj->checklinecount == 3)
gameScore += 160;
pobj->gameScore += 160;
if (pobj->checklinecount == 4)
gameScore += 640;
currentspeed = MAXSPPED - gameScore / 3;
if (currentspeed < 1)
currentspeed = 1;
memcpy(&currentblock, &nextblock, sizeof(currentblock));
currentblock.posx = PANELWIDTH / 2;
currentblock.posy = 0;
pobj->testx = currentblock.posx;
pobj->testy = currentblock.posy;
pobj->gameScore += 640;
pobj->currentspeed = MAXSPPED - pobj->gameScore / 3;
if (pobj->currentspeed < 1)
pobj->currentspeed = 1;
memcpy(&pobj->currentblock, &pobj->nextblock, sizeof(pobj->currentblock));
pobj->currentblock.posx = PANELWIDTH / 2;
pobj->currentblock.posy = 0;
pobj->testx = pobj->currentblock.posx;
pobj->testy = pobj->currentblock.posy;
pobj->testid = 2;
pobj->state = ST_CHECKBLOCKCANSETTO;
}
......@@ -533,3 +898,4 @@ static int terrisctrl1_hdl4se_unit_Setup(HOBJECT object)
return 0;
}
#endif
\ No newline at end of file
......@@ -79,7 +79,7 @@ endmodule
/* 俄罗斯方块控制器V1 */
(*
//HDL4SE="LCOM",
HDL4SE="LCOM",
CLSID="158fa52-ca8b-4551-9b87-fc7cff466e2a",
softmodule="hdl4se"
*)
......
......@@ -622,6 +622,7 @@ endmodule
(*
HDL4SE = "LCOM",
CLSID = "158fa52-ca8b-4551-9b87-fc7cff466e2a",
softmodule = "hdl4se"
*)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册