Пример #1
0
T_hash32Item Hash32Find(T_hash32 hash, T_word32 key)
{
    T_hash32Struct *p_hash ;
    T_hash32ItemStruct *p_item = HASH32_ITEM_BAD ;
    T_doubleLinkListElement element ;
    T_doubleLinkList list ;
    T_hash32ItemStruct *p_itemSearch ;

    DebugRoutine("Hash32Find") ;

    /* Make sure this is a valid hash table type. */
    DebugCheck(hash != HASH32_BAD) ;
    if (hash != HASH32_BAD)  {
        /* Get a quick pointer to the header. */
        p_hash = (T_hash32Struct *)hash ;

        /* Make sure this is a pointer to a not already dead */
        /* hash table. */
        DebugCheck(p_hash->tag == HASH32_TAG) ;
        if (p_hash->tag == HASH32_TAG)  {
            /* Find the list that the element is definitely in. */
            list = p_hash->p_index[key & p_hash->keyMask] ;

            /* Search the list for a matching key. */
            element = DoubleLinkListGetFirst(list) ;
            while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)  {
                /* Get the item in this list. */
                p_itemSearch = (T_hash32ItemStruct *)
                    DoubleLinkListElementGetData(element) ;

                /* See if the keys match */
                if (p_itemSearch->key == key)  {
                    /* Grab it and break out of this linear search. */
                    p_item = p_itemSearch ;
                    break ;
                }

                /* Find the next element. */
                element = DoubleLinkListElementGetNext(element) ;
            }
        }
    }

    DebugEnd() ;

    /* Return what we found. */
    return ((T_hash32Item)p_item) ;
}
Пример #2
0
T_void HardFormStartTest(T_word32 formNum)
{
    DebugRoutine("HardFormStartTest");
    DebugCheck(formNum < HARD_FORM_UNKNOWN);

    SpellsInitSpells();

    GrDrawRectangle(
            4,
            4,
            100,
            100,
            32);

    DebugEnd();
}
Пример #3
0
static T_void BankUIReorderSavedCoins()
{
    T_word16 i;

    DebugRoutine ("BankUIReorderSavedCoins");
    for (i=COIN_TYPE_COPPER;i<=COIN_TYPE_GOLD;i++)
    {
        StatsSetPlayerSavedCoins(i+1,StatsGetPlayerSavedCoins(i+1)+(StatsGetPlayerSavedCoins(i)/10));
        StatsSetPlayerSavedCoins(i,StatsGetPlayerSavedCoins(i)%10);
    }

    /* update graphics */
    BankUIUpdateGraphics();

    DebugEnd();
}
Пример #4
0
/*----------------------------------------------------------------------
            Parameters:
              map -   the map to write
              fname - the name of the file to write to.

           Description:
              write a map out to a file in hips format
----------------------------------------------------------------------*/
void
MapIShowImage(IMAP *map, char *name) {
  IMAGE    image ;
#if USE_XWIN
  xwindow_type *xwin ;
#endif

  ImageInitHeader(&image, map->cols, map->rows,  PFINT, 1) ;
  image.image = (unsigned char *)map->image ;

#if USE_XWIN
  xwin = DebugShowImage(&image, NULL, 1, name, 1) ;
  readKeyboard(&image, xwin, 1) ;
  DebugEnd(xwin) ;
#endif
}
Пример #5
0
E_Boolean SliderIsAt (T_sliderID sliderID, T_word16 lx, T_word16 ly)
{
	T_sliderStruct *p_slider;
   T_graphicID graphicID;
	E_Boolean retvalue=FALSE;

	DebugRoutine ("SliderIsAt");
	DebugCheck (sliderID!=NULL);

	p_slider = (T_sliderStruct *)sliderID ;

    retvalue=GraphicIsAt(p_slider->knobgraphic,lx,ly);

	DebugEnd();
	return (retvalue);
}
Пример #6
0
static T_void BankUIDeposit (T_buttonID buttonID)
{
    E_equipCoinTypes coin;
    DebugRoutine ("BankUIDeposit");
    DebugCheck (buttonID != NULL);

    /* get coin type */
    coin=ButtonGetData(buttonID);
    DebugCheck (coin < COIN_TYPE_FIVE);

    StatsSetPlayerSavedCoins (coin,StatsGetPlayerCoins(coin)+StatsGetPlayerSavedCoins(coin));
    StatsSetPlayerCoins(coin,0);
    BankUIReorderSavedCoins();

    DebugEnd();
}
Пример #7
0
/* open games to be sent */
static T_void GuildUIRequestGameList (T_void)
{
    DebugRoutine ("GuildUIRequestGameList");

/*
    GuildUIAddGame (1000,1);
    GuildUIAddGame (1000,2);
    GuildUIAddGame (1003,1);
    GuildUIAddGame (1001,1);
    GuildUIAddGame (1000,3);
*/

    GuildDisplayGameInfo (G_displayBoxes[GUILD_GAME_LIST]);

    DebugEnd();
}
Пример #8
0
/*--------------------------------------------------------------------------*/
T_void DirectTalkSendData(T_void *p_data, T_byte8 size)
{
    T_void *p_storeddata ;

    DebugRoutine("DirectTalkSendData");

    if (G_numPackets < DITALK_MAX_PACKETS)  {
        p_storeddata = (void *)MemAlloc((T_word32)size) ;
        memcpy(p_storeddata, p_data, size) ;
        G_packets[G_numPackets].p_data = p_storeddata ;
        G_packets[G_numPackets].size = size ;
        G_numPackets++ ;
    }

    DebugEnd();
}
Пример #9
0
/**
 *  Someone is requesting to join our game that we are creating!  Do
 *  we have room?  Are they requesting the right group and adventure id?
 *
 *  @param unqiueAddress -- unique address of person requesting to join
 *  @param groupID -- ID of group being requested to join
 *  @param adventure -- Number of adventure being requested to join
 *
 *  @return Current 16-bit adventure id.
 *
 *<!-----------------------------------------------------------------------*/
