Exemple #1
0
/////////////////////////////////////////////////////////////////////////////
// look for longest road
/////////////////////////////////////////////////////////////////////////////
int CGLView::longestRoad(int iPlayer)
{
	int i, j;
	int iOwner;
	BOOL bRoad = FALSE;
	BOOL bShip;

	//see if anyone else has longest road
	iOwner = longestPlayer();

	//search each tile and side for a road that belongs to this player
	for(i = 0; i < m_nTiles; i++)
	{
		for(j = 0; j < 6; j++)
		{
			//skip already done sides
			if(m_pBoard[i].getSide(j) < i) continue;

			//set the ship variable
			bShip = (m_pBoard[i].getShip(j) == iPlayer);

			//see if this tile and corner has a road of this player's
			if((m_pBoard[i].getRoad(j) == iPlayer) || (TRUE == bShip))
			{
				if(longestIterateStart(i, j, iPlayer, iOwner, bShip))
				{
					bRoad = TRUE;
				}
			}
		}
	}

	//they don't have it
	if(!bRoad)
	{
		return -3;
	}

	//see if the person already has longest road
	if(iOwner == iPlayer)
	{
		//already has longest road
		return -2;
	}

	//play sound
	SOUND(SOUND_LONGEST_ROAD);

	//see if they're the first one to get it
	if(iOwner == -1)
	{
		return -1;
	}

	//otherwise, they stole it
	return iOwner;
}
Exemple #2
0
void simulatorReset(Cpu_t *cpu)
{
	uint8_t n;
	for(n=0;n<M_SIZE;n++)cpu->M[n]=0xF; // memory reset value is 0xF
	cpu->Pc=0;
	cpu->flag=0;
	cpu->leds=0;
	SOUND(0,100);
}
Exemple #3
0
 ///----------------------------------------------------------------------------//
 ///--------------------- UPDATE SECTION ---------------------------------------//
 ///----------------------------------------------------------------------------//
 Scene::Enum update(float) override {
     //want to rate
     if (BUTTON(boutonContainer[0])->clicked) {
         SOUND(boutonContainer[0])->sound = theSoundSystem.loadSoundFile("audio/son_menu.ogg");
         game->gameThreadContext->communicationAPI->rateItNow();
         return Scene::ModeMenu;
     //will rate later
     } else if(BUTTON(boutonContainer[1])->clicked){
         SOUND(boutonContainer[1])->sound = theSoundSystem.loadSoundFile("audio/son_menu.ogg");
         game->gameThreadContext->communicationAPI->rateItLater();
         return Scene::ModeMenu;
     //won't never rate
     } else if(BUTTON(boutonContainer[2])->clicked){
         SOUND(boutonContainer[2])->sound = theSoundSystem.loadSoundFile("audio/son_menu.ogg");
         game->gameThreadContext->communicationAPI->rateItNever();
         return Scene::ModeMenu;
     }
     return Scene::RateIt;
 }
