| version 1.3, 2003/05/20 23:38:22 |
version 1.4, 2003/05/21 13:58:30 |
|
|
| /* $Platon: games/3do-view/3do-view.c,v 1.2 2003/05/19 22:24:46 nepto Exp $ */
|
/* $Platon: games/3do-view/3do-view.c,v 1.3 2003/05/20 23:38:22 nepto Exp $ */ |
|
|
|
| #include <stdio.h>
|
#include <stdio.h> |
| #include <string.h>
|
#include <string.h> |
| #include <stdlib.h>
|
#include <stdlib.h> |
| #include <math.h>
|
#include <math.h> |
|
|
|
| #include <system.h> /* target operating system type */
|
#include <system.h> /* target operating system type */ |
|
|
|
| #if PLATON_SYSTEM_LINUX
|
#if PLATON_SYSTEM_LINUX |
| # include <dos2linux.h>
|
# include <dos2linux.h> |
| #endif
|
#endif |
|
|
|
| #if PLATON_SYSTEM_MSDOS
|
#if PLATON_SYSTEM_MSDOS |
| # include <conio.h>
|
# include <conio.h> |
| # include <dos.h>
|
# include <dos.h> |
| # include <dir.h>
|
# include <dir.h> |
| #endif
|
#endif |
|
|
|
| #include <typedef.h>
|
#include <typedef.h> |
| #include <standart.h>
|
#include <standart.h> |
| #include <my-graph.h>
|
#include <my-graph.h> |
| #include <mouse.h>
|
#include <mouse.h> |
|
|
|
| #include "dir.h"
|
#include "dir.h" |
|
|
|
| #define PI 3.1415926536
|
#define PI 3.1415926536 |
| #define ALFA PI/6
|
#define ALFA PI/6 |
| #define BETA PI/6
|
#define BETA PI/6 |
|
|
|
| #define OSX 1
|
#define OSX 1 |
| #define OSY 2
|
#define OSY 2 |
| #define OSZ 4
|
#define OSZ 4 |
|
|
|
| enum modes
|
enum modes |
| {
|
{ |
| MODE_MAIN_MENU,
|
MODE_MAIN_MENU, |
| MODE_AUTOMATIC_TURNING,
|
MODE_AUTOMATIC_TURNING, |
| MODE_MANUAL_TURNING,
|
MODE_MANUAL_TURNING, |
| MODE_FILE_SELECTION,
|
MODE_FILE_SELECTION, |
| MODE_INFORMATION,
|
MODE_INFORMATION, |
| MODE_EXIT_DIALOG,
|
MODE_EXIT_DIALOG, |
| MODE_QUIT
|
MODE_QUIT |
| };
|
}; |
|
|
|
| enum file_selector_modes
|
enum file_selector_modes |
| {
|
{ |
| MODE_SELECTED_NONE,
|
MODE_SELECTED_NONE, |
| MODE_SELECTED_DIRECTORY,
|
MODE_SELECTED_DIRECTORY, |
| MODE_SELECTED_FILE,
|
MODE_SELECTED_FILE, |
| MODE_SELECTED_DIRECTORY_MOVE,
|
MODE_SELECTED_DIRECTORY_MOVE, |
| MODE_SELECTED_FILE_MOVE
|
MODE_SELECTED_FILE_MOVE |
| };
|
}; |
|
|
|
| int q,k,l,pocbod,stop=0;
|
int q,k,l,pocbod,stop=0; |
| BYTE p;
|
BYTE p; |
| double ALFAX,ALFAY,ALFAZ,POSUNX=0.04,POSUNY=0.075,POSUNZ=0.111,POSXOLD,POSYOLD,POSZOLD;
|
double ALFAX,ALFAY,ALFAZ,POSUNX=0.04,POSUNY=0.075,POSUNZ=0.111,POSXOLD,POSYOLD,POSZOLD; |
| int bodxbase[100],bodybase[100],bodzbase[100],
|
int bodxbase[100],bodybase[100],bodzbase[100], |
| bodx[100],body[100],bodz[100];
|
bodx[100],body[100],bodz[100]; |
| int pocspoj[100],spoj[100][20];
|
int pocspoj[100],spoj[100][20]; |
|
|
|
| /* Function prototypes */
|
/* Function prototypes */ |
| int open_3do_file(const char *filename);
|
int open_3do_file(const char *filename); |
| void vykresli(int color);
|
void vykresli(int color); |
|
|
|
| void intro(void) /* {{{ */
|
void intro(void) /* {{{ */ |
| {
|
{ |
| printf("\r\n3D OBJECTS (3DO) viewer\r\n");
|
printf("\r\n3D OBJECTS (3DO) viewer\r\n"); |
| printf("Copyright (c) 1998-2000 Condy software inc.\r\n");
|
printf("Copyright (c) 1998-2000 Condy software inc.\r\n"); |
| printf("Copyright (c) 2001-2003 Platon software development group\r\n");
|
printf("Copyright (c) 2001-2003 Platon software development group\r\n"); |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /************************ ERROR1 (mouse error) ******************************/
|
/************************ ERROR1 (mouse error) ******************************/ |
| void ERROR1(void) /* {{{ */
|
void ERROR1(void) /* {{{ */ |
| {
|
{ |
| intro();
|
intro(); |
| textbackground(CYAN);
|
textbackground(CYAN); |
| textcolor(RED+BLINK);
|
textcolor(RED+BLINK); |
| cprintf("\r\nFATAL ERROR");
|
cprintf("\r\nFATAL ERROR"); |
| textbackground(0);
|
textbackground(0); |
| textcolor(15);
|
textcolor(15); |
| cprintf("\r\nThis program requires mouse.\r\n");
|
cprintf("\r\nThis program requires mouse.\r\n"); |
| exit(0);
|
exit(0); |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /************************ ERROR2 (file error) *******************************/
|
/************************ ERROR2 (file error) *******************************/ |
| void ERROR2(void) /* {{{ */
|
void ERROR2(void) /* {{{ */ |
| {
|
{ |
| intro();
|
intro(); |
| printf("\r\nCommand line: 3do-view <name>\r\nname - 3D Object file (.3do)\r\n");
|
printf("\r\nCommand line: 3do-view <name>\r\nname - 3D Object file (.3do)\r\n"); |
| exit(0);
|
exit(0); |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /************************* INTERFACE ****************************************/
|
/************************* INTERFACE ****************************************/ |
| void intface(void) /* {{{ */
|
void intface(void) /* {{{ */ |
| {
|
{ |
| hidemouse();
|
hidemouse(); |
| setfillstyle(0,0);
|
setfillstyle(0,0); |
| rectangle(479,0,639,479);
|
rectangle(479,0,639,479); |
| bar(480,1,638,478);
|
bar(480,1,638,478); |
| rectangle(486,27,633,80);
|
rectangle(486,27,633,80); |
| rectangle(486,117,633,170);
|
rectangle(486,117,633,170); |
| rectangle(486,207,633,260);
|
rectangle(486,207,633,260); |
| rectangle(486,297,633,350);
|
rectangle(486,297,633,350); |
| rectangle(486,387,633,440);
|
rectangle(486,387,633,440); |
| setcolor(GREEN);
|
setcolor(GREEN); |
| outtextxy(559,70,"AUTOMAT. OTACANIE");
|
outtextxy(559,70,"AUTOMAT. OTACANIE"); |
| outtextxy(559,160,"MANUALNE OTACANIE");
|
outtextxy(559,160,"MANUALNE OTACANIE"); |
| setcolor(LIGHTBLUE);
|
setcolor(LIGHTBLUE); |
| outtextxy(559,250,"OTVORENIE SUBORU");
|
outtextxy(559,250,"OTVORENIE SUBORU"); |
| outtextxy(559,340,"INFORMACIE");
|
outtextxy(559,340,"INFORMACIE"); |
| setcolor(RED);
|
setcolor(RED); |
| outtextxy(559,430,"KONIEC");
|
outtextxy(559,430,"KONIEC"); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| delay(50);
|
delay(50); |
| q = MODE_MAIN_MENU;
|
q = MODE_MAIN_MENU; |
| showmouse();
|
showmouse(); |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /********************* AUTOMATICKE OTACANIE OBJEKTU *************************/
|
/********************* AUTOMATICKE OTACANIE OBJEKTU *************************/ |
| void run(void) /* {{{ */
|
void run(void) /* {{{ */ |
| {
|
{ |
| hidemouse();
|
hidemouse(); |
| setfillstyle(0,0);
|
setfillstyle(0,0); |
| bar(480,1,638,478);
|
bar(480,1,638,478); |
| outtextxy(559,16,"AUTOMAT. OTACANIE");
|
outtextxy(559,16,"AUTOMAT. OTACANIE"); |
| rectangle(486,387,633,440);
|
rectangle(486,387,633,440); |
| rectangle(486,297,633,350);
|
rectangle(486,297,633,350); |
| rectangle(486,207,633,260);
|
rectangle(486,207,633,260); |
| rectangle(486,40,526,70);
|
rectangle(486,40,526,70); |
| rectangle(593,40,633,70);
|
rectangle(593,40,633,70); |
| rectangle(486,90,526,120);
|
rectangle(486,90,526,120); |
| rectangle(593,90,633,120);
|
rectangle(593,90,633,120); |
| rectangle(486,140,526,170);
|
rectangle(486,140,526,170); |
| rectangle(593,140,633,170);
|
rectangle(593,140,633,170); |
| setcolor(GREEN);
|
setcolor(GREEN); |
| outtextxy(559,55,"X");
|
outtextxy(559,55,"X"); |
| outtextxy(559,105,"Y");
|
outtextxy(559,105,"Y"); |
| outtextxy(559,155,"Z");
|
outtextxy(559,155,"Z"); |
| setcolor(RED);
|
setcolor(RED); |
| outtextxy(506,55,"+");
|
outtextxy(506,55,"+"); |
| outtextxy(506,105,"+");
|
outtextxy(506,105,"+"); |
| outtextxy(506,155,"+");
|
outtextxy(506,155,"+"); |
| setcolor(LIGHTBLUE);
|
setcolor(LIGHTBLUE); |
| outtextxy(612,55,"-");
|
outtextxy(612,55,"-"); |
| outtextxy(612,105,"-");
|
outtextxy(612,105,"-"); |
| outtextxy(612,155,"-");
|
outtextxy(612,155,"-"); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| outtextxy(559,250,"POKRACOVANIE");
|
outtextxy(559,250,"POKRACOVANIE"); |
| outtextxy(559,340,"STOP");
|
outtextxy(559,340,"STOP"); |
| outtextxy(559,430,"HLAVNE MENU");
|
outtextxy(559,430,"HLAVNE MENU"); |
| showmouse();
|
showmouse(); |
| delay(50);
|
delay(50); |
| q = MODE_AUTOMATIC_TURNING;
|
q = MODE_AUTOMATIC_TURNING; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /********************** POKRACOVANIE OTACANIA *******************************/
|
/********************** POKRACOVANIE OTACANIA *******************************/ |
| void CONTINUE(void) /* {{{ */
|
void CONTINUE(void) /* {{{ */ |
| {
|
{ |
| if (stop==1);{
|
if (stop==1);{ |
| POSUNX=POSXOLD;
|
POSUNX=POSXOLD; |
| POSUNY=POSYOLD;
|
POSUNY=POSYOLD; |
| POSUNZ=POSZOLD;
|
POSUNZ=POSZOLD; |
| stop=0;
|
stop=0; |
| }
|
} |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /************************** ZASTAVENIE OTACANIA *****************************/
|
/************************** ZASTAVENIE OTACANIA *****************************/ |
| void STOP(void) /* {{{ */
|
void STOP(void) /* {{{ */ |
| {
|
{ |
| if (stop!=1) {
|
if (stop!=1) { |
| POSXOLD=POSUNX;
|
POSXOLD=POSUNX; |
| POSYOLD=POSUNY;
|
POSYOLD=POSUNY; |
| POSZOLD=POSUNZ;
|
POSZOLD=POSUNZ; |
| POSUNX=0;
|
POSUNX=0; |
| POSUNY=0;
|
POSUNY=0; |
| POSUNZ=0;
|
POSUNZ=0; |
| stop=1;
|
stop=1; |
| }
|
} |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /************************* MANUALNE OTACANIE ********************************/
|
/************************* MANUALNE OTACANIE ********************************/ |
| void manual(void) /* {{{ */
|
void manual(void) /* {{{ */ |
| {
|
{ |
| hidemouse();
|
hidemouse(); |
| setfillstyle(0,0);
|
setfillstyle(0,0); |
| bar(480,1,638,478);
|
bar(480,1,638,478); |
| STOP();
|
STOP(); |
| rectangle(486,40,526,70);
|
rectangle(486,40,526,70); |
| rectangle(593,40,633,70);
|
rectangle(593,40,633,70); |
| rectangle(486,90,526,120);
|
rectangle(486,90,526,120); |
| rectangle(593,90,633,120);
|
rectangle(593,90,633,120); |
| rectangle(486,140,526,170);
|
rectangle(486,140,526,170); |
| rectangle(593,140,633,170);
|
rectangle(593,140,633,170); |
| rectangle(486,387,633,440);
|
rectangle(486,387,633,440); |
| outtextxy(559,16,"MANUALNE OTACANIE");
|
outtextxy(559,16,"MANUALNE OTACANIE"); |
| setcolor(GREEN);
|
setcolor(GREEN); |
| outtextxy(559,55,"X");
|
outtextxy(559,55,"X"); |
| outtextxy(559,105,"Y");
|
outtextxy(559,105,"Y"); |
| outtextxy(559,155,"Z");
|
outtextxy(559,155,"Z"); |
| setcolor(RED);
|
setcolor(RED); |
| outtextxy(506,55,"+");
|
outtextxy(506,55,"+"); |
| outtextxy(506,105,"+");
|
outtextxy(506,105,"+"); |
| outtextxy(506,155,"+");
|
outtextxy(506,155,"+"); |
| setcolor(LIGHTBLUE);
|
setcolor(LIGHTBLUE); |
| outtextxy(612,55,"-");
|
outtextxy(612,55,"-"); |
| outtextxy(612,105,"-");
|
outtextxy(612,105,"-"); |
| outtextxy(612,155,"-");
|
outtextxy(612,155,"-"); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| outtextxy(559,430,"HLAVNE MENU");
|
outtextxy(559,430,"HLAVNE MENU"); |
| showmouse();
|
showmouse(); |
| q = MODE_MANUAL_TURNING;
|
q = MODE_MANUAL_TURNING; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /*************************** FILE SELECTOR **********************************/
|
/*************************** FILE SELECTOR **********************************/ |
| void file_selector(int mode, int item) /* {{{ */
|
void file_selector(int mode, int item) /* {{{ */ |
| {
|
{ |
| register int i;
|
register int i; |
| static int files_offset = 0, directories_offset = 0;
|
static int files_offset = 0, directories_offset = 0; |
| static int files_size = 0, directories_size = 0;
|
static int files_size = 0, directories_size = 0; |
| static char **directories = NULL;
|
static char **directories = NULL; |
| static char **files = NULL;
|
static char **files = NULL; |
| char out_str[18];
|
char out_str[18]; |
| if (mode == MODE_SELECTED_DIRECTORY) {
|
if (mode == MODE_SELECTED_DIRECTORY) { |
| item += directories_offset;
|
item += directories_offset; |
| if (item >= 0 && item < directories_size)
|
if (item >= 0 && item < directories_size) |
| chdir(directories[item]);
|
chdir(directories[item]); |
| if (directories != NULL)
|
if (directories != NULL) |
| free_directories_or_files(directories);
|
free_directories_or_files(directories); |
| if (files != NULL)
|
if (files != NULL) |
| free_directories_or_files(files);
|
free_directories_or_files(files); |
| directories = NULL;
|
directories = NULL; |
| files = NULL;
|
files = NULL; |
| files_offset = 0;
|
files_offset = 0; |
| directories_offset = 0;
|
directories_offset = 0; |
| } else if (mode == MODE_SELECTED_FILE) {
|
} else if (mode == MODE_SELECTED_FILE) { |
| item += files_offset;
|
item += files_offset; |
| if (item >= 0 && item < files_size) {
|
if (item >= 0 && item < files_size) { |
| vykresli(BLACK);
|
vykresli(BLACK); |
| if (open_3do_file(files[item])) {
|
if (open_3do_file(files[item])) { |
| settextjustify(LEFT_TEXT, TOP_TEXT);
|
settextjustify(LEFT_TEXT, TOP_TEXT); |
| bar(1, 1, 470, 11);
|
bar(1, 1, 470, 11); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| outtextxy(1, 1, files[item]);
|
outtextxy(1, 1, files[item]); |
| settextjustify(CENTER_TEXT, CENTER_TEXT);
|
settextjustify(CENTER_TEXT, CENTER_TEXT); |
| }
|
} |
| vykresli(WHITE);
|
vykresli(WHITE); |
| }
|
} |
| } else if (mode == MODE_SELECTED_DIRECTORY_MOVE) {
|
} else if (mode == MODE_SELECTED_DIRECTORY_MOVE) { |
| directories_offset += item;
|
directories_offset += item; |
| directories_offset = min(directories_size - 14, directories_offset);
|
directories_offset = min(directories_size - 14, directories_offset); |
| directories_offset = max(0, directories_offset);
|
directories_offset = max(0, directories_offset); |
| } else if (mode == MODE_SELECTED_FILE_MOVE) {
|
} else if (mode == MODE_SELECTED_FILE_MOVE) { |
| files_offset += item;
|
files_offset += item; |
| files_offset = min(files_size - 14, files_offset);
|
files_offset = min(files_size - 14, files_offset); |
| files_offset = max(0, files_offset);
|
files_offset = max(0, files_offset); |
| }
|
} |
| if (directories == NULL && files == NULL) {
|
if (directories == NULL && files == NULL) { |
| get_directories_and_files(&directories, &files);
|
get_directories_and_files(&directories, &files); |
| for (i = 0; directories != NULL && directories[i] != NULL; i++);
|
for (i = 0; directories != NULL && directories[i] != NULL; i++); |
| directories_size = i;
|
directories_size = i; |
| for (i = 0; files != NULL && files[i] != NULL; i++);
|
for (i = 0; files != NULL && files[i] != NULL; i++); |
| files_size = i;
|
files_size = i; |
| }
|
} |
| if (q != MODE_FILE_SELECTION
|
if (q != MODE_FILE_SELECTION |
| || mode == MODE_SELECTED_DIRECTORY
|
|| mode == MODE_SELECTED_DIRECTORY |
| || mode == MODE_SELECTED_DIRECTORY_MOVE
|
|| mode == MODE_SELECTED_DIRECTORY_MOVE |
| || mode == MODE_SELECTED_FILE_MOVE) {
|
|| mode == MODE_SELECTED_FILE_MOVE) { |
| hidemouse();
|
hidemouse(); |
| setfillstyle(0,0);
|
setfillstyle(0,0); |
| bar(480,1,638,478);
|
bar(480,1,638,478); |
| outtextxy(559,16,"OTVORENIE SUBORU");
|
outtextxy(559,16,"OTVORENIE SUBORU"); |
| rectangle(486,387,633,440);
|
rectangle(486,387,633,440); |
| outtextxy(559,430,"HLAVNE MENU");
|
outtextxy(559,430,"HLAVNE MENU"); |
| /* directories box */
|
/* directories box */ |
| rectangle(486,37,633,185);
|
rectangle(486,37,633,185); |
| rectangle(486,190,505,200);
|
rectangle(486,190,505,200); |
| rectangle(509,190,524,200);
|
rectangle(509,190,524,200); |
| rectangle(595,190,610,200);
|
rectangle(595,190,610,200); |
| rectangle(614,190,633,200);
|
rectangle(614,190,633,200); |
| setcolor(directories_offset == 0 ? LIGHTGRAY: WHITE);
|
setcolor(directories_offset == 0 ? LIGHTGRAY: WHITE); |
| outtextxy(496, 196, "<<");
|
outtextxy(496, 196, "<<"); |
| outtextxy(517, 196, "<");
|
outtextxy(517, 196, "<"); |
| setcolor(directories_offset == max(0, directories_size - 14) ? LIGHTGRAY : WHITE);
|
setcolor(directories_offset == max(0, directories_size - 14) ? LIGHTGRAY : WHITE); |
| outtextxy(603, 196, ">");
|
outtextxy(603, 196, ">"); |
| outtextxy(624, 196, ">>");
|
outtextxy(624, 196, ">>"); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| sprintf(out_str, "[%d]", directories_size);
|
sprintf(out_str, "[%d]", directories_size); |
| outtextxy(559, 196, out_str);
|
outtextxy(559, 196, out_str); |
| /* files box */
|
/* files box */ |
| rectangle(486,207,633,355);
|
rectangle(486,207,633,355); |
| rectangle(486,360,505,370);
|
rectangle(486,360,505,370); |
| rectangle(509,360,524,370);
|
rectangle(509,360,524,370); |
| rectangle(595,360,610,370);
|
rectangle(595,360,610,370); |
| rectangle(614,360,633,370);
|
rectangle(614,360,633,370); |
| setcolor(files_offset == 0 ? LIGHTGRAY : WHITE);
|
setcolor(files_offset == 0 ? LIGHTGRAY : WHITE); |
| outtextxy(496, 366, "<<");
|
outtextxy(496, 366, "<<"); |
| outtextxy(517, 366, "<");
|
outtextxy(517, 366, "<"); |
| setcolor(files_offset == max(0, files_size - 14) ? LIGHTGRAY : WHITE);
|
setcolor(files_offset == max(0, files_size - 14) ? LIGHTGRAY : WHITE); |
| outtextxy(603, 366, ">");
|
outtextxy(603, 366, ">"); |
| outtextxy(624, 366, ">>");
|
outtextxy(624, 366, ">>"); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| sprintf(out_str, "[%d]", files_size);
|
sprintf(out_str, "[%d]", files_size); |
| outtextxy(559, 366, out_str);
|
outtextxy(559, 366, out_str); |
| settextjustify(LEFT_TEXT, CENTER_TEXT);
|
settextjustify(LEFT_TEXT, CENTER_TEXT); |
| for (i = 0; directories != NULL && directories[i] != NULL && i < 14; i++) {
|
for (i = 0; directories != NULL && directories[i] != NULL && i < 14; i++) { |
| strncpy(out_str, directories[i + directories_offset], 18);
|
strncpy(out_str, directories[i + directories_offset], 18); |
| if (strlen(directories[i + directories_offset]) > 17)
|
if (strlen(directories[i + directories_offset]) > 17) |
| strcpy(out_str + 15, "...");
|
strcpy(out_str + 15, "..."); |
| outtextxy(490, 47 + i * 10, out_str);
|
outtextxy(490, 47 + i * 10, out_str); |
| }
|
} |
| for (i = 0; files != NULL && files[i] != NULL && i < 14; i++) {
|
for (i = 0; files != NULL && files[i] != NULL && i < 14; i++) { |
| strncpy(out_str, files[i + files_offset], 18);
|
strncpy(out_str, files[i + files_offset], 18); |
| if (strlen(files[i + files_offset]) > 17)
|
if (strlen(files[i + files_offset]) > 17) |
| strcpy(out_str + 15, "...");
|
strcpy(out_str + 15, "..."); |
| outtextxy(490, 217 + i * 10, out_str);
|
outtextxy(490, 217 + i * 10, out_str); |
| }
|
} |
| settextjustify(CENTER_TEXT, CENTER_TEXT);
|
settextjustify(CENTER_TEXT, CENTER_TEXT); |
| showmouse();
|
showmouse(); |
| if ((mode != MODE_SELECTED_DIRECTORY_MOVE || abs(item) > 1)
|
if ((mode != MODE_SELECTED_DIRECTORY_MOVE || abs(item) > 1) |
| && (mode != MODE_SELECTED_FILE_MOVE || abs(item) > 1))
|
&& (mode != MODE_SELECTED_FILE_MOVE || abs(item) > 1)) |
| delay(160);
|
delay(160); |
| }
|
} |
| q = MODE_FILE_SELECTION;
|
q = MODE_FILE_SELECTION; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /**************************** INFORMACIE ************************************/
|
/**************************** INFORMACIE ************************************/ |
| void info(void) /* {{{ */
|
void info(void) /* {{{ */ |
| {
|
{ |
| hidemouse();
|
hidemouse(); |
| setfillstyle(0,0);
|
setfillstyle(0,0); |
| bar(480,1,638,478);
|
bar(480,1,638,478); |
| outtextxy(559,16,"INFORMACIE");
|
outtextxy(559,16,"INFORMACIE"); |
| rectangle(486,387,633,440);
|
rectangle(486,387,633,440); |
| outtextxy(559,430,"HLAVNE MENU");
|
outtextxy(559,430,"HLAVNE MENU"); |
| showmouse();
|
showmouse(); |
| delay(50);
|
delay(50); |
| q = MODE_INFORMATION;
|
q = MODE_INFORMATION; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /*************************** QUIT *******************************************/
|
/*************************** QUIT *******************************************/ |
| void quit(void) /* {{{ */
|
void quit(void) /* {{{ */ |
| {
|
{ |
| hidemouse();
|
hidemouse(); |
| setfillstyle(0,0);
|
setfillstyle(0,0); |
| bar(480,1,638,478);
|
bar(480,1,638,478); |
| rectangle(486,387,633,440);
|
rectangle(486,387,633,440); |
| rectangle(486,297,633,350);
|
rectangle(486,297,633,350); |
| outtextxy(559,16,"KONIEC PROGRAMU?");
|
outtextxy(559,16,"KONIEC PROGRAMU?"); |
| setcolor(RED);
|
setcolor(RED); |
| outtextxy(559,340,"ANO");
|
outtextxy(559,340,"ANO"); |
| setcolor(LIGHTBLUE);
|
setcolor(LIGHTBLUE); |
| outtextxy(559,430,"NIE");
|
outtextxy(559,430,"NIE"); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| showmouse();
|
showmouse(); |
| delay(100);
|
delay(100); |
| q = MODE_EXIT_DIALOG;
|
q = MODE_EXIT_DIALOG; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /******************** VYKRESLENIE OBJEKTU Z 3D DO 2D ************************/
|
/******************** VYKRESLENIE OBJEKTU Z 3D DO 2D ************************/ |
| void vykresli(int color) /* {{{ */
|
void vykresli(int color) /* {{{ */ |
| {
|
{ |
| register int x1,x2,y1,y2;
|
register int x1,x2,y1,y2; |
| register double sin_ALFA, cos_ALFA, sin_BETA, cos_BETA;
|
register double sin_ALFA, cos_ALFA, sin_BETA, cos_BETA; |
| sin_ALFA = sin(ALFA);
|
sin_ALFA = sin(ALFA); |
| cos_ALFA = cos(ALFA);
|
cos_ALFA = cos(ALFA); |
| sin_BETA = sin(BETA);
|
sin_BETA = sin(BETA); |
| cos_BETA = cos(BETA);
|
cos_BETA = cos(BETA); |
| setcolor(color);
|
setcolor(color); |
| hidemouse();
|
hidemouse(); |
| for (k=1;k<=pocbod;k++) {
|
for (k=1;k<=pocbod;k++) { |
| for (l=1;l<=pocspoj[k];l++) {
|
for (l=1;l<=pocspoj[k];l++) { |
| x1=-bodx[k]*cos_ALFA+body[k]*cos_BETA;
|
x1=-bodx[k]*cos_ALFA+body[k]*cos_BETA; |
| y1=bodx[k]*sin_ALFA+body[k]*sin_BETA-bodz[k];
|
y1=bodx[k]*sin_ALFA+body[k]*sin_BETA-bodz[k]; |
| x2=-bodx[spoj[k][l]]*cos_ALFA+body[spoj[k][l]]*cos_BETA;
|
x2=-bodx[spoj[k][l]]*cos_ALFA+body[spoj[k][l]]*cos_BETA; |
| y2=bodx[spoj[k][l]]*sin_ALFA+body[spoj[k][l]]*sin_BETA-bodz[spoj[k][l]];
|
y2=bodx[spoj[k][l]]*sin_ALFA+body[spoj[k][l]]*sin_BETA-bodz[spoj[k][l]]; |
| if (x1<-238)x1=-238;
|
if (x1<-238)x1=-238; |
| if (x1>238)x1=238;
|
if (x1>238)x1=238; |
| if (x2<-238)x2=-238;
|
if (x2<-238)x2=-238; |
| if (x2>238)x2=238;
|
if (x2>238)x2=238; |
| if (y1<-238)y1=-238;
|
if (y1<-238)y1=-238; |
| if (y1>238)y1=238;
|
if (y1>238)y1=238; |
| if (y2<-238)y2=-238;
|
if (y2<-238)y2=-238; |
| if (y2>238)y2=238;
|
if (y2>238)y2=238; |
| line(240+x1,240+y1,240+x2,240+y2);
|
line(240+x1,240+y1,240+x2,240+y2); |
| }
|
} |
| }
|
} |
| showmouse();
|
showmouse(); |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /******************** POSUNUTIE PODLA OSI X,Y,Z *****************************/
|
/******************** POSUNUTIE PODLA OSI X,Y,Z *****************************/ |
| void posun(void) /* {{{ */
|
void posun(void) /* {{{ */ |
| {
|
{ |
| int xbod,ybod,zbod;
|
int xbod,ybod,zbod; |
| for (k=1;k<=pocbod;k++) {
|
for (k=1;k<=pocbod;k++) { |
| xbod=bodxbase[k];
|
xbod=bodxbase[k]; |
| ybod=bodybase[k];
|
ybod=bodybase[k]; |
| zbod=bodzbase[k];
|
zbod=bodzbase[k]; |
| if (p&OSX) {
|
if (p&OSX) { |
| int newpoint;
|
int newpoint; |
| newpoint=xbod*cos(ALFAZ)-ybod*sin(ALFAZ);
|
newpoint=xbod*cos(ALFAZ)-ybod*sin(ALFAZ); |
| ybod=xbod*sin(ALFAZ)+ybod*cos(ALFAZ);
|
ybod=xbod*sin(ALFAZ)+ybod*cos(ALFAZ); |
| xbod=newpoint;
|
xbod=newpoint; |
| }
|
} |
| if (p&OSY) {
|
if (p&OSY) { |
| int newpoint;
|
int newpoint; |
| newpoint=xbod*cos(ALFAY)+zbod*sin(ALFAY);
|
newpoint=xbod*cos(ALFAY)+zbod*sin(ALFAY); |
| zbod=-xbod*sin(ALFAY)+zbod*cos(ALFAY);
|
zbod=-xbod*sin(ALFAY)+zbod*cos(ALFAY); |
| xbod=newpoint;
|
xbod=newpoint; |
| }
|
} |
| if (p&OSZ) {
|
if (p&OSZ) { |
| int newpoint;
|
int newpoint; |
| newpoint=ybod*cos(ALFAX)-zbod*sin(ALFAX);
|
newpoint=ybod*cos(ALFAX)-zbod*sin(ALFAX); |
| zbod=ybod*sin(ALFAX)+zbod*cos(ALFAX);
|
zbod=ybod*sin(ALFAX)+zbod*cos(ALFAX); |
| ybod=newpoint;
|
ybod=newpoint; |
| }
|
} |
| bodx[k]=xbod;
|
bodx[k]=xbod; |
| body[k]=ybod;
|
body[k]=ybod; |
| bodz[k]=zbod;
|
bodz[k]=zbod; |
| }
|
} |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /**** ISINBAR (ZISTENIE POZICIE KURZORU VZHLADOM NA PLOCHU X1,Y1,X2,Y2) *****/
|
/**** ISINBAR (ZISTENIE POZICIE KURZORU VZHLADOM NA PLOCHU X1,Y1,X2,Y2) *****/ |
| BYTE isinbar(int x1,int y1,int x2,int y2) /* {{{ */
|
BYTE isinbar(int x1,int y1,int x2,int y2) /* {{{ */ |
| {
|
{ |
| WORD xx,yy;
|
WORD xx,yy; |
| if ((x1>x2)&&(y1>y2)) {
|
if ((x1>x2)&&(y1>y2)) { |
| if ((getmousepos(&xx,&yy)==1)&&(xx<x1)&&(xx>x2)&&(yy<y1)&&(yy>y2))return(1);
|
if ((getmousepos(&xx,&yy)==1)&&(xx<x1)&&(xx>x2)&&(yy<y1)&&(yy>y2))return(1); |
| else return(0);
|
else return(0); |
| }
|
} |
| if ((x1>x2)&&(y1<y2)) {
|
if ((x1>x2)&&(y1<y2)) { |
| if ((getmousepos(&xx,&yy)==1)&&(xx<x1)&&(xx>x2)&&(yy<y2)&&(yy>y1))return(1);
|
if ((getmousepos(&xx,&yy)==1)&&(xx<x1)&&(xx>x2)&&(yy<y2)&&(yy>y1))return(1); |
| else return(0);
|
else return(0); |
| }
|
} |
| if ((x1<x2)&&(y1>y2)) {
|
if ((x1<x2)&&(y1>y2)) { |
| if ((getmousepos(&xx,&yy)==1)&&(xx<x2)&&(xx>x1)&&(yy<y1)&&(yy>y2))return(1);
|
if ((getmousepos(&xx,&yy)==1)&&(xx<x2)&&(xx>x1)&&(yy<y1)&&(yy>y2))return(1); |
| else return(0);
|
else return(0); |
| }
|
} |
| if ((x1<x2)&&(y1<y2)) {
|
if ((x1<x2)&&(y1<y2)) { |
| if ((getmousepos(&xx,&yy)==1)&&(xx<x2)&&(xx>x1)&&(yy<y2)&&(yy>y1))return(1);
|
if ((getmousepos(&xx,&yy)==1)&&(xx<x2)&&(xx>x1)&&(yy<y2)&&(yy>y1))return(1); |
| else return(0);
|
else return(0); |
| }
|
} |
| return(0);
|
return(0); |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /**************************** OPEN 3DO FILE *********************************/
|
/**************************** OPEN 3DO FILE *********************************/ |
| int open_3do_file(const char *filename) /* {{{ */
|
int open_3do_file(const char *filename) /* {{{ */ |
| {
|
{ |
| FILE *f;
|
FILE *f; |
| if ((f = fopen(filename, "rt")) == NULL) {
|
if ((f = fopen(filename, "rt")) == NULL) { |
| #if 0
|
#if 0 |
| my_graph_close();
|
my_graph_close(); |
| printf("File not found. [%s]\n",filename);
|
printf("File not found. [%s]\n",filename); |
| exit(1);
|
exit(1); |
| #endif
|
#endif |
| return 0;
|
return 0; |
| }
|
} |
| if (fscanf(f,"%d",&pocbod) != 1) {
|
if (fscanf(f,"%d",&pocbod) != 1) { |
| fclose(f);
|
fclose(f); |
| return 0;
|
return 0; |
| }
|
} |
| for (k=1;k<=pocbod;k++) {
|
for (k=1;k<=pocbod;k++) { |
| fscanf(f,"%d",&bodxbase[k]);
|
fscanf(f,"%d",&bodxbase[k]); |
| fscanf(f,"%d",&bodybase[k]);
|
fscanf(f,"%d",&bodybase[k]); |
| fscanf(f,"%d",&bodzbase[k]);
|
fscanf(f,"%d",&bodzbase[k]); |
| }
|
} |
| for (k=1;k<=pocbod;k++) {
|
for (k=1;k<=pocbod;k++) { |
| fscanf(f,"%d",&pocspoj[k]);
|
fscanf(f,"%d",&pocspoj[k]); |
| for (l=1;l<=pocspoj[k];l++) {
|
for (l=1;l<=pocspoj[k];l++) { |
| fscanf(f,"%d",&spoj[k][l]);
|
fscanf(f,"%d",&spoj[k][l]); |
| }
|
} |
| }
|
} |
| fclose(f);
|
fclose(f); |
| return 1;
|
return 1; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /**************************** HLAVNY PROGRAM ********************************/
|
/**************************** HLAVNY PROGRAM ********************************/ |
| int main(int argc,char *argv[]) /* {{{ */
|
int main(int argc,char *argv[]) /* {{{ */ |
| {
|
{ |
| char pomstr[100];
|
char pomstr[100]; |
| clrscr();
|
clrscr(); |
| if ((initmouse()!=2)&&(initmouse()!=3))ERROR1();
|
if ((initmouse()!=2)&&(initmouse()!=3))ERROR1(); |
| if (argc > 1) {
|
if (argc > 1) { |
| if (strcmp(argv[1], "-h") && strcmp(argv[1], "--help"))
|
if (strcmp(argv[1], "-h") && strcmp(argv[1], "--help")) |
| (void) open_3do_file(argv[1]);
|
(void) open_3do_file(argv[1]); |
| else
|
else |
| ERROR2();
|
ERROR2(); |
| }
|
} |
| if (my_graph_init(1) < 0) {
|
if (my_graph_init(1) < 0) { |
| return 1;
|
return 1; |
| }
|
} |
| settextjustify(CENTER_TEXT, CENTER_TEXT);
|
settextjustify(CENTER_TEXT, CENTER_TEXT); |
| settextstyle(0,0,1);
|
settextstyle(0,0,1); |
| intface();
|
intface(); |
| ALFAY=0;
|
ALFAY=0; |
| ALFAX=0;
|
ALFAX=0; |
| ALFAZ=0;
|
ALFAZ=0; |
| p=OSX+OSY+OSZ;
|
p=OSX+OSY+OSZ; |
| showmouse();
|
showmouse(); |
| while (q != MODE_QUIT) {
|
while (q != MODE_QUIT) { |
| if (isinbar(486,387,633,440) == 1 && q == MODE_MAIN_MENU)
|
if (isinbar(486,387,633,440) == 1 && q == MODE_MAIN_MENU) |
| quit();
|
quit(); |
| if (isinbar(486,297,633,350) == 1 && q == MODE_MAIN_MENU)
|
if (isinbar(486,297,633,350) == 1 && q == MODE_MAIN_MENU) |
| info();
|
info(); |
| if (isinbar(486,27,633,80) == 1 && q == MODE_MAIN_MENU)
|
if (isinbar(486,27,633,80) == 1 && q == MODE_MAIN_MENU) |
| run();
|
run(); |
| if (isinbar(486,387,633,440) == 1 && q == MODE_MANUAL_TURNING) {
|
if (isinbar(486,387,633,440) == 1 && q == MODE_MANUAL_TURNING) { |
| intface();
|
intface(); |
| CONTINUE();
|
CONTINUE(); |
| }
|
} |
| if (isinbar(486,387,633,440) == 1 && q != MODE_MAIN_MENU)
|
if (isinbar(486,387,633,440) == 1 && q != MODE_MAIN_MENU) |
| intface();
|
intface(); |
| if (isinbar(486,207,633,260) == 1 && q == MODE_MAIN_MENU)
|
if (isinbar(486,207,633,260) == 1 && q == MODE_MAIN_MENU) |
| file_selector(MODE_SELECTED_NONE, 0);
|
file_selector(MODE_SELECTED_NONE, 0); |
| if (isinbar(486,117,633,170) == 1 && q == MODE_MAIN_MENU)
|
if (isinbar(486,117,633,170) == 1 && q == MODE_MAIN_MENU) |
| manual();
|
manual(); |
| if (q == MODE_FILE_SELECTION) {
|
if (q == MODE_FILE_SELECTION) { |
| int mode = MODE_SELECTED_NONE;
|
int mode = MODE_SELECTED_NONE; |
| int item = 0;
|
int item = 0; |
| if (isinbar(486,37,633,185)) {
|
if (isinbar(486,37,633,185)) { |
| mode = MODE_SELECTED_DIRECTORY;
|
mode = MODE_SELECTED_DIRECTORY; |
| } else if (isinbar(486,207,633,355)) {
|
} else if (isinbar(486,207,633,355)) { |
| mode = MODE_SELECTED_FILE;
|
mode = MODE_SELECTED_FILE; |
| } else if (isinbar(486,190,505,200)) {
|
} else if (isinbar(486,190,505,200)) { |
| mode = MODE_SELECTED_DIRECTORY_MOVE;
|
mode = MODE_SELECTED_DIRECTORY_MOVE; |
| item = -10;
|
item = -10; |
| } else if (isinbar(509,190,524,200)) {
|
} else if (isinbar(509,190,524,200)) { |
| mode = MODE_SELECTED_DIRECTORY_MOVE;
|
mode = MODE_SELECTED_DIRECTORY_MOVE; |
| item = -1;
|
item = -1; |
| } else if (isinbar(595,190,610,200)) {
|
} else if (isinbar(595,190,610,200)) { |
| mode = MODE_SELECTED_DIRECTORY_MOVE;
|
mode = MODE_SELECTED_DIRECTORY_MOVE; |
| item = 1;
|
item = 1; |
| } else if (isinbar(614,190,633,200)) {
|
} else if (isinbar(614,190,633,200)) { |
| mode = MODE_SELECTED_DIRECTORY_MOVE;
|
mode = MODE_SELECTED_DIRECTORY_MOVE; |
| item = 10;
|
item = 10; |
| } else if (isinbar(486,360,505,370)) {
|
} else if (isinbar(486,360,505,370)) { |
| mode = MODE_SELECTED_FILE_MOVE;
|
mode = MODE_SELECTED_FILE_MOVE; |
| item = -10;
|
item = -10; |
| } else if (isinbar(509,360,524,370)) {
|
} else if (isinbar(509,360,524,370)) { |
| mode = MODE_SELECTED_FILE_MOVE;
|
mode = MODE_SELECTED_FILE_MOVE; |
| item = -1;
|
item = -1; |
| } else if (isinbar(595,360,610,370)) {
|
} else if (isinbar(595,360,610,370)) { |
| mode = MODE_SELECTED_FILE_MOVE;
|
mode = MODE_SELECTED_FILE_MOVE; |
| item = 1;
|
item = 1; |
| } else if (isinbar(614,360,633,370)) {
|
} else if (isinbar(614,360,633,370)) { |
| mode = MODE_SELECTED_FILE_MOVE;
|
mode = MODE_SELECTED_FILE_MOVE; |
| item = 10;
|
item = 10; |
| }
|
} |
| if (mode != MODE_SELECTED_NONE) {
|
if (mode != MODE_SELECTED_NONE) { |
| if (item == 0) {
|
if (item == 0) { |
| getmousepos(NULL, (WORD *) &item);
|
getmousepos(NULL, (WORD *) &item); |
| item -= mode == MODE_SELECTED_FILE ? 212 : 42;
|
item -= mode == MODE_SELECTED_FILE ? 212 : 42; |
| item /= 10;
|
item /= 10; |
| item = min(13, item);
|
item = min(13, item); |
| item = max(0, item);
|
item = max(0, item); |
| }
|
} |
| file_selector(mode, item);
|
file_selector(mode, item); |
| }
|
} |
| }
|
} |
| if (q == MODE_AUTOMATIC_TURNING) {
|
if (q == MODE_AUTOMATIC_TURNING) { |
| if (stop!=1) {
|
if (stop!=1) { |
| if (isinbar(486,40,526,70)==1) {
|
if (isinbar(486,40,526,70)==1) { |
| if (POSUNX==0)p=p+OSX;
|
if (POSUNX==0)p=p+OSX; |
| if (POSUNX!=-0.001)POSUNX+=0.001;
|
if (POSUNX!=-0.001)POSUNX+=0.001; |
| else POSUNX=0;
|
else POSUNX=0; |
| POSUNX+=0.001;
|
POSUNX+=0.001; |
| if (POSUNX==0)p=p-OSX;
|
if (POSUNX==0)p=p-OSX; |
| }
|
} |
| if (isinbar(593,40,633,70)==1) {
|
if (isinbar(593,40,633,70)==1) { |
| if (POSUNX==0)p=p+OSX;
|
if (POSUNX==0)p=p+OSX; |
| if (POSUNX!=0.001)POSUNX-=0.001;
|
if (POSUNX!=0.001)POSUNX-=0.001; |
| else POSUNX=0;
|
else POSUNX=0; |
| if (POSUNX==0)p=p-OSX;
|
if (POSUNX==0)p=p-OSX; |
| }
|
} |
| if (isinbar(486,90,526,120)==1) {
|
if (isinbar(486,90,526,120)==1) { |
| if (POSUNY==0)p=p+OSY;
|
if (POSUNY==0)p=p+OSY; |
| if (POSUNY!=-0.001)POSUNY+=0.001;
|
if (POSUNY!=-0.001)POSUNY+=0.001; |
| else POSUNY=0;
|
else POSUNY=0; |
| if (POSUNY==0)p=p-OSY;
|
if (POSUNY==0)p=p-OSY; |
| }
|
} |
| if (isinbar(593,90,633,120)==1) {
|
if (isinbar(593,90,633,120)==1) { |
| if (POSUNY==0)p=p+OSY;
|
if (POSUNY==0)p=p+OSY; |
| if (POSUNY!=0.001)POSUNY-=0.001;
|
if (POSUNY!=0.001)POSUNY-=0.001; |
| else POSUNY=0;
|
else POSUNY=0; |
| if (POSUNY==0)p=p-OSY;
|
if (POSUNY==0)p=p-OSY; |
| }
|
} |
| if (isinbar(486,140,526,170)==1) {
|
if (isinbar(486,140,526,170)==1) { |
| if (POSUNZ==0)p=p+OSZ;
|
if (POSUNZ==0)p=p+OSZ; |
| if (POSUNZ!=-0.001)POSUNZ+=0.001;
|
if (POSUNZ!=-0.001)POSUNZ+=0.001; |
| else POSUNZ=0;
|
else POSUNZ=0; |
| if (POSUNZ==0)p=p-OSZ;
|
if (POSUNZ==0)p=p-OSZ; |
| }
|
} |
| if (isinbar(593,140,633,170)==1) {
|
if (isinbar(593,140,633,170)==1) { |
| if (POSUNZ==0)p=p+OSZ;
|
if (POSUNZ==0)p=p+OSZ; |
| if (POSUNZ!=0.001)POSUNZ-=0.001;
|
if (POSUNZ!=0.001)POSUNZ-=0.001; |
| else POSUNZ=0;
|
else POSUNZ=0; |
| if (POSUNZ==0)p=p-OSZ;
|
if (POSUNZ==0)p=p-OSZ; |
| }
|
} |
| }
|
} |
| if (isinbar(486,207,633,260)==1)CONTINUE();
|
if (isinbar(486,207,633,260)==1)CONTINUE(); |
| if ((isinbar(486,297,633,350)==1)&&(stop!=1))STOP();
|
if ((isinbar(486,297,633,350)==1)&&(stop!=1))STOP(); |
| setcolor(WHITE);
|
setcolor(WHITE); |
| sprintf(pomstr,"%+04.0f",POSUNX*1000);
|
sprintf(pomstr,"%+04.0f",POSUNX*1000); |
| bar(530,60,590,70);
|
bar(530,60,590,70); |
| outtextxy(555,65,pomstr);
|
outtextxy(555,65,pomstr); |
| sprintf(pomstr,"%+04.0f",POSUNY*1000);
|
sprintf(pomstr,"%+04.0f",POSUNY*1000); |
| bar(530,110,590,120);
|
bar(530,110,590,120); |
| outtextxy(555,115,pomstr);
|
outtextxy(555,115,pomstr); |
| sprintf(pomstr,"%+04.0f",POSUNZ*1000);
|
sprintf(pomstr,"%+04.0f",POSUNZ*1000); |
| bar(530,160,590,170);
|
bar(530,160,590,170); |
| outtextxy(555,165,pomstr);
|
outtextxy(555,165,pomstr); |
| }
|
} |
| if (q == MODE_EXIT_DIALOG)
|
if (q == MODE_EXIT_DIALOG) |
| if (isinbar(486,297,633,350) == 1)
|
if (isinbar(486,297,633,350) == 1) |
| q = MODE_QUIT;
|
q = MODE_QUIT; |
| if (q == MODE_MANUAL_TURNING) {
|
if (q == MODE_MANUAL_TURNING) { |
| if (isinbar(486,40,526,70) == 1) POSUNX += 0.01;
|
if (isinbar(486,40,526,70) == 1) POSUNX += 0.01; |
| if (isinbar(593,40,633,70) == 1) POSUNX -= 0.01;
|
if (isinbar(593,40,633,70) == 1) POSUNX -= 0.01; |
| if (isinbar(486,90,526,120) == 1) POSUNY += 0.01;
|
if (isinbar(486,90,526,120) == 1) POSUNY += 0.01; |
| if (isinbar(593,90,633,120) == 1) POSUNY -= 0.01;
|
if (isinbar(593,90,633,120) == 1) POSUNY -= 0.01; |
| if (isinbar(486,140,526,170) == 1) POSUNZ += 0.01;
|
if (isinbar(486,140,526,170) == 1) POSUNZ += 0.01; |
| if (isinbar(593,140,633,170) == 1) POSUNZ -= 0.01;
|
if (isinbar(593,140,633,170) == 1) POSUNZ -= 0.01; |
| }
|
} |
| my_graph_refresh();
|
my_graph_refresh(); |
| delay(50);
|
delay(50); |
| if ((POSUNX>0.0005)||(POSUNY>0.0005)||(POSUNZ>0.0005)
|
if ((POSUNX>0.0005)||(POSUNY>0.0005)||(POSUNZ>0.0005) |
| ||(POSUNX<-0.0005)||(POSUNY<-0.0005)||(POSUNZ<-0.0005)) {
|
||(POSUNX<-0.0005)||(POSUNY<-0.0005)||(POSUNZ<-0.0005)) { |
| vykresli(BLACK);
|
vykresli(BLACK); |
| if (POSUNX!=0) {
|
if (POSUNX!=0) { |
| if (ALFAX>=180)ALFAX=0;
|
if (ALFAX>=180)ALFAX=0; |
| else ALFAX+=POSUNX;
|
else ALFAX+=POSUNX; |
| }
|
} |
|
|
|
| if (POSUNY!=0) {
|
if (POSUNY!=0) { |
| if (ALFAY>=180)ALFAY=0;
|
if (ALFAY>=180)ALFAY=0; |
| else ALFAY+=POSUNY;
|
else ALFAY+=POSUNY; |
| }
|
} |
|
|
|
| if (POSUNZ!=0) {
|
if (POSUNZ!=0) { |
| if (ALFAZ>=180)ALFAZ=0;
|
if (ALFAZ>=180)ALFAZ=0; |
| else ALFAZ+=POSUNZ;
|
else ALFAZ+=POSUNZ; |
| }
|
} |
|
|
|
| posun();
|
posun(); |
| vykresli(WHITE);
|
vykresli(WHITE); |
| }
|
} |
| if (q == MODE_MANUAL_TURNING) {
|
if (q == MODE_MANUAL_TURNING) { |
| POSUNX=0;
|
POSUNX=0; |
| POSUNY=0;
|
POSUNY=0; |
| POSUNZ=0;
|
POSUNZ=0; |
| }
|
} |
| }
|
} |
| my_graph_close();
|
my_graph_close(); |
| clrscr();
|
clrscr(); |
| endstring("3do-view");
|
endstring("3do-view"); |
| textcolor(0x07);cputs("\r\n\nEspecially thanX 2 ");
|
textcolor(0x07);cputs("\r\n\nEspecially thanX 2 "); |
| textcolor(11);cputs("Stefan Soun ");
|
textcolor(11);cputs("Stefan Soun "); |
| textcolor(0x07);cputs("a.k.a. ");
|
textcolor(0x07);cputs("a.k.a. "); |
| textcolor(128+0x0f);cputs("Pysta");
|
textcolor(128+0x0f);cputs("Pysta"); |
| return 0;
|
return 0; |
| } /* }}} */
|
} /* }}} */ |
|
|
|
| /* Modeline for ViM {{{
|
/* Modeline for ViM {{{ |
| * vim: set ts=4:
|
* vim: set ts=4: |
| * vim600: fdm=marker fdl=0 fdc=0:
|
* vim600: fdm=marker fdl=0 fdc=0: |
| * }}} */
|
* }}} */ |
|
|
|