T_void PeopleHereRequestJoin(
        T_directTalkUniqueAddress uniqueAddress,
        T_gameGroupID groupID,
        T_word16 adventure)
{
    T_word16 i;
    T_gameGroupID ourGroupID;

    DebugRoutine("PeopleHereRequestJoin");

    ourGroupID = ClientSyncGetGameGroupID();

    /* In order to process this packet, we must be the */
    /* creator of the game and THIS particular group. */
    if ((CompareGameGroupIDs(groupID, ourGroupID))) {
        if ((PeopleHereGetOurState() == PLAYER_ID_STATE_CREATING_GAME)
                && (adventure == PeopleHereGetOurAdventure())
                && (IGetOurLocation() == PLAYER_ID_LOCATION_GUILD)) {
            if (G_numPeopleInGame < MAX_PLAYERS_PER_GAME) {
                /* Add this person to the list (if not already) */
                for (i = 0; i < G_numPeopleInGame; i++) {
                    /* Stop if we have seen this one before. */
                    if (memcmp(&uniqueAddress, &G_peopleNetworkIDInGame[i],
                            sizeof(uniqueAddress)) == 0)
                        break;
                }

                /* Are we at the end?  Then add the name. */
                if (i == G_numPeopleInGame) {
                    G_peopleNetworkIDInGame[i] = uniqueAddress;
                    G_numPeopleInGame++;
                }

                ClientSendRespondToJoinPacket(uniqueAddress, groupID, adventure,
                GAME_RESPOND_JOIN_OK);
            } else {
                ClientSendRespondToJoinPacket(uniqueAddress, groupID, adventure,
                GAME_RESPOND_JOIN_FULL);
            }
        } else {
            ClientSendRespondToJoinPacket(uniqueAddress, groupID, adventure,
            GAME_RESPOND_JOIN_CANCELED);
        }
    }

    DebugEnd();
}
Пример #10
0
Файл: FILE.C Проект: LesInk/Test
T_sword32 FileRead(T_file file, T_void *p_buffer, T_word32 size)
{
    T_sword32 result ;

    DebugRoutine("FileRead") ;
    DebugCheck(file != FILE_BAD) ;
//    DebugCheck(size > 0) ;
    DebugCheck(p_buffer != NULL) ;

    SoundUpdateOften() ;
    result = read(file, p_buffer, size) ;
    SoundUpdateOften() ;

    DebugEnd() ;

    return result ;
}
Пример #11
0
T_void StoreCloseInventory (T_void)
{
    DebugRoutine ("StoreCloseInventory");

    G_storeOpen=FALSE;
    InventoryCloseStoreInventory();

    /* set banner back to normal mode */
//   BannerUIModeOff();

    G_houseMode=FALSE;

    /* clear control callback */
    StoreSetControlCallback (NULL);

    DebugEnd();
}
Пример #12
0
/**
 *  ICreateNode is used to create a new node structure item and clean it
 *  up before processing.  All fields are set to zero.
 *
 *  @return Newly create node.
 *
 *<!-----------------------------------------------------------------------*/
