Overview
Comment: | Implement more of the deferred movement (untested so far, although it does compile). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
6bc4ddf9d689eac2b20b22a5e56c4f84 |
User & Date: | user on 2021-04-06 21:21:51 |
Other Links: | manifest | tags |
Context
2021-04-07
| ||
21:59 | Some more additions to sound.c check-in: debe888931 user: user tags: trunk | |
2021-04-06
| ||
21:21 | Implement more of the deferred movement (untested so far, although it does compile). check-in: 6bc4ddf9d6 user: user tags: trunk | |
2021-04-05
| ||
05:50 | Start to implement deferred movement (incomplete and untested so far). check-in: 13bc344828 user: user tags: trunk | |
Changes
Modified exec.c from [bffe9b84f5] to [bd128e8f11].
︙ | |||
2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 | 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - + - - - - + + + + - - - - + - - | v=send_message(n2,n1,MSG_COLLIDING,NVALUE(objects[n2]->x),NVALUE(objects[n2]->y),NVALUE(r2)); if(v.t) Throw("Type mismatch"); h|=v.u; if((h&0x0002) && try_sharp(n1,n2)) h|=0x0004; if((h&0x00020000) && try_sharp(n2,n1)) h|=0x00040000; return h; } static inline Uint8 find_deferred_movement_loop(Uint32 obj,Uint8 xx,Uint8 yy) { // At this point, it is necessary to check for a loop, which may be like the diagram below: // >>>>>>>v // ^<<<< // The loop may also have a different shape. // If a loop is found, call the handle_colliding function to determine what to do next. // If there is no loop, allow the move to be retried later, trying objE's location next. // Since there may be multiple objects in a location, which move in different directions, // a variable "ch" mentions the next object to try, if it is VOIDLINK. If not, then once // it reaches the end without finding a loop, it can try the next one, resetting ch to // VOIDLINK. This will find not only loops, but also if there is a branch that is later // merged; due to what this program needs to do, and how they will be dealt with after // the potential loop is found, that isn't a problem. static sqlite3_uint64 board[64]; // bit board for locations with possible collisions Object*o=objects[obj]; Uint32 ch=VOIDLINK; // first object found in same place as other where it must be checked Uint8 x=o->x; Uint8 y=o->y; Uint32 n,nn; memset(board,0,sizeof(board)); begin: if(x==xx && y==yy) return 1; if(x<1 || x>pfwidth || y<1 || y>pfheight) goto notfound; if(board[y-1]&(1ULL<<(x-1))) return 0; board[y-1]|=1ULL<<(x-1); n=playfield[x+y*64-65]; nn=VOIDLINK; while(n!=VOIDLINK) { o=objects[n]; if((o->oflags&(OF_MOVING|OF_VISUALONLY|OF_DESTROYED))==OF_MOVING && o->height>0) { if(nn==VOIDLINK) { nn=n; if(ch!=VOIDLINK) goto found; } else if(ch==VOIDLINK) { ch=n; goto found; } } up: n=o->up; } if(nn==VOIDLINK) { notfound: if(ch==VOIDLINK) return 0; o=objects[n=ch]; x=o->x; y=o->y; ch=VOIDLINK; goto up; } found: o=objects[nn]; x+=x_delta[o->dir]; y+=y_delta[o->dir]; goto begin; } static Uint32 deferred_colliding(Uint32 obj,int x,int y) { Object*o=objects[obj]; Object*oE; Uint32 h=0xFFFFFFFF; Uint32 objE=playfield[x+y*64-65]; Uint8 d; int xx,yy; while(objE!=VOIDLINK) { oE=objects[objE]; if(!(oE->oflags&(OF_DESTROYED|OF_VISUALONLY))) { |
︙ | |||
2109 2110 2111 2112 2113 2114 2115 | 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 | - + | re=1; o->oflags=(o->oflags|OF_MOVED)&~OF_MOVING; i-=65; if(i<0) i=0; goto retry; } stop: |
︙ |