VOID Style(PSPAWNINFO pChar, PCHAR szLine) { if (!szLine || !szLine[0]) { char out[256] = { 0 }; sprintf_s(out,"Style 0x%X",MQChatWnd->WindowStyle); WriteChatColor(out); return; } if (szLine[0]=='!') { int TurnOff = 0; if(sscanf_s(&szLine[1],"%x",&TurnOff)) { //well we set it anyway i guess... } BitOff(MQChatWnd->WindowStyle, TurnOff); } else { int TurnOn = 0; if(sscanf_s(&szLine[0],"%x",&TurnOn)) { //hmm can error handle i guess } BitOn(MQChatWnd->WindowStyle,TurnOn); } char out[256]; sprintf_s(out,"Style 0x%X",MQChatWnd->WindowStyle); WriteChatColor(out); }
CMQChatWnd(CXStr *Template):CCustomWnd(Template) { DebugSpew("CMQChatWnd()"); SetWndNotification(CMQChatWnd); InputBox=(CTextEntryWnd*)GetChildItem("CWChatInput"); InputBox->WindowStyle|=0x800C0; BitOff(WindowStyle,CWS_CLOSE); InputBox->UnknownCW|=0xFFFFFFFF; InputBox->SetMaxChars(512); OutputBox=(CStmlWnd*)GetChildItem("CWChatOutput"); OutStruct=(_CSIDLWND*)GetChildItem("CWChatOutput"); OutWnd=(CXWnd*)OutputBox; OutBoxLines=0; *(DWORD*)&(((PCHAR)OutputBox)[EQ_CHAT_HISTORY_OFFSET])=0x190; OutputBox->Clickable=1; iCurrentCmd=-1; }
CMQChatWnd() : CCustomWnd("ChatWindow") { DebugSpew("CMQChatWnd()"); SetWndNotification(CMQChatWnd); InputBox = (CTextEntryWnd*)GetChildItem("CWChatInput"); InputBox->WindowStyle |= 0x800C0; InputBox->UnknownCW |= 0xFFFFFFFF; InputBox->SetMaxChars(512); OutputBox = (CStmlWnd*)GetChildItem("CWChatOutput"); OutputBox->Clickable = 1; *(DWORD*)&(((PCHAR)OutputBox)[EQ_CHAT_HISTORY_OFFSET])=400; OutBoxLines = 0; AutoScroll = true; BitOff(WindowStyle,CWS_CLOSE); CloseOnESC = 0; }
int main(void) { char array[64]; memset(array, '\0', sizeof(array)); BitOn(array, 5); BitOn(array, 12); BitOn(array, 500); if (IsBit(array, 5) && IsBit(array, 12) && IsBit(array, 500)) puts("These functions seem to work!"); else puts("Something's broken here!"); BitFlip(array, 12); BitOff(array, 5); if (!IsBit(array, 5) && !IsBit(array, 12) && IsBit(array, 500)) puts("These functions still seem to work!"); else puts("Something's broken here!"); return 0; }
CMQChatWnd(CXStr *Template):CCustomWnd(Template) { DebugSpew("CMQChatWnd()"); SetWndNotification(CMQChatWnd); BGColor = 0xFF000000;//black background InputBox=(CTextEntryWnd*)GetChildItem("CWChatInput"); InputBox->WindowStyle|=0x800C0; BitOff(WindowStyle,CWS_CLOSE); InputBox->CRNormal=0xFFFFFFFF;//we want a white cursor InputBox->SetMaxChars(512); OutputBox=(CStmlWnd*)GetChildItem("CWChatOutput"); OutStruct=(_CSIDLWND*)GetChildItem("CWChatOutput"); //fix for the 0 parent crash at charselect when clicking the children... //wow it only took us 13 years to fix that one... -eqmule OutStruct->pParentWindow = (_CSIDLWND *)this; OutputBox->pParentWindow = (_CSIDLWND *)this; InputBox->pParentWindow = (_CSIDLWND *)this; OutWnd=(CXWnd*)OutputBox; OutBoxLines=0; *(DWORD*)&(((PCHAR)OutputBox)[EQ_CHAT_HISTORY_OFFSET])=0x190; OutputBox->Clickable=1; iCurrentCmd=-1; ZLayer = 1; // Make this the topmost window (we will leave it as such for charselect, and allow it to move to background ingame) }
ba->length = size * CHAR_BIT; ba->data = g_new(guchar, ba->alloc); fread(ba->data, sizeof(guchar), size, fp); return ba; } void BitArray_append_bit(BitArray *ba, gboolean bit){ register gint64 word = ba->length / CHAR_BIT, pos = ba->length & (CHAR_BIT-1); if(ba->length == (ba->alloc*CHAR_BIT)){ ba->alloc <<= 1; ba->data = g_realloc(ba->data, ba->alloc); memset(ba->data+(ba->alloc>>1), 0, (ba->alloc>>1)); } ba->data[word] = bit?BitOn(ba->data[word], pos) :BitOff(ba->data[word], pos); ba->length++; return; } void BitArray_append(BitArray *ba, guint64 data, guchar width){ register gint64 word = ba->length/ CHAR_BIT, input; register guchar todo = width, bit = ba->length & (CHAR_BIT-1), taken = CHAR_BIT-bit, done = 0; ba->length += width; if(ba->length >= (ba->alloc*CHAR_BIT)){ ba->alloc <<= 1; ba->data = g_realloc(ba->data, ba->alloc); memset(ba->data+(ba->alloc>>1), 0, (ba->alloc>>1));