static T_doubleLinkListStruct *ICreateNode(T_void)
{
    T_doubleLinkListStruct *p_node ;
    T_word16 newNode ;

    DebugRoutine("ICreateNode") ;

#if 1      /* List method */
        if (G_firstFreeNode == 0xFFFF)  {
            DebugCheck(G_numAllocatedNodes < MAX_ALLOCATED_NODES) ;
            if (G_numAllocatedNodes >= MAX_ALLOCATED_NODES)  {
                GrGraphicsOff() ;
                fprintf(stderr, "Out of node memory!\n") ;
                exit(1001) ;
            }
            newNode = G_numAllocatedNodes++ ;
        } else {
            newNode = G_firstFreeNode ;
            G_firstFreeNode = G_nodes[newNode].countOrData.count ;
        }
        p_node = G_nodes + newNode ;
        memset(p_node, 0, sizeof(T_doubleLinkListStruct)) ;
#ifndef NDEBUG
        p_node->tag = DOUBLE_LINK_LIST_TAG ;
#endif
        G_numNodes++ ;
        if (G_numNodes > G_maxNodes)
            G_maxNodes = G_numNodes ;
#else
    p_node = MemAlloc(sizeof(T_doubleLinkListStruct)) ;
    DebugCheck(p_node != NULL) ;
    if (p_node)  {
        memset(p_node, 0, sizeof(T_doubleLinkListStruct)) ;
#ifndef NDEBUG
        p_node->tag = DOUBLE_LINK_LIST_TAG ;
#endif
        G_numNodes++ ;
        if (G_numNodes > G_maxNodes)
            G_maxNodes = G_numNodes ;
    }
#endif

    DebugEnd() ;

    return p_node ;
}
Пример #13
0
T_void HardFormUpdate(T_void)
{
    DebugRoutine("HardFormUpdate");
    if (G_currentForm < HARD_FORM_UNKNOWN) {
        GrScreenSet(GRAPHICS_ACTUAL_SCREEN);
        BannerUpdate();
        StatsUpdatePlayerStatistics();
        GraphicUpdateAllGraphics();
        ScheduleUpdateEvents();
        KeyboardUpdateEvents();
        MouseUpdateEvents();
        if (G_callbackGroups[G_currentForm].update != NULL )
            G_callbackGroups[G_currentForm].update();
    }

    DebugEnd();
}
Пример #14
0
Файл: FORM.C Проект: LesInk/Test
T_void FormPush(T_void)
{
    T_formObjectID *p_formObjs;
    T_void *p_state;
    T_formVariousValues *p_values;

    DebugRoutine("FormPush");

    /* Make sure we have a list. */
    if (G_formStack == DOUBLE_LINK_LIST_BAD)
        G_formStack = DoubleLinkListCreate();

    /* Create a list of form objects to put on the stack. */
    p_formObjs = MemAlloc(sizeof(G_formObjectArray));
    DebugCheck(p_formObjs != NULL);
    memcpy(p_formObjs, G_formObjectArray, sizeof(G_formObjectArray));
    DoubleLinkListAddElementAtFront(G_formStack, p_formObjs);

    /* Clear the list of form objects */
    memset(G_formObjectArray, 0, sizeof(G_formObjectArray));

    /* Put the buttons on the list. */
    p_state = ButtonGetStateBlock();
    DoubleLinkListAddElementAtFront(G_formStack, p_state);

    /* Put the graphics on the list. */
    p_state = GraphicGetStateBlock();
    DoubleLinkListAddElementAtFront(G_formStack, p_state);

    /* Put the sliders on the list. */
    p_state = SliderGetStateBlock();
    DoubleLinkListAddElementAtFront(G_formStack, p_state);

    /* Put the text boxes on the list. */
    p_state = TxtboxGetStateBlock();
    DoubleLinkListAddElementAtFront(G_formStack, p_state);

    /* Put the callback and other flags in the list */
    p_values = MemAlloc(sizeof(T_formVariousValues));
    p_values->callback = formcallback;
    p_values->hasText = G_formHasTextBoxes;
    p_values->hasButtons = G_formHasButtons;
    DoubleLinkListAddElementAtFront(G_formStack, p_values);

    DebugEnd();
}
Пример #15
0
Файл: FORM.C Проект: LesInk/Test
T_formObjectID FormAddTextBox(
        T_word16 x1,
        T_word16 y1,
        T_word16 x2,
        T_word16 y2,
        T_byte8 *fontname,
        T_word32 maxlength,
        T_byte8 hotkey,
        E_Boolean numericonly,
        E_TxtboxJustify justify,
        E_TxtboxMode boxmode,
        T_word32 idnum)
{
    T_word16 i;
    T_TxtboxID TxtboxID;

    DebugRoutine("FormAddTextBox");
    DebugCheck(fontname != NULL);
    DebugCheck(maxlength > 0);
    DebugCheck(justify < Txtbox_JUSTIFY_UNKNOWN);
    DebugCheck(boxmode < Txtbox_MODE_UNKNOWN);

    G_formHasTextBoxes = TRUE;

    for (i = 0; i < MAX_FORM_OBJECTS; i++) {
        /* find an empty slot */
        if (G_formObjectArray[i] == NULL ) {
            /* found one, create a new textform */
            TxtboxID = TxtboxCreate(x1, y1, x2, y2, fontname, maxlength, hotkey,
                    numericonly, justify, boxmode, FormReportTextBox);

            TxtboxSetCallback(TxtboxID, FormReportTextBox);
            /* now that a textform has been created, make an objstruct for it */
            G_formObjectArray[i] = FormCreateObject(FORM_OBJECT_TEXTBOX,
                    (T_formObjectID)TxtboxID, idnum);
            /* we made a new object struct, break from the loop */
            break;
        }
    }

    /* make sure we haven't exceeded any limits */
    DebugCheck(i!=MAX_FORM_OBJECTS);
    DebugEnd();
    /* return the ID for the object created */
    return (G_formObjectArray[i]);
}
Пример #16
0
T_void SMCLogoffReportErrorEnter(
           T_stateMachineHandle handle,
           T_word32 extraData)
{
    T_SMCLogoffData *p_data ;

    DebugRoutine("SMCLogoffReportErrorEnter") ;

    p_data = (T_SMCLogoffData *)StateMachineGetExtraData(G_smHandle) ;
    DebugCheck(p_data != NULL) ;

    SMCLogoffSetFlag(
        SMCLOGOFF_FLAG_REPORT_ERROR_COMPLETE,
        FALSE) ;

    DebugEnd() ;
}
Пример #17
0
void EscapeMenuKeyHandler(E_keyboardEvent event, T_word16 scankey)
{
    T_byte8 i;

    DebugRoutine("EscapeMenuKeyHandler");

//    printf("ESC-Key: %d %d\n", event, scankey);

    switch (event) {
        case KEYBOARD_EVENT_RELEASE:
            if (scankey == KEY_SCAN_CODE_ESC) {
                if (G_escKeyPressed) {
                    EscapeMenuExitState();
                    G_escKeyPressed = FALSE;
                }
            }
            break;
        case KEYBOARD_EVENT_PRESS:
            G_escKeyPressed = TRUE;
            if (G_escMenuAssignMode) {
                // Only assign if NOT escape key
                if (scankey != KEY_SCAN_CODE_ESC) {
                    // Unassign any keys already assigned with this
                    for (i = 0; i < sizeof(G_keys) / sizeof(G_keys[0]); i++) {
                        if (G_keys[i] == scankey) {
                            if ((strstr(G_keyboardMapping[i], "ALT+")==0) == (strstr(G_keyboardMapping[G_escMenuAssignKeyMap], "ALT+")==0)) {
                                G_keys[i] = 0;
                            }
                        }
                    }

                    // Assign the new key
                    G_keys[G_escMenuAssignKeyMap] = (T_byte8)scankey;

                    // End the assignment state
                    EscapeMenuExitState();
                    G_escMenuAssignMode = FALSE;
                }
            }
            break;
        default:
            break;
    }

    DebugEnd();
}
Пример #18
0
T_void ComwinSay (T_buttonID buttonID)
{
   T_TxtboxID TxtboxID, TxtboxID2;
   T_word16 saynum;
   T_byte8 *tosay;
   E_statsClassType playerclass;
   E_comwinSampleType sampleset;

   DebugRoutine ("ComwinSay");

   playerclass=StatsGetPlayerClassType();
   sampleset=G_characterSampleMaps[playerclass];

   TxtboxID=FormGetObjID(501);
   tosay=TxtboxGetData(TxtboxID);

   if (strcmp(tosay,"\0")!=0 && strcmp(tosay,"\r\0")!=0)
   {
      ClientSendMessage(tosay);
      if (strcmp(tosay, "@DIVIDE BY ZERO ERROR") == 0)
          StatsToggleGodMode() ;
   }
   else
   {
      TxtboxID2=FormGetObjID(500);
      saynum=TxtboxGetSelectionNumber (TxtboxID2);
      if (sampleset > 0)
      {
         saynum=saynum+G_sampleSetMarkers[sampleset-1];
      }
      saynum=G_sampleNumbers[saynum];
/*    ClientCreateGlobalAreaSound(
           PlayerGetX16(),
           PlayerGetY16(),
           1000,
           saynum) ;
*/
//      ClientSyncSendActionAreaSound(saynum,1000);
      PlayerMakeSoundGlobal(saynum,1000);
//    SoundPlayByNumber(saynum, 255) ;
   }

   TxtboxSetData(TxtboxID,"\0");

   DebugEnd();
}
Пример #19
0
static T_void StoreUIUpdateGraphics (T_void)
{
    T_byte8 stmp[32];
    T_word16 i;

    DebugRoutine ("StoreUIUpdateGraphics");

    for (i=0;i<4;i++)
    {
        sprintf (stmp,"%d",StatsGetPlayerCoins(3-i));
        TxtboxSetData(G_financeDisplays[i],stmp);
    }

    GraphicUpdateAllGraphics();

    DebugEnd();
}
Пример #20
0
T_void StoreUIEnd    (T_void)
{
    T_word16 i;
    DebugRoutine ("StoreUIEnd");

    /* destroy ui objects */
    GraphicDelete (G_backgroundPic);
    for (i=0;i<4;i++)
    {
        TxtboxDelete(G_financeDisplays[i]);
    }

    /* close store inventory */
    StoreCloseInventory();

    DebugEnd();
}
Пример #21
0
static T_word16 IFindPointer(T_memBlockHeader *p_ptr)
{
    T_word16 pos ;

    DebugRoutine("IFindPointer") ;

    for (pos=0; pos<G_numBlocks; pos++)
        if (p_ptr == G_blockList[pos])
            break ;

    if (pos == G_numBlocks)
        pos = 0xFFFF ;

    DebugEnd() ;

    return pos ;
}
Пример #22
0
/**
 *  After requesting to join, this is the response handler.
 *
 *  @param unqiueAddress -- unique address of person requesting to join
 *  @param groupID -- ID of group being requested to join
 *  @param adventure -- Number of adventure being requested to join
 *  @param response -- Response to attempted join
 *
 *  @return Current 16-bit adventure id.
 *
 *<!-----------------------------------------------------------------------*/
