コード例 #1
0
ファイル: New File.c プロジェクト: bcherry/bcherry
void _main(void) {
  GrayOn();
  clrscr();
  GraySprite16_XOR_R(8, 8, 16, ball_C0, ball_C1, GetPlane(0), GetPlane(1));
  ngetchx();
  GrayOff();
}
コード例 #2
0
 void DiPlaneColliderControllerObj::InitPropertyTable()
 {
     InitBasePropertyTable();
     
     DiPropertyGroup* g = DI_NEW DiPropertyGroup("Plane Collider");
     
     g->AddProperty("Normal", DI_NEW DiVec3Property([&](){ return GetPlane()->GetNormal(); },
                                                    [&](DiVec3& val){ GetPlane()->SetNormal(val);}));
     g->CreateUI();
     
     mPropGroups.push_back(g);
     
 }
コード例 #3
0
/**
**  Define a plane.
**
**  @param l  Lua state.
*/
static int CclDefinePlane(lua_State *l)
{
	LuaCheckArgs(l, 2);
	if (!lua_istable(l, 2)) {
		LuaError(l, "incorrect argument (expected table)");
	}

	std::string plane_name = LuaToString(l, 1);
	CPlane *plane = GetPlane(plane_name);
	if (!plane) {
		plane = new CPlane;
		plane->Name = plane_name;
		plane->ID = Planes.size();
		Planes.push_back(plane);
	}
	
	//  Parse the list:
	for (lua_pushnil(l); lua_next(l, 2); lua_pop(l, 1)) {
		const char *value = LuaToString(l, -2);
		
		if (!strcmp(value, "Description")) {
			plane->Description = LuaToString(l, -1);
		} else if (!strcmp(value, "Background")) {
			plane->Background = LuaToString(l, -1);
		} else if (!strcmp(value, "Quote")) {
			plane->Quote = LuaToString(l, -1);
		} else {
			LuaError(l, "Unsupported tag: %s" _C_ value);
		}
	}
	
	return 0;
}
コード例 #4
0
ファイル: ListContour.cpp プロジェクト: BRAT-DEV/main
void CListContour::DumpPlane( size_t iPlane ) const
{
    CLineStripList::const_iterator pos;
    size_t i;
    CLineStrip* pStrip;

    //assert__( iPlane >= 0 );
    assert__( iPlane < GetNPlanes() );
    LOG_TRACEstd( "Level : " + n2s( GetPlane( iPlane ) ) );

    LOG_TRACEstd( "Number of strips : " + n2s( m_vStripLists[iPlane].size() ) + "\r\n" );
    LOG_TRACE("i np start end xstart ystart xend yend\r\n");
    for ( pos = m_vStripLists[iPlane].begin(), i=0; pos != m_vStripLists[iPlane].end(); pos++, i++ )
    {
        pStrip=*pos;
        assert__( pStrip );
        LOG_TRACEstd(
            n2s( i ) + " " +
            n2s( pStrip->size() ) + " " +
            n2s( pStrip->front() ) + " " +
            n2s( pStrip->back() ) + " " +
            n2s( GetXi( pStrip->front() ) ) + " " +
            n2s( GetYi( pStrip->front() ) ) + " " +
            n2s( GetXi( pStrip->back() ) ) + " " +
            n2s( GetYi( pStrip->back() ) ) + "\r\n"
        );
    }
}
コード例 #5
0
static errcode GetObject(FILE * dfile, SceneHandle scene) {
  char objtype[80];
 
  fscanf(dfile, "%s", objtype);
  if (!stringcmp(objtype, "END_SCENE")) {
    return PARSEEOF; /* end parsing */
  }
  if (!stringcmp(objtype, "TEXDEF")) {
    return GetTexDef(dfile);
  }	
  if (!stringcmp(objtype, "TEXALIAS")) {
    return GetTexAlias(dfile);
  }
  if (!stringcmp(objtype, "BACKGROUND")) {
    return GetBackGnd(dfile);
  }
  if (!stringcmp(objtype, "CYLINDER")) {
    return GetCylinder(dfile);
  }
  if (!stringcmp(objtype, "FCYLINDER")) {
    return GetFCylinder(dfile);
  }
  if (!stringcmp(objtype, "POLYCYLINDER")) {
    return GetPolyCylinder(dfile);
  }
  if (!stringcmp(objtype, "SPHERE")) {
    return GetSphere(dfile);
  }
  if (!stringcmp(objtype, "PLANE")) {
    return GetPlane(dfile);
  }
  if (!stringcmp(objtype, "RING")) {
    return GetRing(dfile);
  }
  if (!stringcmp(objtype, "BOX")) {
    return GetBox(dfile);
  }
  if (!stringcmp(objtype, "SCALARVOL")) {
    return GetVol(dfile);
  }
  if (!stringcmp(objtype, "TRI")) {
    return GetTri(dfile);
  }
  if (!stringcmp(objtype, "STRI")) {
    return GetSTri(dfile);
  }
  if (!stringcmp(objtype, "LIGHT")) {
    return GetLight(dfile);
  }
  if (!stringcmp(objtype, "SCAPE")) {
    return GetLandScape(dfile);
  }
  if (!stringcmp(objtype, "TPOLYFILE")) {
    return GetTPolyFile(dfile);
  }

  fprintf(stderr, "Found bad token: %s expected an object type\n", objtype);
  return PARSEBADSYNTAX;
}
コード例 #6
0
ファイル: BackWall.cpp プロジェクト: ldw9981/Rendering
cBackWall::cBackWall()
{
	m_pVB=NULL; 
	m_pIB=NULL;
	m_pTexture=NULL;
	CreatePlane();
	GetPlane()->Make(D3DXVECTOR3(0.0f,0.0f,-1.0f),250);
}
コード例 #7
0
ファイル: blaster.c プロジェクト: bcherry/bcherry
// function that draws the title screen, in one or both planes
void drawTitle(int planes) {
    int x,y;
    int tilewidth  = 32;
    int tileheight = 32;
    int vcount     = 3;
    int hcount     = 5;
    int i;
    memset(GetPlane(0),0,LCD_SIZE);
    memset(GetPlane(1),0,LCD_SIZE);
    for (y=0; y<vcount; y++) {
        for (x=0; x<hcount; x++) {
            int offset = (y*hcount+x)*tileheight;
            for (i=0; i<planes; i++) {
                Sprite32(x*tilewidth,y*tileheight,tileheight,&title[i][offset],GetPlane(i),SPRT_OR);
            }
        }
    }
}
コード例 #8
0
ファイル: Frustum.cpp プロジェクト: chengzg/MathGeoLib
void Frustum::GetPlanes(Plane *outArray) const
{
	assume(outArray);
#ifndef MATH_ENABLE_INSECURE_OPTIMIZATIONS
	if (!outArray)
		return;
#endif
	for(int i = 0; i < 6; ++i)
		outArray[i] = GetPlane(i);
}
コード例 #9
0
ファイル: triangle.cpp プロジェクト: rohit-n/Eldritch
bool Triangle::Contains( const Vector& p ) const
{
    // If p isn't in plane of triangle, it can't be contained
    if( Abs( GetPlane().DistanceTo( p ) ) > EPSILON )
    {
        return false;
    }

    Vector a = m_Vec1 - p;
    Vector b = m_Vec2 - p;
    Vector c = m_Vec3 - p;

    Vector u = b.Cross( c );
    Vector v = c.Cross( a );

    if( u.Dot( v ) < 0.0f )
    {
        return false;
    }

    Vector w = a.Cross( b );

    if( u.Dot( w ) < 0.0f )
    {
        return false;
    }

    // NOTE: If point lies along the line of one of the triangle's edges,
    // the previous checks may not catch if it is outside the triangle.
    if( u.LengthSquared() < EPSILON )
    {
        if( b.Dot( c ) > 0.0f )
        {
            return false;
        }
    }

    if( v.LengthSquared() < EPSILON )
    {
        if( c.Dot( a ) > 0.0f )
        {
            return false;
        }
    }

    if( w.LengthSquared() < EPSILON )
    {
        if( a.Dot( b ) > 0.0f )
        {
            return false;
        }
    }

    return true;
}
コード例 #10
0
ファイル: test.c プロジェクト: bcherry/bcherry
void _main(void) {

   INT_HANDLER int1 = GetIntVec(AUTO_INT_1);
   INT_HANDLER int5 = GetIntVec(AUTO_INT_5);
   SetIntVec(AUTO_INT_1, DUMMY_HANDLER);
   SetIntVec(AUTO_INT_5, DUMMY_HANDLER);
   GrayOn();  ////  everything above is just magic, you need it but
//don't need to understand it.
   clrscr();

   Sprite8(0,0,8,square,GetPlane(0),SPRT_XOR);
   Sprite8(8,0,8,square,GetPlane(1),SPRT_XOR);
   Sprite8(16,0,8,square,GetPlane(0),SPRT_XOR);
   Sprite8(16,0,8,square,GetPlane(1),SPRT_XOR);

   while(!_keytest(RR_ENTER));

   GrayOff();
   SetIntVec(AUTO_INT_1, int1);
   SetIntVec(AUTO_INT_5, int5);

}
コード例 #11
0
/**
**  Define a world.
**
**  @param l  Lua state.
*/
static int CclDefineWorld(lua_State *l)
{
	LuaCheckArgs(l, 2);
	if (!lua_istable(l, 2)) {
		LuaError(l, "incorrect argument (expected table)");
	}

	std::string world_name = LuaToString(l, 1);
	CWorld *world = GetWorld(world_name);
	if (!world) {
		world = new CWorld;
		world->Name = world_name;
		world->ID = Worlds.size();
		Worlds.push_back(world);
	}
	
	//  Parse the list:
	for (lua_pushnil(l); lua_next(l, 2); lua_pop(l, 1)) {
		const char *value = LuaToString(l, -2);
		
		if (!strcmp(value, "Description")) {
			world->Description = LuaToString(l, -1);
		} else if (!strcmp(value, "Background")) {
			world->Background = LuaToString(l, -1);
		} else if (!strcmp(value, "Quote")) {
			world->Quote = LuaToString(l, -1);
		} else if (!strcmp(value, "BaseTerrain")) {
			int base_terrain_id = GetWorldMapTerrainTypeId(LuaToString(l, -1));
			if (base_terrain_id == -1) {
				LuaError(l, "Terrain doesn't exist.");
			}
			world->BaseTerrain = WorldMapTerrainTypes[base_terrain_id];
		} else if (!strcmp(value, "Plane")) {
			CPlane *plane = GetPlane(LuaToString(l, -1));
			if (!plane) {
				LuaError(l, "Plane doesn't exist.");
			}
			world->Plane = plane;
		} else {
			LuaError(l, "Unsupported tag: %s" _C_ value);
		}
	}
	
	return 0;
}
コード例 #12
0
ファイル: blaster.c プロジェクト: bcherry/bcherry
// function that draws the screen
void Draw_Map(int map_x_location, char map_array[12][MAP_SIZE], POSITION pos, POSITION laserPos, int laser, POSITION missilePos, int missile) {
    int x = map_x_location;
    int y = 0;

    // clear both planes
    SetPlane (LIGHT_PLANE);
    ClrScr();
    SetPlane (DARK_PLANE);
    ClrScr();

    // draw ship, and missiles and cannons if they exist
    drawShip(pos, map_x_location);
    if (laser) drawLaser(laserPos, map_x_location);
    if (missile == 1) drawMissile(missilePos, map_x_location);
    if (missile == -1) drawUpMissile(missilePos, map_x_location);

    // Well.. the map_x_location will keep track of where we are on the X-plane on the map array
    // This way we mask out the stuff in the array that we use.. So we will only read 20x12 elements of the
    // array (instead of MAP_SIZEx12 which it is at the moment.. )
    while (x < (map_x_location + 20)) {// Again, we can't view more than 20 blocks.. so.. don't calculate more than 20 blocks
        if ((map_array[y][x] == 1)) { // If the array at this location is equal to 1, place a broken piece
            Sprite8((x - map_x_location) * 8, y * 8, 8, broken2_dark, GetPlane (DARK_PLANE), SPRT_XOR);
            Sprite8((x - map_x_location) * 8, y * 8, 8, broken2_light, GetPlane (LIGHT_PLANE), SPRT_XOR);
        }
        if ((map_array[y][x] == 2)) { // If the array at this location is equal to 1, place a broken piece
            Sprite8((x - map_x_location) * 8, y * 8, 8, broken1_dark, GetPlane (DARK_PLANE), SPRT_XOR);
            Sprite8((x - map_x_location) * 8, y * 8, 8, broken1_light, GetPlane (LIGHT_PLANE), SPRT_XOR);
        }
        if ((map_array[y][x] == 3)) { // .. and if it's 2, place block1
            Sprite8((x - map_x_location) * 8, y * 8, 8, block1_dark, GetPlane (DARK_PLANE), SPRT_XOR);
            Sprite8((x - map_x_location) * 8, y * 8, 8, block1_light, GetPlane (LIGHT_PLANE), SPRT_XOR);
        }
        if ((map_array[y][x] == 4)) { // a 3 means the indestructible block
            Sprite8((x - map_x_location) * 8, y * 8, 8, solid1_light, GrayGetPlane(LIGHT_PLANE), SPRT_XOR);
            Sprite8((x - map_x_location) * 8, y * 8, 8, solid1_dark, GrayGetPlane(LIGHT_PLANE), SPRT_XOR);
            Sprite8((x - map_x_location) * 8, y * 8, 8, solid1_mid, GrayGetPlane(DARK_PLANE), SPRT_XOR);
            Sprite8((x - map_x_location) * 8, y * 8, 8, solid1_dark, GrayGetPlane(DARK_PLANE), SPRT_XOR);
        }
        y++; // Now.. we're increasing the Y value.. note that i'm drawing the world from LEFT to RIGHT
        // I've seen people who draw their world TOP to DOWN or otherwise, but i found LEFT to RIGHT
        // is the best way to draw the world..
        if (y > 11) { // We've reached the limit.. restore the Y value, and move 1 block row forward..
            y = 0;
            x++;
        }
    }
}
コード例 #13
0
/**
**  Get plane data.
**
**  @param l  Lua state.
*/
static int CclGetPlaneData(lua_State *l)
{
	if (lua_gettop(l) < 2) {
		LuaError(l, "incorrect argument");
	}
	std::string plane_name = LuaToString(l, 1);
	CPlane *plane = GetPlane(plane_name);
	if (!plane) {
		LuaError(l, "Plane \"%s\" doesn't exist." _C_ plane_name.c_str());
	}
	const char *data = LuaToString(l, 2);

	if (!strcmp(data, "Name")) {
		lua_pushstring(l, plane->Name.c_str());
		return 1;
	} else if (!strcmp(data, "Description")) {
		lua_pushstring(l, plane->Description.c_str());
		return 1;
	} else if (!strcmp(data, "Background")) {
		lua_pushstring(l, plane->Background.c_str());
		return 1;
	} else if (!strcmp(data, "Quote")) {
		lua_pushstring(l, plane->Quote.c_str());
		return 1;
	} else if (!strcmp(data, "Species")) {
		lua_createtable(l, plane->Species.size(), 0);
		for (size_t i = 1; i <= plane->Species.size(); ++i)
		{
			lua_pushstring(l, plane->Species[i-1]->Ident.c_str());
			lua_rawseti(l, -2, i);
		}
		return 1;
	} else {
		LuaError(l, "Invalid field: %s" _C_ data);
	}

	return 0;
}
コード例 #14
0
void YARPImageUtils::GetSaturation (const YARPImageOf<YarpPixelHSV>& in, YARPImageOf<YarpPixelMono>& out)
{
	GetPlane (in, out, 1);
}
コード例 #15
0
static errcode GetObject(parsehandle * ph, SceneHandle scene) {
  char objtype[256];
 
  if (fscanf(ph->ifp, "%s", objtype) == EOF) {
    return PARSEEOF;
  }
  if (!stringcmp(objtype, "TRI")) {
    return GetTri(ph, scene);
  }
  if (!stringcmp(objtype, "STRI")) {
    return GetSTri(ph, scene);
  }
  if (!stringcmp(objtype, "VCSTRI")) {
    return GetVCSTri(ph, scene);
  }
  if (!stringcmp(objtype, "SPHERE")) {
    return GetSphere(ph, scene);
  }
  if (!stringcmp(objtype, "FCYLINDER")) {
    return GetFCylinder(ph, scene);
  }
  if (!stringcmp(objtype, "RING")) {
    return GetRing(ph, scene);
  }
  if (!stringcmp(objtype, "POLYCYLINDER")) {
    return GetPolyCylinder(ph, scene);
  }
  if (!stringcmp(objtype, "CYLINDER")) {
    return GetCylinder(ph, scene);
  }
  if (!stringcmp(objtype, "PLANE")) {
    return GetPlane(ph, scene);
  }
  if (!stringcmp(objtype, "BOX")) {
    return GetBox(ph, scene);
  }
  if (!stringcmp(objtype, "SCALARVOL")) {
    return GetVol(ph, scene);
  }
  if (!stringcmp(objtype, "TEXDEF")) {
    return GetTexDef(ph, scene);
  }	
  if (!stringcmp(objtype, "TEXALIAS")) {
    return GetTexAlias(ph);
  }
  if (!stringcmp(objtype, "LIGHT")) {
    return GetLight(ph, scene);
  }
  if (!stringcmp(objtype, "DIRECTIONAL_LIGHT")) {
    return GetDirLight(ph, scene);
  }
  if (!stringcmp(objtype, "SPOTLIGHT")) {
    return GetSpotLight(ph, scene);
  }
  if (!stringcmp(objtype, "SCAPE")) {
    return GetLandScape(ph, scene);
  }
  if (!stringcmp(objtype, "CAMERA")) {
    return GetCamera(ph, scene);
  }
  if (!stringcmp(objtype, "TPOLYFILE")) {
    return GetTPolyFile(ph, scene);
  }
  if (!stringcmp(objtype, "MGFFILE")) {
#ifdef USELIBMGF
    return GetMGFFile(ph, scene);
#else
    printf("MGF File Parsing is not available in this build.\n");
    return PARSEBADSYNTAX;
#endif
  }
  if (!stringcmp(objtype, "#")) {
    int c;
    while (1) {
      c=fgetc(ph->ifp);
      if (c == EOF || c == '\n')    /* eat comment text */
        return PARSENOERR;
    } 
  }
  if (!stringcmp(objtype, "BACKGROUND")) {
    return GetBackGnd(ph, scene);
  }
  if (!stringcmp(objtype, "FOG")) {
    return GetFog(ph, scene);
  }
  if (!stringcmp(objtype, "INCLUDE")) {
    char includefile[FILENAME_MAX];
    fscanf(ph->ifp, "%s", includefile);
    return ReadIncludeFile(ph, includefile, scene);
  }
  if (!stringcmp(objtype, "START_CLIPGROUP")) {
    return GetClipGroup(ph, scene);
  }
  if (!stringcmp(objtype, "END_CLIPGROUP")) {
    return GetClipGroupEnd(ph, scene);
  }
  if (!stringcmp(objtype, "END_SCENE")) {
    return PARSEEOF; /* end parsing */
  }

  PrintSyntaxError(ph, "an object or other declaration", objtype);

  return PARSEBADSYNTAX;
}
コード例 #16
0
void YARPImageUtils::GetHue (const YARPImageOf<YarpPixelHSV>& in, YARPImageOf<YarpPixelMono>& out)
{
	GetPlane (in, out, 0);
}
コード例 #17
0
void Character::Control(GLdouble FrameInterval)
{
	GLdouble step = WALK_SPEED;
	if(bSpecial[GLUT_KEY_SHIFT_L])
		step *= SPRINT_KOEF;

	if(bKeyboard['W']) {
		dVelocityX -= FrameInterval*AIR_ACCEL*step*sin(TORAD(dSpinY));
		dVelocityZ -= FrameInterval*AIR_ACCEL*step*cos(TORAD(dSpinY));
	}
	if(bKeyboard['S']) {
		dVelocityX += FrameInterval*AIR_ACCEL*step*sin(TORAD(dSpinY));
		dVelocityZ += FrameInterval*AIR_ACCEL*step*cos(TORAD(dSpinY));
	}
	if(bKeyboard['D']) {
		dVelocityX += FrameInterval*AIR_ACCEL*step*cos(TORAD(dSpinY));
		dVelocityZ -= FrameInterval*AIR_ACCEL*step*sin(TORAD(dSpinY));
	}
	if(bKeyboard['A']) {
		dVelocityX -= FrameInterval*AIR_ACCEL*step*cos(TORAD(dSpinY));
		dVelocityZ += FrameInterval*AIR_ACCEL*step*sin(TORAD(dSpinY));
	}
	if(bKeyboard['R']) {
		dVelocityY += FrameInterval*AIR_ACCEL*step;
	}
	if(bKeyboard['F']) {
		dVelocityY -= FrameInterval*AIR_ACCEL*step;
	}

	GLdouble ko = dVelocityX*dVelocityX + dVelocityZ*dVelocityZ;
	if(ko > WALK_SPEED*WALK_SPEED*SPRINT_KOEF*SPRINT_KOEF) {
		ko = pow(ko, 0.5);
		dVelocityX = dVelocityX*WALK_SPEED*SPRINT_KOEF/ko;
		dVelocityZ = dVelocityZ*WALK_SPEED*SPRINT_KOEF/ko;
	}

	if(bKeyboard[VK_SPACE]) {
	}
	
	if(bKeyboard['X']) {
		dVelocityX = 0;
		dVelocityY = 0;
		dVelocityZ = 0;
	}
	
	GLdouble yerr, xerr, zerr;
	GetPlane(&xerr, &yerr, &zerr);
	
	PosInWorld pos;
	if(zerr < xerr && zerr < yerr) {
		if((position.bz < centerPos.bz && position.cz == centerPos.cz) || position.cz < centerPos.cz) {
			pos = PosInWorld(0, 0, 0.5);
		} else {
			pos = PosInWorld(0, 0, -0.5);
		}
	} else if(xerr < zerr && xerr < yerr) {
		if((position.bx < centerPos.bx && position.cx == centerPos.cx) || position.cx < centerPos.cx) {
			pos = PosInWorld(0.5, 0, 0);
		} else {
			pos = PosInWorld(-0.5, 0, 0);
		}
	} else if(yerr < xerr && yerr < zerr) {
		if(position.by < centerPos.by) {
			pos = PosInWorld(0, 0.5, 0);
		} else {
			pos = PosInWorld(0, -0.5, 0);
		}
	}
	aimedBlock = BlockInWorld(centerPos + pos);
	freeBlock = BlockInWorld(centerPos + pos.inv());

	int num = 100;
	int sq = 100;
	int sqb2 = sq/2;

	if(bKeyboard['1']) {
		int i = 0;
		while(i < num) {
			if(wWorld.AddBlock(BlockInWorld(rand()%sq-sqb2, abs(rand()%sq-sqb2), rand()%sq-sqb2), rand()%14+1, true))
				i++;
		}
	}
	if(bKeyboard['2']) {
		int i = 0;
		while(i < num) {
			if(wWorld.RemoveBlock(BlockInWorld(rand()%sq-sqb2, rand()%sq-sqb2, rand()%sq-sqb2), true))
				i++;
		}
	}

	if(bKeyboard['3']) {
		for(BlockCoord i = -sqb2; i <= sqb2; i++) {
			for(BlockCoord j = -sqb2; j <= sqb2; j++) {
				for(BlockCoord k = -sqb2; k <= sqb2; k++) {
					wWorld.RemoveBlock(BlockInWorld(i, j, k), true);
				}
			}
		}
	}

	if(bKeyboard['4']) {
		wWorld.LoadChunk(0, 0);
		bKeyboard['4'] = false;
	}
	if(bKeyboard['5']) {
		wWorld.UnLoadChunk(0, 0);
		bKeyboard['5'] = false;
	}
	if(bKeyboard['6']) {
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 8; j++)
				wWorld.LoadChunk(i, j);
		bKeyboard['6'] = false;
	}
	if(bKeyboard['7']) {
		for(int i = 0; i < 8; i++)
			for(int j = 0; j < 8; j++)
				wWorld.UnLoadChunk(i, j);
		bKeyboard['7'] = false;
	}

	if(bKeyboard['0']) {
		static Param par = {0, 1, &wWorld};

		_beginthread(LoadNGenerate, 0, &par);

		WaitForSingleObject(wWorld.parget2, INFINITE);
		ResetEvent(wWorld.parget2);

		par.z++;
		bKeyboard['0'] = false;
	}
	
	if(bKeyboard['C']) {
		Chunk *chunk;
		int index;
		wWorld.FindBlock(aimedBlock, &chunk, &index);
		if ((chunk)&&(chunk->bBlocks[index].cMaterial == MAT_DIRT)) {
			chunk->bBlocks[index].bVisible ^= (1 << SNOWCOVERED);
		}
	}
	if(bKeyboard['V']) {
		Chunk *chunk;
		int index;
		wWorld.FindBlock(aimedBlock, &chunk, &index);
		if ((chunk)&&(chunk->bBlocks[index].cMaterial == MAT_DIRT)) {
			chunk->bBlocks[index].bVisible ^= (1 << GRASSCOVERED);
		}
	}
	if(bKeyboard['E']) {
		wWorld.RemoveBlock(aimedBlock, true);
	}
	if(bKeyboard['Q']) {
		wWorld.AddBlock(freeBlock, MAT_PUMPKIN_SHINE, true);
	}
	if(bKeyboard['O']) {
		wWorld.SaveChunks();
	}

	position = position + PosInWorld(FrameInterval*dVelocityX, FrameInterval*dVelocityY, FrameInterval*dVelocityZ);

	/*{
		signed short xx, yy, zz;
		GLdouble wx = gfPosX + gfVelX;
		GLdouble wy = gfPosY - PLAYER_HEIGHT + 0.1;
		GLdouble wz = gfPosZ;

		xx = floor(wx/TILE_SIZE + 0.5);
		zz = floor(wz/TILE_SIZE + 0.5);
		yy = floor(wy/TILE_SIZE);

		if((FindTile(xx, yy, zz) == NULL)&&(FindTile(xx, yy + 1, zz) == NULL))
			gfPosX += g_FrameInterval*gfVelX;
		else gfVelX = 0;
	}
	{
		signed short xx, yy, zz;
		GLdouble wx = gfPosX;
		GLdouble wy = gfPosY - PLAYER_HEIGHT + 0.1;
		GLdouble wz = gfPosZ + gfVelZ;

		xx = floor(wx/TILE_SIZE + 0.5);
		zz = floor(wz/TILE_SIZE + 0.5);
		yy = floor(wy/TILE_SIZE);

		if((FindTile(xx, yy, zz) == NULL)&&(FindTile(xx, yy + 1, zz) == NULL))
			gfPosZ += g_FrameInterval*gfVelZ;
		else gfVelZ = 0;
	}
	*/
	/*if(falling)
	{
		gfPosY -= g_FrameInterval*gfVelY;
		if(gfVelY < MAX_DOWNSTEP)
			gfVelY += g_FrameInterval*STEP_DOWNSTEP;
	}*/
	/*
	{
		signed short xx, yy, zz;
		GLdouble wx = gfPosX;
		GLdouble wy = gfPosY - PLAYER_HEIGHT;
		GLdouble wz = gfPosZ;

		xx = floor(wx/TILE_SIZE + 0.5);
		zz = floor(wz/TILE_SIZE + 0.5);
		yy = floor(wy/TILE_SIZE);

		if(FindTile(xx, yy, zz) == NULL) falling = true;
		else
		{
			gfVelY = 0;
			if(falling)
			{
				falling = false;
				gfPosY = (yy + 1)*TILE_SIZE + PLAYER_HEIGHT - 0.001;
			}
		}
	}

	if(!falling)
	{
		gfVelX = 0;
		gfVelZ = 0;
	}*/
	//falling = 1;

// 	if(dPositionX >= LOCATION_SIZE_XZ*TILE_SIZE) { dPositionX -= LOCATION_SIZE_XZ*TILE_SIZE; lnwPositionX++;}
// 	if(dPositionX < 0) { dPositionX += LOCATION_SIZE_XZ*TILE_SIZE; lnwPositionX--;}
// 	if(dPositionZ >= LOCATION_SIZE_XZ*TILE_SIZE) { dPositionZ -= LOCATION_SIZE_XZ*TILE_SIZE; lnwPositionZ++;}
// 	if(dPositionZ < 0) { dPositionZ += LOCATION_SIZE_XZ*TILE_SIZE; lnwPositionZ--;}

}
コード例 #18
0
void YARPImageUtils::GetBlue (const YARPImageOf<YarpPixelRGB>& in, YARPImageOf<YarpPixelMono>& out)
{
	GetPlane (in, out, 2);
}
コード例 #19
0
void YARPImageUtils::GetGreen (const YARPImageOf<YarpPixelBGR>& in, YARPImageOf<YarpPixelMono>& out)
{
	GetPlane (in, out, 1);
}
コード例 #20
0
ファイル: shift.c プロジェクト: bcherry/bcherry
void Draw_Map(/*int map_array[12][20], */POSITION pos, POSITION laserPos, int laser, POSITION missilePos, int missile) {
	//int x = map_x_location;
	int x = 0;
	int y = 0;
	
	unsigned long int mask, position;

	SetPlane (LIGHT_PLANE);
	ClrScr ();

	SetPlane (DARK_PLANE);
	ClrScr ();
	
	drawRType(pos);
	if (laser) drawLaser(laserPos);
	if (missile) drawMissile(missilePos);
	
	for (y = 0; y < 12; y++) {
		position = map1[y];
		
		mask = 0x100000;
		
		for (x = 0; x < 20; x++) {
			mask >>= 1;
			
			if (position & mask) {
				Sprite8(x*8, y*8, 8, ground, GetPlane (DARK_PLANE), SPRT_XOR);
			Sprite8(x*8, y*8, 8, ground, GetPlane (LIGHT_PLANE), SPRT_XOR);
			}
		}
		
	}
	
	// Well.. the map_x_location will keep track of where we are on the X-plane on the map array
	// This way we mask out the stuff in the array that we use.. So we will only read 30x8 elements of the
	// array (instead of 60x8 which it is at the moment.. ).. This might sound unuseful, and it sort of is
	// with a small array as this one.. but i'm guessing you will create worlds that are much much bigger..
	// so.. to gain more speed.. we mask it out ;)

	/*while (x<20) {// Again, we can't view more than 30 blocks.. so.. don't calculate more than 30 blocks 
		if ((map_array[y][x]==7)) { // If the array at this location is equal to 1, place a ground piece
			Sprite8(x*8, y*8, 8, ground_down, GetPlane (DARK_PLANE), SPRT_XOR);
			Sprite8(x*8, y*8, 8, ground_down, GetPlane (LIGHT_PLANE), SPRT_XOR);
		}
		if ((map_array[y][x]==8)) { // .. and if it's 2, place block1
			Sprite8(x*8, y*8, 8, ground_flat, GetPlane (DARK_PLANE), SPRT_XOR);
			Sprite8(x*8, y*8, 8, ground_flat, GetPlane (LIGHT_PLANE), SPRT_XOR);
		}
		if (map_array[y][x]==9) {
			Sprite8(x*8, y+8, 8, ground_up, GrayGetPlane(LIGHT_PLANE), SPRT_XOR);
			Sprite8(x*8, y+8, 8, ground_up, GrayGetPlane(DARK_PLANE), SPRT_XOR);
		}
		y++; // Now.. we're increasing the Y value.. note that i'm drawing the world from LEFT to RIGHT
				// I've seen people who draw their world TOP to DOWN or otherwise, but i found LEFT to RIGHT
		 	 // is the best way to draw the world..
		if (y>11) { // We've reached the limit.. restore the Y value, and move 1 block row forward..
			y=0;
			x++;
		} 
	}*/
	
	/*for (x = 0; x <= 19; x++) {
		for (y = 0; y <= 11; y++) {
			if (map_array[y][x] == 7) {
				Sprite8(x*8, y*8, 8, ground_down, GrayGetPlane(DARK_PLANE), SPRT_XOR);
				Sprite8(x*8, y*8, 8, ground_down, GrayGetPlane(LIGHT_PLANE), SPRT_XOR);
			}	else if (map_array[y][x] == 8) {
				Sprite8(x*8, y*8, 8, ground_flat, GrayGetPlane(DARK_PLANE), SPRT_XOR);
				Sprite8(x*8, y*8, 8, ground_flat, GrayGetPlane(LIGHT_PLANE), SPRT_XOR);
			} else if (map_array[y][x] == 9) {
				Sprite8(x*8, y*8, 8, ground_up, GrayGetPlane(DARK_PLANE), SPRT_XOR);
				Sprite8(x*8, y*8, 8, ground_up, GrayGetPlane(LIGHT_PLANE), SPRT_XOR);
			}
		}
	}	*/
}