dos33fsprogs/gr-sim/tfv/tfv_info.c

250 lines
4.9 KiB
C
Raw Normal View History

2017-08-13 19:38:49 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "gr-sim.h"
#include "tfv_utils.h"
#include "tfv_zp.h"
#include "tfv_defines.h"
2017-08-13 19:38:49 +00:00
#include "tfv_backgrounds.h"
void game_over(void) {
text();
home();
/* Make a box around it? */
2017-09-19 04:26:38 +00:00
vtab(12);
htab(15);
move_cursor();
print("GAME OVER");
2017-08-13 19:38:49 +00:00
/* play the GROAN sound? */
2017-09-19 04:26:38 +00:00
page_flip();
2017-08-13 19:38:49 +00:00
repeat_until_keypressed();
}
void print_help(void) {
clear_top_a(0xa0);
soft_switch(TXTSET);
2017-08-13 19:38:49 +00:00
2017-11-18 20:17:28 +00:00
// htab(1);
// vtab(1);
// move_cursor();
/*
***************************************
* HELP *
* *
* ARROWS - MOVE *
* W/A/S/D - MOVE *
* Z/X - SPEED UP / SLOW DOWN *
* SPACE - STOP *
* RETURN - LAND / ENTER / ACTION *
* I - INVENTORY *
* M - MAP *
* ESC - QUIT *
* *
***************************************
*/
ram[CV]=1;
ram[CH]=18;
move_and_print("HELP");
ram[CV]=3;
ram[CH]=4; move_and_print("ARROWS - MOVE");
ram[CV]++; move_and_print("W/A/S/D - MOVE");
ram[CV]++; move_and_print("Z/X - SPEED UP / SLOW DOWN");
ram[CV]++; move_and_print("SPACE - STOP");
ram[CV]++; move_and_print("RETURN - LAND / ENTER / ACTION");
ram[CV]++; move_and_print("I - INVENTORY");
ram[CV]++; move_and_print("M - MAP");
ram[CV]++; move_and_print("ESC - QUIT");
2017-09-19 04:26:38 +00:00
page_flip();
2017-08-13 19:38:49 +00:00
repeat_until_keypressed();
soft_switch(TXTCLR);
2017-08-13 19:38:49 +00:00
}
void show_map(void) {
gr();
2017-09-19 04:26:38 +00:00
grsim_unrle(map_rle,((int)ram[DRAW_PAGE]+0x4)<<8);
//gr_copy(0x800,0x400);
2017-08-13 19:38:49 +00:00
color_equals(COLOR_RED);
printf("plot(%d,%d)\n",
8+((map_location&0x3)*6)+(tfv_x/6),
8+(((map_location&0xc)>>2)*6)+(tfv_y/6));
basic_plot(8+((map_location&0x3)*6)+(tfv_x/6),8+(((map_location&0xc)>>2)*6)+(tfv_y/6));
// basic_plot(8+((map_location&0x3)*6)+(tfv_x/6),8+(((map_location&0xc)>>2)*6)+(tfv_y/6));
ram[CH]=20;
ram[CV]=20; move_and_print(map_info[map_location].name);
2017-08-13 19:38:49 +00:00
2017-09-19 04:26:38 +00:00
page_flip();
2017-08-13 19:38:49 +00:00
repeat_until_keypressed();
}
/*
1 2 3 4
01234567890123456789012345678901234567890
**************************************** 1
* DEATER * LEVEL 1 * 2
**************************************** 3
* INVENTORY * STATS * 4
**************************************** 5
* * HP: 50/100 * 6
* * MP: 0/0 * 7
* * * 8
* * EXPERIENCE: 0 * 9
* * NEXT LEVEL: 16 * 10
* * * 11
* * MONEY: $1 * 12 0-256
* * TIME: 00:00 * 13
* * * 14
* * * 15
* * * 16
* * * 17
* * * 18
* * * 19
* * * 20
* * * 21
* * * 22
* * * 23
**************************************** 24
EXPERIENCE = 0...255
LEVEL = EXPERIENCE / = 0...63
NEXT LEVEL =
MONEY = 0...255
MAX_HP = 32+EXPERIENCE (maxing at 255)
*/
static char item_names1[8][15]={
"CUPCAKE", // cafeteria lady
"CARROT", // capabara
"SMARTPASS", // metro worker
"ELF RUNES", // mree
"LIZBETH STAR", // Lizbeth
"KARTE SPIEL", // Frau
"GLAMDRING", // Gus
"VEGEMITE", // Nicole
};
static char item_names2[8][15]={
"BLUE LED", // bird
"RED LED", //
"1K RESISTOR", // brown black red, Elaine
"4.7K RESISTOR", // yellow purple red, Tater
"9V BATTERY", // Cindy
"1.5V BATTERY", // Oscar
"LINUX CD", // john
"ARMY KNIFE", // Steve
};
void print_info(void) {
int i;
text();
home();
/* Inverse Space */
/* 0x30=COLOR */
ram[0x30]=0x20;
/* Draw boxes */
2017-11-19 04:17:26 +00:00
hlin_double(0,0,39,0);
hlin_double(0,0,39,4);
hlin_double(0,0,39,8);
hlin_double(0,0,39,46);
2017-08-13 19:38:49 +00:00
basic_vlin(0,48,0);
basic_vlin(0,48,20);
basic_vlin(0,48,39);
basic_htab(3);
basic_vtab(2);
basic_print(nameo);
basic_htab(23);
basic_print("LEVEL ");
print_u8(level);
basic_htab(3);
basic_vtab(4);
basic_print("INVENTORY");
basic_htab(23);
basic_print("STATS");
for(i=0;i<8;i++) {
basic_htab(4);
basic_vtab(6+i);
if (items1&(1<<i)) basic_print(item_names1[i]);
basic_htab(4);
basic_vtab(14+i);
if (items2&(1<<i)) basic_print(item_names2[i]);
}
basic_htab(23);
basic_vtab(6);
basic_print("HP: ");
print_u8(hp);
basic_print("/");
print_u8(max_hp);
basic_htab(23);
basic_vtab(7);
basic_print("MP: 0/0");
basic_htab(23);
basic_vtab(9);
basic_print("EXPERIENCE: ");
print_u8(experience);
basic_htab(23);
basic_vtab(10);
basic_print("NEXT LEVEL: ");
basic_htab(23);
basic_vtab(12);
basic_print("MONEY: $");
print_u8(money);
basic_htab(23);
basic_vtab(13);
basic_print("TIME: ");
if (time_hours<10) basic_print("0");
print_u8(time_hours);
basic_print(":");
if (time_minutes<10) basic_print("0");
print_u8(time_minutes);
grsim_update();
repeat_until_keypressed();
home();
gr();
}