コード例 #1
0
/* redraws the list of open games */
static T_void GuildUIDrawGameList(T_void)
{
    T_doubleLinkListElement element;
    T_gameDescriptionStruct *p_game=NULL;
    T_mapDescriptionStruct *p_map=NULL;
    T_byte8 *listData=NULL;
    T_byte8 *temp=NULL;
    T_byte8 stmp[64];
    T_word16 count=0;
    T_word32 size=0;

    DebugRoutine ("GuildUIDrawGameList");
    element=DoubleLinkListGetFirst (G_gameList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        /* get this element's data */
        p_game=(T_gameDescriptionStruct *)DoubleLinkListElementGetData(element);

        /* find corresponding map information structure */
        p_map=GuildUIGetMapDescription(p_game->mapNumber);

        /* make this data line */
        sprintf (stmp,"%s\r",p_map->name);

        /* add to list */
        if (listData != NULL) size=strlen(listData);
        else size=0;
        size+=strlen(stmp);
        temp=MemAlloc(size+2);
        if (listData != NULL) sprintf (temp,"%s%s",listData,stmp);
        else strcpy (temp,stmp);
        if (listData != NULL) MemFree(listData);

        listData=temp;
        temp=NULL;

        element=DoubleLinkListElementGetNext(element);
    }

    if (listData != NULL)
    {
        /* get rid of last '\r' */
        listData[strlen(listData)-1]='\0';
        TxtboxSetData(G_displayBoxes[GUILD_GAME_LIST],listData);
        MemFree(listData);
    }
    else
    {
        TxtboxSetData(G_displayBoxes[GUILD_GAME_LIST],"");
    }
    DebugEnd();
}
コード例 #2
0
/* for store / bank / inn ui screens */
T_void MessageSetAlternateOutputOn(T_void)
{
    DebugRoutine ("MessageSetAlternateOutputOn");

    if (G_alternateOutput==FALSE)
    {
        /* create alternate textbox */
        G_altOutputBox = TxtboxCreate  (OUTPUT_BOX_X1,
                                        OUTPUT_BOX_Y1,
                                        OUTPUT_BOX_X2,
                                        OUTPUT_BOX_Y2,
                                        "FontMedium",
                                        0,
                                        0,
                                        FALSE,
                                        Txtbox_JUSTIFY_CENTER,
                                        Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                        NULL);

        TxtboxSetData(G_altOutputBox,"");
        G_alternateOutput=TRUE;
    }

    DebugEnd();
}
コード例 #3
0
/* information block about an adventure */
static T_void GuildDisplayMapInfo (T_TxtboxID TxtboxID)
{
    T_word16 selection;
    T_mapDescriptionStruct *p_map;
    T_doubleLinkListElement element;

    DebugRoutine ("GuildDisplayMapInfo");

    selection=TxtboxGetSelectionNumber(TxtboxID);
    element=DoubleLinkListGetFirst(G_mapList);

    /* Record that adventure as the selected adventure. */
    StatsSetCurrentQuestNumber(selection);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        if (selection==0)
        {

            /* display this map information */
            p_map=DoubleLinkListElementGetData(element);
            TxtboxSetData (G_displayBoxes[GUILD_MAPS_DESC],p_map->description);
            break;
        }

        selection-=1;
        element=DoubleLinkListElementGetNext(element);
    }


    DebugEnd();
}
コード例 #4
0
ファイル: BANKUI.C プロジェクト: cabbruzzese/AmuletsArmor
static T_void BankUIUpdateGraphics (T_void)
{
    T_byte8 stmp[64];
    T_word16 i;

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

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


    if (BannerFormIsOpen (BANNER_FORM_FINANCES)) BannerDisplayFinancesPage();
    GraphicUpdateAllGraphics();

    DebugEnd();
}
コード例 #5
0
/* game, and either issuing a 'begin' or 'cancel' command for the created game */
T_void GuildUIConfirmCreateGame (T_void)
{
    DebugRoutine ("GuildUIConfirmCreateGame");

    /* switch control buttons to 'begin game' and 'cancel game' */
    ButtonDelete (G_joinButton);
    ButtonDelete (G_createButton);
    G_joinButton=ButtonCreate (6,
                               127,
                               "UI/GUILD/BEGIN",
                               FALSE,
                               KeyDual(KEY_SCAN_CODE_B,KEY_SCAN_CODE_ALT),
                               NULL,
                               GuildUIBeginGame);

    G_createButton=ButtonCreate (109,
                                 127,
                                 "UI/GUILD/CANCEL",
                                 FALSE,
                                 KeyDual(KEY_SCAN_CODE_C,KEY_SCAN_CODE_ALT),
                                 NULL,
                                 GuildUICancelCreateGame);


    /* 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],
                   "^003Creating game:^007\r\rplease wait for\rother players\r\r^005Select begin button\rTo start game.");


    DebugEnd();
}
コード例 #6
0
/* displays information about an open game */
static T_void GuildDisplayGameInfo (T_TxtboxID TxtboxID)
{
    T_sword16 selection;
    T_doubleLinkListElement element;
    T_gameDescriptionStruct *p_game;
    T_mapDescriptionStruct *p_map;
    T_gameDescriptionStruct blank = { 0, 0 } ;

    DebugRoutine ("GuildDisplayGameInfo");

    selection=TxtboxGetSelectionNumber(TxtboxID);
    element=DoubleLinkListGetFirst (G_gameList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        /* compare this game entry to the selection number */
        if (selection==0)
        {
            /* this is the one - */
            p_game=(T_gameDescriptionStruct *)DoubleLinkListElementGetData(element);
            /* find map */
            element=DoubleLinkListGetFirst (G_mapList);
            while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
            {
                p_map=(T_mapDescriptionStruct *)DoubleLinkListElementGetData(element);
                if (p_map->mapIndex==p_game->mapNumber)
                {
                    /* display this one */
                    TxtboxCursSetRow (G_displayBoxes[GUILD_MAPS_LIST],selection);
                    TxtboxSetData (G_displayBoxes[GUILD_MAPS_DESC],p_map->description);
                    break;
                }
                element=DoubleLinkListElementGetNext(element);
                selection++;
            }
            break;
        }
        element=DoubleLinkListElementGetNext(element);
        selection--;
    }

   /* request player list for this game from server here */
    if (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
        GuildUIRequestPlayerListForOpenGame(p_game);
    else
        GuildUIRequestPlayerListForOpenGame(&blank) ;

    DebugEnd();
}
コード例 #7
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();
}
コード例 #8
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();
}
コード例 #9
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() ;
}
コード例 #10
0
T_void ComwinDisplayCommunicatePage(T_void)
{
   T_TxtboxID TxtboxID;
   T_buttonID buttonID;

   DebugRoutine ("ComwinDisplayCommunicatePage");

   G_comwinIsOpen=TRUE;

   TxtboxID=FormGetObjID(500);
   TxtboxSetData(TxtboxID,G_fielddata);

   /* attach buttons */
   buttonID=FormGetObjID(301);
   ButtonSetCallbacks (buttonID,NULL,ComwinSay);

   DebugEnd();
}
コード例 #11
0
/* clears all player names from the player list box */
T_void GuildUIClearPlayers (T_void)
{
    T_doubleLinkListElement element,nextElement;
    T_byte8 *p_name;
    T_byte8 *test;
    DebugRoutine ("GuildUIClearPlayers");

    element=DoubleLinkListGetFirst(G_playerList);
    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        nextElement=DoubleLinkListElementGetNext(element);
        p_name=(T_byte8 *)DoubleLinkListElementGetData(element);
        MemFree(p_name);
        DoubleLinkListRemoveElement(element);
        element=nextElement;
    }

    test=TxtboxGetData(G_displayBoxes[GUILD_GAME_DESC]);
    if (test != NULL) TxtboxSetData(G_displayBoxes[GUILD_GAME_DESC],"");

    DebugEnd();
}
コード例 #12
0
/* draws current player list (G_playerList) */
static T_void GuildUIDrawPlayerList (T_void)
{
    T_doubleLinkListElement element;
    T_byte8* listData=NULL;
    T_byte8* temp=NULL;
    T_byte8* name=NULL;
    T_word16 size=0;

    DebugRoutine ("GuildUIDrawPlayerList");
    element=DoubleLinkListGetFirst (G_playerList);

    while (element != DOUBLE_LINK_LIST_ELEMENT_BAD)
    {
        /* get this element's data */
        name=(T_byte8*)DoubleLinkListElementGetData(element);
        /* find corresponding map information structure */
        /* add to list */
        if (listData != NULL) size=strlen(listData);
        else size=0;
        size+=strlen(name);
        temp=MemAlloc(size+2);
        if (listData != NULL) sprintf (temp,"%s%s\r",listData,name);
        else sprintf (temp,"%s\r",name);

        if (listData != NULL) MemFree(listData);

        listData=temp;
        temp=NULL;

        element=DoubleLinkListElementGetNext(element);
    }

    TxtboxSetData(G_displayBoxes[GUILD_GAME_DESC],listData);
    if (listData != NULL) MemFree(listData);

    DebugEnd();
}
コード例 #13
0
T_void InnUIStart(T_word32 formNum)
{
    T_word16 i;
    T_byte8 stmp[32];
    T_word16 hotkey[4];

    DebugRoutine("InnUIStart");

    /* load backdrop */
    G_backgroundPic = GraphicCreate(4, 3, "UI/INN/INNBACK");

    hotkey[0] = KeyDual(KEY_SCAN_CODE_C,KEY_SCAN_CODE_ALT);
    hotkey[1] = KeyDual(KEY_SCAN_CODE_S,KEY_SCAN_CODE_ALT);
    hotkey[2] = KeyDual(KEY_SCAN_CODE_L,KEY_SCAN_CODE_ALT);
    hotkey[3] = KeyDual(KEY_SCAN_CODE_U,KEY_SCAN_CODE_ALT);

    for (i = 0; i < 4; i++) {
        /* place rent buttons */
        sprintf(stmp, "UI/INN/ROOMBTN%d", i + 1);

        G_rentButtons[i] = ButtonCreate(45, 24 + (i * 28), stmp,
        FALSE, hotkey[i],
        NULL, InnUIRent);

        ButtonSetData(G_rentButtons[i], i);

        /* set up rent cost displays */
        G_rentCostDisplays[i] = TxtboxCreate(45, 37 + (i * 28), 110,
                46 + (i * 28), "FontMedium", 0, 0,
                TRUE, Txtbox_JUSTIFY_CENTER, Txtbox_MODE_VIEW_NOSCROLL_FORM,
                NULL);

        /* set up current funds display */
        G_financeDisplays[i] = TxtboxCreate(164, 32 + (i * 11), 204,
                41 + (i * 11), "FontMedium", 0, 0,
                TRUE, Txtbox_JUSTIFY_CENTER, Txtbox_MODE_VIEW_NOSCROLL_FORM,
                NULL);

        sprintf(stmp, "%d", StatsGetPlayerCoins(3-i));
        TxtboxSetData(G_financeDisplays[i], stmp);

    }

    /* set rent prices */
    TxtboxSetData(G_rentCostDisplays[0], "free!");
    TxtboxSetData(G_rentCostDisplays[1], "2 gold");
    TxtboxSetData(G_rentCostDisplays[2], "1 platinum");
    TxtboxSetData(G_rentCostDisplays[3], "2 platinum");

    GraphicUpdateAllGraphics();

    /* welcome user */
    MessageAdd("^007Welcome to the inn!");

    /* add journal help page if necessary */
    if (StatsPlayerHasNotePage(31) == FALSE && StatsPlayerHasNotePage(0) == TRUE) {
        StatsAddPlayerNotePage(31);
    }

    DebugEnd();
}
コード例 #14
0
ファイル: ESCMENU.C プロジェクト: alexey-lysiuk/AmuletsArmor
T_void EscapeMenuFormControl(
        E_formObjectType objtype,
        T_word16 objstatus,
        T_word32 objID)
{
    T_TxtboxID textID;

    DebugRoutine("EscapeMenuFormControl");

//    printf("ESC: %d %d %d\n", objtype, objstatus, objID);

    if ((objtype == FORM_OBJECT_BUTTON) && (objstatus == 2)) {
        if ((objID >= 4001) && (objID <= 4009)) {
            // Go to a menu
            EscapeMenuGotoState(objID - 4000);
        } else if ((objID >= 2001) && (objID <= 2009)) {
            // Enter pages
            EscapeMenuEnterState(objID - 2000);
        } else if ((objID >= 1000) && (objID <= 1999)) {
            // Assign a key by enering into it and putting
            // the ESC code into an assignment mode
            G_escMenuAssignKeyMap = objID - 1000;
            EscapeMenuEnterState(6);
            G_escMenuAssignMode = TRUE;
        } else if ((objID >= 7000) && (objID < (7000+ESC_MENU_NUM_OPTIONS))) {
            if (objID == 7000+ESC_MENU_MOUSE_TURN_SPEED) {
                // Set the range from 1 to 10 with 5 as the default
                G_escMenuToggleOptions[ESC_MENU_MOUSE_TURN_SPEED]+=10;
                if (G_escMenuToggleOptions[ESC_MENU_MOUSE_TURN_SPEED] > 200)
                    G_escMenuToggleOptions[ESC_MENU_MOUSE_TURN_SPEED] = 20;
                EscapeMenuSetOptions();
            } else if (objID == 7000+ESC_MENU_KEYBOARD_TURN_SPEED) {
                    // Set the range from 1 to 10 with 5 as the default
                    G_escMenuToggleOptions[ESC_MENU_KEYBOARD_TURN_SPEED]+=10;
                    if (G_escMenuToggleOptions[ESC_MENU_KEYBOARD_TURN_SPEED] > 200)
                        G_escMenuToggleOptions[ESC_MENU_KEYBOARD_TURN_SPEED] = 20;
                    EscapeMenuSetOptions();
            } else {
                // On/Off option hit
                G_escMenuToggleOptions[objID - 7000] ^= 1;
                EscapeMenuSetOptions();
            }
        } else if (objID == 301) {
            // Pressed the "No Key" button
            // Assign a zero for no key selected
            G_keys[G_escMenuAssignKeyMap] = 0;

            // End the assignment state
            EscapeMenuExitState();
            G_escMenuAssignMode = FALSE;
        } else if (objID == 300) {
            EscapeMenuExitState();
        } else if (objID == 5000) {
            EscapeMenuEnterState(8);
            G_escMenuAbortCount = 1;
        } else if (objID == 5001) {
            textID = FormFindObjID(5002);
            if (G_escMenuAbortCount==1) {
                ClientSyncSendActionAbortLevel();
                TxtboxSetData(textID, "Requesting to abort level.");
                G_escMenuAbortCount = 2;
            } else if (G_escMenuAbortCount == 2) {
                TxtboxSetData(textID, "Hit once more to force an abort...");
                G_escMenuAbortCount = 3;
            } else if (G_escMenuAbortCount == 3) {
                TxtboxSetData(textID, "Forced abort!");
                G_escMenuAbortCount = 4;

                /* Declare this as no longer an adventure */
                ClientSetAdventureNumber(0);

                /* Return to guild. */
                MouseRelativeModeOff();
                ClientSetNextPlace(20004, 0);
            }
        } else if (objID == 5999) {
            // Directly stop immediately and once
            ClientSyncSendActionAbortLevel();
        }
    }

    DebugEnd();
}
コード例 #15
0
T_void GuildUIStart  (T_word32 formNum)
{
    T_word16 i;

    const T_word16 arrowCoordX[4]=   { 97,  97,  200, 200};
    const T_word16 upArrowCoordY[4]= { 28,  77,  28,  77 };
    const T_word16 dnArrowCoordY[4]= { 67,  117, 67,  117};
    const T_word16 scrollBarY[4]=    { 38,  87,  38,  87 };
    const T_word16 dispWindowX1[4]=  { 6,   6,   109, 109};
    const T_word16 dispWindowY1[4]=  { 28,  77,  28,  77 };
    const T_word16 dispWindowX2[4]=  { 95,  95,  198, 198};
    const T_word16 dispWindowY2[4]=  { 75,  125, 75,  125};

    const E_TxtboxMode dispWindowMode[4]={Txtbox_MODE_SELECTION_BOX,
                                          Txtbox_MODE_VIEW_SCROLL_FORM,
                                          Txtbox_MODE_SELECTION_BOX,
                                          Txtbox_MODE_VIEW_SCROLL_FORM};

    const E_TxtboxJustify dispWindowJustify[4]={Txtbox_JUSTIFY_LEFT,
                                                Txtbox_JUSTIFY_LEFT,
                                                Txtbox_JUSTIFY_CENTER,
                                                Txtbox_JUSTIFY_CENTER};

    DebugRoutine ("GuildUIStart");

    /* load backdrop */
    G_backgroundPic=GraphicCreate (4,3,"UI/GUILD/GLDBACK");

    for (i=GUILD_GAME_LIST;i<=GUILD_MAPS_DESC;i++)
    {
        /* set up display textboxes */
        /* scroll bars and control arrows */
        G_displayBoxes[i]=TxtboxCreate (dispWindowX1[i],
                                        dispWindowY1[i],
                                        dispWindowX2[i],
                                        dispWindowY2[i],
                                        "FontTiny",
                                        0,
                                        0,
                                        FALSE,
                                        dispWindowJustify[i],
                                        dispWindowMode[i],
                                        NULL);
        TxtboxSetData (G_displayBoxes[i]," ");


        G_upButtons[i]=ButtonCreate (arrowCoordX[i],
                                     upArrowCoordY[i],
                                     "UI/COMMON/UPARROW",
                                     FALSE,
                                     0,
                                     NULL,
                                     GuildUIUpDisplay);
        ButtonSetData (G_upButtons[i],i);

        G_dnButtons[i]=ButtonCreate (arrowCoordX[i],
                                     dnArrowCoordY[i],
                                     "UI/COMMON/DNARROW",
                                     FALSE,
                                     0,
                                     NULL,
                                     GuildUIDnDisplay);
        ButtonSetData (G_dnButtons[i],i);

        if (i%2==0)
        {
            G_scrollBars[i]=GraphicCreate (arrowCoordX[i],
                                           scrollBarY[i],
                                           "UI/GUILD/SB1");
        }
        else
        {
            G_scrollBars[i]=GraphicCreate (arrowCoordX[i],
                                           scrollBarY[i],
                                           "UI/GUILD/SB1");
        }

        TxtboxSetScrollBarObjIDs(G_displayBoxes[i],G_upButtons[i],G_dnButtons[i],G_scrollBars[i]);
    }

    /* set up control buttons */
    G_joinButton=ButtonCreate (6,
                               127,
                               "UI/GUILD/JOIN",
                               FALSE,
                               KeyDual(KEY_SCAN_CODE_J,KEY_SCAN_CODE_ALT),
                               NULL,
                               GuildUIJoinGame);

    G_createButton=ButtonCreate (109,
                                 127,
                                 "UI/GUILD/CREATE",
                                 FALSE,
                                 KeyDual(KEY_SCAN_CODE_C,KEY_SCAN_CODE_ALT),
                                 NULL,
                                 GuildUICreateGame);

    /* build map list */
    GuildUIBuildMapList();

    /* initialize game/player listings */
    G_gameList=DoubleLinkListCreate();
    G_playerList=DoubleLinkListCreate();

    /* set up control callbacks */
    TxtboxSetCallback (G_displayBoxes[GUILD_MAPS_LIST],GuildDisplayMapInfo);
    TxtboxSetCallback (G_displayBoxes[GUILD_GAME_LIST],GuildDisplayGameInfo);

    /* notify server to send a list of active games */
    GuildUIRequestGameList();

    /* update graphics */
    GraphicUpdateAllGraphics();

    /* Set up what we are out. */
    ClientSyncSetGameGroupID(*DirectTalkGetNullBlankUniqueAddress()) ;
    PeopleHereSetOurAdventure(0) ;
    PeopleHereSetOurState(PLAYER_ID_STATE_NONE) ;

    /* Ask for people to show themselves. */
    PeopleHereReset() ;

    /* add journal help page if necessary */
    if (StatsPlayerHasNotePage(30)==FALSE &&
        StatsPlayerHasNotePage(0)==TRUE)
    {
        StatsAddPlayerNotePage(30);
    }

    DebugEnd();
}
コード例 #16
0
ファイル: FORM.C プロジェクト: LesInk/Test
T_void FormLoadFromFile(T_byte8 *filename)
{
    FILE *fp, *fp2;
    T_word16 i, j;
    T_word16 objtype = 0, objid, x1, y1, x2, y2;
    T_word16 hotkey, toggletype, datatype, fieldtype, fcolor, bcolor, justify;
    T_word16 sbupID, sbdnID, sbgrID;
    T_word16 numericonly;
    T_word32 maxlength;
    T_byte8 picname[32];
    T_byte8 buttontext[256];
    T_byte8 fontname[32];
    T_byte8 tempstr[256];
    T_byte8 tempstr2[256];
    T_byte8 tempstr3[32];
    T_byte8 val;
    E_Boolean isincludedfile = FALSE;
    E_Boolean appendtext = FALSE;
    E_Boolean cursorset = FALSE;
    T_formObjectID objID;
    T_formObjectStruct *p_obj, *p_obj2;
    T_TxtfldStruct *p_txtfld;
    T_buttonStruct *p_button;
    T_buttonID buttonID, SBUbuttonID, SBDbuttonID;
    T_graphicID SBGgraphicID;
    T_sliderID sliderID;
    T_byte8 *p_includedtext;
    T_word32 size;

    DebugRoutine("FormLoadFromFile");
    DebugCheck(filename!=NULL);

    /* first, clean up the form structure and delete any previous forms */
    FormCleanUp();

    /* open up the file */
    fp = fopen(filename, "r");
    DebugCheck(fp!=NULL);
    while (feof(fp) == FALSE) {
        objtype = 0;
        /* get a line from the main file */
        fgets(tempstr, 128, fp);
        /* strip last (newline) character */
        if (tempstr[strlen(tempstr) - 1] == '\n')
            tempstr[strlen(tempstr) - 1] = '\0';

        /* append text to current object if flag is set */
        if (appendtext == TRUE) {
            if (strcmp(tempstr, "ENDOFTEXT") == 0) {
                /* turn off appendstring mode */
                TxtboxBackSpace(p_obj->objID);
                TxtboxCursTop(p_obj->objID);
                TxtboxRepaginate(p_obj->objID);
                TxtboxFirstBox();
                appendtext = FALSE;
                sprintf(tempstr, "#");
            } else if (tempstr[0] != '$' && tempstr[0] != '#') {
                /* strip last character if newline */
                if (tempstr[strlen(tempstr) - 1] == '\n')
                    tempstr[strlen(tempstr) - 1] = '\0';
                TxtboxAppendString(p_obj->objID, tempstr);
                TxtboxAppendKey(p_obj->objID, 13);
                sprintf(tempstr, "#");
            }
        }

        /* check to see if we should open an included file */
        if (tempstr[0] == '$') {
            /* strip the '$' from the string */
            for (i = 1; i < strlen(tempstr); i++)
                tempstr2[i - 1] = tempstr[i];
            tempstr2[i - 1] = '\0';
            /* open an included file */
            p_includedtext = FileLoad(tempstr2, &size);
            TxtboxSetData(p_obj->objID, p_includedtext);
            TxtboxRepaginateAll(p_obj->objID);
            TxtboxCursTop(p_obj->objID);
            MemFree(p_includedtext);

//        	fp2 = fopen (tempstr2,"r");
//	        DebugCheck (fp2!=NULL);
//           isincludedfile=TRUE;

            sprintf(tempstr, "#");
        }

        /* ignore comments and blank lines */
        if (tempstr[0] != '#' && tempstr[0] != ' ') {
            sscanf(tempstr, "%d", &objtype);
            if (objtype == 1) /* add a graphic */
            {
                sscanf(tempstr, "%d,%d,%d,%d,%s", &objtype, &objid, &x1, &y1,
                        picname);
                FormAddGraphic(x1, y1, picname, objid);
            } else if (objtype == 2) /* add a text */
            {
                sscanf(tempstr, "%d,%d,%d,%d,%d,%d", &objtype, &objid, &x1, &y1,
                        &fcolor, &bcolor);
                /* get font name */
                fgets(tempstr, 128, fp);
                sscanf(tempstr, "%s", fontname);
                /* get text */
                fgets(tempstr, 128, fp);
                /* strip last (newline) character */
                if (tempstr[strlen(tempstr) - 1] == '\n')
                    tempstr[strlen(tempstr) - 1] = '\0';
                /* add a text object */
                FormAddText(x1, y1, tempstr, fontname, fcolor, bcolor, objid);
            } else if (objtype == 3) /* add a button */
            {
                sscanf(tempstr, "%d,%d,%d,%d,%d,%d,%s", &objtype, &objid, &x1,
                        &y1, &toggletype, &hotkey, picname);
                FormAddButton(x1, y1, picname, (E_Boolean)toggletype, hotkey,
                        objid);
            } else if (objtype == 4) /* add a text button */
            {
                sscanf(tempstr, "%d,%d,%d,%d,%d,%d", &objtype, &objid, &x1, &y1,
                        &fcolor, &toggletype, &hotkey);
                /* get picture name */
                fgets(tempstr, 128, fp);
                sscanf(tempstr, "%s", picname);
                /* get font name */
                fgets(tempstr, 128, fp);
                sscanf(tempstr, "%s", fontname);
                /* get buttontext */
                fgets(tempstr, 128, fp);
                /* strip last (newline) character */
                if (tempstr[strlen(tempstr) - 1] == '\n')
                    tempstr[strlen(tempstr) - 1] = '\0';
                /* make a text button */
                FormAddTextButton(x1, y1, tempstr, picname, fontname, fcolor, 0,
                        (E_Boolean)toggletype, hotkey, objid);
            } else if (objtype == 5) /* add a text box */
            {
                sscanf(tempstr, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%s",
                        &objtype, &objid, &x1, &y1, &x2, &y2, &maxlength,
                        &numericonly, &justify, &fieldtype, &hotkey, &sbupID,
                        &sbdnID, &sbgrID, fontname);

                /* read in default text */
//                fgets (tempstr,128,fp);
                /* create a text box */
                /* set maximum length to highest possible value if 0 */
                if (maxlength == 0)
                    maxlength--;

                objID = FormAddTextBox(x1, y1, x2, y2, fontname, maxlength,
                        hotkey, numericonly, justify, (E_TxtboxMode)fieldtype,
                        objid);

                DebugCheck(objID != NULL);
                /* set form scroll bar stuff */
                if (sbupID != 0) {
                    SBUbuttonID = FormGetObjID(sbupID);
                    ButtonSetData(SBUbuttonID, objid);
                    ButtonSetCallbacks(SBUbuttonID, NULL, TxtboxHandleSBUp);
                    SBDbuttonID = FormGetObjID(sbdnID);
                    ButtonSetData(SBDbuttonID, objid);
                    ButtonSetCallbacks(SBDbuttonID, NULL, TxtboxHandleSBDn);
                    SBGgraphicID = FormGetObjID(sbgrID);
                    DebugCheck(SBUbuttonID != NULL);
                    DebugCheck(SBDbuttonID != NULL);
                    DebugCheck(SBGgraphicID != NULL);
                    p_obj = (T_formObjectStruct*)objID;
                    TxtboxSetScrollBarObjIDs(p_obj->objID, SBUbuttonID,
                            SBDbuttonID, SBGgraphicID);
                }

                /* set default text */
                p_obj = (T_formObjectStruct *)objID;
                appendtext = TRUE;

            } else if (objtype == 6) /* add a slider */
            {
                sscanf(tempstr, "%d,%d,%d,%d,%d", &objtype, &objid, &x1, &y1,
                        &x2);
                objID = FormAddSlider(x1, y1, x2, objid);
                DebugCheck(objID != NULL);
                p_obj = (T_formObjectStruct *)objID;
                SliderSetCallBack(p_obj->objID, FormReportSlider);
            }
        }
    }
    fclose(fp);
    DebugEnd();
}
コード例 #17
0
ファイル: BANKUI.C プロジェクト: cabbruzzese/AmuletsArmor
T_void BankUIStart  (T_word32 formNum)
{
    T_word16 i;
    T_byte8 stmp[64];
    E_statsAdventureNumber adv=ADVENTURE_NONE;
    DebugRoutine ("BankUIStart");

    /* load backdrop */
    G_backgroundPic=GraphicCreate (4,3,"UI/BANK/BANKBACK");

    for (i=0;i<4;i++)
    {
        /* load deposit/withdraw buttons */
        G_depositButtons[i]=ButtonCreate(119,
                                         32+(i*11),
                                         "UI/COMMON/LTARROW",
                                         FALSE,
                                         0,
                                         NULL,
                                         BankUIDeposit);

        ButtonSetData(G_depositButtons[i],3-i);

        G_withdrawButtons[i]=ButtonCreate(131,
                                         32+(i*11),
                                         "UI/COMMON/RTARROW",
                                         FALSE,
                                         0,
                                         NULL,
                                         BankUIWithdraw);

        ButtonSetData(G_withdrawButtons[i],3-i);

        /* create financial display fields */
        G_financeDisplays[i]=TxtboxCreate(57,
                                          31+(i*11),
                                          109,
                                          40+(i*11),
                                          "FontMedium",
                                          0,
                                          0,
                                          TRUE,
                                          Txtbox_JUSTIFY_CENTER,
                                          Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                          NULL);

        sprintf (stmp,"%d",StatsGetPlayerSavedCoins(3-i));
        TxtboxSetData(G_financeDisplays[i],stmp);

        G_financeDisplays[i+4]=TxtboxCreate(148,
                                          31+(i*11),
                                          200,
                                          40+(i*11),
                                          "FontMedium",
                                          0,
                                          0,
                                          TRUE,
                                          Txtbox_JUSTIFY_CENTER,
                                          Txtbox_MODE_VIEW_NOSCROLL_FORM,
                                          NULL);

        sprintf (stmp,"%d",StatsGetPlayerCoins(3-i));
        TxtboxSetData(G_financeDisplays[i+4],stmp);

    }

    GraphicUpdateAllGraphics();

    /* set up bank inventory */
    StoreSetUpInventory(10,82,112,124,6,3);

    /* tell store what items we will buy */
    StoreAddBuyType(EQUIP_OBJECT_TYPE_RING);
    StoreAddBuyType(EQUIP_OBJECT_TYPE_AMULET);

    adv=StatsGetCompletedAdventure();

    switch (adv)
    {
        case ADVENTURE_7:
        /* Ring of Strength 2 */
        StoreAddItem (408,1);
        /* Ring of Speed 2 */
        StoreAddItem (430,1);
        /* Amulet of Quickness */
        StoreAddItem (611,1);
		/* Amulet of Hiding */
		StoreAddItem(609, 1);

        case ADVENTURE_6:
        /* Amulet of Speed */
        StoreAddItem (602,1);
        /* Amulet of Mana Regeneration */
        StoreAddItem (619,1);

        case ADVENTURE_5:
        /* Amulet of Accuracy */
        StoreAddItem (605,1);
        /* Ring of Stealth */
		StoreAddItem(438, 1);
		/* Ring of Armor 1 */
        StoreAddItem (415,1);
        /* Amulet of Spell Focus */
        StoreAddItem (600,1);

        case ADVENTURE_4:
		/* Ring of Regen 2 */
		StoreAddItem(406, 1);
		/* Ring of Speed 1 */
        StoreAddItem (429,1);
        /* Ring of Accuracy 2 */
        StoreAddItem (421,1);

        case ADVENTURE_3:
        /* Ring of Strength 1 */
        StoreAddItem (407,1);
        /* Ring of Map */
        StoreAddItem (435,1);

        case ADVENTURE_2:
        /* Ring of Accuracy 1 */
        StoreAddItem (420,1);

        case ADVENTURE_1:
		/* Amulet of Stealth */
		StoreAddItem(603, 1);
		/* Ring of Regen 1 */
		StoreAddItem(405, 1);

        case ADVENTURE_NONE:
        default:
        /* Ring of Food Conservation */
        StoreAddItem (426,1);
        /* Ring of Water Conservation */
        StoreAddItem (427,1);
        /* Ring of Water Walk */
        StoreAddItem (400,1);
        /* Ring of Traction */
        StoreAddItem (432,1);
        break;

        case ADVENTURE_UNKNOWN:
        DebugCheck(0);
        break;
    }


    /* Amulet of Falling */
///  StoreAddItem (614,1);
    /* Ring of Regen 2 */
//    StoreAddItem (406,1);
    /* Ring of Strength 3 */
//    StoreAddItem (409,1);
    /* Ring of Strength 4 */
//    StoreAddItem (410,1);
    /* Ring of Strength 5 */
//    StoreAddItem (411,1);
    /* Ring of Armor 2 */
//    StoreAddItem (416,1);
    /* Ring of Armor 3 */
//    StoreAddItem (417,1);
    /* Ring of Armor 4 */
//    StoreAddItem (418,1);
    /* Ring of Armor 5 */
//    StoreAddItem (419,1);
    /* Ring of Accuracy 3 */
//  StoreAddItem (422,1);
    /* Ring of Accuracy 4 */
//  StoreAddItem (423,1);
    /* Ring of Accuracy 5 */
//  StoreAddItem (424,1);
    /* Ring of Speed 4 */
//  StoreAddItem (428,1);
    /* Ring of Speed 3 */
//  StoreAddItem (431,1);
    /* Ring of Jumping */
//  StoreAddItem (434,1);
    /* Amulet of Regeneration */
//  StoreAddItem (601,1);
    /* Amulet of Strength */
//  StoreAddItem (604,1);
    /* Amulet of Poison Protection */
//  StoreAddItem (606,1);
    /* Amulet of Fire Protection */
//  StoreAddItem (607,1);
    /* Amulet of Lava Walk */
//  StoreAddItem (608,1);
    /* Amulet of Eternal Nourishment */
//  StoreAddItem (610,1);
    /* Amulet of Jumping */
//  StoreAddItem (612,1);
    /* Amulet of Flying */
//  StoreAddItem (613,1);
    /* Amulet of Super Armor */
//  StoreAddItem (615,1);
    /* Amulet of Acid Protection */
//  StoreAddItem (616,1);
    /* Amulet of Electricity Protection */
//  StoreAddItem (617,1);
    /* Amulet of Mana Drain Protection */
//  StoreAddItem (618,1);

    InventoryReorder(INVENTORY_STORE,TRUE);
    InventoryDrawInventoryWindow (INVENTORY_STORE);

    /* set up store control callback */
    StoreSetControlCallback (BankUIUpdateGraphics);

    /* welcome user */
    MessageAdd ("^007Welcome to the bank!");

    /* add journal help page if necessary */
    if (StatsPlayerHasNotePage(33)==FALSE &&
        StatsPlayerHasNotePage(0)==TRUE)
    {
        StatsAddPlayerNotePage(33);
    }
    else
    {
        /* force loading of inventory banner display */
        BannerOpenForm(BANNER_FORM_INVENTORY);
    }

    DebugEnd();
}
コード例 #18
0
/* routine builds a list of maps that the player can create */
static T_void GuildUIBuildMapList (T_void)
{
    T_byte8 stmp[64];
    T_byte8 stmp2[512];
    T_word16 mapIndex,mapKey;
    T_byte8 *dataIn;
    T_resource res;
    T_word32 size,tempSize;
    T_word32 inCnt,outCnt;
    T_byte8 charIn;
    T_word16 pass=0;
    T_word16 listcount=0;
    T_mapDescriptionStruct *p_mapStruct;
    T_byte8 *listdata=NULL,*temps=NULL;

    DebugRoutine ("GuildUIBuildMapList");

    /* initialize map listings */

    G_mapList=DoubleLinkListCreate();
    listcount=0;
    sprintf (stmp,"MAPDESC/DES%05d",listcount++);
    while (PictureExist(stmp))
    {
        /* alloc space for new map description block */
        p_mapStruct = MemAlloc (sizeof(T_mapDescriptionStruct));
        DebugCheck (p_mapStruct != NULL);

        /* lock in data 'text file' */
        dataIn=(T_byte8 *)PictureLockData (stmp,&res);
        size=ResourceGetSize(res);

        /* scan for newline */
        outCnt=inCnt=0;
        pass=0;

        while (inCnt < size)
        {
            /* get a character from input data */
            charIn=dataIn[inCnt++];
            stmp2[outCnt++]=charIn;

            /* check for temporary overflow */
            DebugCheck (outCnt<512);

            if (charIn=='\n')
            {
                /* reached 'end of line' */
                /* parse our temp string */
                stmp2[outCnt]='\0';
                outCnt=0;

                if (pass==0)
                {
                    /* getting map access (journal page needed ) */
                    sscanf (stmp2,"%d",&mapKey);
                    p_mapStruct->mapKey=mapKey;

                }
                else if (pass==1)
                {
                    /* getting map number */
                    sscanf (stmp2,"%d",&mapIndex);
                    p_mapStruct->mapIndex=mapIndex;

                }
                else if (pass==2)
                {
                    /* getting map name */
                    tempSize=strlen(stmp2);
                    /* alloc string */
                    p_mapStruct->name=MemAlloc(tempSize+1);
                    strcpy (p_mapStruct->name,stmp2);
                    p_mapStruct->name[strlen(p_mapStruct->name)-2]='\0';
                }
                else if (pass==3)
                {
                    /* getting map description */
                    tempSize=strlen(stmp2);
                    /* alloc string */
                    p_mapStruct->description=MemAlloc(tempSize+1);
                    strcpy (p_mapStruct->description,stmp2);

                }
                else
                {
                    break;
                }

                pass++;
            }
        }

        PictureUnlockAndUnfind(res);

        /* add our structure to global list */
        DoubleLinkListAddElementAtEnd (G_mapList,p_mapStruct);

        /* build our list of maps on the fly */
        if (GuildUIPlayerCanVisitMap(listcount))
        {
            sprintf (stmp,"^009%s",p_mapStruct->name);
        }
        else
        {
            sprintf (stmp,"^010%s",p_mapStruct->name);
        }

        /* add stmp to list */
        tempSize=strlen(stmp);
        if (listdata!=NULL) tempSize+=strlen(listdata);
        temps=MemAlloc(tempSize+2);
        if (listdata == NULL) sprintf (temps,"%s\r",stmp);
        else sprintf (temps,"%s%s\r",listdata,stmp);
        if (listdata != NULL) MemFree (listdata);
        listdata=temps;
        listdata[strlen(listdata)]='\0';

        /* increment map description file name */
        sprintf (stmp,"MAPDESC/DES%05d",listcount++);
    }

    TxtboxSetData (G_displayBoxes[GUILD_MAPS_LIST],listdata);
    TxtboxCursBot(G_displayBoxes[GUILD_MAPS_LIST]);
    TxtboxBackSpace (G_displayBoxes[GUILD_MAPS_LIST]);
    TxtboxCursTop(G_displayBoxes[GUILD_MAPS_LIST]);
    MemFree(listdata);

    GuildDisplayMapInfo (G_displayBoxes[GUILD_MAPS_LIST]);

    DebugEnd();
}