Rev 5056 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5056 | Rev 5071 | ||
---|---|---|---|
Line 11833... | Line 11833... | ||
11833 | { lastageclock = totalclock; agecache(); } |
11833 | { lastageclock = totalclock; agecache(); } |
11834 | 11834 | ||
11835 | #ifdef USE_OPENGL
|
11835 | #ifdef USE_OPENGL
|
11836 | omdtims = mdtims; mdtims = getticks(); |
11836 | omdtims = mdtims; mdtims = getticks(); |
11837 | 11837 | ||
11838 | {
|
- | |
11839 | int32_t i; |
- | |
11840 | for (i=0; i<MAXSPRITES; i++) |
11838 | for (int i = 0; i < Numsprites; i++) |
11841 | if ((mdpause&&spriteext[i].mdanimtims)||(spriteext[i].flags & SPREXT_NOMDANIM)) |
11839 | if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) |
11842 | spriteext[i].mdanimtims+=mdtims-omdtims; |
11840 | spriteext[i].mdanimtims += mdtims - omdtims; |
11843 | }
|
- | |
11844 | #endif
|
11841 | #endif
|
11845 | 11842 | ||
11846 | beforedrawrooms = 1; |
11843 | beforedrawrooms = 1; |
11847 | numframes++;
|
11844 | numframes++;
|
11848 | }
|
11845 | }
|
Line 17986... | Line 17983... | ||
17986 | // setrollangle
|
17983 | // setrollangle
|
17987 | //
|
17984 | //
|
17988 | #ifdef USE_OPENGL
|
17985 | #ifdef USE_OPENGL
|
17989 | void setrollangle(int32_t rolla) |
17986 | void setrollangle(int32_t rolla) |
17990 | {
|
17987 | {
|
17991 | gtang = (float)rolla * PI * (1.f/1024.f); |
17988 | gtang = (float)rolla * (PI * (1.f/1024.f)); |
17992 | }
|
17989 | }
|
17993 | #endif
|
17990 | #endif
|
17994 | 17991 | ||
17995 | 17992 | ||
17996 | //
|
17993 | //
|
Line 18014... | Line 18011... | ||
18014 | UNREFERENCED_PARAMETER(pal); |
18011 | UNREFERENCED_PARAMETER(pal); |
18015 | UNREFERENCED_PARAMETER(how); |
18012 | UNREFERENCED_PARAMETER(how); |
18016 | #else
|
18013 | #else
|
18017 | if (getrendermode() >= REND_POLYMOST) |
18014 | if (getrendermode() >= REND_POLYMOST) |
18018 | {
|
18015 | {
|
18019 | int32_t hp, np; |
- | |
18020 | - | ||
18021 | const int32_t firstpal = (pal < 0) ? 0 : pal; |
18016 | const int32_t firstpal = (pal < 0) ? 0 : pal; |
18022 | const int32_t numpals = (pal < 0) ? MAXPALOOKUPS : 1; |
18017 | const int32_t numpals = (pal < 0) ? MAXPALOOKUPS : 1; |
18023 | 18018 | ||
18024 | for (hp = 0; hp <= 4; hp+=4) |
18019 | for (int hp = 0; hp <= 4; hp+=4) |
18025 | {
|
18020 | {
|
18026 | if (how & pow2long[hp]) |
18021 | if (how & pow2long[hp]) |
18027 | for (np = firstpal; np < firstpal+numpals; np++) |
18022 | for (int np = firstpal; np < firstpal+numpals; np++) |
18028 | gltexinvalidate(tilenume, np, hp); |
18023 | gltexinvalidate(tilenume, np, hp); |
18029 | }
|
18024 | }
|
18030 | 18025 | ||
18031 | #ifdef POLYMER
|
18026 | #ifdef POLYMER
|
18032 | if (getrendermode() == REND_POLYMER) |
18027 | if (getrendermode() == REND_POLYMER) |
Line 18045... | Line 18040... | ||
18045 | {
|
18040 | {
|
18046 | #ifdef USE_OPENGL
|
18041 | #ifdef USE_OPENGL
|
18047 | if (getrendermode() < REND_POLYMOST) return; |
18042 | if (getrendermode() < REND_POLYMOST) return; |
18048 | 18043 | ||
18049 | bglViewport(0,0,xres,yres); |
18044 | bglViewport(0,0,xres,yres); |
- | 18045 | ||
18050 | bglMatrixMode(GL_PROJECTION); |
18046 | bglMatrixMode(GL_PROJECTION); |
18051 | bglLoadIdentity(); |
18047 | bglLoadIdentity(); |
18052 | bglOrtho(0,xres,yres,0,-1,1); |
18048 | bglOrtho(0,xres,yres,0,-1,1); |
- | 18049 | ||
- | 18050 | if (getrendermode() == REND_POLYMER) |
|
- | 18051 | {
|
|
18053 | bglMatrixMode(GL_MODELVIEW); |
18052 | bglMatrixMode(GL_MODELVIEW); |
18054 | bglLoadIdentity(); |
18053 | bglLoadIdentity(); |
- | 18054 | }
|
|
18055 | 18055 | ||
18056 | gloy1 = -1; |
18056 | gloy1 = -1; |
18057 | 18057 | ||
18058 | bglDisable(GL_DEPTH_TEST); |
18058 | bglDisable(GL_DEPTH_TEST); |
18059 | bglDisable(GL_TEXTURE_2D); |
18059 | bglDisable(GL_TEXTURE_2D); |
Line 18067... | Line 18067... | ||
18067 | t->items=(hashitem_t **)Xcalloc(1, t->size * sizeof(hashitem_t)); |
18067 | t->items=(hashitem_t **)Xcalloc(1, t->size * sizeof(hashitem_t)); |
18068 | }
|
18068 | }
|
18069 | 18069 | ||
18070 | void hash_free(hashtable_t *t) |
18070 | void hash_free(hashtable_t *t) |
18071 | {
|
18071 | {
|
18072 | hashitem_t *cur, *tmp; |
- | |
18073 | int32_t i; |
- | |
18074 | int32_t num; |
- | |
18075 | - | ||
18076 | if (t->items == NULL) |
18072 | if (t->items == NULL) |
18077 | return; |
18073 | return; |
18078 | // initprintf("*free, num:%d\n",t->size);
|
- | |
- | 18074 | ||
18079 | i= t->size-1; |
18075 | int remaining = t->size - 1; |
- | 18076 | ||
18080 | do
|
18077 | do
|
18081 | {
|
18078 | {
|
18082 | cur = t->items[i]; |
18079 | hashitem_t *cur = t->items[remaining]; |
- | 18080 | ||
18083 | num = 0; |
18081 | int num = 0; |
- | 18082 | ||
18084 | while (cur) |
18083 | while (cur) |
18085 | {
|
18084 | {
|
18086 | tmp = cur; |
18085 | hashitem_t * const tmp = cur; |
18087 | cur = cur->next; |
18086 | cur = cur->next; |
18088 | // initprintf("Free %4d \"%s\"\n",tmp->key,(tmp->string)?tmp->string:".");
|
- | |
- | 18087 | ||
18089 | if (tmp->string) |
18088 | if (tmp->string) |
18090 | {
|
18089 | {
|
18091 | Bfree(tmp->string); |
18090 | Bfree(tmp->string); |
18092 | tmp->string = NULL; |
18091 | tmp->string = NULL; |
18093 | }
|
18092 | }
|
18094 | Bfree(tmp); |
18093 | Bfree(tmp); |
18095 | num++;
|
18094 | num++;
|
18096 | }
|
18095 | }
|
18097 | // initprintf("#%4d: %3d\t",i,num);
|
18096 | } while (--remaining >= 0); |
18098 | }
|
18097 | |
18099 | while (--i > -1); |
- | |
18100 | Bfree(t->items); |
18098 | Bfree(t->items); |
18101 | t->items = 0; |
18099 | t->items = 0; |
18102 | }
|
18100 | }
|
18103 | 18101 | ||
18104 | // djb3 algorithm
|
18102 | // djb3 algorithm
|
Line 18113... | Line 18111... | ||
18113 | return h; |
18111 | return h; |
18114 | }
|
18112 | }
|
18115 | 18113 | ||
18116 | void hash_add(hashtable_t *t, const char *s, intptr_t key, int32_t replace) |
18114 | void hash_add(hashtable_t *t, const char *s, intptr_t key, int32_t replace) |
18117 | {
|
18115 | {
|
18118 | hashitem_t *cur, *prev=NULL; |
- | |
18119 | int32_t code; |
- | |
18120 | - | ||
18121 | if (EDUKE32_PREDICT_FALSE(t->items == NULL)) |
18116 | if (EDUKE32_PREDICT_FALSE(t->items == NULL)) |
18122 | {
|
18117 | {
|
18123 | initprintf("hash_add(): table not initialized!\n"); |
18118 | initprintf("hash_add(): table not initialized!\n"); |
18124 | return; |
18119 | return; |
18125 | }
|
18120 | }
|
18126 | 18121 | ||
18127 | code = hash_getcode(s) % t->size; |
18122 | uint32_t code = hash_getcode(s) % t->size; |
18128 | cur = t->items[code]; |
18123 | hashitem_t *cur = t->items[code]; |
18129 | 18124 | ||
18130 | if (!cur) |
18125 | if (!cur) |
18131 | {
|
18126 | {
|
18132 | cur = (hashitem_t *)Xcalloc(1,sizeof(hashitem_t)); |
18127 | cur = (hashitem_t *)Xcalloc(1,sizeof(hashitem_t)); |
18133 | cur->string = Xstrdup(s); |
18128 | cur->string = Xstrdup(s); |
Line 18135... | Line 18130... | ||
18135 | cur->next = NULL; |
18130 | cur->next = NULL; |
18136 | t->items[code] = cur; |
18131 | t->items[code] = cur; |
18137 | return; |
18132 | return; |
18138 | }
|
18133 | }
|
18139 | 18134 | ||
- | 18135 | hashitem_t *prev = NULL; |
|
- | 18136 | ||
18140 | do
|
18137 | do
|
18141 | {
|
18138 | {
|
18142 | if (Bstrcmp(s,cur->string) == 0) |
18139 | if (Bstrcmp(s,cur->string) == 0) |
18143 | {
|
18140 | {
|
18144 | if (replace) cur->key = key; |
18141 | if (replace) cur->key = key; |
Line 18156... | Line 18153... | ||
18156 | }
|
18153 | }
|
18157 | 18154 | ||
18158 | // delete at most once
|
18155 | // delete at most once
|
18159 | void hash_delete(hashtable_t *t, const char *s) |
18156 | void hash_delete(hashtable_t *t, const char *s) |
18160 | {
|
18157 | {
|
18161 | hashitem_t *cur, *prev=NULL; |
- | |
18162 | int32_t code; |
- | |
18163 | - | ||
18164 | if (t->items == NULL) |
18158 | if (t->items == NULL) |
18165 | {
|
18159 | {
|
18166 | initprintf("hash_delete(): table not initialized!\n"); |
18160 | initprintf("hash_delete(): table not initialized!\n"); |
18167 | return; |
18161 | return; |
18168 | }
|
18162 | }
|
18169 | 18163 | ||
18170 | code = hash_getcode(s) % t->size; |
18164 | uint32_t code = hash_getcode(s) % t->size; |
18171 | cur = t->items[code]; |
18165 | hashitem_t *cur = t->items[code]; |
18172 | 18166 | ||
18173 | if (!cur) |
18167 | if (!cur) |
18174 | return; |
18168 | return; |
18175 | 18169 | ||
- | 18170 | hashitem_t *prev = NULL; |
|
- | 18171 | ||
18176 | do
|
18172 | do
|
18177 | {
|
18173 | {
|
18178 | if (Bstrcmp(s,cur->string) == 0) |
18174 | if (Bstrcmp(s, cur->string) == 0) |
18179 | {
|
18175 | {
|
18180 | Bfree(cur->string); |
18176 | Bfree(cur->string); |
Line 18184... | Line 18180... | ||
18184 | else
|
18180 | else
|
18185 | prev->next = cur->next; |
18181 | prev->next = cur->next; |
18186 | 18182 | ||
18187 | Bfree(cur); |
18183 | Bfree(cur); |
18188 | 18184 | ||
18189 | return; |
18185 | break; |
18190 | }
|
18186 | }
|
18191 | prev = cur; |
18187 | prev = cur; |
18192 | }
|
18188 | }
|
18193 | while ((cur = cur->next)); |
18189 | while ((cur = cur->next)); |
18194 | }
|
18190 | }
|
18195 | 18191 | ||
18196 | intptr_t hash_find(const hashtable_t *t, const char *s) |
18192 | intptr_t hash_find(const hashtable_t *t, const char *s) |
18197 | {
|
18193 | {
|
18198 | hashitem_t *cur; |
- | |
18199 | - | ||
18200 | if (t->items == NULL) |
18194 | if (t->items == NULL) |
18201 | {
|
18195 | {
|
18202 | initprintf("hash_find(): table not initialized!\n"); |
18196 | initprintf("hash_find(): table not initialized!\n"); |
18203 | return -1; |
18197 | return -1; |
18204 | }
|
18198 | }
|
18205 | 18199 | ||
18206 | if ((cur = t->items[hash_getcode(s) % t->size]) == NULL) return -1; |
18200 | hashitem_t *cur = t->items[hash_getcode(s) % t->size]; |
- | 18201 | ||
- | 18202 | if (!cur) |
|
- | 18203 | return -1; |
|
18207 | 18204 | ||
18208 | do
|
18205 | do
|
18209 | if (Bstrcmp(s,cur->string) == 0) |
18206 | if (Bstrcmp(s, cur->string) == 0) |
18210 | return cur->key; |
18207 | return cur->key; |
18211 | while ((cur = cur->next)); |
18208 | while ((cur = cur->next)); |
Line 18213... | Line 18210... | ||
18213 | return -1; |
18210 | return -1; |
18214 | }
|
18211 | }
|
18215 | 18212 | ||
18216 | intptr_t hash_findcase(const hashtable_t *t, const char *s) |
18213 | intptr_t hash_findcase(const hashtable_t *t, const char *s) |
18217 | {
|
18214 | {
|
18218 | hashitem_t *cur; |
- | |
18219 | 18215 | ||
18220 | if (t->items == NULL) |
18216 | if (t->items == NULL) |
18221 | {
|
18217 | {
|
18222 | initprintf("hash_findcase(): table not initialized!\n"); |
18218 | initprintf("hash_findcase(): table not initialized!\n"); |
18223 | return -1; |
18219 | return -1; |
18224 | }
|
18220 | }
|
18225 | 18221 | ||
18226 | if ((cur=t->items[hash_getcode(s)%t->size]) == NULL) return -1; |
18222 | hashitem_t *cur = t->items[hash_getcode(s) % t->size]; |
- | 18223 | ||
- | 18224 | if (!cur) |
|
- | 18225 | return -1; |
|
18227 | 18226 | ||
18228 | do
|
18227 | do
|
18229 | if (Bstrcasecmp(s,cur->string) == 0) |
18228 | if (Bstrcasecmp(s, cur->string) == 0) |
18230 | return cur->key; |
18229 | return cur->key; |
18231 | while ((cur=cur->next)); |
18230 | while ((cur = cur->next)); |