Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. oid lcars_RenderViewScreen(void){
  2. char i;
  3. int vWidth = 228, vHeight = 173;
  4. gfx_SetClipRegion(xStart, yStart, xStart+vWidth, yStart+vHeight);
  5. for( i = 0; i <= (sizeof(MapData)/sizeof(MapObject_t)); i++){
  6. MapObject_t *object = &MapData[i];
  7. if( object->type == OBJ_SHIP || object->type == OBJ_PROJ ){
  8. float delta_x = object->Position.coords[0] - PlayerData->Position.coords[0];
  9. float delta_y = object->Position.coords[1] - PlayerData->Position.coords[1];
  10. float delta_z = object->Position.coords[2] - PlayerData->Position.coords[2];
  11. Relativity_t data = GetOffsets(delta_x, delta_y, delta_z);
  12. if( data.distance <= VISUAL_RANGE ){
  13. unsigned char diffXZ, diffY;
  14.  
  15. diffXZ = data.xzOffset - PlayerData->Position.angles[0];
  16. if( diffXZ > 128 ) diffXZ = 256 - diffXZ;
  17. diffY = data.yOffset - PlayerData->Position.angles[1];
  18. if( diffY > 128 ) diffY = 256 - diffY;
  19.  
  20. if( (diffXZ <= 45) && (diffY <= 45) ){
  21. int xcoord = data.xzOffset - PlayerData->Position.angles[0] + 45;
  22. char ycoord = data.yOffset - PlayerData->Position.angles[1] + 45;
  23. int scale = data.distance * 10 / VISUAL_RANGE;
  24. scale = 11 - scale;
  25. xcoord = (xcoord * vWidth) / 91 - scale;
  26. ycoord = (ycoord * vHeight) / 91;
  27. if(object->type == OBJ_SHIP){
  28. if( gfx_OutBuffer = malloc( (sprite_BorgSphere->width * scale) * (sprite_BorgSphere->height * scale))) {
  29. gfx_OutBuffer->width = sprite_BorgSphere->width * scale;
  30. gfx_OutBuffer->height = sprite_BorgSphere->height * scale;
  31. gfx_ScaleSprite(sprite_BorgSphere, gfx_OutBuffer);
  32. gfx_TransparentSprite(gfx_OutBuffer, xcoord, ycoord);
  33. free(gfx_OutBuffer);
  34. }
  35. }
  36. if(object->type == OBJ_PROJ){
  37. if( gfx_OutBuffer = malloc( (sprite_Phaser->width * scale) * (sprite_Phaser->height * scale))) {
  38. gfx_OutBuffer->width = sprite_Phaser->width * scale;
  39. gfx_OutBuffer->height = sprite_Phaser->height * scale;
  40. gfx_ScaleSprite(sprite_Phaser, gfx_OutBuffer);
  41. gfx_TransparentSprite(gfx_OutBuffer, xcoord, ycoord);
  42. free(gfx_OutBuffer);
  43. }
  44. }
  45. /* gfx_SetTextXY(0,140);
  46. gfx_PrintUInt(scale, 2);
  47. gfx_PrintString(", ");
  48. gfx_PrintUInt(data.distance, 5);
  49. gfx_SetTextXY(0,150);
  50. gfx_PrintInt((int)delta_x, 5);
  51. gfx_PrintString(", ");
  52. gfx_PrintInt((int)delta_y, 5);
  53. gfx_PrintString(", ");
  54. gfx_PrintInt((int)delta_z, 5); */
  55. }
  56. }
  57. }
  58. }
  59. gfx_SetClipRegion(0,0,320,240);
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement