Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- oid lcars_RenderViewScreen(void){
- char i;
- int vWidth = 228, vHeight = 173;
- gfx_SetClipRegion(xStart, yStart, xStart+vWidth, yStart+vHeight);
- for( i = 0; i <= (sizeof(MapData)/sizeof(MapObject_t)); i++){
- MapObject_t *object = &MapData[i];
- if( object->type == OBJ_SHIP || object->type == OBJ_PROJ ){
- float delta_x = object->Position.coords[0] - PlayerData->Position.coords[0];
- float delta_y = object->Position.coords[1] - PlayerData->Position.coords[1];
- float delta_z = object->Position.coords[2] - PlayerData->Position.coords[2];
- Relativity_t data = GetOffsets(delta_x, delta_y, delta_z);
- if( data.distance <= VISUAL_RANGE ){
- unsigned char diffXZ, diffY;
- diffXZ = data.xzOffset - PlayerData->Position.angles[0];
- if( diffXZ > 128 ) diffXZ = 256 - diffXZ;
- diffY = data.yOffset - PlayerData->Position.angles[1];
- if( diffY > 128 ) diffY = 256 - diffY;
- if( (diffXZ <= 45) && (diffY <= 45) ){
- int xcoord = data.xzOffset - PlayerData->Position.angles[0] + 45;
- char ycoord = data.yOffset - PlayerData->Position.angles[1] + 45;
- int scale = data.distance * 10 / VISUAL_RANGE;
- scale = 11 - scale;
- xcoord = (xcoord * vWidth) / 91 - scale;
- ycoord = (ycoord * vHeight) / 91;
- if(object->type == OBJ_SHIP){
- if( gfx_OutBuffer = malloc( (sprite_BorgSphere->width * scale) * (sprite_BorgSphere->height * scale))) {
- gfx_OutBuffer->width = sprite_BorgSphere->width * scale;
- gfx_OutBuffer->height = sprite_BorgSphere->height * scale;
- gfx_ScaleSprite(sprite_BorgSphere, gfx_OutBuffer);
- gfx_TransparentSprite(gfx_OutBuffer, xcoord, ycoord);
- free(gfx_OutBuffer);
- }
- }
- if(object->type == OBJ_PROJ){
- if( gfx_OutBuffer = malloc( (sprite_Phaser->width * scale) * (sprite_Phaser->height * scale))) {
- gfx_OutBuffer->width = sprite_Phaser->width * scale;
- gfx_OutBuffer->height = sprite_Phaser->height * scale;
- gfx_ScaleSprite(sprite_Phaser, gfx_OutBuffer);
- gfx_TransparentSprite(gfx_OutBuffer, xcoord, ycoord);
- free(gfx_OutBuffer);
- }
- }
- /* gfx_SetTextXY(0,140);
- gfx_PrintUInt(scale, 2);
- gfx_PrintString(", ");
- gfx_PrintUInt(data.distance, 5);
- gfx_SetTextXY(0,150);
- gfx_PrintInt((int)delta_x, 5);
- gfx_PrintString(", ");
- gfx_PrintInt((int)delta_y, 5);
- gfx_PrintString(", ");
- gfx_PrintInt((int)delta_z, 5); */
- }
- }
- }
- }
- gfx_SetClipRegion(0,0,320,240);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement