コード例 #1
0
ファイル: GameChat.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : gcPollForNewChat
    Description : This function is called every univ update to
                  check if new chat messages have arrived or not.
    Inputs      :
    Outputs     :
    Return      : void
----------------------------------------------------------------------------*/
void gcPollForNewChat(void)
{
    chathistory *chat;
    sdword i;

    gcLockGameChat();

    if (numnewchat)
    {
        for (i=0;i<numnewchat;i++)
        {
            chat = (chathistory *)memAlloc(sizeof(chathistory),"InGameChat",NonVolatile);

            strcpy(chat->chatstring, threadtransfer[i].chatstring);
            strcpy(chat->userName, threadtransfer[i].userName);

            chat->messageType = threadtransfer[i].messageType;
            chat->col         = threadtransfer[i].col;

            chat->playerindex = threadtransfer[i].playerindex;

            gcAddChatItemToList(chat);
        }

#ifdef DEBUG_STOMP
        regVerify(chatdrawregion);
#endif
        bitSet(chatdrawregion->status,RSF_DrawThisFrame);

        numnewchat = 0;
    }

    gcUnLockGameChat();
}
コード例 #2
0
void hrDirtyChatBox()
{
    if (hrRunning)
    {
        if (hrChatBoxRegion != NULL)
        {
#ifdef DEBUG_STOMP
            regVerify(hrChatBoxRegion);
#endif
            hrChatBoxRegion->status |= RSF_DrawThisFrame;
        }
    }
}
コード例 #3
0
void hrDirtyProgressBar()
{
    if (hrRunning)
    {
        if (hrProgressRegion != NULL)
        {
#ifdef DEBUG_STOMP
            regVerify(hrProgressRegion);
#endif
            hrProgressRegion->status |= RSF_DrawThisFrame;
        }
    }
}
コード例 #4
0
/*-----------------------------------------------------------------------------
    Name        : svDirtyShipView
    Description :
    Inputs      :
    Outputs     :
    Return      :
----------------------------------------------------------------------------*/
void svDirtyShipView(void)
{
    if (svShipViewRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svShipViewRegion);
#endif
        svShipViewRegion->status |= RSF_DrawThisFrame;
    }
    if (svFirepowerRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svFirepowerRegion);
#endif
        svFirepowerRegion->status |= RSF_DrawThisFrame;
    }
    if (svCoverageRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svCoverageRegion);
#endif
        svCoverageRegion->status |= RSF_DrawThisFrame;
    }
    if (svManeuverRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svManeuverRegion);
#endif
        svManeuverRegion->status |= RSF_DrawThisFrame;
    }
    if (svArmorRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svArmorRegion);
#endif
        svArmorRegion->status |= RSF_DrawThisFrame;
    }
    if (svTopSpeedRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svTopSpeedRegion);
#endif
        svTopSpeedRegion->status |= RSF_DrawThisFrame;
    }
    if (svMassRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(svMassRegion);
#endif
        svMassRegion->status |= RSF_DrawThisFrame;
    }
}
コード例 #5
0
ファイル: TradeMgr.c プロジェクト: rcarmo/homeworld
void tmDirtyTechInfo(void)
{
    if (tmTechInfoRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(tmTechInfoRegion);
#endif
        tmTechInfoRegion->status |= RSF_DrawThisFrame;
    }

    if (tmTechImageRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(tmTechImageRegion);
#endif
        tmTechImageRegion->status |= RSF_DrawThisFrame;
    }

    if (tmNumberRUsRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(tmNumberRUsRegion);
#endif
        tmNumberRUsRegion->status |= RSF_DrawThisFrame;
    }

    if (tmDialogRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(tmDialogRegion);
#endif
        tmDialogRegion->status |= RSF_DrawThisFrame;
    }

    if (tmCostListRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(tmCostListRegion);
#endif
        tmCostListRegion->status |= RSF_DrawThisFrame;
    }

    if (tmTechListRegion != NULL)
    {
#ifdef DEBUG_STOMP
        regVerify(tmTechListRegion);
#endif
        tmTechListRegion->status |= RSF_DrawThisFrame;
    }
}
コード例 #6
0
ファイル: GameChat.c プロジェクト: Almamu/homeworld
/*-----------------------------------------------------------------------------
    Name        : gcInGameChatEntry
    Description : Handles the chat text entry box messages.
    Inputs      :
    Outputs     :
    Return      : void
----------------------------------------------------------------------------*/
void gcInGameChatEntry(char *name, featom *atom)
{
    sdword user;
    chathistory *chat;
    char         temp[60];
    sdword       ruentered;

    if (MessageToAllies == GC_RUTransfer)
    {
        if (FEFIRSTCALL(atom))
        {
            chatentrybox = (textentryhandle)atom->pData;
            uicTextEntryInit(chatentrybox,UICTE_NoTextures|UICTE_ChatTextEntry|UICTE_NumberEntry);
            bitSet(chatentrybox->reg.status, RSF_KeyCapture);
            keyBufferClear();
            bitSet(chatentrybox->textflags, UICTE_DropShadow);
            chatentrybox->shadowColor = colBlack;
            uicTextBufferResize(chatentrybox,GC_MAXCHARACTERS);
            return;
        }
        switch (uicTextEntryMessage(atom))
        {
            case CM_AcceptText :
            {
                ruentered = atol(chatentrybox->textBuffer);
                //sendRUTransfer((udword)PLAYER_MASK(RUTransferToPlayer), ruentered);
                clWrapRUTransfer(&universe.mainCommandLayer,sigsPlayerIndex,RUTransferToPlayer, ruentered,0);
                //universe.players[sigsPlayerIndex].resourceUnits-=ruentered;
                InChatMode = FALSE;
                feScreenDisappear(NULL,NULL);
            }
            break;
            case CM_RejectText :
            {
                InChatMode = FALSE;
                feScreenDisappear(NULL,NULL);
            }
            break;
            case CM_KeyPressed:
            {
                 ruentered = atol(chatentrybox->textBuffer);
                 if (ruentered > universe.players[sigsPlayerIndex].resourceUnits
                     || ruentered <= 0)
                 {
                     //backspace if ru's entered are more than player has, or if they're less than or equal to 0
                     uicBackspaceCharacter(chatentrybox);
                 }
            }
            break;
        }
    }
    else
    {
        if (FEFIRSTCALL(atom))
        {
            chatentrybox = (textentryhandle)atom->pData;
            uicTextEntryInit(chatentrybox,UICTE_NoTextures|UICTE_ChatTextEntry);
            bitSet(chatentrybox->reg.status, RSF_KeyCapture);
            keyBufferClear();
            bitSet(chatentrybox->textflags, UICTE_DropShadow);
            chatentrybox->shadowColor = colBlack;
            uicTextBufferResize(chatentrybox,GC_MAXCHARACTERS);
            return;
        }
        switch (uicTextEntryMessage(atom))
        {
            case CM_AcceptText :
                chat = (chathistory *)memAlloc(sizeof(chathistory),"InGameChat",NonVolatile);

                if (MessageToAllies==GC_ChatToAllies)
                {
                    sendChatMessage(universe.players[sigsPlayerIndex].Allies,chatentrybox->textBuffer,(uword)sigsPlayerIndex);

                    strcpy(chat->chatstring, chatentrybox->textBuffer);
                    chat->messageType = GC_WHISPEREDMESSAGE;
                }
                else
                {
                    if ((user=gcParseChatEntry(chatentrybox->textBuffer))!=-1)
                    {
                        if (user!=sigsPlayerIndex)
                        {
                            sendChatMessage(PLAYER_MASK(user),chatentrybox->textBuffer+strlen(playerNames[user])+2,(uword)sigsPlayerIndex);

                            strcpy(chat->chatstring, chatentrybox->textBuffer+strlen(playerNames[user])+2);
                            chat->messageType = GC_WHISPEREDMESSAGE;

                    #ifdef DEBUG_STOMP
                            regVerify(chatdrawregion);
                    #endif
                            bitSet(chatdrawregion->status,RSF_DrawThisFrame);
                        }
                    }
                    else
                    {
                        sendChatMessage(OTHER_PLAYERS_MASK,chatentrybox->textBuffer,(uword)sigsPlayerIndex);

                        strcpy(chat->chatstring, chatentrybox->textBuffer+strlen(playerNames[user]));
                        chat->messageType = GC_NORMALMESSAGE;

                #ifdef DEBUG_STOMP
                        regVerify(chatdrawregion);
                #endif
                        bitSet(chatdrawregion->status,RSF_DrawThisFrame);
                    }
                }

                strcpy(chat->userName, utyName);
                chat->playerindex = sigsPlayerIndex;

                gcAddChatItemToList(chat);

                uicTextEntrySet(chatentrybox,"",0);
                InChatMode = FALSE;
                feScreenDisappear(NULL,NULL);
            break;
            case CM_RejectText :
                InChatMode = FALSE;
                feScreenDisappear(NULL,NULL);
            break;
            case CM_KeyPressed:
            {
                if ((user=gcParseChatEntry(chatentrybox->textBuffer))!=-1)
                {
                    sprintf(temp, "/%s ", playerNames[user]);
                    if (strlen(chatentrybox->textBuffer) < strlen(temp))
                        uicTextEntrySet(chatentrybox, temp, strlen(temp));
                }
            }
            break;
        }
    }
}