diff options
author | Max Horn | 2009-03-08 18:58:09 +0000 |
---|---|---|
committer | Max Horn | 2009-03-08 18:58:09 +0000 |
commit | 85f6f204195c0859ecf4119e63d5f53b91fb5684 (patch) | |
tree | d904d63d9e51a7d72c74e749d7f7df59a81fad02 /engines/agos/script_pn.cpp | |
parent | 6c0ac7f692e46d669d992bebf6d386306b6c42e6 (diff) | |
download | scummvm-rg350-85f6f204195c0859ecf4119e63d5f53b91fb5684.tar.gz scummvm-rg350-85f6f204195c0859ecf4119e63d5f53b91fb5684.tar.bz2 scummvm-rg350-85f6f204195c0859ecf4119e63d5f53b91fb5684.zip |
some cleanup
svn-id: r39241
Diffstat (limited to 'engines/agos/script_pn.cpp')
-rw-r--r-- | engines/agos/script_pn.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/engines/agos/script_pn.cpp b/engines/agos/script_pn.cpp index 7b58e46cd8..d508d10c7a 100644 --- a/engines/agos/script_pn.cpp +++ b/engines/agos/script_pn.cpp @@ -711,10 +711,9 @@ int AGOSEngine_PN::inventoryOff() { // ----------------------------------------------------------------------- -static int bitvalue[8] = {128, 64, 32, 16, 8, 4, 2, 1}; - int AGOSEngine_PN::bitextract(uint32 ptr, int offs) { - return ((bitvalue[offs % 8] & _dataBase[ptr + offs / 8]) != 0); + const byte mask = 0x80 >> (offs % 8); + return ((mask & _dataBase[ptr + offs / 8]) != 0); } uint16 AGOSEngine_PN::getptr(uint32 pos) { @@ -823,9 +822,11 @@ void AGOSEngine_PN::writeval(uint8 *ptr, int val) { void AGOSEngine_PN::setbitf(uint32 ptr, int offs, int val) { ptr += offs / 8; - _dataBase[ptr] &= (255 - bitvalue[offs % 8]); + const byte mask = 0x80 >> (offs % 8); if (val != 0) - _dataBase[ptr] |= bitvalue[offs % 8]; + _dataBase[ptr] |= mask; + else + _dataBase[ptr] &= ~mask; } int AGOSEngine_PN::actCallD(int n) { @@ -970,7 +971,7 @@ int AGOSEngine_PN::gvwrd(uint8 *wptr, int mask) { int val, code, q = _dataBase[57]; uint8 *vocbase = _dataBase + getlong(15); while (*vocbase != 255) { - if (*vocbase < 128) { + if (*vocbase < 0x80) { val = vocbase[q] + 256 * vocbase[q + 1]; code = vocbase[q + 2]; } @@ -981,6 +982,8 @@ int AGOSEngine_PN::gvwrd(uint8 *wptr, int mask) { return -1; } + +// FIXME/TODO: Isn't this just scumm_strnicmp ? int AGOSEngine_PN::samewrd(uint8 *w1, uint8 *w2, int ln) { int ct = 0; |