/**
 *  MouseFinish is called when you are done with the mouse module
 *  and no longer need it.  All hooks and variables are changed to non-
 *  active mode and you can consider it no longer being used.
 *
 *<!-----------------------------------------------------------------------*/
T_void MouseFinish(T_void)
{
    DebugRoutine("MouseFinish") ;
    DebugCheck(F_MouseIsInitialized == TRUE) ;
    DebugCheck(G_mouseShowLevel < 2) ;

    DebugCheck(G_eventStack != DOUBLE_LINK_LIST_BAD) ;
    DoubleLinkListDestroy(G_eventStack) ;

    /* Hide the mouse. */
    MouseHide() ;

    /* Turn off the event handler. */
    MouseSetEventHandler(NULL) ;

    /* Set the default options. */
    MouseSetEventOptions(MOUSE_EVENT_DEFAULT_OPTIONS) ;

    /* Allow the mouse to move all over the screen. */
    MouseReleaseBounds() ;

    /* Note that the mouse module is no longer in use. */
    F_MouseIsInitialized = FALSE ;

    /* Free up the mouse background screen. */
    GrScreenFree(G_mouseScreen) ;
#ifdef DOS32
    IMouseUninstallCallback() ;
#endif
    DebugEnd() ;
}
Example #2
0
int ConfirmAF(TUnit *u, TUnit *t)
{
    char b[200];
    int cm;
    static int last_cm = 0;

    if (ConAF_always) return TRUE;
    if (ConAF_table[u->ID]) return FALSE;
    switch (u->GetType()) {
        case unBumerang : case unPerseusAlfa : case unPerseusBeta :
        case unFalanga : case unPagoda : case unFlint :
        case unHorizont :
            return TRUE; break;
    }

    sprintf(b, SigText[TXT_READYSHOOT], u->GetName(), t->GetName());
    MouseShow();
    ShowHelpers();
    ShowHelpers();
    cm = PromtBox(b, cmYes | cmNo | cmAlways);
    HideHelpers();
    HideHelpers();
    MouseHide();
    if (cm == cmAlways) ConAF_always = TRUE;
    if (cm == cmNo) ConAF_table[u->ID] = TRUE;
    last_cm = cm;
    ConAF_unit = t;
    ConAF_used = TRUE;
    return (cm != cmNo);
}
Example #3
0
void TContainer::Draw()
{
  MouseHide ();
  TShape f(Bounds, shptype, 2, EGA_DARKGRAY, EGA_WHITE);
  f.bg = shpbg;
  f.Draw();
  TGroup::Draw();
  MouseShow ();
}
Example #4
0
void TTransBox::Hide(int fast)
{
	MouseHide();
	if (iniEnhancedGuiOn && (!fast))
		for (int i = 0; i < w; i += w/OPEN_STEP) {Draw(i); SDL_Delay(15);}
	PutBitmap32(x, y, Bkg, w, h);
	MouseShow();
	unlockmem(Buf, w * h); unlockmem(Bkg, w * h);
	memfree(Bkg);
	memfree(Buf);
}
Example #5
0
void BriefScrollUp(int Num)
{
    int OldOfs = Ofset;
  if (Ofset-Num < 0) Ofset = 0;
  else Ofset -= Num;
    if (OldOfs != Ofset) {
    MouseHide();
    BriefRedrawScr();
    MouseShow();
  }
}
Example #6
0
void BriefScrollDown(int Num)
{
    int OldOfs = Ofset;
  if (Ofset+Num > BigBufLines-MinNumOfYPixels) Ofset = BigBufLines-MinNumOfYPixels;
  else Ofset += Num;
    
    if (OldOfs != Ofset) {
    MouseHide();
    BriefRedrawScr();
    MouseShow();
  }
}
Example #7
0
void TTransBox::Show(int fast)
{
	Buf = (byte*) memalloc(w * h);
	Bkg = (byte*) memalloc(w * h);
	lockmem(Buf, w * h); lockmem(Bkg, w * h);
	GetBitmap32(x, y, Bkg, w, h);

	MouseHide();
	if (iniEnhancedGuiOn && (!fast))
		for (int i = w; i > 0; i -= w/OPEN_STEP) {Draw(i); SDL_Delay(15);}
	memcpy(Buf, Templ, w * h);
	Draw(0);
	MouseShow();
}
Example #8
0
void MouseSetCursor(int cnum)
{
	if (Mouse.ActCur == cnum) return;
	Mouse.SuperLocks++;
	MouseHide();
	Mouse.ActCur = cnum;
	switch (cnum) {
		case mcurSupport :
		case mcurArrow : Mouse.xrpt = 0; Mouse.yrpt = 0; break;
		case mcurWait : Mouse.xrpt = 16; Mouse.yrpt = 16; break;
		case mcurBuild :
		case mcurLoadIn :
		case mcurSelect : 
		case mcurSelectBig : 
		case mcurSelectSmall : 
		case mcurTarget :
		case mcurTargetBig :                
		case mcurTargetSmall : Mouse.xrpt = 16; Mouse.yrpt = 16; break;
	}
	MouseShow();
	Mouse.SuperLocks--;
}
/**
 *  MouseSetBitmap changes the picture used for the mouse and its hotspot.
 *
 *  @param hot_spot_x -- x position for hot spot
 *  @param hot_spot_y -- y position for hot spot
 *  @param p_bitmap -- COMPRESSED Bitmap to use
 *
 *<!-----------------------------------------------------------------------*/
