Revision 321
correcting some problems
proj.c | ||
---|---|---|
49 | 49 |
return 0; |
50 | 50 |
} |
51 | 51 |
|
52 |
basic_sprite_t *bsp_crosshair = NULL; |
|
53 |
basic_sprite_t *bsp_shooter = NULL; |
|
54 |
basic_sprite_t *bsp_zombie = NULL; |
|
55 |
basic_sprite_t *bsp_pistol = NULL; |
|
56 |
basic_sprite_t *bsp_nothing = NULL; |
|
57 |
basic_sprite_t *bsp_bullet = NULL; |
|
58 |
map_t *map1 = NULL; |
|
59 |
sprite_t *sp_crosshair = NULL; |
|
52 |
static basic_sprite_t *bsp_crosshair = NULL;
|
|
53 |
static basic_sprite_t *bsp_shooter = NULL;
|
|
54 |
static basic_sprite_t *bsp_zombie = NULL;
|
|
55 |
static basic_sprite_t *bsp_pistol = NULL;
|
|
56 |
static basic_sprite_t *bsp_nothing = NULL;
|
|
57 |
static basic_sprite_t *bsp_bullet = NULL;
|
|
58 |
static map_t *map1 = NULL;
|
|
59 |
static sprite_t *sp_crosshair = NULL;
|
|
60 | 60 |
|
61 | 61 |
static int (singleplayer)(void); |
62 | 62 |
static int (multiplayer)(void); |
... | ... | |
118 | 118 |
while (good) { |
119 | 119 |
/* Get a request message. */ |
120 | 120 |
if((r = get_interrupts_vector(&int_vector))) return r; |
121 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
121 |
uint32_t n = 1; |
|
122 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
122 | 123 |
if (int_vector & n) { |
123 | 124 |
interrupt_handler(i); |
124 | 125 |
switch (i) { |
... | ... | |
142 | 143 |
|
143 | 144 |
break; |
144 | 145 |
case KBC_IRQ: |
145 |
if ((scancode[0]) == ESC_BREAK_CODE) good = false;
|
|
146 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
|
|
146 | 147 |
case MOUSE_IRQ: |
147 | 148 |
if (counter_mouse_ih >= 3) { |
148 | 149 |
mouse_parse_packet(packet_mouse_ih, &pp); |
... | ... | |
182 | 183 |
return 0; |
183 | 184 |
} |
184 | 185 |
|
185 |
host_info_t *host_info = NULL; |
|
186 |
remote_info_t *remote_info = NULL; |
|
187 |
bullet_info_t *bullet_info = NULL; |
|
186 |
static host_info_t *host_info = NULL;
|
|
187 |
static remote_info_t *remote_info = NULL;
|
|
188 |
static bullet_info_t *bullet_info = NULL;
|
|
188 | 189 |
|
189 | 190 |
static void multiplayer_process(const uint8_t *p, const size_t sz) { |
190 | 191 |
void *dest = NULL; |
... | ... | |
202 | 203 |
bullet_info_dtor(bullet_info); |
203 | 204 |
bullet_info = (bullet_info_t*)dest; |
204 | 205 |
break; |
205 |
default: break; |
|
206 |
case hltp_type_invalid: break; |
|
207 |
case hltp_type_string : break; |
|
206 | 208 |
} |
207 | 209 |
} |
208 | 210 |
static int (multiplayer_host)(void); |
... | ... | |
227 | 229 |
while (good) { |
228 | 230 |
/* Get a request message. */ |
229 | 231 |
if((r = get_interrupts_vector(&int_vector))) return r; |
230 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
232 |
uint32_t n = 1; |
|
233 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
231 | 234 |
if (int_vector & n) { |
232 | 235 |
interrupt_handler(i); |
233 | 236 |
switch (i) { |
... | ... | |
250 | 253 |
|
251 | 254 |
break; |
252 | 255 |
case KBC_IRQ: |
253 |
if ((scancode[0]) == ESC_BREAK_CODE) good = false;
|
|
256 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
|
|
254 | 257 |
case MOUSE_IRQ: |
255 | 258 |
if (counter_mouse_ih >= 3) { |
256 | 259 |
mouse_parse_packet(packet_mouse_ih, &pp); |
... | ... | |
279 | 282 |
|
280 | 283 |
list_t *shooter_list = list_ctor(); |
281 | 284 |
|
282 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
285 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
283 | 286 |
gunner_set_spawn(shooter1, 75, 75); |
284 | 287 |
|
285 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 2); if(shooter2 == NULL) printf("Failed to get shooter2\n");
|
|
288 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 2); if(shooter2 == NULL) printf("Failed to get shooter2\n");
|
|
286 | 289 |
gunner_set_spawn(shooter2, 975, 75); |
287 | 290 |
|
288 | 291 |
list_insert(shooter_list, list_end(shooter_list), shooter1); |
... | ... | |
314 | 317 |
int state_1, state_2; |
315 | 318 |
while (good) { |
316 | 319 |
if ((r = get_interrupts_vector(&int_vector))) return r; |
317 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
320 |
uint32_t n = 1; |
|
321 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
318 | 322 |
if (int_vector & n) { |
319 | 323 |
interrupt_handler(i); |
320 | 324 |
switch (i) { |
321 | 325 |
case TIMER0_IRQ: |
322 |
if (no_interrupts % 60 == 0) timer_update(in_game_timer);
|
|
326 |
if (timer_get_no_interrupts() % 60 == 0) timer_update(in_game_timer);
|
|
323 | 327 |
|
324 | 328 |
update_movement(map1, shooter1, keys, shooter_list); |
325 | 329 |
update_movement(map1, shooter2, &(remote_info->remote_keys_pressed), shooter_list); |
... | ... | |
360 | 364 |
|
361 | 365 |
break; |
362 | 366 |
case KBC_IRQ: |
363 |
if ((scancode[0]) == ESC_BREAK_CODE) {
|
|
367 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
|
|
364 | 368 |
good = false; |
365 | 369 |
} |
366 | 370 |
break; |
... | ... | |
418 | 422 |
|
419 | 423 |
list_t *shooter_list = list_ctor(); |
420 | 424 |
|
421 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 2); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
425 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 2); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
422 | 426 |
gunner_set_spawn(shooter1, 75, 75); |
423 | 427 |
|
424 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter2 == NULL) printf("Failed to get shooter2\n");
|
|
428 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter2 == NULL) printf("Failed to get shooter2\n");
|
|
425 | 429 |
gunner_set_spawn(shooter2, 975, 75); |
426 | 430 |
|
427 | 431 |
list_insert(shooter_list, list_end(shooter_list), shooter1); |
... | ... | |
446 | 450 |
int good = true; |
447 | 451 |
while (good) { |
448 | 452 |
if ((r = get_interrupts_vector(&int_vector))) return r; |
449 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
453 |
uint32_t n = 1; |
|
454 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
450 | 455 |
if (int_vector & n) { |
451 | 456 |
interrupt_handler(i); |
452 | 457 |
switch (i) { |
453 | 458 |
case TIMER0_IRQ: |
454 |
if (no_interrupts % 60 == 0) timer_update(in_game_timer);
|
|
459 |
if (timer_get_no_interrupts() % 60 == 0) timer_update(in_game_timer);
|
|
455 | 460 |
|
456 | 461 |
double angle = get_mouse_angle(shooter1); |
457 | 462 |
|
... | ... | |
472 | 477 |
ent_set_origin(gunner_get_x(shooter1)-ent_get_XLength()/2.0, |
473 | 478 |
gunner_get_y(shooter1)-ent_get_YLength()/2.0); |
474 | 479 |
|
475 |
for (size_t i = 0; i < host_info->no_bullets; i++) {
|
|
476 |
if (host_info->bullets_shooter[i]) { // remote
|
|
477 |
bullet_t *bullet = bullet_ctor(shooter1, bsp_bullet, host_info->bullets_x[i], host_info->bullets_y[i], host_info->bullets_vx[i], host_info->bullets_vy[i]);
|
|
480 |
for (size_t j = 0; j < host_info->no_bullets; j++) {
|
|
481 |
if (host_info->bullets_shooter[j]) { // remote
|
|
482 |
bullet_t *bullet = bullet_ctor(shooter1, bsp_bullet, host_info->bullets_x[j], host_info->bullets_y[j], host_info->bullets_vx[j], host_info->bullets_vy[j]);
|
|
478 | 483 |
list_insert(bullet_list, list_end(bullet_list), bullet); |
479 | 484 |
} else { // host |
480 |
bullet_t *bullet = bullet_ctor(shooter2, bsp_bullet, host_info->bullets_x[i], host_info->bullets_y[i], host_info->bullets_vx[i], host_info->bullets_vy[i]);
|
|
485 |
bullet_t *bullet = bullet_ctor(shooter2, bsp_bullet, host_info->bullets_x[j], host_info->bullets_y[j], host_info->bullets_vx[j], host_info->bullets_vy[j]);
|
|
481 | 486 |
list_insert(bullet_list, list_end(bullet_list), bullet); |
482 | 487 |
} |
483 | 488 |
} |
... | ... | |
500 | 505 |
|
501 | 506 |
break; |
502 | 507 |
case KBC_IRQ: |
503 |
if ((scancode[0]) == ESC_BREAK_CODE) {
|
|
508 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
|
|
504 | 509 |
good = false; |
505 | 510 |
} |
506 | 511 |
break; |
... | ... | |
567 | 572 |
while (good) { |
568 | 573 |
/* Get a request message. */ |
569 | 574 |
if((r = get_interrupts_vector(&int_vector))) return r; |
570 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
575 |
uint32_t n = 1; |
|
576 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
571 | 577 |
if (int_vector & n) { |
572 | 578 |
interrupt_handler(i); |
573 | 579 |
switch (i) { |
... | ... | |
590 | 596 |
|
591 | 597 |
break; |
592 | 598 |
case KBC_IRQ: |
593 |
if ((scancode[0]) == ESC_BREAK_CODE) good = false;
|
|
599 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
|
|
594 | 600 |
case MOUSE_IRQ: |
595 | 601 |
if (counter_mouse_ih >= 3) { |
596 | 602 |
mouse_parse_packet(packet_mouse_ih, &pp); |
... | ... | |
618 | 624 |
|
619 | 625 |
list_t *shooter_list = list_ctor(); |
620 | 626 |
|
621 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
627 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
622 | 628 |
gunner_set_spawn(shooter1, 75, 75); |
623 | 629 |
gunner_set_pos(shooter1, 75, 75); |
624 | 630 |
|
625 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing, gunner_player, 2);
|
|
631 |
gunner_t *shooter2 = gunner_ctor(bsp_shooter, bsp_nothing, GUNNER_PLAYER, 2);
|
|
626 | 632 |
gunner_set_spawn(shooter2, 975, 75); |
627 | 633 |
gunner_set_pos(shooter2, 775, 75); |
628 | 634 |
|
... | ... | |
645 | 651 |
while (good) { |
646 | 652 |
/* Get a request message. */ |
647 | 653 |
if((r = get_interrupts_vector(&int_vector))) return r; |
648 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
654 |
uint32_t n = 1; |
|
655 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
649 | 656 |
if(!good) break; |
650 | 657 |
if (int_vector & n) { |
651 | 658 |
interrupt_handler(i); |
652 | 659 |
switch (i) { |
653 | 660 |
case TIMER0_IRQ: |
654 | 661 |
|
655 |
if (no_interrupts % 60 == 0) timer_update(in_game_timer);
|
|
662 |
if (timer_get_no_interrupts() % 60 == 0) timer_update(in_game_timer);
|
|
656 | 663 |
update_movement(map1, shooter1, keys, shooter_list); |
657 | 664 |
|
658 | 665 |
update_game_state(map1, shooter_list, bullet_list); |
... | ... | |
677 | 684 |
|
678 | 685 |
break; |
679 | 686 |
case KBC_IRQ: |
680 |
if ((scancode[0]) == ESC_BREAK_CODE) {
|
|
687 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
|
|
681 | 688 |
good = false; |
682 | 689 |
} |
683 | 690 |
break; |
... | ... | |
726 | 733 |
|
727 | 734 |
list_t *shooter_list = list_ctor(); |
728 | 735 |
|
729 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, gunner_player, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
736 |
gunner_t *shooter1 = gunner_ctor(bsp_shooter, bsp_pistol, GUNNER_PLAYER, 1); if(shooter1 == NULL) printf("Failed to get shooter1\n");
|
|
730 | 737 |
gunner_set_spawn(shooter1, 980, 790); |
731 | 738 |
gunner_set_pos(shooter1, 980, 790); |
732 | 739 |
|
... | ... | |
749 | 756 |
|
750 | 757 |
int health = 50; |
751 | 758 |
|
752 |
/** #DEV */ /* { |
|
753 |
gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, gunner_melee | gunner_follow, 3); |
|
754 |
gunner_set_health(zombie, health); |
|
755 |
gunner_set_curr_health(zombie, health); |
|
756 |
health *= ZOMBIE_HEALTH_FACTOR; |
|
757 |
gunner_set_pos(zombie, 1100, 75); |
|
758 |
list_push_back(shooter_list, zombie); |
|
759 |
}*/ //\#DEV |
|
760 |
|
|
761 | 759 |
map_make_dijkstra(map1, gunner_get_x(shooter1), gunner_get_y(shooter1)); |
762 | 760 |
|
763 | 761 |
while (good && !dead) { |
764 | 762 |
/* Get a request message. */ |
765 | 763 |
if((r = get_interrupts_vector(&int_vector))) return r; |
766 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
764 |
uint32_t n = 1; |
|
765 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
767 | 766 |
if(!good || dead) break; |
768 | 767 |
if (int_vector & n) { |
769 | 768 |
interrupt_handler(i); |
770 | 769 |
switch (i) { |
771 | 770 |
case TIMER0_IRQ: |
772 |
if (no_interrupts % 60 == 0) timer_update(in_game_timer);
|
|
773 |
if (no_interrupts % 6 == 0){
|
|
771 |
if (timer_get_no_interrupts() % 60 == 0) timer_update(in_game_timer);
|
|
772 |
if (timer_get_no_interrupts() % 6 == 0){
|
|
774 | 773 |
map_make_dijkstra(map1, gunner_get_x(shooter1), gunner_get_y(shooter1)); |
775 | 774 |
} |
776 | 775 |
|
... | ... | |
791 | 790 |
gunner_get_y(shooter1)-ent_get_YLength()/2.0); |
792 | 791 |
|
793 | 792 |
while(list_size(shooter_list) < ZOMBIES_NUM+1){ |
794 |
gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, gunner_melee | gunner_follow, 3);
|
|
793 |
gunner_t *zombie = gunner_ctor(bsp_zombie, bsp_nothing, GUNNER_MELEE | GUNNER_FOLLOW, 3);
|
|
795 | 794 |
gunner_set_health(zombie, health); |
796 | 795 |
gunner_set_curr_health(zombie, health); |
797 | 796 |
health *= ZOMBIE_HEALTH_FACTOR; |
... | ... | |
812 | 811 |
|
813 | 812 |
break; |
814 | 813 |
case KBC_IRQ: |
815 |
if ((scancode[0]) == ESC_BREAK_CODE) {
|
|
814 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) {
|
|
816 | 815 |
good = false; |
817 | 816 |
} |
818 | 817 |
break; |
... | ... | |
856 | 855 |
|
857 | 856 |
#define CHAT_MAX_SIZE 75 |
858 | 857 |
#define CHAT_MAX_NUM 19 |
859 |
text_t *t_text[CHAT_MAX_NUM] = {NULL}; |
|
860 |
rectangle_t *r_text = NULL; |
|
858 |
static text_t *t_text[CHAT_MAX_NUM] = {NULL};
|
|
859 |
static rectangle_t *r_text = NULL;
|
|
861 | 860 |
static void chat_process(const uint8_t *p, const size_t sz){ |
862 | 861 |
char buffer2[CHAT_MAX_NUM+3]; |
863 | 862 |
void *dest = NULL; |
... | ... | |
879 | 878 |
} |
880 | 879 |
} |
881 | 880 |
break; |
882 |
default: break; |
|
881 |
case hltp_type_invalid: break; |
|
882 |
case hltp_type_bullet : break; |
|
883 |
case hltp_type_host : break; |
|
884 |
case hltp_type_remote : break; |
|
883 | 885 |
} |
884 | 886 |
} |
885 | 887 |
static int (chat)(void){ |
... | ... | |
894 | 896 |
rectangle_t *r_buffer = NULL; { |
895 | 897 |
r_buffer = rectangle_ctor(0,0,900,70); |
896 | 898 |
rectangle_set_pos(r_buffer, graph_get_XRes()/2 -rectangle_get_w(r_buffer)/2, |
897 |
graph_get_YRes()*0.87-rectangle_get_h(r_buffer)/2);
|
|
899 |
(int16_t)(graph_get_YRes()*0.87-rectangle_get_h(r_buffer)/2));
|
|
898 | 900 |
rectangle_set_fill_color (r_buffer, GRAPH_BLACK); |
899 | 901 |
rectangle_set_outline_width(r_buffer, 2); |
900 | 902 |
rectangle_set_outline_color(r_buffer, GRAPH_WHITE); |
... | ... | |
924 | 926 |
/** r_text */ { |
925 | 927 |
r_text = rectangle_ctor(0,0,900,550); |
926 | 928 |
rectangle_set_pos(r_text, graph_get_XRes()/2 -rectangle_get_w(r_buffer)/2, |
927 |
graph_get_YRes()*0.09);
|
|
929 |
(int16_t)(graph_get_YRes()*0.09));
|
|
928 | 930 |
rectangle_set_fill_color (r_text, GRAPH_BLACK); |
929 | 931 |
rectangle_set_outline_width(r_text, 2); |
930 | 932 |
rectangle_set_outline_color(r_text, GRAPH_WHITE); |
931 | 933 |
rectangle_set_fill_trans(r_text, GRAPH_TRANSPARENT); |
932 | 934 |
} |
933 | 935 |
/** t_text */ { |
934 |
for(size_t i = 0; i < CHAT_MAX_NUM; ++i){
|
|
936 |
for(uint16_t i = 0; i < CHAT_MAX_NUM; ++i){
|
|
935 | 937 |
t_text[i] = text_ctor(font_get_default(), " "); |
936 | 938 |
text_set_pos(t_text[i], rectangle_get_x(r_text)+50, |
937 | 939 |
rectangle_get_y(r_text)+rectangle_get_h(r_text)-30-25*i); |
... | ... | |
947 | 949 |
while (good) { |
948 | 950 |
/* Get a request message. */ |
949 | 951 |
if((r = get_interrupts_vector(&int_vector))) return r; |
950 |
for (uint32_t i = 0, n = 1; i < 32; i++, n <<= 1) { |
|
952 |
uint32_t n = 1; |
|
953 |
for (uint8_t i = 0; i < 32; i++, n <<= 1) { |
|
951 | 954 |
if (int_vector & n) { |
952 | 955 |
interrupt_handler(i); |
953 | 956 |
switch (i) { |
... | ... | |
960 | 963 |
text_draw(t_size); |
961 | 964 |
|
962 | 965 |
rectangle_draw(r_text); |
963 |
for(size_t i = 0; i < CHAT_MAX_NUM; ++i) text_draw(t_text[i]);
|
|
966 |
for(size_t j = 0; j < CHAT_MAX_NUM; ++j) text_draw(t_text[j]);
|
|
964 | 967 |
|
965 | 968 |
sprite_draw(sp_crosshair); |
966 | 969 |
graph_draw(); |
967 | 970 |
break; |
968 | 971 |
case KBC_IRQ: |
969 |
if (scancode[0] == ESC_BREAK_CODE) good = false;
|
|
970 |
else if (scancode[0] == ENTER_MAKE_CODE) {
|
|
972 |
if (keyboard_get_scancode()[0] == ESC_BREAK_CODE) good = false;
|
|
973 |
else if (keyboard_get_scancode()[0] == ENTER_MAKE_CODE) {
|
|
971 | 974 |
hltp_send_string(buffer); |
972 | 975 |
char buffer2[CHAT_MAX_SIZE+3] = "> "; |
973 | 976 |
strncat(buffer2, buffer, strlen(buffer)); |
974 |
for(size_t i = CHAT_MAX_NUM-1; i; --i) |
|
975 |
text_set_string(t_text[i], text_get_string(t_text[i-1])); |
|
977 |
for(size_t j = CHAT_MAX_NUM-1; j; --j) text_set_string(t_text[i], text_get_string(t_text[i-1])); |
|
976 | 978 |
text_set_string(t_text[0], buffer2); |
977 |
for(size_t i = 0; i < CHAT_MAX_NUM; ++i){
|
|
978 |
if(text_get_string(t_text[i])[0] == '>'){
|
|
979 |
text_set_pos(t_text[i], rectangle_get_x(r_text)+50, text_get_y(t_text[i]));
|
|
980 |
text_set_halign(t_text[i], text_halign_left);
|
|
979 |
for(size_t j = 0; j < CHAT_MAX_NUM; ++j){
|
|
980 |
if(text_get_string(t_text[j])[0] == '>'){
|
|
981 |
text_set_pos(t_text[j], rectangle_get_x(r_text)+50, text_get_y(t_text[j]));
|
|
982 |
text_set_halign(t_text[j], text_halign_left);
|
|
981 | 983 |
}else{ |
982 |
text_set_pos(t_text[i], rectangle_get_x(r_text)+rectangle_get_w(r_text)-50, text_get_y(t_text[i]));
|
|
983 |
text_set_halign(t_text[i], text_halign_right);
|
|
984 |
text_set_pos(t_text[j], rectangle_get_x(r_text)+rectangle_get_w(r_text)-50, text_get_y(t_text[j]));
|
|
985 |
text_set_halign(t_text[j], text_halign_right);
|
|
984 | 986 |
} |
985 | 987 |
} |
986 | 988 |
buffer[0] = '\0'; |
987 |
} else if(scancode[0] == BACKSPACE_MAKE_CODE){
|
|
989 |
} else if(keyboard_get_scancode()[0] == BACKSPACE_MAKE_CODE){
|
|
988 | 990 |
buffer[strlen(buffer)-1] = '\0'; |
989 | 991 |
} else { |
990 |
char c = map_makecode(scancode[0]);
|
|
992 |
char c = map_makecode(keyboard_get_scancode()[0]);
|
|
991 | 993 |
if (c == ERROR_CODE) break; |
992 | 994 |
if(strlen(buffer) < CHAT_MAX_SIZE) strncat(buffer, &c, 1); |
993 | 995 |
else printf("Char limit exceeded\n"); |
Also available in: Unified diff