T_void PeopleHereRespondToJoin(
        T_directTalkUniqueAddress uniqueAddress,
        T_gameGroupID groupID,
        T_word16 adventure,
        E_respondJoin response)
{
    T_directTalkUniqueAddress ourAddress;
    DebugRoutine("PeopleHereRespondToJoin");

    /* Make sure this refers to us. */
    DirectTalkGetUniqueAddress(&ourAddress);
    if (memcmp(&ourAddress, &uniqueAddress, sizeof(ourAddress)) == 0) {
        /* Yep, thats us. */
        switch (response) {
            case GAME_RESPOND_JOIN_OK:
                /* Tell others that I'm trying to join in the game. */
                PeopleHereSetOurState(PLAYER_ID_STATE_JOINING_GAME);
                PeopleHereSetOurAdventure(adventure);
                ClientSyncSetGameGroupID(groupID);

                /* we are in. */
                GuildUIConfirmJoinGame();

                /* Send out a message that this is what we are doing. */
                ClientSendPlayerIDSelf();

                PeopleHereGeneratePeopleInGame(groupID);
                break;
            case GAME_RESPOND_JOIN_FULL:
                PeopleHereSetOurState(PLAYER_ID_STATE_NONE);
                MessageAdd("Game is already full.");
                break;
            case GAME_RESPOND_JOIN_CANCELED:
                PeopleHereSetOurState(PLAYER_ID_STATE_NONE);
                MessageAdd("Game was cancelled.");
                break;
            default:
                DebugCheck(FALSE);
                break;
        }
    } else {
        /* Not us.  Just ignore. */
    }

    DebugEnd();
}
Пример #23
0
T_void MouseRelativeModeOn(T_void)
{
    DebugRoutine("MouseRelativeModeOn");

    if (!G_relativeMode) {
        G_relativeMode = TRUE;
        // Remember where the mouse is located (we'll return there when we exit)
        IMouseGetMousePosition(&G_mousePreRelativeX, &G_mousePreRelativeY);

        // Center the mouse
        MouseMoveTo(SCREEN_SIZE_X/2, SCREEN_SIZE_Y/2);

        G_relativeModeFirstIsZero = TRUE;
    }

    DebugEnd();
}
Пример #24
0
/**
 *  Used to fill out this player's own player ID structure
 *
 *  @param p_self -- Pointer to player id self to fill
 *
 *<!-----------------------------------------------------------------------*/