Exemple #4
0
void warning_beep(double *beep_speed)
{
  
   unsigned   freq; 
   if((*beep_speed)>=15 || (*beep_speed)<=-15)
   {
		for(freq=80;freq<230;freq+=30)
		{ 
			SOUND(freq); 
			delay(20); 
			NOSOUND(); 
		} 
		for(   ;   freq> 80;     freq   -=30) 
		{ 
			SOUND(freq); 
			delay(20); 
			NOSOUND(); 
		} 
	}
}
Exemple #5
0
void game_slave(void)
{
	game.mode = 3;

init:
	game_init();
	tft_setZoom(2);
	RECTANGLE(GAME_S);
	STRING(GAME_S_STR);
	STRING(GAME_S_ORIE);

get:
	switch (ROE_get()) {
	case ROE_SW1:
	case ROE_SW2:
		SOUND(SOUND_CONF);
		while (ROE_get() != ROE_N);
		tft_setOrient(tft_getOrient() + 1);
		goto init;
	}
	switch (connect_read()) {
	case CONN_LEFT:
		connect_put(CONN_READY);
		game.mode = 2;
		goto init;
	case CONN_DETECT:
	case CONN_RIGHT:
		connect_put(CONN_READY);
		game.mode = 3;
		goto init;
	case CONN_START:
		box.dx = connect_get();
		connect_put(CONN_READY);
		box.dy = (box.dx >> 1) & 0x01;
		box.dx &= 0x01;
		box.e = 0;
		RECTANGLE_CLEAN(GAME_S);
		box_show(GAME_BGC);
		return;
	case CONN_SOUND:
		sound_freq(connect_get16());
	}
	goto get;
}
Exemple #6
0
static int process_cmd (const char *line)
{
    RESULT[0] = '\0';
    if      (matchstr (&line, "EJECT"))        return EJECT (line);
    else if (matchstr (&line, "INSERT"))       return INSERT (line);
    else if (matchstr (&line, "QUERY"))        return QUERY (line);
    else if (matchstr (&line, "FEEDBACK"))     return FEEDBACK (line);
    else if (matchstr (&line, "VERSION"))      return GET_VERSION (line);
    else if (matchstr (&line, "BYE"))          QUIT ();
    else if (matchstr (&line, "QUIT"))         QUIT ();
    else if (matchstr (&line, "DEBUG"))        return DEBUG ();
    else if (matchstr (&line, "RESET"))        m68k_reset (0);
    else if (matchstr (&line, "DISPLAY"))      return DISPLAY (line);
    else if (matchstr (&line, "FRAMERATE"))    return FRAMERATE( line);
    else if (matchstr (&line, "FAKEJOYSTICK")) return FAKEJOYSTICK (line);
    else if (matchstr (&line, "SOUND"))        return SOUND (line);
    else if (matchstr (&line, "UAEEXE"))       return UAEEXE (line);
    else return RC_ERROR;
    return RC_OK;
}
    ///----------------------------------------------------------------------------//
    ///--------------------- UPDATE SECTION ---------------------------------------//
    ///----------------------------------------------------------------------------//
    Scene::Enum update(float dt) override {
        Entity animLogo = e(HASH("logo/logo_anim", 0xed78c546));

        if (timeAccum > 0.8 + 0.05 + 0.25 + 0.05) {
            RENDERING(animLogo)->show = false;
            return Scene::Menu;
        } else if (timeAccum > 0.8 + 0.05 + 0.25) {
            RENDERING(animLogo)->texture = theRenderingSystem.loadTextureFile("soupe_logo2_365_331");
        }
        else if (timeAccum > 0.8 + 0.05) {
            if (!soundPlayed) {
                SOUND(animLogo)->sound = theSoundSystem.loadSoundFile("sounds/logo_blink.ogg");
                soundPlayed = true;
            }
            RENDERING(animLogo)->texture = theRenderingSystem.loadTextureFile("soupe_logo3_365_331");
        }
        else if (timeAccum > 0.8) {
            RENDERING(animLogo)->show = true;
        }

        timeAccum += dt;
        return Scene::Logo;
    }
Exemple #8
0
	{ "MUS_E1M6", 0 }, // 4-1
	{ "MUS_TITL", 0 },
	{ "MUS_INTR", 0 },
	{ "MUS_CPTD", 0 }
};
*/

// Sound info

#define SOUND(name, priority, numchannels, pitchshift) \
    { name, "", priority, NULL, pitchshift, 0, -1, 0, numchannels, NULL }

sfxinfo_t S_sfx[] = {
    // tagname, lumpname, priority, usefulness, snd_ptr, lumpnum, numchannels,
    //              pitchshift
    SOUND("", 0, 0, 0),
    SOUND("PlayerFighterNormalDeath", 256, 2, 1),
    SOUND("PlayerFighterCrazyDeath", 256, 2, 1),
    SOUND("PlayerFighterExtreme1Death", 256, 2, 1),
    SOUND("PlayerFighterExtreme2Death", 256, 2, 1),
    SOUND("PlayerFighterExtreme3Death", 256, 2, 1),
    SOUND("PlayerFighterBurnDeath", 256, 2, 1),
    SOUND("PlayerClericNormalDeath", 256, 2, 1),
    SOUND("PlayerClericCrazyDeath", 256, 2, 1),
    SOUND("PlayerClericExtreme1Death", 256, 2, 1),
    SOUND("PlayerClericExtreme2Death", 256, 2, 1),
    SOUND("PlayerClericExtreme3Death", 256, 2, 1),
    SOUND("PlayerClericBurnDeath", 256, 2, 1),
    SOUND("PlayerMageNormalDeath", 256, 2, 0),
    SOUND("PlayerMageCrazyDeath", 256, 2, 0),
    SOUND("PlayerMageExtreme1Death", 256, 2, 0),
Exemple #9
0
uint8_t game_master(void)
{
	uint8_t index = 0;
	game.mode = 2;

init:
	game_init();
	tft_setZoom(2);
	RECTANGLE(GAME_M);
	STRING(GAME_M_STR);

list:
	SELECTION(index == 0, GAME_M_ORIE, GAME_M);
	SELECTION(index == 1, GAME_M_LEFT, GAME_M);
	SELECTION(index == 2, GAME_M_RIGHT, GAME_M);

get:
	switch (ROE_get()) {
	case ROE_SW1:
	case ROE_SW2:
		SOUND(SOUND_CONF);
		while (ROE_get() != ROE_N);
		goto enter;
	case ROE_CW1:
	case ROE_CW2:
		SOUND(SOUND_SELECT);
		if (index == 2)
			index = 0;
		else
			index++;
refresh:
		if (index == 1 && game.mode == 3) {
			game.mode = 2;
			connect_put(CONN_RIGHT);
			if (connect_get() != CONN_READY)
				goto clean;
			goto init;
		} else if (index == 2 && game.mode == 2) {
			game.mode = 3;
			connect_put(CONN_LEFT);
			if (connect_get() != CONN_READY)
				goto clean;
			goto init;
		}
		goto list;
	case ROE_CCW1:
	case ROE_CCW2:
		SOUND(SOUND_SELECT);
		if (index == 0)
			index = 2;
		else
			index--;
		goto refresh;
	}
	if (connect_read() == CONN_SOUND)
		sound_freq(connect_get16());
	goto get;

enter:
	if (index == 0) {
		tft_setOrient(tft_getOrient() + 1);
		goto init;
	}
	connect_put(CONN_START);
	connect_put(box.dy << 1 | box.dx);
	if (connect_get() != CONN_READY)
		goto clean;
	RECTANGLE_CLEAN(GAME_M);
	box_show(GAME_BGC);
	return 1;

clean:
	tft_fill(GAME_BGC);
	return 0;
}
Exemple #10
0
// Sound info

	/* Macro for original heretic sfxinfo_t 
#define SOUND(name, priority, numchannels) \
	{ name, NULL, priority, -1, NULL, 0, numchannels }
#define SOUND_LINK(name, link_id, priority, numchannels) \
	{ name, &S_sfx[link_id], priority, -1, NULL, 0, numchannels }
	*/

#define SOUND(name, priority, numchannels) \
	{ NULL, name, priority, NULL, -1, -1, -1, 0, numchannels, NULL }
#define SOUND_LINK(name, link_id, priority, numchannels) \
	{ NULL, name, priority, &S_sfx[link_id], 0, 0, -1, 0, numchannels, NULL }

sfxinfo_t S_sfx[] = {
	SOUND("",        0,   0),
	SOUND("gldhit",  32,  2),
	SOUND("gntful",  32,  -1),
	SOUND("gnthit",  32,  -1),
	SOUND("gntpow",  32,  -1),
	SOUND("gntact",  32,  -1),
	SOUND("gntuse",  32,  -1),
	SOUND("phosht",  32,  2),
	SOUND("phohit",  32,  -1),
	SOUND_LINK("-phopow", sfx_hedat1, 32, 1),
	SOUND("lobsht",  20,  2),
	SOUND("lobhit",  20,  2),
	SOUND("lobpow",  20,  2),
	SOUND("hrnsht",  32,  2),
	SOUND("hrnhit",  32,  2),
	SOUND("hrnpow",  32,  2),
Exemple #11
0
void executeVm(Cpu_t *cpu)
{
	uint8_t temp;
	uint8_t command;
	//SYSTEMOUTHEX("adr",cpu->Pc);
	//SYSTEMOUTHEX("flag",cpu->flag);
	command=cpu->M[cpu->Pc];
	cpu->Pc++;
	switch(command)
	{
		// KA 	K->Ar 	 0, 1 	The pressed key from the hex keypad is saved to the A register.
		// If a key is not pressed, the Flag is set to 1, otherwise it is 0.
		case KA:{
		  DISASM("KA   ");
		  if(KEYHIT())
          {
            cpu->M[AR]=GETKEY();
            cpu->flag=0;
            SYSTEMOUTHEX("Key:",cpu->M[AR]);
          }else {
            SYSTEMOUT("nokey");
            cpu->flag=1;
          }
		}break;
		// AO 	Ar->Op 		1 	The 7-segment readout displays the value currently contained in the A register.
		case AO:{
			DISASM("AO   ");
			//show7Segment(cpu->M[AR]);
			DISPLAYOUTHEX(cpu->M[AR]);
			 //PRINT7SEGMENT(x);
			cpu->flag=1;
		}break;
		// CH 	Ar<=>Br
        // Yr<=>Zr 	1 	Exchange the contents of the A and B registers, and the Y and Z registers.
		case CH:{
			DISASM("CH   ");

			temp=cpu->M[AR];
			cpu->M[AR]=cpu->M[BR];
			cpu->M[BR]=temp;
			temp=cpu->M[YR];
			cpu->M[YR]=cpu->M[ZR];
			cpu->M[ZR]=temp;
			cpu->flag=1;
		}break;
		// CY 	Ar<=>Yr 	1 	Exchange the contents of the A and Y registers.
		case CY:{
			DISASM("CY   ");

			temp=cpu->M[AR];
			cpu->M[AR]=cpu->M[YR];
			cpu->M[YR]=temp;
			cpu->flag=1;
		}break;
		// AM 	Ar->M 		1 	Write the contents of the A register to data memory (memory address is 50 + Y register).
		case AM:{
			DISASM("AM   ");

			cpu->M[((cpu->M[YR])&0xF)+M_OFFSET]=cpu->M[AR];
			cpu->flag=1;
		}break;
		// MA 	M->Ar 		1 	Write the contents of data memory (50 + Y register) to the A register.
		case MA:{
			DISASM("MA   ");

			cpu->M[AR]=cpu->M[((cpu->M[YR])&0xF)+M_OFFSET];
			cpu->flag=1;
		}break;
		// M+ 	M+Ar->Ar 	0, 1 	Add the contents of data memory (50 + Y register) to the A register. If there is overflow, the Flag is set to 1, otherwise 0.
		case MPLUS:{
			DISASM("M+   ");

			cpu->M[AR]+=cpu->M[((cpu->M[YR])&0xF)+M_OFFSET];
			if(((cpu->M[AR])&0x10)!=0)cpu->flag=1;
			else cpu->flag=0;
			cpu->M[AR]&=0x0F;
		}break;
		// M- 	M-Ar->Ar 	0, 1 	Subtract the contents of data memory (50 + Y register) from the A register. If the result is negative, the Flag is set to 1, otherwise 0.
		case MMINUS:{
			DISASM("M-   ");

			cpu->M[AR]-=cpu->M[((cpu->M[YR])&0xF)+M_OFFSET];
			if(((cpu->M[AR])&0x10)!=0)cpu->flag=1;
			else cpu->flag=0;
			cpu->M[AR]&=0x0F;
		}break;
		// TIA [ ] 	[ ] -> Ar 	1 	Transfer immediate to the A register.
		case TIA:{
			DISASM("TIA  ");

			cpu->M[AR]=cpu->M[cpu->Pc];
			cpu->Pc++;
			cpu->flag=1;
		}break;
		// AIA [ ] 	Ar + [ ] -> Ar 	0, 1 	Add immediate to the A register. If there is overflow, the Flag is set to 1, otherwise 0.
		case AIA:{
			DISASM("AIA  ");

			cpu->M[AR]+=cpu->M[cpu->Pc];
			if(((cpu->M[AR])&0x10)!=0)cpu->flag=1;
			else cpu->flag=0;
			cpu->M[AR]&=0x0F;
			cpu->Pc++;
		}break;
		// TIY [ ] 	[ ] -> Yr 	1 	Transfer immediate to the Y register.
		case TIY:{
			DISASM("TIA  ");

			cpu->M[YR]=cpu->M[cpu->Pc];
			cpu->Pc++;
			cpu->flag=1;
		}break;
		// AIY [ ] 	Yr + [ ] -> Yr 	0, 1 	Add immediate to the Y register. If there is overflow, the Flag is set to 1, otherwise 0.
		case AIY:{
			DISASM("AIY  ");

			cpu->M[YR]+=cpu->M[cpu->Pc];
			if(((cpu->M[YR])&0x10)!=0)cpu->flag=1;
			else cpu->flag=0;
			cpu->M[YR]&=0x0F;
			cpu->Pc++;
		}break;
		// CIA [ ] 	Ar != [ ] ? 	0, 1 	Compare immediate to the A register. If equal, Flag reset to 0, otherwise set to 1.
		case CIA:{
			DISASM("CIA  ");

			if(cpu->M[AR]!=cpu->M[cpu->Pc])cpu->flag=0;
			else cpu->flag=1;
			cpu->Pc++;
		}break;
		// CIY [ ] 	Yr != [ ] ? 	0, 1 	Compare immediate to the Y register. If equal, Flag reset to 0, otherwise set to 1.
		case CIY:{
			DISASM("CIY  ");

			if(cpu->M[YR]!=cpu->M[cpu->Pc])cpu->flag=0;
			else cpu->flag=1;
			cpu->Pc++;
		}break;
		//JUMP [ ] [ ] 		1 	Jump to the immediate address if the Flag is 1, otherwise just increment the program counter.
		//The Flag is then set to 1. Note that this is an absolute address. That is, JUMP [0] [2] will change the address pointer to hex address 0x02.
		//You can jump both forward and backward in program space.
		case JUMP:{
			DISASM("JUMP ");

			if((cpu->flag)==1)
			{
				temp=cpu->M[cpu->Pc]<<4;
				cpu->Pc++;
				temp+=cpu->M[cpu->Pc]<<4;
				cpu->Pc=temp;
			}else{
				cpu->Pc++;
				cpu->flag=1;
			}
		}break;
		//      --- 	--- 	--- 	Extended code. See table below.
		case EXTENDED:{
			command=(cpu->M[cpu->Pc])|0xE0;
			SYSTEMOUTHEX("com:",command);
			cpu->Pc++;
			if(cpu->flag==1)switch(command)
			{
				case CAL_RSTO:{
					DISASM("CAL_RSTO  ");
					SYSTEMOUTCHAR(' ');
					//SYSTEMOUT("clear 7 seg");
				}break;
				case CAL_SETR:{
					DISASM("CAL_SETR  ");
					cpu->leds|=(1<<(cpu->M[YR]));
					SHOWLEDS(cpu->leds);
					//SYSTEMOUT("led on");
				}break;
				case CAL_RSTR:{
					DISASM("CAL_RSTR  ");
                    cpu->leds&=~(1<<(cpu->M[YR]));
                    SHOWLEDS(cpu->leds);
					//SYSTEMOUT("led off");
				}break;
				// 0xE4 // 	CAL CMPL 	1 	Complement the A register (1 <=> 0).
				case CAL_CMPL:{
					DISASM("CAL_CMPL  ");

					cpu->M[AR]=(~cpu->M[AR])&0x0F;
					cpu->flag=1;
				}break;
				//0xE5 // 	CAL CHNG 	1 	Swap the A/B/Y/Z registers with A'/B'/Y'/Z'
				case CAL_CHNG:{
					DISASM("CAL_CHNG  ");

					temp=cpu->M[AR];
					cpu->M[AR]=cpu->M[AR_];
					cpu->M[AR_]=temp;

					temp=cpu->M[BR];
					cpu->M[BR]=cpu->M[BR_];
					cpu->M[BR_]=temp;

					temp=cpu->M[YR];
					cpu->M[YR]=cpu->M[YR_];
					cpu->M[YR_]=temp;

					temp=cpu->M[ZR];
					cpu->M[ZR]=cpu->M[ZR_];
					cpu->M[ZR_]=temp;

					cpu->flag=1;

				}break;
				// 0xE6 //	CAL SIFT 	0, 1 	Shift the A register right 1 bit. If the starting value is even (bit 0 = 0), set the Flag to 1, otherwise 0.
				case CAL_SIFT:{
					DISASM("CAL_SIFT  ");

					if((cpu->M[AR])&1)cpu->flag=1;
					else cpu->flag=0;
					cpu->M[AR]=(~cpu->M[AR])>>1;
				}break;
				//0xE7 //	CAL ENDS 	1 	Play the End sound.
				case CAL_ENDS:{
					DISASM("CAL_ENDS  ");
					SOUND(NOTE_D6,80);
					SOUND(NOTE_E6,80);
					SOUND(NOTE_F6,80);
					SOUND(NOTE_G6,80);
					SOUND(NOTE_A6,80);
					SOUND(NOTE_B6,80);
				    //soundf(0);
					//SOUND(440,500);
					SYSTEMOUT("end sound");
					cpu->flag=1;
				}break;
				//0xE8 //	CAL ERRS 	1 	Play the Error sound.
				case CAL_ERRS:{
					DISASM("CAL_ERRS  ");
				    for(int n = 0; n < 6; n++)
				    {
				        SOUND(NOTE_G5,20);
				        SOUND(NOTE_A5,20);
				        SOUND(NOTE_B5,20);
				        SOUND(NOTE_C6,20);
				        SOUND(NOTE_D6,20);
				        SOUND(NOTE_E6,20);
				    }
					//SOUND(200,500);
					SYSTEMOUT("play error sound");
					cpu->flag=1;
				}break;
				//0xE9 //	CAL SHTS 	1 	Play a short "pi" sound.
				case CAL_SHTS:{
					DISASM("CAL_SHTS  ");
					SOUND(NOTE_C5,150);
					SYSTEMOUT("play short peep sound");
					cpu->flag=1;
				}break;
				//0xEA //	CAL LONS 	1 	Play a longer "pi-" sound.
				case CAL_LONS:{
					DISASM("CAL_LONS  ");
					SOUND(NOTE_C5,450);
					SYSTEMOUT("play longer peep sound");
					cpu->flag=1;
				}break;
				//0xEB //	CAL SUND 	1 	Play a note based on the value of the A register
				//(allowed values are 1 - E).
				case CAL_SUND:{

					DISASM("CAL_SUND  ");
					//SOUND(cpu->M[AR],500);
					gmcSound(cpu->M[AR],300);

					SYSTEMOUT("play A reg");
					cpu->flag=1;
				}break;
				//0xEC // 	CAL TIMR 	1
				//Pause for the time calculated by (value of A register +1) * 0.1 seconds.
				case CAL_TIMR:{
					DISASM("CAL_TIMR  ");

					showMatrix(((cpu->M[AR])*100+1));

					cpu->flag=1;
				}break;

				//0xED //	CAL DSPR 	1 	Set the 2-pin LEDs with the value from data memory. The data to display is as follows: the upper three bits come from memory address 5F (bits 0-2), and the lower four from memory address 5E (bits 0-3).
				case CAL_DSPR:{
					DISASM("CAL_DSPR  ");

					SYSTEMOUT("set LED");
					cpu->flag=1;
				}break;
				//0xEE // 	CAL DEM- 	1
				//Subtract the value of the A register from the value in data memory.
				//The new value is stored in data memory as a decimal.
				//Afterwards, the Y register is decremented by 1.
				case CAL_DEMMINUS:{
					DISASM("CAL_DEM-  ");

					//SYSTEMOUT("dem-");
					cpu->M[YR]=cpu->M[YR]-cpu->M[AR];
					cpu->M[YR]++;
					cpu->M[YR]&=0xF;
					cpu->flag=1;
				}break;

				//0xEF //	CAL DEM+ 	1
				//Add the value of the A register to the value in data memory.
				//The new value is stored in memory as a decimal.
				//If the result is overflow, data memory will be automatically adjusted.
				//Afterwards, the Y register is decremented.
				case CAL_DEMPLUS:{
					DISASM("CAL_DEM+  ");

					cpu->M[YR]=cpu->M[YR]+cpu->M[AR];
					cpu->M[YR]--;
					cpu->M[YR]&=0xF;
					cpu->flag=1;
				}break;
			}
		}break;

	}
}