123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- #define BUILDING_OPENDOORS
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include "OpenDoor.h"
- #include "ODCore.h"
- #include "ODGen.h"
- #include "ODScrn.h"
- #include "ODKrnl.h"
- static char szANSIClearLine[3] = {27, '[', 'K'};
- static char szAvatarClearLine[2] = {22, 7};
- ODAPIDEF void ODCALL od_clr_line(void)
- {
- char *pchLine;
- INT nCharsLeft;
- INT nCount;
-
- TRACE(TRACE_API, "od_clr_line()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
-
- ODScrnGetTextInfo(&ODTextInfo);
-
- nCharsLeft = 80 - ODTextInfo.curx;
-
-
-
- if(od_control.user_avatar || od_control.user_ansi)
- {
- pchLine = (char *)szODWorkString;
- for(nCount = 0; nCount <= nCharsLeft; ++nCount) *pchLine++ = ' ';
- *pchLine = '\0';
- ODScrnEnableScrolling(0);
- ODScrnDisplayString(szODWorkString);
- ODScrnEnableScrolling(1);
- ODScrnSetCursorPos(ODTextInfo.curx, ODTextInfo.cury);
- }
-
- if(od_control.user_avatar)
- {
-
- od_disp(szAvatarClearLine, 2, FALSE);
- }
-
- else if(od_control.user_ansi)
- {
-
- od_disp(szANSIClearLine, 3, FALSE);
- }
-
- else
- {
-
-
- pchLine = (char *)szODWorkString;
- for(nCount = 0; nCount < nCharsLeft; ++nCount) *pchLine++ = ' ';
- for(nCount = 0; nCount < nCharsLeft; ++nCount) *pchLine++ = 8;
- *pchLine='\0';
-
- od_disp(szODWorkString, strlen(szODWorkString), TRUE);
- }
- OD_API_EXIT();
- }
- ODAPIDEF void ODCALL od_set_cursor(INT nRow, INT nColumn)
- {
- static char szControlSequence[40];
-
- TRACE(TRACE_API, "od_set_cursor()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
-
- if(nRow < 1 || nColumn < 1)
- {
- od_control.od_error = ERR_PARAMETER;
- return;
- }
-
- if(od_control.user_avatar)
- {
-
- ODScrnSetCursorPos((BYTE)nColumn, (BYTE)nRow);
-
- szControlSequence[0] = 22;
- szControlSequence[1] = 8;
- szControlSequence[2] = nRow;
- szControlSequence[3] = nColumn;
-
- od_disp(szControlSequence, 4, FALSE);
- }
-
- else if(od_control.user_ansi)
- {
-
- sprintf(szControlSequence, "x[%d;%dH", nRow, nColumn);
- szControlSequence[0] = 27;
-
- od_disp(szControlSequence, strlen(szControlSequence), FALSE);
-
- ODScrnSetCursorPos((BYTE)nColumn, (BYTE)nRow);
- }
- else
- {
-
-
- od_control.od_error = ERR_NOGRAPHICS;
- }
- OD_API_EXIT();
- }
- ODAPIDEF void ODCALL od_get_cursor(INT *pnRow, INT *pnColumn)
- {
- tODScrnTextInfo TextInfo;
-
- TRACE(TRACE_API, "od_get_cursor()");
-
- if(!bODInitialized) od_init();
- OD_API_ENTRY();
-
- if(pnRow == NULL && pnColumn == NULL)
- {
- od_control.od_error = ERR_PARAMETER;
- OD_API_EXIT();
- return;
- }
-
- ODScrnGetTextInfo(&TextInfo);
-
-
- if(pnRow != NULL) *pnRow = (INT)TextInfo.cury;
- if(pnColumn != NULL) *pnColumn = (INT)TextInfo.curx;
- OD_API_EXIT();
- }
|