T_void PeopleHereGetPlayerIDSelfStruct(T_playerIDSelf *p_self)
{
    DebugRoutine("PeopleHereGetPlayerIDSelfStruct");
    DebugCheck(p_self != NULL);

    strncpy(p_self->name, StatsGetName(), 30);
    DirectTalkGetUniqueAddress(&p_self->uniqueAddress);
    p_self->location = IGetOurLocation();
    p_self->state = G_ourState;
    p_self->groupID = ClientSyncGetGameGroupID();
    p_self->adventure = PeopleHereGetOurAdventure();
	p_self->quest = StatsGetCurrentQuestNumber();
	p_self->classType = StatsGetPlayerClassType();
	p_self->level = StatsGetPlayerLevel();

    DebugEnd();
}
Пример #25
0
/**
 *  CmdQForcedReceive makes the command queue act like it just received
 *  the packet from the inport.  All processing is the same.
 *
 *  NOTE: 
 *  NEVER PASS AN ACK PACKET TO THIS ROUTINE.  It does not properly
 *  work with them.
 *
 *  @param p_packet -- Packet being forced in
 *
 *<!-----------------------------------------------------------------------*/
T_void CmdQForcedReceive(T_packetEitherShortOrLong *p_packet)
{
    T_word16 command ;

    DebugRoutine("CmdQForcedReceive") ;

    command = p_packet->data[0] ;

    if (G_cmdQActionList[command] != NULL)  {
        /* Call the appropriate action item. */
        command = p_packet->data[0] ;
        G_cmdQActionList[command](p_packet) ;
        DebugCompare("CmdQForcedReceive") ;
    }

    DebugEnd() ;
}
Пример #26
0
/* to select 'begin game'.  Player has the option to cancel the join */
T_void GuildUIConfirmJoinGame (T_void)
{
    DebugRoutine ("GuildUIConfirmJoinGame");

    /* switch control buttons to 'cancel' and 'null' */
    ButtonDelete (G_joinButton);
    ButtonDownNoAction (G_createButton);
    GraphicUpdateAllGraphics ();
    ButtonDelete (G_createButton);
    G_createButton=NULL;

    G_joinButton=ButtonCreate (6,
                               127,
                               "UI/GUILD/CANCEL",
                               FALSE,
                               KeyDual(KEY_SCAN_CODE_C,KEY_SCAN_CODE_ALT),
                               NULL,
                               GuildUICancelJoinGame);


    /* delete adventure list box and replace with information */
    /* concerning status */
    TxtboxDelete (G_displayBoxes[GUILD_GAME_LIST]);
    TxtboxDelete (G_displayBoxes[GUILD_MAPS_LIST]);
    ButtonSetCallbacks (G_upButtons[GUILD_GAME_LIST],NULL,NULL);
    ButtonSetCallbacks (G_dnButtons[GUILD_GAME_LIST],NULL,NULL);
    ButtonSetCallbacks (G_upButtons[GUILD_MAPS_LIST],NULL,NULL);
    ButtonSetCallbacks (G_dnButtons[GUILD_MAPS_LIST],NULL,NULL);

    G_displayBoxes[GUILD_GAME_LIST]=TxtboxCreate (6,
                                                  28,
                                                  95,
                                                  75,
                                                  "FontTiny",
                                                  0,
                                                  0,
                                                  FALSE,
                                                  Txtbox_JUSTIFY_CENTER,
                                                  Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                                  NULL);

    TxtboxSetData (G_displayBoxes[GUILD_GAME_LIST],
                   "^003Joining game:^007\r\rplease wait for\rother players\r\r^005Select cancel button\rTo cancel action.");

    DebugEnd();
}
Пример #27
0
/**
 *  MessageAdd appends a text line to the bottom of the message list.
 *  If needed, the messages are scroll up to make room (and one message
 *  is scroll off the list).
 *
 *  @param p_string -- String to add to message list
 *
 *<!-----------------------------------------------------------------------*/
