Prev: CA3F Up: Map Next: CACB
CAA7: Colour Fuel Gauge
Used by the routine at UpdateFuelGauge.
Used on odd frames. When the fuel is low (the gauge level is at least 98) the colour of the fuel gauge alternates between red and yellow every other frame, otherwise it is yellow. ColourFuelGauge_Yellow is the entry point that always uses yellow.
ColourFuelGauge CAA7 LD A,($9A64) Fetch the frame counter from FrameCounter.
CAAA LD B,A Keep it, so the next bit can be tested as well.
CAAB AND %00000001 Is this an odd frame?
CAAD RET Z Return on an even frame.
CAAE LD A,($CC4C) Fetch the row of the top of the fuel.
CAB1 CP $98 Use yellow if the tank is not low.
CAB3 JR C,ColourFuelGauge_Yellow
CAB5 BIT 1,B Use yellow on the frames when bit 1 is clear.
CAB7 JR Z,ColourFuelGauge_Yellow
CAB9 LD A,$42 Otherwise use red (42).
CABB JR ColourFuelGauge_Fill Fill the gauge with it.
This entry point is used by the routine at DrawHUD.
ColourFuelGauge_Yellow CABD LD A,$46 The normal colour of the gauge is yellow (46).
ColourFuelGauge_Fill CABF LD ($CBAD),A Store the chosen colour in the gauge attributes.
CAC2 LD HL,$BFF0 The gauge hangs from the right of the bottom row.
CAC5 LD DE,$CBAB The attribute area of the gauge.
CAC8 JP FillAttributes Fill that area.
Prev: CA3F Up: Map Next: CACB