T_void MouseSetBitmap(
          T_word16 hot_spot_x,
          T_word16 hot_spot_y,
          T_bitmap *p_bitmap)
{
    DebugRoutine("MouseSetBitmap") ;
//    DebugCheck(p_bitmap != NULL) ;

    G_hotSpotX = hot_spot_x ;
    G_hotSpotY = hot_spot_y ;

//    if (G_mouseShowLevel > 0)
//        MouseErase() ;

    MouseHide();
    G_bitmap = p_bitmap ;
    MouseShow() ;
//    if (G_mouseShowLevel > 0)
//        MouseDraw() ;

    DebugEnd() ;
}
Example #10
0
// Zakaze kurzor v dane oblasti:
void MouseFreeze(int x, int y, int w, int h)
{
	if (mouse_painting) return;
	if (Mouse.FreezeHided) {
		Mouse.FreezeHided++, Mouse.SuperLocks++; 
		return;
	}
	
	int x1 = x - (32 - Mouse.xrpt);
	int y1 = y - (32 - Mouse.yrpt); 
	int x2 = x + w + Mouse.xrpt;
	int y2 = y + h + Mouse.yrpt;
	
	int mx = Mouse.x;
	int my = Mouse.y;
	int bx = (Mouse.back_x < 0) ? mx : Mouse.back_x;
	int by = (Mouse.back_y < 0) ? my : Mouse.back_y;
	
	Mouse.SuperLocks++;
	if (((mx >= x1 && mx <= x2) && (my >= y1 && my <= y2)) || ((bx >= x1 && bx <= x2) && (by >= y1 && by <= y2))) {
		Mouse.FreezeHided++;
		MouseHide();
	}
}
Example #11
0
void DrawOnScreen(int DrawBackground)
{
    int i;
    int WordLineCnt;
    int LocalWordCnt = 0;
    int LocalPicCnt = 0;
    int PixColCnt = 0;
    int ArtCnt = -1; // Citac odstavcu
    
    double PixLineCnt;
    
    if (DrawBackground != 0) {
    void *ptr;
    char buf[20];
    sprintf(buf, "%ibriefbk", iniResolution - 0x0100);
    ptr = GraphicsDF->get(buf);
    MouseHide();
    DrawPicture(ptr);
    MouseShow();
    memfree(ptr);
  }
  
  for (i = 0; i <= NumOfLines; i++) {
    WordLineCnt = -1;
    PixLineCnt = 0;
    
    do {
      WordLineCnt++;
        LocalWordCnt++;
        
      if (WordsTypes[LocalWordCnt] == 1) {
            if (LocalWordCnt != 1) i++;
            ArtCnt++;
        PixLineCnt = GetStrWidth("  ", NormalFont);
        if (LocalWordCnt != 1) PixColCnt += ArticleSpace*2;
        WordLineCnt = 0;
        }
      if (Links[LocalWordCnt] == 0) 
        PutStr (BigDrawBuffer, LinePixels, PixLineCnt, PixColCnt,
                Words[LocalWordCnt], NormalFont, clrWhite, clrBlack);
      else {
        PutStr (BigDrawBuffer, LinePixels, PixLineCnt, PixColCnt,
                Words[LocalWordCnt], NormalFont, clrRed, clrBlack);    
        LastLink++;
        LinksXY[LastLink].x1 = PixLineCnt;
        LinksXY[LastLink].x2 = PixLineCnt+GetStrWidth(Words[LocalWordCnt],NormalFont);
        LinksXY[LastLink].y1 = PixColCnt;
        LinksXY[LastLink].y2 = PixColCnt + 16;
        Links2[LastLink] = Links[LocalWordCnt];
      }
      
      if (WordsTypes[LocalWordCnt] == 4) {
        // Obrazky (jee...)
        LocalPicCnt++;
        
        void *ptr;
        ptr = GraphicsDF->get(PicFiles[LocalPicCnt]);
        PixColCnt += 32;
        CopyBmpNZ(BigDrawBuffer, LinePixels, (LinePixels-PicSize[LocalPicCnt].x)/2, 
                  PixColCnt, ptr, PicSize[LocalPicCnt].x, PicSize[LocalPicCnt].y);
        PixColCnt += (PicSize[LocalPicCnt].y-16);
        
        memfree(ptr);
      }
            
        PixLineCnt += (double)GetStrWidth(Words[LocalWordCnt], NormalFont);
        PixLineCnt += LineSpace[i];
        
        if (WordsTypes[LocalWordCnt] == 3) goto LastWord;
                
    } while (WordsTypes[LocalWordCnt] != 2);
    PixColCnt += 16;
    
  }

  LastWord:
  
  BriefRedrawScr();
  
}
Example #12
0
void ShowCredits()
{
    char *buf;
    char line[200];
    void *ptr, *ptr2;
    char *c;
    int i, curln, lastchar;
    int oldvol = MusicVolume;
    
    TEvent e;

    SetVolume(EffectsVolume, SpeechVolume, 64);
    MouseHide();
    ClearScr();
    PlayMusic("solution.s3m");


    do {GetEvent(&e);} while (e.What != evNothing);
    e.What = evNothing;
 
    ptr = memalloc(RES_X * RES_Y);
    memset(ptr, 0, 800*600);
    ptr2 = GraphicsDF->get("mmnulogo");
    memcpy(ptr, ptr2, 800 * 140);
    memfree(ptr2);

    buf = (char*) TextsDF->get("credits");
    ptr2 = memalloc(RES_X * RES_Y);
    memcpy(ptr2, ptr, RES_X * RES_Y);
    DrawPicture(ptr);

    for (curln = 520; TRUE; curln -= 1) {
        i = 0; line[0] = 0; lastchar = 0;
        for (c = buf; *c != 0; c++) {
            if (*c == '\n') {
                line[lastchar] = 0;
                if (strcmp(line, "END") == 0) break;
                i++;
                if (strlen(line) == 0) continue;
                if ((curln + 20 * i > 60) && (curln + 20 * i < 540)) 
                    PutStr(ptr, 800, 400 - GetStrWidth(line+1, NormalFont)/2,
                           curln + 20 * i, line+1, NormalFont, 
                           (line[0] == '*') ? 9/*red*/ : 2/*white*/, 0);
                line[0] = 0; lastchar = 0;
            }
            else line[lastchar++] = *c;                
        }
        PutBitmap(0, 220, ((char*)ptr) + 220 * 800, 800, 300);
        memcpy(ptr, ptr2, 800*600);
        SDL_Delay(20);

        GetEvent(&e);
        if ((e.What == evKeyDown) || (e.What == evMouseDown)) break;
    }

    memfree(ptr);
    memfree(ptr2);
    memfree(buf);
    MouseShow();
    ClearScr();
    SetVolume(EffectsVolume, SpeechVolume, oldvol);
}