T_void MessageAdd(T_byte8 *p_string)
{
    DebugRoutine("MessageAdd") ;
//    DebugCheck(strlen(p_string) <= MAX_SIZE_MESSAGE) ;

    if (G_alternateOutput==TRUE)
    {
        /* spit output to alternate textbox */
        TxtboxSetData(G_altOutputBox,p_string);
    }

    /* First see if we need to scroll up the messages. */
    if (G_numMessages == MAX_NUM_MESSAGES)  {
        /* Yes, we need to scroll. */
        /* Scroll up the messages. */
        memmove(
            P_Messages,
            P_Messages+1,
            sizeof(P_Messages)-sizeof(T_byte8 *)) ;

        /* Note that we are one message less now. */
        G_numMessages-- ;
    }

    /* Add the new message. */
    /* Get a pointer to next message slot. */
    P_Messages[G_numMessages] = G_Messages[G_realMessage++] ;

    /* Copy the message into the slot. */
    strncpy(P_Messages[G_numMessages], p_string, MAX_SIZE_MESSAGE-1) ;

    /* Add one to the total number of messages. */
    G_numMessages++ ;

    /* If the real message location is past the end, wrap around. */
    if (G_realMessage == MAX_NUM_MESSAGES)
        G_realMessage = 0 ;

    /* If the new message is out of our view, scroll down one to try */
    /* to follow it. */
    if (((T_sword16)(G_numMessages-G_currentMessage)) > MAX_VIEWED_MESSAGES)
        MessageScrollDown() ;

    DebugEnd() ;
}
Пример #28
0
static T_void SliderDraw (T_sliderID sliderID)
{
    T_word16 offset1,offset2,dx;
    float offset;
	T_byte8 *p_pic;
	T_bitmap *p_bitmap ;
	T_sliderStruct *p_slider;
    T_graphicStruct *p_graphic;

    DebugRoutine ("SliderDraw");
	DebugCheck (sliderID!=NULL);

	p_slider = (T_sliderStruct *)sliderID ;
    p_graphic = (T_graphicStruct *)p_slider->knobgraphic;

    /* set the slider location */
    dx=((p_slider->lx2-p_graphic->width+2)-p_slider->lx1);
    offset2=0-1;
    offset=p_slider->curval;
    offset/=(float)offset2;
    offset*=(float)dx;
    offset+=p_slider->lx1;

    if (offset > p_slider->lx2-p_graphic->width+1)
      offset=p_slider->lx2-p_graphic->width+1;
    else if (offset < p_slider->lx1)
      offset=p_slider->lx1;

    p_graphic->locx=offset;

    /* draw background */
    GrDrawRectangle (p_slider->lx1,p_slider->ly1-4,p_slider->lx2,p_slider->ly1+6,SLIDER_BACKGROUND_COLOR);

    /* draw lines */
    GrDrawHorizontalLine (p_slider->lx1,p_slider->ly1,p_slider->lx2,SLIDER_LINE1_COLOR);
    GrDrawHorizontalLine (p_slider->lx1,p_slider->ly1+1,p_slider->lx2,SLIDER_LINE2_COLOR);
    GrDrawHorizontalLine (p_slider->lx1+1,p_slider->ly1+2,p_slider->lx2+1,0);

    /* update graphic */
    p_graphic=(T_graphicStruct *)p_slider->knobgraphic;
    DebugCheck (p_graphic != NULL);
    p_graphic->changed=TRUE;

    DebugEnd();
}
Пример #29
0
Файл: FILE.C Проект: LesInk/Test
E_Boolean FileExist(T_byte8 *p_filename)
{
    E_Boolean fileFound = FALSE ;
    T_file file ;

    DebugRoutine("FileExist") ;
    DebugCheck(p_filename != NULL) ;

    file = FileOpen(p_filename, FILE_MODE_READ) ;
    if (file != FILE_BAD)  {
        fileFound = TRUE ;
        FileClose(file) ;
    }

    DebugEnd() ;

    return fileFound ;
}
Пример #30
0
T_void SliderCleanUp (T_void)
{
	T_word16 i;
	T_sliderStruct *p_slider;

	DebugRoutine ("SliderCleanUp");

	for (i=0;i<MAX_SLIDERS;i++)
	if (G_sliderArray[i]!=NULL)
	{
      p_slider = (T_sliderStruct *)G_sliderArray[i];
      GraphicDelete (p_slider->knobgraphic);
      MemFree (G_sliderArray[i]);
      MemCheck (601);
      G_sliderArray[i]=NULL;
	}
	DebugEnd();
}