getPixel doesn't correctly map the pixel. #408
This commit is contained in:
		@@ -153,15 +153,14 @@ static void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if(x < machine->state.clip.l || y < machine->state.clip.t || x >= machine->state.clip.r || y >= machine->state.clip.b) return;
 | 
						if(x < machine->state.clip.l || y < machine->state.clip.t || x >= machine->state.clip.r || y >= machine->state.clip.b) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO: check color bounds here
 | 
						tic_tool_poke4(machine->memory.ram.vram.screen.data, y * TIC80_WIDTH + x, tic_tool_peek4(machine->memory.ram.vram.mapping, color & 0xf));
 | 
				
			||||||
	tic_tool_poke4(machine->memory.ram.vram.screen.data, y * TIC80_WIDTH + x, tic_tool_peek4(machine->memory.ram.vram.mapping, color));
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static u8 getPixel(tic_machine* machine, s32 x, s32 y)
 | 
					static u8 getPixel(tic_machine* machine, s32 x, s32 y)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if(x < 0 || y < 0 || x >= TIC80_WIDTH || y >= TIC80_HEIGHT) return 0;
 | 
						if(x < 0 || y < 0 || x >= TIC80_WIDTH || y >= TIC80_HEIGHT) return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return tic_tool_peek4(machine->memory.ram.vram.mapping, tic_tool_peek4(machine->memory.ram.vram.screen.data, y * TIC80_WIDTH + x));
 | 
						return tic_tool_peek4(machine->memory.ram.vram.screen.data, y * TIC80_WIDTH + x);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void drawHLine(tic_machine* machine, s32 x, s32 y, s32 width, u8 color)
 | 
					static void drawHLine(tic_machine* machine, s32 x, s32 y, s32 width, u8 color)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user