Exemplo n.º 1
0
// This method is called from the scheduler once every five
// minutes.  It will generate random new creatures.
int Creature::CREGEN()
{
	// Update Task's next_time
	scheduler.TCBLND[Scheduler::TID_CRTREGEN].next_time = 
		scheduler.curTime +
		scheduler.TCBLND[Scheduler::TID_CRTREGEN].frequency;

	int X = CMXPTR;
	dodBYTE B = CTYPES - 1;
	dodBYTE A = 0;
	do
	{
		A += CMXLND[X + B];
		--B;
	} while (B != 255);
	if (A < 32)
	{
		A = rng.RANDOM();
		if (g_cheats&CHEAT_REGEN_SCALING) {
			switch (game.LEVEL) {
			case 0:
				A %= 4; 
				break;
			case 1:
				A %= 5; 
				A += 1;
				break;
			case 2:
				A %= 6; 
				A += 1;
				break;
			case 3:
				A %= 7; 
				A += 2;
				break;
			case 4:
				A %= 7; 
				A += 3;
				break;
			}
		}
		else {
			A &= 7;
			A += 2;
		}
		++CMXLND[X + A];
	}
	return 0;
}
Exemplo n.º 2
0
// Creates a new creature and places it in the maze
void Creature::CBIRTH(dodBYTE typ)
{
	int			u, maz_idx;
	RowCol		rndcell;
	dodBYTE		rw, cl;
	int			TCBindex;

	u = -1;
	do
	{
		++u;
	} while (CCBLND[u].P_CCUSE != 0);
	--CCBLND[u].P_CCUSE;

	CCBLND[u].creature_id = typ;
	CCBLND[u].P_CCPOW = CDBTAB[typ].P_CDPOW;
	CCBLND[u].P_CCMGO = CDBTAB[typ].P_CDMGO;
	CCBLND[u].P_CCMGD = CDBTAB[typ].P_CDMGD;
	CCBLND[u].P_CCPHO = CDBTAB[typ].P_CDPHO;
	CCBLND[u].P_CCPHD = CDBTAB[typ].P_CDPHD;
	CCBLND[u].P_CCTMV = CDBTAB[typ].P_CDTMV;
	CCBLND[u].P_CCTAT = CDBTAB[typ].P_CDTAT;

	do
	{
		do
		{
			cl = (rng.RANDOM() & 31);
			rw = (rng.RANDOM() & 31);
			//printf("          %02X, %02X = %02X\n", rw, cl, dungeon.MAZLND[dungeon.RC2IDX(rw, cl)]);
			rndcell.setRC(rw, cl);
			maz_idx = dungeon.RC2IDX(rw, cl);
		} while (dungeon.MAZLND[maz_idx] == 0xFF);
	} while (CFIND(rw, cl) == false);
	
	//printf("----- %02X: %02X, %02X -----\n", typ, rw, cl);
	CCBLND[u].P_CCROW = rw;
	CCBLND[u].P_CCCOL = cl;

	TCBindex = scheduler.GETTCB();
	scheduler.TCBLND[TCBindex].data = u;
	scheduler.TCBLND[TCBindex].type = Scheduler::TID_CRTMOVE;
	scheduler.TCBLND[TCBindex].frequency = CCBLND[u].P_CCTMV;
}