The FPS are now unfucked
This commit is contained in:
@@ -266,11 +266,11 @@ void Get_Color_From_Background(Point whereToLook,Color *color){
|
||||
color->Blue = SMPTE.pixel_data[index+2];
|
||||
}
|
||||
|
||||
void Get_Color_From_Sprite(Sprite_32x32 sprite, Point whereToLook, Color *color){
|
||||
int index = (whereToLook.Y*32+whereToLook.X)*3;
|
||||
color->Red = sprite.pixel_data[index];
|
||||
color->Green = sprite.pixel_data[index+1];
|
||||
color->Blue = sprite.pixel_data[index+2];
|
||||
void Get_Color_From_Sprite(Point whereToLook, Color *color){
|
||||
int index = ((whereToLook.Y << 5)+whereToLook.X)*3;
|
||||
color->Red = ShipSprite1.pixel_data[index];
|
||||
color->Green = ShipSprite1.pixel_data[index+1];
|
||||
color->Blue = ShipSprite1.pixel_data[index+2];
|
||||
}
|
||||
void auto_screen_roloff(Rectangle area,Point currentPos){
|
||||
if(currentPos.Y + area.Position.Y == SCREEN_HEIGHT){
|
||||
@@ -294,8 +294,9 @@ void Refresh_Area(Rectangle area){
|
||||
}
|
||||
}
|
||||
}
|
||||
int showDebug = 0;
|
||||
void Refresh_Player_Area(Rectangle area,Rectangle Hitbox){
|
||||
Sprite_32x32 sprite = ShipSprite1;
|
||||
//Sprite_32x32 sprite = ShipSprite1;
|
||||
Resize_Window(area);
|
||||
Write_Cmd(0x2C);
|
||||
Color color;
|
||||
@@ -307,14 +308,13 @@ void Refresh_Player_Area(Rectangle area,Rectangle Hitbox){
|
||||
&& x + area.Position.X >= Hitbox.Position.X
|
||||
&& x + area.Position.X < Hitbox.Position.X + Hitbox.Size.Width){
|
||||
|
||||
Get_Color_From_Sprite(sprite,(Point){x-(Hitbox.Position.X - area.Position.X),y-(Hitbox.Position.Y-area.Position.Y)},&color);
|
||||
|
||||
Get_Color_From_Sprite((Point){x-(Hitbox.Position.X - area.Position.X),y-(Hitbox.Position.Y-area.Position.Y)},&color);
|
||||
if(color.Red == 0 && color.Green == 0 && color.Blue == 0)
|
||||
Get_Color_From_Background((Point){area.Position.X+x,(area.Position.Y+y)%SCREEN_HEIGHT},&color);
|
||||
}else{
|
||||
Get_Color_From_Background((Point){area.Position.X+x,(area.Position.Y+y)%SCREEN_HEIGHT},&color);
|
||||
//if(y == 0 || y == area.Size.Height -1 || x == 0 || x == area.Size.Width -1)
|
||||
//color = (Color){255,0,0};
|
||||
if(showDebug && (y == 0 || y == area.Size.Height -1 || x == 0 || x == area.Size.Width -1))
|
||||
color = (Color){255,0,0};
|
||||
}
|
||||
SendPixel(color.Red,color.Green,color.Blue);
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void DrawPlayer(Player player, Rectangle areaToDraw){
|
||||
auto_screen_roloff(player.Hitbox,(Point){0,y});
|
||||
for(int x = 0; x < (player.Hitbox.Size.Width+1);x++){
|
||||
if(y >= areaToDraw.Position.Y && y <= areaToDraw.Size.Height && x >= areaToDraw.Position.X && x <= areaToDraw.Size.Width){
|
||||
Get_Color_From_Sprite(sprite,(Point){x,y},&color);
|
||||
Get_Color_From_Sprite((Point){x,y},&color);
|
||||
if(color.Red != 0 && color.Green != 0 && color.Blue != 0){
|
||||
SendPixel(color.Red,color.Green,color.Blue);
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user